diff --git a/ICLR/2025/Segment Any 3D Object with Language/433d7e24-a16c-4113-9609-65f6d182288b_content_list.json b/ICLR/2025/Segment Any 3D Object with Language/433d7e24-a16c-4113-9609-65f6d182288b_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..4e8d7ca122717b7a2758a26808ad0f7e1c1d1fe8 --- /dev/null +++ b/ICLR/2025/Segment Any 3D Object with Language/433d7e24-a16c-4113-9609-65f6d182288b_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:347b752e95590932aee8740c06115c528fdeb7aa4f797c0ef0474b05716a04ce +size 137693 diff --git a/ICLR/2025/Segment Any 3D Object with Language/433d7e24-a16c-4113-9609-65f6d182288b_model.json b/ICLR/2025/Segment Any 3D Object with Language/433d7e24-a16c-4113-9609-65f6d182288b_model.json new file mode 100644 index 0000000000000000000000000000000000000000..b73984b2dc199cf893cee04696553c77a530a8a4 --- /dev/null +++ b/ICLR/2025/Segment Any 3D Object with Language/433d7e24-a16c-4113-9609-65f6d182288b_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:42de2bc42120825c9f29ce98885f913be2ed7ddd1deadd00dbddeb41b06db168 +size 172937 diff --git a/ICLR/2025/Segment Any 3D Object with Language/433d7e24-a16c-4113-9609-65f6d182288b_origin.pdf b/ICLR/2025/Segment Any 3D Object with Language/433d7e24-a16c-4113-9609-65f6d182288b_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..b79394a3ab0cd9845acf61718a8544fd63a06485 --- /dev/null +++ b/ICLR/2025/Segment Any 3D Object with Language/433d7e24-a16c-4113-9609-65f6d182288b_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2e135a820aa290d04bb76aad86629994d82917305a1c09155e116869afd1ec90 +size 41816908 diff --git a/ICLR/2025/Segment Any 3D Object with Language/full.md b/ICLR/2025/Segment Any 3D Object with Language/full.md new file mode 100644 index 0000000000000000000000000000000000000000..7f7e0fbb577f370d0c8cf41774a556e83d53c8e1 --- /dev/null +++ b/ICLR/2025/Segment Any 3D Object with Language/full.md @@ -0,0 +1,531 @@ +# SEGMENT ANY 3D OBJECT WITH LANGUAGE + +Seungjun Lee*, Yuyang Zhao, Gim Hee Lee + +Department of Computer Science, National University of Singapore +{seungjun.lee, yuyang.zhao, gimhee.lee}@comp.nus.edu.sg +https://cvrp-sole.github.io + +![](images/b523dc50df5ea6d727f6c29c04439b807f6e30ad4ba167a4b9c05f4f8a20d7b7.jpg) +(a) "Can I wash my hands?" + +![](images/48af3878f73af46954d757c34b547c0232c3d8139f90325d240672dc80e02c4d.jpg) +(b) "Brown Furnitures." +Figure 1: Qualitative results of SOLE with various language instructions. SOLE is highly generalizable and can segment corresponding instances with various language instructions, including but not limited to (a) visual questions, (b) attributes description, and (c) functional description. + +![](images/dba26bc6ea45aea4c6c12299e7aba5bd9156d109134b66def2e1e895357b47dc.jpg) +(c) "Device to play game." + +# ABSTRACT + +In this paper, we investigate Open-Vocabulary 3D Instance Segmentation (OV-3DIS) with free-form language instructions. Earlier works mainly rely on annotated base categories for training which leads to limited generalization to unseen novel categories. To mitigate the poor generalizability to novel categories, recent works generate class-agnostic masks or projecting generalized masks from 2D to 3D, subsequently classifying them with the assistance of 2D foundation model. However, these works often disregard semantic information in the mask generation, leading to sub-optimal performance. Instead, generating generalizable but semantic-aware masks directly from 3D point clouds would result in superior outcomes. To the end, we introduce Segment any 3D Object with LanguagE (SOLE), which is a semantic and geometric-aware visual-language learning framework with strong generalizability by generating semantic-related masks directly from 3D point clouds. Specifically, we propose a multimodal fusion network to incorporate multimodal semantics in both backbone and decoder. In addition, to align the 3D segmentation model with various language instructions and enhance the mask quality, we introduce three types of multimodal associations as supervision. Our SOLE outperforms previous methods by a large margin on ScanNetv2, ScanNet200, and Replica benchmarks, and the results are even closed to the fully-supervised counterpart despite the absence of class annotations in the training. Furthermore, extensive qualitative results demonstrate the versatility of our SOLE to language instructions. + +# 1 INTRODUCTION + +3D instance segmentation which aims at detecting, segmenting and recognizing object instances in 3D scenes is one of the crucial tasks for 3D scene understanding. Effective and generalizable 3D instance segmentation has great potential in real-world applications, including but not limited to autonomous driving, augmented reality (AR), and virtual reality (VR). Owing to its significance, 3D instance segmentation has achieved remarkable success in the computer vision community (Schult et al., 2022; Vu et al., 2022; He et al., 2022). Previous 3D instance segmentation models mainly focus on the closed-set setting, where the training and testing stages share the same categories. However, novel and unseen categories with various shapes and semantic meaning are inevitable in real-world applications. Failure to segment such instances drastically narrows the scope of application. + +![](images/95e43230f9d158a50d2ee1a7c60de0a48396ea4f7bc71cacb717750a7c4af857.jpg) +(a) Class agnostic 3D masks and classification + +![](images/04824bac0671b7f46625edcfbc635ca5dcfb3078aaf0529b1539c602e9ce45e8.jpg) +Figure 2: Left (a): Previous works train class-agnostic mask proposal module with only using mask annotations. In the inference time, generated 3D masks are projected to 2D images and subsequently classified with the help of 2D foundation model. Right (b): In contrast, we train semantic-aware mask proposal module with giving Multi-Modal Associations (MMA) and mask annotations as supervision. With regarding both geometry and semantic information in the mask generation, our SOLE can produce highly generalizable segments. + +![](images/3564e2ed78b3c785bb2c1fcdbf42993d698db12550b0605c6579fdc26c7c4c8f.jpg) +(b) Semantic-aware 3D masks (ours) + +![](images/aca291c53a42279bfaae60c56ddbef59a53ed1738793087f3310d574e5cdb731.jpg) + +In view of the strong limitations of closed-set setting, open-set 3D instance segmentation (OS-3DIS) that aims at detecting and segmenting unseen classes based on instructions is introduced and investigated in the community. Most of the works (Huang et al., 2023b; Ding et al., 2022b; Nguyen et al., 2024) leverage category names or descriptions as segmentation instructions, which is also termed as open-vocabulary 3D instance segmentation (OV-3DIS). The early approaches (Ding et al., 2022b; Yang et al., 2023; Ding et al., 2023) split categories in each dataset into base and novel set. Only base categories are available in the training stage, but the model is expected to segment novel categories during inference. Due to the lack of novel classes during training, these methods easily overfit to the base categories and thus yielding sub-optimal performance on novel categories. In addition, they suffer from severe performance degradation when they are evaluated on the data with different distributions. In this regards, recent works (Takmaz et al., 2023; Huang et al., 2023b; Yan et al., 2024; Lu et al., 2023) explore more generalizable OV-3DIS with the help of 2D foundation models (Radford et al., 2021; Oquab et al., 2023; Zhou et al., 2022b). Specifically, Nguyen et al. (2024); Takmaz et al. (2023); Huang et al. (2023b) learn class-agnostic 3D masks from mask annotation and then project the point clouds to 2D images to obtain class labels from foundation models (Fig. 2a). Yan et al. (2024); Lu et al. (2023); Yin et al. (2024) predict 2D instances with 2D open-vocabulary instance segmentation model (Zhou et al., 2022b) and fuse them to obtain 3D predictions. However, class-agnostic masks and 2D projected masks ignore the semantic and geometry information in the mask generation, respectively, leading to the sub-optimal performance (details in Appendix. E.1). To this end, we investigate the OV-3DIS problem from the perspective of mask generator in this paper (Fig. 2b). We propose the semantic-aware mask generator to obtain semantic-related masks from 3D point clouds, yielding better and more generalizable 3D masks. + +In this paper, we propose SOLE: Segment any 3D Object with Language to circumvent the above-mentioned issues for OV-3DIS. To realize generalizable open-set 3D instance segmentation, our SOLE requires two main attributes: generating and classifying 3D masks directly from 3D point clouds, and responsive to free-form language instructions. The 3D segmentation network is required to be aligned with language instructions to directly segment and classify instances from point clouds. To this end, we build a multimodal fusion network with two main techniques: 1) Point-wise CLIP features obtained from pre-trained multimodal 2D segmentation model (Ghiasi et al., 2022) are incorporated to the backbone to enhance the generality of the model; 2) Cross-modality decoder is introduced to integrate information from language-domain features, facilitating the effective fusion of multimodal knowledge. Furthermore, we improve the generalization ability across various scene and language instructions with a novel visual-language learning framework, training the 3D segmentation network with three types of multimodal associations: 1) Mask-visual association aligns the 3D visual information with 2D visual information in the foundation model; 2) mask-caption association aims at enabling the mask generation and classification from various language forms; and 3) mask-entity association introduces fine-grained textual information into the framework, enhancing the ability of instance segmentation. These associations improve the language instruction alignment and enhance the 3D mask prediction with more abundant semantic information. + +Equipped with a multimodal fusion network and three types of multimodal associations, our visual-language learning framework (SOLE) outperforms previous works by a large margin on ScanNetv2 (Dai et al., 2017), ScanNet200 (Rozenberszki et al., 2022) and Replica (Straub et al., 2019) benchmarks. Furthermore, SOLE can respond to free-form queries, including but not limited to + +questions, attributes description, and functional description (Fig. 1 and Fig. 7). In summary, our contributions are as follows: + +- We propose a visual-language learning framework for OV-3DIS, SOLE. A multimodal fusion network is designed for SOLE, which can directly predict semantic-related masks from 3D point clouds with multimodal information, leading to high-quality and generalizable segments. +- We propose three types of multimodal associations to improve the alignment between 3D segmentation model with the language. The associations improve the mask quality and the response ability to language instructions. +- SOLE achieves state-of-the-art results on ScanNetv2, Scannet200 and Replica benchmarks, and the results are even close to the fully-supervised counterpart. In addition, extensive qualitative results demonstrate that SOLE can respond to various language questions and instructions. + +# 2 RELATED WORK + +Closed-Set 3D Instance Segmentation. 3D instance segmentation aims at detecting, segmenting and recognizing the object instances in 3D scenes. Previous works (He et al., 2021; 2022; Ngo et al., 2023; Schult et al., 2022; Sun et al., 2023; Vu et al., 2022; Yi et al., 2019; Zhang et al., 2021; Hou et al., 2019; Yang et al., 2019a; Chen et al., 2021; Dong et al., 2022; Jiang et al., 2020; Liu et al., 2022; Wu et al., 2022) mainly consider the closed-set setting, where the training and testing categories are the same. These methods vary in feature extraction and decoding process. With the development of transformer models, mask prediction becomes a more efficient and effective way than traditional box detection decoding approaches. Mask3D (Schult et al., 2022) samples a fixed number of points across the scene as queries, and then directly predicts the final masks with attention mechanism, achieving better results. However, closed-set methods lack the capability to handle the unseen categories and thus hindering their application in the real world. + +Open-Vocabulary 2D Segmentation. Owing to the recent success of large-scale vision-language models (Alayrac et al., 2022; Cherti et al., 2023; Girdhar et al., 2023; Jia et al., 2021; Radford et al., 2021; Yu et al., 2022; Yuan et al., 2021), notable achievements have been made in open-vocabulary or zero-shot 2D segmentation (Ding et al., 2022a; Ghiasi et al., 2022; Gu et al., 2021; He et al., 2023; Kuo et al., 2022; Li et al., 2022; Liang et al., 2023; Ma et al., 2022; Rao et al., 2022; Xu et al., 2022; Zabari & Hoshen, 2021; Zhou et al., 2022a; Cho et al., 2023; Ma et al., 2023; Yuan et al., 2024). The common key idea is to leverage 2D multit-modal foundation models (Radford et al., 2021; Jia et al., 2021) for the transfer of image-level embeddings to the pixel-level downstream tasks. LSeg (Li et al., 2022), OpenSeg (Ghiasi et al., 2022), and OVSeg (Liang et al., 2023) align pixel-level or mask-level visual features to text features from foundation model for open-vocabulary semantic segmentation. Recently, Open-Vocabulary SAM (Yuan et al., 2024) integrates CLIP and SAM, further exploring interactive open-world tasks. Other works such as X-Decoder (Zou et al., 2023), FreeSeg (Qin et al., 2023) and SEEM (Zou et al., 2024) suggest more unified-framework for open-vocabulary segmentation, include instance, panoptic, and referring segmentation. + +Open-Vocabulary 3D Scene Understanding. The remarkable success achieved in open-vocabulary 2D segmentation (OV-2DS) has spurred several endeavors in open-vocabulary 3D segmentation. However, the techniques in OV-2DS cannot be directly transferred to the 3D domain due to the lack of 3D multimodal foundation model. Consequently, researchers propose to align 2D images and 3D point clouds and thus lifting 2D foundation models to 3D. For open-vocabulary 3D semantic segmentation, (Chen et al., 2023; Ding et al., 2022b; Ha & Song, 2022; Huang et al., 2023a; Jatavallabhula et al., 2023; Peng et al., 2023; Shafiullah et al., 2022; Shah et al., 2023) construct task-agnostic point-wise feature representations from 2D foundation models (Radford et al., 2021), and then use these features to query the open-vocabulary concepts within 3D scene. These works focus purely on transferring semantic information from 2D to 3D, limiting the application for instance-level recognition tasks. In this regard, open-vocabulary 3D instance segmentation (OV-3DIS) (Ding et al., 2023; Huang et al., 2023b; Takmaz et al., 2023; Lu et al., 2023; Nguyen et al., 2024; Yan et al., 2024) is introduced to detect and segment instances of various categories in 3D scenes. PLA (Ding et al., 2022b) and its variants (Yang et al., 2023; Ding et al., 2023) split the training categories into base and novel classes, and train the model only with base class annotation. OpenMask3D (Takmaz et al., 2023) and OpenIns3D (Huang et al., 2023b) learn class-agnostic 3D masks from mask annotations and then use the corresponding 2D images to obtain class labels from foundation models. With + +![](images/573c16557b7f82074e3964a61bb038195ba86b00aed0d13458f7a7a6c697e5b1.jpg) +Figure 3: Overall framework of SOLE. SOLE is built on transformer-based instance segmentation model with multimodal adaptations. For model architecture, backbone features are integrated with per-point CLIP features and subsequently fed into the cross-modality decoder (CMD). CMD aggregates the point-wise features and textual features into the instance queries, finally segmenting the instances, which are supervised by multimodal associations. During inference, predicted mask features are combined with the per-point CLIP features, enhancing the open-vocabulary performance. + +![](images/7b50e71d5a61dea6e8f59435e004c5f358c9c01b0e045cd3b89fa161d5d64f4c.jpg) + +following similar paradigm, Open3DIS (Nguyen et al., 2024) further improves the quality of masks by fusing 3D segments and 2D masks. Recently, researchers also investigate direct lifting of 2D predictions from 2D instance segmentation model (Zhou et al., 2022b) to 3D without training (Yan et al., 2024; Lu et al., 2023; Yin et al., 2024). However, previous works often disregard semantic information in the mask generation, leading to the poor semantic generalization ability. Considering the limitations of previous works, we significantly improve OV-3DIS by designing a visual-language learning framework with a multimodal network and various multimodal associations. + +# 3 METHOD + +Objective. The goal of open-vocabulary 3D instance segmentation (OV-3DIS) with free-form language instructions is defined as follows: Given a 3D point cloud $\mathbf{P} \in \mathbb{R}^{M \times C}$ , the corresponding 2D images $I$ and the instance-level 3D masks $\mathbf{m}$ , we aim to train a 3D instance segmentation network without ground-truth class annotations. During inference, given a text prompt $q$ , the trained 3D instance segmentation network must detect and segment corresponding instances. + +Mask-Prediction Baseline. We build our framework on the transformer-based 3D instance segmentation model Mask3D (Schult et al., 2022), which treats the instance segmentation task as the mask prediction paradigm. Specifically, the transformer decoders with mask queries are used to segment instances. Given $N_{q}$ queries selected from the scene, cross attention is used to aggregate information from the point clouds to instance queries. After several decoder layers, $N_{q}$ queries become $N_{q}$ masks with corresponding semantic prediction. During training, Hungarian matching (Kuhn, 1955) is adopted to match and train the model with ground truth labels and masks. At the inference stage, $N_{q}$ masks with correct semantic classification results are taken as the final outputs. Our SOLE leverages the mask prediction paradigm with transformer-based architecture, where the model is only trained with masks without ground truth labels to achieve generalizable OV-3DIS. + +Overview. The overall architecture of SOLE is illustrated in Fig. 3. To realize open-vocabulary instance segmentation with free-form language instructions, we improve the transformer-based instance segmentation model with multimodal information: point-wise CLIP features in the backbone (Sec. 3.1) and textual information in the decoder (Sec. 3.2). Furthermore, to achieve better generalization ability without ground truth class labels, we construct three types of multimodal associations on target instances: mask-visual association, mask-caption association and mask-entity association + +![](images/07b6e732876e9011077ed55223c4a204d587cbe798f6daa999e96c5cb53b8b92.jpg) +Figure 4: Three types of multimodal association instance. For each ground truth instance mask, we first pool the per-point CLIP features to obtain Mask-Visual Association $\mathbf{f}^{\mathrm{MVA}}$ . Subsequently, $\mathbf{f}^{\mathrm{MVA}}$ is fed into CLIP space captioning model to generate caption and corresponding textual feature $\mathbf{f}^{\mathrm{MCA}}$ for each mask, termed as Mask-Caption Association. Finally, noun phrases are extracted from mask caption and the embeddings of them are aggregated via multimodal attention to get Mask-Entity Association $\mathbf{f}^{\mathrm{MEA}}$ . The three multimodal associations are used for supervising SOLE to acquire the ability to segment 3D objects with free-form language instructions. + +to train SOLE. Equipped with the multimodal framework and associations, our SOLE can effectively segment instances given various language prompts. + +# 3.1 BACKBONE FEATURE ENSEMBLE + +Initializing the backbone with pre-trained model (Jia et al., 2022; Zhao et al., 2023b;a) is an efficient and effective way to improve the performance on the downstream tasks, especially when the downstream data is not in abundance. For 3D open-set setting, leveraging 2D foundation model is crucial due to the limited 3D data. We thus follow (Peng et al., 2023) to project pre-trained visual features of 2D images to 3D point clouds based on the camera pose. To maintain the fine-grained and generalizable features, we leverage OpenSeg (Ghiasi et al., 2022) as the 2D backbone. These features contain visual information in the CLIP (Radford et al., 2021) feature space, which is aligned with textual information. + +Since CLIP feature space mainly focuses on semantic information due to the image-level contrastive training, leveraging the projected features solely cannot achieve optimal performance on instance segmentation. To this end, we train a 3D instance segmentation backbone and combine its features $\mathbf{f}^b\in \mathbb{R}^{M\times D}$ with the projected 2D CLIP features $\mathbf{f}^p\in \mathbb{R}^{M\times C}$ : + +$$ +\tilde {\mathbf {f}} ^ {b} = \operatorname {c o n c a t} \left(\mathbf {f} ^ {p}, \mathbf {f} ^ {b}\right) \in \mathbb {R} ^ {M \times (C + D)}, \tag {1} +$$ + +where $M$ denotes the number of points while $D$ and $C$ denote the feature dimension of 3D instance segmentation backbone and the projected 2D features, respectively. Note that features of different resolutions are extracted from the 3D backbone and respectively incorporated with the 2D CLIP features. As illustrated in Fig. 3, the same pooling strategy with 3D backbone is adopted to CLIP features, aligning the resolution. Finally, incorporated point-wise features with multiple resolutions are fed into cross modality decoder. + +# 3.2 CROSS MODALITY DECODER (CMD) + +Projected 2D CLIP features provide generalizable visual information but the language information is not explicitly integrated, limiting the responsive ability to language instructions. To circumvent this issue, we introduce Cross Modality Decoder (CMD) to incorporate textual information in the decoding process of our framework. Specifically, each CMD module contains three attention layers. Instance queries first extract visual information from the CLIP-combined backbone features $\tilde{\mathbf{f}}^b$ . + +CLIP textual features are then projected to key and value in the second attention layer, incorporating the text domain knowledge. During the training, CLIP textual features are obtained from the caption features of each target mask, $\mathbf{f}^{\mathrm{MCA}}\in \mathbb{R}^{N_c\times C}$ (See Sec. 3.3 for details), whereas, during the inference, it can be the description of the query instance or other form of language instructions, such as visual questions or functional attributes. Finally, self-attention is applied to the instance queries to further improve the representation. By fusing the multimodal knowledge from CLIP with multilevel CMD as the decoder, SOLE can respond to various language instructions with high-quality results. + +# 3.3 VISION-LANGUAGE LEARNING + +We do vision-language learning to enable our SOLE towards generalizable OV-3DIS. To respond effectively to various language instructions, we leverage multimodal information stemming from target mask annotations, to supervise the segmentation network. Specifically, three types of supervision in hierarchical granularity are proposed: 1) mask-visual association, 2) mask-caption association and 3) mask-entity association. + +Mask-Visual Association (MVA). Using the correspondence between 2D images and 3D point clouds, we can get the instance-level CLIP visual features $\mathbf{f}^{\mathrm{MVA}} \in \mathbb{R}^{N_m \times C}$ by averaging the perpoint CLIP features within the $N_m$ target instance masks $\mathbf{m} = [m_1, m_2, \dots, m_{N_m}]$ . The instance-level CLIP visual features can serve as the supervision to indirectly align the 3D segmentation model to CLIP textual space. In addition, as the intermediate representation between 3D point cloud and language, the mask-visual association is also the basis for the following two fine-grained associations. + +Mask-Caption Association (MCA). Despite being in the CLIP feature space, mask-visual association is not an accurate and precision language supervision. Instead, directly supervising the model with language instructions would yield better results. Due to the strong generalization ability of CLIP (Radford et al., 2021), text generation from CLIP space is widely investigated in the community (Tewel et al., 2022; Mokady et al., 2021; Li et al., 2023). Since the instance-level CLIP visual features $\mathbf{f}^{\mathrm{MVA}}$ in the mask-visual association is in CLIP visual space, we can feed them to the CLIP space caption generation model (DeCap (Li et al., 2023)) to obtain the mask captions $\mathbf{c} = [c_1, c_2, \dots, c_{N_m}]$ . The mask captions are then fed into CLIP textual model to extract the mask-caption association $\mathbf{f}^{\mathrm{MCA}}$ . This association represents the language information for the instance masks, used in CMD to fuse textual information during the training. + +Mask-Entity Association (MEA). Although mask-caption association can provide detailed language descriptions for both semantics and geometry, it may be ambiguous for specific categories. As shown in the example of Fig. 4. The mask caption for a desk is "A wooden desk with a chair in a room". Such caption can lead to the confusion of the model between the chair and the desk, or misinterpretation of the two instances as a single one. It is therefore important to introduce a more fine-grained visual-language association for better semantic learning. + +Since the objects are commonly the nouns in the caption, we can extract the entity-level descriptions for the nouns and match them with the instances. Specifically, as illustrated in Fig. 4, we first extract all the noun phrases $\mathbf{e}_i$ for each mask caption $c_i$ and obtain the text feature of each noun phrase from CLIP text encoder $\mathcal{T}$ as below: + +$$ +\mathcal {E} \left(c _ {i}\right) = \mathbf {e} _ {i} = \left[ e _ {1}, e _ {2}, \dots , e _ {N _ {e} ^ {i}} \right], \quad \mathbf {f} _ {i} ^ {\mathbf {e}} = \mathcal {T} \left(\mathbf {e} _ {i}\right) \in \mathbb {R} ^ {N _ {e} ^ {i} \times C}, \tag {2} +$$ + +where $\mathcal{E}(\cdot)$ denotes the NLP tool to extract noun phrases and $N_{e}^{i}$ denotes the number of nouns obtained from mask caption $c_{i}$ . The entities can be matched to the mask in either a hard or soft manner. Intuitively, the most similar entity can be viewed as the mask label. However, there are two main issues with such a hard matching. First, the generated caption and the similarity results may not be accurate, leading to wrong supervision. Second, although the entity is correct, hard matching ignores the geometry information in the context and thus impairing the responsive ability to language instructions. To this end, we propose a soft matching to get mask-entity association by multimodal attention. Specifically, the aggregated entity feature for the $i$ -th mask $\mathbf{f}_{i}^{\mathrm{MEA}}$ is obtained based on the attention map $A_{c,e}$ constructed by cosine similarity $\cos (\cdot ,\cdot)$ between mask feature and + +entity features: + +$$ +\mathbf {f} _ {i} ^ {\mathrm {M E A}} = A _ {c, e} \cdot \mathbf {f} _ {i} ^ {\mathrm {e}} = \sum_ {k} ^ {N _ {e} ^ {i}} \frac {\exp \left(\cos \left(\mathbf {f} _ {i} ^ {\mathrm {M V A}} , \mathbf {f} _ {i} ^ {e _ {k}}\right)\right)}{\sum_ {j} ^ {N _ {e} ^ {i}} \exp \left(\cos \left(\mathbf {f} _ {i} ^ {\mathrm {M V A}} , \mathbf {f} _ {i} ^ {e _ {j}}\right)\right)} \cdot \mathbf {f} _ {i} ^ {e _ {k}}, \tag {3} +$$ + +where $\mathbf{f}_i^{\mathrm{MVA}}$ denotes the mask-visual association feature for $i$ -th mask, and $\mathbf{f}_i^{e_k}$ is the CLIP textual feature for $k$ -th entity in the $i$ -th mask caption. With the aggregated entity feature, the 3D mask can be aligned with a specific instance category. + +# 3.4 TRAINING AND INFERENCE + +Training. The three types of multimodal associations are effective supervision to learn a generalizable 3D instance segmentation model. We follow the mask prediction paradigm to train the segmentation model, which matches the ground truth instances with the predicted masks via Hungarian matching (Kuhn, 1955). Specifically, the matching cost between $i$ -th predicted mask and $j$ -th ground truth instance is calculated as: + +$$ +\begin{array}{l} \mathcal {C} (i, j) = - \lambda_ {\mathrm {M M A}} \left(p \left(\cos \left(\mathbf {f} _ {i} ^ {\mathbf {m}}, \mathbf {f} _ {j} ^ {\mathrm {M V A}}\right)\right) + p \left(\cos \left(\mathbf {f} _ {i} ^ {\mathbf {r m}}, \mathbf {f} _ {j} ^ {\mathrm {M C A}}\right)\right) + p \left(\cos \left(\mathbf {f} _ {i} ^ {\mathbf {m}}, \mathbf {f} _ {j} ^ {\mathrm {M E A}}\right)\right)\right) \tag {4} \\ + \lambda_ {\text {d i c e}} \mathcal {L} _ {\text {d i c e}} (i, j) + \lambda_ {\text {B C E}} \mathcal {L} _ {\text {B C E}} (i, j), \\ \end{array} +$$ + +where $p(\cdot)$ denotes the softmax probability following the cosine similarity between the predicted instance and the ground truth. After matching the masks and ground truth instances, the model is trained with the combination of mask and semantic loss. + +Specifically, all three types of associations are used to semantically supervise the model. For each association, we follow (Zhou et al., 2023) to use the combination of focal loss (Lin et al., 2017) and dice loss, which can ensure the segmentation result for each class is independently generated. The semantic multimodal association loss $\mathcal{L}_{\mathrm{MMA}}^j$ for $j$ -th ground truth mask is: + +$$ +\mathcal {L} _ {\mathrm {M M A}} ^ {j} = \sum_ {a} \left(\mathcal {L} _ {\text {f o c a l}} \left(\hat {p} _ {\sigma (j)} ^ {a}, y _ {j} ^ {a}\right) + \mathcal {L} _ {\text {d i c e}} \left(\hat {p} _ {\sigma (j)} ^ {a}, y _ {j} ^ {a}\right)\right), \tag {5} +$$ + +where $a \in \{\mathrm{MVA}, \mathrm{MCA}, \mathrm{MEA}\}$ denotes three types of associations and $y_{j}^{a}$ is the binary label for matching. $\hat{p}_{\sigma(j)}^{a} = \operatorname{sigmoid}(\mathbf{f}_{\sigma(j)}^{\mathbf{m}} \cdot \mathbf{f}_{j}^{a})$ is the semantic probability between the prediction with the association $a$ . The overall training loss is the combination of mask loss and semantic loss: + +$$ +\mathcal {L} = \frac {1}{N _ {m}} \sum_ {j} ^ {N _ {m}} \left(\lambda_ {\mathrm {M M A}} \mathcal {L} _ {\mathrm {M M A}} ^ {j} + \lambda_ {\mathrm {d i c e}} \mathcal {L} _ {\mathrm {d i c e}} (\hat {m} _ {\sigma (j)}, m _ {j}) + \lambda_ {\mathrm {B C E}} \mathcal {L} _ {\mathrm {B C E}} (\hat {m} _ {\sigma (j)}, m _ {j})\right), \tag {6} +$$ + +where $\hat{m}_{\sigma (j)}$ denotes matched predicted mask with $j$ -th target mask. + +Inference. During inference, we combine the visual feature from CLIP with the predicted mask feature to achieve better generalization ability. Specifically, after obtaining the 3D masks, per-point CLIP features are pooled within the mask. The pooled CLIP feature and mask feature are then given to the text classifier $\mathbf{f}^t$ to obtain the respective classification probability $\mathbf{P}^m = p(\cos (\mathbf{f}^m,\mathbf{f}^t))$ and $\mathbf{P}^p = p(\cos (\mathbf{f}^p,\mathbf{f}^t))$ , and the final probability is yielded by soft geometric mean between them: + +$$ +\mathbf {P} = \max \left(\mathbf {P} ^ {m}, \mathbf {P} ^ {p}\right) ^ {\tau} \cdot \min \left(\mathbf {P} ^ {m}, \mathbf {P} ^ {p}\right) ^ {1 - \tau}, \tag {7} +$$ + +where $\tau$ is the exponent to increase confidence, which we set to 0.667 in this paper. For benchmark evaluation, we use CLIP textual features of all category names as the classifier. For responding to other language instructions, we use the CLIP textual feature of corresponding language instruction as binary classifier. + +# 4 EXPERIMENTS + +# 4.1 EXPERIMENTAL SETTING + +Datasets. We evaluate SOLE on the popular scene understanding datasets: ScanNetv2 (Dai et al., 2017), ScanNet200 (Rozenberszki et al., 2022) and Replica (Straub et al., 2019) in both closed-set and open-set 3D instance segmentation tasks. ScanNetv2 (Dai et al., 2017) is a popular indoor + +Table 1: The comparison of closed-set 3D instance segmentation setting on ScanNetv2. SOLE is compared with mask-training methods and the fully-supervised counterpart (upper bound). SOLE outperforms all the OV-3DIS methods and achieves competitive results with the fully-supervised model. The best results are in bold while the second best results are underscored. + +
MethodAP\( AP_{50} \)\( AP_{25} \)voxel size
OpenIns3D (Huang et al., 2023b)-28.738.92cm
OpenMask3D (Takmaz et al., 2023)31.039.544.02cm
Open3DIS (only 3D) (Nguyen et al., 2024)31.342.447.82cm
SOLE w 4cm voxel size30.852.570.94cm
SOLE w/o text sup35.050.260.22cm
SOLE (ours)44.4 (+13.1)62.2 (+19.8)71.4 (+23.6)2cm
Mask3D (Schult et al., 2022) (fully sup)55.273.783.52cm
+ +Table 2: The comparison of closed-set 3D instance segmentation setting on ScanNet200. SOLE is compared with mask training methods on the overall segmentation performance and on each subset. SOLE significantly outperforms state-of-the-art methods on five out of the six evaluation metrics under the same conditions using only proposals from a 3D Network. + +
MethodAP\( AP_{50} \)\( AP_{25} \)\( AP_{head} \)\( AP_{com} \)\( AP_{tail} \)
OpenIns3D (Huang et al., 2023b)8.810.314.416.06.54.2
OpenMask3D (Takmaz et al., 2023)15.419.923.117.114.114.9
Open3DIS (only 3D) (Nguyen et al., 2024)18.623.127.324.716.913.3
SOLE (ours)20.1(+1.5)28.1(+5.0)33.6(+6.3)27.5(+2.8)17.6(+0.7)14.1(-0.8)
Mask3D (fully sup) (Schult et al., 2022)26.936.241.439.821.717.9
+ +point cloud dataset with 18 instance classes, where "other furniture" class is disregarded due to its ambiguity. ScanNet200 (Rozenberszki et al., 2022) is a fine-grained annotated version of ScanNetv2 that contains 200 classes of head (66 categories), common (68 categories) and tail (66 categories) subsets. For ScanNetv2 and ScanNet200, we evaluate the closed-set setting and the hierarchical open-set setting. Replica (Straub et al., 2019) is a high-quality synthetic dataset annotated with 48 instance categories. Following (Takmaz et al., 2023), we evaluate on eight scenes in Replica for open-set instance segmentation, including {office0, office1, office2, office3, office4, room0, room1 and room2}. + +Implementation Details. Following the Mask3D (Schult et al., 2022), we adopt Minkowski-Unet (Choy et al., 2019) as backbone. The feature backbone extracts point features in 5 scales, while 4 layers of transformer decoder iteratively refine the instance queries. Our model is trained for 600 epochs with AdamW (Loshchilov & Hutter, 2017) optimizer. The learning rate is set to $1 \times 10^{-4}$ with cyclical decay. In training, we set $\lambda_{MMA} = 20.0$ , $\lambda_{dice} = 2.0$ and $\lambda_{BCE} = 5.0$ as the loss weight. + +Baselines. We compare SOLE mainly with recent mask-training methods (Takmaz et al., 2023; Huang et al., 2023b; Nguyen et al., 2024). Mask-training methods (Takmaz et al., 2023; Huang et al., 2023b; Nguyen et al., 2024) train class-agnostic mask generator with mask annotations and get the semantic prediction with 2D foundation models. Evaluation is conducted under the same conditions using only proposals from a 3D Network on all the categories. The proposed semantic-aware mask generator can be combined with the classification techniques proposed by previous works, further improving the performance (Appendix. D.2). + +Evaluation Metric. Average precision (AP) of different IoU thresholds is adopted as the evaluation metric, including AP under $25\%$ , $50\%$ IoU and the average AP from $50\%$ to $95\%$ IoU. + +# 4.2 COMPARISON WITH PREVIOUS METHODS + +Closed-Set 3D Instance Segmentation. We compare our SOLE with mask-training methods (Tak-maz et al., 2023; Huang et al., 2023b; Nguyen et al., 2024) on the closed-set 3D instance segmenta + +Table 3: The comparison of hierarchical open-set 3D instance segmentation setting on ScanNetv2 (Dai et al., 2017) $\rightarrow$ ScanNet200 (Rozenberszki et al., 2022). SOLE is compared with OpenMask3D and Open3DIS on both base and novel classes and achieves the best results. + +
MethodNovel ClassesBase ClassesAll Classes
AP\( AP_{50} \)\( AP_{25} \)AP\( AP_{50} \)\( AP_{25} \)AP\( AP_{tail} \)
OpenMask3D (Takmaz et al., 2023)11.915.217.814.318.321.212.611.5
Open3DIS (only 3D) (Nguyen et al., 2024)14.919.222.116.522.426.215.310.9
SOLE (ours)19.1(+4.2)26.2(+7.0)30.7(+8.6)17.4(+0.9)26.2(+3.8)32.1(+5.9)18.7(+3.4)12.5(+1.0)
+ +Table 4: The comparison of open-set 3D instance segmentation setting on ScanNet200 (Rozen-berszki et al., 2022)→Replica (Straub et al., 2019). SOLE outperforms state-of-the-art methods (Takmaz et al., 2023; Nguyen et al., 2024) on all the evaluation metrics. + +
MethodMask TrainingAP\( AP_{50} \)\( AP_{25} \)
OpenIns3D (Huang et al., 2023b)ScanNet20013.618.019.7
OpenMask3D (Takmaz et al., 2023)ScanNet20013.118.424.2
Open3DIS (only 3D) (Nguyen et al., 2024)ScanNet20014.918.823.6
SOLE (ours)ScanNet20024.7 (+9.8)31.8 (+13.0)40.3 (+16.1)
+ +tion setting. From the comparison results in Tab. 1, we can make the following observations. First, with the same mask supervision, SOLE significantly surpasses state-of-the-art method (Nguyen et al., 2024) by $13.1\%$ , $19.8\%$ , and $23.6\%$ on AP, $\mathrm{AP}_{50}$ and $\mathrm{AP}_{25}$ , respectively. Second, our SOLE can even achieve competitive performance with the fully-supervised counterpart ( $44.4\%$ v.s. $55.2\%$ in AP) despite not using the class labels. Finally, we provide two variants of SOLE to further verify our effectiveness. SOLE $w$ 4cm voxel size leverages 4cm voxel size instead of 2cm as in previous works. Larger voxel size can save the memory requirements and speed up the model with the loss of precision. Despite using a small voxel size, SOLE $w$ 4cm voxel size is still on par with OpenMask3D and Open3DIS in AP, and largely outperforms them in $\mathrm{AP}_{50}$ and $\mathrm{AP}_{25}$ . Furthermore, we verify that the effectiveness of our framework is not limited to the caption model and NLP tools by conducting experiments without any additional textual information, i.e. SOLE w/o text sup. In this experiment, mask-caption association and mask-entity association is removed since the caption is not available. The model can still achieve the state-of-the-art performance despite only trained with mask-visual association. Additionally, we compare SOLE with mask-training methods on ScanNet200 (Rozenberszki et al., 2022) in Tab. 2. All of the methods are evaluated on the overall segmentation performance and the performance on each of the three subsets. SOLE outperforms state-of-the-art methods (Nguyen et al., 2024; Takmaz et al., 2023) on five out of the six metrics and achieves comparable performance on the tail classes. The results on ScanNet200 (Rozenberszki et al., 2022) further demonstrate the effectiveness of our framework. + +Hierarchical and Cross-Domain Open-Set 3DIS. To evaluate the generalization capability of our work, we compare our SOLE with mask training methods (Huang et al., 2023b; Takmaz et al., 2023; Nguyen et al., 2024) in open-set setting, using Scannet200 (Rozenberszki et al., 2022) and Replica (Straub et al., 2019) datasets. For ScanNet200, both models are trained with mask annotations in ScanNetv2 (Dai et al., 2017). Following (Takmaz et al., 2023), 53 classes that are semantically close to the ScanNet, are grouped as "Base". The remaining 147 classes are grouped as "Novel". Both in-distribution ("base") and out-of-distribution ("novel") classes are reported in Tab. 3. Our SOLE outperforms OpenMask3D (Takmaz et al., 2023) and Open3DIS (Nguyen et al., 2024) by a large margin on both base and novel classes. Furthermore, to verify the generalization ability of SOLE when both domain shift and category shift exist, we compare our framework with all of the mask training methods on the synthetic Replica benchmark (Straub et al., 2019). Models are trained on the annotated masks on ScanNet200. As shown in Tab. 4, our method further shows superior robustness on more out-of-distribution data from Replica, achieving $+9.8\%$ improvement in AP score compared to Open3DIS. + +# 4.3 ABLATION STUDIES AND ANALYSIS + +In this section, we conduct several ablation studies to validate our design choices. All of the studies are evaluated on ScanNetv2 (Dai et al., 2017) dataset. + +Table 5: Multimodal fusion network. + +
No.fPfbCMDAPAP50AP25voxel size
1✓✓18.736.458.14cm
2✓✓25.447.066.04cm
3✓✓✓30.852.570.94cm
4✓✓42.860.568.92cm
5✓✓✓44.462.271.42cm
+ +Table 6: Multimodal associations. + +
No.fMVAfMCAfMEAAPAP50AP25voxel size
1✓24.542.056.04cm
2✓30.453.068.74cm
3✓32.153.870.04cm
4✓✓29.150.966.84cm
5✓✓30.353.770.44cm
6✓✓✓30.852.570.94cm
+ +![](images/e81a6ac439f73d4242f99bbecea8e6f5d5f53f09c048cf23cefe06c9736b52c2.jpg) +(a) $\mathbf{f}^{MEA}$ + +![](images/e6f7037f6d1daed1bd1af5e6d457a6482946239e040e7c2e182f183be0cd98a8.jpg) +(b) $\mathbf{f}^{MVA},\mathbf{f}^{MCA}$ +Figure 5: Qualitative analysis on multimodal associations. Given the free-form language instruction, "I wanna see outside". SOLE trained only with $\mathbf{f}^{\mathrm{MEA}}$ captures the wrong object ((a)), whereas it segments the related object when $\mathbf{f}^{\mathrm{MVA}}$ and $\mathbf{f}^{\mathrm{MCA}}$ are given as the supervision ((b) and (c)). + +![](images/5cfc601127f911a23579caeca26d109f7e851401fb76fecb40f89c2f3d4cdbec.jpg) +(c) $\mathbf{f}^{MVA}$ , $\mathbf{f}^{MCA}$ , $\mathbf{f}^{MEA}$ + +Multimodel Fusion Network. In Tab. 5, we conduct component analysis on multimodal fusion network, validating the effectiveness of backbone feature ensemble and Cross-Modality Decoder (CMD). As for the backbone feature ensemble, leveraging projected 2D CLIP features $\mathbf{f}^p$ (first row) as only backbone can have better semantic information but lack the 3D geometry detection ability, leading to poor semantic recognition ability. In contrast, solely using 3D instance backbone feature $\mathbf{f}^b$ (second row) cannot inherit the generalizable semantic information, resulting in sub-optimal performance. Combining the two features (third row) can make full use of generalized semantic information while learning good geometry detection ability from 3D masks, yielding optimal results. Additionally, Cross Modality Decoder (CMD) can further enhance the ability to understand language instructions, improving AP by $1.6\%$ . + +Multimodal Associations. We analyze the components of multimodal associations $(\mathbf{f}^{\mathrm{MVA}},\mathbf{f}^{\mathrm{MCA}}$ and $\mathbf{f}^{\mathrm{MEA}})$ in Tab. 6, reporting the scores of various combinations on ScanNetv2 (Dai et al., 2017) with $4\mathrm{cm}$ voxel size. We have the following observations. First, using any of multimodal associations can already achieve significant performance, outperforming previous state-of-the-art method (Opens3D (Huang et al., 2023b)) with larger voxel size (lower resolution). Second, among the three types of associations, mask-entity association $\mathbf{f}^{\mathrm{MEA}}$ is the most effective one on evaluation metrics since it can align the masks with specific categories. Third, when combining $\mathbf{f}^{\mathrm{MEA}}$ with the other two associations, the model suffers from performance degradation on AP and $\mathrm{AP}_{50}$ while the performance improves on $\mathrm{AP}_{25}$ . This observation shows that mask-visual association and mask-caption association can help semantic learning but impair mask accuracy. To this end, we further illustrate qualitative results in Fig. 5. Given a free-form language instruction instead of category name, e.g., "I wanna see outside", the model only using mask-entity association cannot segment the correct instance (Fig. 5a) while the model incorporating the other associations (Fig. 5b and Fig. 5c) can. Therefore, despite slightly impairing the performance on benchmark, mask-visual association and mask-caption association are crucial to recognizing free-form language instructions, benefiting the applications in real-world scenarios. + +# 5 CONCLUSION + +In this paper, we propose a novel framework, SOLE, for open-vocabulary 3D instance segmentation with free-form language instructions. SOLE contains a multimodal fusion network and is supervised with three types of multimodal associations, aiming at aligning the model with various free-form language instructions. Our framework outperforms previous methods by a large margin on three benchmarks while achieving competitive performance with the fully-supervised counterpart. Moreover, extensive qualitative results demonstrate the versatility of our SOLE to language instructions. + +# ACKNOWLEDGEMENTS + +This research work is supported by the Agency for Science, Technology and Research (A*STAR) under its MTC Programmatic Funds (Grant No. M23L7b0021), and the Tier 2 grant MOET2EP20124-0015 from the Singapore Ministry of Education. + +# ETHICS STATEMENT + +This research adheres to the ethical guidelines outlined in the ICLR Code of Ethics. In this section, we take following aspects into account for the ethical considerations. + +Data and Privacy : The datasets used in this research are either publicly available (Straub et al., 2019) or accessible under the agreement on term of use (Dai et al., 2017; Rozenberszki et al., 2022). + +Potential Harmful Applications : The proposed method for open-vocabulary 3D instance segmentation could be used in sensitive domains such as surveillance. We encourage future users to apply the model responsibly, with appropriate safeguards to mitigate potential misuse. + +Research Integrity : We confirm that all experiments were conducted in accordance with best practices in research ethics, and results were reported with complete transparency and accuracy. + +# REPRODUCIBILITY STATEMENT + +To ensure the reproducibility of our work, we state specific implementation details in Sec. 4.1 and Appendix. Sec. A. The code will be made publicly available. + +# REFERENCES + +Jean-Baptiste Alayrac, Jeff Donahue, Pauline Luc, Antoine Miech, Iain Barr, Yana Hasson, Karel Lenc, Arthur Mensch, Katherine Millican, Malcolm Reynolds, et al. Flamingo: a visual language model for few-shot learning. Advances in Neural Information Processing Systems, 35:23716-23736, 2022. 3 +Boyuan Chen, Fei Xia, Brian Ichter, Kanishka Rao, Keerthana Gopalakrishnan, Michael S Ryoo, Austin Stone, and Daniel Kappler. Open-vocabulary queryable scene representations for real world planning. In 2023 IEEE International Conference on Robotics and Automation (ICRA), pp. 11509-11522. IEEE, 2023. 3 +Dave Zhenyu Chen, Angel X Chang, and Matthias Nießner. Scanrefer: 3d object localization in rgb-d scans using natural language. In European conference on computer vision, pp. 202-221. Springer, 2020. 17, 18 +Shaoyu Chen, Jiemin Fang, Qian Zhang, Wenyu Liu, and Xinggang Wang. Hierarchical aggregation for 3d instance segmentation. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 15467-15476, 2021. 3 +Mehdi Cherti, Romain Beaumont, Ross Wightman, Mitchell Wortsman, Gabriel Ilharco, Cade Gordon, Christoph Schuhmann, Ludwig Schmidt, and Jenia Jitsev. Reproducible scaling laws for contrastive language-image learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 2818-2829, 2023. 3 +Seokju Cho, Heeseong Shin, Sunghwan Hong, Seungjun An, Seungjun Lee, Anurag Arnab, Paul Hongsuck Seo, and Seungryong Kim. Cat-seg: Cost aggregation for open-vocabulary semantic segmentation. arXiv preprint arXiv:2303.11797, 2023. 3 +Christopher Choy, JunYoung Gwak, and Silvio Savarese. 4d spatio-temporal convnets: Minkowski convolutional neural networks. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 3075-3084, 2019. 8 + +Angela Dai, Angel X Chang, Manolis Savva, Maciej Halber, Thomas Funkhouser, and Matthias Nießner. Scannet: Richly-annotated 3d reconstructions of indoor scenes. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 5828-5839, 2017. 2, 7, 9, 10, 11, 18, 19 +Jian Ding, Nan Xue, Gui-Song Xia, and Dengxin Dai. Decoupling zero-shot semantic segmentation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 11583-11592, 2022a. 3 +Runyu Ding, Jihan Yang, Chuhui Xue, Wenqing Zhang, Song Bai, and Xiaojuan Qi. Pla: Language-driven open-vocabulary 3d scene understanding. arXiv preprint arXiv:2211.16312, 2022b. 2, 3 +Runyu Ding, Jihan Yang, Chuhui Xue, Wenqing Zhang, Song Bai, and Xiaojuan Qi. Lowis3d: Language-driven open-world instance-level 3d scene understanding. arXiv preprint arXiv:2308.00353, 2023. 2, 3 +Shichao Dong, Guosheng Lin, and Tzu-Yi Hung. Learning regional purity for instance segmentation on 3d point clouds. In European Conference on Computer Vision, pp. 56-72. Springer, 2022. 3 +Martin Ester, Hans-Peter Kriegel, Jörg Sander, Xiaowei Xu, et al. A density-based algorithm for discovering clusters in large spatial databases with noise. In KDD, 1996. 17 +Golnaz Ghiasi, Xiuye Gu, Yin Cui, and Tsung-Yi Lin. Scaling open-vocabulary image segmentation with image-level labels. In European Conference on Computer Vision, pp. 540-557. Springer, 2022. 2, 3, 5 +Rohit Girdhar, Alaaeldin El-Nouby, Zhuang Liu, Mannat Singh, Kalyan Vasudev Alwala, Armand Joulin, and Ishan Misra. Imagebind: One embedding space to bind them all. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 15180-15190, 2023. 3 +Xiuye Gu, Tsung-Yi Lin, Weicheng Kuo, and Yin Cui. Open-vocabulary object detection via vision and language knowledge distillation. arXiv preprint arXiv:2104.13921, 2021. 3 +Huy Ha and Shuran Song. Semantic abstraction: Open-world 3d scene understanding from 2d vision-language models. arXiv preprint arXiv:2207.11514, 2022. 3 +Sunan He, Taian Guo, Tao Dai, Ruizhi Qiao, Xiujun Shu, Bo Ren, and Shu-Tao Xia. Open-vocabulary multi-label classification via multi-modal knowledge transfer. In Proceedings of the AAAI Conference on Artificial Intelligence, 2023. 3 +Tong He, Chunhua Shen, and Anton Van Den Hengel. Dyco3d: Robust instance segmentation of 3d point clouds through dynamic convolution. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 354-363, 2021. 3 +Tong He, Wei Yin, Chunhua Shen, and Anton van den Hengel. Pointinst3d: Segmenting 3d instances by points. In European Conference on Computer Vision, pp. 286-302. Springer, 2022. 1, 3 +Yining Hong, Haoyu Zhen, Peihao Chen, Shuhong Zheng, Yilun Du, Zhenfang Chen, and Chuang Gan. 3d-llm: Injecting the 3d world into large language models. Advances in Neural Information Processing Systems, 36:20482-20494, 2023. 18 +Matthew Honnibal and Ines Montani. spaCy 2: Natural language understanding with Bloom embeddings, convolutional neural networks and incremental parsing. To appear, 2017. 17 +Ji Hou, Angela Dai, and Matthias Nießner. 3d-sis: 3d semantic instance segmentation of rgb-d scans. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 4421-4430, 2019. 3 +Ronghang Hu, Huazhe Xu, Marcus Rohrbach, Jiashi Feng, Kate Saenko, and Trevor Darrell. Natural language object retrieval. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 4555-4564, 2016. 17, 18 + +Chenguang Huang, Oier Mees, Andy Zeng, and Wolfram Burgard. Visual language maps for robot navigation. In 2023 IEEE International Conference on Robotics and Automation (ICRA), pp. 10608-10615. IEEE, 2023a. 3 +Zhening Huang, Xiaoyang Wu, Xi Chen, Hengshuang Zhao, Lei Zhu, and Joan Lasenby. Openins3d: Snap and lookup for 3d open-vocabulary instance segmentation. arXiv preprint arXiv:2309.00616, 2023b. 2, 3, 8, 9, 10, 19, 20 +Krishna Murthy Jatavallabhula, Alihusein Kuwajerwala, Qiao Gu, Mohd Omama, Tao Chen, Alaa Maalouf, Shuang Li, Ganesh Iyer, Soroush Saryazdi, Nikhil Keetha, et al. Conceptfusion: Openset multimodal 3d mapping. arXiv preprint arXiv:2302.07241, 2023. 3 +Baoxiong Jia, Yixin Chen, Huangyue Yu, Yan Wang, Xuesong Niu, Tengyu Liu, Qing Li, and Siyuan Huang. Sceneverse: Scaling 3d vision-language learning for grounded scene understanding. arXiv preprint arXiv:2401.09340, 2024. 21 +Chao Jia, Yinfei Yang, Ye Xia, Yi-Ting Chen, Zarana Parekh, Hieu Pham, Quoc Le, Yun-Hsuan Sung, Zhen Li, and Tom Duerig. Scaling up visual and vision-language representation learning with noisy text supervision. In International conference on machine learning, pp. 4904-4916. PMLR, 2021. 3 +Menglin Jia, Luming Tang, Bor-Chun Chen, Claire Cardie, Serge Belongie, Bharath Hariharan, and Ser-Nam Lim. Visual prompt tuning. In European Conference on Computer Vision, pp. 709-727. Springer, 2022. 5 +Li Jiang, Hengshuang Zhao, Shaoshuai Shi, Shu Liu, Chi-Wing Fu, and Jiaya Jia. Pointgroup: Dual-set point grouping for 3d instance segmentation. In Proceedings of the IEEE/CVF conference on computer vision and Pattern recognition, pp. 4867-4876, 2020. 3 +Harold W Kuhn. The hungarian method for the assignment problem. *Naval research logistics quarterly*, 2(1-2):83-97, 1955. 4, 7 +Weicheng Kuo, Yin Cui, Xiuye Gu, AJ Piergiovanni, and Anelia Angelova. F-vlm: Open-vocabulary object detection upon frozen vision and language models. arXiv preprint arXiv:2209.15639, 2022. 3 +Boyi Li, Kilian Q. Weinberger, Serge Belongie, Vladlen Koltun, and René Ranftl. Language-driven semantic segmentation, 2022. 3 +Wei Li, Linchao Zhu, Longyin Wen, and Yi Yang. Decap: Decoding clip latents for zero-shot captioning via text-only training, 2023. 6, 17 +Feng Liang, Bichen Wu, Xiaoliang Dai, Kunpeng Li, Yinan Zhao, Hang Zhang, Peizhao Zhang, Peter Vajda, and Diana Marculescu. Open-vocabulary semantic segmentation with mask-adapted clip. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 7061-7070, 2023. 3 +Tsung-Yi Lin, Priya Goyal, Ross Girshick, Kaiming He, and Piotr Dólar. Focal loss for dense object detection. In Proceedings of the IEEE international conference on computer vision, pp. 2980-2988, 2017. 7 +Jiaheng Liu, Tong He, Honghui Yang, Rui Su, Jiayi Tian, Junran Wu, Hongcheng Guo, Ke Xu, and Wanli Ouyang. 3d-queryis: A query-based framework for 3d instance segmentation. arXiv preprint arXiv:2211.09375, 2022. 3 +Steven Loria et al. textblob documentation. Release 0.15, 2(8):269, 2018. 17 +Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization. arXiv preprint arXiv:1711.05101, 2017. 8 +Shiyang Lu, Haonan Chang, Eric Pu Jing, Abdeslam Boularias, and Kostas Bekris. Ovir-3d: Open-vocabulary 3d instance retrieval without training on 3d data. In Conference on Robot Learning, pp. 1610–1620. PMLR, 2023. 2, 3, 4 + +Chaofan Ma, Yuhuan Yang, Yanfeng Wang, Ya Zhang, and Weidi Xie. Open-vocabulary semantic segmentation with frozen vision-language models. arXiv preprint arXiv:2210.15138, 2022. 3 +Chaofan Ma, Yuhuan Yang, Chen Ju, Fei Zhang, Ya Zhang, and Yanfeng Wang. Attrseg: open-vocabulary semantic segmentation via attribute decomposition-aggregation. In Thirty-seventh Conference on Neural Information Processing Systems, 2023. 3 +Ron Mokady, Amir Hertz, and Amit H Bermano. Clipcap: Clip prefix for image captioning. arXiv preprint arXiv:2111.09734, 2021. 6 +Tuan Duc Ngo, Binh-Son Hua, and Khoi Nguyen. Isbnet: a 3d point cloud instance segmentation network with instance-aware sampling and box-aware dynamic convolution. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 13550-13559, 2023. 3 +Phuc Nguyen, Tuan Duc Ngo, Evangelos Kalogerakis, Chuang Gan, Anh Tran, Cuong Pham, and Khoi Nguyen. Open3dis: Open-vocabulary 3d instance segmentation with 2d mask guidance. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 4018-4028, 2024. 2, 3, 4, 8, 9, 19, 20 +Maxime Oquab, Timothee Darcet, Théo Moutakanni, Huy Vo, Marc Szafraniec, Vasil Khalidov, Pierre Fernandez, Daniel Haziza, Francisco Massa, Alaaeldin El-Nouby, et al. Dinov2: Learning robust visual features without supervision. arXiv preprint arXiv:2304.07193, 2023. 2 +Songyou Peng, Kyle Genova, Chiyu Jiang, Andrea Tagliasacchi, Marc Pollefeys, Thomas Funkhouser, et al. Openscene: 3d scene understanding with open vocabularies. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 815-824, 2023. 3, 5 +Charles R Qi, Or Litany, Kaiming He, and Leonidas J Guibas. Deep hough voting for 3d object detection in point clouds. In proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 9277-9286, 2019. 17, 18 +Charles Ruizhongtai Qi, Li Yi, Hao Su, and Leonidas J Guibas. Pointnet++: Deep hierarchical feature learning on point sets in a metric space. In NeurIPS, 2017. 17 +Jie Qin, Jie Wu, Pengxiang Yan, Ming Li, Ren Yuxi, Xuefeng Xiao, Yitong Wang, Rui Wang, Shilei Wen, Xin Pan, et al. Freeseg: Unified, universal and open-vocabulary image segmentation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 19446-19455, 2023. 3 +Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, et al. Learning transferable visual models from natural language supervision. In International conference on machine learning, pp. 8748-8763. PMLR, 2021. 2, 3, 5, 6 +Yongming Rao, Wenliang Zhao, Guangyi Chen, Yansong Tang, Zheng Zhu, Guan Huang, Jie Zhou, and Jiwen Lu. Denseclip: Language-guided dense prediction with context-aware prompting. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 18082-18091, 2022. 3 +David Rozenberszki, Or Litany, and Angela Dai. Language-grounded indoor 3d semantic segmentation in the wild. In European Conference on Computer Vision, pp. 125-141. Springer, 2022. 2, 7, 8, 9, 11, 20 +Jonas Schult, Francis Engelmann, Alexander Hermans, Or Litany, Siyu Tang, and Bastian Leibe. Mask3d for 3d semantic instance segmentation. arXiv preprint arXiv:2210.03105, 2022. 1, 3, 4, 8, 17, 20 +Nur Muhammad Mahi Shafiullah, Chris Paxton, Lerrel Pinto, Soumith Chintala, and Arthur Szlam. Clip-fields: Weakly supervised semantic fields for robotic memory. arXiv preprint arXiv:2210.05663, 2022. 3 + +Dhruv Shah, Błajej Osiński, Sergey Levine, et al. Lm-nav: Robotic navigation with large pretrained models of language, vision, and action. In Conference on Robot Learning, pp. 492-504. PMLR, 2023. 3 +Julian Straub, Thomas Whelan, Lingni Ma, Yufan Chen, Erik Wijmans, Simon Green, Jakob J Engel, Raul Mur-Artal, Carl Ren, Shobhit Verma, et al. The replica dataset: A digital replica of indoor spaces. arXiv preprint arXiv:1906.05797, 2019. 2, 7, 8, 9, 11 +Jiahao Sun, Chunmei Qing, Junpeng Tan, and Xiangmin Xu. Superpoint transformer for 3d scene instance segmentation. In Proceedings of the AAAI Conference on Artificial Intelligence, 2023. 3 +Ayca Takmaz, Elisabetta Fedele, Robert W Sumner, Marc Pollefeys, Federico Tombari, and Francis Engelmann. Openmask3d: Open-vocabulary 3d instance segmentation. arXiv preprint arXiv:2306.13631, 2023. 2, 3, 8, 9, 19, 20 +Yoad Tewel, Yoav Shalev, Idan Schwartz, and Lior Wolf. Zerocap: Zero-shot image-to-text generation for visual-semantic arithmetic. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 17918-17928, 2022. 6 +Thang Vu, Kookhoi Kim, Tung M Luu, Thanh Nguyen, and Chang D Yoo. Softgroup for 3d instance segmentation on point clouds. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 2708-2717, 2022. 1, 3 +Yizheng Wu, Min Shi, Shuaiyuan Du, Hao Lu, Zhiguo Cao, and Weicai Zhong. 3d instances as 1d kernels. In European Conference on Computer Vision, pp. 235-252. Springer, 2022. 3 +Jiarui Xu, Shalini De Mello, Sifei Liu, Wonmin Byeon, Thomas Breuel, Jan Kautz, and Xiaolong Wang. Groupvit: Semantic segmentation emerges from text supervision. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 18134-18144, 2022. 3 +Jiarui Xu, Sifei Liu, Arash Vahdat, Wonmin Byeon, Xiaolong Wang, and Shalini De Mello. Open-vocabulary panoptic segmentation with text-to-image diffusion models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 2955-2966, 2023. 3 +Mi Yan, Jiazhao Zhang, Yan Zhu, and He Wang. Maskclustering: View consensus based mask graph clustering for open-vocabulary 3d instance segmentation. arXiv preprint arXiv:2401.07745, 2024. 2, 3, 4 +Bo Yang, Jianan Wang, Ronald Clark, Qingyong Hu, Sen Wang, Andrew Markham, and Niki Trigoni. Learning object bounding boxes for 3d instance segmentation on point clouds. Advances in neural information processing systems, 32, 2019a. 3 +Jihan Yang, Runyu Ding, Zhe Wang, and Xiaojuan Qi. Regionplc: Regional point-language contrastive learning for open-world 3d scene understanding. arXiv preprint arXiv:2304.00962, 2023. 2, 3 +Zhengyuan Yang, Boqing Gong, Liwei Wang, Wenbing Huang, Dong Yu, and Jiebo Luo. A fast and accurate one-stage approach to visual grounding. In Proceedings of the IEEE/CVF international conference on computer vision, pp. 4683-4693, 2019b. 17, 18 +Li Yi, Wang Zhao, He Wang, Minhyuk Sung, and Leonidas J Guibas. Gspn: Generative shape proposal network for 3d instance segmentation in point cloud. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 3947-3956, 2019. 3 +Yingda Yin, Yuzheng Liu, Yang Xiao, Daniel Cohen-Or, Jingwei Huang, and Baoquan Chen. Sai3d: Segment any instance in 3d scenes. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 3292–3302, 2024. 2, 4 +Jiahui Yu, Zirui Wang, Vijay Vasudevan, Legg Yeung, Mojtaba Seyedhosseini, and Yonghui Wu. Coca: Contrastive captioners are image-text foundation models. arXiv preprint arXiv:2205.01917, 2022.3 + +Haobo Yuan, Xiangtai Li, Chong Zhou, Yining Li, Kai Chen, and Chen Change Loy. Open-vocabulary sam: Segment and recognize twenty-thousand classes interactively. arXiv preprint arXiv:2401.02955, 2024.3 +Lu Yuan, Dongdong Chen, Yi-Ling Chen, Noel Codella, Xiyang Dai, Jianfeng Gao, Houdong Hu, Xuedong Huang, Boxin Li, Chunyuan Li, et al. Florence: A new foundation model for computer vision. arXiv preprint arXiv:2111.11432, 2021. 3 +Nir Zabari and Yedid Hoshen. Semantic segmentation in-the-wild without seeing any segmentation examples. arXiv preprint arXiv:2112.03185, 2021. 3 +C Zhang, H Wan, S Liu, X Shen, and Z Wu. Pvt: Point-voxel transformer for 3d deep learning. arxiv 2021. arXiv preprint arXiv:2108.06076, 2021. 3 +Hengyuan Zhao, Hao Luo, Yuyang Zhao, Pichao Wang, Fan Wang, and Mike Zheng Shou. Revisit parameter-efficient transfer learning: A two-stage paradigm. arXiv preprint arXiv:2303.07910, 2023a. 5 +Henry Hengyuan Zhao, Pichao Wang, Yuyang Zhao, Hao Luo, Fan Wang, and Mike Zheng Shou. +Sct: A simple baseline for parameter-efficient fine-tuning via salient channels. International Journal of Computer Vision, pp. 1-19, 2023b. 5 +Chong Zhou, Chen Change Loy, and Bo Dai. Extract free dense labels from clip. In European Conference on Computer Vision, pp. 696-712. Springer, 2022a. 3 +Xingyi Zhou, Rohit Girdhar, Armand Joulin, Philipp Krahenbuhl, and Ishan Misra. Detecting twenty-thousand classes using image-level supervision. In European Conference on Computer Vision, pp. 350-368. Springer, 2022b. 2, 4 +Ziqin Zhou, Yinjie Lei, Bowen Zhang, Lingqiao Liu, and Yifan Liu. Zegclip: Towards adapting clip for zero-shot semantic segmentation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 11175-11185, 2023. 7 +Xueyan Zou, Zi-Yi Dou, Jianwei Yang, Zhe Gan, Linjie Li, Chunyuan Li, Xiyang Dai, Harkirat Behl, Jianfeng Wang, Lu Yuan, et al. Generalized decoding for pixel, image, and language. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 15116-15127, 2023. 3 +Xueyan Zou, Jianwei Yang, Hao Zhang, Feng Li, Linjie Li, Jianfeng Wang, Lijuan Wang, Jianfeng Gao, and Yong Jae Lee. Segment everything everywhere all at once. Advances in Neural Information Processing Systems, 36, 2024. 3 + +# Segment Any 3D Object with language supplementary material + +In this supplementary material, we provide more implementation details, introduce additional evaluation on free-form language instructions, and conduct more qualitative and quantitative analysis. + +- More implementation details are provided in Sec. A. +- SOLE is evaluated on 3D visual grounding task to verify the responsive ability to free-form language instructions in Sec. B +- Analysis of CLIP visual features are provided in Sec. C. +- Variants of SOLE are introduced in terms of scalability and compatibility in Sec. D. +- Analysis of semantic-aware mask generator are provided in Sec. E. +- More qualitative results about the mask caption and segmentation results are shown in Sec. F. + +# A IMPLEMENTATION DETAILS + +Segmentation Network. Following Mask3D (Schult et al., 2022), we use the transformer-based mask-prediction paradigm to obtain instance mask and semantic features. The masks are initialized from object queries and regressed by attention layers. For each 3D point cloud scene, we use farthest point sampling (Qi et al., 2017) to get 150 points as object queries. After getting masks from the segmentation model, we use DBSCAN (Ester et al., 1996) to break down non-contiguous masks into smaller, spatially contiguous clusters to improve the mask quality. The maximum distance and neighborhood points number are set to 0.95 and 1, respectively. + +Text Information Generation and Extraction. To effectively generate a caption for each mask, we use a caption model in CLIP space, i.e., DeCap (Li et al., 2023). DeCap is a lightweight transformer model to generate captions from CLIP image embedding. It contains a 4-layer Transformer with 4 attention heads as the language model and the visual embedding is obtained from the pre-trained ViT-L/32 CLIP model. We feed the mask features that are average pooled from the projected CLIP visual features into the DeCap model to obtain the mask caption. Then the caption is integrated into the text prompt "a {} in a scene." to better align with our data, e.g. "a blue chair in a scene". With the mask caption, noun phrases are extracted by the NLP library, TextBlob (Loria et al., 2018) and spaCy (Honnibal & Montani, 2017), to get the mask-entity association. + +# B 3D VISUAL GROUNDING + +To further verify the effectiveness of SOLE on various language instructions, we conduct experiments on 3D visual grounding benchmark ScanRefer (Chen et al., 2020). 3D visual grounding aims at localizing 3D objects with free-form text descriptions. Therefore, we query SOLE with each text prompt in the ScanRefer validation set to get the corresponding instance, and then 3D bounding box is obtained from the instance masks. The performance is evaluated on the matching accuracy with IoU over 0.25 (ACC@25) and 0.5 (ACC@50). + +Baselines. We compare SOLE with five specialist baseline models and one generalist model. Specialist models mean that the models are designed and trained for 3D visual grounding only while generalist models are models that can address other tasks such as instance segmentation with class names. For the specialist models, OCRand (Chen et al., 2020) uses an oracle with ground truth bounding boxes of objects, and selects a random box that matches the object category. VoteRand (Qi et al., 2019; Chen et al., 2020) leverages the pre-trained VoteNet (Qi et al., 2019) to predict bounding boxes and randomly select a box of the correct semantic class. SCRC (Hu et al., 2016) and One-stage (Yang et al., 2019b) are 2D approaches with 3D extension using back-projection. Scan-Refer (Chen et al., 2020) uses a pre-trained VoteNet (Qi et al., 2019) with a trained GRU to select a matching bounding box. For the generalist model, 3D-LLM directly predicts the location of the bounding box corresponding to the text description via large language model. Note that except for + +Table 7: Results on ScanRefer (Chen et al., 2020) for 3D visual grounding task. SOLE achieves the best performance on generalist models with weak supervision. + +
MethodTypeSupervisionACC@25ACC@50
OCRand (Chen et al., 2020)VoteRand (Qi et al., 2019; Chen et al., 2020)SCRC (Hu et al., 2016)One-stage (Yang et al., 2019b)ScanRefer (Chen et al., 2020)SpecialistFull30.029.8
Full10.05.3
Full18.76.5
Full20.49.0
Full41.227.4
3D-LLM (flamingo) (Hong et al., 2023)SOLEGeneralistFull21.2—
Zero-Shot25.222.6
+ +![](images/13597aeead9169f74e13804bd218a7590e8a5c6f51793f633c406a56adce023e.jpg) +(a) K-Means clustering of $\mathbf{f}^p$ + +![](images/fef8214d7908ec62348f30e552176f5ace4ec696cb4059ba286ab2e9cd66dd11.jpg) +(b) K-Means clustering of $\mathbf{f}^b$ +Figure 6: K-means clustering of different backbone features. Different colors denote different clusters. + +![](images/2c21ecefd5a98e861f5131f905e8e7d4615c27f8368d601328709a783eedfe55.jpg) +(c) K-Means clustering of $\tilde{\mathbf{f}}^b$ + +OCRand and VoteRand where training is not required, the other four baseline models are trained or fine-tuned on the ScanRefer training set. Differently, SOLE is only trained with instance segmentation masks of ScanNetv2 (Dai et al., 2017), without leveraging any labels in ScanRefer. + +Results. As shown in Tab. 7, with instance mask annotation, SOLE outperforms the generalist model 3D-LLM by $4\%$ on ACC@25. In addition, SOLE can achieve competitive performance with the fully-supervised specialist counterpart on ACC@50 (22.6% v.s. 27.4%). Such results demonstrate the strong generalization ability and the effectiveness in responding to free-form language instructions of our framework. + +# C ANALYSIS OF CLIP VISUAL FEATURE + +CLIP visual features play an important role in the generalization ability of SOLE. In this section, we further analyze the effectiveness of CLIP visual features in the backbone feature ensemble and inference ensemble. + +# C.1 BACKBONE FEATURE ENSEMBLE + +As shown in Tab. 5, solely using 3D instance backbone feature $\mathbf{f}^b$ or projected CLIP visual feature $\mathbf{f}^p$ cannot achieve the best performance. 3D backbone features lack the generalized semantic information while projected CLIP visual features lack the location and geometry information. To further verify the effectiveness of the backbone feature ensemble, we visualize the clustering results of different features in Fig. 6. In Fig. 6a, all chairs are clustered together (the green cluster), showing that the projected CLIP features contain good semantic information but cannot detect the instances. In Fig. 6b, different instances within one category can be identified, e.g., chairs are in three clusters. However, the semantic generalization ability is degraded. As in the highlighted red circle, the trash can is detected by projected CLIP visual features (Fig. 6a) but misclassified to a chair cluster when only using 3D backbone (Fig. 6b). Compared with using the two features separately, SOLE combines the two features and thus achieves better semantic generalization ability (segmentation of the trash can) and segmentation performance (chairs are clustered into six clusters). The visualization results further demonstrate the effectiveness of the backbone feature ensemble. + +Table 8: Analysis on classification probability ensemble. Results are reported on the ScanNetv2 (Dai et al., 2017) dataset in 2cm voxel size. + +
ComponentAPAP50AP25
w.o. Ensemble42.258.666.9
hard geometric mean43.761.170.1
soft geometric mean (ours)44.462.271.4
+ +Table 9: Analysis on $\tau$ . Results are reported on the ScanNetv2 (Dai et al., 2017) dataset in 2cm voxel size. + +
τAP
0.144.1
0.33444.2
0.667 (ours)44.4
0.942.4
+ +Table 10: Analysis of the light version of SOLE on ScanNetv2 (Dai et al., 2017). Despite of performance drop, SOLE-light still outperforms mask-training methods with the fastest inference time. The best results are in bold while the second best results are underscored. + +
MethodAP\( AP_{50} \)\( AP_{25} \)Inference Time (s)voxel size
OpenIns3D (Huang et al., 2023b)-28.738.916.32cm
OpenMask3D (Takmaz et al., 2023)31.039.544.0553.72cm
Open3DIS (only 3D) (Nguyen et al., 2024)31.342.447.856.62cm
SOLE (ours)44.462.271.4454.22cm
SOLE-light37.150.859.013.12cm
+ +# C.2 INFERENCE ENSEMBLE + +During inference, we combine the CLIP visual features with the predicted mask feature to achieve better generalization ability. Specifically, after obtaining the 3D masks, per-point CLIP features are pooled within the mask. The pooled CLIP feature and mask feature are then fed into the classifier to obtain the respective classification probability $p(\mathbf{f}^m)$ and $p(\mathbf{f}^p)$ , and the final probability is yielded by the ensemble of them. In Tab. 8, we compare three options to ensemble the class probabilities of 3D segmentation model and CLIP model. "w.o. Ensemble" denotes only using the prediction of 3D segmentation model, and "hard geometric mean" refers to the standard geometric mean, formulated as $p(\mathbf{f}^m)^{\tau} \cdot p(\mathbf{f}^p)^{1 - \tau}$ . Our method, "soft geometric mean" (Eq. 7), shows the best results among the ensemble methods, demonstrating the effectiveness of dynamically fusing the prediction from two models. However, as shown in the first row, SOLE already achieves competitive performance even without utilizing the CLIP prediction, further demonstrating the strong generalization ability of our multimodal fusion network. We also analyze the parameter $\tau$ on soft geometric mean in Tab. 9. SOLE is robust to $\tau$ while achieving the best result when it is 0.667. + +# D SOLE ++ + +As shown in Fig. 2, SOLE focuses more on the 3D semantic-aware mask generation than the semantic classification. Therefore, SOLE itself can be used for fast segmentation and it can also be combined with generalizable semantic classification and 2D mask refinement techniques proposed by previous and concurrent works (Takmaz et al., 2023; Nguyen et al., 2024). By default, we use the soft geometric mean to combine the CLIP visual feature with predicted mask feature for better generalization ability. In this section, we investigate two variants of SOLE: the light version without using any additional information for segmentation and the advanced version leveraging the semantic classification techniques from other methods. + +# D.1 SOLE-LIGHT + +SOLE-light introduces a light inference technique to exclude 2D foundation model (CLIP) used in backbone feature ensemble and soft geometric mean. In Tab. 10, we compare performance and inference time of SOLE-light to previous mask training methods (Takmaz et al., 2023; Huang et al., 2023b; Nguyen et al., 2024) on ScanNetv2 (Dai et al., 2017) dataset. Removing the CLIP model significantly improves the inference time by 30 times (454s v.s. 13s) with the performance drop to some degree. However, SOLE-light still outperforms previous mask training methods by a large margin, further demonstrating the strong generalization ability and good mask quality of our semantic-aware mask generator. + +Table 11: Analysis of compatibility with previous works on ScanNet200 (Rozenberszki et al., 2022). SOLE shows high compatibility with previous mask training methods, achieving state-of-the-art performance when it is incorporated into Open3DIS framework. + +
Method2D masksClassificationAP\( AP_{50} \)\( AP_{25} \)
OpenMask3D (Takmaz et al., 2023)✘OpenMask3D15.419.923.1
Open3DIS (Nguyen et al., 2024)✓Open3DIS23.729.432.8
SOLE (ours)✘SOLE20.128.133.6
SOLE + OpenMask3D✘SOLE + OpenMask3D20.228.533.2
SOLE + Open3DIS✓SOLE + Open3DIS24.530.134.1
+ +Table 12: Mask quality evaluation on ScanNet200 (Rozenberszki et al., 2022). SOLE significantly outperforms Mask3D-CA in terms of mask quality and the performance is even comparable to original Mask3D despite the absence of filtering step. + +
MethodSemantic GuidancefilteringAP\( AP_{50} \)\( AP_{25} \)
Mask3D-CANone✘23.129.933.4
SOLE (ours)MMA✘43.556.262.5
Mask3D (Schult et al., 2022)GT labels✓53.072.582.4
SOLE (ours)MMA✓43.659.370.2
+ +# D.2 SOLE-ADVANCED + +Previous works (Huang et al., 2023b; Takmaz et al., 2023; Nguyen et al., 2024) commonly use the 3D masks generated by a pre-trained class-agnostic mask generator and propose techniques to refine and classify the masks with the help 2D vision large model (VLM). Since SOLE focuses more on the semantic-aware 3D mask prediction, we introduce several variants of SOLE in Tab. 11 by incorporating the previous techniques into our framework and evaluate on ScanNet200 (Rozenberszki et al., 2022). Specifically, "SOLE + OpenMask3D" further leverages the frame selection and mask feature aggregation in OpenMask3D to improve the masks classification on top of SOLE. Similarly, "SOLE + Open3DIS" uses 2D mask guidance and pointwise feature extraction in Open3DIS to improve the masks and classification. As shown in Tab. 11, our model exhibits the high compatibility with previous work and achieves the state-of-the-art performance (24.5%AP) on ScanNet200 when it is combined with Open3DIS framework. + +# E SEMANTIC-AWARE MASK GENERATOR + +One of the main contributions of SOLE is that we improve the mask generator with multimodal associations and multimodal fusion network. In this section, we evaluate and analyze how semantic information improves the mask quality. + +# E.1 QUALITY OF SEMANTIC-AWARE MASKS + +In contrast to previous works (Huang et al., 2023b; Takmaz et al., 2023; Nguyen et al., 2024) that disregard semantic information in the mask generation, our SOLE generates semantic-aware masks with showing superior quality and generalizability. To investigate the impact of semantic information to mask quality, Tab. 12 further examines the mask evaluation in the class-agnostic setting. We first adjust Mask3D (Schult et al., 2022) to remove semantic-related parts by discarding classification head and training it on only mask annotations. This Mask3D variant, denoted as Mask3D-CA, is compared to SOLE in class agnostic 3DIS on ScanNet200 (Rozenberszki et al., 2022). During the evaluation, we use all of the mask proposals without filtering the low quality masks. As shown in Tab. 12, SOLE significantly outperforms Mask3D-CA on the mask quality, demonstrating the effectiveness of semantic information in mask generation. We also show the performance of full-supervised counterpart in Tab. 12, taking the class information into account but only evaluating the mask quality. The fully-supervised Mask3D (Schult et al., 2022) leverages classification logits to filter low-quality segments, which is their way to use semantic information to support mask generation. SOLE shows close performance to original Mask3D despite not filtering the low-quality + +Table 13: Analysis on caption influence for multimodal associations. SceneVerse generates captions based on ground truth class labels, which can further improves the performance of SOLE. + +
MethodCaptionGT LabelsAPAP50AP25
SOLEDeCap×20.128.133.6
SOLESceneVerse✓26.137.344.2
+ +masks. When filtering the low-quality segments, the performance of SOLE can be further improved. Comparing the second and fourth row in Tab. 12, our SOLE shows robust performance regardless of whether filtering step is present or not. Since SOLE is aware of rich semantic information, it can already generate high quality of masks without the requirements of post processing. + +# E.2 QUALITY OF SEMANTIC GUIDANCE + +SOLE leverages DeCap to generate mask captions without any class labels. However, although the generated captions contain rich semantic information, they are still not perfect due to the lack of class label. In Tab. 13, we replace the generated caption with captions in SceneVerse (Jia et al., 2024). SceneVerse (Jia et al., 2024) leverages LLM to generate mask captions given the mask and class labels. With the better captions, SOLE can be further improved by $6\%$ in AP on ScanNet200 dataset. These results demonstrate that better semantic information indeed help to learn a better mask proposal modules and the label-free caption generator can still be improved, deserving investigation in the future work. + +# F QUALITATIVE RESULTS + +Visualization for Segmentation Results. In Fig. 1 and Fig. 7, we present qualitative results, demonstrating that SOLE is capable of processing free-form language queries, including but not limited to visual questions, attributes description, and functional description. More qualitative results are presented by the video in supplementary material. + +Visualization for Mask Captions. We provide the visualization for different masks and corresponding generated captions in Fig. 8. The generated caption contains the semantic information of the 3D object as well as the location for better 3D segmentation. As shown in the examples, more than one nouns exist in the caption and thus we aggregate all the noun phrases with attention mechanism in mask-entity association. + +![](images/027ce87c1cf63e2844c425ed1d724fef3de649066eead4c6d2ee43a6e5f221b9.jpg) +"leather texture." + +![](images/75394369f37ed3207bcf3a5c1bcf2b20fef4459db1aba629453290aae2a196f6.jpg) + +![](images/734c46a0c2260f91d9e3dfe82b2906daaf5bb921431b30d8cd18659870e82ab6.jpg) +"Green tree." + +![](images/6a2e3709f93fb72a77bbb20b6cb28fa58d2339efbc18a43d9a8b951bdd892f21.jpg) + +![](images/f0037dbe5cbcc7d4b8ff54e4961756ed35e2e90da01874a38cb654776f87fa1d.jpg) +"sofa with flower pattern." + +![](images/bf31f4a2fc09d69515662541c04879355e13245cf9d16d5fc7fa7df7b5d59393.jpg) + +![](images/f92d6d6e72876d4db96fd7a00ed536902dbe2a515fde70b3a8a4fec4f4666cae.jpg) +"What time is it?" + +![](images/e494435bcf7a6de7403bb2485845bdb9c2f9efaf05ff81e7c9b3cf0297f8a5a6.jpg) +"Art work." + +![](images/c2626f61c05baa02b9ab49991f85b4d8286e908e65c2e9a55178ebd519fc965a.jpg) +"Turn on the light." + +![](images/baacc7c5f5cb8cfcf55fdf62e0272f45f3445ad35ee9cd4b4776a6f9b99fb515.jpg) +"I want to watch movie." + +![](images/685b13ce03e88169d647ea2a63ba1356e7dfc17fdc961be7f09579bac13821e2.jpg) +"Chairs near by the window." + +![](images/edd3966d0f4141b5c8eb1d5f97348b052578c50adce13e8089522c73272c45bc.jpg) +"I'm hungry." + +![](images/3b580392afbfd69f8cf7f08763ca7f8f97fd914fc4766aa70cf77d5fbab3d357.jpg) +"Throwing away the garbage." + +![](images/49a4f8b750377fea935eef0a2f02c0da59e5e3663604ec7357c6c398d94277e2.jpg) +"I wanna see outside." + +![](images/6268e1b63a307294fbe58709cdf1a56b0db4987786ce61ecaafa7e04b8c31f5e.jpg) +"Place I can pee." + +![](images/ffea9d7bd19704dfe53e1f5126601541134c655c109591a6cc6d3545f4bf88ea.jpg) +"I'm sleepy." +"bathroom." +Figure 7: Qualitative results from SOLE. Our SOLE demonstrates open-vocabulary capability by effectively responding to free-form language queries, including visual questions, attributes description and functional description. + +![](images/ed4106850b7db7f5f66956d7d8ce527aac2d1a41c64156a768b084c1bce3d08f.jpg) +"I want to take a shower." +"kitchen." + +![](images/61fa9076d699cf65c7883ae8ec183630585d2af927e2e6eec36dd3c0cef61791.jpg) +"Where can I sit?" +"Cooking the food." + +![](images/4341a843f6be08740181634aef5e8ee70a0b2cc72c8752430c1c313eb82f3243.jpg) +a microwave oven sitting inside of a small kitchen + +![](images/a48917d906d094b76064cc8dc1aeddf64b419e0c240b7079eccfb92eb41b5d1a.jpg) +a trash can with a microwave on top of it + +![](images/16de54f2a384184ea50d9d775b2bc56f9c2fdc433a42e4c9db1ed2a561c9d201.jpg) +a black refrigerator freezer sitting inside of a kitchen + +![](images/c749fe7713d32cd15f1a67aea71e4e3f61e203bd8389262001d991345d8da2b2.jpg) +a bed with white pillows and a large white comforter on top + +![](images/8f2cec4b7d029df57bd3fa54a1a1f58d444bb6d2877c94b44528aca7f6b33ea9.jpg) +a black suitcase with a piece of luggage sitting on a floor + +![](images/40bc20aee26262f9e9515be5e6ad2576e4218b757c96d8d56d3fbd380372b981.jpg) +a brown chair sitting in front of a desk with a black table + +![](images/99e1e7d32164d60879cc915d4b005bd4179022001e7a9e004fda7dfa48a1a426.jpg) +a box of various items sitting on a cluttered place + +![](images/1521668ef74958f266e8edfbb1b7331f99ad77da52a86e18c5cfe12b43afed42.jpg) +a painting hanging on the wall of a living room + +![](images/429ebdd7fb358a3e0750048e179f07d6d520888d216947a16a75ad9c7038e63f.jpg) + +![](images/dbb6c3053e52650a07f7a76eb0b8f8dc2a627393ad8e62b14557be27250cca82.jpg) +a computer monitor sitting on a desk in front of two computers +Figure 8: Qualitative examples for mask captions. Generated captions contain the semantic, appearance, and geometric relationship of the corresponding object. + +![](images/7a7717f8a6b0375889a79bfb68b4b8b5638d4318fff07f2d83caee1158822569.jpg) +a desk with a laptop, computer, papers and other items + +![](images/597ea1d7c06664b7513c1fed0632d3a70ac7eb45275bb99b6c418955c6f3cc78.jpg) +a kitchen area with a sink and counter top near cabinets +a plant with a white pot sitting on a table \ No newline at end of file diff --git a/ICLR/2025/Segment Any 3D Object with Language/images.zip b/ICLR/2025/Segment Any 3D Object with Language/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..6368ba6c54f0f0c1b1497d44240082321ac1cbcb --- /dev/null +++ b/ICLR/2025/Segment Any 3D Object with Language/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e5b8b2c2cb68fd718df6b62974c97e397010454dad59acd61e43cc747c0024d2 +size 1276851 diff --git a/ICLR/2025/Segment Any 3D Object with Language/layout.json b/ICLR/2025/Segment Any 3D Object with Language/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..6772888e3434dca01b0a426257b81f8819b1df62 --- /dev/null +++ b/ICLR/2025/Segment Any 3D Object with Language/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:574200b084f7539c27c268affccaff564bab890345855e2e02bb43f51ffc9677 +size 688788 diff --git a/ICLR/2025/SelKD_ Selective Knowledge Distillation via Optimal Transport Perspective/3928d910-6231-4501-b281-9f80e70df3b0_content_list.json b/ICLR/2025/SelKD_ Selective Knowledge Distillation via Optimal Transport Perspective/3928d910-6231-4501-b281-9f80e70df3b0_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..1598792bde51c006aafb7222a3d5de0b54d7e2e3 --- /dev/null +++ b/ICLR/2025/SelKD_ Selective Knowledge Distillation via Optimal Transport Perspective/3928d910-6231-4501-b281-9f80e70df3b0_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:978fdeff5752b01a7e8d545ae1dc6a98e6c47180a7df3b961e66a881345023f3 +size 94306 diff --git a/ICLR/2025/SelKD_ Selective Knowledge Distillation via Optimal Transport Perspective/3928d910-6231-4501-b281-9f80e70df3b0_model.json b/ICLR/2025/SelKD_ Selective Knowledge Distillation via Optimal Transport Perspective/3928d910-6231-4501-b281-9f80e70df3b0_model.json new file mode 100644 index 0000000000000000000000000000000000000000..0044cfc8f42f4db2f79747a17503c0ee9e7ebf87 --- /dev/null +++ b/ICLR/2025/SelKD_ Selective Knowledge Distillation via Optimal Transport Perspective/3928d910-6231-4501-b281-9f80e70df3b0_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e7b7db0c1e76bea579ce54a1884841e87f8e1afef606db10e9377d7a8f4ac544 +size 112278 diff --git a/ICLR/2025/SelKD_ Selective Knowledge Distillation via Optimal Transport Perspective/3928d910-6231-4501-b281-9f80e70df3b0_origin.pdf b/ICLR/2025/SelKD_ Selective Knowledge Distillation via Optimal Transport Perspective/3928d910-6231-4501-b281-9f80e70df3b0_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..117c4d95f8f2d80dc170de3f9e022d5ac220c4c7 --- /dev/null +++ b/ICLR/2025/SelKD_ Selective Knowledge Distillation via Optimal Transport Perspective/3928d910-6231-4501-b281-9f80e70df3b0_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:070ef06e810c99e0f4fb623a23845f7a75f4b7416972dea9c57ac41a56f18367 +size 1245440 diff --git a/ICLR/2025/SelKD_ Selective Knowledge Distillation via Optimal Transport Perspective/full.md b/ICLR/2025/SelKD_ Selective Knowledge Distillation via Optimal Transport Perspective/full.md new file mode 100644 index 0000000000000000000000000000000000000000..576b0ba7a3c9037f00278c2644795d7920ebbb95 --- /dev/null +++ b/ICLR/2025/SelKD_ Selective Knowledge Distillation via Optimal Transport Perspective/full.md @@ -0,0 +1,367 @@ +# SELKD: SELECTIVE KNOWLEDGE DISTILLATION VIA OPTIMAL TRANSPORT PERSPECTIVE + +Liangliang $\mathbf{Shi}^{1\dagger}$ , Zhengyan $\mathbf{Shi}^{1\dagger}$ , Junchi Yan $^{12*}$ + +$^{1}$ Sch. of Computer Science & Sch. of Artificial Intelligence, Shanghai Jiao Tong University + +$^{2}$ Shanghai Artificial Intelligence Laboratory + +† Equal Contributions * Correspondence Author + +{shiliangliang,macho2021,yanjunchi}@sjtu.edu.cn + +# ABSTRACT + +Knowledge Distillation (KD) has been a popular paradigm for training a (smaller) student model from its teacher model. However, little research has been done on the practical scenario where only a subset of the teacher's knowledge needs to be distilled, which we term selective KD (SelKD). This demand is especially pronounced in the era of foundation models, where the teacher model can be significantly larger than the student model. To address this issue, we propose to rethink the knowledge distillation problem from the perspective of Inverse Optimal Transport (IOT). Previous Bayesian frameworks mapped each sample to the probabilities of corresponding labels in an end-to-end manner, which fixed the number of classification categories and hindered effective partial knowledge transfer. In contrast, IOT calculates from the standpoint of transportation or matching, allowing for the flexible selection of samples and their quantities for matching. Traditional logit-based KD can be viewed as a special case within the IOT framework. Building on this IOT foundation, we formalize this setting in the context of classification, where only selected categories from the teacher's category space are required to be recognized by the student in the context of closed-set recognition, which we call closed-set SelKD, enhancing the student's performance on specific subtasks. Furthermore, we extend the closed-set SelKD, introducing an open-set version of SelKD, where the student model is required to provide a "not selected" response for categories outside its assigned task. Experimental results on standard benchmarks demonstrate the superiority of our approach. The source code is available at: https://github.com/machoshi/SelKD. + +# 1 INTRODUCTION + +Knowledge Distillation (KD) (Hinton et al., 2015) has been a popular paradigm to transfer the knowledge from large models (teachers) to small ones (students), which has been widely used in different fields from visual recognition (Kong et al., 2019), speech recognition (Shen et al., 2020), natural language processing (Jiao et al., 2019), to recommendation systems (Pan et al., 2019). Many approaches have been proposed including matching the intermediate features (Romero et al., 2014), learning the relationships (Lee et al., 2018) and adopting the multiple teachers (Liu et al., 2020). + +Existing KD methods typically transfer the entire knowledge from one (Sun et al., 2024) or multiple (Yuan et al., 2021) teacher models to a student model. However, in many real-world applications, it is often preferable for the student model to learn only a subset of the teacher's knowledge. This scenario becomes particularly relevant when the teacher is a large foundation model, while the student model is deployed in resource-constrained environments such as edge computing. Despite its practical significance, this setting has received little attention in prior work. + +To address this gap, we formalize the described setting as selective knowledge distillation (SelKD) within the context of classification. Unlike traditional KD, SelKD requires the specification of + +categories (i.e., subsets of knowledge)1 as a side input, allowing the student model to focus exclusively on learning this selected knowledge. This targeted approach makes SelKD particularly applicable to real-world scenarios, where efficiency and task-specific learning are crucial. + +SelKD has practical applications in real-world scenarios. Typically, we tend to implement more complex functionalities in relatively larger networks, which often run on high-performance servers. However, for smaller devices such as smartphones and tablets with limited computational power, it is often unnecessary to replicate the full functionality of models running on large servers. Instead, they may only need to perform specific tasks that are tailored to the device's capabilities. To improve the model performance on different devices, traditional knowledge distillation methods require training multiple teacher models for specific tasks to ensure consistency between teachers and students. However, the advantage of the SelKD framework lies in the fact that we only need to train a single strong teacher classifier capable of recognizing a wide range of categories. This teacher model can then be utilized to selectively transfer the relevant knowledge to different students with their respective subtasks. As a result, there is no need to retrain a teacher for each specific task, leading to reduced computational costs and simplified training process. + +In this paper, we adopt the inverse optimal transport (IOT) perspective to address the classification problem. We define labels as a set of features, such as one-hot vectors or features extracted by a text encoder. Our goal is to establish a matching or transportation (i.e., coupling) between the features of images and texts. In this context, the learning process can be seen as the inverse of Entropic Optimal Transport, while the testing inference can be viewed as the optimization of Optimal Transport. From this perspective, we can naturally define the student categories as a subset of the categories of the teacher, enabling the knowledge transfer in the SelKD setting. + +We propose two distinct settings within our SelKD framework. The first, referred to as (closed-set) SelKD, focuses on the teacher transferring knowledge related only to a specific subtask. The student model is trained exclusively on the data relevant to the assigned subtask and is not required to recognize categories beyond this scope. The second setting introduces open-set SelKD, which extends the framework to handle the recognition of unselected classes. Specifically, in resource-constrained devices, if a sample falls outside the subtask's recognition domain, open-set SelKD enables the student to provide a "not selected" or "reject due to unknown" response. To tackle this challenge, we employ a modified inverse optimal transport approach that relaxes the Softmax constraint, allowing the row-sum to be less than 1. The contributions of this paper can be summarized as follows: + +1) We revisit the Knowledge Distillation (KD) problem through the lens of Inverse Optimal Transport (IOT), reformulating the vanilla KD problem as a bi-level optimization task. In the inner optimization, the goal is to learn the coupling (i.e., the matching probability) of the student model, which is then supervised by both the ground truth and the teacher's coupling to update the model parameters. + +2) Building on this IOT-based formulation, we introduce Selective Knowledge Distillation (SelKD), where the student model is trained to learn only specific subtasks from the teacher model. Additionally, by adjusting the constraints of the original closed-set SelKD for open-set setting, we propose an open-set version of SelKD. The open-set SelKD requires the model to recognize "not selected" knowledge, allowing for a more flexible and robust response to unassigned tasks. + +3) Our proposed method demonstrates superior performance compared to state-of-the-art techniques in both closed-set and open-set SelKD tasks, achieving notable improvements in accuracy and robustness. This highlights the effectiveness of the IOT-based KD approach and its potential for diverse real-world applications. + +# 2 RELATED WORKS + +# 2.1 KNOWLEDGE DISTILLATION + +Logit-based KD. The idea of training smaller, cheaper models (students) to mimic larger ones (teachers) can be dated back to (Bucila et al., 2006) and it has been applied to neural networks among various tasks including classification (Hinton et al., 2015), speech recognition (Shen et al., + +![](images/a84ab7e88efc2d34e2cbcfd34f614e73292d544c89825de908dc91531d31f8d2.jpg) +Figure 1: Illustrative comparison between vanilla knowledge distillation and our selective knowledge distillation with regard to classification tasks. In the vanilla KD framework, the student model learns knowledge from all categories in the teacher model. In contrast, within the selective KD framework, each student independently learns only a subset of categories from the teacher model, with the collective knowledge acquired by the students encompassing the entirety of the teacher's knowledge. + +![](images/cf241d184e8bae5663155cbd0b98b8fa2a680740f3f6f3cbd87843229fa21f4c.jpg) + +2020), natural language processing (Jiao et al., 2019), Large-scale language-image pretraining (Wu et al., 2023) etc. From a broader perspective, KD can be categorized into three types based on how the students learn knowledge from the teachers: logit-based, feature-based and relation-based KD. In particular, the logit-based KD methods distill the knowledge by aligning the logits between the teacher and student, which can be formulated as a loss as follows (Hinton et al., 2015): + +$$ +\mathcal {L} _ {\text {l o g i t}} = C E \left(y \mid \sigma \left(f _ {s} (\mathbf {x}); \tau\right)\right) + \lambda \cdot K L \left(\sigma \left(f _ {t} (\mathbf {x}); \tau\right) \| \sigma \left(f _ {s} (\mathbf {x}); \tau\right)\right), \tag {1} +$$ + +where $f_{s}(\cdot)$ and $f_{t}(\cdot)$ are the sample encoders of the student and teacher models, respectively, and $y$ denotes the ground truth (i.e., label) of the sample. $\sigma(\cdot)$ is the softmax function mapping the logits to the category probabilities and $\tau$ is the temperature to control the smoothness of predictive distribution. $CE$ and $KL$ denotes the cross entropy loss and KL divergence, respectively. The parameter $\lambda$ controls the weight between the two items. The concept of logit-based knowledge distillation is straightforward and becomes particularly intuitive when viewed as a process of knowledge transfer. From another perspective, the effectiveness of soft targets can be compared to techniques such as label smoothing (Kim & Kim, 2017) or regularization methods (Müller et al., 2019; Ding et al., 2019). However, traditional logit-based distillation typically relies on the output of the final layer, like soft targets, which overlooks intermediate-level supervision from the teacher model—an essential component for effective representation learning in very deep neural networks (Romero et al., 2014). Additionally, since soft logits reflect class probability distributions, logit-based distillation is inherently limited to supervised learning scenarios. + +Feature-based KD. In addition to logit-based KD methods, feature-based KD methods (Yang et al., 2023) primarily focus on aligning the intermediate features between the teacher and student models. This alignment can be expressed as: + +$$ +\mathcal {L} _ {\text {f e a t u r e}} = C E \left(y \mid \sigma \left(\mathbf {F} ^ {s}; \tau\right)\right) + \lambda \cdot \mathcal {D} _ {\text {f e a t u r e}} \left(T _ {t} \left(\mathbf {F} ^ {t}\right) \| T _ {s} \left(\mathbf {F} ^ {s}\right)\right), \tag {2} +$$ + +where $\mathbf{F}^t$ and $\mathbf{F}^s$ represent the intermediate features from the teacher and student models, respectively. $T_{t}$ and $T_{s}$ are feature transformation mappings for the teacher and student models, used to align the dimensions of $\mathbf{F}^t$ and $\mathbf{F}^s$ . The term $\mathcal{D}_{\mathrm{feature}}$ measures the divergence to quantify the feature difference between the two models, and the parameter $\lambda$ controls the weight between the two items. + +Self KD. In self KD, the student model itself plays the role of the teacher. Inspired by the analysis of label smoothing regularization, a teacher-free KD method is proposed in (Yuan et al., 2019), whose core idea involves the model generating soft labels from its own knowledge and using these labels for training. (Yang et al., 2022) suggests integrating self KD with image mixture and aggregating multi-stage features to generate soft labels. In the paper (Li, 2022), channel features and layer features are utilized to transfer knowledge without the need for an additional model. To conclude, the main advantage of self KD is that it allows training a student model with a smaller teacher model size, while achieving performance comparable to the student model trained using a larger teacher model. Compared to SelKD, the teacher model in self KD shares the same task to the students. + +# 2.2 OPTIMAL TRANSPORT AND INVERSE OPTIMAL TRANSPORT + +As originally introduced by (Kantorovich, 1942), Optimal Transport (OT) (Raghvendra et al., 2024) involves solving a linear program (Lahn et al., 2023; Phatak et al., 2023), and has become a widely used tool across various research fields, including visual matching (Wang et al., 2013), long-tailed learning (Shi et al., 2024b;c), time series analysis (Zhang et al., 2020; Shi et al., 2020), multi-modal learning (Shi et al., 2024a; Wang et al., 2024), and more. Specifically, given the cost matrix $\mathbf{C}$ and two histograms (i.e., probability vectors) $\mathbf{a} \in \mathbb{R}^n$ , $\mathbf{b} \in \mathbb{R}^m$ , Kantorovich's OT involves solving the coupling $\mathbf{P}$ (i.e., the joint probability matrix) by + +$$ +\min _ {\mathbf {P} \in U (\mathbf {a}, \mathbf {b})} \langle \mathbf {C}, \mathbf {P} \rangle = \sum_ {i = 1} ^ {n} \sum_ {j = 1} ^ {m} \mathbf {C} _ {i j} \mathbf {P} _ {i j}, \tag {3} +$$ + +where $U(\mathbf{a},\mathbf{b})$ is the set of the couplings: + +$$ +U (\mathbf {a}, \mathbf {b}) = \left\{\mathbf {P} \in \mathbb {R} _ {+} ^ {n \times m} \mid \mathbf {P} \mathbf {1} _ {m} = \mathbf {a}, \mathbf {P} ^ {\top} \mathbf {1} _ {n} = \mathbf {b} \right\}. \tag {4} +$$ + +which is bounded and defined by $n + m$ equality constraints. + +A lot of methods (Bertsimas & Tsitsiklis, 1997; Benamou & Brenier, 2000) are proposed to solve the Kantorovitch OT problem and relaxing with the entropic regularization (Wilson, 1969) is one of the simple but efficient methods, whose objective reads: + +$$ +\min _ {\mathbf {P} \in U (\mathbf {a}, \mathbf {b})} \left\langle \mathbf {C}, \mathbf {P} \right\rangle - \epsilon H (\mathbf {P}), \tag {5} +$$ + +where $\epsilon > 0$ is the coefficient for entropic regularization $H(\mathbf{P})$ and the $H(\mathbf{P})$ can be specified as + +$$ +H (\mathbf {P}) = - \sum_ {i, j} \mathbf {P} _ {i j} (\log (\mathbf {P} _ {i j} - 1)). \tag {6} +$$ + +The objective in Eq. 5 is an $\epsilon$ -strongly convex function, and thus the optimization has a unique solution, which can be solved with iterative methods (e.g. the Sinkorn method (Sinkhorn, 1967)). If we use this entropic regularized OT to solve the matching problem, the hard matching problem may convert to soft matching. + +Inverse Optimal Transport (IOT) has been explored in several studies (Dupuy et al., 2016; Li et al., 2019; Stuart & Wolfram, 2020), aiming to infer the unknown cost matrix $\mathbf{C}$ that generates the observed coupling. The work by (Stuart & Wolfram, 2020) presents a systematic approach for inferring these unknown costs, while (Chiu et al., 2022) develops the mathematical theory underpinning IOT. In addition, (Shi et al., 2023) demonstrates a brand new series of contrastive losses with set matching based on IOT. The IOT problem can be formulated as a bi-level optimization problem: + +$$ +\min _ {\theta} K L (\tilde {\mathbf {P}} \mid \mathbf {P} ^ {\theta}) \quad \text {w h e r e} \quad \mathbf {P} ^ {\theta} = \arg \min _ {\mathbf {P} \in U (\mathbf {a}, \mathbf {b})} \left\langle \mathbf {C} ^ {\theta}, \mathbf {P} \right\rangle - \epsilon H (\mathbf {P}). \tag {7} +$$ + +where $\tilde{\mathbf{P}}$ is the ground truth for supervision. IOT facilitates the capture of fine-grained relationships between sample features, thereby enhancing the transfer of structured knowledge from the teacher model to the student model during the knowledge distillation process. + +# 3 METHODOLOGY AND FORMULATIONS + +In contrast to vanilla KD where the student learns all the information from the teacher, we propose the setting of Selective KD (SelKD) that transfers only selective knowledge to the student. Without loss of generality, in this paper we view the classification task with optimal transport, in which labels are defined as a set of features (e.g. one-hot vectors or features extracted by a text encoder) and images are also represented with features extracted by an image encoder. Our goal is to establish a match or transportation between the features of images and texts with the formulation of OT. In this case, variants of optimal transport with specific properties could be introduced to solve the KD problem. + +# 3.1 OPTIMAL TRANSPORT FORMULATED (LOGIT-BASED) KNOWLEDGE DISTILLATION + +Teacher Training via IOT perspective. Given the batch data $\{(\mathbf{x}_i,\mathbf{y}_i)_{i = 1}^N\}$ , where $\mathbf{y}_i$ is the one-hot vector corresponding to sample $\mathbf{x}_i$ and $N$ is the batch size, the features of the samples and labels can + +![](images/c5263016647e5a5f49e698a0d699e64c318c6531c112741ce83ee96cdec27b1a.jpg) +Figure 2: The overview of our approach for both closed-set and open-set SelKD tasks. We first compute cost matrices with features extracted from image samples and labels with encoders (CNN) respectively. The regularized OT is used to analyze and estimate the coupling of the student, which is supervised with ground truth and the coupling of the teacher for representation learning. + +be represented by two sets: $\{f_{\theta}(\mathbf{x}_i)\}_{i = 1}^N,\{g_{\theta}(\mathbf{y}_j)\}_{j = 1}^M$ . The label matrix is denoted as $\mathbf{Y} = \{\mathbf{y}_j\}_{j = 1}^M$ The training process of the teacher model can then be reformulated as a bi-level optimization: + +$$ +\min _ {\theta} K L (\mathbf {Y} \mid \mathbf {P} ^ {\theta}) \quad \text {w h e r e} \quad \mathbf {P} ^ {\theta} = \arg \min _ {\mathbf {P} \mathbf {1} = \mathbf {1}} \left\langle \mathbf {C} ^ {\theta}, \mathbf {P} \right\rangle - \epsilon H (\mathbf {P}). \tag {8} +$$ + +Here the cost matrix $\mathbf{C}^{\theta}\in \mathbb{R}_{+}^{n\times m}$ is designed with features $\{f_{\theta}(\mathbf{x}_i)\}_{i = 1}^N,\{g_{\theta}(\mathbf{y}_j)\}_{j = 1}^M$ with parameters $\theta$ from the networks $f_{\theta}$ and $g_{\theta}$ . This bi-level optimization consists of an outer and an inner optimization. As proved in (Shi et al., 2023), the outer optimization can be regarded as minimization of the cross-entropy loss, while the inner optimization, resembling an optimal transport (OT) problem, operates like a Softmax function, with the constraint $\mathbf{P1} = \mathbf{1}$ ensuring that the probabilities across each category sum to 1. A detailed explanation can be found in Appendix B. These constraints can be interpreted as simplified versions of the row and column sum constraints $U(\mathbf{a},\mathbf{b})$ in OT. From this perspective, the teacher's learning process can be viewed as a bi-level optimization within the framework of entropic regularized OT. Compared to the Bayesian approach, this method offers greater flexibility in selecting desired categories, making it well-suited for implementing SelKD framework. + +(Logit-based) KD via IOT perspective. Inspired by the Inverse Optimal Transport (IOT) framework, as described in Eq. 7, we propose a novel approach to integrate IOT constraints into the knowledge distillation (KD) process. Using logit-based KD as an example, we reformulate the knowledge distillation process as a bi-level optimization problem: + +$$ +\begin{array}{r l} & {\underset {\theta} {\min } C E (\mathbf {Y} \mid \mathbf {P} _ {s} ^ {\theta}) + \lambda \cdot K L (\mathbf {P} _ {t} \| \mathbf {P} _ {s} ^ {\theta}),} \\ {\text {w h e r e}} & {\mathbf {P} _ {t} = \arg \underset {\mathbf {P 1} = \mathbf {1}} {\min } \langle \mathbf {C} _ {t}, \mathbf {P} \rangle - \epsilon H (\mathbf {P}) \quad \mathbf {P} _ {s} ^ {\theta} = \arg \underset {\mathbf {P 1} = \mathbf {1}} {\min } \langle \mathbf {C} _ {s} ^ {\theta}, \mathbf {P} \rangle - \epsilon H (\mathbf {P}).} \end{array} \tag {9} +$$ + +Here $H(\mathbf{P})$ is the entropic regularization as defined in Eq. 6, and $\mathbf{Y}$ denotes the label matrix. In this optimization, the cost matrix $\mathbf{C}_t \in \mathbb{R}_+^{n \times m}$ is designed with features from the pre-trained teacher + +networks $f_{t}$ and $g_{t}$ , while $\mathbf{C}_s^\theta \in \mathbb{R}_+^{n\times m}$ is computed with features $\{f_{s,\theta}(\mathbf{x}_i)\}_{i = 1}^N$ , $\{g_{s,\theta}(\mathbf{y}_j)\}_{j = 1}^M$ with parameters $\theta$ from the networks $f_{s,\theta}$ and $g_{s,\theta}$ . Different from previous works setting $U = \{\mathbf{P}:\mathbf{P}\mathbf{1} = \mathbf{1}\}$ , we think the constraint $U$ can be designed according to the specific circumstances of the problem, especially in the case of open-set tasks. We will discuss it in detail in the next subsection. In the outer minimization, the coupling $\mathbf{P}_s^\theta$ is calculated by OT's inner minimization and $\mathbf{Y}$ is the ground truth for supervision. + +The aim of outer minimization is to supervise the student coupling with the ground truth and the teacher coupling, in order to learn the feature extractor (i.e. $f_{s,\theta}(\cdot)$ and $g_{s,\theta}(\cdot)$ ). Simultaneously, the inner minimization formulates the distillation problem as an entropic regularized optimal transport task. Our overarching goal is to derive the student coupling $\mathbf{P}_s^\theta$ that aligns with the teacher coupling $\mathbf{P}_t$ , utilizing the respective cost matrices $\mathbf{C}_s^\theta$ and $\mathbf{C}_t$ . + +To summarize, this innovative perspective on logit-based knowledge distillation (KD) through the lens of Inverse Optimal Transport (IOT) reformulates the distillation process as a bi-level optimization problem. By incorporating IOT constraints, it allows for a more structured approach to aligning the teacher's and student's knowledge. In addition, the IOT-based view leads to the introduction of Selective Knowledge Distillation (SelKD), which focuses on targeted and efficient knowledge transfer and allows the student model to selectively learn relevant knowledge for specific subtasks. + +# 3.2 SELECTIVE KNOWLEDGE DISTILLATION VIA INVERSE OPTIMAL TRANSPORT + +In traditional knowledge distillation, the primary objective is to transfer the entire knowledge of the teacher model to the student model in a straightforward end-to-end manner. However, this approach can be inefficient and overly complex, especially in real-world applications where a student model may only need to perform a subset of tasks. Our proposed method, Selective Knowledge Distillation (SelKD), addresses this limitation by enabling the student model to learn only the relevant knowledge from the teacher model for specific subtasks, with evaluations focused solely on those areas during testing. Figure 1 illustrates the difference between vanilla KD and our proposed SelKD. + +Leveraging the perspective of Inverse Optimal Transport (IOT) in Eq. 9, we can formalize a general bi-level optimization framework for SelKD, expressed as follows: + +$$ +\min _ {\theta} C E (\mathbf {Y} \mid \mathbf {P} _ {s} ^ {\theta}) + \lambda \cdot K L (\mathbf {P} _ {t} \| \mathbf {P} _ {s} ^ {\theta}), +$$ + +$$ +\text {w h e r e} \quad \mathbf {P} _ {t} = \arg \min _ {U} \langle \mathbf {C} _ {t}, \mathbf {P} \rangle - \epsilon H (\mathbf {P}) \quad \mathbf {P} _ {s} ^ {\theta} = \arg \min _ {U} \langle \mathbf {C} _ {s} ^ {\theta}, \mathbf {P} \rangle - \epsilon H (\mathbf {P}). \tag {10} +$$ + +In this formulation, $U$ represents the general constraints for the coupling. A key advantage of this approach is that it allows us to tailor the cost matrices $\mathbf{C}_s^\theta$ and $\mathbf{C}_t$ according to the specific categories we select for distillation. This flexibility enables a more nuanced and effective knowledge transfer, as the constraints can be adjusted based on the particularities of the tasks at hand. + +In the following sections, we will detail how to specify the constraints $U$ and select feasible categories to formalize the optimization process, whether in closed-set or open-set scenarios. + +# 3.2.1 (CLOSED-SET) SELECTIVE KNOWLEDGE DISTILLATION + +We begin by analyzing Eq. 10 under the constraint $U = \{\mathbf{P} : \mathbf{P1} = \mathbf{1}\}$ . In this context, we partition the training set based on the selected categories. Specifically, we define the complete category set as $\mathcal{C} = \{1,2,\dots ,N\}$ where $N$ represents the total number of categories. We set the entire dataset $S = \{(\mathbf{x}_i,\mathbf{y}_i)_i = 1^M\}$ where $M$ is the size of dataset and $\mathbf{y}_i$ is the one-hot vector corresponding to sample $\mathbf{x}_i$ . Without loss of generality, denoting the selected categories set $\mathcal{C}_{\mathrm{closed - set}} = \{1,2,\dots ,n\} \subset \mathcal{C}$ with $n < N$ , we denote $S_{\mathrm{closed - set}} = \{(\mathbf{x}_i,\mathbf{y}_i)\mid \mathbf{y}_i\in \mathrm{one - hot}(\mathcal{C}_{\mathrm{closed - set}})\}$ . Here one-hot(·) is a mapping function that converts all elements in the set to their one-hot representations. + +For the batch data $\{(\mathbf{x}_i,\mathbf{y}_i)_{i = 1}^m\} \subset S_{\mathrm{closed - set}}$ where $m$ is the batch size, the features of samples and labels can be represented by two sets $\{\{f_{s,\theta}(\mathbf{x}_i)\}_{i = 1}^m,\{g_{s,\theta}(\mathbf{y}_j)\}_{j = 1}^n\}$ and $\{\{f_t(\mathbf{x}_i)\}_{i = 1}^m,\{g_t(\mathbf{y}_j)\}_{j = 1}^n\}$ regarding student and teacher extracted features. Denoting $S_{\mathrm{image}} = \{(\mathbf{x}_i)_{i = 1}^m\}$ , without loss of generality, we set $\mathbf{C}_s$ and $\mathbf{C}_t$ as follows: + +$$ +\left(\mathbf {C} _ {s} ^ {\theta}\right) _ {i j} = - f _ {s, \theta} \left(\mathbf {x} _ {i}\right) \cdot g _ {s, \theta} (\mathbf {y} _ {j}) \quad \left(\mathbf {C} _ {t}\right) _ {i j} = - f _ {t} \left(\mathbf {x} _ {i}\right) \cdot g _ {t} (\mathbf {y} _ {j}) \quad \text {f o r} \quad i \in S _ {\text {i m a g e}}, j \in \mathcal {C} _ {\text {c l o s e d - s e t}} \tag {11} +$$ + +For traditional classifiers, $f(\cdot)$ represents the image encoder and $g(\cdot)$ represents the label encoder (e.g., one-hot encoding). For multimodal classifiers based on CLIP (Radford et al., 2021), $f(\cdot)$ represents the image encoder while $g(\cdot)$ represents the text encoder. Our formulation generalizes this approach, making it more adaptable to a wider range of methods. + +Figure 2 illustrates the pipeline of our method. Initially, we compute the cost matrices using features extracted from image samples and labels via encoders (CNN). These cost matrices are then incorporated into Eq. 11, forming the optimization formula for SelKD. To facilitate understanding, the cost matrices can be interpreted as the negative of similarity matrices (ignoring constant factors in the optimization problem). + +# 3.2.2 OPEN-SET VERSION FOR SELECTIVE KNOWLEDGE DISTILLATION + +We propose open-set SelKD, an extension of the SelKD framework mentioned above, designed to address the recognition of classes that were not included in the student's training subset. Specifically, in smaller or resource-constrained devices, SelKD tasks does not allow the student model to be trained on the full set of classes from the teacher model. Open-set SelKD requires student models to handle cases where an input sample falls outside the scope of the subtask that the student has been trained to recognize. In such situations, rather than attempting to force a classification, the student model is equipped to produce a "not selected" or "reject due to unknown" response, effectively acknowledging that the sample does not belong to any of the known classes. This ability to reject unknown inputs enhances the robustness and applicability of SelKD, especially in open-set or dynamic environments where new or unseen classes may emerge. + +Algorithm 1: Computing the KL divergence between student and teacher couplings under Open-set SelKD + +Input : features $\mathbf{F}_{\mathrm{image},t}$ and $\mathbf{F}_{\mathrm{image},s}$ extracted from image samples, $\mathbf{F}_{\mathrm{label},t}$ and $\mathbf{F}_{\mathrm{label},s}$ extracted from labels, (footnotes $s$ or $t$ represents student and teacher models, respectively), temperature $\tau$ and parameter $\gamma$ + +Output:Loss function $\mathcal{L}$ + +Initialize $\mathbf{C}_s = \mathbf{F}_{\mathrm{image},s}\mathbf{F}_{\mathrm{label},s}^\top$ and $\mathbf{C}_t = \mathbf{F}_{\mathrm{image},t}\mathbf{F}_{\mathrm{label},t}^\top$ + +Compute $\mathbf{P}_s^{(0)} = e^{-\mathbf{C}_s / \tau}$ and $\mathbf{P}_t^{(0)} = e^{-\mathbf{C}_t / \tau}$ + +for $l = 1,2,\dots ,L$ do + +$$ +\mathbf {P} _ {s} ^ {(l)} = \frac {\mathbf {P} _ {s} ^ {(l)}}{\max (\mathbf {P} _ {s} ^ {(l)} \mathbf {1} , \mathbf {1})} +$$ + +$$ +\mathbf {P} _ {s} ^ {(l + 1)} = \mathbf {P} _ {s} ^ {(l)} \cdot \frac {\gamma}{\mathbf {1} ^ {\top} \mathbf {P} _ {s} ^ {(l)} \mathbf {1}} +$$ + +$$ +\mathbf {P} _ {t} ^ {(l)} = \frac {\mathbf {P} _ {t} ^ {(l)}}{\max (\mathbf {P} _ {t} ^ {(l)} \mathbf {1} , \mathbf {1})} +$$ + +$$ +\mathbf {P} _ {t} ^ {(l + 1)} = \mathbf {P} _ {t} ^ {(l)} \cdot \frac {\gamma}{\mathbf {1} ^ {\top} \mathbf {P} _ {t} ^ {(l)} \mathbf {1}} +$$ + +end + +return $\mathcal{L} = -\mathbf{1}^{\top}(\mathbf{P}_t\cdot \log (\mathbf{P}_s))\mathbf{1}$ + +To formulate open-set SelKD with an optimization based on the closed-set version, we first relax the constraints by setting $\mathbf{P1} = \mathbf{1}$ to a new one motivated by Partial Optimal Transport given as + +$$ +U _ {\mathrm {M} - \mathrm {P O T}} = \left\{\mathbf {P} \mathbf {1} \leq \mathbf {1}, \mathbf {1} ^ {\top} \mathbf {P} \mathbf {1} = \gamma \right\} \tag {12} +$$ + +where $\gamma$ is the number of batch sample classified to the categories of the subtask. + +Similarly, we define the complete category set as $\mathcal{C} = \{1,2,\dots ,N\}$ where $N$ represents the total number of categories. We set the entire dataset $\mathcal{S} = \{\left(\mathbf{x}_i,\mathbf{y}_i\right)_{i = 1}^M\}$ where $M$ is the size of dataset and $\mathbf{y}_i$ is the one-hot vector corresponding to sample $\mathbf{x}_i$ . Without loss of generality, denoting the selected categories set $\mathcal{C}_{\mathrm{closed - set}} = \{1,2,\dots ,n\} \subset \mathcal{C}$ with $n < N$ , we denote $\mathcal{C}_{\mathrm{open - set}} = \mathcal{C}_{\mathrm{closed - set}}\cup \{n + 1\}$ where $n + 1$ represents the union of "not selected" categories in the student model. + +For the batch data $\{(\mathbf{x}_i,\mathbf{y}_i)_{i = 1}^m\} \subset S$ , the features of samples and labels can be represented by two sets $\{\{f_{s,\theta}(\mathbf{x}_i)\}_{i = 1}^m,\{g_{s,\theta}(\mathbf{y}_j)\}_{j = 1}^{n + 1}\}$ and $\{\{f_t(\mathbf{x}_i)\}_{i = 1}^m,\{g_t(\mathbf{y}_j)\}_{j = 1}^N\}$ with footnotes. Denoting $S_{\mathrm{image}} = \{(x_i)_i = 1\}$ , without loss of generality, we set $\mathbf{C}_s$ and $\mathbf{C}_t$ as follows: + +$$ +\left(\mathbf {C} _ {s} ^ {\theta}\right) _ {i j} = - f _ {s, \theta} \left(\mathbf {x} _ {i}\right) \cdot g _ {s, \theta} \left(\mathbf {y} _ {j}\right) \quad \left(\mathbf {C} _ {t}\right) _ {i j} = - f _ {t} \left(\mathbf {x} _ {i}\right) \cdot g _ {t} \left(\mathbf {y} _ {j}\right) \quad \text {f o r} \quad i \in S _ {\text {i m a g e}}, j \in C _ {\text {o p e n - s e t}} \tag {13} +$$ + +Table 1: Top-1 accuracy (\%) on CIFAR-100 for closed-set SelKD. We compare the performance of vanilla knowledge distillation (KD), self-knowledge distillation (SKD) and our selective knowledge distillation (SelKD) in the closed-set SelKD classification tasks. All the comparisons are conducted based on feature-based distillation (FitNet Romero et al. (2014), FT Kim et al. (2018) and AT Zagoruyko & Komodakis (2016)). + +
Student NetworksMethodsSubTask 0SubTask 1SubTask 2SubTask 3SubTask 4Mean of SubTasks#Param of Teachers + Students
ResNet-8Without KD81.0082.4580.8576.9083.3080.900 + 0.4M
FitNet-KD81.5083.5582.2078.5085.6582.28117.7M + 0.4M
FitNet-SKD81.7083.2581.5577.7585.0581.860.4M + 0.4M
FitNet-SelKD82.9584.4582.2578.8585.9082.8823.7M + 0.4M
FT-KD81.5083.5082.9578.5086.1582.52117.7M + 0.4M
FT-SKD81.2082.8080.7077.8083.7081.240.4M + 0.4M
FT-SelKD82.7584.2082.8580.3586.3583.3023.7M + 0.4M
AT-KD81.0584.3581.6078.1085.0582.03117.7M + 0.4M
AT-SKD80.1582.8081.2577.4083.5081.020.4M + 0.4M
AT-SelKD82.4584.7082.2078.5085.3082.6323.7M + 0.4M
ResNet-14Without KD83.6085.4084.1081.2086.5584.170 + 0.9M
FitNet-KD83.6086.0084.8581.5588.0084.80117.7M + 0.9M
FitNet-SKD83.0084.0581.8079.1085.0082.590.9M + 0.9M
FitNet-SelKD84.3086.2084.9081.8588.3085.1123.7M + 0.9M
FT-KD83.9085.9084.8581.6587.8584.83117.7M + 0.9M
FT-SKD83.0585.9082.5579.7586.8083.610.9M + 0.9M
FT-SelKD85.3087.5584.7582.8087.9085.6623.7M + 0.9M
AT-KD84.0586.7584.6081.4587.0084.77117.7M + 0.9M
AT-SKD83.0583.9582.0079.3585.2082.710.9M + 0.9M
AT-SelKD85.0087.0585.7582.9587.2585.6023.7M + 0.9M
+ +Then the optimization can be modified as + +$$ +\min _ {\boldsymbol {\theta}} C E (\mathbf {Y} \mid \mathbf {P} _ {s} ^ {\boldsymbol {\theta}}) + \lambda \cdot K L (\mathbf {P} _ {t} \parallel \mathbf {P} _ {s} ^ {\boldsymbol {\theta}}), +$$ + +where $\mathbf{P}_t = \arg \min_{\mathbf{P1}\leq \mathbf{1},\mathbf{1}^\top \mathbf{P1} = \gamma}\langle \mathbf{C}_t,\mathbf{P}\rangle -\epsilon H(\mathbf{P})$ (14) + +$$ +\mathbf {P} _ {s} ^ {\theta} = \arg \min _ {\mathbf {P} \mathbf {1} \leq \mathbf {1}, \mathbf {1} ^ {\top} \mathbf {P} \mathbf {1} = \gamma} \langle \mathbf {C} _ {s} ^ {\theta}, \mathbf {P} \rangle - \epsilon H (\mathbf {P}) +$$ + +The entire process can be summarized by Algorithm 1. For the prediction in the inference process, we calculate Eq. 14 given the batch testing data. Then for the prediction of sample $i$ , we do the arg max operation $(\mathbf{P}_s)_{i,j}$ on every $j$ and $1 - \sum_{j}(\mathbf{P}_s)_{i,j}$ as the result. + +# 4 EXPERIMENTS + +# 4.1 BASIC SETTINGS + +Our experiments are performed using PyTorch 1.4.0 and run on Intel Core i7-7820X CPU @ 3.60GHz with Nvidia GeForce RTX 3080. We take single GPU for classification on CIFAR-10, CIFAR-100 (Krizhevsky et al., 2009) and Tiny ImageNet (Le & Yang, 2015), and evaluate on testing data by top-1 accuracy. + +Experimental Setting Details. For CIFAR-10 and CIFAR-100, we adopt ResNet50 (He et al., 2016) as the backbone teacher model, while for Tiny ImageNet, we use ResNet32 for training. The settings for students also vary depending on datasets. For CIFAR-10 and CIFAR-100, the experiments of image classification tasks are based on ResNet8 and ResNet14 as the backbone of students. For Tiny ImageNet dataset, we adopt only ResNet8 for training. As for the learning rate, we set 0.05 for all tasks with regard to CIFAR-10 and CIFAR-100 datasets. For Tiny ImageNet, learning rate is 0.2. + +As the primary focus of this paper is to pose the problem of selective knowledge distillation, and to find feasible ways to work on the problem, we do not adopt additional specialized techniques to + +Table 2: Top-1 accuracy (%) on Tiny ImageNet for closed-set SelKD with ResNet-8 as backbone. We compare the performance of vanilla knowledge distillation (KD) and our selective knowledge distillation (SelKD) in the closed-set SelKD classification tasks. + +
MethodsSubTask 0SubTask 1SubTask 2SubTask 3SubTask 4Mean of SubTasks
Without KD52.0553.4053.0050.1554.8552.69
FitNet-KD52.5554.0054.1051.2555.6053.50
FitNet-SelKD53.2054.9554.8052.0556.4054.28
FT-KD52.4553.9554.1552.0055.6053.63
FT-SelKD53.1555.0554.7052.1056.5554.31
AT-KD52.9554.6054.4551.0555.2553.66
AT-SelKD52.9054.7055.2051.9055.9054.12
+ +improve performance, such as resampling. This is to control variables and thus all the baselines used in this study represent only the method of knowledge distillation proposed by them. + +# 4.2 EXPERIMENTS ON (CLOSED-SET) SELKD + +For SelKD, we decompose the overall classification task into various subtasks, with scales varying by dataset. Specifically, for the CIFAR-10 dataset, which consists of 10 classes, we split the task into 2 subtasks, each containing 5 classes. In contrast, CIFAR-100 and Tiny ImageNet, with 100 classes each, are divided into 5 subtasks, each containing 20 classes. We combine feature-based KD methods with different KD frameworks, including vanilla KD, self KD and our SelKD, for a comprehensive comparison to highlight the advantages of our SelKD framework. For feature-based KD, we select typical methods including FitNet (Romero et al., 2014), FT (Kim et al., 2018), and AT (Zagoruyko & Komodakis, 2016). Notably, in both vanilla KD (KD) and self-KD (SKD), we train separate teachers for each subtask, while in SelKD approach, a single teacher is trained to cover all subtasks. + +The results of SelKD tasks on the CIFAR-100 and Tiny ImageNet dataset are presented in Table 1 and Table 2, with results for CIFAR-10 is shown in the Appendix A. Our findings clearly indicate that, regardless of the feature-based distillation method employed, SelKD outperforms both KD and SKD in terms of top-1 accuracy. Furthermore, our SelKD method requires fewer parameters compared to KD, which necessitates training an additional teacher for each subtask. Experimental results suggest that a teacher with comprehensive knowledge enhances the performance of subtask students more effectively than multiple teachers with knowledge limited to specific areas. This is because the additional knowledge from the comprehensive teacher aids students in mastering the selected knowledge. + +# 4.3 EXPERIMENTS ON OPEN-SET SELKD + +We further examine the application of our SelKD method on open-set SelKD tasks. We first apply Algorithm 1 on all the tasks similar to those of closed-set SelKD, but we add an extra class for "not selected" knowledge in each subtask student model. Specifically, for CIFAR-10 dataset, the whole task is separated into 2 subtasks with 6 classes each (5 for selected classes and 1 for all "not selected" classes), while both CIFAR-100 and Tiny ImageNet classification tasks are separated into 5 subtasks with 21 classes each (20 for selected classes and 1 for all "not selected" classes). Table 3 demonstrates the results of open-set SelKD experiments on CIFAR-100. + +We have observed that, in line with the results in closed-set SelKD tasks, the experiments conducted on the open-set SelKD tasks reveal that training a group of students with different disjoint tasks is more advantageous when facilitated by a teacher possessing comprehensive knowledge, as opposed to assigning separate teachers who are only well-versed in selected knowledge for each task. This finding also highlights the notable advantage of employing our selective knowledge distillation method in predicting samples that belong to "not selected" knowledge. + +Table 3: Top-1 accuracy (%) on CIFAR-100 for open-set SelKD. We compare the performance of vanilla knowledge distillation (KD), self-knowledge distillation (SKD) and our selective knowledge distillation (SelKD) in the open-set SelKD classification tasks. All the comparisons are conducted based on feature-based distillation (FitNet Romero et al. (2014), FT Kim et al. (2018) and AT Zagoruyko & Komodakis (2016)). + +
Student NetworksMethodsSubTask 0SubTask 1SubTask 2SubTask 3SubTask 4Mean of SubTasks#Param of Teachers + Students
ResNet-8Without KD82.1982.8282.6282.4481.4282.300 + 0.4M
FitNet-KD84.6585.2085.6985.7284.2085.10117.7M + 0.4M
FitNet-SKD84.7785.4185.6085.5484.6285.190.4M + 0.4M
FitNet-SelKD85.6386.4686.6986.6185.6586.2123.7M + 0.4M
FT-KD84.8385.3286.0386.0584.8285.41117.7M + 0.4M
FT-SKD84.7985.0685.4885.4784.8685.130.4M + 0.4M
FT-SelKD86.1786.6287.2886.9986.3586.6923.7M + 0.4M
AT-KD84.4685.3285.8586.1684.3185.22117.7M + 0.4M
AT-SKD84.6285.2185.5685.6984.7385.160.4M + 0.4M
AT-SelKD85.8186.5787.2086.5985.7686.3923.7M + 0.4M
ResNet-14Without KD84.1583.6883.1584.2282.9383.630 + 0.9M
FitNet-KD86.9287.2187.6487.7587.2687.36117.7M + 0.9M
FitNet-SKD87.5287.5487.5487.7687.9587.540.9M + 0.9M
FitNet-SelKD87.2787.7087.8187.8587.6887.6623.7M + 0.9M
FT-KD87.4688.0488.2488.4488.0288.04117.7M + 0.9M
FT-SKD87.3387.9988.0487.9687.9287.860.9M + 0.9M
FT-SelKD87.6088.4688.2488.8288.6488.3523.7M + 0.9M
AT-KD86.9387.5887.9688.0487.2987.56117.7M + 0.9M
AT-SKD86.5487.1387.1586.6185.9086.670.9M + 0.9M
AT-SelKD87.0387.6788.0488.0187.4787.6423.7M + 0.9M
+ +Table 4: Ablation Study of SelKD on CIFAR-100. + +
Loss SettingsSubTask 0SubTask 1SubTask 2SubTask 3SubTask 4Mean of SubTasks
Without Distillation83.5085.8583.2080.9587.4584.19
Without Logit-based Loss83.6086.0583.8080.6085.8583.98
Without Feature-based Loss83.9586.1584.7081.8088.1584.95
Ours84.3086.2084.9081.8588.3085.11
+ +# 4.4 ABLATION STUDY + +Regarding the previously presented experiments, the loss function can be divided into three parts, namely from cross-entropy loss with dataset labels, KL divergence with teacher coupling and the divergence with features from the teacher. Here we further explore how the accuracy of the student model is influenced when certain components are absent from the three aforementioned parts. To be more precise, we conduct separate tests to evaluate the impact of each component's absence and compare the obtained results with the original outcome. The results of these tests are summarized and presented in the Table 4. + +Based on the analysis of the table data, it is apparent that the removal of any component from the loss function results in a reduction in the accuracy of the student model. Hence, it is imperative to include all parts of losses in the final settings when seeking a more suitable training method for handling Selective KD tasks. Each module plays a crucial role and is indispensable for best performance. + +# 5 CONCLUSION + +We have proposed a new and practical setting for Knowledge Distillation, called Selective Knowledge Distillation (SelKD), which transfers the partial knowledge to student instead of the whole knowledge in vanilla KD. OT is applied for the SelKD, to help the student learn the subtask. Our current work is focused on classification (including open-set setting). + +# REFERENCES + +Jean-David Benamou and Yann Brenier. A computational fluid mechanics solution to the mongekantorovich mass transfer problem. Numerische Mathematik, 84(3):375-393, 2000. +Jean-David Benamou, Guillaume Carlier, Marco Cuturi, Luca Nenna, and Gabriel Peyré. Iterative bregman projections for regularized transportation problems. SIAM Journal on Scientific Computing, 37(2):A1111-A1138, 2015. +Dimitris Bertsimas and John N Tsitsiklis. Introduction to linear optimization, volume 6. Athena Scientific Belmont, MA, 1997. +Cristian Bucila, Rich Caruana, and Alexandru Niculescu-Mizil. Model compression. In Knowledge Discovery and Data Mining, 2006. URL https://api-semanticscholar.org/CorpusID:11253972. +Wei-Ting Chiu, Pei Wang, and Patrick Shafto. Discrete probabilistic inverse optimal transport. In International Conference on Machine Learning, pp. 3925-3946. PMLR, 2022. +Qianggang Ding, Sifan Wu, Hao Sun, Jiadong Guo, and Shu-Tao Xia. Adaptive regularization of labels. arXiv preprint arXiv:1908.05474, 2019. +Arnaud Dupuy, Alfred Galichon, and Yifei Sun. Estimating matching affinity matrix under low-rank constraints. arXiv preprint arXiv:1612.09585, 2016. +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, pp. 770-778, 2016. +Geoffrey Hinton, Oriol Vinyals, and Jeff Dean. Distilling the knowledge in a neural network. arXiv preprint arXiv:1503.02531, 2015. +Xiaoqi Jiao, Yichun Yin, Lifeng Shang, Xin Jiang, Xiao Chen, Linlin Li, Fang Wang, and Qun Liu. Tinybert: Distilling bert for natural language understanding. arXiv preprint arXiv:1909.10351, 2019. +L Kantorovich. On the transfer of masses (in russian). In Doklady Akademii Nauk, volume 37, pp. 227, 1942. +Jangho Kim, Seong Uk Park, and Nojun Kwak. Paraphrasing complex network: Network compression via factor transfer. Advances in neural information processing systems, 31, 2018. +Seung Wook Kim and Hyo-Eun Kim. Transferring knowledge to smaller network with class-distance loss. 2017. +Ru Kong, Jingwei Li, Csaba Orban, Mert R Sabuncu, Hesheng Liu, Alexander Schaefer, Nanbo Sun, Xi-Nian Zuo, Avram J Holmes, Simon B Eickhoff, et al. Spatial topography of individual-specific cortical networks predicts human cognition, personality, and emotion. Cerebral cortex, 29(6): 2533-2551, 2019. +Alex Krizhevsky, Geoffrey Hinton, et al. Learning multiple layers of features from tiny images. 2009. +Nathaniel Lahn, Sharath Raghvendra, and Kaiyi Zhang. A combinatorial algorithm for approximating the optimal transport in the parallel and MPC settings. Advances in Neural Information Processing Systems, 36:21675-21686, 2023. +Ya Le and Xuan Yang. Tiny imagenet visual recognition challenge. CS 231N, 7(7):3, 2015. +Seung Hyun Lee, Dae Ha Kim, and Byung Cheol Song. Self-supervised knowledge distillation using singular value decomposition. In Proceedings of the European conference on computer vision (ECCV), pp. 335-350, 2018. +Lujun Li. Self-regulated feature learning via teacher-free feature distillation. In European Conference on Computer Vision, pp. 347-363. Springer, 2022. + +Ruilin Li, Xiaojing Ye, Haomin Zhou, and Hongyuan Zha. Learning to match via inverse optimal transport. Journal of machine learning research, 20(80):1-37, 2019. +Yuang Liu, Wei Zhang, and Jun Wang. Adaptive multi-teacher multi-level knowledge distillation. Neurocomputing, 415:106-113, 2020. +Rafael Müller, Simon Kornblith, and Geoffrey E Hinton. When does label smoothing help? Advances in neural information processing systems, 32, 2019. +Yiteng Pan, Fazhi He, and Haiping Yu. A novel enhanced collaborative autoencoder with knowledge distillation for top-n recommender systems. Neurocomputing, 332:137-148, 2019. +Abhijeet Phatak, Sharath Raghvendra, Chittaranjan Tripathy, and Kaiyi Zhang. Computing all optimal partial transports. In International Conference on Learning Representations, 2023. +Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, et al. Learning transferable visual models from natural language supervision. In International conference on machine learning, pp. 8748-8763. PMLR, 2021. +Sharath Raghvendra, Pouyan Shirzadian, and Kaiyi Zhang. A new robust partial $p$ -wasserstein-based metric for comparing distributions. In International Conference on Machine Learning, 2024. +Adriana Romero, Nicolas Ballas, Samira Ebrahimi Kahou, Antoine Chassang, Carlo Gatta, and Yoshua Bengio. Fitnets: Hints for thin deep nets. arXiv preprint arXiv:1412.6550, 2014. +Peng Shen, Xugang Lu, Sheng Li, and Hisashi Kawai. Knowledge distillation-based representation learning for short-utterance spoken language identification. IEEE/ACM Transactions on Audio, Speech, and Language Processing, 28:2674–2683, 2020. +Liangliang Shi, Peili Lu, and Junchi Yan. Causality learning from time series data for the industrial finance analysis via the multi-dimensional point process. Intelligent Automation & Soft Computing, 26(5), 2020. +Liangliang Shi, Gu Zhang, Haoyu Zhen, Jintao Fan, and Junchi Yan. Understanding and generalizing contrastive learning from the inverse optimal transport perspective. In International conference on machine learning, pp. 31408-31421. PMLR, 2023. +Liangliang Shi, Jack Fan, and Junchi Yan. Ot-clip: Understanding and generalizing clip via optimal transport. In *Forty-first International Conference on Machine Learning*, 2024a. +Liangliang Shi, Zhaoqi Shen, and Junchi Yan. Double-bounded optimal transport for advanced clustering and classification. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 38, pp. 14982-14990, 2024b. +Liangliang Shi, Haoyu Zhen, Gu Zhang, and Junchi Yan. Relative entropic optimal transport: a (prior-aware) matching perspective to (unbalanced) classification. Advances in Neural Information Processing Systems, 36, 2024c. +Richard Sinkhorn. Diagonal equivalence to matrices with prescribed row and column sums. The American Mathematical Monthly, 74(4):402-405, 1967. +Andrew M Stuart and Marie-Therese Wolfram. Inverse optimal transport. SIAM Journal on Applied Mathematics, 80(1):599-619, 2020. +Shangquan Sun, Wenqi Ren, Jingzhi Li, Rui Wang, and Xiaochun Cao. Logit standardization in knowledge distillation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 15731-15740, 2024. +Guolong Wang, Xun Wu, Zheng Qin, and Liangliang Shi. Routing evidence for unseen actions in video moment retrieval. In Proceedings of the 30th ACM SIGKDD conference on knowledge discovery and data mining, pp. 3024-3035, 2024. + +Wei Wang, Dejan Slepčev, Saurav Basu, John A Ozolek, and Gustavo K Rohde. A linear optimal transportation framework for quantifying and visualizing variations in sets of images. International journal of computer vision, 101:254-269, 2013. +Alan Geoffrey Wilson. The use of entropy maximising models, in the theory of trip distribution, mode split and route split. Journal of transport economics and policy, pp. 108-126, 1969. +Kan Wu, Houwen Peng, Zhenghong Zhou, Bin Xiao, Mengchen Liu, Lu Yuan, Hong Xuan, Michael Valenzuela, Xi Stephen Chen, Xinggang Wang, et al. Tinyclip: Clip distillation via affinity mimicking and weight inheritance. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 21970-21980, 2023. +Chuanguang Yang, Zhulin An, Helong Zhou, Linhang Cai, Xiang Zhi, Jiwen Wu, Yongjun Xu, and Qian Zhang. Mixskd: Self-knowledge distillation from mixup for image recognition. In European Conference on Computer Vision, pp. 534-551. Springer, 2022. +Chuanguang Yang, Xinqiang Yu, Zhulin An, and Yongjun Xu. Categories of response-based, feature-based, and relation-based knowledge distillation. In Advancements in knowledge distillation: towards new horizons of intelligent systems, pp. 1-32. Springer, 2023. +Fei Yuan, Linjun Shou, Jian Pei, Wutao Lin, Ming Gong, Yan Fu, and Daxin Jiang. Reinforced multi-teacher selection for knowledge distillation. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 35, pp. 14284–14291, 2021. +Li Yuan, Francis EH Tay, Guilin Li, Tao Wang, and Jiashi Feng. Revisit knowledge distillation: a teacher-free framework. 2019. +Sergey Zagoruyko. Wide residual networks. arXiv preprint arXiv:1605.07146, 2016. +Sergey Zagoruyko and Nikos Komodakis. Paying more attention to attention: Improving the performance of convolutional neural networks via attention transfer. arXiv preprint arXiv:1612.03928, 2016. +Zheng Zhang, Ping Tang, and Thomas Corpetti. Time adaptive optimal transport: A framework of time series similarity measure. IEEE Access, 8:149764-149774, 2020. + +# A MORE EXPERIMENT RESULT + +The result of closed-set SelKD tasks on the CIFAR-10 dataset are presented in Table 5, and it is obvious that SelKD outperforms both KD and SKD in terms of top-1 accuracy. + +We further add more experiments for closed-set SelKD on CIFAR-100 with WideResNet-40-2 (Zagoruyko, 2016) as the teacher model and WideResNet-16-2 as the student model. The results are shown in Table 6. + +# B A DETAILED EXPLANATION OF THE BI-LEVEL OPTIMIZATION + +We mainly follow (Shi et al., 2023) that understanding or designing the loss via bi-level optimization: + +$$ +\min _ {\theta} K L (\mathbf {Y} \mid \mathbf {P} ^ {\theta}) \quad \mathrm {s . t .} \quad P ^ {\theta} = \arg \min _ {\mathbf {P 1} = \mathbf {1}} \langle \mathbf {C} ^ {\theta}, \mathbf {P} \rangle - \epsilon H (\mathbf {P}) +$$ + +where $\mathbf{C}^{\theta}$ represents the cosine distance for image feature and text/label feature, with parameters $\theta$ , and $\mathbf{Y}$ is the known supervision for learning. As proven in (Shi et al., 2023), $H(\mathbf{P}) = -\langle \mathbf{P}, \log \mathbf{P} - \mathbf{1} \rangle$ is the entropic regularization with coefficient $\epsilon$ . The inner optimization is exactly equivalent to the softmax activation, while the outer optimization corresponds to cross-entropy. Thus we can find the above bi-level optimization equals to InfoNCE loss: + +$$ +\min _ {\theta} \mathcal {L} = \sum_ {i, j} Y _ {i j} \log (\frac {e ^ {- C _ {i j} ^ {\theta} / \epsilon}}{\sum_ {k} e ^ {- C _ {i k} ^ {\theta} / \epsilon}}) +$$ + +Table 5: Top-1 accuracy (\%) on CIFAR-10 for closed-set SelKD. We compare the performance of vanilla knowledge distillation (KD), self-knowledge distillation (SKD) and our selective knowledge distillation (SelKD) in the closed-set SelKD classification tasks. + +
Student NetworksMethodsSubTask 0SubTask 1Mean of SubTasks
ResNet-8Without KD91.2894.7693.02
FitNet-KD91.5695.7293.64
FitNet-SKD91.4295.3493.12
FitNet-SelKD91.8895.8893.88
FT-KD91.9896.2294.10
FT-SKD91.5395.9993.25
FT-SelKD93.6896.5095.09
AT-KD91.6695.6093.63
AT-SKD91.6895.0993.65
AT-SelKD92.9096.1294.51
ResNet-14Without KD94.4296.5495.48
FitNet-KD94.8696.4095.63
FitNet-SKD91.5695.7293.64
FitNet-SelKD95.0497.7296.38
FT-KD94.5697.0495.80
FT-SKD91.5695.7293.64
FT-SelKD95.6697.9296.79
AT-KD94.0296.7695.39
AT-SKD91.5695.7293.64
AT-SelKD94.8497.6496.24
+ +Table 6: Results for closed-set SelKD on CIFAR-100 with WideResNet-40-2 as the teacher model and WideResNet-16-2 as the student model. + +
MethodsSubTask 0SubTask 1SubTask 2SubTask 3SubTask 4Mean
FitNet-KD85.6786.5285.1481.9787.7285.40
FitNet-SelKD86.1587.6885.8382.7688.0486.09
FT-KD85.4285.5686.0882.1388.4585.53
FT-SelKD85.9287.2386.1782.5688.7386.12
AT-KD85.1785.4985.4381.8787.7185.13
AT-SelKD85.5587.2586.3882.4188.5286.02
+ +Thus, bi-level optimization is fundamentally a method for designing activation layers or loss functions. In (Shi et al., 2023), modifications to the inner optimization improve the loss. Our work follows this learning framework, but we modify the inner optimization with new constraints to adapt to open-set scenarios, solving it with iterative algorithm (Benamou et al., 2015) to obtain the predicted probability matching matrix. The outer optimization is adjusted to use the original KL Divergence in KD as the loss, resulting in an application in KD problems. \ No newline at end of file diff --git a/ICLR/2025/SelKD_ Selective Knowledge Distillation via Optimal Transport Perspective/images.zip b/ICLR/2025/SelKD_ Selective Knowledge Distillation via Optimal Transport Perspective/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..7c655ae7609d806de942ffb53f0c1ca883286a13 --- /dev/null +++ b/ICLR/2025/SelKD_ Selective Knowledge Distillation via Optimal Transport Perspective/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:26196dd4284049b27da41eccee2af92680fa07730bd5df84ddb5df5ad17e0608 +size 739704 diff --git a/ICLR/2025/SelKD_ Selective Knowledge Distillation via Optimal Transport Perspective/layout.json b/ICLR/2025/SelKD_ Selective Knowledge Distillation via Optimal Transport Perspective/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..bd36fce7e38d846cf7f523218b814577610973e8 --- /dev/null +++ b/ICLR/2025/SelKD_ Selective Knowledge Distillation via Optimal Transport Perspective/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d6cd19c419cbcdc76ad6da2575c9a285182bcbcd7d4791473a4056cf3195fc24 +size 449182 diff --git a/ICLR/2025/SelectFormer in Data Markets_ Privacy-Preserving and Efficient Data Selection for Transformers with Multi-Party Computation/cf83c876-81f1-46fa-8ff1-14f2edc206c5_content_list.json b/ICLR/2025/SelectFormer in Data Markets_ Privacy-Preserving and Efficient Data Selection for Transformers with Multi-Party Computation/cf83c876-81f1-46fa-8ff1-14f2edc206c5_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..4a76a6f878e2940f93001723d841a4eb9806410d --- /dev/null +++ b/ICLR/2025/SelectFormer in Data Markets_ Privacy-Preserving and Efficient Data Selection for Transformers with Multi-Party Computation/cf83c876-81f1-46fa-8ff1-14f2edc206c5_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dcb44e1683b3b1246026c03761f0036ebed7aaf6d71bc111e46de6eb637b71dd +size 95979 diff --git a/ICLR/2025/SelectFormer in Data Markets_ Privacy-Preserving and Efficient Data Selection for Transformers with Multi-Party Computation/cf83c876-81f1-46fa-8ff1-14f2edc206c5_model.json b/ICLR/2025/SelectFormer in Data Markets_ Privacy-Preserving and Efficient Data Selection for Transformers with Multi-Party Computation/cf83c876-81f1-46fa-8ff1-14f2edc206c5_model.json new file mode 100644 index 0000000000000000000000000000000000000000..3bbec10efb93027959ee42541da743b3c3041e09 --- /dev/null +++ b/ICLR/2025/SelectFormer in Data Markets_ Privacy-Preserving and Efficient Data Selection for Transformers with Multi-Party Computation/cf83c876-81f1-46fa-8ff1-14f2edc206c5_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0c198d375d47a687dea051c0e011260e20d3f9c76efb6bb5924c3542647191ca +size 113338 diff --git a/ICLR/2025/SelectFormer in Data Markets_ Privacy-Preserving and Efficient Data Selection for Transformers with Multi-Party Computation/cf83c876-81f1-46fa-8ff1-14f2edc206c5_origin.pdf b/ICLR/2025/SelectFormer in Data Markets_ Privacy-Preserving and Efficient Data Selection for Transformers with Multi-Party Computation/cf83c876-81f1-46fa-8ff1-14f2edc206c5_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..dfd06f0cff60efd899c8f920bd0d9138275353ee --- /dev/null +++ b/ICLR/2025/SelectFormer in Data Markets_ Privacy-Preserving and Efficient Data Selection for Transformers with Multi-Party Computation/cf83c876-81f1-46fa-8ff1-14f2edc206c5_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0aaf677379d0f6139d02c0d122b2acbf1efdf30d9808f980d5070c51be9cf1b9 +size 1084995 diff --git a/ICLR/2025/SelectFormer in Data Markets_ Privacy-Preserving and Efficient Data Selection for Transformers with Multi-Party Computation/full.md b/ICLR/2025/SelectFormer in Data Markets_ Privacy-Preserving and Efficient Data Selection for Transformers with Multi-Party Computation/full.md new file mode 100644 index 0000000000000000000000000000000000000000..b51dd35ebc5f3cdcffdd981af5687113be3fc0d3 --- /dev/null +++ b/ICLR/2025/SelectFormer in Data Markets_ Privacy-Preserving and Efficient Data Selection for Transformers with Multi-Party Computation/full.md @@ -0,0 +1,325 @@ +# SELECTFORMER IN DATA MARKETS: PRIVACY-PRESERVING AND EFFICIENT DATA SELECTION FOR TRANSFORMERS WITH MULTI-PARTY COMPUTATION + +Xu Ouyang, Felix Xiaozhu Lin, Yangfeng Ji + +Department of Computer Science + +University of Virginia + +{ftp8nr, felixlin, yangfeng}@virginia.edu + +# ABSTRACT + +Critical to a free data market is private data selection, i.e. the model owner selects and then appraises training data from the data owner before both parties commit to a transaction. To keep the data and model private, this process shall evaluate the target model to be trained over Multi-Party Computation (MPC). While prior work suggests that evaluating Transformer-based models over MPC is prohibitively expensive, this paper makes it practical for the purpose of data selection. Our contributions are three: (1) a new pipeline for private data selection over MPC; (2) emulating high-dimensional nonlinear operators with low-dimension MLPs, which are trained on a small sample of the data of interest; (3) scheduling MPC in a parallel, multiphase fashion. We evaluate our method on diverse Transformer models and NLP/CV benchmarks. Compared to directly evaluating the target model over MPC, our method reduces the delay from thousands of hours to tens of hours, while only seeing around $0.20\%$ accuracy degradation from training with the selected data. + +# 1 INTRODUCTION + +Data selection & appraisal In today's ML ecosystem, data and models are often owned by separate parties. Examples include mobile users versus app providers, and small businesses versus marketing firms. As model owners are interested in acquiring data to train their models from data owners, data becomes a commodity to be valued and traded. + +![](images/137f1755ade8adc80a41e35c644f717ad671f0036e19c3eacaa9a5d206523886.jpg) +Figure 1: Three stages of our data selection workflow in chronological order. + +In a free data market, no purchase commitment should be required unless both parties reach an agreement, for which pre-purchase assessment is vital. It contains two steps: select the most valuable data; (optionally) appraise the selected data. To model owners, pre-purchase selection is key to cost-effectiveness. Extensive work already showed that datasets are often redundant and noisy (Settles, 2012; Katharopoulos & Fleuret, 2018; Mirzasoleiman et al., 2020; Ouyang et al., 2022); purchase budgets should be spent on data points that are most likely to maximize model accuracy. To data owners, selection allows them to reveal less data in exchange for the same monetary reward, which + +retains their data ownership and reduces privacy exposure. The need for judicious data selection is further highlighted by that data candidates are often unlabeled (Hoi et al., 2006; Smith et al., 2018) and have skewed label distributions (Kaur et al., 2019). This paper targets this issue. + +Challenge: private selection Data selection and appraisal should be private: they should not leak any data and model parameters; if a purchase agreement is eventually reached, the model owner should learn no more beyond the data she is paying for. To select and appraise data, a common algorithm is to run a model's forward passes over data candidates and select based on the outcome (see Section 2 for details). It can be made private by building atop Multi-Party Computation (MPC) (Goldreich et al., 1987; Shamir, 1979; Yao, 1986): both parties (owners) jointly evaluate over the candidate data, learning only the indices of selected data and the quality measurement. + +However, evaluating Transformer models on MPC is expensive. A forward pass of BERT on a batch of 4 requires 3252 communication rounds and over 245 GB data exchanged, taking around 0.76 hours across commodity servers with GPUs. Most of the cost comes from executing nonlinear arithmetics such as softmax, which is pervasive in Transformers. Some efficient Transformers works can improve inference speed (Fu et al., 2021; You et al., 2022; Fu et al., 2022). But to support Transformer inference over MPC, recent work approximates nonlinearity with cheaper linear operations (Li et al., 2022; Dong et al., 2023; Chen et al., 2021). For data selection, they are not only too slow (hundreds of GPU hours to select from tens of K data points) but also have poor results as this paper will show. + +Goal & techniques Our goal is to accelerate private data selection for transformer-based models, e.g. BERT and ViT, while retaining the training performance. Our key insight is that the nonlinearity in Transformers can be fused and evaluated at low dimensions; fortunately, the resultant model evaluation outcomes will be acceptable for the purpose of data selection, which only depends on how the outcomes for individual data candidates compare to each other. We present a holistic selection pipeline with three key techniques. + +Nonlinearity emulated by multi-layer perceptron (MLPs). While existing MPC frameworks treat individual nonlinear operations in isolation (e.g. Newton-Raphson iterations for reciprocal), we fuse adjacent non-linear operators and emulate them altogether with a small MLP. The benefits are twofold. (1) MLPs significantly reduce MPC costs because they not only serve as approximators (converting nonlinear to linear operations) but also dimension reducers, e.g. substituting a 512-dimensional softmax with 2-dimensional MLP. This sets us apart from prior work that approximates a single nonlinear operation (e.g. reciprocal) with an MLP (Chen et al., 2022), which does not reduce dimensions and therefore executes much slower. (2) MLPs are data-driven. They are trained atop the distributions of the actual model activations, tailored to the datasets of interest. They only require a small amount of training data, as few as several hundred on average in our experiment. + +Multi-phase selection. For efficiency, the data/model owners jointly select data in multiple phases. While early phases evaluate cheap selection models to filter most of the data, later phases run more expensive selection models to select from the data that survived from earlier phases. This reduces the total selection delay without compromising accuracy. + +Parallel MPC executions. To further reduce the selection delay, the data/model owners batch network latency-bound MPC operations and execute them in parallel to network bandwidth-bound MPC operations; they further overlap the MPC communication and computation across different batches. No prior MPC systems exploit such parallelism, to the best of our knowledge. + +Workflow There are three stages in our proposed workflow: two in the clear and one over MPC. As shown in Figure 1, in the beginning, the model owner and the data owner exchange some basic information in the clear. For instance, the total amount of data and the amount of data that the model owner plans to purchase. Next is the private multi-phase selection which is over MPC. Two parties secretly share encrypted proxy model parameters and data to do a forward pass and get the entropy value. We then rank them and select the top candidates based on their rank. The remaining data points' indices will be reused in the next phase. The comparison outcomes will be revealed and the data indices are in the clear. Data will not be transferred among phases. The final transaction is in the clear. After private data selection, the model owner pays for the data it wants and the data owner sends out the data to seal the deal. More details in Section 4. + +Results We test SelectFormer with four target models, seven NLP/CV benchmarks, and a variety of purchase budgets (20%–40%). We show that with commodity GPUs and typical Internet, our pipeline can select from 10K–100K data points within tens of hours, one order of magnitude faster than prior work. Using unmodified MPC protocol and framework, we provide a strong privacy guarantee. Our selected data only results in just 0.20% lower accuracy compared to directly evaluating the target model over MPC for selection, a gold method which is however 204×slower. + +Contributions This work proposes a novel application of MPC - private data selection, and makes it practical on large Transformer models. It achieves so via three new techniques: + +- A data-driven MLP approximation that is uniquely tailored for data selection, instead of generic inference. +- Multi-phase selection that progressively increases the selection models' capability and reduces the amount of data candidates. +- Parallel MPC executions that hide the delays of computation and communication rounds behind that of communication data exchange. + +# 2 BACKGROUND + +# 2.1 ASSUMPTIONS ON SYSTEMS + +Two parties The model owner possesses a pretrained Transformer model $M_{target}$ and wants to finetune it. The data owner owns the dataset $D$ for selection. The model owner plans to buy $B$ datapoints $(B < |D|)$ from dataset $D$ which will be used to finetune the target model $M_{target}$ . The model owner has a private, small validation set, on which she wants to maximize the validation accuracy. The two parties agree on $B$ and that they will use MPC for selection. + +Datapoints We follow a common premise in prior work on data selection: (Coleman et al., 2019; Mahmood et al., 2022), the dataset $D$ is unlabeled and might have an imbalanced class distribution, which warrants careful selection before training. This premise is motivated by real-world situations where data labels are scarce and data owners often lack the motivation, expertise, and authority to label their data (Hoi et al., 2006; Smith et al., 2018). + +Threat model Without alternation, we follow a semi-honest model widely used in prior security research (Knott et al., 2021; Dong et al., 2023; Mohassel & Zhang, 2017): both parties faithfully follow the MPC protocol but nevertheless attempt to learn each other's private information (model weights and datapoints) through their interactions. Notably, we do not deviate from protocols implemented by well-known frameworks such as Crypten (Knott et al., 2021). As such, our privacy guarantee is as strong as the underlying framework. + +# 2.2 ALGORITHM FOUNDATIONS + +(1) Maximum entropy selection Active learning (AL) (Settles, 2012) selects from unlabeled data to maximize training performance. To appraise an example $x$ for training model $M$ , AL runs a forward pass of $M$ over $x$ (or query $x$ with $M$ ) and computes the prediction entropy: higher entropy implies lower model confidence, hence a higher learning value of $x$ . (2) Proxy models Querying all examples in $D$ with $M_{target}$ can be slow. To this end, prior work uses a lightweight model $M_p$ called "proxy" for selection before training $M_{target}$ with the selected data (Coleman et al., 2019). To select valuable data, $M_p$ 's prediction should resemble that of $M_{target}$ ; hence $M_p$ is often created as a miniature version of $M_{target}$ : examples include + +![](images/7d3fb81fe7dc68ede6bc428d2f676ecce50bef2ea94376e48962e01de75c5bdb.jpg) +Figure 2: Transformers over MPC incurs high communication and computation overhead. Showing one forward pass of one layer (12 heads) over a batch of 5 (maximum allowable on our GPU). Hardware: Quadro RTX 4000. MPC framework: Crypten (Knott et al., 2021). + +ResNet-18 as proxy for ResNet-50 (Coleman et al., 2019). We use simplified Transformers as proxy models with fewer layers and attention heads. + +# 2.3 TRANSFORMERS, MPC, AND OVERHEAD ANALYSIS + +# Transformers + +We focus on transformer-based models (Vaswani et al., 2017). Each layer of these models features a Multihead Attention paired with FeedForward. Both are succeeded by layer normalization and a residual connection. Within the Multihead Attention, operations proceed sequentially from QKV linear operation to the attention mechanism, and finally to an attention output. + +MPC setting: 2PC We assume the most common MPC setting: secret sharing under two-party computation (2PC) (Yang et al., 2019). The model owner randomly decomposes $x$ into two shares, $x_{1}$ and $x_{2}$ (such that $x_{1} + x_{2} = x$ ), retains $x_{1}$ , and convey $x_{2}$ to the data owner. Analogously, the data owner fragments $y$ into $y_{1}$ and $y_{2}$ and transfers $y_{2}$ to the model owner. These shares individually disclose no information about the original numbers, $x$ and $y$ . Reconstruction of a number is possible when both parties exchange their shares and sum them up. + +To compute $z = x + y$ , each party adds their shares of $x$ and $y$ , yielding $z_{1} = x_{1} + y_{1}$ and $z_{2} = x_{2} + y_{2}$ . Both parties can retrieve $z$ by adding $z_{1}$ and $z_{2}$ . For multiplication, The parties can offline generate a random triple called Beaver triples (Beaver, 1992), $a, b$ , and $c$ (such that $ab = c$ ). The elements of this triple are then partitioned and disseminated amongst the parties, akin to $x$ and $y$ . The model owner calculates $\epsilon_{1} = x_{1} - a_{1}, \delta_{1} = y_{1} - b_{1}$ while the data owner computes $\epsilon_{2} = x_{2} - a_{2}, \delta_{2} = y_{2} - b_{2}$ . The parties jointly reconstruct $\epsilon$ and $\delta$ . Subsequently, the model owner computes $p_{1} = c_{1} + \epsilon y_{1} + \delta x_{1} + \epsilon \delta$ and the data owner calculates $p_{2} = c_{2} + \epsilon y_{2} + \delta x_{2}$ , enabling the retrieval of $p = xy$ . Throughout this procedure, all intermediate computations, including $\epsilon_{1}, \epsilon_{2}, \delta_{1}$ and $\delta_{2}$ maintain the confidentiality of $x, y$ and $p$ , precluding any information leakage. + +Major overheads comes from that MPC lacks native support for nonlinear operations, such as softmax, logarithmic, and exponential, which are pervasive in Transformers. In response, MPC frameworks provide corresponding linear approximations. Unfortunately, the overhead is still high. Figure 2 shows the cost of the operations for one transformer block. As shown in the table, the cost of nonlinear arithmetic dominates. Notably, softmax contributes $81.9\%$ communication data and 142 communication rounds. The overheads become prohibitive for data selection, which needs to evaluate Transformers on tens of thousands of data points over MPC. We show this in Section 5. + +# 3 RELATED WORKS + +Data selection and appraisal Our work builds on the idea of using a miniature version (proxy) of the target model as the selector (Coleman et al., 2019). Yet, proxies alone are still too expensive for MPC as we will show in Section 5. Xu et al. (2022) investigates data appraisal over MPC. Contrasting to us, they assume labeled data (a strong assumption in practice), which allows them to appraise data via forward influence functions. Unlike us focusing on Transformer models, they only demonstrated logistic regression tasks. Mindermann et al. (2022) introduces RHO loss that quantifies by how much data candidates would reduce the loss on a small holdout set if the model were to train the candidates. They then select data based on RHO loss. Their methods inspire our bootstrap dataset. However, they rely on labeled data, whereas we focus on a more challenging setting – selecting unlabeled data. + +MPC inference of neural networks Existing research has developed discretized DNN training with a customized two-party protocol (Agrawal et al., 2019) and MPC-friendly approximations to speed up CNN. Chou et al. (2018) develop an optimization framework that minimizes the approximation error of order two polynomial to ReLU. Mishra et al. (2020) alleviates this problem by using a set of heuristics along with Neural Architecture Search (NAS). Mohassel & Zhang (2017) proposes a costly approximation of softmax by replacing exponential with ReLU functions on high-dimension inputs. + +MPCFORMER (Li et al., 2022) and PUMA (Dong et al., 2023) directly address efficient Transformer inference over MPC. MPCFORMER is implemented based on Crypten (Knott et al., 2021) framework and its key idea is that approximate nonlinear operations in the student model and then distill it; + +PUMA proposes new approximations for faster secure inference in a three-party setting. Bolt (Pang et al., 2024) proposes a new Transformer inference framework. Compared to us, they miss the key opportunities of reducing nonlinearity dimensions and using learned approximators (MLPs). Furthermore, MPCFORMER's model distillation approach is ill-suited to data selection, where labeled data for distillation is lacking. As Section 5 will show, they perform poorly in data selection. + +# 4 METHOD + +# 4.1 HIGH-LEVEL WORKFLOW + +Pre-selection bootstrap: Prior to the selection, the two parties exchange meta-information in the clear: the purchase budget $B$ , the secure computation framework, the target model architecture type, pre-processing methods, and the metadata about the $S$ , which includes the number of data points. + +The model owner purchases bootstrap data $S_{boot}$ which constitutes a small fraction of the purchase budget $B$ . The data owner randomly samples $S_{boot}$ from $S$ ; the purchase requires no selection and incurs no MPC overhead. The model owner will use $S_{boot}$ to generate proxy models $\hat{M}_{1..N}$ , as will be described below. + +Multipass selection For efficiency, the selection process is a progressive sieve: earlier phases run smaller selector models for quickly filtering a majority of redundancy, whereas later phases run larger selector models for slower, more precise selection. Concretely, both parties jointly execute $N$ selection phases over MPC. A phase $i$ downselects dataset $S_{i-1}$ to the set $S_i$ with a selectivity $\alpha_i = |S_i| / |S_{i-1}|, \alpha_i < 1$ . + +In phase $i$ , the model owner queries the dataset $S_{i-1}$ with a proxy model $\hat{M}_i$ . The query is executed as a forward pass of $\hat{M}_i$ on $S_{i-1}$ on MPC. The forward pass computes the prediction entropy values, which are encrypted. Next, both parties jointly find the indices of $|S_i|$ highest entropy values: execute the QuickSelect algorithm with $O(|S_{i-1}|)$ pairwise comparisons between entropy values; the comparison is over MPC, each taking 8 communication rounds and transferring 432 bytes. A comparison does not reveal its inputs (entropy values) but only the binary outcome. Finally, the indices of data points with the highest prediction entropy constitute the input $S_i$ for the next phase. + +![](images/83a0b1af46fea2a3dbd44782aa760e203a7bf99521429424ca009d15056fd695.jpg) +Figure 3: Our high-level workflow. Left: proxy model generation. Right: multi-phase selection. $\mathbf{M}_g$ is the base model for the proxy models $\hat{M}_{1..N}$ . More details in subsection 4.2. + +$N$ phases result in the final dataset $S_{N}$ . The model owner may offer to buy $S_{N}$ , or request an appraisal of $S_{N}$ before buying. For appraisal, both parties jointly compute an average entropy over $S_{N}$ and reveal the average entropy. If the average entropy is sensitive, both parties can jointly compute if the (encrypted) average exceeds a pre-defined threshold and only reveals the one-bit outcome. + +Privacy guarantees The following information is kept private: dataset $S$ ; parameters of $M_{\text{target}}$ and $\hat{M}_{1..N}$ ; the prediction outcome and entropy. The following is revealed: the rank of prediction entropy; the architecture (operations) of $\hat{M}_{1..N}$ ; the number of data points and budget. + +
DistilBERTBERTViT-smallViT-base
SST2QNLIQQPAGNEWSYELPSST2QNLIQQPAGNEWSYELPCifar10Cifar100Cifar10Cifar100
Ours82.3471.4671.5388.4960.1884.5973.6872.7389.0461.3396.4669.1196.6168.42
Random (vs. Ours)79.0870.3466.1886.4358.0979.5873.5668.8487.8559.1694.6943.9995.6363.21
-3.26-1.12-5.35-2.06-2.09-5.01-0.12-3.89-1.19-2.17-1.71-25.12-0.98-5.21
Oracle (vs. Ours)82.3271.4471.5189.1959.9386.0674.6273.0889.7460.896.8768.496.9467.85
-0.02-0.02-0.020.70-0.251.470.940.350.70-0.530.41-0.710.33-0.57
+ +Table 1: Ours are consistently higher than Random across all models and benchmarks and are close to Oracle (gold accuracy). + +# 4.2 GENERATING PROXY MODELS IN DETAIL + +A proxy model $\hat{M}_i$ is characterized by $< l_i, w_i, d_i >$ : $L_i$ transformer layers with $A_i$ attention heads each (width), in which the nonlinear modules are substituted by MLPs with hidden dimension $d_i$ and the GeLU functions are substituted by ReLU functions. FFN is also removed from proxy models. As shown in Figure 3, the model owner generates proxy models $\hat{M}_{1..N}$ as follows: + +- Extract a sub-model $M_g$ from $M_{target}$ . $M_g$ comprises $L$ bottom layers from $M_{target}$ where $L = \max(l_{1..N})$ , with all the weights copied over. $M_g$ serves as the backbone for $\hat{M}_{1..N}$ . +- Finetune $M_g$ on the bootstrap data $S_{boot}$ . This serves two purposes: (1) collecting sample input/output of $M_g$ 's nonlinear modules, which will be used to train the MLPs that substitute these nonlinear modules; (2) roughly adapting $M_g$ to a sample from the dataset $S$ . Initialize $\hat{M}_{1..N}$ by pruning the width and depth of $M_g$ . +- Ex vivo MLP training. For each transformer block in a proxy model, randomly initialize three MLPs. Train them separately on the input/output of nonlinear modules collected from the previous step. More training data following the same distribution as the input/output will be randomly generated as data augmentations. See subsection 4.3 for details. +- In vivo MLP training. Substitute the nonlinear modules in $\hat{M}_i$ with the MLPs trained in the previous step. Further finetune the resultant model $\hat{M}_i$ on $S_{boot}$ end-to-end. This co-tunes MLPs (the approximate portion of $\hat{M}_i$ ) and the remaining exact portion. + +The model owner schedules the selection by setting $\{< l_i, w_i, d_i >\}_{i=1..N}$ for $N$ phases. As described above, the principle of schedule is progressive: increasingly higher $l/w/d$ for later phases. Given a budget $B$ , SelectFormer determines the schedule via offline grid search. See Section 5. + +![](images/0585effda09679008cc0a322c836871f5e2bba98411aac79fe85479af9d60042.jpg) +Figure 4: Training MLPs for substituting the non-linearity in Transformer models + +# 4.3 APPROXIMATION MLPS FOR NON-LINEAR OPERATIONS + +Our theoretical foundation is Hornik et al. (1989): MLPs are able to approximate any function at any desired degree of accuracy, as long as the function is continuous on a closed and bounded subset of $R^n$ . A transformer's nonlinear modules satisfy this condition (Goodfellow et al., 2016). We use standard MLPs, each comprising one ReLU layer sandwiched between two linear layers. Of a proxy model, MLPs substitute the following nonlinear modules as shown in Figure 4: + +- Softmax in the attention module. At each transformer layer, a substitute MLP maps along the last dimension of the input and has the same input/output shape as the original softmax operation. + +![](images/6febb4d3032c4dad1637663fb03b2a2944b5347ad786e3e531a6a7f7f63c0c13.jpg) +Figure 5: Across a variety of budgets, Ours consistently outperforms Random and are comparable with Oracle (gold accuracy). Target model: DistilBERT. + +- LayerNorm in the attention module. At each transformer layer, a substitute MLP emulates the reciprocal operation in LayerNorm. Of the LayerNorm, its learnable weights and bias in the affine functions are loaded from the original LayerNorm layers in $M_g$ . Its numerator is computed directly on MPC because the total number is a constant and it needs just cheap summation and multiplication. +- Softmax over logits and the subsequent entropy computation. At the top of the model, a substitute MLP emulates the two modules combined. The MLP input shape is the same as that of softmax. The output will be the entropy itself. + +A proxy model of layer $l$ comprises $2l + 1$ MLPs in total; they have the identical hidden dimension albeit different weights. Different proxy models may have MLPs of different hidden dimensions, set as part of the schedule as described above. + +Training MLPs MLPs need to be trained on the sample input/output of the nonlinear modules being substituted. While we can use such input/output observed in finetuning $M_g$ over bootstrap data ( $S_{boot}$ ), the data amount is inadequate: randomly sampled $S_{boot}$ must be small (3521 datapoints on average in our experiments) in order to save the budget for private selection. + +We address the problem with the empirical observation that inputs to a nonlinear module largely follow a parametric Gaussian distribution (Chen et al., 2022). As such, from the actually observed inputs, the model owner estimates the Gaussian distribution parameters $\langle \mu, \sigma \rangle$ and uses such parameters to synthesize training inputs and outputs. + +For a given nonlinear module in $M_g$ , an instance of $\langle \mu, \sigma \rangle$ is estimated and one dataset (5.12 million data points) is synthesized once, which is used to train the MLPs that substitute this particular nonlinear module in all proxy models $\hat{M}_{1..N}$ . There are three synthesized datasets: $S_{sm}$ , $S_{ln}$ , and $S_{se}$ . This is shown in Figure 4. Note that $\hat{M}_{1..N}$ with MLPs inserted will be further finetuned as described above. The MLP training is very cheap compared with the selection over MPC, which can be measured in minutes. + +# 4.4 IO SCHEDULING + +Our proxy models perform a sequence of matrix multiplication and ReLU. Operating on high-dimensional inputs are bound by the network bandwidth; after being projected into lower dimensions, the operations succeeding the activation functions are bound by network latency. To this end, (1) SelectFormer stacks and coalesces the latency-bound modules from multiple batches, reducing the number of communication rounds and improving the computation throughput. (2) Furthermore, SelectFormer exploits computation and communication parallelism across batches, executing a module whenever its needed resources become available. For instance, while data exchange is occurring for one batch, computations for the subsequent batches can be performed concurrently. Such co-execution is only limited by data dependencies and the available memory of a party to hold operation inputs. + +# 5 EVALUATION + +# 5.1 EXPERIMENT SETUP + +Models & datasets For NLP, we choose target models as BERT (12 layers) and DistilBERT (6 layers), with 12 attention heads and a hidden dimension of 768. For vision, we chose the target model as ViT, with the same architecture as BERT. We chose benchmarks with at least tens of thousands + +
Emulated w/ MLP?DistillBERT AccuracyBERT Accuracy
MLPumMLPseMLPnSST2QQPAGNEWSSST2QQPAGNEWS
Ours✓✓✓82.80±0.9871.63±0.9187.75±1.0084.33±1.3072.31±1.2188.37±1.58
NoAttnSM✓✓82.48±1.27 (-0.32)71.85±1.11 (+0.22)89.58±0.43 (+1.83)85.14±0.46 (+0.81)74.15±0.56 (+1.84)89.55±0.66 (+1.18)
NoAttnLN✓✓81.83±0.78 (-0.97)71.68±0.44 (+0.05)87.20±1.49 (-0.55)83.95±0.73 (-0.38)72.76±0.94 (+0.45)89.08±0.47 (+0.71)
NoApprox82.02±0.80 (-0.78)70.42±1.00 (-1.21)88.99±0.50 (+1.24)84.79±1.00 (+0.46)72.26±0.91 (-0.06)89.30±0.45 (+0.93)
+ +Table 2: Using MLPs to emulate Transformer nonlinearity results in minor accuracy degradation + +![](images/35847991e7937134764aab46989eb1cb00c27557cab4ba7bb7029cc4bfe1bfd2.jpg) +Figure 6: Our method reduces the end-to-end delays by two orders of magnitude. As in Section 4, 1 phase selection selects data using a proxy model with a hidden dimension of 16. + +of data points which warrant selection. Following prior work (Xu et al., 2022) to construct the training set with imbalanced labels, we remove some data points from the original benchmarks. Our imbalanced NLP benchmarks include binary classification from GLUE (Wang et al., 2018): SST2 (42K), QNLI (58K), and QQP (149K); and multilabel classification (Zhang et al., 2015): AG news (40K) and Yelp review full (188K). Our vision benchmarks are two multilabel benchmarks CAFAR-10 (10K) and CIFAR-100 (6K). Note that we do not change the test set. + +We implement our scheme based on Crypten (Knott et al., 2021), a popular MPC framework. We run data/model owners on separate GPUs (Nvidia Quadro RTX 4000) with Intel(R) Xeon(R) Silver 4210 CPU; we control the network bandwidth (100 MB/sec) and latency (100 ms) between them to emulate a wide-area network condition. We report: (1) the test accuracy of the target model, after being trained with the selected data; (2) the delay of the data selection process over MPC. + +These results are derived using two-phase data selection unless specified otherwise. In the first phase, for NLP tasks, we employ a proxy model with a single layer and a dimensionality of 2, while for CV tasks, a proxy model with three layers and the same dimensionality is utilized. In the second phase, a proxy model with three layers and a dimensionality of 16 is applied for these two tasks. + +Baselines We evaluate our method against the following baselines. + +1. Random selects data randomly from the data owner. It incurs zero MPC overhead. +2. Oracle queries data using the target model. Under our framework (Section 2), we consider that it leads to gold test accuracy. Yet, it incurs prohibitive MPC overhead as will be shown. +3. MPCFORMER (Li et al., 2022) is a closely related project that minimizes the cost of evaluating transformers over MPC. We implement this baseline to adopt MPCFORMER's key optimizations for evaluating proxy models: linear operators for approximating nonlinearity and model distillation for recovering accuracy. For a fair comparison, MPCFORMER uses the same proxy model architecture as ours, and initializes the proxy models in the same way; runs distillation on the same amount of bootstrap data. Note that we cannot directly compare to PUMA (Dong et al., 2023), which is designed under 3 compute parties. +4. Bolt (Pang et al., 2024)'s MPC framework contains linear approximations for nonlinear operations. + +# 5.2 END-TO-END RESULTS + +Selection delays Our method significantly reduces the delays. Compared to Oracle, our method's delay is lower by two orders of magnitude as shown in Figure 6. For instance, to select $20\%$ from 42K data points (SST2 benchmark, DistilBERT model), our experiment takes around 20 hours whereas Oracle would take 3740 hours. + +Selection efficacy Our method effectively selects training data that best boosts the test accuracy. Table 1 zooms in on a typical purchase budget (20%). Compared to Random, our test accuracy + +![](images/429666b69fbafb530f4da57d432979d1cf0bc621fae654804b08d1355c9e5142.jpg) +Figure 7: Delay reduction by our techniques. The results also show that using proxy models alone (variant "P" in the figure,) is not enough. + +![](images/ef1fe33f7c12c1e0dc4a6a089d58bbb13685d5108b3b11d4d7588da965defc6c.jpg) + +![](images/19b0d48c36173d686bb8abb1b2944ace5f0bb00d90b1f5c93a3953eb25c1c4a0.jpg) + +![](images/e61fe8bfa58a55a5223fbd99c6840a23778d5902bfe1fb294d516c4139bef0ff.jpg) + +![](images/e7964f8e8c5fe1e45f66815e6eb847b2565819979cb7f29e1f8c5553e4ca5048.jpg) + +is consistently higher across all NLP and CV benchmarks. The benefit is particularly pronounced on challenging tasks such as CIFAR-100, on which our accuracy is higher by $25.11\% / 5.21\%$ on ViT-small/base. Compared to Oracle, our test accuracy is comparable: only $0.08\% - 0.58\%$ lower for DistillBERT and BERT, and even $0.13\%$ and $0.15\%$ higher for ViT-base and ViT-small. + +Across different purchase budgets of $25\%$ , $30\%$ , and $40\%$ , our method also leads to strong accuracy. Compared to Random, our accuracy is $2.23\%$ higher on average, and up to $5.14\%$ . Compared to Oracle, our average accuracy is only $0.91\%$ lower on average, and as low as $0.01\%$ . See the Appendix for detailed results. + +From a different angle to view our efficacy: to reach a given accuracy, our method demands a much lower budget. As shown in Figure 5, to be on par with our test accuracy on a budget of $20\%$ , Random would need a budget of $70\%$ (BERT on QNLI), a budget of $90\%$ (DistilBERT on SST2), and a budget of $100\%$ (DistilBERT on YELP and BERT on YELP/SST2). + +# 5.3 COMPARISON WITH MPCFORMER AND BOLT + +As shown in Table 3, our method simultaneously delivers much higher test accuracy (by $23\% - 36\%$ ) and much shorter (by $7\times$ ) selection delays. The reasons are twofold. (1) MPCFORMER's longer delays come from that it approximates individual nonlinear operators with linear counterparts; it does not reduce model dimension as we do. (2) MPCFORMER's lower accuracy comes from that its proxy models come from the distillation of the target model, a process requiring ample, representative training data. This is at + +
BERT Accuracies/%Delay/hrs
SST2QNLIQQPSST2QNLIQQP
MPCFORMER50.9250.5436.82279388998
Ours84.59 (+33.67)73.68 (+23.14)72.73 (+35.91)37 (-242)51 (-337)131 (-867)
+ +Table 3: Compared to MPCFORMER, our method results in much higher test accuracy and much lower delays. On GLUE benchmarks which were also evaluated and reported by MPCFORMER. Target model: BERT. Proxy model: 1 transformer layer with 1 head + 3 transformer layers with 12 heads. + +odds with data selection: $S_{boot}$ is the only data available for distillation; it has a small size and skewed labels. The skewness propagates from $S_{boot}$ to proxy models, to selected data, and to the target model. As a result, the trained target model is biased towards predicting the majority class in the training set. This results in poor accuracy if the test and train sets have different majority classes, sometimes even worse than random guess (e.g. QQP in Table 3). See subsection 7.2 for the comparison with Bolt. + +# 5.4 ABLATION STUDY + +Crypten incurs minor accuracy loss We validate that our choice of the Crypten framework (Knott et al., 2021), which executes ML on a finite ring, introduces minor accuracy loss. On SST2 with the default budget (5% for $S_{boot}$ ; 20% total), private selection fully executed on Crypten results in test accuracy of 83.37%, which is even slightly (0.5%) higher than executing on PyTorch. + +MLP for non-linearity (1) Delay. Our use of MLP reduces the selection delay by two orders of magnitude, e.g. from 3740 hours to around 20 hours for DistilBERT on SST2. This is shown in Figure 7, by the difference between $P$ and $PM$ . (2) Accuracy. The use of MLP incurs minor degradation in the test accuracy. The results are shown in Table 2, by the difference between Ours to NoApprox. On SST2, ours is $0.78\%$ higher with DistilBERT and only $0.46\%$ lower with BERT. On AGNEWS, ours are just $1.24\%$ lower with DistilBERT and $0.93\%$ lower with BERT. On QQP, it's $1.21\%$ and $0.05\%$ higher respectively. Among the three MLPs, softmax in the attention module shows a higher + +
Totl +PhsMLP +dims# proxy layersSelectivityDistilBERT AccuracyBERT Accuracy
DistilBTBERTSST2QQPSST2QQP
11611100%*→20%82.9171.2883.4964.48
22→161→11→3100%*→30%→20%82.00 (-0.91)71.62 (+0.34)85.21 (+1.72)73.07 (+8.59)
32→8→161→1→11→3→3100%*→50%→30%→20%83.37 (+0.46)72.90 (+1.62)84.52 (+1.03)73.48 (+9.00)
+ +*: include bootstrap data + +Table 4: Our multi-phase selection improves accuracy in general. Three example schedules (with 1, 2, and 3 total phases, respectively) and their test accuracies are shown. + +impact on accuracy than the other two. As shown in Table 2 and across all the datasets, by the difference between Ours to NoAttnSM. Using softmax approximation MLP is just $0.75\%$ lower with DistillBERT and $0.99\%$ lower with BERT on average; by the difference between Ours to NoAttnLN, our approximations of LayerNorm only decreases the performance by $0.76\%$ with DistillBERT and $0.16\%$ higher with BERT on average. This is justified by the higher cost that our AttentionSM reduces data communication by $42\times$ , while AttentionLN only reduces $8.25\times$ . + +Efficacy of multi-phase selection (MPS) We compare MPS to single-phase selection (SPS), in which the proxy model is the same as the one used in the last phase of MPS; it has all our other optimizations. (1) MPS reduces delays significantly. Compared to SPS, the two-phase selection reduces the total delay by $33\% - 61\%$ across all the benchmarks. Because MPS runs a much smaller proxy model in phase 1 to filter most datapoints. The advantage is more pronounced for large models such as BERT, where the efficiency gap between the proxy models in phase 1 is even larger. (2) MPS improves accuracy moderately. We focus on two representative benchmarks SST2 and QQP (binary and multi-label classification). The results are in Table 4. Going from one phase to two/three phases results in tangible accuracy gain (around $1\%$ ); notably BERT sees accuracy gain as high as $1.72\%$ (SST2) and $8.59\%$ (QQP). We attribute the gain to MPS being more selective for the finally selected datapoints, which have been sieved through multiple proxy models, small and big. + +Sizes of proxy models Multi-layer proxy models increase the selection delay while may improve the test accuracy. Our experiments show that: for small target models on challenging benchmarks (e.g. ViT-small on CIFAR-100), the test accuracy from a three-layer proxy outperforms a one-layer proxy significantly (by $17.33\%$ ); on other benchmarks, $1+$ layers only result in a minor increase in the test accuracy. On CIFAR-100, a three-layer ViT-base proxy model is $11.32\%$ higher than a one-layer with $66.6\%$ lower efficiency. Their accuracies are $0.26\%$ higher than Oracle's on average, but with $4\times$ higher efficiency. It is worth trading some extent of efficiency for much higher accuracy by a multi-layer proxy model, especially on difficult datasets like CIFAR-100. + +MLP hidden dimensions To decide $d_{i}$ , we conduct a grid search to find the best values, which are included in our selection schedules shown in Table 4. We mainly do this grid search on SST2, validate the hyperparameters on QQP before applying the same settings to other datasets. A higher dimension like 16 has good accuracy on different datasets while not incurring much more latency. Multi-phase selection can reduce lots of latency, hence, we pick hidden dimension combinations that can bring more accuracy gain. For the 2 Phase, we choose (2, 16) which has the highest accuracy on larger datasets and target models, such as BERT on QQP. For the 3 Phase, we choose (2, 8, 16). It has the highest accuracy with DisitilBERT on SST2, with BERT on QQP, and suboptimal accuracy on other experiments. + +IO scheduling This optimization reduces the end-to-end selection delays by $1.3 - 1.4 \times$ , as shown in Figure 7, the difference between Ours and PMT. The reduction comes from overlapping the MPC computation and the communication rounds. their communication latency is hidden. The reduction depends on hardware: device computation bandwidth and the network latencies. + +# 6 CONCLUDING REMARKS + +This paper addresses the private selection of imbalanced, unlabelled data. We propose data selection on MPC, preserving privacy while evaluating data. Overcoming computational challenges, we introduce a data-aware MLP approximation for non-linear modules, tailored to different datasets for reduced latency. Our multi-phase selection mechanism enhances proxy models' efficiency across diverse benchmarks. + +# ACKNOWLEDGMENT + +The authors were supported in part by NSF awards #2128725, #1919197, and #2106893; as well as NSF awards #2124538 and #2007492. The authors thank the anonymous reviewers for their insightful feedback. + +# REFERENCES + +Nitin Agrawal, Ali Shahin Shamsabadi, Matt J Kusner, and Adrià Gascon. Quotient: two-party secure neural network training and prediction. In Proceedings of the 2019 ACM SIGSAC Conference on Computer and Communications Security, pp. 1231-1247, 2019. +Donald Beaver. Efficient multiparty protocols using circuit randomization. In Joan Feigenbaum (ed.), Advances in Cryptology — CRYPTO '91, pp. 420–432, Berlin, Heidelberg, 1992. Springer Berlin Heidelberg. ISBN 978-3-540-46766-3. +Tianlong Chen, Zhenyu Zhang, Xu Ouyang, Zechun Liu, Zhiqiang Shen, and Zhangyang Wang. "bnn - bn = ?": Training binary neural networks without batch normalization. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR) Workshops, pp. 4619-4629, June 2021. +Tianyu Chen, Hangbo Bao, Shaohan Huang, Li Dong, Binxing Jiao, Daxin Jiang, Haoyi Zhou, Jianxin Li, and Furu Wei. THE-X: Privacy-preserving transformer inference with homomorphic encryption. In Findings of the Association for Computational Linguistics: ACL 2022, pp. 3510-3520, Dublin, Ireland, May 2022. Association for Computational Linguistics. doi: 10.18653/v1/2022.findings-acl.277. URL https://aclanthology.org/2022-findings-acl.277. +Edward Chou, Josh Beal, Daniel Levy, Serena Yeung, Albert Haque, and Li Fei-Fei. Faster cryptonets: Leveraging sparsity for real-world encrypted inference. arXiv preprint arXiv:1811.09953, 2018. +Cody Coleman, Christopher Yeh, Stephen Mussmann, Baharan Mirzasoleiman, Peter Bailis, Percy Liang, Jure Leskovec, and Matei Zaharia. Selection via proxy: Efficient data selection for deep learning. arXiv preprint arXiv:1906.11829, 2019. +Ye Dong, Wen-jie Lu, Yancheng Zheng, Haoqi Wu, Derun Zhao, Jin Tan, Zhicong Huang, Cheng Hong, Tao Wei, and Wenguang Cheng. Puma: Secure inference of llama-7b in five minutes. arXiv preprint arXiv:2307.12533, 2023. +Yonggan Fu, Qixuan Yu, Yang Zhang, Shang Wu, Xu Ouyang, David Cox, and Yingyan Lin. Drawing robust scratch tickets: Subnetworks with inborn robustness are found within randomly initialized networks. In M. Ranzato, A. Beygelzimer, Y. Dauphin, P.S. Liang, and J. Wortman Vaughan (eds.), Advances in Neural Information Processing Systems, volume 34, pp. 13059-13072. Curran Associates, Inc., 2021. URL https://proceedings.neurips.cc/paper_files/paper/2021/file/6ce8d8f3b038f737cefcdafcf3752452-Paper.pdf. +Yonggan Fu, Qixuan Yu, Meng Li, Xu Ouyang, Vikas Chandra, and Yingyan Lin. Contrastive quant: quantization makes stronger contrastive learning. In Proceedings of the 59th ACM/IEEE Design Automation Conference, pp. 205-210, 2022. +O. Goldreich, S. Micali, and A. Wigderson. How to play any mental game. In Proceedings of the Nineteenth Annual ACM Symposium on Theory of Computing, STOC '87, pp. 218-229, New York, NY, USA, 1987. Association for Computing Machinery. ISBN 0897912217. doi: 10.1145/28395.28420. URL https://doi.org/10.1145/28395.28420. +Ian Goodfellow, Yoshua Bengio, and Aaron Courville. Deep Learning. MIT Press, 2016. http://www.deeplearningbook.org. +Steven C. H. Hoi, Rong Jin, Jianke Zhu, and Michael R. Lyu. Batch mode active learning and its application to medical image classification. In Proceedings of the 23rd International Conference on Machine Learning, ICML '06, pp. 417-424, New York, NY, USA, 2006. Association for Computing Machinery. ISBN 1595933832. doi: 10.1145/1143844.1143897. URL https://doi.org/10.1145/1143844.1143897. + +Kurt Hornik, Maxwell Stinchcombe, and Halbert White. Multilayer feedforward networks are universal approximators. Neural networks, 2(5):359-366, 1989. +Angelos Katharopoulos and François Fleuret. Not all samples are created equal: Deep learning with importance sampling. In International conference on machine learning, pp. 2525-2534. PMLR, 2018. +Harsurinder Kaur, Husanbir Singh Pannu, and Avleen Kaur Malhi. A systematic review on imbalanced data challenges in machine learning: Applications and solutions. ACM Computing Surveys (CSUR), 52(4):1-36, 2019. +Brian Knott, Shobha Venkataraman, Awni Hannun, Shubho Sengupta, Mark Ibrahim, and Laurens van der Maaten. Crypten: Secure multi-party computation meets machine learning. Advances in Neural Information Processing Systems, 34:4961-4973, 2021. +Dacheng Li, Rulin Shao, Hongyi Wang, Han Guo, Eric P Xing, and Hao Zhang. Mpcformer: fast, performant and private transformer inference with mpc. arXiv preprint arXiv:2211.01452, 2022. +Rafid Mahmood, James Lucas, Jose M. Alvarez, Sanja Fidler, and Marc Law. Optimizing data collection for machine learning. In S. Koyejo, S. Mohamed, A. Agarwal, D. Belgrave, K. Cho, and A. Oh (eds.), Advances in Neural Information Processing Systems, volume 35, pp. 29915-29928. Curran Associates, Inc., 2022. URL https://proceedings.neurips.cc/paper_files/paper/2022/file/c1449acc2e64050d79c2830964f8515f-Paper-Conference.pdf. +Sören Mindermann, Jan M Brauner, Muhammed T Razzak, Mrinank Sharma, Andreas Kirsch, Winnie Xu, Benedikt Höltgen, Aidan N Gomez, Adrien Morisot, Sebastian Farquhar, et al. Prioritized training on points that are learnable, worth learning, and not yet learnt. In International Conference on Machine Learning, pp. 15630-15649. PMLR, 2022. +Baharan Mirzasoleiman, Jeff Bilmes, and Jure Leskovec. Coresets for data-efficient training of machine learning models. In International Conference on Machine Learning, pp. 6950-6960. PMLR, 2020. +Pratyush Mishra, Ryan Lehmkuhl, Akshayaram Srinivasan, Wenting Zheng, and Raluca Ada Popa. Delphi: A cryptographic inference service for neural networks. In 29th USENIX Security Symposium (USENIX Security 20), pp. 2505-2522. USENIX Association, August 2020. ISBN 978-1-939133-17-5. URL https://www.usenix.org/conference/usenixsecurity20/presentation/mishra. +Payman Mohassel and Yupeng Zhang. Secureml: A system for scalable privacy-preserving machine learning. In 2017 IEEE symposium on security and privacy (SP), pp. 19-38. IEEE, 2017. +Xu Ouyang, Shahina Mohd Azam Ansari, Felix Xiaozhu Lin, and Yangfeng Ji. Efficient nlp model finetuning via multistage data filtering. arXiv preprint arXiv:2207.14386, 2022. +Qi Pang, Jinhao Zhu, Helen Möllering, Wenting Zheng, and Thomas Schneider. Bolt: Privacy-preserving, accurate and efficient inference for transformers. In 2024 IEEE Symposium on Security and Privacy (SP), pp. 4753-4771. IEEE, 2024. +Burr Settles. Active Learning. Synthesis Lectures on Artificial Intelligence and Machine Learning. Morgan & Claypool Publishers, 2012. +Adi Shamir. How to share a secret. Communications of the ACM, 22(11):612-613, 1979. +Justin S. Smith, Ben Nebgen, Nicholas Lubbers, Alexandr Isayev, and Adrian E. Roitberg. Less is more: Sampling chemical space with active learning. The Journal of Chemical Physics, 148 (24):241733, 05 2018. ISSN 0021-9606. doi: 10.1063/1.5023802. URL https://doi.org/10.1063/1.5023802. +Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. CoRR, abs/1706.03762, 2017. URL http://arxiv.org/abs/1706.03762. + +Alex Wang, Amanpreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel R Bowman. Glue: A multi-task benchmark and analysis platform for natural language understanding. arXiv preprint arXiv:1804.07461, 2018. +Xinlei Xu, Awni Hannun, and Laurens Van Der Maaten. Data appraisal without data sharing. In International Conference on Artificial Intelligence and Statistics, pp. 11422-11437. PMLR, 2022. +Qiang Yang, Yang Liu, Tianjian Chen, and Yongxin Tong. Federated machine learning: Concept and applications. CoRR, abs/1902.04885, 2019. URL http://arxiv.org/abs/1902.04885. +Andrew Chi-Chih Yao. How to generate and exchange secrets. In 27th annual symposium on foundations of computer science (Sfcs 1986), pp. 162-167. IEEE, 1986. +Haoran You, Baopu Li, Zhanyi Sun, Xu Ouyang, and Yingyan Lin. Supertickets: Drawing task-agnostic lottery tickets from supernets via jointly architecture searching and parameter pruning. In European Conference on Computer Vision, pp. 674-690. Springer, 2022. +Xiang Zhang, Junbo Jake Zhao, and Yann LeCun. Character-level convolutional networks for text classification. In NIPS, 2015. + +# 7 APPENDIX + +# 7.1 MLP APPROXIMATION IS TIED TO DATA SELECTION + +Inspired by the outstanding performance of our MLP approximations for nonlinear modules, one question was raised: is the good performance of MLP approximations because of its inference capability? Our further experiments show that our MLP approximation is tied to data selection, instead of general model inference. + +Following Li et al. (2022), we replace three nonlinear modules in a BERT-base model with our approximations: Attention Softmax, Attention LayerNorm, and Feedforward Network Layernorm. There are $3^{*}12 = 36$ MLPs in the BERT model. In the experiments, two LayerNorm approximations are always data-aware, while there are both data-aware and fixed approximations of Softmax because of varying attention masks. The BERT with MLP approximation will be fine-tuned on the benchmark before inference. + +Three versions of attention softmax approximations achieve no better than random guess performances: (1) Using fixed MLP for attention softmax and changing the mask value to -3 instead of a very negative value for simpler distribution. Our BERT with approximation achieves only $52.92\%$ accuracy. (2) Using data-aware attention softmax approximation, which zeros out masked values on MLP outputs, has $49.08\%$ accuracy. If we normalize the remaining values to [0, 1], the accuracy remains $49.08\%$ . To better understand the influence of each nonlinear approximation, we did an ablation study that keeps just one kind of MLPs (12 of them) in BERT. However, none of them achieve better than $50.92\%$ accuracies. We further notice that adding just one attention softmax MLP to the model has no impact on the inference accuracy. But adding one layernorm MLP will degrade the accuracy by $0.85\%$ on average. These results show that having just one MLP will hurt the inference performance a lot; having 12 or even 36 MLPs will degrade model performance drastically. (3) Removing the attention mask to make MLP data-aware. It always has $50.92\%$ accuracies, no matter with all three approximations or just one approximation. + +The poor inference performance and good data selection performance show that the MLP approximation is specifically suitable for data selection while impractical for model inference directly. + +# 7.2 COMPARISON WITH BOLT + +We compare with Bolt (Pang et al., 2024)'s polynomial softmax approximation by replacing MLPs in our 2-phase proxy models while keeping other nonlinear layers intact. This approach ensures the highest softmax accuracy but the largest delay. Bolt achieves an accuracy of $69.04\% \pm 11.86\%$ , ours achieves $84.59\% \pm 0.95\%$ , and MPCFORMER achieves $50.92\%$ . With proxy models trained on $S_{boot}$ , Bolt outperforms MPCFORMER. However, our method surpasses Bolt by $15.55\%$ in accuracy and had a lower standard deviation, demonstrating better robustness against the biased $S_{boot}$ . Notably, if full + +approximations (e.g., reciprocal and layer normalization) are applied, Bolt's accuracy is expected to decrease further, reducing its effectiveness compared to our methods. + +# 7.3 ADDITIONAL EXPERIMENTS RESULTS + +![](images/dfbe1ed241e6e4fae9c8425d262fbac344a416afdbed7a584ced4bb38d45efa9.jpg) +Figure 8: Multi-phase selection achieves a better trade-off between accuracy and delay in data selection. 2-phase proxy model: 1 layer with 1 attention head and a dimension of 2, 3 layers with 12 attention heads and a dimension of 16; 1-phase proxy model: 3 layers with 12 attention heads and a dimension of 16. + +![](images/840736cd4500ce6cf3ad84677a5b4556102f4c548153b0181bce3aad044b6075.jpg) + +![](images/1a324f8094514c6ce109a0411d7f1788fcca7cd93c7e5ddf45f8e2b96c6f5eb9.jpg) + +![](images/48b3e3ae64792154df1637de5860442fb0cd23eb3ecae633921c4f191e66201e.jpg) + +![](images/179bd0a6540b193d23d86e1172d766d8bf9a53204cb81d366edefb7df9d75c4d.jpg) + +
# phases#MLP dimsDistilBERTBERT
SST2QQPSST2QQP
1283.9471.9084.5264.06
485.3270.0683.9463.13
882.1173.4386.5864.20
1682.9171.2883.4964.48
Average83.5771.6784.6363.97
2(2, 2)82.9172.3084.8672.79
(2, 8)82.4569.8481.8869.30
(2, 16)82.0071.6285.2173.07
(4, 16)82.5772.1983.4972.56
Average82.4871.4983.8671.93
3(2, 2, 2)81.7770.9283.3771.67
(2, 2, 8)80.6271.8585.5571.31
(2, 2, 16)82.1172.3584.7573.08
(2, 8, 8)82.5770.7985.2172.77
(2, 8, 16)83.3772.9084.5273.48
(2, 16, 16)81.6571.4686.0171.75
Average82.0171.7184.9073.47
+ +Table 5: Multi-phase selection is able to significantly reduce runtime and maintain comparable accuracy. On QQP, three-phase selection achieves $9.5\%$ higher accuracy than using one phase. Main results: 16, (2,16), (2,8,16). + +
BenchmarksSST2QNLIQQPAGNEWSYELP
DistillBERTOursSelectviaFullRandomOursSelectviaFullRandomOursSelectviaFullRandomOursSelectviaFullRandomOursSelectviaFullRandom
20%82.80±0.9882.32±0.6879.08±1.6571.12±1.5271.44±1.3570.34±1.7471.63±0.9171.51±1.5166.18±3.5487.75±1.0089.19±0.2786.43±0.6660.04±0.1659.93±0.1658.09±0.60
25%82.75±1.4183.97±1.0177.61±0.8271.04±1.5672.72±1.0969.95±0.9372.04±0.5673.18±1.2968.67±1.1188.06±1.5689.35±0.3887.67±0.4660.38±0.1360.63±0.2058.43±0.20
30%83.35±0.5983.97±0.7778.67±0.2371.10±1.0572.87±0.9270.72±0.9472.10±0.7374.04±0.5269.46±0.5888.28±1.7189.50±0.3288.02±0.7260.86±0.2161.14±0.2158.90±0.27
40%83.30±1.0683.88±1.3280.21±0.8172.03±1.3272.92±1.0670.92±0.1973.43±1.2373.97±0.6169.76±0.5489.72±0.2889.73±0.2687.81±0.6660.92±0.2761.15±0.2459.13±0.49
+ +Table 6: Our methods are robust against the increase in purchase budget. We have consistently better accuracy than Random by a large margin and achieve comparable performance with Oracle, up to $40\%$ budget. Ours: 2-phase selection. 1 layer with 1 attention head and a dimension of 2 in phase 1, 3 layers with 12 attention heads and a dimension of 16 in phase 2. + +
DistilBERTBERT
SST2QNLIQQPAGNEWSYELPSST2QNLIQQPAGNEWSYELP
40%80.21%±0.8170.92%±0.1969.76%±0.5487.81%±0.6659.13%±0.4980.99%±1.7473.15%±0.9971.07%±0.8588.36%±0.6759.85%±0.55
50%79.79%±1.2270.34%±0.7071.07%±0.2788.48%±0.4459.59%±0.2380.85%±0.7372.98%±1.5871.59%±1.2088.92%±0.3560.06%±0.30
60%80.41%±0.8071.47%±1.0671.76%±1.0888.84%±0.6359.73%±0.1882.39%±0.9573.01%±0.9872.28%±0.7588.80%±0.8659.73%±0.88
70%80.53%±1.6871.63%±0.5872.92%±0.4789.02%±0.2059.74%±0.3282.78%±0.4174.02%±1.3572.47%±0.6588.73%±0.3760.46%±0.33
80%81.08%±0.9471.40%±0.7972.69%±1.0389.42%±0.4459.98%±0.2483.00%±1.0475.29%±0.7672.90%±0.4489.42%±0.2960.56%±0.51
90%82.50%±1.0072.39%±0.6773.73%±1.0889.45%±0.3559.96%±0.5082.73%±1.4074.37%±1.3373.22%±1.0589.21%±0.2360.28%±0.26
100%83.60%±0.9273.20%±0.5773.85%±0.9489.67%±0.2360.36%±0.1182.78%±1.9174.83%±1.8473.66%±0.6289.58%±0.5260.39%±0.60
+ +Table 7: Accuracies of randomly selecting more data to train the target model. Compared with our selection accuracies in the main body, Random needs much more data. $100\%$ YELP and $90\%$ QQP data is necessary for our $20\%$ selection with DistilBERT; $100\%$ YELP and SST2, $80\%$ QQP and AGNEWS are necessary to match our $20\%$ budget performance of BERT. + +
DistillBERTBERTViT-smallViT-base
SST2QNLIQQPAGNEWSYELPSST2QNLIQQPAGNEWSYELPCifar10Cifar100Cifar10Cifar100
Ours82.34±1.0171.46±1.0671.53±0.7788.49±0.5560.18±0.2084.59±0.9573.68±1.6472.73±0.6089.04±0.4361.33±0.4096.46±0.2569.11±1.1696.61±0.1768.42±1.44
Random79.08±1.6570.34±1.7466.18±3.5486.43±0.6658.09±0.6079.58±1.8373.56±1.3568.84±0.7487.85±0.5459.16±0.4394.69±0.3743.99±0.9395.63±0.5063.21±1.78
(vs. Ours)-3.26-1.12-5.35-2.06-2.09-5.01-0.12-3.89-1.19-2.17-1.71-25.12-0.98-5.21
Oracle82.32±0.6871.44±1.3571.51±1.5189.19±0.2759.93±0.1686.06±0.7974.62±1.3973.08±1.8689.74±0.3860.80±1.3396.87±0.1768.40±1.7196.94±0.2367.85±1.35
(vs. Ours)-0.02-0.02-0.02+0.70-0.25+1.47+0.94+0.35+0.70-0.53+0.41-0.71+0.33-0.57
+ +Table 8: Ours are consistently higher than Random across all models and benchmarks and are close to Oracle (gold accuracy). Compared with Table 1, standard deviations of 5 runs are added. \ No newline at end of file diff --git a/ICLR/2025/SelectFormer in Data Markets_ Privacy-Preserving and Efficient Data Selection for Transformers with Multi-Party Computation/images.zip b/ICLR/2025/SelectFormer in Data Markets_ Privacy-Preserving and Efficient Data Selection for Transformers with Multi-Party Computation/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..2f2f082f90027d2a7f200820061f2006c414062e --- /dev/null +++ b/ICLR/2025/SelectFormer in Data Markets_ Privacy-Preserving and Efficient Data Selection for Transformers with Multi-Party Computation/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c7c540fd2acb0bc43a6ffb5c4797451551277be47c849136569350f5410ae85b +size 507609 diff --git a/ICLR/2025/SelectFormer in Data Markets_ Privacy-Preserving and Efficient Data Selection for Transformers with Multi-Party Computation/layout.json b/ICLR/2025/SelectFormer in Data Markets_ Privacy-Preserving and Efficient Data Selection for Transformers with Multi-Party Computation/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..f90bdffd7274818873b14e46a10ff7470aa067be --- /dev/null +++ b/ICLR/2025/SelectFormer in Data Markets_ Privacy-Preserving and Efficient Data Selection for Transformers with Multi-Party Computation/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:235619371bb298b78cd385857d29d801f8a460e5d7992a703c1fc6c191a622aa +size 527638 diff --git a/ICLR/2025/Selective Aggregation for Low-Rank Adaptation in Federated Learning/4aacdb1e-5b63-489a-bd6b-47295aea797c_content_list.json b/ICLR/2025/Selective Aggregation for Low-Rank Adaptation in Federated Learning/4aacdb1e-5b63-489a-bd6b-47295aea797c_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..4ac05dd2bdacbaf620b0e0f4ab62258e98f5e7db --- /dev/null +++ b/ICLR/2025/Selective Aggregation for Low-Rank Adaptation in Federated Learning/4aacdb1e-5b63-489a-bd6b-47295aea797c_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c977af232579e920d611687df1013fea1c1b17b3624ad6ff67407dbc8c597e0e +size 167329 diff --git a/ICLR/2025/Selective Aggregation for Low-Rank Adaptation in Federated Learning/4aacdb1e-5b63-489a-bd6b-47295aea797c_model.json b/ICLR/2025/Selective Aggregation for Low-Rank Adaptation in Federated Learning/4aacdb1e-5b63-489a-bd6b-47295aea797c_model.json new file mode 100644 index 0000000000000000000000000000000000000000..27a9c6955ff763c624fa275d0a6a25fe5e7aac03 --- /dev/null +++ b/ICLR/2025/Selective Aggregation for Low-Rank Adaptation in Federated Learning/4aacdb1e-5b63-489a-bd6b-47295aea797c_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ff8aa30d495bb413a624f17c8dcb696f9d99fdc074261fddd3ebe9a02683597b +size 202243 diff --git a/ICLR/2025/Selective Aggregation for Low-Rank Adaptation in Federated Learning/4aacdb1e-5b63-489a-bd6b-47295aea797c_origin.pdf b/ICLR/2025/Selective Aggregation for Low-Rank Adaptation in Federated Learning/4aacdb1e-5b63-489a-bd6b-47295aea797c_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..ca6da40207fd915cf1376c4b1bef326643e1cc58 --- /dev/null +++ b/ICLR/2025/Selective Aggregation for Low-Rank Adaptation in Federated Learning/4aacdb1e-5b63-489a-bd6b-47295aea797c_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d0cc1d50db884c936a27ec09d4f48164c18bc2bba1931d4432bd5422302d101c +size 848435 diff --git a/ICLR/2025/Selective Aggregation for Low-Rank Adaptation in Federated Learning/full.md b/ICLR/2025/Selective Aggregation for Low-Rank Adaptation in Federated Learning/full.md new file mode 100644 index 0000000000000000000000000000000000000000..45b271b2b8b42db67a652aba13aa7d964a393754 --- /dev/null +++ b/ICLR/2025/Selective Aggregation for Low-Rank Adaptation in Federated Learning/full.md @@ -0,0 +1,761 @@ +# SELECTIVE AGGREGATION FOR LOW-RANK ADAPTATION IN FEDERATED LEARNING + +Pengxin Guo $^{1}$ Shuang Zeng $^{1}$ Yanran Wang $^{2}$ Huijie Fan $^{3}$ Feifei Wang $^{1,4}$ Liangqiong $\mathbf{Q}\mathbf{u}^{1*}$ + +1 The University of Hong Kong 2 Stanford University +3 Shenyang Institute of Automation, Chinese Academy of Sciences +$^{4}$ Materials Innovation Institute for Life Sciences and Energy (MILES), HKU-SIRI + +{guopx, zengsh9}@connect.hku.hk, joycewyr@stanford.edu, fanhuijie@sia.cn, ffwang@eee.hku.hk, liangqqu@hku.hk + +# ABSTRACT + +We investigate LoRA in federated learning through the lens of the asymmetry analysis of the learned $A$ and $B$ matrices. In doing so, we uncover that $A$ matrices are responsible for learning general knowledge, while $B$ matrices focus on capturing client-specific knowledge. Based on this finding, we introduce Federated Share-A Low-Rank Adaptation (FedSA-LoRA), which employs two low-rank trainable matrices $A$ and $B$ to model the weight update, but only $A$ matrices are shared with the server for aggregation. Moreover, we delve into the relationship between the learned $A$ and $B$ matrices in other LoRA variants, such as rsLoRA and VeRA, revealing a consistent pattern. Consequently, we extend our FedSA-LoRA method to these LoRA variants, resulting in FedSA-rsLoRA and FedSA-VeRA. In this way, we establish a general paradigm for integrating LoRA with FL, offering guidance for future work on subsequent LoRA variants combined with FL. Extensive experimental results on natural language understanding and generation tasks demonstrate the effectiveness of the proposed method. Our code is available at https://github.com/Pengxin-Guo/FedSA-LoRA. + +# 1 INTRODUCTION + +Large Language Models (LLMs) trained on large amounts of text, referred to as Pre-trained Language Models (PLMs), have become a cornerstone of Natural Language Processing (NLP) (Brown, 2020; Touvron et al., 2023; Achiam et al., 2023; Chowdhery et al., 2023). Typically, to adapt PLMs for specific tasks or enhance accuracy in real-world scenarios, fine-tuning PLMs on task-specific data is often needed. However, in many real-world applications, data is distributed across different institutions, and data sharing between these entities is often restricted due to privacy and regulatory concerns. Federated Learning (FL) (McMahan et al., 2017; Li et al., 2020a; Zhang et al., 2021; Kairouz et al., 2021), which utilizes collaborative and decentralized training of models across multiple institutions without sharing personal data externally, offers a promising solution to this challenge. + +Despite its promise, fine-tuning PLMs in an FL system is challenging due to the high computational and storage demands on local clients and the communication overhead involved. To enable fine-tuning of PLMs in an FL system with limited resources, various Parameter-Efficient Fine-Tuning (PEFT) techniques have been explored. These include adapter-tuning-based methods (Houlsby et al., 2019; Zhang et al., 2024b), prompt-tuning-based methods (Li & Liang, 2021; Guo et al., 2023b; Che et al., 2023; Guo et al., 2023a; Qiu et al., 2024; Li et al., 2024; Deng et al., 2024; Sun et al., 2024a; Cui et al., 2024; Cao et al., 2024), and LoRA-based methods (Hu et al., 2022; Yi et al., 2023; Liu et al., 2023; Yang et al., 2024; Qi et al., 2024; Cho et al., 2023; Byun & Lee, 2024; Chen et al., 2024; Sun et al., 2024b; Lin et al., 2024; Wu et al., 2024; Wang et al., 2024b). Among these, LoRA-based methods have become increasingly popular, leveraging the assumption that overparameterized models have a low intrinsic dimension (Li et al., 2018; Aghajanyan et al., 2020). A pre-trained model can be shared and utilized to create multiple small LoRA modules tailored for + +![](images/d7b9b013c3b0a30f9f08f95f815ef11d878e23580813956b2a73d2d3f241aff1.jpg) +(a) LoRA + +![](images/e9a4ca23827181ae8ca0ef02ff003eeba1384bcbef76bcbde4615c1c75d97392.jpg) +(b) FFA-LoRA + +![](images/f9a5c21000bee853a12b50ffcd2a2fa5b0d9a833cc635058a0605f1601dba9d2.jpg) +(c) FedSA-LoRA (Ours) +Figure 1: The illustration of (a) LoRA, (b) FFA-LoRA, and (c) FedSA-LoRA. In LoRA, both $A$ and $B$ matrices are trainable and shared with the server for aggregation. In FFA-LoRA, only $B$ matrices are trainable and shared with the server for aggregation, while $A$ matrices are fixed after initialization. In FedSA-LoRA, both $A$ and $B$ matrices are trainable, but only $A$ matrices are shared with the server for aggregation while $B$ matrices are kept locally. + +![](images/a58c26668c7cb37db7d8d5341e8b3dd9d4f7e7cf85fcc1649f1f857f0731a744.jpg) + +different tasks, making them more effective and flexible. Moreover, this simple design allows us to merge the trainable matrices with the frozen weights during deployment, introducing no inference latency. Given these advantages, we focus on LoRA-based methods in this work. + +However, aggregating LoRA matrices $A$ and $B$ in FL setting poses a key problem. Directly aggregating the $A$ and $B$ matrices on the server and then broadcasting them to each client may introduce aggregation errors. Specifically, in an FL task with $m$ clients, each client's model update is represented by two low-rank matrices $A_{i}$ and $B_{i}$ introduced by LoRA. After server aggregation and broadcast, the model update of each client is: + +$$ +\frac {1}{m} \left(B _ {1} + B _ {2} + \dots + B _ {m}\right) \frac {1}{m} \left(A _ {1} + A _ {2} + \dots + A _ {m}\right), \tag {1} +$$ + +which is different from the "ideal" model update, i.e., $\frac{1}{m} (B_1A_1 + B_2A_2 + \dots + B_mA_m)$ .1 + +To solve this problem, some methods have been explored (Sun et al., 2024b; Wang et al., 2024b). For example, Sun et al. (2024b) propose Federated Freeze-A LoRA (FFA-LoRA), which freezes the $A$ matrices and only updates and aggregates the $B$ matrices, as illustrated in Figure 1(b). Thus, the local update of each client under FFA-LoRA is $\frac{1}{m} (B_1 + B_2 + \dots + B_m)A_0$ , where $A_0$ denotes the initialized and fixed weights. They point out that this term is equal to the "ideal" model update introduced by FFA-LoRA, i.e., $\frac{1}{m} (B_1A_0 + B_2A_0 + \dots + B_mA_0)$ . However, fixing $A$ matrices can impair the learning ability of LoRA and result in suboptimal performance (Zhang et al., 2023). Meanwhile, many works have demonstrated that a uniform model update for all clients is not optimal, especially under the non-IID scenario (Zhao et al., 2018; Zhu et al., 2021; Li et al., 2022), which motivates the development of personalized FL (T Dinh et al., 2020; Collins et al., 2021; Xu et al., 2023). To this end, we aim to explore a better way to combine LoRA and FL in this work and move beyond the constraint that the model update of each client should be the same. + +To achieve this, we start by analyzing the distinct roles of the learned $A$ and $B$ matrices when combining LoRA with FL, resulting in Lemma 1. This lemma suggests that when combing LoRA with FL, $A$ matrices are responsible for learning general knowledge while $B$ matrices focus on capturing client-specific knowledge. To verify this empirically, we locally fine-tuned a RoBERTa-large model (Liu et al., 2019) with LoRA (Hu et al., 2022) on the RTE task from the GLUE benchmark (Wang et al., 2018) with three clients under different levels of data heterogeneity. The results, illustrated in Figure 2, show that the learned $A$ matrices are more similar across clients than the $B$ matrices, and with increased data heterogeneity, the similarity of $B$ matrices between different clients decreases. These results demonstrate our argument that $A$ matrices are used to learn general knowledge while $B$ matrices focus on modeling client-specific knowledge. + +Based on our findings, we introduce the Federated Share-A Low-Rank Adaptation (FedSA-LoRA) method in this work. Similar to LoRA (Hu et al., 2022), we utilize two trainable low-rank matrices, denoted as $A$ and $B$ , to model the weight updates during local training. However, only the $A$ matrices are shared with the server for aggregation, as illustrated in Figure 1(c). Then, the model + +update of client $i$ after server aggregation and broadcast is: + +$$ +B _ {i} \frac {1}{m} \left(A _ {1} + A _ {2} + \dots + A _ {m}\right), \tag {2} +$$ + +where the first part $B_{i}$ is responsible for capturing client-specific knowledge while the second part is used to model general knowledge. By sharing the $A$ matrices that learn general knowledge with the server for aggregation, while keeping the $B$ matrices that capture client-specific knowledge locally during training, the learning abilities of LoRA combined with FL can be enhanced. Note that this method differs from previous works (Sun et al., 2024b; Wang et al., 2024b) that require each client to share a uniform model update. Instead, it allows for different model updates, placing it in the realm of personalized FL (T Dinh et al., 2020; Collins et al., 2021; Xu et al., 2023), which is more efficient under the non-IID scenario (Zhao et al., 2018; Zhu et al., 2021; Li et al., 2022). + +Moreover, we delve into the relationship between the learned $A$ and $B$ matrices in other LoRA variants, such as rsLoRA (Kalajdzievski, 2023) and VeRA (Kopiczko et al., 2024). The observations, illustrated in Figures 5 and 6 in Appendix, demonstrate a similar phenomenon to LoRA. Building upon these insights, we extend our FedSA-LoRA method to these LoRA variants, resulting in FedSA-rsLoRA and FedSA-VeRA. By extending the proposed method to other LoRA variants, we establish a general paradigm for integrating LoRA with FL, offering guidance for future work on subsequent LoRA variants combined with FL. + +We summarize our contributions as follows: + +- We investigate the relationship between learned $A$ and $B$ matrices in LoRA and other LoRA variants (e.g., rsLoRA and VeRA) across different clients, delineating their distinct roles. Specifically, $A$ matrices are responsible for learning general knowledge, while $B$ matrices focus on capturing client-specific knowledge. +- Building upon our findings, we establish a general paradigm for integrating LoRA with FL. Specifically, we introduce Federated Share-A LoRA (FedSA-LoRA), where both $A$ and $B$ matrices are trainable, but only the $A$ matrices are shared with the server for aggregation. We then generalize the FedSA-LoRA framework to other LoRA variants, resulting in FedSA-rsLoRA and FedSA-VeRA. +- Extensive experimental results demonstrate the superiority of the proposed FedSA-LoRA, FedSA-rsLoRA, and FedSA-VeRA compared to other methods. + +# 2 RELATED WORK + +# 2.1 FEDERATED LEARNING + +Federated Learning (FL) (McMahan et al., 2017; Li et al., 2020a; Zhang et al., 2021; Kairouz et al., 2021), a commonly used distributed learning method for tasks requiring privacy, has gained significant attention in recent years. However, its application faces challenges due to the non-IID nature of distributed datasets, resulting in accuracy discrepancies compared to centralized training. Numerous works (Li et al., 2020b; Xu et al., 2023; Yan et al., 2023; Chan et al., 2024; Xu et al., 2024; Zeng et al., 2024) have been proposed to mitigate this performance degradation, including optimizing local learning (Li et al., 2020b), optimizing server aggregation (Zeng et al., 2024), and personalized FL (Xu et al., 2023). Recently, some studies demonstrate that fine-tuning pre-trained models, especially Pre-trained Language Models (PLMs), through FL suffers less from the non-IID issue (Qu et al., 2022; Chen et al., 2023; Nguyen et al., 2023; Weller et al., 2022). The experimental results in (Weller et al., 2022) show that when applying PLMs, even the vanilla FedAvg can achieve performance comparable to centralized training. However, these large-scale PLMs usually introduce significant communication overheads in FL scenarios, leading to slow and impractical federated training in real-world applications. Additionally, local clients are often constrained by limited computational capacity and memory, making the local fine-tuning of PLMs challenging. To enable fine-tuning of PLMs in an FL system with limited resources, various Parameter-Efficient Fine-Tuning (PEFT) techniques have been explored, such as adapter-tuning-based methods (Houlsby et al., 2019; Zhang et al., 2024b), prompt-tuning-based methods (Li & Liang, 2021; Guo et al., 2023b; Che et al., 2023; Guo et al., 2023a; Qiu et al., 2024; Li et al., 2024; Deng et al., 2024; Sun et al., 2024a; Cui et al., 2024; Cao et al., 2024), and LoRA-based methods (Hu et al., 2022; Yi et al., 2023; Liu et al., 2023; + +Yang et al., 2024; Qi et al., 2024; Cho et al., 2023; Byun & Lee, 2024; Chen et al., 2024; Sun et al., 2024b; Lin et al., 2024; Wu et al., 2024; Wang et al., 2024b). Among these, LoRA-based methods have become increasingly popular, leveraging the assumption that over-parameterized models have a low intrinsic dimension (Li et al., 2018; Aghajanyan et al., 2020). A pre-trained model can be shared and utilized to create multiple small LoRA modules tailored for different tasks, making them more effective and flexible. Moreover, this simple design allows us to merge the trainable matrices with the frozen weights during deployment, introducing no inference latency. Given these advantages, we focus on LoRA-based methods in this work. + +# 2.2 LORA IN FEDERATED LEARNING + +Low-Rank Adaptation (LoRA) (Hu et al., 2022), which introduces low-rank adaptation matrices to simulate gradient updates while keeping the pre-trained model weights frozen, has recently gained significant attention due to its efficiency, effectiveness, and flexibility (Hayou et al., 2024; Liu et al., 2024; Kopiczko et al., 2024; Wang et al., 2024a). With this trait, LoRA can be utilized to mitigate the communication overhead in FL, which primarily relies on the size of model update parameters. Yi et al. (2023) propose FedLoRA, incorporating LoRA in FL to increase model fine-tuning efficiency. Liu et al. (2023) introduce DP-LoRA, ensuring differential privacy in FL for LLMs with minimal communication overhead. Yang et al. (2024) propose a dual-personalizing adapter (FedDPA), and Qi et al. (2024) introduce FDLoRA. Both adopt the similar idea where each client contains a personalized LoRA module and a global LoRA module to capture personalized and global knowledge, respectively. + +Another line of such work is heterogeneous LoRA. For example, Cho et al. (2023) introduce heterogeneous LoRA, where they deploy heterogeneous ranks across clients, aggregate the heterogeneous LoRA modules through zero-padding, and redistribute the LoRA modules heterogeneously through truncation. However, this simple zero-padding strategy can make the training process unstable (Byun & Lee, 2024). To solve this issue, Byun & Lee (2024) propose a replication-based strategy for aggregating rank-heterogeneous LoRA. Chen et al. (2024) propose Rank-Based LoRA Aggregation (RBLA) that performs a weighted aggregation for heterogeneous LoRA structures. Wang et al. (2024b) introduce a stacking-based aggregation method for heterogeneous LoRA. + +The most related work to ours is Federated Freeze-A LoRA (FFA-LoRA) (Sun et al., 2024b), which fixes the randomly initialized non-zero $A$ matrices and only fine-tunes the zero-initialized $B$ matrices to further halve the communication cost. However, since some matrices are fixed, the learning ability of LoRA is impaired, resulting in suboptimal performance (Zhang et al., 2023). In contrast, we propose Federated Share-A LoRA (FedSA-LoRA), where both $A$ and $B$ matrices are trainable and only the $A$ matrices are shared with the server for aggregation. + +# 3 MOTIVATING EXAMPLE + +Preliminary Building upon the hypothesis that updates to the weights during the fine-tuning exhibit a low "intrinsic rank", LoRA (Hu et al., 2022) proposes using the product of two low-rank matrices to update the pre-trained weights incrementally. For a pre-trained weight matrix $W_0 \in \mathbb{R}^{k \times d}$ , LoRA models the weight update $\Delta_W \in \mathbb{R}^{k \times d}$ utilizing a low-rank decomposition, expressed as $BA$ , where $B \in \mathbb{R}^{k \times r}$ and $A \in \mathbb{R}^{r \times d}$ represent two low-rank matrices, with $r \ll min(k, d)$ . During training, $W_0$ is frozen and does not receive gradient updates, while $A$ and $B$ contain trainable parameters. Consequently, the fine-tuned weight $W'$ can be represented as: $W' = W_0 + BA$ . The matrix $A$ is initialized with random Gaussian distribution, while $B$ is initially set to zero, resulting in $\Delta_W = BA$ being zero at the start of training. + +To analyze the role of learned $A$ and $B$ matrices, let's consider a simple example analogous to a single network layer with least-squares linear regression task. Specifically, suppose there is a pretrained linear model weight $W_0 \in \mathbb{R}^{k \times d}$ . With this model held constant, our goal is regressing $(x_t, y_t)$ pairs where $y_t$ is given by: + +$$ +y _ {t} = W _ {t} x _ {t}, +$$ + +with $W_{t} = W_{0} + \Delta_{W}$ . In LoRA, the target $\Delta_W$ is modeled by a low rank update to the pre-trained $W_{0}$ , i.e., $W^{\prime} = W_{0} + BA$ : + +$$ +\hat {y} = (W _ {0} + B A) x _ {t}, +$$ + +![](images/1a2c459c00b7e38d9476a4b72698c965987b68efb6fedb7333132c5f2db482c0.jpg) +(a) IID + +![](images/82688375c2aa3850596f07954332a505b7018a06d645a1032a90cd95a3c97ec6.jpg) +(b) moderate non-IID + +![](images/8ce73d9f3b314c7aac0c490998f9507f600bd3ba2baf30684df7259eea234b72.jpg) +(c) server non-IID + +![](images/2fa8b9ad92538edeeabf1cc6337c38f452f99af74e6fa86c10896c2c37ce980d.jpg) +(d) IID + +![](images/570b09fbde58435255922c9083089e27c32aa8c16b8efe07d912492afbcf39b6.jpg) +(e) moderate non-IID + +![](images/a461d589df257af3cda6978ccf29c908985352caad67e44cb68307f7523b96f2.jpg) +(f) server non-IID +Figure 2: Mean of pairwise cosine similarity of the learned $A$ and $B$ matrices across layers of a RoBERTa model locally fine-tuned with LoRA on the RTE task, with different levels of data heterogeneity. (a)-(c): value matrices; (d)-(f): query matrices. The learned $A$ matrices are more similar across clients than the $B$ matrices, and with increased data heterogeneity, the similarity of $B$ matrices between different clients decreases. + +where $B \in \mathbb{R}^{k \times r}$ and $A \in \mathbb{R}^{r \times d}$ , with $r \ll \min(k, d)$ . Then, the least squares loss is defined on the difference between $\hat{y}$ and $y_t$ : + +$$ +\mathcal {L} = \mathbb {E} _ {\left(x _ {t}, y _ {t}\right)} \left[ \| y _ {t} - \left(W _ {0} + B A\right) x _ {t} \| _ {2} ^ {2} \right]. \tag {3} +$$ + +Below, we present the lemma on minimizing this loss while freezing either $A$ or $B$ . The proof is provided in Section A.1 in Appendix. + +Lemma 1. Fine-tuning $B$ while fixing $A = Q$ , with the goal of optimizing Eq. (3), yields: + +$$ +B ^ {*} = \Delta_ {W} \mathbb {E} \left[ x _ {t} x _ {t} ^ {T} \right] Q ^ {T} \left(Q \mathbb {E} \left[ x _ {t} x _ {t} ^ {T} \right] Q ^ {T}\right) ^ {- 1}. \tag {4} +$$ + +Fine-tuning $A$ while fixing $B = U$ and assuming $U^{-1}$ exists, with the goal of optimizing Eq. (3), yields: + +$$ +A ^ {*} = U ^ {- 1} \Delta_ {W}. \tag {5} +$$ + +Remark 1. From this lemma, we can conclude that the optimal solution of $A^{*}$ is independent of the input data distribution, while $B^{*}$ is related to the input data distribution captured by $\mathbb{E}[x_t x_t^T]$ . This indicates that $A$ is responsible for learning general knowledge, while $B$ focuses on modeling client-specific knowledge. + +To verify this empirically, we locally fine-tune a RoBERTa-large model (Liu et al., 2019) with LoRA (Hu et al., 2022) on the RTE task from the GLUE benchmark (Wang et al., 2018) using three clients. We model an IID data distribution and two non-IID data distributions. The two non-IID distributions are modeled by a Dirichlet distribution with $\alpha = 1$ and $\alpha = 0.5$ , referred to as moderate non-IID and severe non-IID. Figure 2 shows the mean pairwise cosine similarity of the learned $A$ and $B$ matrices across clients. These results indicate that the learned $A$ matrices are more similar across clients than the $B$ matrices, and with increased data heterogeneity, the similarity of $B$ matrices between different clients decreases. To demonstrate that the $A$ matrices are indeed updated, as they are similar across different clients, we further illustrate the difference between the learned and initialized $A$ matrices for each client in Figure 4 in Appendix. These results confirm that the $A$ matrices are updated. This phenomenon is consistent with previous study about the asymmetry analysis in LoRA (Zhu et al., 2024). Based on these results, we argue that $A$ matrices are responsible for learning general knowledge while $B$ matrices focus on capturing client-specific knowledge. + +To demonstrate the generalizability of our findings, we further explore the relationship between the learned $A$ and $B$ matrices in other LoRA variants, such as rsLoRA (Kalajdzievski, 2023) and VeRA (Kopiczko et al., 2024). The observations, illustrated in Figures 5 and 6 in Appendix, show a similar phenomenon to LoRA. In this way, we uncover a general phenomenon when combining LoRA with FL, which serves as the foundation for our proposed method. + +There are some works analyzing the asymmetry of $A$ and $B$ within LoRA in other areas (Zhu et al., 2024; Tian et al., 2024). However, our work distinctly considers the asymmetry analyses of $A$ and $B$ within LoRA in the context of federated learning, while these related papers (Zhu et al., 2024; Tian et al., 2024) can further serve as verification of the effectiveness of our method. In particular, we further analyzed different non-IID scenarios, as data heterogeneity is a significant issue in FL. Through our analysis, we not only found that the learned $A$ matrices are more similar across clients than the $B$ matrices (consistent with previous findings), but more importantly, we discovered that with increased data heterogeneity, the similarity of $B$ matrices between different clients decreases. Moreover, we further extended this asymmetry analysis to other LoRA variants, such as rsLoRA (Kalajdzievski, 2023) and VeRA (Kopiczko et al., 2024), and found similar phenomena. This generalization was previously lacking in the literature (Zhu et al., 2024; Tian et al., 2024). + +# 4 OUR METHOD + +# 4.1 FEDERATED SHARE-A LOW RANK ADAPTATION + +Drawing from the insights of our findings, we introduce Federated Share-A Low-Rank Adaptation (FedSA-LoRA), illustrated in Figure 1(c), which utilizes two low-rank trainable matrices $A$ and $B$ to model the weight update, but only $A$ matrices are shared with the server for aggregation. Specifically, similar to LoRA (Hu et al., 2022), we employ two low-rank matrices, namely $B \in \mathbb{R}^{k \times r}$ and $A \in \mathbb{R}^{r \times d}$ with $r \ll \min(k, d)$ , to model the weight update $\Delta_W \in \mathbb{R}^{k \times d}$ for a pre-trained weight matrix $W_0 \in \mathbb{R}^{k \times d}$ . This approach allows us to represent the fine-tuned weight as $W_0 + BA$ . During the local training process, $W_0$ is frozen and does not receive gradient updates, while $A$ and $B$ contain trainable parameters. Following LoRA (Hu et al., 2022), the matrix $A$ is initialized with a random Gaussian distribution, whereas $B$ is initially set to zero, ensuring that $\Delta_W = BA$ is zero at the start of training. Then, for global aggregation, only the $A$ matrices are shared with the server for aggregation. Once the server averages these $A$ matrices, they are broadcast to each client for the subsequent training round. By sharing the $A$ matrices that learn general knowledge with the server for aggregation, while keeping the $B$ matrices that model client-specific knowledge locally, the learning abilities of LoRA combined with FL can be enhanced. + +Moreover, based on the similar phenomena observed in other LoRA variants (i.e., rsLoRA (Kalajdzievski, 2023) and VeRA (Kopiczko et al., 2024)), we extend the FedSA-LoRA method to these variants, resulting in FedSA-rsLoRA and FedSA-VeRA. Specifically, rsLoRA (Kalajdzievski, 2023) is similar to LoRA, differing only in the scaling factor. Thus, the difference between FedSA-rsLoRA and FedSA-LoRA also lies in the scaling factor. In VeRA (Kopiczko et al., 2024), the low-rank matrices $A$ and $B$ are initialized using the uniform version of Kaiming initialization, fixed, shared across all layers, and adapted with trainable scaling vectors $d$ and $b$ . The $b$ vectors are initialized to zero, and the $d$ vectors are initialized with a value of 0.1. To make the notation consistent with our work, we rewrite the scaling vectors $d$ and $b$ as $A_{d}$ and $B_{b}$ to reflect the position of each scaling vector. Thus, in FedSA-VeRA, only the scaling vector $A_{d}$ is shared with the server for aggregation, while $B_{b}$ is trained locally. By extending the proposed method to other LoRA variants, we establish a general paradigm for integrating LoRA with FL, offering guidance for future work on subsequent LoRA variants combined with FL. + +# 4.2 CONVERGENCE ANALYSIS + +To facilitate the convergence analysis of the proposed method, we make assumptions commonly encountered in the literature (Li et al., 2020c) to characterize the smooth and non-convex optimization landscape. + +Assumption 1. $\mathcal{L}_1,\dots ,\mathcal{L}_m$ are all $L$ -smooth.For all $W_{i,j}$ and $W_{i,k}$ + +$$ +\mathcal {L} _ {i} \left(W _ {i, k}\right) \leq \mathcal {L} _ {i} \left(W _ {i, j}\right) + \left\langle W _ {i, k} - W _ {i, j}, \nabla \mathcal {L} _ {i} \left(W _ {i, j}\right) \right\rangle_ {F} + \frac {L}{2} \| W _ {i, k} - W _ {i, j} \| _ {F} ^ {2}. +$$ + +Here, $m$ is the number of clients, $W_{i,j}$ and $W_{i,k}$ represent any different model weights of client $i$ , $\mathcal{L}_i$ is the empirical loss on client $i$ , $\nabla \mathcal{L}_i(W_{i,j})$ represents the gradient of $\mathcal{L}_i$ with respect to $W_{i,j}$ , $\langle \cdot ,\cdot \rangle_F$ is the Frobenius inner product, and $\| \cdot \| _F$ denotes the Frobenius norm. + +Assumption 2. Let $\xi_{i,t}$ be sampled from the $i$ -th client's local data uniformly at random at $t$ -th training step. The expected squared norm of stochastic gradients is uniformly bounded, i.e., + +$\mathbb{E}\| \nabla \mathcal{L}_i(W_i^{(t)};\xi_{i,t})\|^2\leq G^2$ , for all $i = 1,\dots ,m$ and $t = 0,\dots ,T - 1$ . Here $T$ denotes the total number of every client's training steps. + +Assumption 3. Let $W_{i}^{(t)} = W_{0} + B_{i}^{(t)}A_{i}^{(t)}$ represent the model parameters for the $i$ -th client at the $t$ -th step. There exist constants $C_B > 0, C_A > 0, c_B > 0,$ and $c_{A} > 0$ such that: + +$$ +\left\| B _ {i} ^ {(t)} \right\| _ {F} \leq C _ {B}, +$$ + +$$ +\left\| A _ {i} ^ {(t)} \right\| _ {F} \leq C _ {A}, +$$ + +$$ +\langle A _ {i} ^ {(t)} ^ {\top} A _ {i} ^ {(t)}, \nabla \mathcal {L} _ {i} (W _ {i} ^ {(t)}) ^ {\top} \nabla \mathcal {L} _ {i} (W _ {i} ^ {(t)}) \rangle_ {F} \geq c _ {A} \| \nabla \mathcal {L} _ {i} (W _ {i} ^ {(t)}) \| _ {F} ^ {2}, +$$ + +$$ +\langle B _ {i} ^ {(t)} ^ {\top} B _ {i} ^ {(t)}, \nabla \mathcal {L} _ {i} (W _ {i} ^ {(t)}) ^ {\top} \nabla \mathcal {L} _ {i} (W _ {i} ^ {(t)}) \rangle_ {F} \geq c _ {B} \| \nabla \mathcal {L} _ {i} (W _ {i} ^ {(t)}) \| _ {F} ^ {2}, +$$ + +for all $i = 1,\dots ,m$ and $t = 0,\dots ,T - 1$ + +Assumptions 1 and 2 are widely used $L$ -smoothness and bounded second moment assumption in FL papers (Li et al., 2020c; Yu et al., 2019; Basu et al., 2019). For Assumption 3, according to the definition of the Frobenius norm $\| A \|_{\mathrm{F}} = \sqrt{\sum_{i}^{m} \sum_{j}^{n} |a_{ij}|^{2}}$ , we know that the first two inequalities in Assumption 3 hold when all parameter values in $A_{i}^{(t)}$ and $B_{i}^{(t)}$ are finite. If we denote the eigenvalues of $A_{i}^{(t)}$ by $\{\lambda_1, \dots, \lambda_K\}$ , then the eigenvalue of $(A_{i}^{(t)})^{\top} A_{i}^{(t)}$ are $\{\lambda_1^2, \dots, \lambda_K^2\}$ . Similarly, if the eigenvalues of $\nabla \mathcal{L}_i(W_i^{(t)})$ are $\{\mu_1, \dots, \mu_K\}$ , then the eigenvalues of $(\nabla \mathcal{L}_i(W_i^{(t)}))^{\top} \nabla \mathcal{L}_i(W_i^{(t)})$ are $\{\mu_1^2, \dots, \mu_K^2\}$ . Noting that $\langle A_{i}^{(t)}^{\top} A_{i}^{(t)}, \nabla \mathcal{L}_{i}(W_{i}^{(t)})^{\top} \nabla \mathcal{L}_{i}(W_{i}^{(t)}) \rangle_{F} = \sum_{k} \lambda_{k}^{2} \mu_{k}^{2}$ , and $\| \nabla \mathcal{L}_i(W_i^{(t)}) \|_F^2 = \sum_k \mu_k^2$ , the third inequality of Assumption 3 holds when there exist a constant $c_A$ such that $\lambda_k^2 \geq c_A, \forall k$ . In other words, the third inequality of Assumption 3 holds when all the eigenvalues of $A_{i}^{(t)}$ are non-zero (choose $c_A = \min\{|\lambda_1|, \dots, |\lambda_K|\}$ ). Similarly, the last inequality of Assumption 3 holds when all the eigenvalues of $B_{i}^{(t)}$ are non-zero. Then we present the convergence rate for our method, with the proof provided in Section A.2 in Appendix. + +Theorem 1. Let Assumptions 1, 2, and 3 hold and $L$ , $G$ , $C_A$ , $C_B$ , $c_{A}$ , $c_{B}$ be defined therein. Denote $E$ as the number of local training iterations between two communication rounds. Then, for a learning rate $\eta$ , we have: + +$$ +\frac {1}{m T} \sum_ {i = 1} ^ {m} \sum_ {t = 1} ^ {T} \mathbb {E} \left[ \left\| \nabla \mathcal {L} _ {i} \left(W _ {i} ^ {(t)}\right) \right\| _ {F} ^ {2} \right] \leq \frac {2}{c _ {A} + c _ {B}} \sqrt {\frac {D M}{T}}, \tag {6} +$$ + +where $\mathcal{L}_i(W^{(0)}) - \mathcal{L}_i(W^*)\leq D,\forall i$ , and $(2C_B^2 E^2 G^2 +\frac{1}{2} G^2)\eta +\frac{3}{2}\eta^4 C_A^2 C_B^2 G^4 L + (C_A C_B G^2 +$ $\frac{3}{2} C_A^2 LG^2 +\frac{3}{2} C_B^2 LG^2 +2C_B^4 E^2 LG^2)\eta^2\leq M\eta^2.$ + +According to Theorem 1, we can obtain an $O\left(\frac{1}{\sqrt{T}}\right)$ convergence rate towards the stationary solution under smooth and non-convex conditions. This convergence rate is comparable to that of traditional FedAvg in the non-convex scenario (Yu et al., 2019) + +# 5 EXPERIMENTS + +In this section, we evaluate and compare the performance of the proposed method with other methods on two types of tasks: natural language understanding and natural language generation. For the natural language understanding tasks, we use the RoBERTa model (Liu et al., 2019) evaluated on the GLUE benchmark (Wang et al., 2018), including MNLI, SST2, QNLI, QQP, and RTE. For the natural language generation tasks, we employ the LLaMA model (Touvron et al., 2023) evaluated on the GSM8K dataset (Cobbe et al., 2021). Our implementation is based on the FederatedScope-LLM library (Kuang et al., 2023). The experiments for LoRA-based methods are conducted on NVIDIA GeForce RTX 4090 and 3090 GPUs, while the rsLoRA-based and VeRA-based methods are carried out on NVIDIA L40S GPUs. All experiments are performed with half-precision enabled for efficiency. For the main results in Table 1, they are based on multiple runs to report the mean and standard deviation, while other results in our paper are based on a single run. + +# 5.1 NATURAL LANGUAGE UNDERSTANDING + +Model Performance. For the natural language understanding tasks, similar to FFA-LoRA (Sun et al., 2024a), we randomly split the data across three clients for federated learning. We model a non-IID data distribution using a Dirichlet distribution with $\alpha = 0.5$ , i.e., $\operatorname{Dir}(0.5)$ . We use the pre-trained RoBERTa-large (355M) (Liu et al., 2019) from the HuggingFace Transformers library (Wolf et al., 2020) as the base model. For LoRA-based methods optimization, we adopt the SGD optimizer (Ruder, 2016) for all approaches. We set the batch size to 128, local update steps to 10, and total communication rounds to 1000, consistent across all experiments. Similar to Hu et al. (2022), we only apply LoRA to $W_{q}$ and $W_{v}$ in the attention layers in our experiments. The rank $r = 8$ and scaling factor $\alpha = 16$ are fixed for all algorithms. We report the best result from experiments run with learning rates $\eta \in \{5\mathrm{E} - 3,1\mathrm{E} - 2,2\mathrm{E} - 2,5\mathrm{E} - 2,1\mathrm{E} - 1\}$ . The optimization of rsLoRA-based methods is similar to LoRA-based methods, only the learning rates are searched from $\eta \in \{1\mathrm{E} - 3,2\mathrm{E} - 3,5\mathrm{E} - 3,1\mathrm{E} - 2,2\mathrm{E} - 2,5\mathrm{E} - 2\}$ . For VeRA-based methods, following VeRA (Kopiczko et al., 2024), we set the rank $r = 256$ . We adopt the AdamW optimizer (Loshchilov & Hutter, 2017), introduce separate learning rates for the classification head and the adapted layers, and determine the learning rates through hyperparameter tuning. Other settings are the same as for LoRA-based methods. The learning rates used for each method are shown in Tables 6, 7, and 8 in Appendix. + +Table 1: Performance of different methods on the GLUE benchmark. MNLI-m denotes MNLI with matched test sets, and MNLI-mm denotes MNLI with mismatched test sets. For all tasks, we report accuracy evaluated across 3 runs with mean and standard deviation. + +
MethodMNLI-mMNLI-mmSST2QNLIQQPRTEAvg.
LoRALoRA88.71±0.0988.19±0.0295.16±0.0991.16±0.7285.33±1.3387.49±0.1589.33
FFA-LoRA88.83±0.0288.27±0.0394.95±0.0491.52±0.5986.71±0.0786.08±1.1689.39
FedDPA-LoRA88.99±0.0688.43±0.0595.50±0.0690.74±1.3885.73±1.7387.44±0.1389.47
FedSA-LoRA90.18±0.0288.88±0.0296.00±0.0492.13±0.2487.48±0.2287.93±0.1190.43
rsLoRArsLoRA88.91±0.1588.33±0.0495.02±0.2491.21±0.3986.73±0.9885.99±0.3489.36
FFA-rsLoRA89.21±0.1188.45±0.0895.42±0.1791.42±0.4486.93±1.1885.24±0.2189.44
FedDPA-rsLoRA89.34±0.1188.53±0.0595.56±0.2190.97±0.7686.81±0.5386.26±0.1189.57
FedSA-rsLoRA90.35±0.1189.02±0.0395.78±0.0892.03±0.2287.97±0.1688.00±0.1090.52
VeRAVeRA85.54±0.1085.09±0.0793.53±0.1391.90±0.1782.07±0.3586.31±0.1287.40
FFA-VeRA86.63±0.1386.22±0.0893.44±0.0592.05±0.2382.23±0.0783.54±0.5987.35
FedDPA-VeRA86.74±0.1186.35±0.0793.61±0.3290.73±0.5482.11±0.4186.12±0.1287.61
FedSA-VeRA87.21±0.1086.52±0.0493.68±0.0792.91±0.0982.56±0.0587.83±0.0988.45
+ +The experimental results are shown in Table 1. From this table, we can observe that the proposed FedSA-LoRA, FedSA-rsLoRA, and FedSA-VeRA consistently outperform other methods across all tasks, demonstrating the effectiveness of the proposed method. + +System Efficiency. We further compare the proposed method with baselines in terms of system efficiency, following Qu et al. (2022); Zhang et al. (2024a); Lai et al. (2022). The system efficiency in FL consists of communication cost and computation cost. To provide a comprehensive comparison, we detail the number of trainable parameters, the number of communication model parameters per FL round, the computation cost per FL round, and the number of communication rounds needed to reach the predefined target performance on the RTE and QNLI tasks in Table 2. The target performance is defined as $95\%$ of the prediction accuracy provided in LoRA (Hu et al., 2022). Specifically, we define the target performance of the RTE and QNLI tasks as $80.94\%$ and $90.06\%$ , respectively. + +Communication cost is a critical factor in FL, as it significantly impacts the overall system efficiency. The communication cost can be roughly estimated by considering the number of transmitted messages required to achieve a target performance, calculated as #transmitted messages = #communication round × #communicated model parameter. As shown in Table 2, our FedSA-LoRA requires the smallest communication cost to reach the target performance (with smallest communication rounds and per-round communication parameters). Additionally, while our FedSA-LoRA requires more trainable model parameters and incurs slightly more computation cost per FL round than the baseline FFA-LoRA (22s compared to 20s on RTE task), it is important to note that our model reaches the target performance with fewer communication rounds (#91 compared to #229 on RTE task). These computation and communication costs demonstrate the overall efficiency of our model. + +Table 2: Time and space costs for each method on the RTE and QNLI tasks. # Communication round denotes the number of communication rounds to reach the predefined target performance. + +
# Trainable Parm.# Per-round Communicated Parm.# Per-round Computation Cost# Communication Round
RTEQNLIRTEQNLI
LoRA1.83M0.78M22s35s167397
FFA-LoRA1.44M0.39M20s33s229374
FedDPA-LoRA2.62M0.78M23s37s128325
FedSA-LoRA1.83M0.39M22s34s91224
+ +# 5.2 IN-DEPTH ANALYSES + +In this section, we utilize LoRA-based methods to perform in-depth analyses on the natural language understanding tasks of QNLI, SST2, and MNLI-m to assess the impact of factors such as data heterogeneity, the number of clients, and LoRA rank on model performance. + +# 5.2.1 EFFECT OF DATA HETEROGENEITY + +To investigate the effect of data heterogeneity on model performance, we model an IID partition (Split-1) and two non-IID partitions with Dir (1) and Dir (0.5). The latter two non-IID partitions are referred to as moderate non-IID (Split-2) and severe non-IID (Split-3). The training settings are the same as in Section 5.1. + +Table 3: Performance comparison on the QNLI, SST2, and MNLI-m tasks with various degrees of data heterogeneity. + +
MethodQNLISST2MNLI-m
Split-1Split-2Split-3Split-1Split-2Split-3Split-1Split-2Split-3
LoRA92.9292.4490.6095.3095.5395.2688.5288.3588.80
FFA-LoRA92.6892.2991.7295.8795.4794.9188.1588.0388.83
FedSA-LoRA92.9593.3292.0096.1096.2495.9289.5789.7190.20
+ +The results are provided in Table 3. From these results, we can observe that the proposed FedSA-LoRA consistently outperforms other baselines, demonstrating its adaptability and robustness in various heterogeneous data scenarios. Additionally, as data heterogeneity increases, the improvement of the proposed method also increases. Specifically, FedSA-LoRA improves accuracy by $0.03\%$ , $0.88\%$ , and $1.84\%$ on the QNLI task from IID to severe non-IID compared with LoRA, and by $1.05\%$ , $1.36\%$ , and $1.4\%$ on the MNLI-m task. This indicates that the proposed method is more effective when non-IID conditions are more severe. This phenomenon is consistent with Figure 2, which shows that with increased data heterogeneity, the similarity of $B$ matrices between different clients decreases. Therefore, when the non-IID conditions are more severe, the advantages of keeping $B$ locally become more pronounced. In this case, the learned $B$ will be less similar, highlighting the need for personalization. + +# 5.2.2 EFFECT OF NUMBER OF CLIENTS + +In Section 5.1, we demonstrated the effectiveness of the proposed method on a small number of clients, i.e., three clients. In this section, we show the superiority of FedSA-LoRA compared to other baselines on a larger number of clients, i.e., from 10 to 100 clients. Specifically, we use the same non-IID split, i.e., Dir (0.5), to divide the data into 10, 20, and 100 clients. The training settings are the same as in Section 5.1 and the results are shown in Table 4. + +It can be concluded that FedSA-LoRA not only outperforms other methods with a small number of clients (i.e., 3 clients) but also shows superior performance with a large number of clients (i.e., from 10 to 100 clients), demonstrating the adaptability and robustness of the proposed FedSA-LoRA across various client numbers. + +Table 4: Performance comparison on the QNLI, SST2, and MNLI-m tasks with different number of clients. We apply full participation for FL system with 10 and 20 clients, and apply client sampling with rate 0.3 for FL system with 100 clients. + +
MethodQNLISST2MNLI-m
10 clients20 clients100 clients10 clients20 clients100 clients10 clients20 clients100 clients
LoRA91.3291.2390.3296.6893.1696.6886.9488.5088.13
FFA-LoRA91.4791.7091.2796.5993.3196.3386.7688.6087.86
FedSA-LoRA91.9792.5491.4896.8394.2197.0288.5989.0588.82
+ +# 5.2.3 EFFECT OF LORA RANK + +The adapter parameter budget (i.e., rank $r$ ) is a key factor in LoRA performance. In this section, we experiment with rank $r \in \{2, 4, 8, 16\}$ on the QNLI, SST2, and MNLI-m tasks to test its influence on model performance, keeping other settings unchanged compared to Section 5.1. + +Table 5: Performance comparison on the QNLI, SST2, and MNLI-m tasks with different LoRA ranks $r$ . + +
RankMethodQNLISST2MNLI-mRankMethodQNLISST2MNLI-m
r=2LoRA92.0794.6988.29r=4LoRA92.7194.2088.43
FFA-LoRA91.0293.9587.98FFA-LoRA92.9794.6188.24
FedSA-LoRA92.6995.6789.14FedSA-LoRA93.1095.6988.98
r=8LoRA90.6995.2688.80r=16LoRA90.5994.9888.78
FFA-LoRA91.7294.9188.83FFA-LoRA91.6294.1389.25
FedSA-LoRA92.0095.9290.20FedSA-LoRA92.0395.7889.59
+ +The results, as shown in Table 5, demonstrate that the proposed FedSA-LoRA outperforms other methods across various LoRA rank values, showcasing the adaptability and robustness of FedSA-LoRA in different scenarios. + +# 5.3 NATURAL LANGUAGE GENERATION + +For the natural language generation tasks, we adopt the pre-trained LLaMA3-8B (Meta, 2024) from the HuggingFace Transformers library (Wolf et al., 2020), using the GSM8K dataset (Cobbe et al., 2021) and the CodeSearchNet dataset (Husain et al., 2019) for evaluation. For the GSM8K dataset (Cobbe et al., 2021), Following (Kuang et al., 2023), we split the data into three clients under an IID distribution, and other optimization hyperparameters are the same as in that work. The results of LoRA, FFA-LoRA, and FedSA-LoRA are 46.23, 46.32, and 46.63, respectively, and the generated examples are shown in Table 9 in Appendix. From the given example, it can be seen that both LoRA and FFA-LoRA have reasoning errors, but FedSA-LoRA can reason accurately, demonstrating the superiority of the proposed method in complex natural language generation tasks. + +For an additional dataset on the code generation task. We choose the CodeSearchNet dataset (Husain et al., 2019) and use the default non-IID partitioning provided in (Kuang et al., 2023). The performance scores for LoRA, FFA-LoRA, and our FedSA-LoRA are 58.34, 58.57, and 59.66, respectively, which further validates the effectiveness of our method in generation tasks. + +# 6 CONCLUSION + +In this work, we discover that when combining LoRA with FL, $A$ matrices are responsible for learning general knowledge, while $B$ matrices focus on capturing client-specific knowledge. Building upon this finding, we introduce Federated Share-A Low-Rank Adaptation (FedSA-LoRA), which employs two low-rank trainable matrices $A$ and $B$ to model the weight update, but only $A$ matrices are shared with the server for aggregation. By sharing the $A$ matrices that learn general knowledge with the server for aggregation, while keeping the $B$ matrices that model client-specific knowledge locally, the learning abilities of LoRA combined with FL can be enhanced. Moreover, we explore the relationship between the learned $A$ and $B$ matrices in other LoRA variants, such as rsLoRA and VeRA, revealing a consistent pattern. Consequently, we extend our FedSA-LoRA method to these LoRA variants, resulting in FedSA-rsLoRA and FedSA-VeRA. By doing so, we establish a general paradigm for integrating LoRA with FL, offering guidance for future work on subsequent LoRA variants combined with FL. + +# ACKNOWLEDGMENTS + +This work was supported by National Natural Science Foundation of China (62306253, U24A201397), Early career fund (27204623), and Guangdong Natural Science Fund-General Programme (2024A1515010233). + +# REFERENCES + +Josh Achiam, Steven Adler, Sandhini Agarwal, Lama Ahmad, Ilge Akkaya, Florencia Leoni Aleman, Diogo Almeida, Janko Altenschmidt, Sam Altman, Shyamal Anadkat, et al. Gpt-4 technical report. arXiv preprint arXiv:2303.08774, 2023. +Armen Aghajanyan, Luke Zettlemoyer, and Sonal Gupta. Intrinsic dimensionality explains the effectiveness of language model fine-tuning. arXiv preprint arXiv:2012.13255, 2020. +Debraj Basu, Deepesh Data, Can Karakus, and Suhas Diggavi. Qsparse-local-sgd: Distributed sgd with quantization, sparsification and local computations. Advances in Neural Information Processing Systems, 32, 2019. +Tom B Brown. Language models are few-shot learners. arXiv preprint ArXiv:2005.14165, 2020. +Yuji Byun and Jaeho Lee. Towards federated low-rank adaptation with rank-heterogeneous communication. arXiv preprint arXiv:2406.17477, 2024. +Linxiao Cao, Yifei Zhu, and Wei Gong. Sfprompt: Communication-efficient split federated fine-tuning for large pre-trained models over resource-limited devices. arXiv preprint arXiv:2407.17533, 2024. +Yun-Hin Chan, Rui Zhou, Running Zhao, Zhihan JIANG, and Edith CH Ngai. Internal cross-layer gradients for extending homogeneity to heterogeneity in federated learning. In The Twelfth International Conference on Learning Representations, 2024. +Tianshi Che, Ji Liu, Yang Zhou, Jiaxiang Ren, Jiwen Zhou, Victor Sheng, Huaiyu Dai, and Dejing Dou. Federated learning of large language models with parameter-efficient prompt tuning and adaptive optimization. In Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing, pp. 7871-7888, 2023. +Hong-You Chen, Cheng-Hao Tu, Ziwei Li, Han Wei Shen, and Wei-Lun Chao. On the importance and applicability of pre-training for federated learning. In The Eleventh International Conference on Learning Representations, 2023. +Shuaijun Chen, Omid Tavallaie, Niousha Nazemi, and Albert Y. Zomaya. Rbla: Rank-based-lore-aggregation for fine-tuning heterogeneous models in flaas, 2024. +Yae Jee Cho, Luyang Liu, Zheng Xu, Aldi Fahrezi, Matt Barnes, and Gauri Joshi. Heterogeneous lora for federated fine-tuning of on-device foundation models. In International Workshop on Federated Learning in the Age of Foundation Models in Conjunction with NeurIPS 2023, 2023. +Aakanksha Chowdhery, Sharan Narang, Jacob Devlin, Maarten Bosma, Gaurav Mishra, Adam Roberts, Paul Barham, Hyung Won Chung, Charles Sutton, Sebastian Gehrmann, et al. Palm: Scaling language modeling with pathways. Journal of Machine Learning Research, 24(240): 1-113, 2023. +Karl Cobbe, Vineet Kosaraju, Mohammad Bavarian, Mark Chen, Heewoo Jun, Lukasz Kaiser, Matthias Plappert, Jerry Tworek, Jacob Hilton, Reiichiro Nakano, et al. Training verifiers to solve math word problems. arXiv preprint arXiv:2110.14168, 2021. +Liam Collins, Hamed Hassani, Aryan Mokhtari, and Sanjay Shakkottai. Exploiting shared representations for personalized federated learning. In International conference on machine learning, pp. 2089-2099. PMLR, 2021. +Tianyu Cui, Hongxia Li, Jingya Wang, and Ye Shi. Harmonizing generalization and personalization in federated prompt learning. In *Forty-first International Conference on Machine Learning*, 2024. + +Wenlong Deng, Christos Thrampoulidis, and Xiaoxiao Li. Unlocking the potential of prompt-tuning in bridging generalized and personalized federated learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 6087-6097, 2024. +Tao Guo, Song Guo, and Junxiao Wang. Pfedprompt: Learning personalized prompt for vision-language models in federated learning. In Proceedings of the ACM Web Conference 2023, pp. 1364-1374, 2023a. +Tao Guo, Song Guo, Junxiao Wang, Xueyang Tang, and Wenchao Xu. Promptfl: Let federated participants cooperatively learn prompts instead of models-federated learning in age of foundation model. IEEE Transactions on Mobile Computing, 2023b. +Soufiane Hayou, Nikhil Ghosh, and Bin Yu. Lora+: Efficient low rank adaptation of large models. In *Forty-first International Conference on Machine Learning*, 2024. +Neil Houlsby, Andrei Giurgiu, Stanislaw Jastrzebski, Bruna Morrone, Quentin De Laroussilhe, Andrea Gesmundo, Mona Attariyan, and Sylvain Gelly. Parameter-efficient transfer learning for nlp. In International conference on machine learning, pp. 2790-2799. PMLR, 2019. +Edward J Hu, Phillip Wallis, Zeyuan Allen-Zhu, Yuzhhi Li, Shean Wang, Lu Wang, Weizhu Chen, et al. Lora: Low-rank adaptation of large language models. In International Conference on Learning Representations, 2022. +Hamel Husain, Ho-Hsiang Wu, Tiferet Gazit, Miltiadis Allamanis, and Marc Brockschmidt. Codesearchnet challenge: Evaluating the state of semantic code search. arXiv preprint arXiv:1909.09436, 2019. +Peter Kairouz, H Brendan McMahan, Brendan Avent, Aurélien Bellet, Mehdi Bennis, Arjun Nitin Bhagoji, Kallista Bonawitz, Zachary Charles, Graham Cormode, Rachel Cummings, et al. Advances and open problems in federated learning. Foundations and Trends® in Machine Learning, 14(1-2):1-210, 2021. +Damjan Kalajdzievski. A rank stabilization scaling factor for fine-tuning with lora. arXiv preprint arXiv:2312.03732, 2023. +Dawid Jan Kopiczko, Tijmen Blankevoort, and Yuki M Asano. Vera: Vector-based random matrix adaptation. In The Twelfth International Conference on Learning Representations, 2024. +Weirui Kuang, Bingchen Qian, Zitao Li, Daoyuan Chen, Dawei Gao, Xuchen Pan, Yuexiang Xie, Yaliang Li, Bolin Ding, and Jingren Zhou. Federatedscope-llm: A comprehensive package for fine-tuning large language models in federated learning. arXiv preprint arXiv:2309.00363, 2023. +Fan Lai, Yinwei Dai, Sanjay Singapuram, Jiachen Liu, Xiangfeng Zhu, Harsha Madhyastha, and Mosharaf Chowdhury. Fedscale: Benchmarking model and system performance of federated learning at scale. In International conference on machine learning, pp. 11814-11827. PMLR, 2022. +Chunyuan Li, Heerad Farkhoor, Rosanne Liu, and Jason Yosinski. Measuring the intrinsic dimension of objective landscapes. arXiv preprint arXiv:1804.08838, 2018. +Hongxia Li, Wei Huang, Jingya Wang, and Ye Shi. Global and local prompts cooperation via optimal transport for federated learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 12151-12161, 2024. +Qinbin Li, Yiqun Diao, Quan Chen, and Bingsheng He. Federated learning on non-iid data silos: An experimental study. In 2022 IEEE 38th international conference on data engineering (ICDE), pp. 965-978. IEEE, 2022. +Tian Li, Anit Kumar Sahu, Ameet Talwalkar, and Virginia Smith. Federated learning: Challenges, methods, and future directions. IEEE signal processing magazine, 37(3):50-60, 2020a. +Tian Li, Anit Kumar Sahu, Manzil Zaheer, Maziar Sanjabi, Ameet Talwalkar, and Virginia Smith. Federated optimization in heterogeneous networks. Proceedings of Machine learning and systems, 2:429-450, 2020b. + +Xiang Li, Kaixuan Huang, Wenhao Yang, Shusen Wang, and Zhihua Zhang. On the convergence of fedavg on non-iid data. In International Conference on Learning Representations, 2020c. +Xiang Lisa Li and Percy Liang. Prefix-tuning: Optimizing continuous prompts for generation. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pp. 4582-4597, 2021. +Zheng Lin, Xuanjie Hu, Yuxin Zhang, Zhe Chen, Zihan Fang, Xianhao Chen, Ang Li, Praneeth Vepakomma, and Yue Gao. Splitlora: A split parameter-efficient fine-tuning framework for large language models. arXiv preprint arXiv:2407.00952, 2024. +Shih-yang Liu, Chien-Yi Wang, Hongxu Yin, Pavlo Molchanov, Yu-Chiang Frank Wang, Kwang-Ting Cheng, and Min-Hung Chen. Dora: Weight-decomposed low-rank adaptation. In *Forty-first International Conference on Machine Learning*, 2024. +Xiao-Yang Liu, Rongyi Zhu, Daochen Zha, Jiechao Gao, Shan Zhong, Matt White, and Meikang Qiu. Differentially private low-rank adaptation of large language model using federated learning. ACM Transactions on Management Information Systems, 2023. +Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. Roberta: A robustly optimized bert pretraining approach. arXiv preprint arXiv:1907.11692, 2019. +Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization. In International Conference on Learning Representations, 2017. +Brendan McMahan, Eider Moore, Daniel Ramage, Seth Hampson, and Blaise Aguera y Arcas. Communication-efficient learning of deep networks from decentralized data. In Artificial intelligence and statistics, pp. 1273-1282. PMLR, 2017. +AI Meta. Introducing meta llama 3: The most capable openly available llm to date. Meta AI, 2024. +John Nguyen, Jianyu Wang, Kshitiz Malik, Maziar Sanjabi, and Michael Rabbat. Where to begin? on the impact of pre-training and initialization in federated learning. In The Eleventh International Conference on Learning Representations, 2023. +Jiaxing Qi, Zhongzhi Luan, Shaohan Huang, Carol Fung, Hailong Yang, and Depei Qian. Fdthora: Personalized federated learning of large language model via dual lora tuning. arXiv preprint arXiv:2406.07925, 2024. +Chen Qiu, Xingyu Li, Chaithanya Kumar Mummadi, Madan Ravi Ganesh, Zhenzhen Li, Lu Peng, and Wan-Yi Lin. Federated text-driven prompt generation for vision-language models. In The Twelfth International Conference on Learning Representations, 2024. +Liangqiong Qu, Yuyin Zhou, Paul Pu Liang, Yingda Xia, Feifei Wang, Ehsan Adeli, Li Fei-Fei, and Daniel Rubin. Rethinking architecture design for tackling data heterogeneity in federated learning. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 10061-10071, 2022. +Daniel Rothchild, Ashwinee Panda, Enayat Ullah, Nikita Ivkin, Ion Stoica, Vladimir Braverman, Joseph Gonzalez, and Raman Arora. Fetchsgd: Communication-efficient federated learning with sketching. In International Conference on Machine Learning, pp. 8253-8265. PMLR, 2020. +Sebastian Ruder. An overview of gradient descent optimization algorithms. arXiv preprint arXiv:1609.04747, 2016. +Jingwei Sun, Ziyue Xu, Hongxu Yin, Dong Yang, Daguang Xu, Yudong Liu, Zhixu Du, Yiran Chen, and Holger R Roth. Fedbpt: Efficient federated black-box prompt tuning for large language models. In *Forty-first International Conference on Machine Learning*, 2024a. +Youbang Sun, Zitao Li, Yaliang Li, and Bolin Ding. Improving lora in privacy-preserving federated learning. In The Twelfth International Conference on Learning Representations, 2024b. + +Canh T Dinh, Nguyen Tran, and Josh Nguyen. Personalized federated learning with moreau envelopes. Advances in neural information processing systems, 33:21394-21405, 2020. +Chunlin Tian, Zhan Shi, Zhijiang Guo, Li Li, and Chengzhong Xu. Hydralora: An asymmetric lora architecture for efficient fine-tuning. arXiv preprint arXiv:2404.19245, 2024. +Hugo Touvron, Thibaut Lavril, Gautier Izacard, Xavier Martinet, Marie-Anne Lachaux, Timothée Lacroix, Baptiste Rozière, Naman Goyal, Eric Hambro, Faisal Azhar, et al. Llama: Open and efficient foundation language models. arXiv preprint arXiv:2302.13971, 2023. +Alex Wang, Amanpreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel Bowman. Glue: A multi-task benchmark and analysis platform for natural language understanding. In Proceedings of the 2018 EMNLP Workshop BlackboxNLP: Analyzing and Interpreting Neural Networks for NLP, pp. 353-355, 2018. +Xuehao Wang, Feiyang Ye, and Yu Zhang. Task-aware low-rank adaptation of segment anything model. arXiv preprint arXiv:2403.10971, 2024a. +Ziyao Wang, Zheyu Shen, Yexiao He, Guoheng Sun, Hongyi Wang, Lingjuan Lyu, and Ang Li. Flora: Federated fine-tuning large language models with heterogeneous low-rank adaptations. arXiv preprint arXiv:2409.05976, 2024b. +Orion Weller, Marc Marone, Vladimir Braverman, Dawn Lawrie, and Benjamin Van Durme. Pretrained models for multilingual federated learning. In Proceedings of the 2022 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pp. 1413-1421, 2022. +Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumont, Clement Delangue, Anthony Moi, Pierrick Cistac, Tim Rault, Rémi Louf, Morgan Funtowicz, et al. Transformers: State-of-the-art natural language processing. In Proceedings of the 2020 conference on empirical methods in natural language processing: system demonstrations, pp. 38-45, 2020. +Feijie Wu, Zitao Li, Yaliang Li, Bolin Ding, and Jing Gao. Fedbiot: Llm local fine-tuning in federated learning without full model. arXiv preprint arXiv:2406.17706, 2024. +Jian Xu, Xinyi Tong, and Shao-Lun Huang. Personalized federated learning with feature alignment and classifier collaboration. In The Eleventh International Conference on Learning Representations, 2023. +Peiran Xu, Zeyu Wang, Jieru Mei, Liangqiong Qu, Alan Yuille, Cihang Xie, and Yuyin Zhou. Fedconv: Enhancing convolutional neural networks for handling data heterogeneity in federated learning. Transactions on Machine Learning Research, 2024. +Rui Yan, Liangqiong Qu, Qingyue Wei, Shih-Cheng Huang, Liyue Shen, Daniel L Rubin, Lei Xing, and Yuyin Zhou. Label-efficient self-supervised federated learning for tackling data heterogeneity in medical imaging. IEEE Transactions on Medical Imaging, 42(7):1932-1943, 2023. +Yiyuan Yang, Guodong Long, Tao Shen, Jing Jiang, and Michael Blumenstein. Dual-personalizing adapter for federated foundation models. arXiv preprint arXiv:2403.19211, 2024. +Liping Yi, Han Yu, Gang Wang, and Xiaoguang Liu. Fedlora: Model-heterogeneous personalized federated learning with lora tuning. arXiv preprint arXiv:2310.13283, 2023. +Hao Yu, Sen Yang, and Shenghuo Zhu. Parallel restarted sgd with faster convergence and less communication: Demystifying why model averaging works for deep learning. In Proceedings of the AAAI conference on artificial intelligence, volume 33, pp. 5693-5700, 2019. +Shuang Zeng, Pengxin Guo, Shuai Wang, Jianbo Wang, Yuyin Zhou, and Liangqiong Qu. Tackling data heterogeneity in federated learning via loss decomposition. arXiv preprint arXiv:2408.12300, 2024. +Chen Zhang, Yu Xie, Hang Bai, Bin Yu, Weihong Li, and Yuan Gao. A survey on federated learning. Knowledge-Based Systems, 216:106775, 2021. + +Junyuan Zhang, Shuang Zeng, Miao Zhang, Runxi Wang, Feifei Wang, Yuyin Zhou, Paul Pu Liang, and Liangqiong Qu. Flhetbench: Benchmarking device and state heterogeneity in federated learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 12098-12108, 2024a. +Longteng Zhang, Lin Zhang, Shaohuai Shi, Xiaowen Chu, and Bo Li. Lora-fa: Memory-efficient low-rank adaptation for large language models fine-tuning. arXiv preprint arXiv:2308.03303, 2023. +Zixin Zhang, Fan Qi, and Changsheng Xu. Enhancing storage and computational efficiency in federated multimodal learning for large-scale models. In *Forty-first International Conference on Machine Learning*, 2024b. +Yue Zhao, Meng Li, Liangzhen Lai, Naveen Suda, Damon Civin, and Vikas Chandra. Federated learning with non-iid data. arXiv preprint arXiv:1806.00582, 2018. +Hangyu Zhu, Jinjin Xu, Shiqing Liu, and Yaochu Jin. Federated learning on non-iid data: A survey. Neurocomputing, 465:371-390, 2021. +Jiacheng Zhu, Kristjan Greenewald, Kimia Nadjahi, Haitz Sáez de Ocariz Borde, Rickard Brüel Gabrielsson, Leshem Choshen, Marzyeh Ghassemi, Mikhail Yurochkin, and Justin Solomon. Asymmetry in low-rank adapters of foundation models. In *Forty-first International Conference on Machine Learning*, 2024. + +# A APPENDIX + +# A.1 PROOF OF LEMMA 1 + +Proof. Consider fine-tuning $B$ while freezing $A = Q$ . The loss function in Eq. (3) becomes: + +$$ +\mathcal {L} = \mathbb {E} _ {\left(x _ {t}, y _ {t}\right)} \left[ \| y _ {t} - \left(W _ {0} + B Q\right) x _ {t} \| _ {2} ^ {2} \right]. \tag {7} +$$ + +Then, the gradient of Eq. (7) w.r.t. $B$ is: + +$$ +\begin{array}{l} \frac {\partial \mathcal {L}}{\partial B} = \frac {\partial \mathbb {E} _ {(x _ {t} , y _ {t})} [ \| y _ {t} - (W _ {0} + B Q) x _ {t} \| _ {2} ^ {2} ]}{\partial B} \\ = \frac {\partial \mathbb {E} [ \| W _ {t} x _ {t} - (W _ {0} + B Q) x _ {t} \| _ {2} ^ {2} ]}{\partial B} \\ = \frac {\partial \mathbb {E} [ \| \left(W _ {0} + \Delta_ {W}\right) x _ {t} - \left(W _ {0} + B Q\right) x _ {t} \| _ {2} ^ {2} ]}{\partial B} \tag {8} \\ = \frac {\partial \mathbb {E} [ \| (\Delta_ {W} - B Q) x _ {t} \| _ {2} ^ {2} ]}{\partial B} \\ = \mathbb {E} [ 2 [ (\Delta_ {W} - B Q) x _ {t} ] (- x _ {t} ^ {T} Q ^ {T}) ] \\ = \mathbb {E} [ 2 (B Q - \Delta_ {W}) x _ {t} x _ {t} ^ {T} Q ^ {T} ]. \\ \end{array} +$$ + +To obtain the optimal $B^{*}$ , we set Eq. (8) to zero, which means: + +$$ +\begin{array}{l} \mathbb {E} \left[ 2 \left(B Q - \Delta_ {W}\right) x _ {t} x _ {t} ^ {T} Q ^ {T} \right] = 0 \\ 2 B Q \mathbb {E} [ x _ {t} x _ {t} ^ {T} ] Q ^ {T} - 2 \Delta_ {W} \mathbb {E} [ x _ {t} x _ {t} ^ {T} ] Q ^ {T} = 0 \\ 2 B Q \mathbb {E} \left[ x _ {t} x _ {t} ^ {T} \right] Q ^ {T} - 2 \Delta_ {W} \mathbb {E} \left[ x _ {t} x _ {t} ^ {T} \right] Q ^ {T} = 0 \tag {9} \\ B Q \mathbb {E} [ x _ {t} x _ {t} ^ {T} ] Q ^ {T} = \Delta_ {W} \mathbb {E} [ x _ {t} x _ {t} ^ {T} ] Q ^ {T} \\ B = \Delta_ {W} \mathbb {E} [ x _ {t} x _ {t} ^ {T} ] Q ^ {T} (Q \mathbb {E} [ x _ {t} x _ {t} ^ {T} ] Q ^ {T}) ^ {- 1}. \\ \end{array} +$$ + +Therefore, we obtain $B^{*} = \Delta_{W}\mathbb{E}[x_{t}x_{t}^{T}]Q^{T}(Q\mathbb{E}[x_{t}x_{t}^{T}]Q^{T})^{-1}$ + +When fine-tuning $A$ with fixed $B = U$ . The loss function in Eq. (3) becomes: + +$$ +\mathcal {L} = \mathbb {E} _ {\left(x _ {t}, y _ {t}\right)} \left[ \left\| y _ {t} - \left(W _ {0} + U A\right) x _ {t} \right\| _ {2} ^ {2} \right]. \tag {10} +$$ + +Then, the gradients of Eq. (7) w.r.t. $A$ is: + +$$ +\begin{array}{l} \frac {\partial \mathcal {L}}{\partial A} = \frac {\partial \mathbb {E} _ {\left(x _ {t} , y _ {t}\right)} \left[ \| y _ {t} - \left(W _ {0} + U A\right) x _ {t} \| _ {2} ^ {2} \right]}{\partial A} \\ = \frac {\partial \mathbb {E} [ \| W _ {t} x _ {t} - (W _ {0} + U A) x _ {t} \| _ {2} ^ {2} ]}{\partial A} \\ = \frac {\partial \mathbb {E} [ \| \left(W _ {0} + \Delta_ {W}\right) x _ {t} - \left(W _ {0} + B Q\right) x _ {t} \| _ {2} ^ {2} ]}{\partial A} \tag {11} \\ = \frac {\partial \mathbb {E} [ \| (\Delta_ {W} - U A) x _ {t} \| _ {2} ^ {2} ]}{\partial A} \\ = \mathbb {E} \left[ 2 U ^ {T} \left[ \left(\Delta_ {W} - U A\right) x _ {t} \right] x _ {t} ^ {T} \right] \\ \end{array} +$$ + +To obtain the optimal $A^{*}$ , we set Eq. (11) to zero, which means: + +$$ +\mathbb {E} \left[ 2 U ^ {T} \left[ \left(\Delta_ {W} - U A\right) x _ {t} \right] x _ {t} ^ {T} \right] = 0 +$$ + +$$ +2 U ^ {T} \Delta_ {W} \mathbb {E} \left[ x _ {t} x _ {t} ^ {T} \right] - 2 U ^ {T} U A \mathbb {E} \left[ x _ {t} x _ {t} ^ {T} \right] = 0 \tag {12} +$$ + +$$ +U ^ {T} U A \mathbb {E} \left[ x _ {t} x _ {t} ^ {T} \right] = U ^ {T} \Delta_ {W} \mathbb {E} \left[ x _ {t} x _ {t} ^ {T} \right] \tag {12} +$$ + +$$ +A = U ^ {- 1} \Delta_ {W}. +$$ + +Thus, we obtain $A^{*} = U^{-1}\Delta_{W}$ + +# A.2 PROOF OF THEOREM 1 + +Proof. Let $W_{i}^{(t)} = W_{0} + B_{i}^{(t)}A_{i}^{(t)}$ be the model parameters maintained in the $i$ -th client at the $t$ -th step. Let $\mathcal{I}_E$ be the set of global synchronization steps, i.e., $\mathcal{I}_E = \{nE \mid n = 1,2,\dots\}$ . If $t + 1 \in \mathcal{I}_E$ , which represents the time step for communication, then the one-step update of the proposed method for the $i$ -th client can be described as follows: + +$$ +\left( \begin{array}{c} B _ {i} ^ {(t)} \\ A _ {i} ^ {(t)} \end{array} \right) \underset {\text {u p d a t e o f} B _ {i} ^ {(t)} \text {a n d} A _ {i} ^ {(t)}} {\longrightarrow} \left( \begin{array}{c} B _ {i} ^ {(t + 1)} \\ A _ {i} ^ {(t + 1)} \end{array} \right) \underset {\text {i f} t + 1 \in \mathcal {I} _ {E}} {\longrightarrow} \left( \begin{array}{c} B _ {i} ^ {(t + 1)} \\ \frac {1}{m} \sum_ {j = 1} ^ {m} A _ {j} ^ {(t + 1)} \end{array} \right). +$$ + +For convenience, we denote the parameters in each sub-step above as follows: + +$$ +W _ {i} ^ {(t)} = W _ {0} + B _ {i} ^ {(t)} A _ {i} ^ {(t)}, +$$ + +$$ +U _ {i} ^ {(t)} = W _ {0} + B _ {i} ^ {(t + 1)} A _ {i} ^ {(t + 1)}, +$$ + +$$ +V _ {i} ^ {(t)} = W _ {0} + B _ {i} ^ {(t + 1)} \frac {1}{m} \sum_ {j = 1} ^ {m} A _ {j} ^ {(t + 1)}, +$$ + +$$ +W _ {i} ^ {(t + 1)} = \left\{ \begin{array}{l l} U _ {i} ^ {(t)} & \text {i f} t + 1 \notin \mathcal {I} _ {E}, \\ V _ {i} ^ {(t)} & \text {i f} t + 1 \in \mathcal {I} _ {E}. \end{array} \right. +$$ + +Here, the variable $U_{i}^{(t)}$ represents the immediate result of one sub-step update from the parameter of the previous sub-step $W_{i}^{(t)}$ , and $V_{i}^{(t)}$ represents the parameter obtained after communication steps (if applicable). Furthermore, we denote the learning rate for the $i$ -th client at the $t$ -th step as $\eta_{i,t}$ and the stochastic gradient at step $t$ as follows: + +$$ +\nabla_ {B} \mathcal {L} _ {i} \left(W _ {i} ^ {(t)}, \xi_ {i, t}\right) = \nabla_ {W} \mathcal {L} _ {i} \left(W _ {i} ^ {(t)}, \xi_ {i, t}\right) A _ {i} ^ {(t)} ^ {\top}, +$$ + +$$ +\nabla_ {A} \mathcal {L} _ {i} \left(W _ {i} ^ {(t)}, \xi_ {i, t}\right) = B _ {i} ^ {(t) ^ {\top}} \nabla_ {W} \mathcal {L} _ {i} \left(W _ {i} ^ {(t)}, \xi_ {i, t}\right), +$$ + +$$ +\nabla_ {B} \mathcal {L} _ {i} \left(W _ {i} ^ {(t)}\right) = \mathbb {E} \left[ \nabla_ {B} \mathcal {L} _ {i} \left(W _ {i} ^ {(t)}, \xi_ {i, t}\right) \right], +$$ + +$$ +\nabla_ {A} \mathcal {L} _ {i} \left(W _ {i} ^ {(t)}\right) = \mathbb {E} \left[ \nabla_ {A} \mathcal {L} _ {i} \left(W _ {i} ^ {(t)}, \xi_ {i, t}\right) \right], +$$ + +where $\xi_{i,t}$ is the data uniformly chosen from the local data set of client $i$ at step $t$ . + +Next, we apply the inequality from the smoothness Assumption 1 to each sub-step of the one-step update for client $i$ . Firstly, by the smoothness of $\mathcal{L}_i$ , we have: + +$$ +\mathcal {L} _ {i} \left(U _ {i} ^ {(t)}\right) \leq \mathcal {L} _ {i} \left(W _ {i} ^ {(t)}\right) + \left\langle U _ {i} ^ {(t)} - W _ {i} ^ {(t)}, \nabla_ {W} \mathcal {L} _ {i} \left(W _ {i} ^ {(t)}\right) \right\rangle_ {F} + \frac {L}{2} \left\| U _ {i} ^ {(t)} - W _ {i} ^ {(t)} \right\| _ {F} ^ {2}. \tag {13} +$$ + +Since + +$$ +\begin{array}{l} B _ {i} ^ {(t + 1)} = B _ {i} ^ {(t)} - \eta_ {i, t} \nabla_ {B} \mathcal {L} _ {i} \left(W _ {i} ^ {(t)}, \xi_ {i, t}\right) \\ = B _ {i} ^ {(t)} - \eta_ {i, t} \nabla_ {W} \mathcal {L} _ {i} \left(W _ {i} ^ {(t)}, \xi_ {i, t}\right) A _ {i} ^ {(t) ^ {\top}}, \\ \end{array} +$$ + +and + +$$ +\begin{array}{l} A _ {i} ^ {(t + 1)} = A _ {i} ^ {(t)} - \eta_ {i, t} \nabla_ {A} \mathcal {L} _ {i} (W _ {i} ^ {(t)}, \xi_ {i, t}) \\ = A _ {i} ^ {(t)} - \eta_ {i, t} B _ {i} ^ {(t) ^ {\top}} \nabla_ {W} \mathcal {L} _ {i} \left(W _ {i} ^ {(t)}, \xi_ {i, t}\right), \\ \end{array} +$$ + +we have: + +$$ +\begin{array}{l} U _ {i} ^ {(t)} - W _ {i} ^ {(t)} \\ = B _ {i} ^ {(t + 1)} A _ {i} ^ {(t + 1)} - B _ {i} ^ {(t)} A _ {i} ^ {(t)} \\ = \left(B _ {i} ^ {(t)} - \eta_ {i, t} \nabla_ {W} \mathcal {L} _ {i} \left(W _ {i} ^ {(t)}, \xi_ {i, t}\right) A _ {i} ^ {(t) ^ {\top}}\right) \left(A _ {i} ^ {(t)} - \eta_ {i, t} B _ {i} ^ {(t) ^ {\top}} \nabla_ {W} \mathcal {L} _ {i} \left(W _ {i} ^ {(t)}, \xi_ {i, t}\right)\right) - B _ {i} ^ {(t)} A _ {i} ^ {(t)} \\ = \eta_ {i, t} ^ {2} \nabla_ {W} \mathcal {L} _ {i} (W _ {i} ^ {(t)}, \xi_ {i, t}) A _ {i} ^ {(t)} ^ {\top} B _ {i} ^ {(t)} ^ {\top} \nabla_ {W} \mathcal {L} _ {i} (W _ {i} ^ {(t)}, \xi_ {i, t}) - \eta_ {i, t} \nabla_ {W} \mathcal {L} _ {i} (W _ {i} ^ {(t)}, \xi_ {i, t}) A _ {i} ^ {(t)} ^ {\top} A _ {i} ^ {(t)} \\ - \eta_ {i, t} B _ {i} ^ {(t)} B _ {i} ^ {(t) \top} \nabla_ {W} \mathcal {L} _ {i} (W _ {i} ^ {(t)}, \xi_ {i, t}). \\ \end{array} +$$ + +Then, for the second term on the right side of Eq. (13), according to the law of total expectation, we have: + +$$ +\begin{array}{l} \mathbb {E} \left[ \left\langle U _ {i} ^ {(t)} - W _ {i} ^ {(t)}, \nabla_ {W} \mathcal {L} _ {i} (W _ {i} ^ {(t)}) \right\rangle_ {F} \right] \\ = \eta_ {i, t} ^ {2} \mathbb {E} \left[ \left\langle \nabla_ {W} \mathcal {L} _ {i} (W _ {i} ^ {(t)}, \xi_ {i, t}) A _ {i} ^ {(t) ^ {\top}} B _ {i} ^ {(t) ^ {\top}} \nabla_ {W} \mathcal {L} _ {i} (W _ {i} ^ {(t)}, \xi_ {i, t}), \nabla_ {W} \mathcal {L} _ {i} (W _ {i} ^ {(t)}) \right\rangle_ {F} \right] \\ - \eta_ {i, t} \mathbb {E} \left[ \left\langle \nabla_ {W} \mathcal {L} _ {i} (W _ {i} ^ {(t)}, \xi_ {i, t}) A _ {i} ^ {(t)} ^ {\top} A _ {i} ^ {(t)}, \nabla_ {W} \mathcal {L} _ {i} (W _ {i} ^ {(t)}) \right\rangle_ {F} \right] \\ - \eta_ {i, t} \mathbb {E} \left[ \left\langle B _ {i} ^ {(t)} B _ {i} ^ {(t) ^ {\top}} \nabla_ {W} \mathcal {L} _ {i} (W _ {i} ^ {(t)}, \xi_ {i, t}), \nabla_ {W} \mathcal {L} _ {i} (W _ {i} ^ {(t)}) \right\rangle_ {F} \right] \\ = \eta_ {i, t} ^ {2} \left\langle \nabla_ {W} \mathcal {L} _ {i} (W _ {i} ^ {(t)}) A _ {i} ^ {(t) ^ {\top}} B _ {i} ^ {(t) ^ {\top}} \nabla_ {W} \mathcal {L} _ {i} (W _ {i} ^ {(t)}), \nabla_ {W} \mathcal {L} _ {i} (W _ {i} ^ {(t)}) \right\rangle_ {F} \\ - \eta_ {i, t} \left\langle \nabla_ {W} \mathcal {L} _ {i} (W _ {i} ^ {(t)}) A _ {i} ^ {(t) ^ {\top}} A _ {i} ^ {(t)}, \nabla_ {W} \mathcal {L} _ {i} (W _ {i} ^ {(t)}) \right\rangle_ {F} \\ - \eta_ {i, t} \left\langle B _ {i} ^ {(t)} B _ {i} ^ {(t) ^ {\top}} \nabla_ {W} \mathcal {L} _ {i} (W _ {i} ^ {(t)}), \nabla_ {W} \mathcal {L} _ {i} (W _ {i} ^ {(t)}) \right\rangle_ {F}. \\ \end{array} +$$ + +Since + +$$ +\begin{array}{l} \left\langle \nabla_ {W} \mathcal {L} _ {i} (W _ {i} ^ {(t)}) A _ {i} ^ {(t) ^ {\top}} B _ {i} ^ {(t) ^ {\top}} \nabla_ {W} \mathcal {L} _ {i} (W _ {i} ^ {(t)}), \nabla_ {W} \mathcal {L} _ {i} (W _ {i} ^ {(t)}) \right\rangle_ {F} \\ \leq \left\| \nabla_ {W} \mathcal {L} _ {i} (W _ {i} ^ {(t)}) A _ {i} ^ {(t) ^ {\top}} B _ {i} ^ {(t) ^ {\top}} \nabla_ {W} \mathcal {L} _ {i} (W _ {i} ^ {(t)}) \right\| \left\| \nabla_ {W} \mathcal {L} _ {i} (W _ {i} ^ {(t)}) \right\| _ {F} \\ \leq \left\| A _ {i} ^ {(t)} \right\| \left\| B _ {i} ^ {(t)} \right\| _ {F} \left\| \nabla_ {W} \mathcal {L} _ {i} \left(W _ {i} ^ {(t)}\right) \right\| _ {F} ^ {3} \\ \leq C _ {A} C _ {B} G ^ {3}, \\ \end{array} +$$ + +and if we assume there exists $c_{A} > 0$ such that $\forall t$ : + +$$ +\left\langle A _ {i} ^ {(t) ^ {\top}} A _ {i} ^ {(t)}, \nabla_ {W} \mathcal {L} _ {i} (W _ {i} ^ {(t)}) ^ {\top} \nabla_ {W} \mathcal {L} _ {i} (W _ {i} ^ {(t)}) \right\rangle_ {F} \geq c _ {A} \left\| \nabla_ {W} \mathcal {L} _ {i} (W _ {i} ^ {(t)}) \right\| _ {F} ^ {2}, +$$ + +then we have: + +$$ +\begin{array}{l} \left\langle \nabla_ {W} \mathcal {L} _ {i} (W _ {i} ^ {(t)}) A _ {i} ^ {(t) ^ {\top}} A _ {i} ^ {(t)}, \nabla_ {W} \mathcal {L} _ {i} (W _ {i} ^ {(t)}) \right\rangle_ {F} = \mathrm {T r} \Big [ (\nabla_ {W} \mathcal {L} _ {i} (W _ {i} ^ {(t)}) A _ {i} ^ {(t) ^ {\top}} A _ {i} ^ {(t)}) ^ {\top} \nabla_ {W} \mathcal {L} _ {i} (W _ {i} ^ {(t)}) \Big ] \\ = \operatorname {T r} \left[ A _ {i} ^ {(t)} ^ {\top} A _ {i} ^ {(t)} \nabla_ {W} \mathcal {L} _ {i} (W _ {i} ^ {(t)}) ^ {\top} \nabla_ {W} \mathcal {L} _ {i} (W _ {i} ^ {(t)}) \right] \\ = \left\langle A _ {i} ^ {(t) ^ {\top}} A _ {i} ^ {(t)}, \nabla_ {W} \mathcal {L} _ {i} \left(W _ {i} ^ {(t)}\right) ^ {\top} \nabla_ {W} \mathcal {L} _ {i} \left(W _ {i} ^ {(t)}\right) \right\rangle_ {F} \\ \geq c _ {A} \left\| \nabla_ {W} \mathcal {L} _ {i} \left(W _ {i} ^ {(t)}\right) \right\| _ {F} ^ {2}. \\ \end{array} +$$ + +And similarly if we assume there exists $c_{B} > 0$ such that $\forall t$ : + +$$ +\left\langle B _ {i} ^ {(t)} ^ {\top} B _ {i} ^ {(t)}, \nabla_ {W} \mathcal {L} _ {i} (W _ {i} ^ {(t)}) ^ {\top} \nabla_ {W} \mathcal {L} _ {i} (W _ {i} ^ {(t)}) \right\rangle_ {F} \geq c _ {B} \left\| \nabla_ {W} \mathcal {L} _ {i} (W _ {i} ^ {(t)}) \right\| _ {F} ^ {2}, +$$ + +then we have: + +$$ +\begin{array}{l} \left\langle B _ {i} ^ {(t)} B _ {i} ^ {(t) \top} \nabla_ {W} \mathcal {L} _ {i} (W _ {i} ^ {(t)}), \nabla_ {W} \mathcal {L} _ {i} (W _ {i} ^ {(t)}) \right\rangle_ {F} = \mathrm {T r} \Big [ \big (B _ {i} ^ {(t)} B _ {i} ^ {(t) \top} \nabla_ {W} \mathcal {L} _ {i} (W _ {i} ^ {(t)}) \big) ^ {\top} \nabla_ {W} \mathcal {L} _ {i} (W _ {i} ^ {(t)}) \Big ] \\ = \operatorname {T r} \left[ \nabla_ {W} \mathcal {L} _ {i} \left(W _ {i} ^ {(t)}\right) ^ {\top} B _ {i} ^ {(t)} B _ {i} ^ {(t)} ^ {\top} \nabla_ {W} \mathcal {L} _ {i} \left(W _ {i} ^ {(t)}\right) \right] \\ = \operatorname {T r} \left[ \nabla_ {W} \mathcal {L} _ {i} \left(W _ {i} ^ {(t)}\right) \nabla_ {W} \mathcal {L} _ {i} \left(W _ {i} ^ {(t)}\right) ^ {\top} B _ {i} ^ {(t)} B _ {i} ^ {(t) ^ {\top}} \right] \\ = \left\langle \nabla_ {W} \mathcal {L} _ {i} \left(W _ {i} ^ {(t)}\right) \nabla_ {W} \mathcal {L} _ {i} \left(W _ {i} ^ {(t)}\right) ^ {\top}, B _ {i} ^ {(t)} B _ {i} ^ {(t) ^ {\top}} \right\rangle_ {F} \\ \geq c _ {B} \left\| \nabla_ {W} \mathcal {L} _ {i} \left(W _ {i} ^ {(t)}\right) \right\| _ {F} ^ {2}, \tag {14} \\ \end{array} +$$ + +where we use the cyclic property of the trace for the third equality above. We further get: + +$$ +\begin{array}{l} \mathbb {E} \left[ \left< U _ {i} ^ {(t)} - W _ {i} ^ {(t)}, \nabla_ {W} \mathcal {L} _ {i} (W _ {i} ^ {(t)}) \right> _ {F} \right] \\ \leq \eta_ {i, t} ^ {2} C _ {A} C _ {B} G ^ {3} - \eta_ {i, t} c _ {A} ^ {2} \left\| \nabla_ {W} \mathcal {L} _ {i} \left(W _ {i} ^ {(t)}\right) \right\| _ {F} ^ {2} - \eta_ {i, t} c _ {B} ^ {2} \left\| \nabla_ {W} \mathcal {L} _ {i} \left(W _ {i} ^ {(t)}\right) \right\| _ {F} ^ {2}. \tag {15} \\ \end{array} +$$ + +Similarly, we know: + +$$ +\begin{array}{l} \mathbb {E} [ \| U _ {i} ^ {(t)} - W _ {i} ^ {(t)} \| _ {F} ^ {2} ] = \mathbb {E} [ \| \eta_ {i, t} ^ {2} \nabla_ {W} \mathcal {L} _ {i} (W _ {i} ^ {(t)}, \xi_ {i, t}) A _ {i} ^ {(t)} ^ {\top} B _ {i} ^ {(t)} ^ {\top} \nabla_ {W} \mathcal {L} _ {i} (W _ {i} ^ {(t)}, \xi_ {i, t}) \\ - \eta_ {i, t} \nabla_ {W} \mathcal {L} _ {i} \left(W _ {i} ^ {(t)}, \xi_ {i, t}\right) A _ {i} ^ {(t)} ^ {\top} A _ {i} ^ {(t)} - \eta_ {i, t} B _ {i} ^ {(t)} B _ {i} ^ {(t)} ^ {\top} \nabla_ {W} \mathcal {L} _ {i} \left(W _ {i} ^ {(t)}, \xi_ {i, t}\right) \| _ {F} ^ {2} ] \\ \leq 3 \eta_ {i, t} ^ {4} C _ {A} ^ {2} C _ {B} ^ {2} G ^ {4} + 3 \eta_ {i, t} ^ {2} C _ {A} ^ {2} G ^ {2} + 3 \eta_ {i, t} ^ {2} C _ {B} ^ {2} G ^ {2}. \tag {16} \\ \end{array} +$$ + +Plugging Eq. (14), Eq. (15), and Eq. (16) into Eq. (13), we have: + +$$ +\begin{array}{l} \mathcal {L} _ {i} \left(U _ {i} ^ {(t)}\right) \leq \mathcal {L} _ {i} \left(W _ {i} ^ {(t)}\right) + \eta_ {i, t} ^ {2} C _ {A} C _ {B} G ^ {3} - \eta_ {i, t} c _ {A} \left\| \nabla_ {W} \mathcal {L} _ {i} \left(W _ {i} ^ {(t)}\right) \right\| _ {F} ^ {2} - \eta_ {i, t} c _ {B} \left\| \nabla_ {W} \mathcal {L} _ {i} \left(W _ {i} ^ {(t)}\right) \right\| _ {F} ^ {2} \\ + \frac {3}{2} \eta_ {i, t} ^ {4} C _ {A} ^ {2} C _ {B} ^ {2} G ^ {4} L + \frac {3}{2} \eta_ {i, t} ^ {2} C _ {A} ^ {2} G ^ {2} L + \frac {3}{2} \eta_ {i, t} ^ {2} C _ {B} ^ {2} G ^ {2} L. \tag {17} \\ \end{array} +$$ + +Secondly, by the smoothness of $\mathcal{L}_i$ , we have: + +$$ +\mathcal {L} _ {i} \left(V _ {i} ^ {(t)}\right) \leq \mathcal {L} _ {i} \left(\left(U _ {i} ^ {(t)}\right) + \left\langle V _ {i} ^ {(t)} - U _ {i} ^ {(t)}, \nabla_ {W} \mathcal {L} _ {i} \left(U _ {i} ^ {(t)}\right) \right\rangle_ {F} + \frac {L}{2} \| V _ {i} ^ {(t)} - U _ {i} ^ {(t)} \| _ {F} ^ {2}. \right. \tag {18} +$$ + +Since + +$$ +\begin{array}{l} V _ {i} ^ {(t)} - U _ {i} ^ {(t)} = B _ {i} ^ {(t + 1)} A _ {i} ^ {(t + 1)} - \frac {1}{m} B _ {i} ^ {(t + 1)} \sum_ {j = 1} ^ {m} A _ {j} ^ {(t + 1)} \\ = B _ {i} ^ {(t + 1)} \frac {1}{m} \sum_ {j = 1} ^ {m} \left(A _ {i} ^ {(t + 1)} - A _ {j} ^ {(t + 1)}\right), \\ \end{array} +$$ + +and + +$$ +\begin{array}{l} A _ {j} ^ {(t + 1)} = A _ {j} ^ {(t - E + 1)} - \sum_ {t _ {0} = t - E + 1} ^ {t} \eta_ {j, t _ {0}} \nabla_ {A} \mathcal {L} _ {j} \left(W _ {j} ^ {(t _ {0})}; \xi_ {j, t _ {0}}\right) \\ = A _ {j} ^ {(t - E + 1)} - \sum_ {t _ {0} = t - E + 1} ^ {t} \eta_ {j, t _ {0}} B _ {j} ^ {(t _ {0})} ^ {\top} \nabla_ {W} \mathcal {L} _ {j} (W _ {j} ^ {(t _ {0})}; \xi_ {j, t _ {0}}), \\ \end{array} +$$ + +we know: + +$$ +V _ {i} ^ {(t)} - U _ {i} ^ {(t)} = B _ {i} ^ {(t + 1)} \Big (- \frac {1}{m} \sum_ {j = 1} ^ {m} \sum_ {t _ {0} = t - E + 1} ^ {t} \eta_ {j, t _ {0}} B _ {j} ^ {(t _ {0})} ^ {\top} \big (\nabla \mathcal {L} _ {i} (W _ {i} ^ {(t _ {0})}; \xi_ {i, t _ {0}}) - \nabla \mathcal {L} _ {j} (W _ {j} ^ {(t _ {0})}; \xi_ {j, t _ {0}}) \big) \Big). +$$ + +Therefore, + +$$ +\begin{array}{l} \mathbb {E} \left[ \left\| V _ {i} ^ {(t)} - U _ {i} ^ {(t)} \right\| _ {F} ^ {2} \right] \\ = \mathbb {E} \left[ \left\| B _ {i} ^ {(t + 1)} \right\| _ {F} ^ {2} \right\| - \frac {1}{m} \sum_ {j = 1} ^ {m} \sum_ {t _ {0} = t - E + 1} ^ {t} \eta_ {j, t _ {0}} B _ {j} ^ {(t _ {0})} ^ {\top} \left(\nabla \mathcal {L} _ {i} \left(W _ {i} ^ {(t _ {0})}; \xi_ {i, t _ {0}}\right) - \nabla \mathcal {L} _ {j} \left(W _ {j} ^ {(t _ {0})}; \xi_ {j, t _ {0}}\right)\right) \| _ {F} ^ {2} \Bigg ] \\ \leq C _ {B} ^ {2} \frac {E}{m} \sum_ {j = 1} ^ {m} \sum_ {t _ {0} = t - E + 1} ^ {t} \eta_ {j, t _ {0}} ^ {2} \mathbb {E} \left[ \left\| B _ {j} ^ {(t _ {0})} ^ {\top} \big (\nabla \mathcal {L} _ {i} (W _ {i} ^ {(t _ {0})}; \xi_ {i, t _ {0}}) - \nabla \mathcal {L} _ {j} (W _ {j} ^ {(t _ {0})}; \xi_ {j, t _ {0}}) \big) \right\| _ {F} ^ {2} \right] \\ \leq \frac {C _ {B} ^ {4} E}{m} \sum_ {j = 1} ^ {m} \sum_ {t _ {0} = t - E + 1} ^ {t} \eta_ {j, t _ {0}} ^ {2} \mathbb {E} \left[ \left\| \nabla \mathcal {L} _ {i} (W _ {i} ^ {(t _ {0})}; \xi_ {i, t _ {0}}) - \nabla \mathcal {L} _ {j} (W _ {j} ^ {(t _ {0})}; \xi_ {j, t _ {0}}) \right\| _ {F} ^ {2} \right] \\ \leq \frac {4 C _ {B} ^ {4} E G ^ {2}}{m} \sum_ {j = 1} ^ {m} \sum_ {t _ {0} = t - E + 1} ^ {t} \eta_ {j, t _ {0}} ^ {2}, \tag {19} \\ \end{array} +$$ + +where we use Assumption 2 to derive that: + +$$ +\begin{array}{l} \mathbb {E} \left[ \left\| \nabla \mathcal {L} _ {i} \left(W _ {i} ^ {(t _ {0})}; \xi_ {i, t _ {0}}\right) - \nabla \mathcal {L} _ {j} \left(W _ {j} ^ {(t _ {0})}; \xi_ {j, t _ {0}}\right) \right\| _ {F} ^ {2} \right] \\ \leq 2 \mathbb {E} \left[ \left\| \nabla \mathcal {L} _ {i} \left(W _ {i} ^ {\left(t _ {0}\right)}; \xi_ {i, t _ {0}}\right) \right\| _ {F} ^ {2} \right] + 2 \mathbb {E} \left[ \left\| \nabla \mathcal {L} _ {i} \left(W _ {j} ^ {\left(t _ {0}\right)}; \xi_ {j, t _ {0}}\right) \right\| _ {F} ^ {2} \right] \\ \leq 4 G ^ {2}. \\ \end{array} +$$ + +Furthermore, + +$$ +\begin{array}{l} \left\langle V _ {i} ^ {(t)} - U _ {i} ^ {(t)}, \nabla_ {W} L _ {i} (U _ {i} ^ {(t)}) \right\rangle \leq \frac {1}{2 \eta_ {i , t}} \left\| V _ {i} ^ {(t)} - U _ {i} ^ {(t)} \right\| _ {F} ^ {2} + \frac {1}{2} \eta_ {i, t} \left\| \nabla_ {W} \mathcal {L} _ {i} (U _ {i} ^ {(t)}) \right\| _ {F} ^ {2} \\ \leq \frac {2 C _ {B} ^ {4} E G ^ {2}}{\eta_ {i , t} m} \sum_ {j = 1} ^ {m} \sum_ {t _ {0} = t - E + 1} ^ {t} \eta_ {j, t _ {0}} ^ {2} + \frac {1}{2} \eta_ {i, t} G ^ {2}. \tag {20} \\ \end{array} +$$ + +Plugging Eq. (19) and Eq. (20) into Eq. (18), we have (choose constant learning rate $\eta_{i,t} = \eta$ ): + +$$ +\mathcal {L} _ {i} \left(V _ {i} ^ {(t)}\right) \leq \mathcal {L} _ {i} \left(U _ {i} ^ {(t)}\right) + \left(2 C _ {B} ^ {2} E ^ {2} G ^ {2} + \frac {1}{2} G ^ {2}\right) \eta + 2 \eta^ {2} C _ {B} ^ {4} E ^ {2} G ^ {2} L. \tag {21} +$$ + +Combining Eq. (17) and Eq. (21), we have (choose constant learning rate $\eta_{i,t} = \eta$ ): + +$$ +\begin{array}{l} \mathcal {L} _ {i} \left(W _ {i} ^ {(t + 1)}\right) \leq \mathcal {L} _ {i} \left((W _ {i} ^ {(t)}) + (2 C _ {B} ^ {2} E ^ {2} G ^ {2} + \frac {1}{2} G ^ {2}) \eta + \frac {3}{2} \eta^ {4} C _ {A} ^ {2} C _ {B} ^ {2} G ^ {4} L ^ {2}\right) \\ + \left(C _ {A} C _ {B} G ^ {2} + \frac {3}{2} C _ {A} ^ {2} L G ^ {2} + \frac {3}{2} C _ {B} ^ {2} L G ^ {2} + 2 C _ {B} ^ {4} E ^ {2} L G ^ {2}\right) \eta^ {2} \\ - \eta (c _ {A} + c _ {B}) \left\| \nabla_ {W} \mathcal {L} _ {i} (W _ {i} ^ {(t)}) \right\| ^ {2}, \\ \end{array} +$$ + +which is equivalent to: + +$$ +\begin{array}{l} \eta \left(c _ {A} + c _ {B}\right) \left\| \nabla_ {W} \mathcal {L} _ {i} \left(W _ {i} ^ {(t)}\right) \right\| _ {F} ^ {2} \leq \mathcal {L} _ {i} \left(\left(W _ {i} ^ {(t)}\right) - \mathcal {L} _ {i} \left(W _ {i} ^ {(t + 1)}\right) \right. \\ + \left(2 C _ {B} ^ {2} E ^ {2} G ^ {2} + \frac {1}{2} G ^ {2}\right) \eta + \frac {3}{2} \eta^ {4} C _ {A} ^ {2} C _ {B} ^ {2} G ^ {4} L \\ + (C _ {A} C _ {B} G ^ {2} + \frac {3}{2} C _ {A} ^ {2} L G ^ {2} + \frac {3}{2} C _ {B} ^ {2} L G ^ {2} + 2 C _ {B} ^ {4} E ^ {2} L G ^ {2}) \eta^ {2}. \\ \end{array} +$$ + +Choosing $M$ which satisfies $(2C_B^2 E^2 G^2 +\frac{1}{2} G^2)\eta +\frac{3}{2}\eta^4 C_A^2 C_B^2 G^4 L + (C_A C_B G^2 +\frac{3}{2} C_A^2 LG^2 +$ $\frac{3}{2} C_B^2 LG^2 +2C_B^4 E^2 LG^2)\eta^2\leq M\eta^2$ , we get: + +$$ +\left\| \nabla_ {W} \mathcal {L} _ {i} \left(W _ {i} ^ {(t)}\right) \right\| _ {F} ^ {2} \leq \frac {\mathcal {L} _ {i} \left(\left(W _ {i} ^ {(t)}\right) - \mathcal {L} _ {i} \left(W _ {i} ^ {(t + 1)}\right)\right)}{\eta \left(c _ {A} + c _ {B}\right)} + \frac {M \eta}{c _ {A} + c _ {B}}. \tag {22} +$$ + +Now, by repeatedly applying Eq. (22) for different values of $t$ and summing up the results, we get: + +$$ +\sum_ {t = 1} ^ {T} \left\| \nabla_ {W} \mathcal {L} _ {i} \left(W _ {i} ^ {(t)}\right) \right\| _ {F} ^ {2} \leq \frac {\mathcal {L} _ {i} \left(\left(W _ {i} ^ {(1)}\right) - \mathcal {L} _ {i} \left(W _ {i} ^ {*}\right)\right)}{\eta \left(c _ {A} ^ {2} + c _ {B} ^ {2}\right)} + \eta \frac {M}{c _ {A} + c _ {B}} T. \tag {23} +$$ + +Dividing both side of Eq. (23) by $T$ , we get: + +$$ +\frac {1}{T} \sum_ {t = 1} ^ {T} \left\| \nabla_ {W} \mathcal {L} _ {i} \left(W _ {i} ^ {(t)}\right) \right\| _ {F} ^ {2} \leq \frac {\mathcal {L} _ {i} \left(\left(W _ {i} ^ {(1)}\right) - \mathcal {L} _ {i} \left(W _ {i} ^ {*}\right)\right)}{\eta \left(c _ {A} + c _ {B}\right) T} + \eta \frac {M}{c _ {A} + c _ {B}}. \tag {24} +$$ + +Let us assume that $\mathcal{L}_i(W_i^{(1)}) - \mathcal{L}_i(W_i^*)\leq D,\forall i$ , and we set $\eta = \sqrt{\frac{D}{MT}}$ . Then, we have: + +$$ +\frac {1}{T} \sum_ {t = 1} ^ {T} \left\| \nabla_ {W} \mathcal {L} _ {i} \left(W _ {i} ^ {(t)}\right) \right\| _ {F} ^ {2} \leq \frac {2}{c _ {A} + c _ {B}} \sqrt {\frac {D M}{T}}. \tag {25} +$$ + +Thus, we can obtain: + +$$ +\frac {1}{m T} \sum_ {i = 1} ^ {m} \sum_ {t = 1} ^ {T} \left\| \nabla_ {W} \mathcal {L} _ {i} \left(W _ {i} ^ {(t)}\right) \right\| _ {F} ^ {2} \leq \frac {2}{c _ {A} + c _ {B}} \sqrt {\frac {D M}{T}}. \tag {26} +$$ + +# A.3 FURTHER EXPLANATIONS ABOUT AGGREGATION ERRORS. + +In this section, we provide more explanation about what aggregation errors are and why people do not achieve the "ideal" model update. + +When introducing LoRA into FL, the update for the $i$ -the client is given by $\Delta_{W_i} = B_iA_i$ . The "ideal" model update for server aggregation should be: + +$$ +\Delta_ {W} ^ {*} = \frac {1}{m} \sum_ {i = 1} ^ {m} \Delta_ {W _ {i}} = \frac {1}{m} \sum_ {i = 1} ^ {m} B _ {i} A _ {i} = \frac {1}{m} \left(B _ {1} A _ {1} + B _ {2} A _ {2} + \dots + B _ {m} A _ {m}\right). \tag {27} +$$ + +However, in practical LoRA training, the matrices $A_{i}$ and $B_{i}$ , not the original $W_{i}$ , are trainable. Thus, we cannot directly average the $\Delta_{W_i}$ ; instead, we can only separately average $A_{i}$ and $B_{i}$ , and then combine them to obtain the update: + +$$ +\begin{array}{l} \Delta_ {W} = \left(\frac {1}{m} \sum_ {i = 1} ^ {m} B _ {i}\right) \left(\frac {1}{m} \sum_ {i = 1} ^ {m} A _ {i}\right) \\ = \frac {1}{m} \left(B _ {1} + B _ {2} + \dots + B _ {m}\right) \frac {1}{m} \left(A _ {1} + A _ {2} + \dots + A _ {m}\right) \tag {28} \\ = \frac {1}{m ^ {2}} \left(B _ {1} A _ {1} + B _ {1} A _ {2} + \dots + B _ {1} A _ {m} + B _ {2} A _ {1} \right. \\ + B _ {2} A _ {2} + \dots + B _ {2} A _ {m} + \dots + B _ {m} A _ {1} + B _ {m} A _ {2} + \dots + B _ {m} A _ {m}), \\ \end{array} +$$ + +which differs from the "ideal" model update in Eq. (27). This difference introduces aggregation errors. + +Regarding why the "ideal" model update is not achieved, it is because the matrices $A_{i}$ and $B_{i}$ are trainable, not the original $W_{i}$ . While it is possible to first combine $A_{i}$ and $B_{i}$ to obtain $\Delta_{W_i}$ and then average them to achieve the "ideal" update, we cannot decompose $W$ back into $A$ and $B$ for further federated training. This limitation prevents people from performing the "ideal" model update. + +# A.4 HYPERPARAMETERS + +Tables 6 and 7 show the learning rates used for LoRA-based methods and rsLoRA-based methods, respectively. For the VeRA-based methods, we first tried using the SGD optimizer (Ruder, 2016) with a search learning rate from $\eta \in \{5\mathrm{E} - 3,1\mathrm{E} - 2,2\mathrm{E} - 2,5\mathrm{E} - 2,1\mathrm{E} - 1\}$ as adopted in LoRA-based methods, but we found the performance to be significantly worse than that of LoRA-based methods. For example, the best performance among the three VeRA-based methods (i.e., VeRA, FFA-VeRA, and FedSA-VeRA) is $53.73\%$ on the MNLI-m task, which is significantly worse than that of the LoRA-based methods $(90.20\%)$ . Thus, we chose the AdamW optimizer (Loshchilov & Hutter, 2017) and introduced separate learning rates for the classification head and the adapted layers as used in VeRA (Kopiczko et al., 2024). The learning rates used for VeRA-based methods are shown in Table 8. + +Table 6: The learning rates used for LoRA-based methods on the GLUE benchmark. + +
MethodMNLI-mMNLI-mmSST2QNLIQQPRTE
LoRA1E-21E-22E-21E-21E-21E-2
FFA-LoRA5E-25E-25E-22E-25E-22E-2
FedDPA-LoRA1E-21E-21E-25E-25E-21E-2
FedSA-LoRA2E-22E-21E-25E-32E-21E-2
+ +# A.5 EXAMPLES OF GENERATED ANSWER FOR GSM8K DATASETS + +The results of the GSM8K dataset are shown in Table 9, demonstrating that the proposed FedSA-LoRA outperforms other methods in complex natural language generation tasks. From the given example, it can be seen that both LoRA and FFA-LoRA have reasoning errors, but FedSA-LoRA can reason accurately, demonstrating the superiority of the proposed method. + +Table 7: The learning rates used for rsLoRA-based methods on the GLUE benchmark. + +
MethodMNLI-mMNLI-mmSST2QNLIQQPRTE
rsLoRA5E-35E-31E-22E-35E-32E-3
FFA-rsLoRA2E-22E-22E-21E-22E-21E-2
FedDPA-reLoRA5E-35E-31E-21E-35E-31E-2
FedSA-rsLoRA5E-35E-35E-31E-32E-32E-3
+ +Table 8: The learning rates used for VeRA-based methods on the GLUE benchmark. + +
MethodPositionMNLI-mMNLI-mmSST2QNLIQQPRTE
VeRAVeRA1E-21E-22E-22E-32E-31E-2
Head6E-36E-32E-33E-43E-42E-4
FFA-VeRAVeRA2E-22E-21E-21E-21E-21E-2
Head2E-32E-36E-32E-46E-32E-4
FedDPA-VeRAVeRA1E-21E-21E-22E-32E-21E-2
Head6E-36E-36E-33E-42E-32E-4
FedSA-VeRAVeRA2E-32E-31E-21E-22E-31E-2
Head3E-53E-53E-43E-43E-41E-4
+ +Table 9: Performance of different methods on the GSM8K dataset and example answers generated by each method. + +
LoRAFFA-LoRAFedSA-LoRA
Accuracy46.2446.3246.63
Question:In a student council election, candidate A got 20% of the votes while candidate B got 50% more than candidate A's votes. The rest of the votes was given to candidate C. If there were 100 voters, how many votes did candidate C get?
Output:Candidate A got 20% of the votes. That is 20% of 100 = 20% × 100 = 20 × 100 = 2000 votes. Candidate B got 50% more than candidate A. That is 50% of 2000 = 50% × 2000 = 50 × 2000 = 10000 votes. The rest of the votes was given to candidate C. So there are 10000 + 2000 = 12000 votes in total. Candidate C got 10000 votes. The answer is 10000. [×]Candidate A got 20% of 100 = 100 × 20% = 100 × 20/100 = 20. Candidate B got 20% more than candidate A's votes, which is 20% + 20% = 40%. 40% of 100 = 100 × 40% = 100 × 40/100 = 40. So the two candidates together got 20 + 40 = 60. The rest of the votes were given to candidate C. So candidate C got 100 - 60 = 40. The answer is 40. [×]Candidate A got 20% of the votes or 20% * 100 = 20 votes. Then candidate B got 50% more than candidate A's 20 votes so 50% of 20 is 20 * 50% = 10. Then candidate B got 20 + 10 = 30 votes. So candidate C got 100 - 20 - 30 = 50 votes. The answer is 50. [✓]
+ +# A.6 LEARNED MATRICES COMPARISON + +# A.6.1 LEARNED AND INITIALIZED LORA MATRICES COMPARISON + +Since the learned LoRA $A$ matrices are similar across different clients in Figure 2, we separately plotted the relationships of $A$ from Figure 2 in Figure 3 to show the relationships in $A$ more clearly. This shows they are similar but not identical. Moreover, we further illustrate the difference between the learned and initialized $A$ matrices for each client under the IID partition in this section. The results, shown in Figure 4, confirm that the $A$ matrices are updated. + +![](images/35d501833c391944ba1b56efd5d97f45441d3cef7ee144603e4747c7f8c55b1d.jpg) +(a) IID + +![](images/0d7843391f92655c0b3d522a14ad463db048a2baa1677ac5248ef81dd1054ca7.jpg) +(b) moderate non-IID + +![](images/97f8a3b8e425a8dd85a9166a1774b6c6bd3b1580f1d66946a695600c933abec5.jpg) +(c) server non-IID + +![](images/a5cda8065de800701adc59ae6697a11600526ba191ac36d8248d0927a0e4d443.jpg) +(d) IID + +![](images/b5afc1e1695c92518bba3ad7ba0a1fe6d97e5222d4a3781afcb6d4dbd1c37c72.jpg) +(e) moderate non-IID + +![](images/5c37f56f2abba35bb7286014c91fb8d291b7b60c88f62ca3a515b824ced23009.jpg) +(f) server non-IID + +![](images/762a8f3d035b9eecfa068908ee1313234553617c6a09c231e69e80128c10fcda.jpg) +Figure 3: Mean of pairwise cosine similarity of the learned $A$ matrices across layers of a RoBERTa model locally fine-tuned with LoRA on the RTE task, with different levels of data heterogeneity. (a)-(c): value matrices; (d)-(f): query matrices. The learned $A$ matrices across client are similar but not identical. + +![](images/f8b5a3617156540a06b2b37c8092f77a2ea4fe24a763c2b6afefed06a23f0a9c.jpg) +(b) Client 2 & Init + +![](images/175e15fef862d72c6339b34c28934228140c765cf4197d04b02273c88c014b2f.jpg) +(c) Client 3 & Init + +![](images/e8b18774b45424561b4dcfdeb4f0c59c1594388ce2e5b13524c4cd0c40915ba4.jpg) +(a) Client 1 & Init +(d) Client 1 & Init +Figure 4: Cosine similarity of learned and initialized $A$ matrices across layers of different clients of a RoBERTa model locally fine-tuned with LoRA on the RTE task. (a)-(c): value matrices; (d)-(f): query matrices. The learned $A$ matrices are different from the initialized $A$ matrices, indicating that the $A$ matrices are updated. + +![](images/bfac4a01a66863c6581d73ae09eaec24fbada88c8fc3bc03d60f626b5639c000.jpg) +(e) Client 2 & Init + +![](images/0ab97e6cf111c7c56f8e8e3397855e443cc168d5c261630cfd7283d8e2653350.jpg) +(f) Client 3 & Init + +# A.6.2 LEARNED RSLORA MATRICES COMPARISON + +In this section, we present the mean of pairwise client relationships for the learned rsLoRA (Kala-jdzievski, 2023) matrices. These results, shown in Figure 5, demonstrate a similar phenomenon to the learned LoRA matrices. That is, the learned $A$ matrices are more similar across clients than the + +$B$ matrices, and with increased data heterogeneity, the similarity of $B$ matrices between different clients decreases. + +![](images/1ec5dfd7f28986f0303c5d094a12128e5db48cbc035be6e1cb10d66a53d3b16b.jpg) +(a) IID + +![](images/662dd6bdebcd7fa5642aae514ce98a5cd3b498a551986a6636f6b2d5dba1deea.jpg) +(b) moderate non-IID + +![](images/b6751df5c859639f378f84d455f3d71daa8b3ce0e3f2917db88fb1dc2ecaaec5.jpg) +(c) server non-IID + +![](images/04194659609610c632bc0d34da21ebc9b2d05e75c36d5cdd4092af3195afbd14.jpg) +(d) IID + +![](images/b8a4ea09193ba91fcee7e02b00209a71c6e0eebd02b81f96e2c1f7bd5f3979e8.jpg) +(e) moderate non-IID + +![](images/7e851b37d24ac5969b850802b2c42a71e37b173f394fde1e99b00111fd625cc6.jpg) +(f) server non-IID +Figure 5: Mean of pairwise cosine similarity of the learned $A$ and $B$ matrices across layers of a RoBERTa model locally fine-tuned with rsLoRA on the RTE task, with different levels of data heterogeneity. (a)-(c): value matrices; (d)-(f): query matrices. The learned $A$ matrices are more similar across clients than the $B$ matrices, and with increased data heterogeneity, the similarity of $B$ matrices between different clients decreases. + +# A.6.3 LEARNED VERA MATRICES COMPARISON + +In this section, we show the mean of pairwise client relationships for the learned VeRA (Kopiczko et al., 2024) matrices. In VeRA, the low-rank matrices $A$ and $B$ are initialized using the uniform version of Kaiming initialization, fixed, shared across all layers, and adapted with trainable scaling vectors $d$ and $b$ . The $b$ vectors are initialized to zero, and the $d$ vectors are initialized with a value of 0.1. To make the notation consistent with our work, we rewrite the scaling vectors $d$ and $b$ as $A_{d}$ and $B_{b}$ to reflect the position of each scaling vector. These results, illustrated in Figure 6, demonstrate a similar phenomenon to the learned LoRA matrices. That is, the learned scaling vectors $A_{d}$ are more similar across clients than the scaling vectors $B_{b}$ , and with increased data heterogeneity, the similarity of scaling vectors $B_{b}$ between different clients decreases. + +![](images/b9b1f1f3454d6143d4f5e8455c31c0a4cc45965b523fe6f74a099cf21088f5ac.jpg) +(a) IID + +![](images/98b2a7ca9e54c1b85865a3dcafbb5210842bc8a9a3d30537b8b9bd516de8a234.jpg) +(b) moderate non-IID + +![](images/3f0d0fd7f3e66e3dd410241f8e5d95c7037d651497188d489cc3962247716d2a.jpg) +(c) server non-IID + +![](images/5d2d7a094494a4230d2b1a5e2a5ca2f7e4b585fdb881e69fa269889af9145589.jpg) +(d) IID +Figure 6: Mean of pairwise cosine similarity of the learned scaling vectors $A_{d}$ and $B_{b}$ across layers of a RoBERTa model locally fine-tuned with VeRA on the RTE task, with different levels of data heterogeneity. (a)-(c): value matrices; (d)-(f): query matrices. The learned scaling vectors $A_{d}$ are more similar across clients than the scaling vectors $B_{b}$ , and with increased data heterogeneity, the similarity of scaling vectors $B_{b}$ between different clients decreases. + +![](images/c3b619f37bf711fd43ee1cc77ca4582702adfa06e9ff1aa43d3357955ea0ee6c.jpg) +(e) moderate non-IID + +![](images/d35d018f8712dbc967bda42680a3df7ecdf92d39d8915a568756e2a0b5962445.jpg) +(f) server non-IID + +# A.7 FURTHER RESULTS ON COMPRESSING A MATRICES + +Based on the reviewers' comments during the review stage, we further conduct experiments on compressing the $A$ matrices. Specifically, we chose FetchSGD (Rothchild et al., 2020) to compress around $50\%$ of the $A$ matrices, given that the updates across the $A$ matrices are trivial but necessary. The experimental results are shown in Table 10, which indicates that FedSA-LoRA with a compression method achieves performance comparable to the original FedSA-LoRA. This confirms that the $A$ matrices can indeed be further compressed to reduce communication overhead while maintaining satisfactory performance, validating the reviewer's hypothesis that "there must exist a compression method or a sparse structure to significantly reduce the number of parameters in the $A$ matrices that need to be updated". + +Table 10: Time and space costs for each method on the RTE and QNLI tasks. # Communication round denotes the number of communication rounds to reach the predefined target performance. ‡ denotes equipped with the compressing method FetchSGD. + +
# Trainable Parm.# Per-round Communicated Parm.# Per-round Computation Cost# Communication RoundAccuracy
RTEQNLIRTEQNLIRTEQNLI
LoRA1.83M0.78M22s35s16739787.49±0.1591.16±0.72
FFA-LoRA1.44M0.39M20s33s22937486.08±1.1691.52±0.59
FedDPA-LoRA2.62M0.78M23s37s12832587.44±0.1390.74±1.38
FedSA-LoRA1.83M0.39M22s34s9122487.93±0.1192.13±0.24
FedSA-LoRA†1.83M0.20M22s34s7915587.88±0.1392.16±0.20
\ No newline at end of file diff --git a/ICLR/2025/Selective Aggregation for Low-Rank Adaptation in Federated Learning/images.zip b/ICLR/2025/Selective Aggregation for Low-Rank Adaptation in Federated Learning/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..0d3fd804aaad44b96c43357d31d84284abe7fab7 --- /dev/null +++ b/ICLR/2025/Selective Aggregation for Low-Rank Adaptation in Federated Learning/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e54205c9b5c202b01d929b46836ab6b522533dc2ab9282b7ea53ae4d21835696 +size 1670551 diff --git a/ICLR/2025/Selective Aggregation for Low-Rank Adaptation in Federated Learning/layout.json b/ICLR/2025/Selective Aggregation for Low-Rank Adaptation in Federated Learning/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..713cdb4cf11a8d366b83a1bb0236e005be392d56 --- /dev/null +++ b/ICLR/2025/Selective Aggregation for Low-Rank Adaptation in Federated Learning/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b05c92383128e77b2d666128fd4559e552ceb6ad62423c9143a9dc82e35ed41d +size 985001 diff --git a/ICLR/2025/Selective Attention Improves Transformer/1874d18c-c191-4cef-9212-763683a4a6b1_content_list.json b/ICLR/2025/Selective Attention Improves Transformer/1874d18c-c191-4cef-9212-763683a4a6b1_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..fe5bfce999a14665d0997b5b8aa31b4d0e258bcf --- /dev/null +++ b/ICLR/2025/Selective Attention Improves Transformer/1874d18c-c191-4cef-9212-763683a4a6b1_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1a3d9c6bc0bbb04765d3b05f5458f6218165d7bb930321d0720c6e82541ac16c +size 129181 diff --git a/ICLR/2025/Selective Attention Improves Transformer/1874d18c-c191-4cef-9212-763683a4a6b1_model.json b/ICLR/2025/Selective Attention Improves Transformer/1874d18c-c191-4cef-9212-763683a4a6b1_model.json new file mode 100644 index 0000000000000000000000000000000000000000..8d61b191ea291688270871187de00ccd2706a0df --- /dev/null +++ b/ICLR/2025/Selective Attention Improves Transformer/1874d18c-c191-4cef-9212-763683a4a6b1_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c38e3ea5ea87f1ba0254281dab0aff16346a958671cd1ab123161715e62f8586 +size 153286 diff --git a/ICLR/2025/Selective Attention Improves Transformer/1874d18c-c191-4cef-9212-763683a4a6b1_origin.pdf b/ICLR/2025/Selective Attention Improves Transformer/1874d18c-c191-4cef-9212-763683a4a6b1_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..5ea895453409b7e4a557ff51fb92a41f3fee3cf0 --- /dev/null +++ b/ICLR/2025/Selective Attention Improves Transformer/1874d18c-c191-4cef-9212-763683a4a6b1_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1bbb172f670c14069b26a1e83f29c7dc46f87c64431e64c55857bea540905cd7 +size 2425518 diff --git a/ICLR/2025/Selective Attention Improves Transformer/full.md b/ICLR/2025/Selective Attention Improves Transformer/full.md new file mode 100644 index 0000000000000000000000000000000000000000..300b86b807aff219c9697b848b6cac44fcc1f63c --- /dev/null +++ b/ICLR/2025/Selective Attention Improves Transformer/full.md @@ -0,0 +1,483 @@ +# SELECTIVE ATTENTION IMPROVES TRANSFORMER + +Yaniv Leviathan + +Google Research + +leviathan@google.com + +Matan Kalman + +Google Research + +matank@google.com + +Yossi Matias + +Google Research + +yossi@google.com + +# ABSTRACT + +Unneeded elements in the attention's context degrade performance. We introduce Selective Attention, a simple parameter-free change to the standard attention mechanism which reduces attention to unneeded elements. Selective attention consistently improves language modeling and downstream task performance in a variety of model sizes and context lengths. For example, transformers trained with the language modeling objective on C4 with selective attention perform language modeling equivalently to standard transformers with $\sim 2\mathbf{X}$ more heads and parameters in their attention modules. Selective attention also allows decreasing the size of the attention's context buffer, leading to meaningful reductions in the memory and compute requirements during inference. For example, transformers trained on C4 with context sizes of 512, 1,024, and 2,048 need 16X, 25X, and 47X less memory for their attention module, respectively, when equipped with selective attention, as those without selective attention, with the same validation perplexity. + +# 1 INTRODUCTION + +Different tasks have different memory requirements. On one extreme, copying an arbitrary sequence requires retaining all sequence elements in memory. On the other extreme, determining whether a specific element appeared at least once, only requires persisting a constant amount of memory. + +Transformers (Vaswani et al., 2017) keep the entire history in their context buffers, allowing them to solve tasks such as copying, while famously leading to their squared attention cost. RNNs (Rumelhart et al., 1986) and their modern structured state space variants (Gu et al., 2022; Gu & Dao, 2024) keep only a constant-sized sketch of the history, making inference cost linear, but rendering them incapable of solving tasks such as arbitrary string copying. + +Can we design a model that persists just the right amount of context? + +Several works (see Section 8) aim to improve costs by compressing or otherwise reducing the context size with minimal impact to quality. We take a different approach, focusing instead on quality improvement, and treating cost reductions as a side benefit. Specifically, it has been demonstrated (Leviathan, 2022) that for some tasks removing unneeded elements from the context buffer enables more efficient transformer programs. Indeed, in the attention's differentiable memory, all memory cells contribute to the data read, and circuitry is needed to filter out the noise generated by irrelevant memories. Reducing the amount of circuitry needed should improve performance. + +In this work we propose Selective Attention, a simple extension to the standard attention mechanism which allows a token to decide that another token is no longer needed, reducing the attention that future tokens will pay to it. Selective attention adds no new parameters and only a negligible amount of computation, yet yields meaningful improvements in synthetic tasks and natural language modeling for a range of model and context sizes. Additionally, we show that elements that are selected to be forgotten by selective attention can be safely removed from the attention's context, leading to substantial reductions in the memory and computation requirements during inference, without penalizing quality. We name our method after the related neuroscience concept of selective attention. Quoting Plebanek & Sloutsky (2017): "Selective attention allows adults to focus on task-relevant information, while ignoring task-irrelevant information. This in turn leads to superior processing of task-relevant information." + +![](images/4fd3cb20049cfd1a2d3cd8a031b89a5f6ae0ff5516b5e73e6a1d743e59c22391.jpg) + +![](images/370fb646bd2281c62713f737c366c85999556f2d49efe6e06f99704be1d9bef9.jpg) + +![](images/22faa3cdb9a5672cfb7efc314c1f0706d05b97d6dd1c9d1e2d0c6429b156c253.jpg) + +![](images/a03c60de5ea1920bf719b7ea4342fe8e441a1aafd3b6b4f6de40e7602f1ec47c.jpg) +Figure 1: A visualization of the masking by selective attention (red strike-through) and attention strength (averaged across heads, blue highlight) for different tasks (see Section 2). + +# 2 MOTIVATING EXAMPLES + +Consider a transformer processing an input sequence with three tokens: a, b, c. In a given layer with the standard attention module, token b can decide how much to read from token a, and token c can decide how much to read from token a, but token b cannot affect how much token c reads from token a. Specifically, if token b has determined that token a is irrelevant or even misleading to future tokens such as c, there is nothing it can do in the given layer to correct for this. Even in subsequent layers, masking token a is not trivial. Selective attention enables exactly such masking. To illustrate its usefulness, let's consider the Variable Assignment problem, as well as natural language modeling. + +In Variable Assignment the input consists of a set of repeated assignments to named variables, followed by a query for the latest value for one of the variables which the model needs to output. For example, for the input: $y = 7$ ; $x = 1$ ; $x = 3$ ; $z = 5$ ; $x = ?$ the output is 3. Note that Variable Assignment can be seen as a generalization of the Search problem (Leviathan, 2022), where repeated occurrences of the query pattern are allowed, and we are tasked with finding the most recent occurrence. It is well known that the Search problem is easily solvable by standard transformers, via induction heads (Olsson et al., 2022). Selective attention facilitates a simple reduction from Variable Assignment to Search, whereby every assignment to a variable masks out all previous assignments to the same variable. In Figure 1 (top) we see that this is indeed the case for a transformer trained with selective attention. In Appendix A.1 we show that a transformer with selective attention easily learns a general solution to Variable Assignment while a standard transformer does not. + +To motivate selective attention for natural language modeling, we first note that Variable Assignment is a common sub-task, e.g. when persisting a state. For further motivation, consider the common case where a part of the input is ambiguous, and the ambiguity is only resolved at a later token. For example, in the sequence: Bar, #ack, Obama, the first token Bar encodes several competing meanings, but the later tokens #ack and Obama resolve it to the entity for the ex-president. For many tasks that are mostly concerned with the semantic meaning, later tokens might not want to read the ambiguous meaning from the earlier tokens, so masking them, as with selective attention, might be useful. In Figure 1 (bottom) we see that this is indeed the case for a transformer trained with selective attention. In the visualized layer, the last token in multi-token expressions masks out the earlier tokens. For example, #ack masks out bar; Obama masks out both bar and #ack; #bm masks out i; and #la masks out both u and #c. We also observe additional masking, e.g. the token after masks out the tokens a and day, perhaps because the token after absorbed the meaning from the tokens a and day, or perhaps because the model deems the extra detail is not helpful at this point. + +Figure 1 also shows that for the trivial task of Parity*, where intermediate results are stored every other token, so that the model's output is only a function of the last two tokens, everything but the last two tokens is masked. For the Copy task, selective attention persists the entirety of the string to be copied until copying starts, and then masks out every element as it is copied. See Appendix A.2. + +# 3 SELECTIVE ATTENTION + +Selective attention is a simple modification on top of standard attention. The key idea is that tokens can mask previous tokens, i.e. the amount of attention a token $\mathbb{C}$ pays a previous token $\mathbb{a}$ can be reduced by the tokens located between $\mathbb{a}$ and $\mathbb{c}$ . For context size $N$ , we produce a real-valued $N \times N$ masking matrix $S$ where $S_{i,j}$ denotes how much token $x_{i}$ masks token $x_{j}$ (see Section 3.1). We then constrain $S$ , e.g. to be causal and non-negative (see Section 3.2). We finally accumulate the information in matrix $S$ into a new matrix $F$ , taking into account masking by all previous tokens (see Section 3.3). The matrix $F = \mathrm{Accumulate}(\mathrm{Constrain}(S))$ is then simply subtracted from the attention logits before applying the softmax: + +$$ +\operatorname {S e l e c t i v e A t t e n t i o n} (Q, K, V) = \operatorname {s o f t m a x} \left(\frac {Q K ^ {T}}{\sqrt {d _ {k}}} - F\right) V \tag {1} +$$ + +Figure 2 illustrates a sketch implementation. + +# 3.1 SELECTION FUNCTION + +Computing the selection matrix $S$ is akin to computing a compatibility score, and many functions can be used, for example, a separate bilinear form. Following an observation from Leviathan (2022) that a common case for a token wanting to mask another is after absorbing its contents (i.e. after attending to it), we instead simply reuse the result of one of the existing heads of the attention module. This means that the selection function adds no new parameters or computation. Note that the head still contributes to attention as usual. We also experimented with a separate bilinear form, and in spite of adding additional parameters and computation, this resulted in the same or slightly worse results (see Appendix A.3). + +# 3.2 CONSTRAINTS + +Following observations from Leviathan (2022), we apply the following constraints to $S$ : + +1. Zero out negative values (i.e. applying ReLU), only reducing attention, never boosting it. +2. Zero out the first column, so as not to mask the $<\text{BOS}>$ token. +3. Zero out the diagonal, so as not to let a token mask itself. + +We observe that all three constraints improve performance (see Appendix A.5). + +# 3.3 ACCUMULATION + +In this work we focus on transformer decoders, so selective attention cannot influence the attention operation by past tokens. We chose cumulative summation as our accumulation function. We observe some improvement by only applying the masking for future tokens (i.e. the masking by a token would not affect its own attention operation), so $F_{i,j} = \sum_{k\leq i - 1}S_{k,j}$ (see ablation in Appendix A.4). + +```txt +... +attn_logits $=$ einsum("bhnd,bhmd->bhnm",Q,K)/sqrt(dk) +attn_logits $=$ where(causal_mask,attn_logits,float(-inf")) +S $=$ attn_logits[:0] #Selecthead0. +S $=$ relu(S) #Onlypositiveselection. + $\mathrm{S}[\dots ,0] = 0$ #Do not mask. + $\mathrm{S} = (1 - \mathrm{eye}(\mathrm{n}))\star \mathrm{S}$ #Do not mask self. + $\mathrm{S} = \mathrm{roll}(\mathrm{S},1, - 2);\mathrm{S}[\dots ,0,:] = 0$ #Mask strictly in the future. +F $=$ np.cumsum(S, axis=-2) #Accumulate. +attn_logits $= = F[:$ None] +attnweights $=$ softmax(attn_logits) +... +``` + +Figure 2: A sketch implementation of selective attention. The colored lines are the additions to standard attention. + +# 4 CONTEXT PRUNING + +As presented in Section 3, while beneficial to model quality, selective attention has negligible impact on inference efficiency1. However, an additional modification can improve inference efficiency substantially. Specifically, selective attention can reduce the memory and computation requirements of the attention module, via pruning elements from the context buffer. + +To see how, note that once a token is sufficiently masked by selective attention, it will not contribute meaningfully to any future attention operations. Such tokens can be safely evicted from the context buffer. We could pick a fixed threshold, and prune all elements whose soft masking is higher than the threshold (i.e. $F_{i,j} > \tau$ ), but that would make the memory savings hard to take advantage of (e.g. + +due to fragmentation and a variable number of dropped tokens each iteration). Instead, we observe that the sparsity (i.e. the magnitude of the masking) per layer is stable across samples (see Section 7). To that effect we set a fixed memory budget for each layer, which directly translates to memory and compute savings. Since when a token is dropped it remains dropped for all future tokens, given a memory budget of $K = K_{1}, \ldots, K_{L}$ tokens for each layer, when processing the first $K_{l}$ tokens in layer $l$ we drop nothing, and for each following token we drop the single not-yet-dropped past token with the highest $F$ value. This maintains no more than $K_{l}$ tokens in layer $l$ . Given an overall memory budget, we allocate it between the layers, using a greedy iterative approach. For context size $N$ , we initialize $K_{1}^{0} = N, \ldots, K_{L}^{0} = N$ . In each iteration $t$ , we set $K_{n}^{t} = K_{n}^{t-1}$ for all $n \neq m$ , and $K_{m}^{t} = K_{m}^{t-1} - C$ for a constant $C$ (we use 8 in our experiments), where $m = \operatorname{argmin}_{i} \mathcal{L}\left(\cdot | K^{t-1}_{i} - C_{i}\right)$ , where $C_{i} = (0, \ldots, 0, C, 0, \ldots, 0)$ contains $C$ at the $i$ th position. In other words, we iteratively reduce the memory budget of the layer that impacts model performance the least. We stop when model performance reaches a predefined threshold, in our experiments, the performance of a standard transformer without selective attention. + +Note that with a low memory budget there might be some discrepancy between training and inference. Fine tuning the model after the budgets have been set (or even better, in each iteration) might be advantageous and lead to larger reductions in memory budgets, but we haven't experimented with this setup yet. + +As selective attention's masking is beneficial for the model, we observe significant reductions in context sizes without any auxiliary losses (see Section 6.2). Nevertheless, we can further encourage the model to mask out more elements by adding an explicit term to the loss, like so: + +$$ +\mathcal {L} _ {m e m} = \mathcal {L} + \epsilon \cdot \frac {\sum_ {l = 1} ^ {L} \max _ {i} M _ {i} ^ {l}}{L \cdot n _ {\neq p a d}} \tag {2} +$$ + +Where $\mathcal{L}$ is the standard loss (log-perplexity in the case of language modeling), $\epsilon$ is a small weight factor (in our experiments we set $\epsilon = 0.1$ without further tuning), $L$ is the number of layers, $n_{\neq pad}$ is the number of non-pad tokens, and $M_i^l = i - \sum_{k=1}^{i} \min(F_{i,k}^l, \tau) / \tau$ is our approximation for the memory requirements at the $i$ th token for layer $l$ ( $0 \leq M_i^l \leq i$ ). We clamp $F_{i,k}^l$ from above by $\tau$ so as not to reward increasing it indefinitely ( $F$ is already clamped from below to 0). We set $\tau = 1$ without further tuning. Since the memory required for a given layer is the maximum memory required for each of the tokens, the loss only considers the maximum among the $M_i^l$ s. We observe further reduction in context sizes with this explicit loss term (see Section 6.2). + +# 5 EXPERIMENTAL SETUP + +In all of our experiments we use a decoder-only transformer with multi-head attention, as in Vaswani et al. (2017), with the following modifications: we use Pre-LN instead of Post-LN (Xiong et al., 2020), learned position encoding, SwiGLU gates instead of MLPs (Shazeer, 2020), normalize the Q and K projections (Dehghani et al., 2023) $^{2}$ , remove the biases (Raffel et al., 2023), and replace the LayerNorms with RMSNorm (Zhang & Sennrich, 2019). Note that we tested other variants, including a vanilla decoder-only transformer exactly as in (Radford et al., 2019) and observed similar results. We trained our models with the AdamW optimizer with $\beta_{1} = 0.9$ and $\beta_{2} = 0.999$ for a total of 524,288 steps. We used cosine decay and 1,000 linear warmup steps and a learning rate of 0.005. We repeated some of the experiments with different learning rates and obtained similar results. We used a batch size of 256 and a fixed context size of 512 for all training runs except for the context size experiments (Figure 3 left) where we used a batch of 128. We follow Esser et al. (2024), and parameterize a model size by a parameter $d$ such that $d_{model} = 64d$ and $n_{heads} = n_{layers} = d$ (see Table 8 in Appendix A.13). We trained all of our models on TPUv4s. For the language modeling experiments, we used the C4 (Raffel et al., 2023) dataset with a vocabulary of size 8K tokens built with the SentencePiece tokenizer (Kudo & Richardson, 2018). We repeated some of the experiments with a vocabulary of size 32K and observed similar results. We also ran experiments with WikiText (Merit et al., 2016), and lm1b (Chelba et al., 2014) and observed similar results. + +# 6 RESULTS + +# 6.1 GENERATION QUALITY + +Transformers with selective attention perform consistently better, as measured by perplexity on the validation set, across model and context sizes. We also observe consistent improvements on a set of downstream tasks. + +Figure 3 (left) compares the validation perplexity for causal language modeling on the C4 dataset of decoder-only $d = 12$ transformer models with and without selective attention, for varying context sizes. Likewise Figure 3 (right) compares validation perplexity with and without selective attention, for varying model sizes with a context length of 512. We observe improvements across model sizes, and that the improvements grow with the size of the context. + +![](images/f43ddf6a406eb0c890e4bdfd714c2e98b621dac624af8e389e84b5b57e38bca3.jpg) +Figure 3: (Left) The validation perplexity of a $d = 12$ transformer, with (blue) and without (orange) selective attention, for varying context sizes. (Right) The validation perplexity of transformers of various sizes, with (blue) and without (orange) selective attention, for a context size of 512. + +![](images/36799fca7f4c4af4f072c2955ed67fa9da52df1cbb1e7e681daf62bc30000e78.jpg) + +Figure 4 shows that even when equipped with additional attention heads (and increasing the parameters of the attention module proportionally, so that the size of each head remains constant), transformers with standard attention only become comparable to those with selective attention, when they have about double the number of heads (and parameters) as their selective attention counterparts. + +![](images/ac77949fcfc0c1420beb0313cbc76dca0fcdbb083879ce4c52e739a1a95fd2c6.jpg) +Figure 4: Perplexity of transformers of various sizes with and without selective attention. For the cases without selective attention we add additional attention heads with their respective parameters (i.e. increase the sizes of all projection matrices). Transformers with selective attention perform equivalently to those with standard attention with $\sim 2\mathrm{X}$ as many heads and parameters. + +In addition to perplexity on the validation set, we also measure model accuracy on the ARC (Clark et al., 2018), HellaSwag (Zellers et al., 2019), PiQA (Bisk et al., 2019), CommonSenseQA (Talmor et al., 2019), and OpenBookQA (Mihaylov et al., 2018) benchmarks, with and without selective attention, for models of various sizes (see Table 1). We observe consistent improvements across all model sizes with selective attention. + +Table 1: Accuracy numbers for baseline transformers with standard attention and transformers with selective attention for various model sizes and downstream tasks. + +
ARC (Easy)ARC (Challenge)HellaSwag
BaseSelectiveBaseSelectiveBaseSelective
d = 1638.46%39.33%23.24%23.24%38.83%40.01%
d = 1840.48%41.10%24.67%24.86%41.77%42.60%
d = 2041.33%41.85%25.14%25.52%43.97%45.08%
d = 2242.43%42.70%25.83%26.41%46.04%47.71%
d = 2443.83%44.47%26.64%26.76%48.70%50.32%
d = 2644.70%45.58%26.37%26.95%51.02%52.25%
d = 2845.64%46.95%26.76%27.37%53.50%53.76%
CommonSenseQAOpenBookQAPiQA
BaseSelectiveBaseSelectiveBaseSelective
d = 1625.44%25.82%34.26%34.33%68.07%68.49%
d = 1826.45%26.69%35.32%35.42%69.05%69.88%
d = 2026.30%26.63%35.42%35.27%69.82%70.49%
d = 2226.56%27.10%35.96%36.88%70.55%71.43%
d = 2427.49%27.49%36.36%37.13%71.34%71.95%
d = 2627.70%27.78%37.64%37.52%71.89%72.47%
d = 2827.86%28.51%37.33%37.54%72.32%72.85%
+ +# 6.2 INFERENCE EFFICIENCY + +Efficiency improvements via selective attention stem from a reduction in the attention module's context size when using pruning as in Section 4. Specifically, a smaller context translates directly to more efficient inference in common scenarios. Indeed, note that during inference with a large context and batch size $(bn >> d)$ , loading the KV-cache (linear in the size of the context) dominates the memory bandwidth (Pope et al., 2022), which is often the bottleneck for generation (Shazeer, 2019). In addition, for very large context sizes $(n >> d)$ , taking the dot product of the query and the keys in the cache and calculating the weighted average of the values in the cache both dominate compute, i.e., in this setup, a smaller context directly translates to similar gains in FLOPs. + +When pruning the context with selective attention, we measure substantial improvements in the memory requirements for the attention module, at the same or better perplexity than the baseline without selective attention. Figure 6 in Appendix A.6 illustrates the trade-off between perplexity and efficiency. + +For example, for $d = 12$ transformers with context sizes of 512, 1,024, and 2,048, we see that with selective attention we can maintain the baseline's perplexity while reducing the memory requirements of the attention module by factors of 5X, 7X, and 8X respectively, without any explicit losses (i.e. using only the standard language modeling objective). When training with the $\mathcal{L}_{mem}$ loss (Equation 2) and an $\epsilon$ value of 0.1, the improvements grow to 16X, 25X, and 47X respectively. We also measure the memory savings when considering only very long examples by filtering C4 to only include examples that are at least $90\%$ the size of the context buffer. In that settings we get memory savings of 12X, 18X, and 24X, while maintaining the perplexity of the baseline without selective attention. To maintain the perplexity gains of selective attention, instead of matching the perplexity of the baseline (i.e. the rightmost point on the flat part of the blue graphs of Figure 6), we need 3X, 4X and 4X less memory, for the context sizes above, respectively. + +In all cases above, we optimized the per-layer budgets on a training set and reported results on a separate unseen test set. + +Finally, we compare selective attention to other attention variants and pruning methods and observe that it achieves a substantially better quality-cost trade-off than all baselines (see Appendix A.10). + +# 7 SELECTION PATTERNS + +It is interesting to question which elements from the context are being masked by selective attention for language modeling. Figure 5 illustrates the values of the $F$ matrix for a specific example (see Appendix A.7 for the full example text). We observe that some layers (e.g. 6) are mostly dense (i.e. low $F$ values), while other layers (e.g. 2) are sparse (i.e. high $F$ values). As expected, all layers persist some of the most recent elements, but several of the sparse layers (e.g. layers 1, 4, and 9) also persist elements for long time periods, as can be seen by the vertical lines. This suggests that simply limiting the attention module to a local window would not result in the same quality gains as those achieved by selective attention, which we confirm in Appendix A.8. + +![](images/489986caf965812930f235f4ac1ccbe959ecbe811f53682115466ea64f949516.jpg) +Figure 5: Visualization of the $F$ matrix (greener is lower, i.e. less masking) for a $d = 12$ transformer for the text in Appendix A.7. + +Figure 9 in Appendix A.12 illustrates the values of the $F$ matrix averaged over 1,000 examples, and demonstrates that the sparsity patterns are stable across examples. Interestingly, we observe that these sparsity patterns are sometimes stable across different training runs, hinting at some general properties of language modeling (see Figure 10 in Appendix A.12). + +Figure 11 in Appendix A.12 depicts the items remaining in the context buffer after pruning (see Section 4), with a budget set to match the perplexity of a standard transformer. We observe that the per-layer budgets correspond well to the values of the $F$ matrix as seen in Figures 5 and 9. For example, layer 6 which gets the highest budget also has the lowest $F$ values. This might indicate that the scales of the $F$ values are consistent across layers. + +Figure 12 in Appendix A.12 illustrates the value of the last row of $F$ (i.e. the masking for the 512th token) for each of the layers. We observe some interesting patterns, for example, layer 4 persists the end-of-sentence periods (''). + +# 8 RELATED WORKS + +Transformer Improvements. Our work aims at improving the transformer architecture. Since its introduction in Vaswani et al. (2017), a large volume of research proposed architecture modifications towards an improved model. Some notable works here include Pre-LN instead of Post-LN (Xiong et al., 2020), gated units instead of MLPs (Shazeer, 2020), removing the biases (Raffel et al., 2023), using RMSNorm instead of LayerNorm (Zhang & Senrich, 2019), normalizing the Q and K projections (Dehghani et al., 2023), and multi-query and group-query attention (Shazeer, 2019; Ainslie et al., 2023). + +Attention Modifications. Our work focuses on modifying the attention module. Most of the existing research work around modifying attention focuses on a different goal than ours, specifically on devising more efficient attention variants. Some such variants are based on approximations to the attention operations and include sparse attention approximations (Child et al., 2019; Ding et al., 2023), and linear attention approximations (Shen et al., 2024; Katharopoulos et al., 2020; Schlag et al., 2021). Some works focus on hardware-aware optimizations instead, such as FlashAttention (Dao et al., 2022) and Ring Attention (Liu et al., 2023a). + +Context Pruning. A part of our work (Section 4) consists of removing elements from the context buffer. Several works employ this mechanism in order to increase inference efficiency. Among those are compression methods, that aim to learn a compressed representation for tokens in the context buffer, with or without auxiliary losses, in order to replace several tokens with their compressed form (Munkhdalai et al., 2024; Ren et al., 2023; Yun et al., 2023; Mu et al., 2024; Rae et al., 2019). Another line of work tries to simply remove elements from the context buffer without replacing them with new compressed forms, with minimal negative impact to model quality. The simplest and most widely adopted of these is using local attention windows in some of the layers (Wang et al., 2019; Beltagy et al., 2020; Zaheer et al., 2021). More sophisticated variants employ heuristics to evict less useful tokens from the context buffer instead of just the earliest ones (Oren et al., 2024; Zhang et al., 2023; Liu et al., 2023b; Berchansky et al., 2023; Ge et al., 2024). Anagnostidis et al. (2024) fine tunes existing models to learn to prune tokens from the context buffer with similarities to selective attention, but is more involved (e.g. needs root solving for evaluating the $\alpha$ -sigmoid), produces binary prune decisions, and notably doesn't improve quality. + +Inference Efficiency. A part of our work (Section 4) consists of making inference from transformers more efficient. Many approaches aim to speed up inference from transformers, including distillation (Hinton et al., 2015), sparsification (Jaszczur et al., 2021), quantization (Hubara et al., 2016), architecture modification (So et al., 2022; Shazeer, 2019), and algorithmic optimization (Dao et al., 2022; Leviathan et al., 2022). + +Finally, we note that the importance of learning to forget has been shown repeatedly in many works, more generally beyond transformers. One of many notable examples are the forget-gates in LSTMs (Hochreiter & Schmidhuber, 1997). + +# 9 DISCUSSION + +In this work we introduced Selective Attention, a simple parameter-free change to the standard attention mechanism which consistently improves language modeling performance across model sizes and context lengths, and can lead to substantial inference efficiency improvements. Given that it adds no new parameters, only a negligible amount of compute, and provides consistent improvements, selective attention might be a good default for transformer decoders. + +Future directions. We applied selective attention to decoder-only transformers. It could be interesting to investigate its applicability to encoders as well (see Appendix A.9 for initial results in an encoder-decoder setup); Reducing the size of the context as in Section 4 improves inference efficiency but not training efficiency. It might be interesting to explore iteratively reducing the size of the context buffer during training; We did not further train the models after removing elements as per Section 4. It seems conceivable that further improvements could be achieved with some additional training after context reduction; We only experimented with pre-training models with selective attention. It is interesting to investigate how it could be applied in a fine-tuning step to existing models; While we observed similar results with selective attention in several setups (Section 5), there are + +still important variants we did not test, notably transformers with multi-query (Shazeer, 2019) and grouped-query (Ainslie et al., 2023) attention, as well as models much larger than 1B parameters; Finally, selective attention can be implemented in a GPU-aware way, similar to Flash Attention (Dao et al., 2022). + +# 10 IMPROVING NEURAL ARCHITECTURES + +In The Art of Transformer Programming, Leviathan (2022) selected a set of foundational problems (sorting, searching, addition, etc.) and manually implemented transformers to solve them (i.e. by manually setting the model's weights). They showed that several programs become much easier, especially for small transformers, when equipped with a mechanism allowing to selectively mask items in the context buffer, similar to selective attention. They further hypothesized that such a mechanism will have similar positive effects on language modeling, which motivated our work. + +Zhou et al. (2023) proposed the RASP-Generalization Conjecture, that "Transformers tend to length generalize on a task if the task can be solved by a short RASP program which works for all input lengths", i.e. that problems that are easily solved by transformers are those that are easily solved by human programmers using RASP. It follows that problems that are not easily solved by humans using RASP are hard for transformers as well, and if we made those easier, by changing the transformer architecture (and respectively the capabilities of RASP) we could meaningfully improve transformers. Similarly, when constructing transformer programs by hand, Leviathan (2022) notes that "...the most interesting cases are those that are hard for us humans and are hard for the optimizer or the architecture, and understanding these better might be key to creating better AI systems." + +We are strong advocates of this method, and believe that finding basic problems for which we cannot program a general solution by hand on a neural model, is a fertile approach for architecture improvements. + +# ACKNOWLEDGMENTS + +We'd like to extend a huge thank you to Raya Leviathan, Blake Hechtman, Asaf Aharoni, Uri Mendlovic, Danny Lumen, Avinatan Hassidim, Dani Valevski, Eyal Segalis, Molad Eyal, the Theta Labs and Google Research teams, and our families for insightful feedback, ideas, suggestions, and support. + +# REFERENCES + +Joshua Ainslie, James Lee-Thorp, Michiel de Jong, Yury Zemlyanskiy, Federico Lebrón, and Sumit Sanghai. Gqa: Training generalized multi-query transformer models from multi-head checkpoints, 2023. URL https://arxiv.org/abs/2305.13245. +Sotiris Anagnostidis, Dario Pavllo, Luca Biggio, Lorenzo Noci, Aurelien Lucchi, and Thomas Hofmann. Dynamic context pruning for efficient and interpretable autoregressive transformers, 2024. URL https://arxiv.org/abs/2305.15805. +Iz Beltagy, Matthew E. Peters, and Arman Cohan. Longformer: The long-document transformer, 2020. URL https://arxiv.org/abs/2004.05150. +Moshe Berchansky, Peter Izsak, Avi Caciularu, Ido Dagan, and Moshe Wasserblat. Optimizing retrieval-augmented reader models via token elimination, 2023. URL https://arxiv.org/abs/2310.13682. +Yonatan Bisk, Rowan Zellers, Ronan Le Bras, Jianfeng Gao, and Yejin Choi. Piaq: Reasoning about physical commonsense in natural language, 2019. URL https://arxiv.org/abs/1911.11641. +Ciprian Chelba, Tomas Mikolov, Mike Schuster, Qi Ge, Thorsten Brants, Phillip Koehn, and Tony Robinson. One billion word benchmark for measuring progress in statistical language modeling, 2014. URL https://arxiv.org/abs/1312.3005. +Rewon Child, Scott Gray, Alec Radford, and Ilya Sutskever. Generating long sequences with sparse transformers, 2019. URL https://arxiv.org/abs/1904.10509. +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, 2018. URL https://arxiv.org/abs/1803.05457. +Tri Dao, Daniel Y. Fu, Stefano Ermon, Atri Rudra, and Christopher Ré. Flashattention: Fast and memory-efficient exact attention with io-awareness, 2022. URL https://arxiv.org/abs/2205.14135. +Mostafa Dehghani, Josip Djolonga, Basil Mustafa, Piotr Padlewski, Jonathan Heek, Justin Gilmer, Andreas Steiner, Mathilde Caron, Robert Geirhos, Ibrahim Alabdulmohsin, Rodolphe Jenatton, Lucas Beyer, Michael Tschannen, Anurag Arnab, Xiao Wang, Carlos Riquelme, Matthias Minderer, Joan Puigcerver, Utku Evci, Manoj Kumar, Sjoerd van Steenkiste, Gamaeldin F. Elsayed, Aravindh Mahendran, Fisher Yu, Avital Oliver, Fantine Huot, Jasmijn Bastings, Mark Patrick Collier, Alexey Gritsenko, Vighnesh Birodkar, Cristina Vasconcelos, Yi Tay, Thomas Mensink, Alexander Kolesnikov, Filip Pavetic, Dustin Tran, Thomas Kipf, Mario Lucic, Xiaohua Zhai, Daniel Keysers, Jeremiah Harmsen, and Neil Houlsby. Scaling vision transformers to 22 billion parameters, 2023. URL https://arxiv.org/abs/2302.05442. +Jiayu Ding, Shuming Ma, Li Dong, Xingxing Zhang, Shaohan Huang, Wenhui Wang, Nanning Zheng, and Furu Wei. Longnet: Scaling transformers to 1,000,000,000 tokens, 2023. URL https://arxiv.org/abs/2307.02486. +Patrick Esser, Sumith Kulal, Andreas Blattmann, Rahim Entezari, Jonas Müller, Harry Saini, Yam Levi, Dominik Lorenz, Axel Sauer, Frederic Boesel, Dustin Podell, Tim Dockhorn, Zion English, Kyle Lacey, Alex Goodwin, Yannik Marek, and Robin Rombach. Scaling rectified flow transformers for high-resolution image synthesis, 2024. URL https://arxiv.org/abs/2403.03206. +Suyu Ge, Yunan Zhang, Liyuan Liu, Minjia Zhang, Jiawei Han, and Jianfeng Gao. Model tells you what to discard: Adaptive kv cache compression for llms, 2024. URL https://arxiv.org/abs/2310.01801. +Albert Gu and Tri Dao. Mamba: Linear-time sequence modeling with selective state spaces, 2024. +Albert Gu, Karan Goel, and Christopher Ré. Efficiently modeling long sequences with structured state spaces, 2022. + +Geoffrey Hinton, Oriol Vinyals, and Jeff Dean. Distilling the knowledge in a neural network, 2015. URL https://arxiv.org/abs/1503.02531. +Sepp Hochreiter and Jürgen Schmidhuber. Long short-term memory. Neural computation, 9(8): 1735-1780, 1997. +Itay Hubara, Matthieu Courbariaux, Daniel Soudry, Ran El-Yaniv, and Yoshua Bengio. Quantized neural networks: Training neural networks with low precision weights and activations, 2016. URL https://arxiv.org/abs/1609.07061. +Sebastian Jaszczur, Aankanksha Chowdhery, Afroz Mohiuddin, Lukasz Kaiser, Wojciech Gajewski, Henryk Michalewski, and Jonni Kanerva. Sparse is enough in scaling transformers, 2021. URL https://arxiv.org/abs/2111.12763. +Angelos Katharopoulos, Apoorv Vyas, Nikolaos Pappas, and François Fleuret. Transformers are rnns: Fast autoregressive transformers with linear attention, 2020. URL https://arxiv.org/abs/2006.16236. +Taku Kudo and John Richardson. Sentencepiece: A simple and language independent subword tokenizer and tokenizer for neural text processing, 2018. URL https://arxiv.org/abs/1808.06226. +Yaniv Leviathan. The art of transformer programming, 2022. URL https://yanivle.github.io/taotp.html. +Yaniv Leviathan, Matan Kalman, and Yossi Matias. Fast inference from transformers via speculative decoding, 2022. URL https://arxiv.org/abs/2211.17192. +Hao Liu, Matei Zaharia, and Pieter Abbeel. Ring attention with blockwise transformers for near-infinite context, 2023a. URL https://arxiv.org/abs/2310.01889. +Zichang Liu, Aditya Desai, Fangshuo Liao, Weitao Wang, Victor Xie, Zhaozhuo Xu, Anastasios Kyrillidis, and Anshumali Shrivastava. Scissorhands: Exploiting the persistence of importance hypothesis for llm kv cache compression at test time, 2023b. URL https://arxiv.org/abs/2305.17118. +Stephen Merity, Caiming Xiong, James Bradbury, and Richard Socher. Pointer sentinel mixture models, 2016. URL https://arxiv.org/abs/1609.07843. +Todor Mihaylov, Peter Clark, Tushar Khot, and Ashish Sabharwal. Can a suit of armor conduct electricity? a new dataset for open book question answering, 2018. URL https://arxiv.org/abs/1809.02789. +Jesse Mu, Xiang Lisa Li, and Noah Goodman. Learning to compress prompts with gist tokens, 2024. URL https://arxiv.org/abs/2304.08467. +Tsendsuren Munkhdalai, Manaal Faruqui, and Siddharth Gopal. Leave no context behind: Efficient infinite context transformers with infini-attention, 2024. URL https://arxiv.org/abs/2404.07143. +Catherine Olsson, Nelson Elhage, Neel Nanda, Nicholas Joseph, Nova DasSarma, Tom Henighan, Ben Mann, Amanda Askell, Yuntao Bai, Anna Chen, Tom Conerly, Dawn Drain, Deep Ganguli, Zac Hatfield-Dodds, Danny Hernandez, Scott Johnston, Andy Jones, Jackson Kernion, Liane Lovitt, Kamal Ndousse, Dario Amodei, Tom Brown, Jack Clark, Jared Kaplan, Sam McCandlish, and Chris Olah. In-context learning and induction heads, 2022. URL https://arxiv.org/abs/2209.11895. +Matanel Oren, Michael Hassid, Nir Yarden, Yossi Adi, and Roy Schwartz. Transformers are multi-state rnns, 2024. URL https://arxiv.org/abs/2401.06104. +Daniel J. Plebanek and Vladimir M. Sloutsky. Costs of selective attention: When children notice what adults miss. Psychological Science, 28:723 - 732, 2017. URL https://apisemantic scholar.org/CorpusID:30610756. + +Reiner Pope, Sholto Douglas, Aakanksha Chowdhery, Jacob Devlin, James Bradbury, Anselm Levskaya, Jonathan Heek, Kefan Xiao, Shivani Agrawal, and Jeff Dean. Efficiently scaling transformer inference, 2022. URL https://arxiv.org/abs/2211.05102. +Alec Radford, Jeff Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. Language models are unsupervised multitask learners, 2019. URL https://cdn.openai.com/better-language-models/language_models—are_unsupervisedMULTITASK_Learners.pdf. +Jack W. Rae, Anna Potapenko, Siddhant M. Jayakumar, and Timothy P. Lillicrap. Compressive transformers for long-range sequence modelling, 2019. URL https://arxiv.org/abs/1911.05507. +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, 2023. URL https://arxiv.org/abs/1910.10683. +Siyu Ren, Qi Jia, and Kenny Q. Zhu. Context compression for auto-regressive transformers with sentinel tokens, 2023. URL https://arxiv.org/abs/2310.08152. +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, 2022. URL https://arxiv.org/abs/2203.17189. +David E. Rumelhart, Geoffrey E. Hinton, and Ronald J. Williams. Learning internal representations by error propagation, 1986. URL https://api_semanticscholar.org/CorpusID: 62245742. +Imanol Schlag, Kazuki Irie, and Jürgen Schmidhuber. Linear transformers are secretly fast weight programmers, 2021. URL https://arxiv.org/abs/2102.11174. +Noam Shazeer. Fast transformer decoding: One write-head is all you need, 2019. URL https://arxiv.org/abs/1911.02150. +Noam Shazeer. Glu variants improve transformer, 2020. URL https://arxiv.org/abs/2002.05202. +Zhuoran Shen, Mingyuan Zhang, Haiyu Zhao, Shuai Yi, and Hongsheng Li. Efficient attention: Attention with linear complexities, 2024. URL https://arxiv.org/abs/1812.01243. +David R. So, Wojciech Manke, Hanxiao Liu, Zihang Dai, Noam Shazeer, and Quoc V. Le. Primer: Searching for efficient transformers for language modeling, 2022. URL https://arxiv.org/abs/2109.08668. +Alon Talmor, Jonathan Herzig, Nicholas Lourie, and Jonathan Berant. *Commonsenseqa: A question answering challenge targeting commonsense knowledge*, 2019. URL https://arxiv.org/abs/1811.00937. +Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need, 2017. +Zhiguo Wang, Patrick Ng, Xiaofei Ma, Ramesh Nallapati, and Bing Xiang. Multi-passage BERT: A globally normalized BERT model for open-domain question answering. In Kentaro Inui, Jing Jiang, Vincent Ng, and Xiaojun Wan (eds.), 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. 5878-5882, Hong Kong, China, November 2019. Association for Computational Linguistics. doi: 10.18653/v1/D19-1599. URL https://aclanthology.org/D19-1599. + +Ruibin Xiong, Yunchang Yang, Di He, Kai Zheng, Shuxin Zheng, Chen Xing, Huishuai Zhang, Yanyan Lan, Liwei Wang, and Tie-Yan Liu. On layer normalization in the transformer architecture, 2020. URL https://arxiv.org/abs/2002.04745. +Jungmin Yun, Mihyeon Kim, and Youngbin Kim. Focus on the core: Efficient attention via pruned token compression for document classification. In *Findings of the Association for Computational Linguistics: EMNLP* 2023. Association for Computational Linguistics, 2023. doi: 10.18653/v1/2023-findings-emnlp.909. URL http://dx.doi.org/10.18653/v1/2023-findings-emnlp.909. +Manzil Zaheer, Guru Guruganesh, Avinava Dubey, Joshua Ainslie, Chris Alberti, Santiago Ontonon, Philip Pham, Anirudh Ravula, Qifan Wang, Li Yang, and Amr Ahmed. Big bird: Transformers for longer sequences, 2021. URL https://arxiv.org/abs/2007.14062. +Rowan Zellers, Ari Holtzman, Yonatan Bisk, Ali Farhadi, and Yejin Choi. Hellaswag: Can a machine really finish your sentence?, 2019. URL https://arxiv.org/abs/1905.07830. +Biao Zhang and Rico Sennrich. Root mean square layer normalization, 2019. URL https:// arxiv.org/abs/1910.07467. +Zhenyu Zhang, Ying Sheng, Tianyi Zhou, Tianlong Chen, Lianmin Zheng, Ruisi Cai, Zhao Song, Yuandong Tian, Christopher Ré, Clark Barrett, Zhangyang Wang, and Beidi Chen. $\mathrm{H}_2\mathrm{o}$ : Heavy-hitter oracle for efficient generative inference of large language models, 2023. +Hattie Zhou, Arwen Bradley, Etai Littwin, Noam Razin, Omid Saremi, Josh Susskind, Samy Bengio, and Preetum Nakkiran. What algorithms can transformers learn? a study in length generalization, 2023. URL https://arxiv.org/abs/2310.16028. + +# A APPENDIX + +# A.1 TRANSFORMERS WITH SELECTIVE ATTENTION LEARN A GENERAL SOLUTION TO VARIABLE ASSIGNMENT + +Transformers with selective attention reach close to 0 validation loss and $100\%$ precision extremely fast when trained on Variable Assignment and they generalize well to out of distribution cases, unlike transformers without selective attention. + +Setup. We train small transformers ( $d = 3$ ), with and without selective attention, to solve the Variable Assignment problem with 3 variables, 1,000 possible values, and 128 assignments. We train with a batch size of 2,048 for 65,536 steps. + +In distribution. The transformer with selective attention reaches a validation loss of 0.002 (and $100\%$ accuracy) after less than 1,000 training steps. The transformer without selective attention only achieves a validation log-perplexity loss of 3.18 and $26\%$ accuracy after 1,000 step. At the end of training (65,536 steps) the transformer with selective attention obtains a loss of 2.2e-8, whereas the transformer with standard attention is at 0.01. Both transformers reach $100\%$ accuracy at the end of training. + +Out of distribution. We observe much stronger generalization capabilities for the transformer with selective attention. When we run on an out of distribution test set with the same 3 variables but only 2 possible values, the transformer with standard attention's accuracy drops substantially to $70\%$ (loss of 3.64). Meanwhile the transformer with selective attention maintains $100\%$ accuracy (with a loss of 2.4e-8). + +We observed similar results in other settings (e.g. 10 variables and 10 possible values). We also repeated the experiments with somewhat larger transformers $(d = 8)$ and observed similar results. + +See Appendix A.11 for an example of the attention patterns for the Variable Assignment task. + +# A.2 ADDITIONAL SYNTHETIC TASKS + +We validate selective attention on two additional synthetic tasks, Copy and Parity*, that are on the two opposite extremes in terms of memory requirements. See Figure 1. + +Setup. We train small transformers $(d = 3)$ , with and without selective attention, to solve the Copy and Parity* tasks. We train with a batch size of 2,048 for 65,536 steps. + +Copy. Here the transformer gets an arbitrary sequence of varying length delimited by a special token and is tasked with outputting a copy of the sequence. We used lengths that are uniformly distributed between 1 and 24. The context size for this task is $3 + 2 \times L_{\text{max}}$ , where $L_{\text{max}} = 24$ is the length of the longest possible input sequence (the 3 extra tokens are for , and the special end-of-input-sequence token). To solve this task, the model cannot forget anything before copying starts, after which point it can mask out tokens that were already copied. + +Parity*. Here the transformer gets a binary sequence where bits in the odd positions are random and bits in the even positions contain the parity of all bits in the earlier odd positions. Equivalently, bits in the even positions contain the XOR of the bits in the previous two positions, so the two previous positions are enough for computing the next token. The loss only considers the even positions. + +Unsurprisingly, transformers with selective attention achieve practically 0 loss (and $100\%$ accuracy) at the end of training, as do standard transformers without selective attention, on both tasks. + +# A.3 SEPARATE BILINEAR FORM + +We experiment with using a separate bilinear form instead of reusing the output of an existing attention head. We compare transformers (for $d = 8$ and $d = 12$ ) trained with selective attention on C4 for 524,288 steps, to similarly trained transformers where the selection function is implemented via a separate bilinear form (adding additional parameters and computation). The transformers with standard selective attention (i.e. sharing the outputs of an existing attention head) achieve the same or slightly better log-perplexities at the end of training (see Table 2). + +Table 2: The log-perplexity on the validation set after 524,288 training steps for (1) standard attention, (2) selective attention with a separate bilinear form for the selection module (more parameters than the baseline), and (3) selective attention. + +
d = 8d = 12Additional parameters
Standard attention2.962.68No
Selective attention (separate)2.912.63Yes
Selective attention2.902.63No
+ +# A.4 SELF-IMPACT + +Table 3 compares the results of forbidding self-impact (i.e. not allowing a token to affect its own attention operation, as in Section 3.3) to those when allowing it (i.e. not shifting the matrix $S$ ). As can be seen, the shifting provides a small but consistent improvement. + +Table 3: The average log-perplexity on the validation set of 3 training runs after 65,536 training steps for selective attention vs selective attention without shifting, for various model sizes. + +
d=10d=12d=14d=16d=18d=26
Selective attention (no shift)2.9272.8322.7532.6922.6412.516
Selective attention2.9232.8312.7502.6912.6392.511
+ +# A.5 ABLATING THE CONSTRAINTS + +We ablate the 3 constraints selective attention applies to $S$ (see Section 3.2). + +Negative selection. While with selective attention a token can decide to reduce attention to another token by all future attention operations, allowing a token to strengthen another token's contribution to all future attention operations does not make sense. Indeed, when removing this constraint (dropping the ReLU, so that $S$ can contain negative values) the training does not converge. + +Masking the token. Since several algorithms can benefit from the existence of the sentinel token (Leviathan, 2022), it is plausible that masking it is detrimental. When we allow selective attention to mask the token, we observe neutral to slightly worse results compared to standard selective attention where the token is forced to never be selected, see Table 4. + +Self-masking. Since selective attention reuses an existing attention head as the selection function, motivated by the absorption observation (see Section 3.1), it seems plausible that a token should never mask itself. Indeed, when we allow tokens to mask themselves (i.e. we stop zeroing out the diagonal of $S$ ) we observe worse results, see Table 5. + +Table 4: The log-perplexity on the validation set after 524,288 training steps for (1) selective attention without the $< \mathrm{{BOS}} >$ constraint and (2) selective attention. + +
dSelective Attention (w/o <BOS> constraint)Selective Attention
122.64092.6373
142.54862.5483
162.47502.4741
182.41532.4156
202.36742.3673
242.29092.2865
+ +Table 5: The log-perplexity on the validation set after 524,288 training steps for (1) selective attention without the self-masking constraint and (2) selective attention. + +
dSelective Attention (w/o self-masking constraint)Selective Attention
122.73482.7251
142.65102.6423
182.52612.5209
+ +# A.6 PERPLEXITY-EFFICIENCY TRADE-OFF + +![](images/c509de0f4509c51ff0a2c123afd50dbf9d196edad761ebc8f8e9ac5d167f9baf.jpg) +Figure 6 illustrates the trade-off between perplexity gains and efficiency gains when pruning as in Section 4. See Section 6 for details. + +![](images/80ef995407b6499acbb1979f54c003f3968fe9c0e103ba2e992987d7575f4b19.jpg) + +![](images/4a27f555100f81b90e621b96013b64657d00e6a2b93c5672d9eedf166f119b57.jpg) +Figure 6: The trade-off between perplexity and KV-cache size for $d = 12$ transformers with context sizes of 512, 1,024, and 2,048. Note that in all cases the perplexity with selective attention is better or equal to that of the baseline without selective attention (the dotted lines). Selective attention transformers trained with the $\mathcal{L}_{mem}$ loss and $\epsilon = 0.1$ (Equation 2) match the perplexity of the baseline with 16X, 25X, and 47X less memory, while those with the standard loss match the perplexity of the baseline with 5X, 7X, and 8X less memory, respectively. + +# A.7 EXAMPLE DETAILS + +The following text from the C4 validation set was used in Figures 5, 11, and 12: + +the real problem with traditional dental veneers has little to do with how they function or their performance. who determines what a normal, aesthetically pleasing smile looks like is the real issue . america struggled for decades with defining " image " as a marketplace bent on exploiting peoples ' flaws for economic gain . the danger of this national obsession has become systemic since the days of twiggy . fashion magazines offer photoshopped perfection as the standard to which we should aspire . the effects of this insidious marketing made their way into breast implants and the definition of a Hollywood smile . carving their bodies and their teeth , people use their resources to chase a false picture of their " perfect " self . people make investments in the tens of thousands of dollars at their dentist office to get the " perfect " smile . this message has become so endemic that people with nice smiles are convinced only a " perfect " hollywood smile is acceptable . one particularly relevant example of this is highlighted in a june 2015 article entitled " saving jane ' s smile . " gary nankin , dds discusses how he " saved " the smile of a patient who was not content with her first set of # porcelain veneers . 1 . endodontic referral for treatment of tooth number 15 , followed by a composite core build - up . 2 . periodontal therapy in both the anterior region and upper left to achieve optimal tissue health . 4 . preparation of maxillary teeth and placement of permanent restorations . 5 . placement of dental implant by the periodontist followed by preparation of mandibular teeth and placement of permanent restorations . 6 . restore the now fully - healed and osseointegrated implant in the position of tooth number 30 . regarding a person ' s smile , the strong link to self - esteem and self - worth make an imperfect set of teeth a concern . however , the picture in the article clearly illustrates what appears to be a well - constructed and healthy - looking smile . the entire premise is puzzling . how does a dentist promote " saving " a smile that $97 \%$ of the people in america would love to show off ? . + +# A.8 COMPARISON WITH LOCAL ATTENTION + +Table 6 compares the validation perplexity of $d = 12$ transformers with various local attention patterns (all-local and alternating), to that of a standard transformer and to that of a transformer with selective attention. For the all-local attention transformers we set all layers to be sliding window attention layers with a fixed sized window. For example, "All-local 32" denotes a transformer where all tokens can only attend up to 32 tokens back. We also include transformers with alternating local and global layers, where we have 3 local attention layers followed by 1 global attention layer, in a repeated fashion. For example, "Local-global 32" denotes a transformer with 3 local attention layers where tokens can only attend up to 32 tokens back, followed by a global layer where tokens can attend to all past tokens, and this 4-layer structure is repeated for the 12 layers of the $d = 12$ transformer. We report the perplexity numbers after 524,288 training steps. We observe that all local attention patterns perform worse than the dense baseline, which in turn performs worse than a transformer with selective attention. + +Table 6: Validation log-perplexity of transformers with different local attention patterns. + +
Model TypeValidation Log-Perplexity
All-local 322.7860
All-local 642.7386
All-local 1282.7154
All-local 2562.6981
All-local 3842.6873
All-local 4482.6849
All-local 4802.6834
Local-global 322.7046
Local-global 642.7105
Local-global 1282.7154
Local-global 2562.6993
Local-global 3842.6895
Local-global 4482.6870
Local-global 4802.6861
Baseline (standard attention)2.6815
Selective attention2.6372
+ +# A.9 RESULTS ON T5 + +We experimented with applying selective attention while pre-training T5 (Raffel et al., 2023). Here we use the standard T5 pre-training recipe and code from T5X (Roberts et al., 2022). Specifically, in this setup, the model is an encoder-decoder, and we apply selective attention to the decoder only, leaving the encoder as-is. The standard T5 span-corruption pre-training objective is used, as in Raffel et al. (2023), both for training and the reported metrics. See Table 7 for the results. + +We observe some improvements for T5 with selective attention for the 3 tested model sizes. + +Table 7: The span corruption loss per non-padding token on the validation set of 3 training runs after 524,288 training steps for a baseline T5 encoder-decoder vs a T5 encoder-decoder where the decoder is equipped with selective attention, for various model sizes. + +
T5-smallT5-baseT5-large
T51.9621.6931.528
T5 with selective attention1.9521.6911.522
+ +# A.10 COMPARISON WITH EFFICIENT ATTENTION METHODS + +Figure 7 compares selective attention to other efficient attention and attention pruning methods, including $H_{2}O$ (Zhang et al., 2023), TOVA (Oren et al., 2024), and sparse attention (Child et al., 2019). We also include Window + 4 following Oren et al. (2024). Note that $H_{2}O$ , TOVA, and Window + 4 can be applied post-training, whereas selective attention and sparse attention require training the model3. + +We observe that in the tested setting of language modeling on C4, selective attention substantially outperforms all of the tested efficient attention baselines. + +![](images/6623a4eed9dcad3a448dc3d7be5807f871a63540ca58bc3607e26cb618ab872b.jpg) + +![](images/68f2ead53eccc303d828ca3b8f12a8a297d94b5574532cdba00b802682de11da.jpg) + +![](images/cf31f619d8840b3a13ab57d69ec2bf7e1defcc57ecff45bec0d08da6ca8f3ed2.jpg) +Figure 7: The trade-off between validation perplexity and KV-cache size for $d = 12$ transformers with context sizes of 512, 1,024, and 2,048 for selective attention and other efficient attention mechanisms. + +# A.11 EXAMPLE ATTENTION PATTERNS FOR VARIABLE ASSIGNMENT + +Figure 8 shows an example of the attention patterns for all 3 layers of transformers with and without selective attention, for the Variable Assignment task. The part of the example sequence shown starts with the tokens: $Z =$ , 177, $Y =$ , 661, $Z =$ , 114, $Z =$ , 468. + +For the first layer of the transformer with selective attention we observe that tokens of type "" (e.g. 177, 661, etc., i.e., those at the even positions) attend to themselves and to the immediately preceding token (of type "=", e.g. $\mathbb{Z} =$ , $\mathbb{Y} =$ , etc.). A potential explanation is that this allows the value tokens to absorb the information of the variable they are assigned to, so that from this point onwards, the token would contain a representation of the pair (variable, value), and the preceding variable-only token would no longer be relevant for future tokens. E.g., the token 177 might contain a combined representation of $\mathbb{Z}$ and 177. In this same layer, tokens of type "=" attend to themselves. + +We further observe that for the transformer with selective attention, the attention patterns in the second and third layers are almost identical. In these layers, tokens in the even positions, now containing a combined (variable, value) representation according to the postulate above, attend to themselves. Tokens in the odd positions, still containing a representation of the assigned variable according to the hypothesis above, attend to the value of the last assignment to the same variable. This allows masking the previous assignment (see Figure 1). + +In contrast, the baseline transformer without selective attention (which doesn't solve the Variable Assignment task for out of distribution problems, see Appendix A.1), exhibits attention patterns that are harder to interpret. + +![](images/fbf85395eda49c4d74515836b31e5664488142d4b01a2dce7a81ac3d44b31ee7.jpg) +Transformer (w/ Selective Attention) + +![](images/68a8f58a8012e3e7d6e52cb23859c7f25339730bdf58c6804d3d1a19eb8b2bec.jpg) +Transformer (w/ Vanilla Attention) + +![](images/b40ba6a53537678eea7248bf5581ff5975b378e62bf8a5a14039f25e830dd107.jpg) + +![](images/2f59fefc63d6226223f666004d559ad5dd4058947256e916625ef11577375213.jpg) + +![](images/ff1f3f925061928e412bc1c321a10e31114106df96a93f57958050102448736c.jpg) +Figure 8: The attention patterns (attention strength averaged across heads) for all layers of transformers with selective attention (left) and with vanilla attention (right). + +![](images/4e22c570146a7d41e8c55c491ce3023605c41f2d4180211d5985fddb67921f81.jpg) + +# A.12 ADDITIONAL FIGURES FOR CONTEXT PRUNING + +Figure 9 illustrates the values of the $F$ matrix averaged across 1,000 examples of length at least 512 from the C4 dataset. + +Figure 10 compares the values from Figure 9 to those obtained from a different training run (different random initialization and different data shuffle). While this isn't always the case, we sometimes observe stable sparsity patterns like those in this example, hinting at some general properties of language modeling on C4. + +Figure 11 illustrates the tokens that remain in the context buffer after pruning (as in Section 4) for the example text (see Appendix A.7), for a $d = 12$ model with selective attention, trained with the $\mathcal{L}_{mem}$ loss (Equation 2, $\epsilon = 0.1$ ), for a memory budget where the validation perplexity matches a transformer without selective attention. The per-layer memory budgets chosen by the pruning algorithm for this model are: [8, 48, 8, 8, 24, 8, 168, 16, 8, 64, 8, 8], leading to a memory saving factor of 16X. + +Figure 12 shows which tokens are pruned for the example text in Appendix A.7. + +![](images/079a69f630e40c9a700cd6434632f217b1953bf9d9a145464928eb3600805ea4.jpg) +Figure 9: Visualization of the $F$ matrix (greener is lower, i.e. less masking) for a $d = 12$ transformer averaged across 1,000 examples. + +![](images/36bac2fa4f5fda7d970e1c5915ad0dabc6fdf34ea48618ad8284b8b46a13f1ca.jpg) +Figure 10: Visualization of the $F$ matrix (greener/bluer is lower, i.e. less masking) for a $d = 12$ transformer averaged across 1,000 examples for two training runs (different random initialization, and different shuffle of the training data). While we only have anecdotal evidence, it is interesting that we sometimes observe these stable sparsity patterns across training runs. + +![](images/0576c000a3e1acee5b60a0475718729d7a69b722c776a4df29edba3139356047.jpg) +Figure 11: Visualization of the persisted elements for a $d = 12$ transformer for the text in Appendix A.7. The white pixels denote tokens removed from the context buffer as per Section 4. + +# Layer 0 + +The real problem with traditional dental v# #f# #s has ttle to do with how they function or their performance - who determine #s what a normal #f# #h f#d #f# #oing smile looks like to the real issue. a mea rience "image" as a standard place on #f# #h #f# #h #f# #h #f# #h for this period of time. + +# Layer 1 + +The real problem with traditional 4# #f#n is, as little as to with how they function or their performance who determine f##s what a normal. a normal. A #f#f #hatic #f#p #f#p #f#p #f#p #f#p #f#p #f#p #f#p #f#p #f#p #f#p #f#p #f#p #f#p #f#p #f#p #f#p #f#p #f#p #f#p #f#p #f#p #f#p #f#p #f#p #f# + +1. + +he picture in the street clearly it #just # rates what you be to be a well - constructed and healthy - looking street . The street pre # # is p 4 4 4 4 4 4 # #ling , you can do a de # f # # # # # # # # # # # # # # # # # # # # + +# + +# Layer 2 + +The real problem with traditional dental ve #h#s has ttle to wit hwo thc fomr performance. who determine #s what a normal #f#t# #h#d #h#i #p#o# #h#ing smile looks like to the real issue. americu struggle #d for decades with de #h# #hiring "image" as a standard placebo #n #h on #h #h #h #h #h #h for economic gain. the dan @her of this national o #h #h #h #h #h as become system #h fice 1742004 fashion magazine #h #hoped perfect #h as the standard to which we should #h s#h #h H#ds making made way into bread an H#p F#H #h and the definition of a d H#d oolino me car hving their buns and their teeth, people use their resources to c H#h F#H a false picture of their perfect "self." people make investments in the ten 100 dollars of that drhen #h F#H offite gate to the + +# Layer 3 + +The real problem with traditional dental vs #H# #frs has little to do with how they function or their performance - who determine #s what a normal, #f# #t #h# #f# #d F# #h# #f# #sming smile looks like in the real issue. America struggle #f# for decades as de # H# #f# "imge" "asmark a placebo #n #x en #f# #f# #f# #f# people #f#. f# #f# for emson th 146 f# h# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# d # #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f # f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# +the real problem with traditional dental vs #Hfrs has little to do with how they function or their performance - who determine #s what a normal, #f? t F## t F## t F## t F## t F## t F## t F## t F## t F## t F## t F## t F## t F## t F## t F## t F## t F## t F## t F## t F## t F## t F## t F## t F## t F## t F## t F## t F## t F## t F## t F## t F## t F## t F## + +# Layer 4 + +The real problem with traditional dental v# #f# #s has ttle to do with how they function or their performance - who determine #s what a normal , #f# # F#h #d F#o # #ing smile looks like to the real issue . americu struggle #f #e as the standard to which we should as F#o # #f #s . The effect of this in f# # #f #s #f #turing made their way into bread on F#p H# #s and the definition of a f#f /kmoolte smle . car #ong their bodies and their teeth , people use their resources to c F#o # # f #a false picture of their "perfect" self . people make investments in the thousands of dollars at their #f o f fice to get the #f o f fice . The idea of 'the best person' is that the person who has become the best person in a given time is "the best person" . k#n , d#fs discuss how he "samed the smile of a patient who was not content with her first set of p # F#o # #f #o f F#o # eve r F#o # 1 . 6 and f#o# t f #o f t for treatment of tooth number 15 , followed by a con F#o # f #o core bld - up . 2 period Fof . #fai therapy in both an the nF# # f Riege and reguiel upper to alloseptive thmial healb . 43 preparation of max i F#o #f ffeand placement of permanent restoration F#o . 50 placement of permanent restoration F#o . 60 replacing the rodtly F#o # f ffeand placement of permanent restoration F#o . 70 replacing the rodtly F#o # f ffeand placement of permanent restoration F#o . 80 replacing the rodtly F#o # f ffeand placement of permanent restoration F#o . 90 replacing the rodtly F#o # f ffeand placement of permanent restoration F#o . 100 replacing the rodtly F#o # f ffeand placement of permanent restoration F#o . 110 replacing the rodtly F#o # f ffeand placement of permanent restoration F#o . 120 replacing the rodtly F#o # f ffeand placement of permanent restoration F#o . 130 replacing the rodtly F#o # f ffeand placement of permanent restoration F#o . 140 replacing the rodtly F#o # f ffeand placement of permanent restoration F#o . 150 replacing the rodtly F#o # f ffeand placement of permanent restoration F#o . 160 replacing the rodtly F#o # f ffeand placement of permanent restoration F#o . 170 replacing the rodtly F#o # f ffeand placement of permanent restoration F#o . 180 replacing the rodtly F#o # f ffeand placement of permanent restoration F#o . 190 replacing the rodtly F#o # f ffeand placement of permanent restoration F#o . 200 replacing the rodtly F#o # f ffeand placement of permanent restoration F#o . 210 replacing the rodtly F#o # f ffeand placement of permanent restoration F#o . 220 replacing the rodtly F#o # f ffeand placement of permanent restoration F#o . 230 replacing the rodtly F#o # f ffeand placement of permanent restoration F#o . 240 replacing the rodtly F#o # f ffeand placement of permanent restoration F#o . 250 replacing the rodtly F#o # f ffeand placement of permanent restoration F#o . 260 replacing the rodtly F#o # f ffeand placement of permanent restoration F#o . 270 replacing the rodtly F#o # f ffeand placement of permanent restoration F#o . 280 replacing the rodtly F#o # f ffeand placement of permanent restoration F#o . 290 replacing the rodtly F#o # f ffeand placement of permanent restoration F#o . 300 replacing the rodtly F#o # f ffeand placement of permanent restoration F#o . 310 replacing the rodtly F#o # f ffeand placement of permanent restoration F#o . 320 replacing the rodtly F#o # f ffeand placement of permanent restoration F#o . 330 replacing the rodtly F#o # f ffeand placement of permanent restoration F#o . 340 replacing the rodtly F#o # f ffeand placement of permanent restoration F#o . 350 replacing the rodtly F#o # f ffeand placement of permanent restoration F#o . 360 replacing the rodtly F#o # f ffeand placement of permanent restoration F#o . 370 replacing the rodtly F#o # f ffeand placement of permanent restoration F#o . 380 replacing the rodtly F#o # f ffeand placement of permanent restoration F + +# Layer 5 + +The real problem with traditional dental ve #f# #frs has ttle to do with how they function or their performance . who gain #s a normal , #f# # f#h # F#d # F#d # F#d # F#d # F#d # F#d # F#d # F#d # F#d # F#d # F#d # F#d # F#d # F#d # F#d # F#d # F#d # F#d # F#d # F#d # F#d # F#d # F#d # F#d # F#d # F# + +# Layer 6 + +The real treatment with traditional dental ve #f#h s has to lio to how wth thc yor or performance hou do tive f#. what a normal #f#t# #f#d p#o# #f#d #f#d sming smile looks like to the reale. a mea rie 402176394217639421763942176394217639421763942176394217639421763942176394217639421763942176394217639421763942 + +# Layer 7 + +The real problem with traditional dental gay #H#o #Hs has ttle to do how they function or their performance. who determine Hs what a normal, # # #d # # H#o # F#d # H#o # # #ing smile looks like to the real issue. a mea rie 402 for decades with d # # #in "image" as a market + placebo en # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # +the real problem with traditional dental gay # H#o # Hs has become system f#k since the days of f#k H#o F#d fashion magazine F#d offers photo F#d hoped perfect #Ded as the standard to which we as H#o F#d. The effects of this f#d H#o F#d & H#o marketing is also being explored in the literature. For example, the article on page 13 of the book describes how de F#d fit that the "perfect" smile. This message has become so and even H#o F#d that people with nice smile Hs are co H#o F#d and even only a "perfect." H#o/Foodsmile is accept f#rable, one particularly relevant example of this is highlighted in a June 2015 article entitled " saving Ian H#" s smile. " q H#o n H#" k +k#, d Hs discuss f#do he "save" the smile of a patient who was not content with her first set of p#. H#o F#d e Vse H#o F#d ## . 1 and f#d O#t F#d refer for treatment of tooth number 15 , followed by a com F#do H#o F#d core build - up. 2 , period F#do. +f#d therapy in both the an F#do H#o F#d and region upper to achieve optimal tissue health. 4, preparation of max f#do H#o F#d teeth and placement of permanent restoration F#do. 5, placement of dental im F#do H#o F#d by the period F#do H#o F#d followed by preparation of man f#do H#o F#d /Fuliar teeth and placement of permanent restoration F#do. 6, repositioning the max f#do H#o F#d /Fuliar teeth and placement of permanent restoration F#do. 7, repositioning the min f#do H#o F#d /Fuliar teeth and placement of permanent restoration F#do. 8, the picture in the article clearly ill S F##nates what appears to be a well- constructed and healthy-looking smile: the entire pre F#do H#o F#d p F#do H#o F#d Zowhowshe's "be a good idea." How does da F#do H#o F#d promote " save " to enable a " T S C of the purpose " intended would lose to standard + +# Layer 8 + +The real problem with traditional dental care $\forall \# \# \# \# \# \# \# \# \# \# \# \# \# \# \# \# \# \# \# \# \# \# \# \# \# \# \# \# \# \# \# \# \# \# \# \# \# \# \# \# \# \# \# \# \# \# \# \# \# \# \text{的 他}$ has little to do with how they function or their performance. who determine $H\#s$ what a normal, #f#d #f f##h #f f##h #f f##h #f f##h #f f##h #f f##h #f f##h #f f##h #f f##h #f f##h #f f##h #f f##h #f f##h #f f##h #f f##h #f f##h #f f##h #f f##h #f f##h #f f##h #f f## h #f f##h #f f##h #f f##h #f f##h #f f##h #f f##h #f f##h #f f##h #f f##h #f f##h #f f##h #f f##h #f f##h #f f##h #f f##h #f f##h #f f##h #f f##h #f f##h #f f## + +# Layer 9 + +The real problem with the dental v# #f# #s has little to do with how they function or their performance. who determine #s what a normal #f# #f# #f# #f# #f# #f# #f# #f# #f# #f# #f# #f# #f# #f# #f# #f# #f# #f# #f# #f# #f# #f# #f# #f# #f# #f# #f# #f# #f# #f# #f# #f# #f# #f# f# #f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# f# + +# Layer 1 + +The real treatment with traditional dental ve #h# #frs has little to do with how they function or their performance. who determine #fs what a normal #f# #h# #f# #f# #f# #f# #f#sming looks like to the real issue. a mea rtrige 14 for decades with de # f# #inig " image" as a market place on #h #f# #f# #f# #f# #f# #f# economic gain, the dan #f# of this national o h# f#h# hossion has become system #f# since the days of f#f# f#f# #f# #f# fashion magazine #f# f#f# #f# f#f# #f# perfect #f#d on the standard to which we as f#f# #f# #f# the effects of this in f#h f#f# #f# #f# #f# marketing and advertising is becoming more important. The trend is that the dentists are now able to offer a service at the end of their day. + +# Layer 1 + +The real problem with traditional dental gay #H#o #Hs has ttle to do how they function or their performance. who determine Hs what a normal #f# #H#o #H#o #H#o #H#o #H#o #H#o #H#o #H#o #H#o #H#o #H#o #H#o #H#o #H#o #H#o #H#o #H#o #H#o #H#o #H#o #H#o #H#o #H#o #H#o #H#o #H#0 #H#o #H#o #H#o #H#o #H#o #H#o #H#o #H#o #H#o #H#o #H#o #H#o #H#o #H#o #H#o #H#o #H#o #H#o #H#o #H#o #H#o #H#o #H#o #H#o #H#O #H#o #H#o #H#o #H#o #H#o #H#o #H#o #H#o #H#o #H#o #H#o #H#o #H#o #H#o #H#o #H#o #H#o #H#o #H#o #H#o #H#o #H#o #H#o #H#o #H# + +Figure 12: A visualizing of the elements that are masked for the last (512th) token, for a $d = 12$ transformer for the text in Appendix A.7. We observe some interesting patterns, for example, layer 4 persists the end-of-sentence periods (""). + +# A.13 PARAMETER COUNTS + +Table 8 shows the actual parameter counts for models with different $ds$ (see Section 5). Note that selective attention does not add any extra parameters. + +Table 8: The number of model parameters for different values of $d$ as in Section 5. + +
dn_layersn_headsd_modelNumber of parameters
88851233,603,584
10101064059,699,200
12121276897,615,872
141414896149,666,048
1616161024218,226,688
1818181152305,717,760
2020201280414,387,200
2222221408546,641,920
2424241536704,950,272
2626261664891,468,032
28282817921,108,645,888
\ No newline at end of file diff --git a/ICLR/2025/Selective Attention Improves Transformer/images.zip b/ICLR/2025/Selective Attention Improves Transformer/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..2f4ee733be3d2670309ec29f3c25e50040062ae1 --- /dev/null +++ b/ICLR/2025/Selective Attention Improves Transformer/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3b2c6d24dedca6e1ea11a60d22999a1568438df936f18c818a93f4919a570aff +size 1005891 diff --git a/ICLR/2025/Selective Attention Improves Transformer/layout.json b/ICLR/2025/Selective Attention Improves Transformer/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..0e69f29287c8619cc35ae7735d58f6f1a6db86ed --- /dev/null +++ b/ICLR/2025/Selective Attention Improves Transformer/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:db9904519978144cb4a99d9575733c2db8dd14d4c7a66365b818b20a064df889 +size 620136 diff --git a/ICLR/2025/Selective Induction Heads_ How Transformers Select Causal Structures in Context/c66b6248-75f9-4d22-a583-04fa3b64edab_content_list.json b/ICLR/2025/Selective Induction Heads_ How Transformers Select Causal Structures in Context/c66b6248-75f9-4d22-a583-04fa3b64edab_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..eb021eb6376cd96ae9a4c65086177ba7b815a48b --- /dev/null +++ b/ICLR/2025/Selective Induction Heads_ How Transformers Select Causal Structures in Context/c66b6248-75f9-4d22-a583-04fa3b64edab_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0ee87f324430b32b915d55f7366bcf3cad0dc08f842afd96f07e22afb07bb7a5 +size 283606 diff --git a/ICLR/2025/Selective Induction Heads_ How Transformers Select Causal Structures in Context/c66b6248-75f9-4d22-a583-04fa3b64edab_model.json b/ICLR/2025/Selective Induction Heads_ How Transformers Select Causal Structures in Context/c66b6248-75f9-4d22-a583-04fa3b64edab_model.json new file mode 100644 index 0000000000000000000000000000000000000000..7405e8a40e60bdc906252e2988d5fb8601196ab8 --- /dev/null +++ b/ICLR/2025/Selective Induction Heads_ How Transformers Select Causal Structures in Context/c66b6248-75f9-4d22-a583-04fa3b64edab_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d5c8348f8498d92c906e05ed70d19a8b65cae12e895645214904fb0bd2be3d34 +size 309150 diff --git a/ICLR/2025/Selective Induction Heads_ How Transformers Select Causal Structures in Context/c66b6248-75f9-4d22-a583-04fa3b64edab_origin.pdf b/ICLR/2025/Selective Induction Heads_ How Transformers Select Causal Structures in Context/c66b6248-75f9-4d22-a583-04fa3b64edab_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..8c8f11d0bd334c82eed4702c5d5e2a9a6efdfa1b --- /dev/null +++ b/ICLR/2025/Selective Induction Heads_ How Transformers Select Causal Structures in Context/c66b6248-75f9-4d22-a583-04fa3b64edab_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c3c62de5b32f06ad576f82058d5760e08a7ca62086a6036cb8c76a3156144fba +size 6448314 diff --git a/ICLR/2025/Selective Induction Heads_ How Transformers Select Causal Structures in Context/full.md b/ICLR/2025/Selective Induction Heads_ How Transformers Select Causal Structures in Context/full.md new file mode 100644 index 0000000000000000000000000000000000000000..c13eb8d5dd84a14bfe7a78ccab8a9a530ad60efe --- /dev/null +++ b/ICLR/2025/Selective Induction Heads_ How Transformers Select Causal Structures in Context/full.md @@ -0,0 +1,1001 @@ +# SELECTIVE INDUCTION HEADS: HOW TRANSFORMERS SELECT CAUSAL STRUCTURES IN CONTEXT + +Francesco D'Angelo,\* Francesco Croce & Nicolas Flammarion + +Theory of Machine Learning Lab, EPFL, Lausanne, Switzerland + +# ABSTRACT + +Transformers have exhibited exceptional capabilities in sequence modelling tasks, leveraging self-attention and in-context learning. Critical to this success are induction heads, attention circuits that enable copying tokens based on their previous occurrences. In this work, we introduce a novel synthetic framework designed to enable the theoretical analysis of transformers' ability to dynamically handle causal structures. Existing works rely on Markov Chains to study the formation of induction heads, revealing how transformers capture causal dependencies and learn transition probabilities in-context. However, they rely on a fixed causal structure that fails to capture the complexity of natural languages, where the relationship between tokens dynamically changes with context. To this end, our framework varies the causal structure through interleaved Markov chains with different lags while keeping the transition probabilities fixed. This setting unveils the formation of Selective Induction Heads, a new circuit that endows transformers with the ability to select the correct causal structure in-context. We empirically demonstrate that attention-only transformers learn this mechanism to predict the next token by identifying the correct lag and copying the corresponding token from the past. We provide a detailed construction of a 3-layer transformer to implement the selective induction head, and a theoretical analysis proving that this mechanism asymptotically converges to the maximum likelihood solution. Our findings advance the theoretical understanding of how transformers select causal structures, providing new insights into their functioning and interpretability. + +# 1 INTRODUCTION + +As autoregressive generative models continue to scale and are increasingly deployed in real-world applications, the question of how Transformer models (Vaswani et al., 2017) function internally becomes pressing. Yet the inherent complexity of natural language hinders the ability to fully comprehend how these models make decisions and work internally. To address this challenge, many recent works have attempted to formulate synthetic frameworks that simplify the problem and enable theoretical analysis while still capturing the remarkable properties and phenomena observed in large language models, such as in-context learning (Brown, 2020; Garg et al., 2022; Bai et al., 2024; Von Oswald et al., 2023a; Sander et al., 2024). Mechanistic interpretability (Olsson et al., 2022) emerges as a line of research focused on reverse-engineering the complex computations performed inside a transformer in order to understand how a certain output is produced for a given input. This research has uncovered the formation of induction heads (Olsson et al., 2022) i.e., interpretable circuits embedded within the transformer's weights, capable of simple operations such as copying tokens. By examining such circuits and their combinations, one can understand the algorithms that transformers implement to solve a given task. For instance, (Nichani et al., 2024; Bietti et al., 2024; Edelman et al., 2024) demonstrated that induction heads enable transformers to implement in-context bigrams for next-token predictions in Markov Chains. Such mechanisms are not limited to simplified models: Nguyen (2024) showed that transformers may rely on N-gram rules even in natural language processing. Yet the process by which transformers select between such learned rules remains poorly understood. While in-context learning studies how transformers solve tasks from demonstrations in the prompt, in-context selection focuses on how transformers + +![](images/a1c46afd5a579104cf7c0352c5057f0d0cdb52d3d2a62cf56e9c94200788f14e.jpg) +Figure 1: Summary of the framework. Top: we define a new task based on Interleaved Markov Chains of different lags ( $k = 1$ and $k = 2$ in the example). Middle: given a sequence generated from a chain of unknown lag, the model has to identify the true lag, and use it to predict the distribution of the next token. Bottom: attention-only transformers can solve this task with 3 layers. The first computes the transition probabilities for each lag seen during training, the second aggregates these probabilities over the entire past, and finally the third layer implements the selective induction head, which selects the correct lag. + +select the most suitable approach to solve a given task from those encountered during training, using instances present in the context. For example, Bai et al. (2024) examines how transformers perform in-context algorithm selection when pre-trained on mixtures of linear and logistic regression with different noise. Similarly, Yadlowsky et al. (2023) studied the ability of transformers to perform model selection between different function class families. Our work takes another step toward understanding this selection process, leveraging Markov chains with different causal structures. + +In-context causal structure selection. Recently, Markov chains have been employed to formulate interesting sequence-to-sequence tasks that can be solved by transformers with interpretable solutions (Ildiz et al., 2024; Nichani et al., 2024; Makkuva et al., 2024; Edelman et al., 2024). In particular, Nichani et al. (2024) show that transformers trained on Markov Chain sequences learn circuits that capture the causal structure, i.e., the set of parent tokens for each token in the sequence and estimate transition probabilities in-context. The existing works relying on Markov chains, fail to model the nuanced relationships typical of natural language. The same word pair can have different causal relationships depending on the surrounding context. While an effective model should recognize these contextual dependencies, previous research has overlooked this consideration by adopting fixed causal structures. To address this limitation, we propose a new synthetic task designed to mimic different causal dependencies (Sec. 3). We consider Interleaved Markov Chains, with fixed transition probabilities between states but different underlying causal structures (Fig. 1), and theoretically study how 3-layers attention-only transformers learn to correctly predict the next token in a sequence. + +Selective induction heads. To solve the task at hand—correctly predicting the next token in-context in a sequence generated within this setup (middle of Fig. 1)—transformers need to learn a circuit that adapts to the given context to select the correct causal structure among those seen during training. We call this circuit a selective induction head, as it differs fundamentally from the induction heads introduced so far in the literature, where the circuit learns either to copy a token from a certain position fixed by the unique structure of the data or by comparing its semantics. In our task, the transformer (with attention maps depicted in Fig. 1) needs to learn to aggregate all past information to determine from which past position the corresponding token should be copied in order to predict the next token. + +A transformer construction for in-context selection. To understand and formalize the selective heads, we provide an interpretable construction of the self-attention layer weights in a 3-layer attention-only disentangled transformer (Friedman et al., 2023) that implements this mechanism + +(Sec. 4). We empirically demonstrate that the constructed transformer matches the performance of both disentangled and standard transformed trained from scratch (Sec. 5) and that 2-layer attention-only transformers cannot solve the task. Moreover, we observe that the attention maps of the trained and constructed transformers present the same patterns, further supporting the validity of our algorithm. Finally, we theoretically analyze the predictor implemented by this construction (Sec. 4.3) showing that, in certain cases, it asymptotically converges to the maximum likelihood solution. Our findings provide insights into the mechanisms by which transformers perform model selection. + +We defer to the appendix a discussion of related works (App. A), additional theoretical analyses, omitted proofs (App. B), extra experiments (Apps. D, F, C), and generalizations of our transformer construction (Apps. H, I, J). + +# 2 (DISENTANGLED) TRANSFORMER MODELS + +In the following we introduce the necessary background and notation about the models we use later. + +Transformers. The architecture of decoder-only transformers is built on two fundamental components, the attention mechanism and the multi-layer perceptron (MLP). Given a finite alphabet $S$ , transformers map an input sequence $s = s_{1:T} = (s_1,\dots ,s_T)\in S^T$ to a sequence of vectors $z = (z_{1},\ldots ,z_{T})$ where $z_{i}\in \mathbb{R}^{d}$ . Each element of the input sequence $s_i$ is first encoded using its corresponding one-hot vector, $e_{s_i}\in 0,1^{|S|}$ . These one-hot representations are then mapped to $d$ -dimensional vectors via an embedding matrix $E\in \mathbb{R}^{d\times |S|}$ . To incorporate positional information, a positional embedding matrix $F\in \mathbb{R}^{d\times T}$ is added. With a slight abuse of notation, let $e_i$ denote the $i$ -th element of the canonical basis of $\mathbb{R}^T$ such that each input element $s_i$ is mapped to a vector $x_{i}\in \mathbb{R}$ via $x_{i} = Ee_{s_{i}} + Fe_{i}$ . The information of the different tokens is then mixed by the causal self-attention heads: denoting the key, query and value matrices $K,Q\in \mathbb{R}^{d\times d_{QK}}$ , $V\in \mathbb{R}^{d\times d}$ , and given an input $h\in \mathbb{R}^{d\times T}$ , one gets + +$$ +\operatorname {A t t n} (h; Q, K) := \mathcal {A} (h; Q, K) h ^ {\top}, \quad \text {w i t h} \quad \mathcal {A} (h; Q, K) := \operatorname {S o f t m a x} \left(\mathcal {M} (h ^ {\top} Q K ^ {\top} h); \alpha\right), +$$ + +where $\operatorname{Softmax}(v; \alpha)_i := \frac{\exp(v_i / \alpha)}{\sum_j \exp(v_j / \alpha)}$ is applied row-wise and $\alpha > 0$ is a temperature parameter. In the following, we call $A = QK^{\top} \in \mathbb{R}^{d \times d}$ the attention matrix, $\mathcal{A} \in \mathbb{R}^{T \times T}$ the attention, and $\mathrm{Attn}: \mathbb{R}^{d \times T} \to \mathbb{R}^{d \times T}$ the attention layer. The causality of the self-attention is enforced by a mask $\mathcal{M}$ , to prevent the model from attending to future tokens, i.e. $\mathcal{M}(A)_{ij} = A_{ij}$ if $i \geq j$ , $-\infty$ otherwise. For a model with $L$ layers and $\{H_l\}_{l \in [L]}$ attention heads per layer, we denote by $Q^{(l,h)}, K^{(l,h)}, V^{(l,h)}$ the attention parameters for the $i$ -th head in the $l$ -th layer, $W_1^{(l)}, W_2^{(l)} \in \mathbb{R}^{d \times d_{\mathrm{FF}}}$ the parameters of the MLP at layer $l$ , and $W_O \in \mathbb{R}^{|S| \times d}$ the parameters of the output linear layer. Then, with $h^{(0)} = (x_1, \ldots, x_T) \in \mathbb{R}^{d \times T}$ as computed above, the decoder transformer $\mathcal{T}(s_{1:T})$ can be written for $l = 1, \ldots, L$ , as + +$$ +\hat {h} ^ {(l)} = h ^ {(l - 1)} + \sum_ {h = 1} ^ {H _ {l}} \operatorname {A t t n} (h ^ {(l - 1)}; Q ^ {(l, h)}, K ^ {(l, h)}) V ^ {(l, h)}, \quad h ^ {(l)} = \hat {h} ^ {(l)} + W _ {2} ^ {(l)} \sigma \left(W _ {1} ^ {(\ell) \top} \hat {h} ^ {(l)}\right) +$$ + +where the output is given by $W_{O}h^{(L)}\in \mathbb{R}^{|S|\times T}$ + +Disentangled Transformers. To improve the interpretability of the operations implemented by the models, Friedman et al. (2023) propose a transformer architecture in which each layer's output is concatenated, rather than added, to its input. This construction makes the residual stream explicitly disentangled, but increases the embedding dimension (constant for standard transformers) with depth. Additionally, in such disentangled transformers the MLP layers are removed, the attention heads are parameterized by a single matrix $\tilde{A} \coloneqq QK^{\top} \in \mathbb{R}^{d_{\ell} \times d_{\ell}}$ , and the value matrices are absorbed into the output layer $\widetilde{W}_O$ . Both the token and positional embedding are one-hot encoding, i.e. $E$ and $F$ are identity matrices, and we encode the input $s_i$ as $[e_{s_i}, e_i]$ via concatenation rather than addition. Altogether, the disentangled transformer $\widetilde{\mathcal{T}}(s_{1:T})$ is formalized for $l = 1, \ldots, L$ as + +$$ +\hat {h} ^ {(l, h)} = \operatorname {A t t n} \left(h ^ {(l - 1)}; \tilde {A} ^ {(l, h)}\right) \quad \text {f o r} \quad h = 1, \dots , H _ {l}, \quad \text {a n d} \quad h ^ {(l)} = \left[ h ^ {(l - 1)}, \hat {h} ^ {(l, 1)}, \dots , \hat {h} ^ {(l, H _ {l})} \right], +$$ + +where the outputs is $\widetilde{W}_O h^{(L)}$ . Due to the concatenation, the embedding dimensions grows over layers as $d_{l} = (1 + H_{l}) \cdot d_{l-1}$ with $d_{0} = |\mathcal{S}| + T$ . Importantly, Nichani et al. (2024) demonstrate that disentangled transformers are equivalent to standard transformers using only attention layers. + +# 3 MARKOV CHAINS AND CAUSAL STRUCTURE SELECTION + +To address the limitations of existing synthetic settings based on Markov chains and better capture the complexity of natural language, we propose a novel framework. In this framework, the model must learn to select the correct causal structure in-context in order to solve the task and generate the input sequence. In the following, we describe this task in detail and outline its solution. + +Interleaved Markov Chains. The framework consists of sequences of length $T$ on a finite alphabet of tokens $S$ , generated by $K$ distinct sources. Let $\mathcal{U} = \{U_1, \ldots, U_K\}$ be the set of sources and $\mathcal{K} = \{k_1, \ldots, k_K\}$ a set of positive integers; each source $U_j$ consists of $k_j$ interleaved and identical irreducible aperiodic Markov chains (Batu et al., 2004; Minot & Lu, 2014). All the sources are defined by the same transition matrix $P^{\star} \in \mathcal{P}^{|\mathcal{S}| \times |\mathcal{S}|}$ , where $\mathcal{P}$ is the set of row-stochastic matrices. This model is equivalent to a time-homogeneous Markov chain $(X_t^{(j)})_{t \geq 0}$ of order $k_j$ , whose transition probabilities depend only on a single state $k_j$ steps back: + +$$ +\mathbb {P} (X _ {t} = s _ {t} \mid X _ {t - 1} = s _ {t - 1}, \ldots , X _ {1} = s _ {1}) = \mathbb {P} (X _ {t} = s _ {t} \mid X _ {t - k _ {j}} = s _ {t - k _ {j}}) = s _ {t - k _ {j}} ^ {\top} P ^ {\star} s _ {t}. +$$ + +Here, we call $k_{j} \in \mathcal{K}$ the lag parameter, as defined by Berchtold & Raftery (2002), where $\mathcal{K} \subseteq [[1, t]]$ is the set of possible lags. The lag, represented by the edges in Fig. 1, encodes the causal structure by explicitly representing the causal relationship between the variables in the Markov chain. + +Data. Given $P^{\star}$ and $\mathcal{K}$ , a lag is uniformly sampled from $\mathcal{K}$ for each sequence. Denoting the maximum lag by $\hat{k} = \max(\mathcal{K})$ , the first $\hat{k}$ elements of each sequence are sampled from the stationary distribution $\pi$ of $P^{\star}$ , ensuring a constant number of independent variables for all sources. The likelihood of a sequence of lag $k$ is $\mathbb{P}(X_1, \ldots, X_T \mid k) = \prod_{i=1}^{k} \pi(X_i) \prod_{j=\hat{k}+1}^{T} \mathbb{P}(X_j \mid X_{j-k+1})$ . + +Task. In this setting, the task is to predict the next state $s_{T + 1}$ given an input sequence $s_{1:T}$ generated from one of the sources, sampled at random. However, the identity of the source, and therefore the lag, is unknown. This task amounts to solving the following minimization problem: + +$$ +f ^ {\star} = \inf _ {f} \mathbb {E} _ {\substack {k \sim \operatorname {Unif}[1, \dots , \hat {k} ] \\ \left(X _ {1: T}\right) \sim \mathbb {P} \left(X _ {1}, \dots , X _ {T} \mid k\right)}} \mathcal {D} _ {K L} \left(\mathbb {P} \left(X _ {t + 1} \mid X _ {t - k + 1}\right) \| f \left(X _ {1}, \dots , X _ {T}\right)\right), \tag{1} +$$ + +where $\mathcal{D}_{KL}$ is the Kullback-Leibler divergence. Eq. (1) admits a closed form solution which is the Bayesian model average (BMA), defined as the average of the transition probabilities for each lag, weighted by their posterior probabilities: + +$$ +\mathbb {P} (X _ {t + 1} \mid X _ {1: T}) = \sum_ {k \in \mathcal {K}} w _ {k} (X _ {1: T}) \mathbb {P} (X _ {t + 1} \mid X _ {t - k + 1}) \text {w i t h} w _ {k} (X _ {1: T}) = \frac {\mathbb {P} (X _ {1 : T} \mid k) \mathbb {P} (k)}{\sum_ {k \in \mathcal {K}} \mathbb {P} (X _ {1 : T} \mid k) \mathbb {P} (k)}. +$$ + +Asymptotically, the posterior distribution concentrates around the maximum likelihood (ML) estimate (Rousseau & Mengersen, 2011). Let $k^*$ be the lag that maximizes the likelihood for a sequence $(s_1, \ldots, s_T)$ , i.e., $k^* = \arg \max_{k \in \mathcal{K}} \mathbb{P}(X_1 = s_1, \ldots, X_T = s_T \mid k)$ . As $T \to \infty$ , the posterior probability $w_k$ converges to 1 for $k^*$ and to 0 for the other lags, i.e., $w_k \to \mathbb{1}[k = k^*]$ where $\mathbb{1}$ is the indicator function. Then, BMA reduces to selecting the lag with the highest likelihood: + +$$ +\mathbb {Q} \left(X _ {t + 1} \mid X _ {1}, \dots , X _ {T}\right) = \sum_ {k \in \mathcal {K}} \mathbb {1} [ k = k ^ {*} ] \mathbb {P} \left(X _ {t + 1} \mid X _ {t - k + 1}\right). \tag {2} +$$ + +It is important to note that an interleaved Markov chain of lag $k$ is mathematically equivalent to a $k$ -th order Markov chain with a specific transition structure. Thus, given a set of orders $\mathcal{K}$ and a sequence generated according to one such order, one could theoretically solve the task by learning in-context the corresponding $(\hat{k} + 1)$ -gram transition probabilities (Nichani et al., 2024; Edelman et al., 2024). However, such an approach fails to leverage the low-dimensional structure of the problem, resulting in a suboptimal sample complexity of $\mathcal{O}(|S|^{\hat{k} + 1})$ . + +# 4 HOW CAN TRANSFORMER DO IN-CONTEXT SELECTION? + +We now want to understand which algorithm transformers learn during training. We focus on disentangled transformers as defined in Sec. 2, which allow for a more interpretable analysis of the model internal computations. The following proposition, which is the main result of the paper, shows how a disentangled transformer can implement a predictor to solve the in-context selection task. + +Proposition 1. Let $\mathcal{K}$ be a contiguous subset of integers, i.e., $\mathcal{K} = [[\hat{k} - K + 1, \hat{k}]]$ for $K = |\mathcal{K}|$ and $\hat{k} = \max(\mathcal{K})$ . For any $T \geq \hat{k}$ there exists a three-layer disentangled transformer $\widetilde{\mathcal{T}}$ with $K$ heads in the second layer such that, defining $\tilde{p}_{i,k} := \frac{X_{i-k}^{\top} P^{*} X_{i}}{\sum_{j \in \mathcal{K}} X_{j-k}^{\top} P^{*} X_{j}}$ for $i > 1$ : + +$$ +\widetilde {\mathcal {T}} \left(X _ {1: T}\right) _ {T} = \sum_ {k \in \mathcal {K}} \tilde {w} _ {k} \left(X _ {1: T}\right) \mathbb {P} \left(X _ {t + 1} \mid X _ {t - k + 1}\right) \text {w i t h} \tilde {w} _ {k} \left(X _ {1: T}\right) = \frac {\exp \left(\frac {\beta}{(T - \hat {k})} \sum_ {i = \hat {k} + 1} ^ {T} \tilde {p} _ {i , k}\right)}{\sum_ {m \in \mathcal {K}} \exp \left(\frac {\beta}{(T - \hat {k})} \sum_ {i = \hat {k} + 1} ^ {T} \tilde {p} _ {i , m}\right)}. \tag {3} +$$ + +The predictor implemented by transformers in Eq. (3) resembles BMA but differs in how it aggregates past information. Instead of using the posterior of each model as in BMA, our method employs weights proportional to the exponential of the average of normalized transition probabilities $\tilde{p}_{i,k}$ . We analyze this predictor in Sec. 4.3 and discuss its convergence to ML. Proposition 1 illustrates how, for large $\beta$ , transformers can implement selective induction heads, a mechanism that adapts to the input sequence by copying the token correspondent to the lag that maximizes the average normalized transition probabilities. The proof of Proposition 1, involves an explicit construction for the weights of the disentangled transformer implementing the solution in Eq. (3) (an alternative third layer in App. H). Notably, this construction produces attention maps similar to those in standard transformers (Fig. 1), suggesting our algorithm aligns with trained transformer implementations. + +# 4.1 PROOF OF PROPOSITION 1: CONSTRUCTION FOR CONTIGUOUS LAGS + +To aid intuition, we use a running example with visual illustrations for $T = 10$ , $\mathcal{K} = \{1,2,3\}$ . We recall that each input element $s_i$ is encoded as $h_i^{(0)} = [e_{s_i}, e_i] \in \{0,1\}^{|S| + T}$ . + +First layer: extraction of transition probabilities. The first attention matrix, $\tilde{A}^{(1)}$ , consists of two blocks: the first block operates on the semantic component of the input tokens, learning the transpose of the logarithm of the transition matrix. The second block $A^{(1)}$ learns the causal relationships induced by each possible lag $s_{i - k}\rightarrow s_i$ for $k\in \mathcal{K}$ : + +$$ +\widetilde {A} ^ {(1)} = \left( \begin{array}{c c} \log P ^ {\top} & 0 \\ 0 & A ^ {(1)} \end{array} \right) +$$ + +$$ +A _ {i j} ^ {(1)} = \left\{ \begin{array}{l l} + \lambda & \text {i f} \quad i - j \in \mathcal {K} \\ - \lambda & \text {i f} \quad i - j \not \in \mathcal {K}. \end{array} \right. +$$ + +$$ +A ^ {(1)} = \left( \begin{array}{c c c c c c c c c c} - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ + \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ + \lambda & + \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ + \lambda & + \lambda & + \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & + \lambda & + \lambda & + \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & + \lambda & + \lambda & + \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda & + \lambda & + \lambda & + \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda & - \lambda & + \lambda & + \lambda & + \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & + \lambda & + \lambda & + \lambda & + \lambda \end{array} \right) +$$ + +We can compute the first layer's attention as: $[e_{s_i}, e_i]^\top \tilde{A}^{(1)}[e_{s_j}, e_j] = (\log P)_{s_j, s_i} + \lambda \mathrm{sign}(A_{ij}^{(1)})$ , and applying the softmax $(\alpha = 1)$ : $\mathcal{A}^{(1)}(h_{1:T}^{(0)}; \tilde{A}^{(1)})_{ij} = \frac{e^{(\log P)s_j,s_i + \lambda \mathrm{sign}(A_{ij}^{(1)})}}{\sum_{r \in \mathcal{K}} e^{(\log P)s_r,s_i + \lambda} + \sum_{r \notin \mathcal{K}} e^{(\log P)s_r,s_i - \lambda}}$ . For $\lambda \to \infty$ (in practice, for $\lambda$ large enough) and denoting $\tilde{p}_{i,k} := \frac{P_{s_i - k,s_i}}{\sum_{r \in \mathcal{K}, r < i} P_{s_i - r,s_i}}$ for $i > 1$ , + +$$ +\lim _ {\lambda \to \infty} \mathcal {A} ^ {(1)} (h _ {1: T} ^ {(0)}; \tilde {A} ^ {(1)}) _ {i j} = \left\{ \begin{array}{c l} \tilde {p} _ {i, i - j} & \text {i f} i - j \in \mathcal {K} \\ 1 & \text {i f} i = j = 1 \\ 0 & \text {e l s e w h e r e .} \end{array} \right. +$$ + +Therefore, the output at index $i$ after the first layer corresponds to a weighted average of the past tokens $h_{i-k}^{(0)}$ for $k \in \mathcal{K}$ where the weights are given by the normalized probabilities $\tilde{p}_{i,k} \colon \hat{h}_i^{(1)} = \mathrm{Attn}(h_{1:T}^{(0)}; \tilde{A}^{(1)})_i = \sum_{k \in \mathcal{K}, k < i} \tilde{p}_{i,k} h_{i-k}^{(0)}$ for $i > 1$ and $h_1^{(0)}$ for $i = 1$ . With the input vectors $h_i^{(0)}$ being the concatenation of the one-hot encoding of the state and position $[e_{s_i}, e_i]$ , the first $|\mathcal{S}|$ entries of $\hat{h}_i^{(1)}$ correspond to $\tilde{s}_i = \sum_{k \in \mathcal{K}, k < i} \tilde{p}_{i,k} e_{s_i - k}$ for $i > 1$ and $\tilde{s}_1 = e_{s_1}$ . The remaining entries, due to the non-overlapping positional encodings, directly copy the normalized transition probabilities for the transition $s_{i-k} \rightarrow s_i$ into the $|\mathcal{S}| + (i-k)$ -th element of $\hat{h}_i^{(1)}$ . To build intuition, we refer to the example in Eq. (12) where the colors highlight transition probabilities of the same lag: + +$$ +\mathcal {A} ^ {(1)} = \left( \begin{array}{c c c c c c c c c c} 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ \bar {p} _ {3, 2} & \bar {p} _ {2, 1} & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ \bar {p} _ {4, 3} & \bar {p} _ {4, 2} & \bar {p} _ {4, 1} & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & \bar {p} _ {5, 3} & \bar {p} _ {5, 2} & \bar {p} _ {5, 1} & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & \bar {p} _ {6, 3} & \bar {p} _ {6, 2} & \bar {p} _ {6, 1} & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & \bar {p} _ {7, 3} & \bar {p} _ {7, 2} & \bar {p} _ {7, 1} & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & \bar {p} _ {8, 3} & \bar {p} _ {8, 2} & \bar {p} _ {8, 1} & \bar {p} _ {8, 1} & \bar {p} _ {9, 1} \\ 0 & 0 & 0 & 0 & 0 & p _ {9, 3} & p _ {9, 2} & \bar {p} _ {9, 1} & \bar {p} _ {1 0, 3} \\ 0 & 0 & 0 & 0 & 0 & \bar {p} _ {1 0, 3} & \bar {p} _ {1 0, 2} & \bar {p} _ {1 0, 1} \end{array} \right) \hat {h} ^ {(1)} = \left( \begin{array}{c c c c c c c c c c} s _ {1} & s _ {2} & s _ {3} & s _ {4} & s _ {5} & s _ {6} & s _ {7} & s _ {8} & s _ {9} & s _ {1 0} \\ 1 & 1 & \bar {p} _ {3, 2} & \bar {p} _ {4, 3} & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & \bar {p} _ {3, 1} & \bar {p} _ {4, 2} & \bar {p} _ {5, 3} & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & \bar {p} _ {4, 1} & \bar {p} _ {5, 2} & \bar {p} _ {6, 3} & 0 & 0 & 0 \\ 0 & 0 & 0 & \bar {p} _ {5, 1} & \bar {p} _ {6, 2} & \bar {p} _ {7, 3} & 0 & 0 & 0 \\ 0 & 0 & 0 & \bar {p} _ {\text {空}} ^ {\prime } (1) ^ {\prime } (2) ^ {\prime } (3) ^ {\prime } (4) ^ {\prime } (5) ^ {\prime } (6) ^ {\prime } (7) ^ {\prime } (8) ^ {\prime } (9) ^ {\prime } (1) ^ {\prime } (2) ^ {\prime } (3) ^ {\prime } (4) ^ {\prime } (5) ^ {\prime } (6) ^ {\prime } (7) ^ {\prime } (8) ^ {\prime } (9) ^ {\prime } (1) ^ {\prime } (2) ^ {\prime } (3) ^ {\prime } (4) ^ {\prime } (5) ^ {- - } (7) ^ {- - } (8) ^ {- - } (9) ^ {- - } (1) ^ {- - } (2) ^ {- - } (3) ^ {- - } (4) ^ {- - } (5) ^ {- - } (7) ^ {- - } (8) ^ {- - } (9) ^ {- - } (1) ^ {- - } (2) ^ {- - } (3) ^ {- - } (4) ^ {- - } (5) ^ {- - } (7) ^ {- - } (8) ^ {- - } (9) ^ {- - } (1) ^ {- - } (2) ^ {- - } (\text {空}) ^ {- - } (\text {空}) ^ {- - } (\text {空}) ^ {- - } (\text {空}) ^ {- - } (\text {空}) ^ {- - } (\text {空}) ^ {- - } (\text {空}) ^ {- - } (\text {空}) ^ {- - } (\text {空}) ^ {- - } (\text {空}) ^ {- - } (\text {空}) ^ {- - } (\text {空}) \end{array} \right) +$$ + +The operation of the first layer is now explicit: for each token $h_i^{(0)}$ , it extracts the normalized transition probabilities $\tilde{p}_{i,k}$ for each possible lag and stores them in the element $\hat{h}_{i,S + T - k}^{(1)}$ . The resulting vector is subsequently concatenated to the residual stream to be fed to the second layer. + +Second layer: aggregation of transition probabilities. To predict the next token, the model needs to determine which lag generated the sequence based on the past transitions. This selection requires aggregating the normalized transition probabilities from the past, and storing them in the embedding of the current token. However, since consecutive tokens store transition probabilities in overlapping positions, the attention needs to learn a convex combination of tokens that avoid mixing information from different transitions while maximizing the number of $\tilde{p}$ stored (to not discard useful information). For instance, when aggregating the past for the token at $i = 10$ in Eq. (12), summing $\hat{h}_{9}^{(1)}$ and $\hat{h}_{10}^{(1)}$ would mix $\tilde{p}_{10,2}$ and $\tilde{p}_{9,1}$ together. This mixing can be avoided, for example, by only selecting tokens every 3 steps $(\hat{h}_{4}^{(1)},\hat{h}_{7}^{(1)},\hat{h}_{10}^{(1)})$ copying transitions without blending information. More generally, the attention $\mathcal{A}^{(2,1)}$ should attend to every $K$ -th token from the current one, which is equivalent to having non-zero entries along the diagonals at positions $nK$ for $n\in \mathbb{N}$ and $nK < T$ . This structure can be enforced by constructing the attention matrix $\tilde{A}^{(2,1)}$ with a single non-zero block operating on the tokens' positional encoding, as follows: + +$$ +\tilde {A} ^ {(2, 1)} = \left( \begin{array}{c c c c} 0 & 0 & 0 \\ 0 & A ^ {(2, 1)} & 0 \\ - & 0 & 0 \end{array} \right) A ^ {(2, 1)} = \left( \begin{array}{c c c c c c c c c c c} - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda & + \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda & - \lambda & + \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda & - \lambda & + \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda & + \lambda & - \lambda & + \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda & - \lambda & + \lambda & - \lambda & + \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda & + \lambda & - \lambda & + \lambda & + \lambda & + \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda & - \lambda & + \lambda & - \lambda & - \lambda & + \lambda & + \lambda \\ - \lambda & - \lambda & - \lambda & + \lambda & - \lambda & + \lambda & + \lambda & + \lambda & + \lambda \end{array} \right) A ^ {(2, 1)} = \left( \begin{array}{c c c c c c c c c c} 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 1 \\ 0 & 0 & 0 & 1 / _ {2} & 0 & 0 \\ 0 & 0 & 0 & 1 / _ {2} & 0 / _ {2} \\ 0 & 0 & 0 & 1 / _ {2} \\ 0 & 0 & 0 & 1 / _ {2} \\ 0 & 0 & 1 / _ {3} \\ 0 & 1 / _ {3} \\ 0. 5 / _ {3} \\ 1 / _ {3} \\ 1 / _ {3} \\ 1 / _ {3} \\ 1 / _ {3} \\ 1 / _ {3} \\ 1 / _ {3} \\ 1 / _ {3} \\ 1 / _ {3} \\ 1 / _ {3} \\ 1 / _ {3} \\ 1 / _ {3} \\ 1 / _ {3} \\ 1 / _ {4} \\ 1 / _ {4} \\ 1 / _ {4} \\ 1 / _ {4} \\ 1 / _ {4} \\ 1 / _ {4} \\ 1 / _ {4} \\ 1 / _ {4} \\ 1 / _ {4} \\ 1 / _ {4} \\ 1 / _ {4} \\ 1 / _ {4} \\ 1 / _ {4} \\ 2 / _ {4} \\ 2 / _ {4} \\ 2 / _ {4} \\ 2 / _ {4} \\ 2 / _ {4} \\ 2 / _ {4} \\ 2 / _ {4} \\ 2 / _ {4} \\ 2 / _ {4} \\ 2 / _ {4} \\ 2 / _ {4} \\ 2 / _ {4} \\ 2 / _ {5} \\ 2 / _ {5} \\ 2 / _ {5} \\ 2 / _ {5} \\ (2) (3) (4) (5) (6) (7) (8) (9) (1) (2) (3) (4) (5) (6) (7) (8) (9) (1) (2) (3) (4) (5) (6) (7) (8) (9) (1) (2) (3) (4) (5) (6) (7) (8) +$$ + +where the first $\hat{k}$ rows and columns are empty because the first $\hat{k}$ elements of the sequence are sampled independently from the stationary distribution and therefore not informative. This construction resolves the issue of overlapping transitions, but copying only a subset of tokens implies losing information from the excluded $\hat{h}_i$ . Introducing additional attention heads $\tilde{A}^{(2,2)},\ldots ,\tilde{A}^{(2,H_2)}$ with the same form as $\tilde{A}^{(2,1)}$ above overcomes this limitation. The resulting attentions $\mathcal{A}^{(2,2)},\ldots \mathcal{A}^{(2,H_2)}$ still follow a diagonal structure as $\mathcal{A}^{(2,1)}$ to avoid overlapping transitions, but they are shifted to copy different tokens. For the given example, we can design $A^{(2,2)}$ as in Eq. (5) to attend to $\hat{h}_{9}^{(1)}$ and $\hat{h}_{6}^{(1)}$ , and similarly, construct $A^{(2,3)}$ for $\hat{h}_{8}^{(1)}$ and $\hat{h}_{5}^{(1)}$ : + +$$ +A ^ {(2, 2)} = \left( \begin{array}{l l l l l l l l l l} \lambda & \lambda & \lambda & \lambda & \lambda & \lambda & \lambda & \lambda & \lambda & \lambda \\ \lambda & \lambda & \lambda & \lambda & \lambda & \lambda & \lambda & \lambda & \lambda & \lambda \\ \lambda & \lambda & \lambda & \lambda & \lambda & \lambda & \lambda & \lambda & \lambda & \lambda \\ \lambda & \lambda & \lambda & \lambda & \lambda & \lambda & \lambda & \lambda & \lambda & \lambda \\ \lambda & \lambda & \lambda & + \lambda & \lambda & \lambda & \lambda & \lambda & \lambda & \lambda \\ \lambda & \lambda & \lambda & - \lambda & + \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ \lambda & \lambda & \lambda & - \lambda & - \lambda & + \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ \lambda & \lambda & \lambda & - \lambda & - \lambda & + \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ \lambda & \lambda & - \lambda & + \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ \lambda & - \lambda & - \lambda & - \lambda & - \lambda & + \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ \lambda & - \lambda & - \lambda & - \lambda & + \lambda & - \lambda & - + \lambda & - + \lambda & - + \lambda \\ \lambda & - \lambda & - \lambda & - + \lambda & - + \lambda & - + + \lambda & - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +$$ + +Each head has a diagonal structure with non-zero entries along the diagonals at position $nK + h - 1$ for $n \geq 0$ and $h \in \{1, \dots, H_2\}$ , the attention matrices can be formalized as: + +$$ +A _ {i j} ^ {(2, h)} = \lambda \left\{ \begin{array}{l l} + 1, & \text {i f} i \geq j > \hat {k} \text {a n d} (i - j) \mod K = h - 1 \\ - 1, & \text {o t h e r w i s e}, \end{array} \right. +$$ + +where the condition $i \geq j > \hat{k}$ ensures that all entries in the first $\hat{k}$ rows and columns are set to $-\lambda$ and imposes a lower triangular structure due to causal masking. The modulo operation instead assigns each diagonal multiple of $K$ to $+\lambda$ (allowing attention) and the remaining diagonals to $-\lambda$ (masking attention), while $h$ determines the shift of the first positive diagonal to ensure the heads do not overlap. The output of each head in the second layer is given by $[[e_{s_i}, e_i], \hat{h}_i^{(1)}]^{\top} \tilde{A}^{(2,h)}[[e_{s_j}, e_j], \hat{h}_j^{(1)}] = A_{i,j}^{(2,h)} = \lambda \mathrm{sign}(A_{i,j}^{(2,h)})$ . Applying softmax and in the limit as $\lambda \to \infty$ , the rows of the attention become uniform for positive entries and zero otherwise: + +$$ +\mathcal {A} _ {i j} ^ {(2, h)} = \operatorname {S o f t m a x} (A ^ {(2, h)}; 1) _ {i j} = \mathbb {1} \left[ A _ {i j} ^ {(2, h)} = \lambda \right] \left(\sum_ {m = 1} ^ {i} \mathbb {1} \left[ A _ {i m} ^ {(2, h)} = \lambda \right]\right) ^ {- 1}. +$$ + +The output $\hat{h}_i^{(2,h)}$ of each head is then concatenated into the residual stream. Fig. 2 shows the output for the 10th token for each attention head $\hat{h}_{10}^{(2,1)},\hat{h}_{10}^{(2,2)}$ and $\hat{h}_{10}^{(2,3)}$ to visualize the mechanism + +![](images/69471fc7a51d75d7837930add8062c35699b748c075f9c50aeff9726a12d90c1.jpg) +Figure 2: Visualization of the mechanism of the second attention layer in our construction. The matrix represents the input of the second layer $h^{(1)}$ whereas the single vectors the output for the $10^{\mathrm{th}}$ token $\hat{h}_{10}^{(2,1)}, \hat{h}_{10}^{(2,2)}, \hat{h}_{10}^{(2,3)}$ . Each of the three attention heads (arrows of different colors) copies non-overlapping transition probabilities at distance 3 from each other from the past. By doing this, the output of the second layer for the current token (10) contains all $\tilde{p}$ for each lag without loss of information. + +of the second layer. The arrows of different colors represent how each head aggregates transition probabilities by attending to non-overlapping past tokens and averaging them with uniform weights. When concatenating the output of the different heads $h_i^{(2)} = [h_i^{(0)}, \hat{h}_i^{(1)}, \hat{h}_i^{(2,1)}, \dots, \hat{h}_i^{(2,H_2)}]$ , we can see how the 10th token stores the transition probabilities of its entire past for each lag. + +Third layer: average of transition probabilities and lag selection. The third layer sums the normalized transition probabilities from the second layer embeddings and uses the result to infer the correct lag. This mechanism is implemented through the combination of multiple blocks within the third attention matrix, $\tilde{A}^{(3)}$ , which is structured as follows: + +$$ +\tilde {A} ^ {(3)} = \left( \begin{array}{c c c c c c c c c} 0 & 0 & 0 & 0 & 0 & \dots & 0 & 0 \\ 0 & A ^ {(3)} & 0 & 0 & 0 & \dots & 0 & 0 \\ \hline 0 & 0 & 0 & 0 & 0 & \dots & 0 & 0 \\ \hline 0 & 0 & 0 & 0 & 0 & \dots & 0 & 0 \\ \hline 0 & 0 & 0 & 0 & 0 & \dots & 0 & 0 \\ \hline \vdots & \vdots & \vdots & \vdots & \vdots & \ddots & \vdots & \vdots \\ \hline 0 & 0 & 0 & 0 & \dots & \boxed {0} & 0 \\ \hline 0 & 0 & 0 & 0 & \dots & \boxed {0} & 0 \\ \hline 0 & 0 & 0 & 0 & \dots & \boxed {0} & B ^ {(3)} \end{array} \right) A ^ {(3)} = \left( \begin{array}{c c c c c c c c c} + \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ + \lambda & + \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ + \lambda & + \lambda & + \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & + \lambda & + \lambda & + \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & + \lambda & + \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda & + \lambda & + \lambda \\ - \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda \\ 0. 1 1 1 1. 1 1 1. 1 1 1. 1 1 1. 1 1 1. 1 1 1. 1 1 1. 1 1 1. 1 1 1. 1 1 1. 1 1 1. 1 1 1. 1 1 1. 1 1 1. 1 1 1. 2. 4. 8. 5. 6. 7. 8. 9. 1. 2. 3. 4. 5. 6. 7. 8. 9. 1. 2. 3.4.5.6.7.8.9.1.2.3.4.5.6.7.8.9.1.2.3.4.5.6.7.8.9.1.2.3.4.5.6.7.8.9.1.2.3.4.5.6.7.8.9.1.2.3.4.5.6.7.8.9.1.2.3.4.5.6.7. +\end{array} \right) +$$ + +$$ +A _ {i j} ^ {(3)} = \lambda \left\{ \begin{array}{l l} + 1 & \text {i f} i - j + 1 \in \mathcal {K} \\ - 1 & \text {i f} i - j + 1 \not \in \mathcal {K} \end{array} \right., \qquad B _ {i j} ^ {(3)} = \beta \left\{ \begin{array}{l l} + 1, & \text {i f} (i - j) \mod K = K - 1 \\ 0, & \text {o t h e r w i s e} \end{array} \right.. +$$ + +The matrix $A^{(3)}$ acts on the positional embedding of the input, similarly to the matrix $A^{(1)}$ in the first layer. The difference is that the position of the diagonals is now shifted by one. This shift ensures that the only non-zero entries after softmax are the ones on the diagonals corresponding to $k - 1$ for $k \in \mathcal{K}$ . The matrix $B^{(3)}$ is instead responsible for the sum of the normalized transitions. Each block operates on the output of a corresponding head in the second layer. To understand how, consider the following tokens in output of the first head in the second layer, + +$$ +\begin{array}{c} \hat {h} _ {1 0} ^ {(2, 1)} = \frac {1}{3} \cdot \left(\sum_ {i = 4, 7, 1 0} e _ {s _ {i}} \quad 0 \quad 0 \quad 0 \quad 1 \quad 0 \quad 0 \quad 1 \quad 0 \quad 0 \quad 1 \quad \sum_ {i = 4, 7, 1 0} \tilde {s} _ {i} \quad \tilde {p} _ {4, 3} \quad \tilde {p} _ {4, 2} \quad \tilde {p} _ {4, 1} \quad \tilde {p} _ {7, 3} \quad \tilde {p} _ {7, 2} \quad \tilde {p} _ {7, 1} \quad \tilde {p} _ {1 0, 3} \quad \tilde {p} _ {1 0, 2} \quad \tilde {p} _ {1 0, 1} \quad 0\right) \\ \hat {h} _ {9} ^ {(2, 1)} = \frac {1}{2} \cdot \left(e _ {s _ {6}} + e _ {s _ {9}} \quad 0 \quad 0 \quad 0 \quad 0 \quad 1 \quad 0 \quad 0 \quad 1 \quad 0 \quad \tilde {s} _ {6} + \tilde {s} _ {9} \quad 0 \quad 0 \quad \tilde {p} _ {6, 3} \quad \tilde {p} _ {6, 2} \quad \tilde {p} _ {6, 1} \quad \tilde {p} _ {9, 3} \quad \tilde {p} _ {9, 2} \quad \tilde {p} _ {9, 1} \quad 0 \quad 0\right) \\ \hat {h} _ {8} ^ {(2, 1)} = \frac {1}{2} \cdot \left(e _ {s _ {5}} + e _ {s _ {8}} \quad 0 \quad 0 \quad 0 \quad 0 \quad 1 \quad 0 \quad 0 \quad 1 \quad 0 \quad 0 \quad \tilde {s} _ {5} + \tilde {s} _ {8} \quad 0 \quad \tilde {p} _ {5, 3} \quad \tilde {p} _ {5, 2} \quad \tilde {p} _ {5, 1} \quad \tilde {p} _ {8, 3} \quad \tilde {p} _ {8, 2} \quad \tilde {p} _ {8, 1} \quad 0 \quad 0 \quad 0\right) \\ \hat {\dot {m}} _ {8} ^ {(2, 1)} \\ & p _ {8} ^ {(2, 1)} \\ & p _ {8} ^ {(2, 1)} \\ & p _ {8} ^ {(2, 1)} \\ & p _ {8} ^ {(2, 1)} \\ & p _ {8} ^ {(2, 1)} \\ & p _ {8} ^ {(2, 1)} \\ & p _ {8} ^ {(2, 1)} \\ & p _ {\mathrm {a l p h a}} ^ {(2, 1)} \\ & p _ {\mathrm {a l p h a}} ^ {(2, 1)} \\ & p _ {\mathrm {a l p h a}} ^ {(2, 1)} \\ & p _ {\mathrm {a l p h a}} ^ {(2, 1)} \\ & p _ {\mathrm {a l p h a}} ^ {(2, 1)} \\ & p _ {\mathrm {a l p h a}}, p _ {\mathrm {a l p h a}}, p _ {\mathrm {a l p h a}}, p _ {\mathrm {a l p h a}}, p _ {\mathrm {a l p h a}}, p _ {\mathrm {a l p h a}}, p _ {\mathrm {a l p h a}}, p _ {\mathrm {a l p h a}}, p _ {\mathrm {a l p h a}}, p _ {\mathrm {a l p h a}}, \\ & p _ {\mathrm {a l p h a}}, p _ {\mathrm {a l p h a}}, p _ {\mathrm {a l p h a}}, p _ {\mathrm {a l p h a}}, p _ {\mathrm {a l p h a}}, p _ {\mathrm {a l p h a}}, p _ {\mathrm {a l p h a}}, p _ {\mathrm {a l p h a}}, p _ {\mathrm {a l p h o}}, p _ {\mathrm {a l p h o}}, p _ {\mathrm {a l p h o}}, p _ {\mathrm {a l p h o}}, p _ {\mathrm {a l p h o}}, p _ {\mathrm {a l p h o}}, p _ {\mathrm {a l p h o}}, p _ {\mathrm {a l p h o}}, p _ {\mathrm {a l p h o}}, p _ {\mathrm {a l p h o}} \\ & p _ {\mathrm {a l p h o}}, p _ {\mathrm {a l p h o}}, p _ {\mathrm {a l p h o}}, p _ {\mathrm {a l p h o}}, p _ {\mathrm {a l p h o}}, p _ {\mathrm {a l p h o}}, p _ {\mathrm {a l p h o}}, p _ {\mathrm {a l p h o}}, p _ {\mathrm {a l p h o}}, \\ & q. q. q. q. q. q. q. q. q. q. q. q. q. q. q. q. q. q. q. q. q. q. q. q. q. q. q. q. q. q. q. q. q. q. q. q. q. q. q. q. q. q. q. q. q. q. q. q. q. q. q. +\end{array} +$$ + +where we define $\hat{p}_i^{(2,h)}\in \mathbb{R}^T$ as the block of $\hat{h}_i^{(2,h)}$ which contains the normalized transition probabilities and $\hat{m}_i^{(2,h)}\in \mathbb{R}^T$ contains a copy of the second attention. With the structure of $\tilde{A}^{(3)}$ , we can see how $B^{(3)}$ acts on these two blocks: $h_i^{(2)\top}\tilde{A}^{(3)}h_j^{(2)} = \sum_{h = 1}^{K}p_i^{(2,h)\top}B^{(3)}m_j^{(2,h)} + e_iA^{(3)}e_j$ . This operation sums the transition probabilities such that the entry corresponding to the lag- $k$ transition for the next token contains the sum of the transitions with the same lag: $h_i^{(2)\top}\tilde{A}^{(3)}h_{i - k + 1}^{(2)}\propto$ + +$\sum_{j \leq i} \tilde{p}_{j,k}$ . To illustrate this process, consider the following: + +$$ +\hat {p} _ {1 0} ^ {(2, 1) \top} B ^ {(3, 1)} \hat {m} _ {8} ^ {(2, 1)} = \frac {\beta}{3} \begin{array}{c} \left( \begin{array}{c} \bar {p} _ {4, 3} \\ \bar {p} _ {4, 2} \\ \bar {p} _ {4, 1} \\ \bar {p} _ {7, 3} \\ \bar {p} _ {7, 2} \\ \bar {p} _ {7, 1} \\ \bar {p} _ {1 0, 3} \\ \bar {p} _ {1 0, 2} \\ \bar {p} _ {1 0, 1} \\ 0 \end{array} \right) ^ {\top} \left( \begin{array}{c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c} 0 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 0 \\ 1 & 0 & 0 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 0 & 0 & 1 \\ 0 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 0 & 0 & 1 \\ 1 & 0 & 0 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 0 \\ 1 & 0 & 0 & 1 & 0 & 0 & 1 & 0 & 1 & 0 & 0 \\ 0 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 0 & 1 & 0 \\ 0 & 1 & 0 & 0 & 1 \end{array} \right) \left( \begin{array}{c} 0 \\ 0 \\ 0 \\ \frac {1}{2} \\ \frac {1}{2} \\ \frac {1}{2} \\ \frac {1}{2} \\ \frac {1}{2} \\ \frac {1}{2} \\ \frac {1}{2} \\ \frac {1}{2} \\ \frac {1}{2} \\ \frac {1}{2} \\ \frac {1}{2} \\ \frac {1}{2} \\ \frac {1}{2} \\ \frac {\bar {p} _ {4 , 3}}{\bar {p} _ {4 , 2}} \end{array} \right) = \frac {\beta}{3} \quad \left( \begin{array}{c} \bar {p} _ {4, 3} \\ \bar {p} _ {4, 2} \\ \bar {p} _ {4, 1} \\ \bar {p} _ {7, 3} \\ \bar {p} _ {7, 2} \\ \bar {p} _ {7, 1} \\ \bar {p} _ {1 0,3} \\ \bar {p} _ {1 0,2} \\ \bar {p} _ {1 0,1} \\ \bar {(p _ {4 , 3}) + (\bar {p} _ {7 , 3}) + (\bar {p} _ {1 0 ,3})}. \end{array} \right) = \frac {\beta}{3} (\bar {p} _ {4, 3}) ^ {\top} + (\bar {p} _ {7, 3}) ^ {\top} + (\bar {p} _ {1 0,3}). +$$ + +The additional blocks containing $B^{(3)}$ act on the outputs of the other heads, performing the same operation by summing the transitions of the same lag stored in the respective outputs. Considering all heads and only the non-zero entries after softmax, occurring at $j = i - k + 1$ due to $A^{(3)}$ , we get + +$$ +h _ {i} ^ {(2) \top} \tilde {A} ^ {(3)} h _ {i - k + 1} ^ {(2)} = \sum_ {h = 1} ^ {K} p _ {i} ^ {(2, h) \top} B ^ {(3)} m _ {i - k + 1} ^ {(2, h)} + \lambda = \sum_ {h = 1} ^ {K} \frac {\beta}{T _ {h , i} + 1} \sum_ {n = 0} ^ {T _ {h, i}} \tilde {p} _ {\hat {k} + h + n K, k} + \lambda , +$$ + +where $T_{h,i} = \left\lfloor \frac{i - \hat{k} - h}{K}\right\rfloor$ . Taking the softmax $(\alpha = 1)$ and the limit $\lambda \to \infty$ , then considering the last token $T$ (for large $T$ ) where $T_{h,T} + 1 \approx \frac{T - \hat{k}}{K}$ , and absorbing $K$ into the temperature $\beta$ , we recover the weights in Eq. (3): + +$$ +\mathcal {A} ^ {(3)} \left(h _ {1: T} ^ {(2)}; \tilde {A} ^ {(3)}\right) _ {T (T - k + 1)} = \exp \left(\frac {\beta}{(T - k)} \sum_ {i = k + 1} ^ {T} \tilde {p} _ {i, k}\right) / \sum_ {r \in \mathcal {K}} \exp \left(\frac {\beta}{(T - k)} \sum_ {i = k + 1} ^ {T} \tilde {p} _ {i, r}\right), \quad \text {f o r} k \in \mathcal {K}. \tag {6} +$$ + +# 4.2 SELECTIVE INDUCTION HEAD AND NEXTTOKEN PREDICTION + +Selective induction head. Eq. (16) shows how the last attention layer computes a weighted average of the tokens at a distance $k$ from the next one, with weights proportional to the average of the normalized transition probabilities of lag $k$ . In practice, trained models often learn large values of $\beta$ . Thus, we consider the limit $\beta \to \infty$ , where the softmax converges to the hardmax: + +$$ +\mathcal {A} _ {i, j} ^ {(3)} = \mathbb {1} [ i - j + 1 = k ^ {\star} ] \quad \text {w i t h} \quad k ^ {\star} = \operatorname {a r g m a x} _ {k} \sum_ {j < i} \tilde {p} _ {j, k}. +$$ + +Here, the transformer selects the causal structure (i.e., the lag) corresponding to the largest $\sum_{j < i} \tilde{p}_{j,k}$ . Given the current token $i$ , the third layer then copies the token from the position $i - k^{\star} + 1$ , i.e., $\hat{h}_i^{(3)} = \sum_{j = \hat{k}}^i \mathbb{1}[i - j + 1 = k^{\star}] h_j^{(2)} = h_{i - k^{\star} + 1}^{(2)}$ . After concatenation to the residual stream, the tokens are of the following form: + +$$ +h _ {i} ^ {(3)} = \left[ e _ {s _ {i}}, e _ {i}, \hat {h} _ {i} ^ {(1)}, \hat {h} _ {i} ^ {(2, 1)}, \ldots , \hat {h} _ {i} ^ {(2, H _ {2})}, e _ {s _ {i - k ^ {\star} + 1}}, e _ {i - k ^ {\star} + 1}, \hat {h} _ {i - k ^ {\star} + 1} ^ {(1)}, \hat {h} _ {i - k ^ {\star} + 1} ^ {(2, 1)}, \ldots , \hat {h} _ {i - k ^ {\star} + 1} ^ {(2, H _ {2})} \right]. +$$ + +Output layer: next token prediction. Finally, the output layer $\widetilde{W}_O\in \mathbb{R}^{S\times \Sigma_l d_l}$ contains all zero blocks, except for the one acting on the semantics of the token copied by the third attention. This block learns the transition matrix $P^{\star}$ to predict the transition probabilities to the next token via + +$$ +\widetilde {W} _ {O} = \left(0 _ {S \times S} \mid 0 _ {S \times T} \mid 0 _ {S \times d _ {0}} \mid 0 _ {S \times 2 d _ {0}} \mid \ldots \mid 0 _ {S \times 2 d _ {0}} \mid P ^ {\star^ {\top}} \mid 0 _ {S \times T} \mid 0 _ {S \times d _ {0}} \mid 0 _ {S \times 2 d _ {0}} \mid \ldots \mid 0 _ {S \times 2 d _ {0}}\right) +$$ + +i.e. $\widetilde{W}_O h^{(3)} = P^{\star \top} e_{s_{i-k^{\star}+1}} = P_{s_{i-k^{\star}+1}}^{\star}$ . This layer shows how transformers can learn a selective induction head; a mechanism that adapts to the input sequence by copying the token corresponding to the argmax of some quantity extracted by the previous layers and stored in the embeddings. + +# 4.3 EQUIVALENCE WITH MAXIMUM LIKELIHOOD + +The disentangled transformer we propose does not rely on likelihood. Due to the normalization applied by the softmax function, the model computes the sum of normalized probabilities $\tilde{p}$ . For the inference to be accurate, the cumulative sum corresponding to the correct lag must exceed those of any other lag. This fact is formalized in terms of expected values in the following claim: + +Claim 1. Let $\mathcal{K}$ be a subset of integers and $X_{t}$ an interleaved Markov chain of lag $k\in \mathcal{K}$ , then, for $r\in \mathcal{K}$ and $i\geq \hat{k}$ + +$$ +\mathbb {E} \Big [ \frac {X _ {i - r} ^ {\top} P ^ {\star} X _ {i}}{\sum_ {l \in \mathcal {K}} X _ {i - l} ^ {\top} P ^ {\star} X _ {i}} \Big ] \leq \mathbb {E} \Big [ \frac {X _ {i - k} ^ {\top} P ^ {\star} X _ {i}}{\sum_ {l \in \mathcal {K}} X _ {i - l} ^ {\top} P ^ {\star} X _ {i}} \Big ]. +$$ + +![](images/facfca39cf11f0fb258b2b6421e61dd43cdf1235d5d2b9a0a13df82c1b37b7a1.jpg) +Figure 3: Performance of our constructed transformers, trained transformers, and theoretical estimator (BMA, ML). First plot: lags 1,2,3. Second: the model solve the task with non-contiguous lags. Third: the model is effective with additional lags. Fourth: one head is enough for two lags. + +![](images/1cab77962eef104e257e591b510d8088883c5b8cf79ef8ec68a8562421aec2e7.jpg) + +![](images/8214376cc78034721db3a7e94dd02775255ba7d468def0f2667cddfdc34fbc0a.jpg) + +![](images/f10d612c9bea36824c65fc02c3e3f7c367cacea1b918044e7b296daa325d66f4.jpg) + +While specific cases (e.g., two lags, no normalization, or independent lags) are proven in App. B, we leave the complete proof of Claim 1 for future work. However, we provide empirical validation of this claim in App. F. Due to ergodicity, the average $\frac{1}{T}\sum_{i=1}^{T}\tilde{p}_{i,r}$ converges to its expected value, and for large enough $T$ it is higher for the correct lag. Therefore applying the exponential and scaling the temperature $\beta$ leads to the same result as MLE in the asymptotic limit, as shown in Fig. 4c. + +# 4.4 GENERALIZATIONS AND SPECIAL CASES + +Single-head transformers: the construction above allows the model to store all the past transition probabilities in the embedding of the current token by scaling the number of heads with the total number of lags $K$ . Since all heads perform the same operation, reducing the number of heads implements an equivalent algorithm but with worse sample complexity compared to ML, as some past transitions are discarded. Thus, a 3-layer single-head transformer still solves the task by implementing the algorithm in Proposition 1, but it only uses $\frac{T - \hat{k} - 1}{K} + 1$ samples to estimate the correct lag. Non-contiguous lags: in App. I, we provide examples of constructions to handle non-contiguous lags, where the core approach remains similar to that in Sec. 4.1. Depending on the specific case, the number of heads needed ranges between the number of lags and $\hat{k} - \min(\mathcal{K}) + 1$ . + +Two lags: by the construction in Sec. 4.1, handling two contiguous lags requires two attention heads in the second layer for optimal sample complexity. However, we provide in App. J an alternative construction for the third layer which enables a single-head model to match the performance of the two-head model for any two lags, whether contiguous or not (see empirical results in Fig.3). + +# 5 EXPERIMENTS AND DISCUSSION + +We conduct a series of experiments to empirically validate our construction and determine whether transformers trained via gradient descent learns it. Setup. We train 3-layer disentangled transformers $(\tilde{\mathcal{T}})$ and 3-layer standard transformers $(\mathcal{T})$ with learned positional and semantic embedding both with $\alpha = \sqrt{d_{QK}}$ using cross-entropy loss. At each step, we generate a fresh batch (size 256) of sequences (length 128) via Alg. 1, and train using Adam optimizer with fixed learning rate 0.001 and no weight decay. For the standard transformer embedding size we tested 128, 64 and $d_{QK} = 32$ . For the constructions, we fix $\beta = 100$ and $\lambda = 500$ . We report $\mathcal{D}_{KL}$ between the true and predicted next-token distribution along the sequence. We generate different tasks with alphabet size $|S| = 5$ (no differences are observed for other sizes) varying the number and values of lags: $\mathcal{K} = \{1,2,3\}$ (our example) and $\mathcal{K} = \{1,2,3,4,5\}$ for the case of contiguous lags (optimal number of heads 3 and 5 according to Proposition 1), $\mathcal{K} = \{1,3,4\}$ to show non-contiguous lags (4 heads needed, see App. I), and $\mathcal{K} = \{1,3\}$ for the special case of two lags. + +Main results. We observe in Fig. 3 how the construction with optimal number of heads, indicated as $\tilde{\mathcal{T}}$ constr., matches the performance of the ML. Moreover, both the disentangled transformers trained ( $\tilde{\mathcal{T}}$ train) and the standard one ( $\mathcal{T}$ train) match the performance of the theoretical construction. Interestingly, we observe that when the number of heads is fixed to 1 the trained transformers can find solutions which perform better than the construction: this indicates the existence of more efficient, yet difficult to interpret, ways of aggregating the transition probabilities, and that gradient descent can find them. Finally, we illustrate how for the case of two lags (right in Fig. 3) our construction + +![](images/6700999f52737a67038c0c5505aca750b688416e551fc9ecb7c9d03dedf5c9a5.jpg) +(a) + +![](images/abb9834bbeb24454e7cbf16bd6b1a854909474f0280f54ecf3be30cb2f5f1045.jpg) + +![](images/1692b94de41025ffcc4387e19cfab49d4919a66efde15d4d67969de8b96cbc40.jpg) +Figure 4: Attention maps trained vs constructed transformer. Fig. 4a reports the heatmaps of the attention maps of the trained standard and disentangled transformer and our construction for lags 3,5,7 and Fig. 4b. The first and second layers display a remarkable similarity and the second layers show a similar diagonal structure. Fig. 4c shows how the estimator in Eq. (3) matches ML for large $\beta$ . + +![](images/c2f9df1691b325ac387605e1f5ffbe6cf02ebeca19721cbba3bb9bc119fe59ad.jpg) +(b) + +![](images/82544029135bc3b9ecebb1d9dfca12cbb2ae5b54c6284decb51686dd7adac66d.jpg) +(c) + +with single head (detailed in App J) attains the optimal sample complexity, while the construction in App. I would require 2 heads. Moreover, in this case, it appears that the trained transformers can obtain performances closer to the BMA rather than the ML for small sequence lengths. + +Trained vs constructed attention maps. In Fig. 4a we report the attention maps for the three layers for $\mathcal{K} = \{3,5,7\}$ for trained standard transformer (top), trained disentangled transformer (middle) and our construction (bottom, see construction in App. I). The attention maps of the first and third layers are nearly identical between the trained and theoretical models, with these layers functioning precisely as expected from the theoretical construction. Notably, the attention entries of the first layer are proportional to $\log P^{\star}$ , even when the model is trained from scratch, for both the disentangled and standard cases. For the second layer (aggregation), the trained transformers converge to a slightly different structure, likely because aggregation is a combinatorial problem with multiple valid implementations. Nevertheless, a clear diagonal pattern emerges, closely resembling our construction. Furthermore, as demonstrated in Fig. 4b, all models achieve comparable performance on the task. These findings strongly suggest that the trained transformers find a solution that aligns closely with our construction. Remarkably, we also show that standard transformers trained with learned positional and semantic embeddings and attention parameterized by $Q,K,V$ produce attention maps in agreement with our construction. This provides compelling evidence that our construction is not merely a byproduct of the disentangled transformer's architecture but it is also implemented by standard transformers. Interestingly, even with an embedding dimension (64) smaller than the sequence length (128), standard transformers efficiently store and utilize past transitions while matching optimal performance. + +# 6 CONCLUSIONS + +We introduced a novel synthetic task based on interleaved Markov chains to study how attention-only transformers perform in-context causal structure selection. Our findings demonstrated that a 3-layer transformer can solve this task with near-optimal sample complexity, effectively showcasing the emergence of selective induction heads, attention circuits that aggregate past information and select the correct causal structure. Moreover, we provided a fully interpretable construction of a disentangled transformer implementing these circuits to solve the task, and empirically verified that both disentangled and standard transformers trained with Adam closely align with this construction. Finally, we theoretically analyze the algorithm implemented by this construction showing that, in certain cases, it asymptotically converges to ML. + +# ACKNOWLEDGMENTS + +This work was supported by the Swiss National Science Foundation (grant number 212111) and partially funded by an unrestricted gift from Google. + +# REFERENCES + +Kwangjun Ahn, Xiang Cheng, Hadi Daneshmand, and Suvrit Sra. Transformers learn to implement preconditioned gradient descent for in-context learning. In Thirty-seventh Conference on Neural Information Processing Systems, 2023. URL https://openreview.net/forum?id= LziniAXEI9. +Ekin Akyurek, Dale Schuurmans, Jacob Andreas, Tengyu Ma, and Denny Zhou. What learning algorithm is in-context learning? investigations with linear models. arXiv preprint arXiv:2211.15661, 2022. +Yu Bai, Fan Chen, Huan Wang, Caiming Xiong, and Song Mei. Transformers as statisticians: Provable in-context learning with in-context algorithm selection. Advances in neural information processing systems, 36, 2024. +Tugkan Batu, Sudipto Guha, and Sampath Kannan. Inferring mixtures of markov chains. In Learning Theory: 17th Annual Conference on Learning Theory, COLT 2004, Banff, Canada, July 1-4, 2004. Proceedings 17, pp. 186-199. Springer, 2004. +Andre Berchtold and Adrian Raftery. The mixture transition distribution model for high-order markov chains and non-gaussian time series. Statistical Science, 17(3):328-356, 2002. +Alberto Bietti, Vivien Cabannes, Diane Bouchacourt, Herve Jegou, and Leon Bottou. Birth of a transformer: A memory viewpoint. Advances in Neural Information Processing Systems, 36, 2024. +Tom B Brown. Language models are few-shot learners. arXiv preprint arXiv:2005.14165, 2020. +Benjamin L Edelman, Ezra Edelman, Surbhi Goel, Eran Malach, and Nikolaos Tsilivis. The evolution of statistical induction heads: In-context learning markov chains. arXiv preprint arXiv:2402.11004, 2024. +Dan Friedman, Alexander Wettig, and Danqi Chen. Learning transformer programs. In Thirty-seventh Conference on Neural Information Processing Systems, 2023. URL https://openreview.net/forum?id=Pe9WxkN8Ff. +Shivam Garg, Dimitris Tsipras, Percy S Liang, and Gregory Valiant. What can transformers learn in-context? a case study of simple function classes. Advances in Neural Information Processing Systems, 35:30583-30598, 2022. +Atticus Geiger, Chris Potts, and Thomas Icard. Causal abstraction for faithful model interpretation. arXiv preprint arXiv:2301.04709, 2023. +Jiachen Hu, Qinghua Liu, and Chi Jin. On limitation of transformer for learning hmms. arXiv preprint arXiv:2406.04089, 2024. +Muhammed Emrullah Ildiz, Yixiao HUANG, Yingcong Li, Ankit Singh Rawat, and Samet Oymak. From self-attention to markov models: Unveiling the dynamics of generative transformers. In *Forty-first International Conference on Machine Learning*, 2024. URL https://openreview.net/forum?id=72oT4mPLUb. +Ashok Vardhan Makkuva, Marco Bondaschi, Adway Girish, Alliot Nagle, Martin Jaggi, Hyeji Kim, and Michael Gastpar. Attention with markov: A framework for principled analysis of transformers via markov chains. arXiv preprint arXiv:2402.04161, 2024. +Ariana Minot and Yue M Lu. Separation of interleaved markov chains. In 2014 48th Asilomar Conference on Signals, Systems and Computers, pp. 1757-1761. IEEE, 2014. + +Aaron Mueller, Jannik Brinkmann, Millicent Li, Samuel Marks, Koyena Pal, Nikhil Prakash, Can Rager, Aruna Sankaranarayanan, Arnab Sen Sharma, Jiuding Sun, et al. The quest for the right mediator: A history, survey, and theoretical grounding of causal interpretability. arXiv preprint arXiv:2408.01416, 2024. +Timothy Nguyen. Understanding transformers via n-gram statistics. arXiv preprint arXiv:2407.12034, 2024. +Eshaan Nichani, Alex Damian, and Jason D. Lee. How transformers learn causal structure with gradient descent. In *Forty-first International Conference on Machine Learning*, 2024. URL https://openreview.net/forum?id=jNM4imlHZv. +Catherine Olsson, Nelson Elhage, Neel Nanda, Nicholas Joseph, Nova DasSarma, Tom Henighan, Ben Mann, Amanda Askell, Yuntao Bai, Anna Chen, et al. In-context learning and induction heads. arXiv preprint arXiv:2209.11895, 2022. +Nived Rajaraman, Marco Bondaschi, Kannan Ramchandran, Michael Gastpar, and Ashok Vardhan Makkuva. Transformers on markov data: Constant depth suffices. arXiv preprint arXiv:2407.17686, 2024. +Allan Raventós, Mansheej Paul, Feng Chen, and Surya Ganguli. Pretraining task diversity and the emergence of non-bayesian in-context learning for regression. Advances in Neural Information Processing Systems, 36, 2024. +Judith Rousseau and Kerrie Mengersen. Asymptotic behaviour of the posterior distribution in overfitted mixture models. Journal of the Royal Statistical Society Series B: Statistical Methodology, 73(5):689-710, 2011. +Michael Eli Sander, Raja Giryes, Taiji Suzuki, Mathieu Blondel, and Gabriel Peyré. How do transformers perform in-context autoregressive learning? In *Forty-first International Conference on Machine Learning*, 2024. URL https://openreview.net/forum?id=kZbTkpnafR. +Naomi Saphra and Sarah Wiegreff. Mechanistic? arXiv preprint arXiv:2410.09087, 2024. +Anej Svete and Ryan Cotterell. Transformers can represent $n$ -gram language models. arXiv preprint arXiv:2404.14994, 2024. +Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. In I. Guyon, U. Von Luxburg, S. Bengio, H. Wallach, R. Fergus, S. Vishwanathan, and R. Garnett (eds.), Advances in Neural Information Processing Systems, volume 30. Curran Associates, Inc., 2017. URL https://proceedings.neurips.cc/paper_files/paper/2017/file/3f5ee243547dee91fdb053c1c4a845aa-Paper.pdf. +Johannes Von Oswald, Eyvind Niklasson, Ettore Randazzo, João Sacramento, Alexander Mordvintsev, Andrey Zhmoginov, and Max Vlademyrov. Transformers learn in-context by gradient descent. In International Conference on Machine Learning, pp. 35151-35174. PMLR, 2023a. +Johannes Von Oswald, Eyvind Niklasson, Maximilian Schlegel, Seijin Kobayashi, Nicolas Zucchet, Nino Scherrer, Nolan Miller, Mark Sandler, Max Vlademyrov, Razvan Pascanu, et al. Uncovering mesa-optimization algorithms in transformers. arXiv preprint arXiv:2309.05858, 2023b. +Sang Michael Xie, Aditi Raghunathan, Percy Liang, and Tengyu Ma. An explanation of in-context learning as implicit bayesian inference. arXiv preprint arXiv:2111.02080, 2021. +Steve Yadlowsky, Lyric Doshi, and Nilesh Tripuraneni. Pretraining data mixtures enable narrow model selection capabilities in transformer models. arXiv preprint arXiv:2311.00871, 2023. + +Organization of the Appendix. The Appendix is organized as follows. In App. A, we present a detailed review of related work on in-context learning and mechanistic interpretability. App. B extends the statistical analysis of the estimator implemented by the transformer in Prop.1 and includes omitted proofs. App. C reports additional experiments and discussions about using more than 3 layers and varying the number of heads in the second layer. Additional attention maps for different tasks and both disentangled and trained transformers as well as the construction are provided in App. D. App. F includes several experiments to validate Claim 1. App. E details the algorithm used to generate the interleaved Markov chains. A complete construction for the contiguous case, along with detailed intuitions, is given in App. G. App. H discusses an alternative third layer construction using positional embedding. The construction for non-contiguous lags is presented in App. I. Finally, App. J explains the single-head construction for the case of two lags. + +# A RELATED WORK + +Following the initial empirical observations of the emergent in-context learning capabilities of transformers (Brown, 2020), several works have attempted to understand this phenomenon. Xie et al. (2021) sought to formulate in-context learning as Bayesian inference, while Garg et al. (2022) studied the ability of transformers to learn simple functions, such as linear models or multilayer perceptrons, in context. A subsequent line of work (Akyurek et al., 2022; Bai et al., 2024; Von Oswald et al., 2023a,b; Raventós et al., 2024) shows that transformer layers might implement gradient descent to solve in-context linear regression. Ahn et al. (2023) extend this idea to higher-order algorithms. Importantly, Olsson et al. (2022) postulate that in-context learning is tied to the emergence of induction heads. Bietti et al. (2024), subsequently extended this idea, showing the development of induction heads to learn bigrams in-context and showcasing a connection with associative memories. Our work is inspired by foundational efforts in causal interpretability and mechanistic understanding of neural networks, particularly transformers (Olsson et al., 2022). These include studies on causal mediation analysis (Mueller et al., 2024), causal abstraction as a theoretical framework (Geiger et al., 2023), and the broader scope of mechanistic interpretability in language models (Saphra & Wiegreffe, 2024). More closely related to our work is the literature analyzing transformers through the lens of Markov chains. In particular, Nichani et al. (2024) shows how transformers trained on sequences generated by Markov chains on a graph learn simple circuits to capture the underlying causal structure and implement the Bayes-optimal solution by estimating transition probabilities in context. Similarly, Edelman et al. (2024) illustrate the formation of statistical induction heads that accurately compute posterior probabilities based on bigram statistics. Makkuva et al. (2024) used Markov chains to study the loss landscape of transformers, while Rajaraman et al. (2024) shows that a constant depth is sufficient to learn k-th order Markov chains. Along this line, Svete & Cotterell (2024) demonstrates that transformers with hard or sparse attention can exactly represent any n-gram model. Extending this framework to Hidden Markov Models, Hu et al. (2024) highlights the limitations of transformers in learning such models compared to RNNs. + +# B STATISTICAL ANALYSIS OF OUR PREDICTOR + +For our estimator to select the correct lag, the following inequalities must hold for a lag $k$ and a sequence of length $T$ generated accordingly: + +$$ +\sum_ {i = 1} ^ {T} \tilde {p} _ {i, k} > \sum_ {j = 1} ^ {T} \tilde {p} _ {j, r} \quad \forall , r \neq k; \text {a n d}; r \in \mathcal {K}. +$$ + +These results enable us to recover the MLE estimator in the high-temperature limit and approximate the BMA at finite temperatures. Assuming the process is ergodic, and by taking the limit of the inequality above, we require the following condition: + +$$ +\mathbb {E} \Big [ \frac {X _ {i - r} ^ {\top} P ^ {\star} X _ {i}}{\sum_ {l \in \mathcal {K}} X _ {i - l} ^ {\top} P ^ {\star} X _ {i}} \Big ] \leq \mathbb {E} \Big [ \frac {X _ {i - k} ^ {\top} P ^ {\star} X _ {i}}{\sum_ {l \in \mathcal {K}} X _ {i - l} ^ {\top} P ^ {\star} X _ {i}} \Big ] \quad \mathrm {f o r} r \in \mathcal {K} \mathrm {a n d} i \geq \max (\mathcal {K}), +$$ + +as formalized in Claim 1. + +We leave the complete proof of this result as future work, but we have fully validated it empirically in Section F. We provide here the proofs of Claim 1 for three specific cases. + +Two-lag case. In the case of two lags, we can show the following general result for any two distributions, $P$ and $Q$ , over $1, \ldots, k$ for $k \geq 0$ . + +Lemma 1. + +$$ +\sum_ {i = 1} ^ {k} \frac {P (i) Q (i)}{P (i) + Q (i)} \leq \sum_ {i = 1} ^ {k} \frac {P (i) ^ {2}}{P (i) + Q (i)}. \tag {7} +$$ + +Proof. We first show that + +$$ +\sum_ {i = 1} ^ {k} \frac {P (i) ^ {2} - Q (i) ^ {2}}{P (i) + Q (i)} = \sum_ {i = 1} ^ {k} \frac {(P (i) - Q (i)) (P (i) + Q (i))}{P (i) + Q (i)} = \sum_ {i = 1} ^ {k} (P (i) - Q (i)) = 0. +$$ + +Then, by using Cauchy-Schwarz inequality, we obtain: + +$$ +\sum_ {i = 1} ^ {k} \frac {P (i) Q (i)}{P (i) + Q (i)} \leq \sqrt {\sum_ {i = 1} ^ {k} \frac {P (i) ^ {2}}{P (i) + Q (i)}} \sqrt {\sum_ {i = 1} ^ {k} \frac {Q (i) ^ {2}}{P (i) + Q (i)}} = \sum_ {i = 1} ^ {k} \frac {P (i) ^ {2}}{P (i) + Q (i)}. +$$ + +![](images/bbd08f0714853255f41d0f1a632f5440a2c38cf7f256a21c3decccc4d9f44418.jpg) + +The result in the two-lag case follows directly. Let $\mu$ denote the distribution of the lag- $k$ interleaved process $X_{t}$ , (i.e., $\mu(s_{i}, s_{j}, s_{k}) = \mathbb{P}(X_{i} = s_{i}, X_{j} = s_{j}, X_{k} = s_{k})$ ). For any lag $\{r\}$ we have + +$$ +\begin{array}{l} \mathbb {E} \Big [ \frac {X _ {i - r} ^ {\top} P ^ {\star} X _ {i}}{X _ {i - r} ^ {\top} P ^ {\star} X _ {i} + X _ {i - k} ^ {\top} P ^ {\star} X _ {i}} \Big ] = \sum_ {s _ {i - k}, s _ {i - r}, s _ {i}} \mu (s _ {i - k}, s _ {i - r}, s _ {i}) \frac {P _ {s _ {i - k} , s _ {i}} P _ {s _ {i - r} , s _ {i}}}{P _ {s _ {i - k} , s _ {i}} + P _ {s _ {i - r} , s _ {i}}} \\ = \sum_ {s _ {i - k}, s _ {i - r}} \mu (s _ {i - k}, s _ {i - r}) \sum_ {s _ {i}} \frac {P _ {s _ {i - k} , s _ {i}} P _ {s _ {i - r} , s _ {i}}}{P _ {s _ {i - k} , s _ {i}} + P _ {s _ {i - r} , s _ {i}}} \\ \end{array} +$$ + +By applying Lemma 1, we directly obtain + +$$ +\mathbb {E} \Big [ \frac {X _ {i - r} ^ {\top} P ^ {\star} X _ {i}}{X _ {i - r} ^ {\top} P ^ {\star} X _ {i} + X _ {i - k} ^ {\top} P ^ {\star} X _ {i}} \Big ] \leq \mathbb {E} \Big [ \frac {X _ {i - k} ^ {\top} P ^ {\star} X _ {i}}{X _ {i - r} ^ {\top} P ^ {\star} X _ {i} + X _ {i - k} ^ {\top} P ^ {\star} X _ {i}} \Big ] +$$ + +which proves Claim 1 in the case of two lags. + +Independent lags. In the case where all lags in $\mathcal{K}$ are such that $(X_{i - l})_{l\in \mathcal{K}}$ are independent, we can prove Claim 1. Indeed, in this case, the distribution of the observed lags can be factorized as $\mu ((s_{i - l})_{l\in \mathcal{K}}) = \prod_{l\in \mathcal{K}}\mu (s_{i - l})$ . Thus we have + +$$ +\begin{array}{l} \mathbb {E} \Big [ \frac {X _ {i - r} ^ {\top} P ^ {\star} X _ {i} - X _ {i - k} ^ {\top} P ^ {\star} X _ {i}}{\sum_ {l \in \mathcal {K}} X _ {i - l} ^ {\top} P ^ {\star} X _ {i}} \Big ] = \sum_ {s _ {i}, (s _ {i - l}) _ {l \in \mathcal {K}}} \mu ((s _ {i - l}) _ {l \in \mathcal {K}}) \frac {P _ {s _ {i - k} , s _ {i}} (P _ {s _ {i - r} , s _ {i}} - P _ {s _ {i - k} , s _ {i}})}{\sum_ {l \in \mathcal {K}} P _ {s _ {i - l} , s _ {i}}} \\ = \sum_ {s _ {i}, (s _ {i - l}) _ {l \in \mathcal {K}}} \mu ((s _ {i - l}) _ {l \in \mathcal {K}, l \neq k, r}) \mu (s _ {i - k}) \mu (s _ {i - r}) \frac {P _ {s _ {i - k} , s _ {i}} (P _ {s _ {i - r} , s _ {i}} - P _ {s _ {i - k} , s _ {i}})}{\sum_ {l \in \mathcal {K}} P _ {s _ {i - l} , s _ {i}}} \\ \end{array} +$$ + +Then, by observing that $a(a - b) + b(b - a) = (a - b)^2 \geq 0$ , the result follows from: + +$$ +\begin{array}{l} 2 \sum_ {s _ {i - r}, s _ {i - l}} \mu (s _ {i - k}) \mu (s _ {i - r}) \frac {P _ {s _ {i - k} , s _ {i}} (P _ {s _ {i - r} , s _ {i}} - P _ {s _ {i - k} , s _ {i}})}{\sum_ {l \in \mathcal {K}} P _ {s _ {i - l} , s _ {i}}} \\ = \sum_ {s _ {i - r}, s _ {i - l}} \mu (s _ {i - k}) \mu (s _ {i - r}) \frac {P _ {s _ {i - k} , s _ {i}} (P _ {s _ {i - r} , s _ {i}} - P _ {s _ {i - k} , s _ {i}}) + P _ {s _ {i - r} , s _ {i}} (P _ {s _ {i - k} , s _ {i}} - P _ {s _ {i - r} , s _ {i}})}{\sum_ {l \in \mathcal {K}} P _ {s _ {i - l} , s _ {i}}} \\ = \sum_ {s _ {i - r}, s _ {i - l}} \mu (s _ {i - k}) \mu (s _ {i - r}) \frac {(P _ {s _ {i - r} , s _ {i}} - P _ {s _ {i - k} , s _ {i}}) ^ {2}}{\sum_ {l \in \mathcal {K}} P _ {s _ {i - l} , s _ {i}}} \geq 0 \\ \end{array} +$$ + +We observe that similar techniques can be applied to prove Claim 1 in the case of a symmetric Markov kernel $P^{\star}$ . + +No normalization case. Due to various reasons, including the normalization of the softmax in the attention layer, our estimator relies on a score computed by aggregating the normalized probabilities $\tilde{p}_{i,k}$ . If we were to use the unnormalized probabilities, we could rely on the following result, which simplifies Claim 1 by excluding the normalization step. + +Lemma 2. Let $\mathcal{K}$ be a subset of integers and $X_{t}$ a stationary interleaved Markov chain of lag $k\in \mathcal{K}$ , then + +$$ +\mathbb {E} \left[ X _ {i - r} ^ {\top} P ^ {\star} X _ {i} \right] \leq \mathbb {E} \left[ X _ {i - k} ^ {\top} P ^ {\star} X _ {i} \right] \quad f o r r \in \mathcal {K} a n d i \geq \max (\mathcal {K}). \tag {8} +$$ + +Proof. + +$$ +\begin{array}{l} \mathbb {E} [ X _ {i - r} ^ {\top} P ^ {\star} X _ {i} ] = \sum_ {s _ {i - r}, s _ {i - k}, s _ {i}} \mu (s _ {i - r}, s _ {i - k}, s _ {i}) P _ {s _ {i - r}, s _ {i}} \\ = \sum_ {s _ {i - r}, s _ {i - k}, s _ {i}} \mu (s _ {i - r}, s _ {i - k}) P _ {s _ {i - k}, s _ {i}} P _ {s _ {i - r}, s _ {i}} \\ \leq \sum_ {s _ {i}} \sqrt {\sum_ {s _ {i - r} , s _ {i - k}} \mu (s _ {i - r} , s _ {i - k}) P _ {s _ {i - k} , s _ {i}} ^ {2}} \sqrt {\sum_ {s _ {i - r} , s _ {i - k}} \mu (s _ {i - r} , s _ {i - k}) P _ {s _ {i - r} , s _ {i}} ^ {2}}, \\ \leq \sum_ {s _ {i}} \sqrt {\sum_ {s _ {i - k}} (\sum_ {s _ {i - r}} \mu (s _ {i - r} , s _ {i - k})) P _ {s _ {i - k} , s _ {i}} ^ {2}} \sqrt {\sum_ {s _ {i - r}} (\sum_ {s _ {i - k}} \mu (s _ {i - r} , s _ {i - k})) P _ {s _ {i - r} , s _ {i}} ^ {2}}, \\ \end{array} +$$ + +where the inequality follows from the Cauchy-Schwarz inequality. + +Assuming that $\mu (s_{i - r},s_{i - k})$ is a coupling of the stationary measure $\pi$ , we then have: + +$$ +\begin{array}{l} \mathbb {E} [ X _ {i - r} ^ {\top} P ^ {\star} X _ {i} ] \leq \sum_ {s _ {i}} \sqrt {\sum_ {s _ {i - k}} \pi (s _ {i - k}) P _ {s _ {i - k} , s _ {i}} ^ {2}} \sqrt {\sum_ {s _ {i - r}} \pi (s _ {i - r}) P _ {s _ {i - r} , s _ {i}} ^ {2}} \\ = \sum_ {s _ {i}, s _ {i - k}} \pi (s _ {i - k}) P _ {s _ {i - k}, s _ {i}} ^ {2} \\ = \mathbb {E} \left[ X _ {i - k} ^ {\top} P ^ {\star} X _ {i} \right]. \\ \end{array} +$$ + +It remains to prove that $\mu(s_{i-r}, s_{i-k})$ is a coupling of the stationary measure $\pi$ . + +First, let's assume that $r$ and $k$ are such that $X_{i-r}$ and $X_{i-k}$ are independent. In this case $\mu(s_{i-r}, s_{i-k}) = \mu(s_{i-r})\mu(s_{i-k})$ and we have both that $\sum_{s_{i-r}} \mu(s_{i-r}, s_{i-k}) = \mu(s_{i-k})$ and $\sum_{s_{i-k}} \mu(s_{i-r}, s_{i-k}) = \mu(s_{i-r})$ . + +Alternatively, if $r$ and $k$ are such that $X_r$ and $X_k$ come from the same Markov Chain with $r > k$ . We have thus that $X_{i-r} \sim \mu$ and $X_{i-k}|X_{i-r} \sim s_{i-r}^\top P^l$ for some $l \geq 0$ and $\mu(s_{i-r}, s_{i-k}) = \pi(s_{i-r})s_{i-r}^\top P^l s_{i-k}$ . Since $P$ is a stochastic matrix, summing over $s_{i-k}$ gives $\sum_{s_{i-k}}\mu(s_{i-r}, s_{i-k}) = \mu(s_{i-r}) = \pi(s_{i-r})$ . Finally, by definition of the stationary distribution $\pi$ , summing over $s_{i-r}$ gives $\sum_{s_{i-r}}\mu(s_{i-r}, s_{i-k}) = \pi(s_{i-k})$ . + +# C SCALING HEADS AND LAYERS + +In this section, we investigate how varying the number of heads in the second layer and the number of layers affects the model's performance. We train standard transformers with learned positional and semantic embeddings in the same setup as reported in Section 5. In Figure 5 (left) we consider the task given by $\mathcal{K} = \{1,2,3\}$ and first show the behavior of the model with 2 layers and different combinations of heads [1,1], [3,1], [1,3], [3,3]1, the results show that transformers with 2 layers can't solve the task. Second, we show that increasing the number of layers beyond 3 does not change the performance. In Figure 5 (right) instead we consider the task defined by $\mathcal{K} = \{1,2,3,4,5\}$ and train transformers with fewer, equal to, or more than $K$ heads. As predicted by our construction increasing the number of heads leads to performances that get closer to the maximum likelihood up to having the number of heads equal to the number of lags in the set $K$ . Beyond this point adding more heads does not improve performance, this is expected as ML is optimal. Figures 6a,6b,6c illustrates the attention maps for a 3-layer transformer with only 1,2,3 heads respectively in the second layer, despite the task having 5 lags. Remarkably, even with fewer than K heads, the layers remain consistent with our theoretical construction, displaying analogous patterns: the first layer extracts transition probabilities, the second aggregates them, and the third implements the selective head. However, in the case of fewer heads, the second layer appears to find an efficient way to superpose information—a mechanism we could not yet interpret. Understanding this behaviour in the second layer remains an open question for future work. + +![](images/1dab7f7c9315b67cabe9cd9b1ce7e79b02791887d69b730875a04e88fbb62425.jpg) +$\kappa = \{1,2,3\}$ + +
—BMA—τ2L [1, 3] —τ3L [1, 3, 1]
—ML—τ2L [3, 1] —τ4L [1, 3, 1, 1]
—τ2L [1, 1]—τ2L [3, 3] —τ5L [1, 3, 1, 1, 1]
+ +![](images/45e8c7031232907754bb52b67d005b57f58ad1edf70d18200dd23533007944b1.jpg) +$\kappa = \{1,2,3,4,5\}$ +Figure 5: (left) Scaling number of layers: we train standard transformers with learned position and semantic embeddings. Transformers with 2 layers can't solve the task for any combination of heads. Transformers with more than 3 layers achieve the same performance as for 3 layers. (right) Scaling number of heads in the second layer: we train standard transformers with learned position and semantic embeddings increasing the number of heads in the second layer. As predicted by the construction increasing the number of layers leads to performance closer to the Maximum Likelihood. + +
—BMA—τ3L [1, 2, 1]—τ3L [1, 5, 1]
—ML—τ3L [1, 3, 1]—τ3L [1, 6, 1]
—τ3L [1, 1, 1]—τ3L [1, 4, 1]—τ3L [1, 7, 1]
+ +![](images/e894f95b143fd987e0deec50840ae13237c5d8c54aba93ceafc411e047f5fe36.jpg) + +![](images/e1f99771be628ba8d5c8d64cb65161d2f9bc8005097f4f0c78c828cf25cd62ff.jpg) + +![](images/651951b06caa782d7db4cc13f869d889ed590587549491f18cbf4596aa197fee.jpg) + +![](images/7f8d2009630d1a3b9b8964bb766a1947697a4be0d24cc6be8e7eb9a1b5123741.jpg) +(a) Attention maps for $\mathcal{T}3L[1,1,1]$ and $\mathcal{K} = \{1,2,3,4,5\}$ : + +![](images/5a620bfabcd8a645207347d8440ccf9b9c76fea827ee43efe4000581f3e4c8b3.jpg) + +![](images/bd8720a6300b3b915424b12043fb69eb0fd074c24d0a36b59536102078313cb6.jpg) + +![](images/9fe50e8794a4da064ca5cce59d27fe968e1ca2a6ce3338bfe0e7fd95af20b101.jpg) +(b) Attention maps for $\mathcal{T}3L$ [1,2,1] and $\mathcal{K} = \{1,2,3,4,5\}$ : + +![](images/edef7c5b12b07d17427037fb8768d313ea2dd98c9bd7be908a595632146f2077.jpg) +(c) Attention maps for $\mathcal{T}3L$ [1, 3, 1] and $\mathcal{K} = \{1, 2, 3, 4, 5\}$ : + +![](images/6e375c097054df648135e263799fe5f45f54316a6358f27b24e757d2ee463345.jpg) +Figure 6: Attention maps for different heads in the second layer and $\mathcal{K} = \{1,2,3,4,5\}$ : we observe how even with fewer heads the transformer learns layers which are consistent with the operations in our construction. In particular the first layer is still extracting the transition probabilities, the second is aggregating them and the third one implements the selective head. + +# D ADDITIONAL ATTENTION MAPS PLOTS + +As an additional confirmation for our construction, we report here comparison of the attention maps after softmax for the task introduced in Figure 1. We compare, trained standard 3-layer attention-only transformer with learned positional encoding and one attention head per layer, trained disentangled transformer and our construction. The standard transformer was trained in the same setup already introduced in Section 5. In Figure 7 we train on data with $\mathcal{K} = 1,2$ , we observe a remarkable similarity between the attention maps of our construction and the trained transformer. This further confirms that the disentangled transformer is a good proxy to study the residual stream and the flow of information inside the transformer in a more interpretable way. Moreover, it confirms that our construction is realistic and aligns with what transformers learn in practice by gradient descent. Moreover, in order to showcase the adaptivity in-context of the selective induction head depending on the true lag of the input sequence, in Figures 8, 9, 10 we train on lags $\mathcal{K} = \{1,2,3\}$ and test on sequences generated with each one of the training lags, similarly in Figures 11, 12, 13 we train on lags $\mathcal{K} = \{1,2,3\}$ and test on each. As expected, the third layer adapts to the input sequence selecting the correct lag and copying the correspondent token via the selective induction head. + +![](images/29a52ae5d18a5229a638e7a3b51e908b3fd3bc9f2f4401582c502228685e5766.jpg) +Figure 7: Attention maps $\mathcal{K} = \{1,2\}$ and true lag $k = 2$ + +![](images/d4e4ccab9679c5b7d1bcbfb4e2624b0b486ee96dff266459c92a71ce7534856b.jpg) +Figure 8: Attention maps $\mathcal{K} = \{1,2,3\}$ and true lag $k = 1$ + +![](images/b11783ae931d3deb4616102f635d2480ed95a3401e494342f19b7405a8c82361.jpg) +Figure 9: Attention maps $\mathcal{K} = \{1,2,3\}$ and true lag $k = 2$ + +![](images/4f158a82f0e2fc7451403eb9d456359f9cbcecec682ac184011037491aa3e4e8.jpg) +Figure 10: Attention maps $\mathcal{K} = \{1,2,3\}$ and true lag $k = 3$ + +![](images/9dbfe79744cbcd3175382f28d06bb2e5ec26637dad09f80904869365bc218a33.jpg) +Figure 11: Attention maps $\mathcal{K} = \{1,3,4\}$ and true lag $k = 1$ + +![](images/cc3b2d39f683374d5650b2768a7a31bf573d26a6b0435055e3b8d05c2c214553.jpg) +Figure 12: Attention maps $\mathcal{K} = \{1,3,4\}$ and true lag $k = 3$ + +![](images/72a6f3ce82a187dac559f175f603d8b7ed04ad3bc17bb1ae47cb8923ffe83922.jpg) +Figure 13: Attention maps $\mathcal{K} = \{1,3,4\}$ and true lag $k = 4$ + +# E TASK DETAILS + +In this section, we illustrate the algorithm we used to generate batches of new samples at each iteration. + +Algorithm 1 Generate Dataset of N Sequences from Interleaved Markov Chains +Require: $N$ (sequences), $T$ (length), $S$ (state space), $\mathcal{K}$ (set of lag values), $P^{*}$ (transition matrix) +Ensure: Dataset $\mathcal{D}$ of $N$ sequences +1: $\mathcal{D} \gets \emptyset$ +2: $\pi \gets$ stationary distribution of $P^{*}$ +3: for $i = 1$ to $N$ do +4: $k \gets$ Uniform( $\mathcal{K}$ ) ▷ Randomly select lag for this sequence +5: $X_0 \gets$ Sample from $\pi$ ▷ Initialize first state +6: $S \gets [X_0]$ ▷ Initialize sequence +7: for $t = 1$ to $T - 1$ do +8: if $t < k$ then +9: $X_t \gets$ Sample from $\pi$ ▷ Sample from stationary distribution +10: else +11: $X_t \gets$ Sample from $P^{*}[X_{t-k},:]$ ▷ Transition based on lag $k$ +12: Append $X_t$ to $S$ +13: Add $S$ to $\mathcal{D}$ +return $\mathcal{D}$ + +# F EMPIRICAL VALIDATION OF CLAIM 1 + +To empirically validate Claim 1 we first sample a set of 12 lags uniformly between 1 and 30; we then sample 1000 different transition matrices and for each matrix and each lag 1000 sequences of length 1000 according to the respective Interleaved Markov chain. For each lag and each set of sequences we then compute the expectation in Claim 1 by averaging the last transition in each sampled sequences. We then compute the following quantity: + +$$ +\mathbb {E} \left[ \frac {X _ {i - k} ^ {\top} P ^ {\star} X _ {i}}{\sum_ {l \in \mathcal {K}} X _ {i - l} ^ {\top} P ^ {\star} X _ {i}} \right] - \max _ {\substack {r \neq k \\ r \in \mathcal {K}}} \mathbb {E} \left[ \frac {X _ {i - r} ^ {\top} P ^ {\star} X _ {i}}{\sum_ {l \in \mathcal {K}} X _ {i - l} ^ {\top} P ^ {\star} X _ {i}} \right] \tag{9} +$$ + +and report it in the histogram in Fig.14. We can see that all values in the histogram are positive therefore confirming our claim. Similarly, the results in Fig.15 report the quantity in the claim for each single lag. As per our claim, the expected normalized transition probabilities of the true lag is always larger than the same quantity for any other lag. As a further confirmation of the claim, in Fig.17 and Fig.18 we report the cumulative average of the normalized transition probabilities along the sequence for a single sequence. We observe that even with few samples (small $t$ ) the cumulative average for the true order is always larger than the same quantity for the other lags. + +![](images/09499f65f801f0ca7b10e3ed374ddda2a50031e36970216ebd2f843cc3f09fa1.jpg) +Figure 14: Difference of the expected Normalized Transition Probabilities for the true lag and the maximum over all other lags for $|S| = 10$ . The histogram shows how the quantity in Eq. 9 is always positive. + +![](images/c3ee58a95b2718c7b8087824a915f6041ecd5370a814f3979c033886447f6b03.jpg) +Figure 15: Expected Normalized Transition Probabilities for $|S| = 10$ : The sampled set of lags is $\mathcal{K} = \{1,2,7,9,10,11,13,15,16,22,26,28\}$ , we sampled 10 different transition matrices and for each lag and each matrix sampled 1000 sequences of length 1000. The expected normalized transition probability is always larger for the true lag. + +![](images/8d9bde60f4747cb4b9a0fb0848dc646f9ada5e184807dcbb3ecba0fdd7468fdd.jpg) +Figure 16: Expected Normalized Transition Probabilities for $|S| = 25$ : The sampled set of lags is $\mathcal{K} = \{1, 2, 7, 9, 10, 11, 13, 15, 16, 22, 26, 28\}$ , we sampled 10 different transition matrices and for each lag and each matrix sampled 1000 sequences of length 1000. The expected normalized transition probability is always larger for the true lag. + +![](images/a20cd4f60edf1b9e1b27dbf24a373a6ca3529b7d3770f9243c4e22ff01e9d511.jpg) +Figure 17: Cumulative average of Normalized Transition Probabilities for $|S| = 10$ : The sampled set of lags is $\mathcal{K} = \{1,2,7,9,10,11,13,15,16,22,26,28\}$ , we report one sequence sampled according to one the transition matrix. The cumulative average of normalized transition probability quickly becomes larger for the true lag. + +![](images/422bd5aa8ffb75ae0bc10345c6f8bb16e75b3de98412050441d6d382cba96d0b.jpg) + +![](images/4f5e092936d65f05544e04174e758e439e5f2713d3f485d61ffd75a8fea0522b.jpg) + +![](images/2c50deed9bb09a5c92b3977842ce377330e2152f7e82d18b3264a73a7ea09853.jpg) + +![](images/649ff70f39b2b97b401b069d694d3b1e32e1566df6f03d6975134391449f47ed.jpg) + +![](images/223c68253716e41effde25f32c8164ad159d4b2716de7f23174dff5f9d86e370.jpg) + +![](images/14f43d1a5d55eb540a271158e99ed1b3567fb922afb492d02e7c41075d013c6c.jpg) + +![](images/b0bb3962c6c35eaa5dad07b44a37e4fc470ae14b1166dd76c3b4766c15a72881.jpg) + +![](images/d309d8a62bcefb7e23416fa81f7f2af60a70126fff17ec54ffade20657b12054.jpg) + +![](images/d71ab14ee57de581930149efbd45e4196ad93365873521f4f8ee1ec4c09fb1e3.jpg) +Figure 18: Cumulative average of Normalized Transition Probabilities for $|S| = 25$ : The sampled set of lags is $\mathcal{K} = \{1,2,7,9,10,11,13,15,16,22,26,28\}$ , we report one sequence sampled according to one the transition matrix. The cumulative average of normalized transition probability quickly becomes larger for the true lag. + +![](images/ee145b5b53151a29966e90002978a63a5717169640ce201e7194adf58d8dee24.jpg) + +![](images/02b9d98c1ed1e1ade40ca8b94ead870bf8d001b39a23055ca0cde0fab7bb3767.jpg) + +![](images/791fd2ffca4705510623f417803dbc3b916380b0dc31200521fe9571c80c5e01.jpg) + +# G COMPLETE CONSTRUCTION FOR CONTIGUOUS LAGS. + +First layer: extraction of transition probabilities. The first attention matrix, $\tilde{A}^{(1)}$ , consists of two blocks: the first block operates on the semantic component of the input tokens, learning the transpose of the logarithm of the transition matrix. The second block $A^{(1)}$ learns the causal relationships induced by each possible lag $s_{i-k} \rightarrow s_i$ for $k \in \mathcal{K}$ : + +$$ +\widetilde {A} ^ {(1)} = \left( \begin{array}{c c} \log P ^ {\top} & 0 \\ 0 & A ^ {(1)} \end{array} \right) +$$ + +$$ +A _ {i j} ^ {(1)} = \left\{ \begin{array}{l l} + \lambda & \text {i f} \quad i - j \in \mathcal {K} \\ - \lambda & \text {i f} \quad i - j \notin \mathcal {K}. \end{array} \right. +$$ + +$$ +A ^ {(1)} = \left( \right.\begin{array}{c c c c c c c c c c}- \lambda&- \lambda&- \lambda&- \lambda&- \lambda&- \lambda&- \lambda&- \lambda&- \lambda\\+ \lambda&- \lambda&- \lambda&- \lambda&- \lambda&- \lambda&- \lambda&- \lambda&- \lambda\\+ \lambda&+ \lambda&- \lambda&- \lambda&- \lambda&- \lambda&- \lambda&- \lambda\\+ \lambda&+ \lambda&+ \lambda&- \lambda&- \lambda&- \lambda&- \lambda&- \lambda\\- \lambda&+ \lambda&+ \lambda&+ \lambda&- \lambda&- \lambda&- \lambda&- \lambda\\- \lambda&- \lambda&+ \lambda&+ \lambda&+ \lambda&- \lambda&- \lambda&- \lambda\\- \lambda&- \lambda&- \lambda&+ \lambda&+ \lambda&- \lambda&- \lambda&- \lambda\\- \lambda&- \lambda&- \lambda&- \lambda&+ \lambda&+ \lambda&- \lambda&- \lambda\\- \lambda&- \lambda&- \lambda&- \lambda&+ \lambda&+ \lambda&+ \lambda&- \lambda\\- \lambda&- \lambda&- \lambda&- \lambda&- \lambda&+ \lambda&+ \lambda&+ \lambda\\- \lambda&- \lambda&- \lambda&- \lambda&- \lambda&+ \lambda&+ \lambda&+ \lambda\end{array}.) +$$ + +We can compute the first layer's attention as: + +$$ +[ e _ {s _ {i}}, e _ {i} ] ^ {\top} \tilde {A} ^ {(1)} [ e _ {s _ {j}}, e _ {j} ] = (\log P) _ {s _ {j}, s _ {i}} + \lambda \mathrm {s i g n} (A _ {i j} ^ {(1)}) +$$ + +and applying the softmax: + +$$ +\mathcal {A} ^ {(1)} (h _ {1: T} ^ {(0)}; \tilde {A} ^ {(1)}) _ {i j} = \frac {e ^ {(\log P) _ {s _ {j} , s _ {i}} + \lambda \mathrm {s i g n} (A _ {i , j} ^ {(1)})}}{\sum_ {r = 1} ^ {i} e ^ {(\log P) _ {s _ {r} , s _ {i}} + \lambda \mathrm {s i g n} (A _ {i , j} ^ {(1)})}} = \frac {e ^ {(\log P) _ {s _ {j} , s _ {i}} + \lambda \mathrm {s i g n} (A _ {i j} ^ {(1)})}}{\sum_ {r \in \mathcal {K}} e ^ {(\log P) _ {s _ {r} , s _ {i}} + \lambda} + \sum_ {r \notin \mathcal {K}} e ^ {(\log P) _ {s _ {r} , s _ {i}} - \lambda}}. +$$ + +For $\lambda \to \infty$ (in practice, for $\lambda$ large enough) and having denoted $\tilde{p}_{i,k} := \frac{P_{s_{i-k}, s_i}}{\sum_{r \in \mathcal{K}, r < i} P_{s_{i-r}, s_i}}$ for $i > 1$ , + +$$ +\lim _ {\lambda \to \infty} \mathcal {A} ^ {(1)} (h _ {1: T} ^ {(0)}; \tilde {A} ^ {(1)}) _ {i j} = \left\{ \begin{array}{c l} \tilde {p} _ {i, i - j} & \text {i f} i - j \in \mathcal {K} \\ 1 & \text {i f} i = j = 1 \\ 0 & \text {e l s e w h e r e} \end{array} \right.. +$$ + +Therefore, the output at index $i$ after the first layer corresponds to a weighted average of the past tokens $h_{i - k}^{(0)}$ for $k\in \mathcal{K}$ where the weights are given by the normalized probabilities $\tilde{p}_{i,k}$ : + +$$ +\begin{array}{l} \hat {h} _ {i} ^ {(1)} = \operatorname {A t t n} \left(h _ {1: T} ^ {(0)}; \tilde {A} ^ {(1)}\right) _ {i} = \left\{ \begin{array}{c l} \sum_ {j = 1} ^ {i} \mathbb {1} [ i - j \in \mathcal {K} ] \frac {P _ {s _ {j} , s _ {i}}}{\sum_ {r \in \mathcal {K}} P _ {s _ {r} , s _ {i}}} h _ {j} ^ {(0)} & \text {i f} i > 1 \\ h _ {1} ^ {(0)} & \text {i f} i = 1 \end{array} \right. (10) \\ = \left\{ \begin{array}{c l} \sum_ {k \in \mathcal {K}, k < i} \tilde {p} _ {i, k} h _ {i - k} ^ {(0)} & \text {i f} i > 1 \\ h _ {1} ^ {(0)} & \text {i f} i = 1 \end{array} \right. (11) \\ \end{array} +$$ + +With the input vectors $h_i^{(0)}$ being the concatenation of the one-hot encoding of the state and position $[e_{s_i}, e_i]$ , the first $|S|$ entries of $\hat{h}_i^{(1)}$ correspond to $\tilde{s}_i = \sum_{k \in \mathcal{K}, k < i} \tilde{p}_{i,k} e_{s_{i-k}}$ for $i > 1$ and $\tilde{s}_1 = e_{s_1}$ . The remaining entries, due to the one-hot positional encoding, directly copy the normalized transition probabilities for the transition $s_{i-k} \rightarrow s_i$ into the $|S| + (i-k)$ -th element of $\hat{h}_i^{(1)}$ . To build intuition, we refer to the example in Eq. (12) where the colors highlight transition probabilities of the same lag: + +$$ +\mathcal {A} ^ {(1)} = \left( \begin{array}{c c c c c c c c c c} 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ \tilde {p} _ {3, 2} & \tilde {p} _ {2, 1} & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ \tilde {p} _ {4, 3} & \tilde {p} _ {4, 2} & \tilde {p} _ {4, 1} & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & \tilde {p} _ {5, 3} & \tilde {p} _ {5, 2} & \tilde {p} _ {5, 1} & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & \tilde {p} _ {6, 3} & \tilde {p} _ {6, 2} & \tilde {p} _ {6, 1} & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & \tilde {p} _ {7, 3} & \tilde {p} _ {7, 2} & \tilde {p} _ {7, 1} & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & \tilde {p} _ {8, 3} & \tilde {p} _ {8, 2} & \tilde {p} _ {8, 1} & \tilde {p} _ {8, 1} & \tilde {p} _ {9, 1} \\ 0 & 0 & 0 & 0 & \tilde {p} _ {9, 3} & \tilde {p} _ {9, 2} & \tilde {p} _ {9, 1} \\ 0 & 0 & 0 & 0 & \tilde {p} _ {1 0, 3} & \tilde {p} _ {1 0, 2} & \tilde {p} _ {1 0, 1} \end{array} \right) \hat {h} ^ {(1)} = \left( \begin{array}{c c c c c c c c c c} \tilde {s} _ {1} & \tilde {s} _ {2} & \tilde {s} _ {3} & \tilde {s} _ {4} & \tilde {s} _ {5} & \tilde {s} _ {6} & \tilde {s} _ {7} & \tilde {s} _ {8} & \tilde {s} _ {9} & \tilde {s} _ {1 0} \\ 1 & 1 & \tilde {p} _ {3, 2} & \tilde {p} _ {4, 3} & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & \tilde {p} _ {3, 1} & \tilde {p} _ {4, 2} & \tilde {p} _ {5, 3} & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & \tilde {p} _ {4, 1} & \tilde {p} _ {5, 2} & \tilde {p} _ {6, 3} & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & \tilde {p} _ {5, 1} & \tilde {p} _ {6, 2} & \tilde {p} _ {7, 3} & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & \tilde {p} _ {6, 1} & \tilde {p} _ {7, 2} & \tilde {p} _ {8, 3} & 0 & 0 \\ 0 & 0 & 0 & 0 & \tilde {p} _ {\text {了}} ^ {- - } ^ {- - } ^ {- - } ^ {- - } ^ {- - } ^ {- - } ^ {- - } ^ {- - } ^ {- - } ^ {- - } ^ {- - } ^ {- - } ^ {- - } ^ {- - } ^ {- - } ^ {- - } ^ {- - } ^ {- - } ^ {- - } ^ {- - } ^ {- - } ^ {- - } ^ {- - } ^ {- - } ^ {- - } ^ {- - }\right) +$$ + +The operation of the first layer is now explicit: for each token $h_i^{(0)}$ , it extracts the normalized transition probabilities $\tilde{p}_{i,k}$ for each possible lag and stores them in the element $\hat{h}_{i,S + T - k}^{(1)}$ . The resulting vector is subsequently concatenated to the residual stream to be fed to the second layer $h_i^{(1)} = [[e_{s_i}, e_i], \hat{h}_i^{(1)}]$ . + +Second layer, aggregation of transition probabilities: To predict the next token, the model needs to determine which lag is more likely to have generated the sequence based on the observed transitions up to the current token. In order to do so, we need to aggregate the normalized transition probabilities of the entire past and copy them into the embedding of the current token. However, since consecutive tokens store transition probabilities in overlapping positions, simply averaging a token's history via a uniform attention would cause information from different transitions to mix. For example, when aggregating the past for the token at $i = 10$ in Eq. (11), summing $\hat{h}_9^{(1)}$ and $\hat{h}_{10}^{(2)}$ would mix $\tilde{p}_{10,2}$ and $\tilde{p}_{9,1}$ together. To avoid this, the second attention needs to use the positional encoding to learn a convex combination of the past tokens, which minimizes the overlap and maximizes the number of transitions stored. For example, by selecting one token every 3 steps $\hat{h}_4^{(1)},\hat{h}_7^{(1)},\hat{h}_{10}^{(1)}$ we can copy all the transitions without mixing information. More generally, the attention $\mathcal{A}^{(2)}$ should attend to every $K$ -th token starting from the current one. This corresponds to a diagonal structure, with non-zero entries along the diagonals at positions $nK$ for $n\in \mathbb{N}$ and $nK < T$ . This structure can be enforced by constructing the attention matrix $\tilde{A}^{(2,h)}$ with a single non-zero block that operates on the positional embeddings and takes the following form: + +$$ +\tilde {A} ^ {(2, h)} = \left( \begin{array}{c c c c} 0 & 0 & 0 \\ 0 & A ^ {(2, 1)} & 0 \\ - & - & - \\ 0 & 0 & - \end{array} \right) A ^ {(2, 1)} = \left( \begin{array}{c c c c c c c c c c c c} - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda & + \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda & - \lambda & + \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda & - \lambda & + \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda & + \lambda & - \lambda & + \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda & - \lambda & + \lambda & - \lambda & + \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda & - \lambda & + \lambda & - \lambda & + \lambda & + \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda & + \lambda & - \lambda & + \lambda & + \lambda & - \lambda & + \lambda & + \lambda \\ 0. 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1. 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1. 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +$$ + +where the first $\hat{k}$ rows and columns are empty because the first $\hat{k}$ elements of the sequence are sampled independently from the stationary distribution and therefore no transitions are present. + +The current construction allows us to overcome the issue caused by overlapping transitions; however, only copying a subset of tokens implies losing the information contained in the remaining $\hat{h}_i$ which were excluded by the attention. To overcome this limitation, we can introduce additional attention heads, for a total of $K$ . Each one of them still presents a diagonal structure in order not to sum overlapping transitions but now shifted such that each head copies different tokens. For the given example, we can construct $A^{(2,2)}$ as in Eq. (13) to attend $\hat{h}_9^{(1)}$ and $\hat{h}_6^{(1)}$ which were discarded before, and similarly, the third head can be constructed with $A^{(2,3)}$ to sum $\hat{h}_8^{(1)}$ and $\hat{h}_5^{(1)}$ . This mechanism corresponds to having each additional head with a diagonal structure and non-zero entries along the diagonals at position $nK + h - 1$ for $n \in \mathbb{N}$ and $h \in \{1, \dots, H_2\}$ being the index of the head. + +$$ +A ^ {(2, 2)} = \left( \begin{array}{c c c c c c c c c} - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda & + \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda & - \lambda & + \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & + \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda & + \lambda & - \lambda & + \lambda & + \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda & - \lambda & + \lambda & - \lambda & + \lambda & + \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda & - \lambda & + \lambda & + \lambda & + \lambda & + \lambda & + \lambda \end{array} \right) A ^ {(2, 3)} = \left( \begin{array}{c c c c c c c c c} - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda< fcel>- 1. 0 p t. 0 p t. 0 p t. 0 p t. 0 p t. 0 p t. 0 p t. 0 p t. 0 p t. 0 p t. 0 p t. 0 p t. 0 p t. 0 p t. 0 p t. 0 p t. 0 p t. 0 p t. 0 p t. 0 p t. 0 p r e s o l v e d f o r a l l i n k s , m u l t i f i c i e s , m u l t i f i e s , m u l t i f i e s , m u l t i f i e s , m u l t i f i e s , m u l t i f i e s , m u l t i f i e s , m u l t i f i e s , m u l t i f i e s , m u l t i f i e s , m u l t i f i e s , m u l t i l a r y , m u l t i l a r y , m u l t i l a r y , m u l t i l a r y , m u l t i l a r y , m u l t i l a r y , m u l t i l a r y , m u l t i l a r y , m u l t i l a r y , m u l t i l a r y , m u l t i l a r r h o, m u l t i l a r r h o, m u l t i l a r r h o, m u l t i l a r r h o, m u l t i l a r r h o, m u l t i l a r r h o, m u l t i l a r r h o, m u l t i l a r r h o, m u l t i l a r r h o, m u l {t} _ {i} ^ {i} (i = 1, 2, 3, 4, 5, 6, 7, 8, 9, 1 0, 1 1, 1 2, 1 3, 1 4, 1 5, 1 6, 1 7, 1 8, 1 9, 2 0, 2 1, 2 2, 2 3, 2 4, 2 5, 2 6, 2 7, 2 8, 2 9, 3 0, 3 1, 3 2, 3 3, 3 4, 3 5, 3 6, 3 7, 3 8, 3 9, 4 0, 4 1, 4 2, 4 3, 4 4, 4 5, 4 6, 4 7, 4 8, 4 9, 5 0, 5 1, 5 2, 5 3, 5 4, 5 5, 5 6, 5 7, 5 8, 5 9, +$$ + +The attention matrices $\{A^{(2,1)},\dots ,A^{(2,H_2)}\}$ can be formalized as: + +$$ +A _ {i j} ^ {(2, h)} = \lambda \left\{ \begin{array}{l l} 1, & \text {i f} i \geq j > \hat {k} \text {a n d} (i - j) \mod K = h - 1 \\ - 1, & \text {o t h e r w i s e}, \end{array} \right. +$$ + +where the condition $i \geq j \geq \hat{k}$ ensures that all entries in the first $\hat{k}$ rows and columns are set to $-\lambda$ and imposes a lower triangular structure due to causal masking. The modulo operation instead assigns each diagonal multiple of $K$ to $+\lambda$ (allowing attention) and the remaining diagonals to $-\lambda$ (masking attention), while $h$ determines the shift of the first positive diagonal to ensure the heads do not overlap. The output of each head in the second layer is given by computing: + +$$ +[ [ e _ {s _ {i}}, e _ {i} ], \hat {h} _ {i} ^ {(1)} ] ^ {\top} \tilde {A} ^ {(2, h)} [ [ e _ {s _ {j}}, e _ {j} ], \hat {h} _ {j} ^ {(1)} ] = A _ {i, j} ^ {(2, h)} = \lambda \mathrm {s i g n} (A _ {i, j} ^ {(2, h)}), +$$ + +![](images/e02df42fb5142dae9b79347eed5e96ef11d4a94a253f059913d75ff5ab57e51e.jpg) +Figure 19: Visualization of the mechanism of the second attention layer in our construction. The matrix represents the input of the second layer $h^{(1)}$ whereas the single vectors the output for the $10^{\text{th}}$ token $\hat{h}_{10}^{(2,1)}, \hat{h}_{10}^{(2,2)}, \hat{h}_{10}^{(2,3)}$ . Each of the three attention heads (arrows of different colors) copies non-overlapping transition probabilities at distance 3 from each other from the past. By doing this, the output of the second layer for the current token (10) contains all $\tilde{p}$ for each lag without loss of information. + +and applying softmax and in the limit as $\lambda \to \infty$ , the rows of the attention become uniform for positive entries and zero otherwise: + +$$ +\mathcal {A} _ {i j} ^ {(2, h)} = \left(\operatorname {S o f t m a x} (A ^ {(2, h)})\right) _ {i j} = \frac {\mathbb {1} \left[ (i - j - h + 1) \mod K = 0 \right]}{\sum_ {m = 1} ^ {i} \mathbb {1} \left[ (m - j - h + 1) \mod K = 0 \right]} +$$ + +which in turns implies that the attention computes $\hat{h}_i^{(2)} = \mathrm{Attn}(h_{1:T}^{(1)};\tilde{A}^{(2,h)})_i = \sum_{j = \hat{k}}^i\mathcal{A}_{ij}^{(2,h)}h_j^{(1)}$ . The output of each head is then concatenated into the residual stream. The visualization in Fig. 19 is helpful in fully understanding the mechanism implemented in the second layer. Due to space constraints, we only show the output for the 10th token for each attention head $\hat{h}_{10}^{(2,1)},\hat{h}_{10}^{(2,2)}$ and $\hat{h}_{10}^{(2,3)}$ . We can see how each attention head, represented by the arrows of different colors, aggregates the transition probabilities by attending to the tokens in the past that do not overlap and averaging them with uniform weights. It is important to remember that the input of the second attention layer is given by the concatenation of the input and output of the first layer, $h^{(1)} = [e_{s_i},e_i,\hat{h}_i^{(1)}]$ ; thus when the tokens are averaged by the attention, the output will also contain an average of the position $e_i$ and semantics $e_{s_i}$ of the attended tokens which are represented by the first half of the vectors $\hat{h}_{10}^{(2,h)}$ . Interestingly the block summing the positional encoding is basically storing a copy of the attention row $\mathcal{A}_i^{(2)}$ in the token $i$ . Finally, when concatenating the output of the difference heads, we can see how the 10th-token will store the transition probabilities for each lag and of its entire past. + +Third layer, average of transition probabilities and lag selection. Once the heads in the second layer aggregate the normalized transition probabilities from previous steps and store them within each token's embedding, the third layer sums these probabilities and uses the result to determine the correct lag that generated the sequence. + +To build some intuition, let's revisit our running example. Suppose the current token is at position $i = 10$ , and we are predicting the $11^{\text{th}}$ token in the sequence. Given a set of possible lags $\{1,2,3\}$ , the third attention mechanism must focus on one of the tokens at positions 8, 9, or 10. This ensures that transitions for all possible lags are considered: If the sequence was generated from the source of lag 1, the token at position 10 needs to be copied to predict the transition probabilities for the $11^{\text{th}}$ token. For lag 2, the token at position 9 is copied, and so on. To determine the correct lag based on the sequence's history, our construction relies on the sum of past transitions up to the current token, $\sum_{j < i} \tilde{p}_{j,k}$ . Therefore, to select the correct lag, the third attention is constructed so that the entries corresponding to the transitions of possible lags are proportional to the respective + +cumulative sums. For example, to select which token among the ones in position 8, 9, 10 should be copied to predict 11, the third attention must be such that $\mathcal{A}_{10,10}^{(3)}$ is proportional exclusively to the sum of transitions of lag 1, i.e., $\sum_{j\leq 10}\tilde{p}_{j,1}$ while $\mathcal{A}_{10,9}^{(3)}$ is exclusively proportional to $\sum_{j\leq 10}\tilde{p}_{j,2}$ and $\mathcal{A}_{10,8}^{(3)}\propto \sum_{j\leq 10}\tilde{p}_{j,3}$ . Then, in the limit of the softmax converging to the hardmax, the attention collapses to the entry corresponding to the larger sum and select the correspondent lag by copying the associated token. More generally, for this to apply to all rows, the third attention matrix must be constructed such that $\mathcal{A}_{i,i}^{(3)}\propto \sum_{j\leq i}\tilde{p}_{j,1}$ , while $\mathcal{A}_{i,i - 1}^{(3)}\propto \sum_{j\leq i}\tilde{p}_{j,2}$ , and $\mathcal{A}_{i,i - 2}^{(3)}$ to $\sum_{j\leq i}\tilde{p}_{j,3}$ , with all remaining entries set to zero. + +This selection mechanism is implemented through the combination of multiple blocks within the third attention matrix, $\tilde{A}^{(3)}$ , which acts on the concatenated tokens $h_i^{(2)} = [h_i^{(0)},\hat{h}_i^{(1)},\hat{h}_i^{(2,1)},\dots,\hat{h}_i^{(2,H_2)}]$ and is structured as follows: + +$$ +\tilde {A} ^ {(3)} = \left( \begin{array}{c c c c c c c c c c} 0 & 0 & 0 & 0 & 0 & 0 & \dots & 0 & 0 \\ 0 & A ^ {(3)} & 0 & 0 & 0 & 0 & \dots & 0 & 0 \\ \vdots & \vdots & \vdots & \vdots & \vdots & \vdots & \dots & 0 & 0 \\ \vdots & \vdots & \vdots & \vdots & \vdots & \vdots & \dots & 0 & 0 \\ \vdots & \vdots & \vdots & \vdots & \vdots & \vdots & \dots & 0 & 0 \\ \vdots & \vdots & \vdots & \vdots & \vdots & \vdots \\ \vdots & \vdots & \vdots & \vdots & \vdots & \vdots & \dots & 0 & 0 \\ \vdots & \vdots & \vdots & \vdots & \vdots & \vdots & \dots & 0 & 0 \\ \vdots & \vdots & \vdots & \vdots & \vdots & \vdots & \dots & 0 & 0 \end{array} \right) A ^ {(3)} = \left( \begin{array}{c c c c c c c c c c} + \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ + \lambda & + \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ + \lambda & + \lambda & + \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & + \lambda & + \lambda & + \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & + \lambda & + \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda & + \lambda \\ - \lambda & - \lambda & - \lambda & + \lambda \\ - \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda \\ 0 & 0 \\ 0 & B ^ {(3)} \\ 0, B ^ {(3)} \\ 0, B ^ {(3)} \\ 0, B ^ {(3)} \\ 0, B ^ {(3)} \\ 0, B ^ {(3)} \\ 0, B ^ {(3)} \\ 0, B ^ {(3)} \\ 0, B ^ {(3)} \\ 0, B ^ {(3)} \\ 0, B ^ {(3)} \\ 0, B ^ {(3)} \\ 0, b ^ {(3)} \\ 0, b ^ {(3)} \\ 0, b ^ {(3)} \\ 0, b ^ {(3)} \\ 0, b ^ {(3)} \\ 0, b ^ {(3)} \\ 0, b ^ {(3)} \\ 0, b ^ {(3)} \\ 0, b ^ {(3)} \\ 0, b ^ {(3)} \\ 0, b ^ {(3)} \\ 0, b _ {1} ^ {(3)} \\ 0, b _ {2} ^ {(3)} \\ 0, b _ {3} ^ {(3)} \\ 0, b _ {4} ^ {(3)} \\ 0, b _ {5} ^ {(3)} \\ 0, b _ {6} ^ {(3)} \\ 0, b _ {7} ^ {(3)} \\ 0, b _ {8} ^ {(3)} \\ 0, b _ {9} ^ {(3)} \\ 0, b _ {1 0} ^ {(3)} \\ 0, b _ {1 1} ^ {(3)} \\ 0, b _ {1 2} ^ {(3)} \\ 0, b _ {1 3} ^ {(3)} \\ 0, b _ {1 4} ^ {(3)} \\ 0, b _ {1 5} ^ {(3)} \\ 0, b _ {1 6} ^ {(3)} \\ 0, b _ {1 7} ^ {(3)} \\ 0, b _ {1 8} ^ {(3)} \\ 0, b _ {1 9} ^ {(3)} \\ 0, b _ {2 0} ^ {(3)} \\ 0, b _ {2 1} ^ {(3)} \\ 0, b _ {2 2} ^ {(3)} \\ 0, b _ {2 3} ^ {(3)} \\ 0, b _ {2 4} ^ {(3)} \\ 0, b _ {2 5} ^ {(3)} \\ 0, b _ {2 6} ^ {(3)} \\ 0, b _ {2 7} ^ {(3)} \\ 0, b _ {2 8} ^ {(3)} \\ 0, b _ {2 9} ^ {(3)} \\ 0, b _ {3 0} ^ {(3)} \\ 0, b _ {3 1} ^ {(3)} \\ 0, b _ {3 2} ^ {(3)} \\ 0, b _ {3 3} ^ {(3)} \\ 0, b _ {34} ^ {(3)} \\ 0, b _ {35} ^ {(3)} \\ 0, b _ {36} ^ {(3)} \\ 0, b _ {37} ^ {(3)} \\ 0, b _ {38} ^ {(3)} \\ 0, b _ {39} ^ {(3)} \\ 0, b _ {4 0} ^ {(3)} \\ 0, b _ {4 1} ^ {(3)} \\ 0, b _ {4 2} ^ {(3)} \\ 0, b _ {4 3} ^ {(3)} \\ 0, b _ {4 4} ^ {(3)} \\ 0, b _ {4 5} ^ {(3)} \\ 0, b _ {4 6} ^ {(3)} \\ 0, b _ {4 7} ^ {(3)} \\ 0, b _ {4 8} ^ {(3)} \\ 0, b _ {4 9} ^ {(3)} \\ 0, b _ {5 0} ^ {(3)} \\ +$$ + +with the general formulation of the two matrices $A^{(3)}$ and $B^{(3)}$ given by: + +$$ +A _ {i j} ^ {(3)} = \lambda \left\{ \begin{array}{l l} + 1 & \text {i f} i - j + 1 \in \mathcal {K} \\ - 1 & \text {i f} i - j + 1 \notin \mathcal {K} \end{array} , \right. \qquad B _ {i j} ^ {(3)} = \beta \left\{ \begin{array}{l l} + 1, & \text {i f} (i - j) \mod K = K - 1 \\ 0, & \text {o t h e r w i s e .} \end{array} \right. +$$ + +The matrix $A^{(3)}$ acts on the positional embedding of the input, similarly to the matrix $A^{(1)}$ in the first layer. The difference is that the position of the diagonals is now shifted by one. This shift ensures that the only non-zero entries after softmax are the ones on the diagonals corresponding to $k - 1$ for $k \in \mathcal{K}$ . The matrix $B^{(3)}$ is instead responsible for the sum of the normalized transitions. Each block operates on the output of a corresponding head in the second layer. To understand how, consider the following tokens in output of the first head in the second layer, + +$$ +\begin{array}{c} \hat {h} _ {1 0} ^ {(2, 1)} = \underbrace {\frac {1}{3}} _ {\cdot} \cdot \left(\sum_ {i = 4 , 7 , 1 0} e _ {s _ {i}} \right. \\ \hat {h} _ {9} ^ {(2, 1)} = \underbrace {\frac {1}{2}} _ {\cdot} \cdot \left(e _ {s _ {6}} + e _ {s _ {9}} \right. \\ \hat {h} _ {8} ^ {(2, 1)} = \underbrace {\frac {1}{2}} _ {\cdot} \cdot \left(e _ {s _ {5}} + e _ {s _ {8}} \right. \\ \end{array} \underbrace {\left( \begin{array}{l l l l l l l l l l l l l l l l l l l l l l} 0 & 0 & 0 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & \sum_ {i = 4 , 7 , 1 0} \tilde {s} _ {i} \\ 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 1 & 0 & \tilde {s} _ {6} + \tilde {s} _ {9} \\ 0 & 0 & 0 & 0 & 1 & 0 & 0 & 1 & 0 & 0 & \tilde {s} _ {5} + \tilde {s} _ {8} \end{array} \right) \underbrace {\left( \begin{array}{l l l l l l l l l l l l l l l l l l l} 0 & 0 & \tilde {p} _ {6 , 3} & \tilde {p} _ {6 , 2} & \tilde {p} _ {8 , 3} & \tilde {p} _ {8 , 2} & \tilde {p} _ {8 , 1} & 0 & 0 & 0\right)} _ {\hat {m} _ {8} ^ {(2, 1)}} +$$ + +where we define $\hat{p}_i^{(2,h)}\in \mathbb{R}^T$ as the block of $\hat{h}_i^{(2,h)}$ which contains the normalized transition probabilities and $\hat{m}_i^{(2,h)}\in \mathbb{R}^T$ the block that contains the copy of the second attention. By the structure of $\tilde{A}^{(3)}$ and the concatenation of the outputs $h^{(2)} = [h^{(0)},\hat{h}_i^{(1)},\hat{h}_i^{(2,1)},\dots ,\hat{h}_i^{(2,H_2)}]$ we can see how $B^{(3)}$ act on these two blocks: + +$$ +h ^ {(2) \top} \tilde {A} ^ {(3)} h ^ {(2)} = \sum_ {h = 1} ^ {K} p _ {i} ^ {(2, h) \top} B ^ {(3)} m _ {j} ^ {(2, h)} + e _ {i} A ^ {(3)} e _ {j} +$$ + +where each operation involving $B^{(3)}$ is selectively summing the transition probabilities from the correspondent head. As previously mentioned, for the sum to be selective, it must hold that $h_i^{(2)\top}\tilde{A}^{(3)}h_{i - k + 1}^{(2)}\propto \sum_{j\leq i}\tilde{p}_{j,k}$ , where we replace $j$ with $i - k + 1$ because, after applying softmax, these will be the only non-zero entries due to $A^{(3)}$ . The key idea behind this operation is that $B^{(3,h)}m_{i - k + 1}^{(2,h)}$ is a boolean vector, such that when multiplied by $\hat{p}_i^{(2,h)}$ , it sums only the entries that correspond to transitions of lag $k$ . For instance, consider the product $\hat{p}_{10}^{(2,1)}B^{(3,h)}\hat{m}_8^{(2,1)}$ in Eq. (14), it should sum the transitions of lag 3 stored in $\hat{h}^{(2,1)}$ to give $\mathcal{A}_{10,8}$ such that the $8^{\mathrm{th}}$ token can be copied to predict the $11^{\mathrm{th}}$ if the lag of the sequence is 3. However, we can notice how simply taking the inner product $\hat{p}_{10}^{(2,1)}\hat{m}_8^{(2,h)}$ would lead to the wrong computations summing over the transitions + +of lag 2 instead of 3 and excluding the transition correspondent to $\tilde{p}_{4,2}$ . This happens because all the transitions are stored starting from the element $i - 1$ of $\hat{p}_i^{(2,1)}$ and not $i$ . To account for this, the matrix $B^{(3,1)}$ performs a permutation such that the mask is shifted by one position. Along with permuting the mask, the matrix $B^{(3,1)}$ also removes the normalization factor $(1/2)$ and includes the missing transitions in the mask. To achieve this, each column of $B^{(3,h)}$ follows a pattern in which the entries are spaced at intervals of $K$ , and the pattern shifts by one position between successive columns such that all possible sequences are present allowing to sum over all possible lags. This shift creates a cyclic arrangement where the columns repeat every $K$ as the transitions within the vector $\hat{p}_i^{(2,h)}$ . + +$$ +\begin{array}{l} \hat {p} _ {1 0} ^ {(2, 1) \top} B ^ {(3, 1)} \hat {m} _ {8} ^ {(2, 1)} = \frac {\beta}{3} \left( \begin{array}{l} \tilde {p} _ {4, 3} \\ \tilde {p} _ {4, 2} \\ \tilde {p} _ {4, 1} \\ \tilde {p} _ {7, 3} \\ \tilde {p} _ {7, 2} \\ \tilde {p} _ {7, 1} \\ \tilde {p} _ {1 0, 3} \\ \tilde {p} _ {1 0, 2} \\ \tilde {p} _ {1 0, 1} \\ 0 \end{array} \right) ^ {\top} \left( \begin{array}{c c c c c c c c c c c c c c c c c c} 0 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 0 \\ 1 & 0 & 0 & 1 & 0 & 0 & 1 & 0 & 0 & 1 \\ 0 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 0 \\ 1 & 0 & 0 & 1 & 0 & 0 & 1 & 0 & 0 & 1 \\ 0 & 1 & 0 & - 1 & - 1 & - 1 & - 1 & - 1 & - 1 & - 1 \\ 0 & 0 & - 1 & - 1 & - 1 & - 1 & - 1 & - 1 & - 1 & - 1 \\ - 1 & - 1 & - 1 & - 1 & - 1 & - 1 & - 1 & - 1 & - 1 & - 1 \\ - 1 & - 1 & - 1 & - 1 & - 1 & - 1 & - 1 & - 1 & - 1 & - 1 \\ - 1 & - 1 & - 1 & - 1 & - 1 & - 1 & - 2 \end{array} \right) \left( \begin{array}{c} 0 \\ 0 \\ 0 \\ \frac {1}{2} \\ \frac {1}{2} \\ \frac {7}{2} \\ \frac {7}{2} \\ \frac {7}{2} \\ \frac {7}{2} \\ \frac {7}{2} \\ \frac {7}{2} \\ \frac {7}{2} \\ \frac {7}{2} \\ \frac {7}{2} \\ \frac {7}{2} \\ \frac {7}{2} \\ \frac {7}{2} \\ \frac {7}{2} \end{array} \right) = \frac {\beta}{3} \left( \begin{array}{c} \tilde {p} _ {4, 3} \\ \tilde {p} _ {4, 2} \\ \tilde {p} _ {4, 1} \\ \tilde {p} _ {7, 3} \\ \tilde {p} _ {7, 2} \\ \tilde {p} _ {7, 1} \\ \tilde {p} _ {1 0, 3}} \\ \tilde {p} _ {1 0, 2} \\ \tilde {p} _ {1 0, 1} \\ \tilde {p} _ {0} \end{array} \right) ^ {\top} \left( \begin{array}{c} - (x) \\ x \\ x \\ x \\ x \\ x \\ x \\ x \\ x \\ x \\ x \\ x \\ x \\ x \\ x \\ x \\ x \\ x \\ x \\ x \\ x \\ x \\ x \\ x \\ x \\ x \\ x \\ x \\ x \\ x \\ x \\ x \\ x \\ x \\ x \\ x \\ x \\ x \\ x +\end{array} \right) \\ = \frac {\beta}{3} (\tilde {p} _ {1 0, 3} + \tilde {p} _ {7, 3} + \tilde {p} _ {4, 3}) \\ \end{array} +$$ + +More in general, the matrix $B^{(3)}$ takes the following form: + +$$ +B _ {i j} ^ {(3)} = \beta \left\{ \begin{array}{l l} + 1, & \text {i f} ((i - j - K + 1) \mod K = 0) \\ - 1, & \text {o t h e r w i s e} \end{array} \right. \tag {15} +$$ + +The additional blocks containing $B^{(3)}$ act on the outputs of the other heads, performing the same operation by selectively summing the transitions of the same lag stored in the respective outputs. Considering all heads and only the non-zero entries after softmax, occurring at $j = i - k + 1$ due to $A^{(3)}$ , we get + +$$ +h _ {i} ^ {(2) \top} \tilde {A} ^ {(3)} h _ {i - k + 1} ^ {(2)} = \sum_ {h = 1} ^ {K} p _ {i} ^ {(2, h) \top} B ^ {(3)} m _ {i - k + 1} ^ {(2, h)} + \lambda = \sum_ {h = 1} ^ {K} \frac {\beta}{T _ {h , i} + 1} \sum_ {n = 0} ^ {T _ {h, i}} \tilde {p} _ {\hat {k} + h + n K, k} + \lambda , +$$ + +where $T_{h,i} = \left\lfloor \frac{i - k - h}{K} \right\rfloor$ . Applying the softmax taking the limit $\lambda \to \infty$ results in non-zero entries of the attention only where $A_{i,j}^{(3)} = +\lambda$ similarly to the first layer. Moreover, for large $i$ for which $T_{h,i} + 1 \approx \frac{i - \hat{k}}{K}$ and absorbing $K$ inside the temperature $\beta$ , considering the last token $T$ we recover the weights in Eq. (3): + +$$ +\mathcal {A} ^ {(3)} \left(h _ {1: T} ^ {(2)}; \tilde {A} ^ {(3)}\right) _ {T, j} = \left\{ \begin{array}{c l} \frac {\exp \left(\frac {\beta}{(T - \hat {k})} \sum_ {n = \hat {k} + 1} ^ {T} \tilde {p} _ {n , n - j + 1}\right)}{\sum_ {r \in \mathcal {K}} \exp \left(\frac {\beta}{(T - \hat {k})} \sum_ {n = \hat {k} + 1} ^ {T} \tilde {p} _ {n , r}\right)} & \text {i f} T - j + 1 = k \quad \text {f o r} k \in \mathcal {K} \\ 0 & \text {e l s e w h e r e} \end{array} \right. \tag {16} +$$ + +# G.1 SELECTIVE INDUCTION HEAD AND NEXTTOKEN PREDICTION + +Selective induction head. Eq. (16) shows how the last attention layer computes a weighted average of the tokens at a distance $k$ from the next one, with weights proportional to the average of the normalized transition probabilities of lag $k$ . In practice, trained models often learn large values of $\beta$ . Thus, we consider the limit $\beta \to \infty$ , where the softmax converges to the hardmax: + +$$ +\mathcal {A} _ {i, j} ^ {(3)} = \mathbb {1} [ i - j + 1 = k ^ {\star} ] \quad \text {w i t h} \quad k ^ {\star} = \operatorname {a r g m a x} _ {k} \sum_ {n = \hat {k} + 1} ^ {i} \tilde {p} _ {n, k}. +$$ + +Here, the transformer selects the causal structure (i.e., the lag) corresponding to the largest $\sum_{n = \hat{k} +1}^{i}\tilde{p}_{j,k}$ . Given the current token $i$ , the third layer then copies the token from the position + +$i - k^{\star} + 1$ , i.e., $\hat{h}_i^{(3)} = \sum_{j = \hat{k}}^i\mathbb{1}[i - j + 1 = k^\star ]h_j^{(2)} = h_{i - k^\star +1}^{(2)}$ . After concatenation to the residual stream, the tokens are of the following form: + +$$ +h _ {i} ^ {(3)} = \left[ e _ {s _ {i}}, e _ {i}, \hat {h} _ {i} ^ {(1)}, \hat {h} _ {i} ^ {(2, 1)}, \dots , \hat {h} _ {i} ^ {(2, H _ {2})}, e _ {s _ {i - k ^ {\star} + 1}}, e _ {i - k ^ {\star} + 1}, \hat {h} _ {i - k ^ {\star} + 1} ^ {(1)}, \hat {h} _ {i - k ^ {\star} + 1} ^ {(2, 1)}, \dots , \hat {h} _ {i - k ^ {\star} + 1} ^ {(2, H _ {2})} \right]. +$$ + +Output layer: next token prediction. Finally, the output layer $\widetilde{W}_O \in \mathbb{R}^{S \times \sum_l d_l}$ contains all zero blocks, except for the one acting on the semantics of the token copied by the third attention. This block learns the transition matrix $P^{\star}$ to predict the transition probabilities to the next token via + +$$ +\widetilde {W} _ {O} = \left(0 _ {S \times S}: 0 _ {S \times T}: 0 _ {S \times d _ {0}}: 0 _ {S \times 2 d _ {0}}: \ldots : 0 _ {S \times 2 d _ {0}}: P ^ {\star^ {\top}}: 0 _ {S \times T}: 0 _ {S \times d _ {0}}: 0 _ {S \times 2 d _ {0}}: \ldots : 0 _ {S \times 2 d _ {0}}\right), +$$ + +i.e., $\widetilde{W}_O h^{(3)} = P^{\star \top} e_{s_{i-k^*+1}} = P_{s_{i-k^*+1}}^\star$ . This final layer shows how transformers can learn a selective induction head. This mechanism adapts to the input sequence by copying the token corresponding to the argmax of a specific quantity extracted by the previous layers and stored in the embeddings. + +# H ALTERNATIVE THIRD LAYER CONSTRUCTION USING POSITIONAL EMBEDDING + +In this section, we illustrate an alternative but equivalent construction that implements the same predictor as in Proposition 1. The first and second layers remain identical, the only difference is in the third layer which implements the selective sum of the normalized transition probabilities. This selection mechanism is implemented through the combination of multiple blocks within the third attention matrix, $\tilde{A}^{(3)}$ , which, in this alternative construction is structured as follows: + +$$ +\tilde {A} ^ {(3)} = \left( \begin{array}{c c c c c c c c c} 0 & 0 & 0 & 0 & 0 & \dots & 0 & 0 \\ 0 & A ^ {(3)} & \dots & \dots & \dots & \dots & \dots & \dots \\ \hline & 0 & 0 & 0 & 0 & \dots & 0 & 0 \\ \hline & 0 & 0 & 0 & 0 & \dots & 0 & 0 \\ \hline 0 & 0 & 0 & 0 & 0 & \dots & 0 & 0 \\ 0 & B ^ {(3, 1)} & 0 & 0 & 0 & \dots & 0 & 0 \\ \hline \vdots & \vdots & \vdots & \vdots & \vdots & \ddots & \vdots & \vdots \\ \hline & 0 & 0 & 0 & 0 & \dots & 0 & 0 \\ \hline 0 & 0 & 0 & 0 & 0 & \dots & 0 & 0 \\ 0 & B ^ {(3, H _ {2})} & 0 & 0 & 0 & \dots & 0 & 0 \end{array} \right) \tag {17} +$$ + +We can notice how, compared to the construction in Section 4, the blocks $B^{(3,1)}, \ldots, B^{(3,H_2)}$ are now positioned all in the first column. Moreover, they are not parameterized by the same matrix contrary to the other construction. The matrix $A^{(3)}$ acts on the positional embedding of the input similarly to the matrix $A^{(1)}$ in the first layer as in the previous construction: + +$$ +A _ {i j} ^ {(3)} = \lambda_ {1} \left\{ \begin{array}{l l l} + 1 & \text {i f} & j - i + 1 \in \mathcal {K} \\ - 1 & \text {i f} & j - i + 1 \notin \mathcal {K} \end{array} \right. A ^ {(3)} = \left( \begin{array}{l l l l l l l l l l l} + \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ + \lambda & + \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ + \lambda & + \lambda & + \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & + \lambda & + \lambda & + \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & + \lambda & + \lambda & + \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda & + \lambda & + \lambda & + \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda & - \lambda & + \lambda & + \lambda & + \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda & - \lambda & + \lambda & + \lambda & + \lambda & + \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & + \lambda & + \lambda & + \lambda \\ - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & + \lambda & + \lambda & + \lambda \end{array} \right) +$$ + +This ensures that the only non-zero entries after softmax will be the ones on the diagonals corresponding to the lags seen during training. The matrices $B^{(3,1)}, \ldots, B^{(3,H_2)}$ are again responsible for the summation; each matrix operates on the output of a corresponding head in the second layer. To understand how this selective sum is implemented, let us consider the output of the first head in the second layer $h^{(2)} = [[e_{s_i}, e_i], \hat{h}_i^{(1)}, \hat{h}_i^{(2,1)}, \ldots, \hat{h}_i^{(2,H_2)}]$ in our example for the tokens 8,9 and 10: + +$$ +\hat {h} _ {1 0} ^ {(2, 1)} = \left. \quad \frac {1}{3} \right. \cdot \left(\sum_ {i = 4, 7, 1 0} e _ {s _ {i}} \quad 0 \quad 0 \quad 0 \quad 1 \quad 0 \quad 0 \quad 1 \quad 0 \quad 0 \quad 1 \quad \sum_ {i = 4, 7, 1 0} \tilde {s} _ {i} \quad \tilde {p} _ {4, 3} \quad \tilde {p} _ {4, 2} \quad \tilde {p} _ {4, 1} \quad \tilde {p} _ {7, 3} \quad \tilde {p} _ {7, 2} \quad \tilde {p} _ {7, 1} \quad \tilde {p} _ {1 0, 3} \quad \tilde {p} _ {1 0, 2} \quad \tilde {p} _ {1 0, 1} \quad 0\right) +$$ + +$$ +\hat {h} _ {9} ^ {(2, 1)} = \boxed {1 / 2} \cdot \left(\begin{array}{c c c c c c c c c c c c c c c c c c} e _ {s _ {6}} + e _ {s _ {9}} & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 1 & 0 & \tilde {s} _ {6} + \tilde {s} _ {9} & 0 & 0 & \tilde {p} _ {6, 3} & \tilde {p} _ {6, 2} & \tilde {p} _ {6, 1} & \tilde {p} _ {9, 3} & \tilde {p} _ {9, 2} & \tilde {p} _ {9, 1} & 0 & 0 \end{array} \right) +$$ + +$$ +\hat {h} _ {8} ^ {(2, 1)} = \begin{array}{c c} 1 / 2 \\ \hline \end{array} \cdot \left( \begin{array}{c c c c c c c c c c c c c c c c c c} e _ {s 5} + e _ {s 8} & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 1 & 0 & 0 & \tilde {s} _ {5} + \tilde {s} _ {8} & 0 & \tilde {p} _ {5, 3} & \tilde {p} _ {5, 2} & \tilde {p} _ {5, 1} & \tilde {p} _ {8, 3} & \tilde {p} _ {8, 2} & \tilde {p} _ {8, 1} \\ \hline \end{array} \right) +$$ + +$$ +\hat {m} _ {8} ^ {\stackrel {(2, 1)} {\left. \right.}} +$$ + +and define $\hat{p}_i^{(2,h)}\in \mathbb{R}^T$ as the block of $\hat{h}_i^{(2,h)}$ which contains the normalized transition probabilities. By the structure in Eq. (17) we can see how, when computing the attention, the matrices $B^{(3,h)}$ act on these two blocks: + +$$ +h _ {i} ^ {(2) \top} \tilde {A} ^ {(3)} h _ {j} ^ {(2)} = \sum_ {h = 1} ^ {K} p _ {i} ^ {(2, h) \top} B ^ {(3, h)} e _ {j} + e _ {i} A ^ {(3)} e _ {j} +$$ + +here we notice how the difference compared to the construction in Section 4 lies in the fact that, due to the position we are not using the copy of the attention to construct the boolean vector but directly the one hot encoding of the position. Each operation involving $B^{(3,h)}$ is still selectively summing the transition probabilities from the correspondent head but with a slightly different mechanism. Let us consider the product $h_i^{(2)\top}\tilde{A}^{(3)}h_{i - k}^{(2)}$ which will be the only non zero entries after softmax, and show how it only sums the transitions of lag $k$ . The main idea is that $B^{(3,h)}$ are boolean matrices such that each column sums only the entries containing the transitions for one of the lags. To achieve this, each column in the matrix follows a pattern in which the entries are spaced at intervals of $K$ , and the pattern shifts by one position between successive columns. This shift creates a cyclic arrangement across the columns which repeats with frequency $K$ . For each head $h$ , the matrix $B^{(3,h)}$ is structured such that the product $\hat{p}_i^{(2,h)}B^{(3,h)}$ results in a vector where each element is the sum of the transitions for a given $k$ . In particular, the first element of the vector corresponds to the sum of $k_{\mathrm{min}}$ , the $K$ -th element corresponds to the sum of $k_{\mathrm{max}}$ , and this pattern repeats cyclically for subsequent elements. To give an example, consider the product $\hat{p}_{10}^{(2,1)}B^{(3,1)}e_8$ in Eq. (I.2), which sums the transitions stored in $\hat{h}^{(2,1)}$ . Notice the structure of $B^{(3,1)}$ ; the first column aligns with the transitions of lag 1 in $\hat{p}_{10}^{(2,1)}$ . Given that the index of $\hat{p}_i^{(2,1)}$ is 10 and the index of $e_j$ is 8, the sum constructs $A_{(10,8)}^{(3)}$ , which is used to copy the $8^{\mathrm{th}}$ token to predict the $11^{\mathrm{th}}$ if the lag of the sequence is 3. Hence, $\hat{p}_{10}^{(2,1)}B^{(3,1)}e_8$ has to sum the transitions of lag 3: + +$$ +\begin{array}{l} \hat {p} _ {1 0} ^ {(2, 1) ^ {\top}} B ^ {(3, 1)} e _ {8} = \frac {\beta}{3} \left( \begin{array}{c} \tilde {p} _ {4, 3} \\ \tilde {p} _ {4, 2} \\ \tilde {p} _ {4, 1} \\ \tilde {p} _ {7, 3} \\ \tilde {p} _ {7, 2} \\ \tilde {p} _ {7, 1} \\ \tilde {p} _ {1 0, 3} \\ \tilde {p} _ {1 0, 2} \\ \tilde {p} _ {1 0, 1} \\ 0 \end{array} \right) ^ {\top} \left( \begin{array}{c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c} 0 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 0 & 1 \\ 1 & 0 & 0 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 0 \\ 0 & 1 & 0 & 0 & 0 & 1 & 0 & 0 & 1 & 0 & 0 \\ 1 & 0 & 0 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 0 \\ 0 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 0 & 1 & 0 \\ 0 & 0 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 0 \\ 1 & 0 & 0 & 1 & 0 & 0 & 1 & 0 & 1 & 0 \\ 0 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 1 & 0 \\ \end{array} \right) \left( \begin{array}{c} 0 \\ 0 \\ 0 \\ 0 \\ 0 \\ \tilde {p} _ {4, 3} + \tilde {p} _ {7, 3} + \tilde {p} _ {1 0, 3} \\ \tilde {p} _ {4, 2} + \tilde {p} _ {7, 2} + \tilde {p} _ {1 0, 2} \\ \tilde {p} _ {4, 1} + \tilde {p} _ {7, 1} + \tilde {p} _ {1 0, 1} \\ \tilde {p} _ {4, 3} + \tilde {p} _ {7, 3} + \tilde {p} _ {1 0, 3} \\ \tilde {p} _ {4, 2} + \tilde {p} _ {7, 2} + \tilde {p} _ {1 0, 2} \\ \tilde {p} _ {4, - } + \tilde {p} _ {7, - } + \tilde {p} _ {1 0, - } \\ \tilde {p} _ {4, - } + \tilde {p} _ {7, - } + \tilde {p} _ {1 0, - } \\ \tilde {p} _ {4, - } + \tilde {p} _ {7, - } + \tilde {p} _ {1 0, - } \\ \tilde {p} _ {4, - } + \tilde {\rho_ {-}} + \tilde {\rho_ {-}} + \tilde {\rho_ {-}} + \tilde {\rho_ {-}} + \tilde {\rho_ {-}} + \tilde {\rho_ {-}} + \tilde {\rho_ {-}} + \tilde {\rho_ {-}} + \tilde {\rho_ {-}} + \tilde {\rho_ {-}} + \tilde {\rho_ {-}} + \tilde {\rho_ {-}} \end{array} \right) ^ {\top} \\ = \frac {\beta}{3} (\tilde {p} _ {1 0, 3} + \tilde {p} _ {7, 3} + \tilde {p} _ {4, 3}) \\ \end{array} +$$ + +We can see how the operation implemented by this different parameterization is the same then in the other construction. Therefore the overall predictor remains unchanged. The additional matrices $B^{(3,h)}$ , which act on the outputs of the other heads $\hat{h}^{(2,h)}$ , perform the same operation by summing the transitions stored in the outputs of the respective heads. The difference in the construction of the matrix $B^{(3,h)}$ for $h \neq 1$ is that the columns are shifted by $h$ positions relative to $h = 1$ . Specifically, for each $h$ , the columns are shifted by $h$ positions compared to the matrix $B^{(3,1)}$ . In more generality, the matrix $B^{(3,h)}$ is constructed as follows: + +$$ +B _ {i j} ^ {(3, h)} = \beta \left\{ \begin{array}{l l} + 1, & \text {i f} ((i - j - h + 1) \mod K = 0) \\ 0, & \text {o t h e r w i s e} \end{array} \right. +$$ + +where $h$ takes into account for the shift. + +# I CONSTRUCTION FOR ANY SET OF LAGS + +The construction illustrated in Section 4 considers only contiguous lags, i.e. set of lags that are intervals of the positive integers. However, both our interleaved Markov chain framework and the Transformer construction can be extended to any set of lags. The implemented algorithm is the same, but the structure of the weights in the different layers becomes more complex because the mechanism with which the transition probabilities are aggregated depends on the relative distance + +between the lags in the set. Due to the difficulties in finding a general formulation of the matrices involved for any set of lags as well as the optimal number of heads which depends now not only on the number of lags but on the relative distance between them, we limit this section into illustrate two example with $T = 10$ and $\mathcal{K} = \{1,3\}$ and $T = 12$ $\mathcal{K} = \{1,3,4\}$ for which we will visualize the matrices and operations involved. + +# I.1 EXAMPLE FOR $\mathcal{K} = \{1,3\}$ + +First layer: The structure of the first layer remains unchanged from Section 4. The important difference is that now the diagonals in the matrix $A^{(1)}$ with positive entries are only $2^{\mathrm{nd}}$ and $4^{\mathrm{th}}$ : + +$$ +\widetilde {A} ^ {(1)} = \left( \begin{array}{c c} \log P ^ {\top} & 0 \\ 0 & A ^ {(1)} \end{array} \right) +$$ + +$$ +A _ {i j} ^ {(1)} = \left\{ \begin{array}{l l} + \lambda & \text {i f} \quad j - i \in \mathcal {K} \\ - \lambda & \text {i f} \quad j - i \not \in \mathcal {K}. \end{array} \right. +$$ + +$$ +A ^ {(1)} = \left( \begin{array}{c c c c c c c c c c} - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ + \lambda & - \lambda & + \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & + \lambda & - \lambda & + \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & + \lambda & - \lambda & + \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda & + \lambda & - \lambda & + \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda & - \lambda & + \lambda & - \lambda & + \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & + \lambda & - \lambda & + \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & + \lambda & - \lambda & + \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & + \lambda & - \lambda & + \lambda & - \end{array} \right) +$$ + +The output token at index $i$ after the first layer still corresponds to a weighted average of the past tokens $h_{i - k}^{(0)}$ for $k\in \mathcal{K}$ where the weights are given by the normalized probabilities $\tilde{p}_{i,k}$ : + +$$ +\begin{array}{l} \hat {h} _ {i} ^ {(1)} = \mathrm {A t t n} (h _ {1: T} ^ {(0)}; \tilde {A} ^ {(1)}) _ {i} = \left\{ \begin{array}{c l} \sum_ {j = 1} ^ {i} \mathbb {1} \left[ i - j \in \mathcal {K} \right] \frac {P _ {s _ {j} , s _ {i}}}{\sum_ {r \in \mathcal {K}} P _ {s _ {r} , s _ {i}}} h _ {j} ^ {(0)} & \text {i f} i > 1 \\ h _ {1} ^ {(0)} & \text {i f} i = 1 \end{array} \right. \\ = \left\{ \begin{array}{c l} \sum_ {k \in \mathcal {K}, k < i} \tilde {p} _ {i, k} h _ {i - k} ^ {(0)} & \text {i f} i > 1 \\ h _ {1} ^ {(0)} & \text {i f} i = 1 \end{array} \right. \\ \end{array} +$$ + +Due to the lack of the entries on the $3^{\mathrm{rd}}$ diagonal, both the attention and the output token will change accordingly: + +$$ +\mathcal {A} ^ {(1)} = \left( \begin{array}{c c c c c c c c c c} 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ \frac {1}{2} & \frac {1}{2} & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ \frac {1}{3} & \frac {1}{3} & \frac {1}{3} & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ \bar {p} _ {4, 3} & 0 & \bar {p} _ {4, 1} & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & \bar {p} _ {5, 3} & 0 & \bar {p} _ {5, 1} & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & \bar {p} _ {6, 3} & 0 & \bar {p} _ {6, 1} & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & \bar {p} _ {7, 3} & 0 & \bar {p} _ {7, 1} & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & \bar {p} _ {8, 3} & 0 & \bar {p} _ {8, 1} & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & \bar {p} _ {9, 3} & 0 & \bar {p} _ {9, 1} & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & \bar {p} _ {1 , - 3} & 0 & \bar {p} _ {1 , - 1} \end{array} \right) \hat {h} ^ {(1)} = \left( \begin{array}{c c c c c c c c c c} \tilde {s} _ {1} & \tilde {s} _ {2} & \tilde {s} _ {3} & \tilde {s} _ {4} & \tilde {s} _ {5} & \tilde {s} _ {6} & \tilde {s} _ {7} & \tilde {s} _ {8} & \tilde {s} _ {9} & \tilde {s} _ {1 0} \\ 1 & \frac {1}{2} _ {2} & \frac {1}{3} _ {3} & \bar {p} _ {4, 3} & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & \frac {1}{2} _ {2} & \frac {1}{3} _ {3} & 0 & \bar {p} _ {5, 3} & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & \frac {1}{3} _ {3} & \bar {p} _ {4, 1} & 0 & \bar {p} _ {6, 3} & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & \bar {p} _ {5, 1} & 0 & \bar {p} _ {7, 3} & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & \bar {p} _ {6, 1} & 0 & \bar {p} _ {8, 3} & 0 & 0 \\ 0 & 0 & 0 & 0 & \bar {p} _ {- - } ^ {\prime}, ^ {\prime}, ^ {\prime}, ^ {\prime}, ^ {\prime}, ^ {\prime}, ^ {\prime}, ^ {\prime}, ^ {\prime}, ^ {\prime}, ^ {\prime}, ^ {\prime}, ^ {\prime}, ^ {\prime}, ^ {\prime}, ^ {\prime}, ^ {\prime}, ^ {\prime}, ^ {\prime}, ^ {\prime}, ^ {\prime}, ^ {\prime}, ^ {\prime}, ^ {\prime}, ^ {\prime}, ^ {\prime}. ^ {\prime}, ^ {\prime}, ^ {\prime}, ^ {\prime}, ^ {\prime}, ^ {\prime}, ^ {\prime}, ^ {\prime}, ^ {\prime}, ^ {\prime}, ^ {\prime}, ^ {\prime}, ^ {\prime}, ^ {\prime}, ^ {\prime}, ^ {\prime}, ^ {\prime}, ^ {\prime}, ^ {\prime}, ^ {\prime}, ^ {\prime}, ^ {\prime}, ^ {\prime}, ^ {\prime}, ^ {\prime}} \\ (1) +$$ + +Second layer. Similarly to the construction for contiguous lags, the second layer is responsible for aggregating the normalized transition probabilities such that they are stored in the embedding of the current vector for its entire history. The second attention needs to learn an effective way of doing a convex combination of the input tokens such that the overlap is minimized and all the transitions are stored without mixing them. Consider the token at $i = 10$ in Eq. (26), summing two consecutive tokens such as $\hat{h}_{9}^{(1)}$ and $\hat{h}_{10}^{(2)}$ , contrary to the contiguous case in Eq. (12), does not lead to any mixing due to the absence of transitions of lag 2. Therefore, 2 attention heads are still sufficient to copy all the transitions in the past as long as they learn to attend two consecutive tokens each. + +Therefore, the optimal way to combine past tokens strictly depends on the number of tokens and the relative distance between them. Hence, finding a general formula for the positions at which the second attention $\mathcal{A}^{(2)}$ should be attended to minimize overlap, is challenging and beyond the scope of this work. Similar considerations apply to the optimal number of heads required, which depends on the solution of the previous problem. However, the task for arbitrary sets of lags, can always be solved by consider the correspondent contiguous problem with $\hat{k} -\min (\mathcal{K} + 1)$ heads. However there are cases in which we can leverage the structure given by the distance between the lags to use fewer heads. One example is the one considered in this section with $\mathcal{K} = \{1,3\}$ we only need two + +heads to achieve optimal sample complexity. The form of the matrix $\tilde{A}^{(2,h)}$ remains unchanged: + +$$ +\tilde {A} ^ {(2, h)} = \left( \begin{array}{c c c} 0 & 0 & 0 \\ 0 & A ^ {(2, 1)} & 0 \\ - & - & - \\ & 0 & 0 \end{array} \right) +$$ + +Considering the case illustrated in Eq. (26), in order for the two heads to copy all the tokens without overlap, it is sufficient to sum two consecutive tokens and skip two. Therefore, the first attention has the pattern: $(0,0,1,1)$ while the second one $(1,1,0,0)$ as illustrated in the following: + +$$ +A ^ {(2, 1)} = \left( \begin{array}{c c c c c c c c c c} - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & + \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & + \lambda & + \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda & + \lambda & + \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda & - \lambda & + \lambda & + \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & + \lambda & - \lambda & - \lambda & + \lambda & + \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & + \lambda & + \lambda & - \lambda & + \lambda & + \lambda & + \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda & + \lambda & + \lambda & + \lambda & + \lambda & + \lambda & + \lambda \end{array} \right) A ^ {(2, 2)} = \left( \begin{array}{c c c c c c c c c c} - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & - \bar {\lambda} & - 1. 0 5 0 5 0 5 0 5 0 5 0 5 0 5 0 5 0 5 0 5 0 5 0 5 0 5 0 5 0 5 0 5 0 5 0 5 0 5 0 5 0 5 0 5 0 5 0 5 0 5 0 0. 0 0 0. 0 0 0. 0 0 0. 0 0 0. 0 0 0. 0 0 0. 0 0 0. 0 0 0. 0 0 0. 0 0 0. 0 0 0. 0 0 0. 0 0 0. 0 0 0. 0 1. 3. 4. 6. 7. 8. 9. 1. 3. 4. 6.7.8.9.1.3.4.6.7.8.9.1.3.4.6.7.8.9.1.3.4.6.7.8.9.1.3.4.6.7.8.9.1.3.4.6.7.8.9.1.3.4.6.7.8.9.1.3.4.6.7.8.9.1.3.4.6 +$$ + +where the first $\hat{k}$ rows and columns are empty because the first $\hat{k}$ elements of the sequence are sampled independently from the stationary distribution and therefore no transitions are present. + +The attention computes the same operation as before: + +$$ +\hat {h} _ {i} ^ {(2)} = \mathrm {A t t n} (h _ {1: T} ^ {(1)}; \tilde {A} ^ {(2, h)}) _ {i} = \sum_ {j = \hat {k}} ^ {i} \frac {\mathbb {1} \left[ A _ {i j} ^ {(2 , h)} = + \lambda \right]}{\sum_ {m = 1} ^ {i} \mathbb {1} \left[ A _ {i m} ^ {(2 , h)} = + \lambda \right]} h _ {j} ^ {(1)}. +$$ + +The output of each head is then concatenated into the residual stream. The structure of the third layer for the general case of any set of lags, also needs some modifications to take into account the particular structure that was enforced in the second layer. We extend the construction introduced in Section H using the positional embeddings. First of all, the matrix $A^{(3)}$ remains unchanged compared to the previous constructions, it has positive values along the diagonals correspondent to the lags shifted by one position to take into account the fact that we are predicting the next token in the sequence: + +$$ +A _ {i j} ^ {(3)} = \left\{ \right.\begin{array}{l l}+ \lambda&\text {i f} j - i + 1 \in \mathcal {K}\\- \lambda&\text {i f} j - i + 1 \notin \mathcal {K}\end{array}\quad A ^ {(3)} = \left(\begin{array}{c c c c c c c c c c}\lambda&- \lambda&- \lambda&- \lambda&- \lambda&- \lambda&- \lambda&- \lambda&- \lambda&- \lambda\\- \lambda&- \lambda&- \lambda&- \lambda&- \lambda&- \lambda&- \lambda&- \lambda&- \lambda&- \lambda\\+ \lambda&- \lambda&+ \lambda&- \lambda&- \lambda&- \lambda&- \lambda&- \lambda&- \lambda&- \lambda\\- \lambda&+ \lambda&- \lambda&+ \lambda&- \lambda&- \lambda&- \lambda&- \lambda&- \lambda&- \lambda\\- \lambda&- \lambda&+ \lambda&- \lambda&+ \lambda&- \lambda&- \lambda&- \lambda&- \lambda&- \lambda\\- \lambda&- \lambda&- \lambda&+ \lambda&- \lambda&+ \lambda&- \lambda&- \lambda&- \lambda&- \lambda\\- \lambda&- \lambda&- \lambda&- \lambda&+ \lambda&+ \lambda&- \lambda&- \lambda&- \lambda&- \lambda\\- \lambda&- \lambda&- \lambda&- \lambda&- \lambda&+ \lambda&+ \lambda&+ \lambda&- \lambda&- \lambda\\- \lambda&- \lambda&- \lambda&- \lambda&- \lambda&- \lambda&+ \lambda&+ \lambda&+ \lambda&+ \lambda\end{array}\right) +$$ + +The matrix $B^{(3)}$ is responsible for the sum of the normalized transitions; each block operates on the output of a corresponding head in the second layer. To understand how, consider the following tokens in output of the first head in the second layer: + +$$ +\hat {h} _ {1 0} ^ {(2)} = \sqrt [ 1 / 4 ]{} \cdot \left(\sum_ {i = 5, 6, 9, 1 0} e _ {s _ {i}} \quad 0 \quad 0 \quad 0 \quad 0 \quad 1 \quad 1 \quad 0 \quad 0 \quad 1 \quad 1 \quad \sum_ {i = 5, 6, 9, 1 0} \tilde {s} _ {i} \quad 0 \quad \tilde {p} _ {5, 3} \quad \tilde {p} _ {6, 3} \quad \tilde {p} _ {5, 1} \quad \tilde {p} _ {6, 1} \quad \tilde {p} _ {9, 3} \quad \tilde {p} _ {1 0, 3} \quad \tilde {p} _ {9, 1} \quad \tilde {p} _ {1 0, 1} \quad 0\right) +$$ + +$$ +\hat {h} _ {9} ^ {(2)} = \sqrt [ 1 / 4 ]{4} \cdot \left(\sum_ {i = 4, 5, 8, 9} e _ {s _ {i}} \quad 0 \quad 0 \quad 0 \quad 1 \quad 1 \quad 0 \quad 0 \quad 1 \quad 1 \quad 0 \quad \sum_ {i = 4, 5, 8, 9} \tilde {s} _ {i} \quad \tilde {p} _ {4, 3} \quad \tilde {p} _ {5, 3} \quad \tilde {p} _ {4, 1} \quad \tilde {p} _ {5, 1} \quad \tilde {p} _ {8, 3} \quad \tilde {p} _ {9, 3} \quad \tilde {p} _ {8, 1} \quad \tilde {p} _ {9, 1} \quad 0 \quad 0\right) +$$ + +$$ +\hat {h} _ {8} ^ {(2)} = \boxed {1 / 3} \cdot \left(\sum_ {i = 4, 7, 8} e _ {s _ {i}} \quad 0 \quad 0 \quad 0 \quad 1 \quad 0 \quad 0 \quad 1 \quad 1 \quad 0 \quad 0 \quad \sum_ {i = 4, 7, 8} \tilde {s} _ {i} \quad \tilde {p} _ {4, 3} \quad 0 \quad \tilde {p} _ {4, 1} \quad \tilde {p} _ {7, 3} \quad \tilde {p} _ {8, 3} \quad \tilde {p} _ {7, 1} \quad \tilde {p} _ {8, 1} \quad 0 \quad 0 \quad 0\right) +$$ + +(21) + +By the structure of $\tilde{A}^{(3)}$ we can see how, when computing the attention, the matrices $B^{(3,h)}$ are applied on the positional encoding $e_j$ and the result is multiplied by $\hat{p}_i^{(2,h)}$ : + +$$ +h _ {i} ^ {(2) \top} \tilde {A} ^ {(3)} h _ {j} ^ {(2) \top} = \sum_ {h = 1} ^ {K} p _ {i} ^ {(2, h) \top} B ^ {(3, h)} e _ {j} + e _ {i} A ^ {(3)} e _ {j} \tag {22} +$$ + +where $B^{(3,h)}$ is selectively summing the transition probabilities from the correspondent head. As for the simpler case of contiguous lags, for the sum to be selective it must hold that $h_i^{(2)\top}\tilde{A}^{(3)}h_{i - k + 1}^{(2)}\propto \sum_{j\leq i}\tilde{p}_{j,k}$ , where $i - k + 1$ are the only non-zero entries due to $A^{(3)}$ after applying softmax. As before, $B^{(3,h)}$ are boolean matrices such that each column sums only the entries containing the transitions for one of the lags. To achieve this, the matrix need to learn the same pattern as in the attention of the second layer $\mathcal{A}^{(2)}$ which was used to sum the vectors and create the current inputs. Each column is shifted by one position and they cyclically repeat with frequency $K$ . In the following example, we consider $\hat{p}_{10}^{(2,1)}B^{(3,1)}e_8$ in Eq. (23), which sums the transitions stored in $\hat{h}^{(2,1)}$ in the entry $\mathcal{A}_{10,8}^{(3)}$ : + +$$ +\begin{array}{l} \hat {p} _ {1 0} ^ {(2, 1) \top} B ^ {(3, 1)} e _ {8} = \frac {\beta}{4} \left( \begin{array}{l} 0 \\ \tilde {p} _ {5, 3} \\ \tilde {p} _ {6, 3} \\ \tilde {p} _ {5, 1} \\ \tilde {p} _ {6, 1} \\ \tilde {p} _ {9, 3} \\ \tilde {p} _ {1 0, 3} \\ \tilde {p} _ {9, 1} \\ \tilde {p} _ {1 0, 1} \\ 0 \end{array} \right) ^ {\top} \left( \begin{array}{l l l l l l l l l l l l} 0 & 1 & 1 & 0 & 0 & 1 & 1 & 0 & 0 & 1 \\ 0 & 0 & 1 & 1 & 0 & 0 & 1 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 & 1 & 0 & 0 & 1 & 1 & 0 \\ 0 & 0 & 0 & 0 & 1 & 1 & 0 & 0 & 1 & 1 \\ 0 & 0 & 0 & 0 & 0 & 1 & 1 & 0 & 0 & 1 \\ 0 & 0 & 0 & 0 & 0 & 0 & 1 & 1 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 1 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 1 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \end{array} \right) \left( \begin{array}{l} 0 \\ 0 \\ 0 \\ 0 \\ \tilde {p} _ {5, 3} \\ \tilde {p} _ {6, 3} \\ \tilde {p} _ {5, 1} \\ \tilde {p} _ {6, 1} \\ \tilde {p} _ {9, 3} \\ \tilde {p} _ {1 0, 3} \\ \tilde {p} _ {9, \mathrm {I}} \\ \tilde {p} _ {1 0, \mathrm {I}} \\ \tilde {p} _ {9, \mathrm {I}} \\ \tilde {p} _ {1 0, \mathrm {I}} \\ \tilde {p} _ {\mathrm {I}} \\ \tilde {p} _ {\mathrm {I}} \\ \tilde {p} _ {\mathrm {I}} \\ \tilde {p} _ {\mathrm {I}} \\ \tilde {p} _ {\mathrm {I}} \\ \tilde {p} _ {\mathrm {I}} \\ \tilde {p} _ {\mathrm {I}} \\ \tilde {p} _ {\mathrm {I}} \\ \tilde {\rho} _ {\mathrm {I}} \\ \tilde {\rho} _ {\mathrm {I}} \\ \tilde {\rho} _ {\mathrm {I}} \\ \tilde {\rho} _ {\mathrm {I}} \\ \tilde {\rho} _ {\mathrm {I}} \\ \tilde {\rho} _ {\mathrm {I}} \\ \tilde {\rho} _ {\mathrm {I}} \\ \tilde {\rho} _ {\mathrm {I}} \\ \\ = \frac {\beta}{4} (\quad \tilde {p} _ {1 0, 3} + \tilde {p} _ {9, 3} + \tilde {p} _ {6, 3} + \tilde {p} _ {5, 3}) \\ \end{array} +$$ + +Notice how the matrix $B^{(3,1)}$ has the same pattern as $A^{(2,1)}$ in Eq. (19) but along the columns instead of the rows. Intuitively it makes sense since we need to sum the same entries resulting from the sum in the previous attention. The matrix $B^{(3,2)}$ acting on second head will have the same pattern but shifted by two positions in order to have the same pattern as $A^{(2,2)}$ . + +# I.2 EXAMPLE WITH $\mathcal{K} = \{1,3,4\}$ + +The case of two lags $\mathcal{K} = \{1,3\}$ despite not being contiguous does not adequately represent the general case. Indeed due to the structure, we could always sum two consecutive tokens and therefore recover optimal performance using 2 heads. It is helpful to also consider a case where the lags do not form a structure that allows for fewer heads in the construction. For example the case of three lags $\mathcal{K} = \{1,3,4\}$ and $T = 12$ : + +First layer: The main structure of the first layer remains unchanged, the diagonals in the matrix $A^{(1)}$ with positive entries are $2^{\mathrm{nd}}$ , $3^{\mathrm{rd}}$ and $4^{\mathrm{th}}$ : + +$$ +\begin{array}{l} \widetilde {A} ^ {(1)} = \left( \begin{array}{c c} \hline \log P ^ {\top} & 0 \\ 0 & A ^ {(1)} \end{array} \right) \\ A ^ {(1)} = \left( \begin{array}{c c c c c c c c c c} - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ + \lambda & - \lambda & + \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ + \lambda & + \lambda & - \lambda & + \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & + \lambda & + \lambda & - \lambda & + \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & + \lambda & + \lambda & - \lambda & + \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda & + \lambda & + \lambda & - \lambda & + \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda & - \lambda & + \lambda & + \lambda & + \lambda & + \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & + \lambda & + \lambda & - \lambda & + \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & + \lambda & + \lambda & + \lambda & + \lambda \end{array} \right) (2 4) \\ \end{array} +$$ + +The output token at index $i$ after the first layer still corresponds to a weighted average of the past tokens $h_{i - k}^{(0)}$ for $k\in \mathcal{K}$ where the weights are given by the normalized probabilities $\tilde{p}_{i,k}$ : + +$$ +\mathcal {A} ^ {(1)} = \left( \begin{array}{c c c c c c c c c c c c c} 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ \frac {1}{2} & \frac {1}{2} & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ \frac {1}{3} & \frac {1}{3} & \frac {1}{3} & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ \frac {1}{4} & \frac {1}{4} & \frac {1}{4} & \frac {1}{4} & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ \frac {\bar {p} _ {5 , 4}}{\bar {p} _ {5 , 3}} & \frac {\bar {p} _ {6 , 3}}{\bar {p} _ {7 , 4}} & \frac {\bar {p} _ {6 , 3}}{\bar {p} _ {7 , 3}} & \frac {\bar {p} _ {6 , 3}}{\bar {p} _ {7 , 3}} & \frac {\bar {p} _ {6 , 3}}{\bar {p} _ {8 , 1}} & \frac {\bar {p} _ {6 , 3}}{\bar {p} _ {9 , 1}} & \frac {\bar {p} _ {6 , 3}}{\bar {p} _ {9 , 1}} & \frac {\bar {p} _ {6 , 3}}{\bar {p} _ {9 , 1}} & \frac {\bar {p} _ {6 , 3}}{\bar {p} _ {9 , 1}} & \frac {\bar {p} _ {6 , 3} ^ {*}}{\bar {p} _ {9 , 1}} & \frac {\bar {p} _ {6 , 3}}{\bar {p} _ {9 , 1}} \\ \frac {\bar {p} _ {8 , 4}}{\bar {p} _ {8 , 4}} & \frac {\bar {p} _ {8 , 4}}{\bar {p} _ {8 , 4}} & \frac {\bar {p} _ {8 , 4}}{\bar {p} _ {8 , 4}} & \frac {\bar {p} _ {8 , 4}}{\bar {p} _ {8 , 4}} & \frac {\bar {p} _ {8 , 4}}{\bar {p}} & \frac {\bar {p} _ {8 , 4}}{\bar {p}} & \frac {\bar {p} _ {8 , 4}}{\bar {p}} & \frac {\bar {p} _ {8 , 4}}{\bar {p}} & \frac {\bar {p} _ {8 , 4}}{\bar {p}} & \frac {\bar {p} _ {8 , 4}}{\bar {P} _ {9 , 1}} \\ \frac {\bar {p} _ {9 , 1}}{\bar {p} _ {9 , 1}} & \frac {\bar {p} _ {9 , 1}}{\bar {p} _ {9 , 1}} & \frac {\bar {p} _ {9 , 1}}{\bar {p} _ {9 , 1}} & \frac {\bar {p} _ {9 , 1}}{\bar {p} _ {9 , 1}} & \frac {\bar {p} _ {9 , 1}}{\bar {p}} & \frac {\bar {p} _ {9 , 1}}{\bar {P} _ {9 , 1}} & \frac {\bar {P} _ {9 , 1}}{\bar {P} _ {9 , 1}} & \frac {\bar {P} _ {9 , 1}}{\bar {P} _ {9 , 1}} & \frac {\bar {P} _ {9 , 1}}{\bar {P} _ {9 , 1}} \\ \frac {\bar {P} _ {9 , 1}}{\bar {P} _ {9 , 1}} & \frac {\bar {P} _ {9 , 1}}{\bar {P} _ {9 , 1}} & \frac {\bar {P} _ {9 , 1}}{\bar {P} _ {9 , 1}} & \frac {\bar {P} _ {9 , 1}}{\bar {P} _ {9 , 2}} & \frac {\bar {P} _ {\mathrm {{I}}} ^ {*}}{\bar {\mathrm {{I}}} ^ {*}} & \frac {\bar {\mathrm {{I}}} ^ {*}}{\bar {\mathrm {{I}}} ^ {*}} & \frac {\bar {\mathrm {{I}}} ^ {*}}{\bar {\mathrm {{I}}} ^ {*}} & \frac {\bar {\mathrm {{I}}} ^ {*}}{\bar {\mathrm {{I}}} ^ {*}} \\ \frac {\bar {\mathrm {{I}}} ^ {*}}{\bar {\mathrm {{I}}} ^ {*}} & \frac {\bar {\mathrm {{I}}} ^ {*}}{\bar {\mathrm {{I}}} ^ {*}} & \frac {\bar {\mathrm {{I}}} ^ {*}}{\bar {\mathrm {{I}}} ^ {*}} & \frac {\bar {\mathrm {{I}}} ^ {*}}{\bar {\mathrm {{I}}} ^ {*}} & \frac {\bar {\mathrm {{I}}} ^ {*}}{\bar {\mathrm {{I}}} ^ {*}} & \frac {\bar {\mathrm {{\it I}}} ^ {*}}{\bar {\mathrm {{I}}} ^ {*}} & \frac {\bar {\mathrm {{\it I}}} ^ {*}}{\bar {\mathrm {{\it I}}} ^ {*}} \\ \frac {\bar {\mathrm {{I}}} ^ {*}}{\bar {\mathrm {{I}}} ^ {*}} & \frac {\bar {\mathrm {{\it I}}} ^ {*}}{\bar {\mathrm {{\it I}}} ^ {*}} & \frac {\bar {\mathrm {{\it I}}} ^ {*}}{\bar {\mathrm {{\it I}}} ^ {*}} & \frac {\bar {\mathrm {{\it I}}} ^ {*}}{\bar {\mathrm {{\it I}}} ^ {*}} & \frac {\bar {\mathrm {{\it I}}} ^ {*}}{\bar {\mathrm {{\it I}}} ^ {*}} & \frac {\bar {\mathrm {{\it I}}} ^ {* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ** * * * * * * * * * * ** + } \\ \hat {h} ^ {(1)} = \left( \begin{array}{c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c t \\ \frac {}{} \\ \frac {}{} \\ \frac {}{} \\ \frac {}{} \\ \frac {}{} \\ \frac {}{} \\ \frac {}{} \\ \frac {}{} \\ \frac {}{} \\ \frac {}{} \\ \frac {}{} \\ \frac {}{} \\ \frac {}{} \\ \frac {}{} \\ \frac {}{} \\ \frac {}{} \\ \frac {}{} \\ \frac {}{} \\ \frac {}{} \\ \frac {}{} \\ \frac {}{25}) +$$ + +Second layer, aggregation of transition probabilities: In this case we can't use anymore the fact that 2 consecutive tokens can be summed without mixing the information. In fact, summing the last tow tokens $\hat{h}_{11}^{(1)}$ and $\hat{h}_{12}^{(2)}$ would now result in the mixing of $\tilde{p}_{11,3}$ and $\tilde{p}_{12,4}$ . In order to avoid this, the only possibility is to sum one token every 4 similar to the case where we would have 4 contiguous lags. This solution is less efficient because summing each 4 tokens while having the missing transition corresponding to lag 2 leaves an empty element in the embedding of the token and adds an additional head, increasing both the dimension and the number of parameters. This means that even if we only have 3 lags, in order to not have any overlap we still need 4 attention heads for our construction to not mix the information. Each head has the pattern $(0,0,0,1)$ shifted by one position as if the lags would be $1,2,3,4$ : + +$$ +A ^ {(2, 1)} = \left( \right.\begin{array}{c c c c c c c c c c c c c}\lambda&- \lambda&- \lambda&- \lambda&- \lambda&- \lambda&- \lambda&- \lambda&- \lambda&- \lambda&- \lambda\\- \lambda&- \lambda&- \lambda&- \lambda&- \lambda&- \lambda&- \lambda&- \lambda&- \lambda&- \lambda&- \lambda\\- \lambda&- \lambda&- \lambda&- \lambda&- \lambda&- \lambda&- \lambda&- \lambda&- \lambda&- \lambda&- \lambda\\- \lambda&- \lambda&- \lambda&- \lambda&- \lambda&- \lambda&- \lambda&- \lambda&- \lambda&- \lambda&- \lambda\\- \lambda&- \lambda&- \lambda&- \lambda&+ \lambda&- \lambda&- \lambda&- \lambda&- \lambda&- \lambda&- \lambda\\- \lambda&- \lambda&- \lambda&- \lambda&- \lambda&+ \lambda&- \lambda&- \lambda&- \lambda&- \lambda&- \lambda\\- \lambda&- \lambda&- \lambda&- \lambda&- \lambda&- \lambda&+ \lambda&- \lambda&- \lambda&- \lambda&- \lambda\\- \lambda&- \lambda&- \lambda&- \lambda&+ \lambda&- \lambda&+ \lambda&+ \lambda&+ \lambda&+ \lambda\\- \lambda&- \lambda&- \lambda&- \lambda&+ \lambda&+ \lambda&+ \lambda&+ \lambda&+ \lambda\\- \lambda&- \lambda&- \lambda&- \lambda&- \lambda&+ \lambda&+ \lambda&+ \lambda&+ \lambda\\- \lambda&- \lambda&- \lambda&- \lambda&- \lambda&- \lambda&+ \lambda&+ \lambda&+ \lambda\\- \lambda&- \lambda&- \lambda&- \lambda&- \lambda&- \lambda&+ \lambda&+ \lambda\\- \lambda&- \lambda&- \lambda&- \lambda&- \lambda&- \lambda&+ \lambda\\- \lambda&- 1. 0 p t {\cdot} 1. 0 p t {\cdot} 1. 0 p t {\cdot} 1. 0 p t {\cdot} 1. 0 p t {\cdot} 1. 0 p t {\cdot} 1. 0 p t {\cdot} 1. 0 p t {\cdot} 1. 0 p t {\cdot} 1. 0 p t {\cdot} 1. 0 p t {\cdot}\end{array}) A ^ {(2, 2)} = +$$ + +$$ +A ^ {(2, 3)} = \left( \begin{array}{c c c c c c c c c c c c c c} - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda\\ - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda & + \lambda \\ - \lambda & - \lambda & - \lambda & - \lambda & + \lambda \\ - \lambda & - \lambda & - \lambda & - \lambda & + \lambda \\ - \lambda & - \lambda & - \lambda & - \lambda & + \lambda \\ - \lambda & - \lambda & - \lambda & + \lambda \\ - \lambda & - \lambda & - \lambda & + \lambda \\ - \lambda & - \lambda & - \lambda & + \lambda \\ + \lambda & + \lambda \\ + \lambda & + \lambda \\ + \lambda & + \lambda \\ + \lambda & + \lambda \\ + \lambda & + \lambda \\ + \lambda & + \lambda \\ + \lambda & + \lambda \\ + \lambda & + \lambda \\ + \lambda & + \lambda \\ + \lambda & + \lambda \\ + \lambda & + \lambda \\ + \lambda & + \lambda \\ + \lambda & 0. 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 4. 9 7 6 p t ] A ^ {(2, 4)} = (1) A ^ {(2, 4)} = (1) A ^ {(2, 4)} = (1) A ^ {(2, 4)} = (1) A ^ {(2, 4)} = (1) A ^ {(2, 4)} = (1) A ^ {(2, 4)} = (1) A ^ {(2, 4)} = (1) A ^ {(2, 4)} = (1) A ^ {(3, 3)} +$$ + +Third layer For the third layer we use again the construction with the positional encoding that was introduced in App H: + +$$ +A _ {i j} ^ {(3)} = \lambda_ {1} \left\{ \begin{array}{l l l} + 1 & \text {i f} & j - i + 1 \in \mathcal {K} \\ - 1 & \text {i f} & j - i + 1 \notin \mathcal {K} \end{array} \right. A ^ {(3)} = \left( \begin{array}{c c c c c c c c c c c c c} \cdot \lambda & \cdot \lambda & \cdot \lambda & \cdot \lambda & \cdot \lambda & \cdot \lambda & \cdot \lambda & \cdot \lambda & \cdot \lambda & \cdot \lambda & \cdot \lambda & \cdot \lambda & \cdot \lambda \\ \cdot \lambda & \cdot \lambda & \cdot \lambda & \cdot \lambda & \cdot \lambda & \cdot \lambda & \cdot \lambda & \cdot \lambda & \cdot \lambda & \cdot \lambda & \cdot \lambda & \cdot \lambda & \cdot \lambda \\ \cdot \lambda & \cdot \lambda & \cdot \lambda & \cdot \lambda & \cdot \lambda & \cdot \lambda & \cdot \lambda \\ + \lambda & + \lambda & - \lambda & + \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & + \lambda & + \lambda & - \lambda & + \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & + \lambda & + \lambda & - \lambda & + \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda & + \lambda & + \lambda & + \lambda \\ - \lambda & - \lambda & - \lambda & - \lambda & + \lambda & + \lambda \\ - \lambda & - \lambda & - \lambda & - \lambda & + \lambda & + \lambda \\ - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & + \lambda \\ - \lambda & - \lambda & - 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0. 5, 0. 5, 0. 5, 0. 5, 0. 5, 0. 5, 0. 5, 0. 5, 0. 5, 0. 5, 0. 5, 0. 5, 0. 5, 0. 5, 0. 5, 0. 5, 0. 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 \\ + (\cdot) ^ {-} (1) ^ {-} (2) ^ {-} (3) ^ {-} (4) ^ {-} (5) ^ {-} (6) ^ {-} (7) ^ {-} (8) ^ {-} (9) ^ {-} (1) ^ {-} (2) ^ {-} (3) ^ {-} (4) ^ {-} (5) ^ {-} (6) ^ {-} (7) ^ {-} (8) ^ {-} (9) ^ {-} (1) ^ {-} (2) ^ {-} (3) ^ {-} (4) ^ {-} (5) ^ {-} (6) ^ {-} (7) ^ {-}. +$$ + +For the selective sum, the matrices $B^{(3,1)}, \ldots, B^{(3,4)}$ have the same form as before but considering now the fact that even if we only have 3 lags in the set, we still need 4 heads: + +$$ +B _ {i j} ^ {(3, h)} = \beta \left\{ \begin{array}{l l} + 1, & \text {i f} \Big ((i - j - h + 1) \mod \hat {k} - \min (\mathcal {K}) + 1 = 0 \Big) \\ 0, & \text {o t h e r w i s e} \end{array} \right. +$$ + +The computation related to the matrix $B^{(3,1)}$ in the attention are reported in the following: + +$$ +\begin{array}{l} \hat {p} _ {1 2} ^ {(2, 1) \top} B ^ {(3, 1)} e _ {1 0} = \frac {\beta}{2} \left( \begin{array}{c} 0 \\ 0 \\ 0 \\ \tilde {p} _ {8, 4} \\ \tilde {p} _ {8, 3} \\ 0 \\ \tilde {p} _ {8, 1} \\ \tilde {p} _ {1 2, 4} \\ \tilde {p} _ {1 2, 3} \\ 0 \\ \tilde {p} _ {1 2, 1} \\ 0 \end{array} \right) ^ {\top} \left( \begin{array}{c c c c c c c c c c c c c c c c c c c} 0 & 1 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 1 \\ 1 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 & 0 & 0 & 0 & 1 & 0 & \end{array} \right) \left( \begin{array}{c} 0 \\ 0 \\ 0 \\ \tilde {p} _ {8, 4} \\ \tilde {p} _ {8, 3} \\ 0 \\ \tilde {p} _ {8, 1} \\ \tilde {p} _ {1 2, 4} \\ \tilde {p} _ {1 2, 3} \\ \tilde {p} _ {1 2, 1} \\ \tilde {p} _ {12, 1} \\ \tilde {p} _ {12, 1} \\ \tilde {p} _ {12, 1} \\ \tilde {p} _ {12, 1} \\ \tilde {p} _ {12, 1} \\ \tilde {p} _ {12, 1} \\ \tilde {p} _ {12, 1} \\ \tilde {\alpha} _ {i j k l m n p q r s t u v w x y z} \end{array} \right) = \frac {\beta}{2} \left( \begin{array}{c} 0 \\ 0 \\ 0 \\ \tilde {p} _ {8, 4} \\ \tilde {p} _ {8, 3} \\ \tilde {p} _ {8, 1} \\ \tilde {p} _ {8, 1} \\ \tilde {p} _ {1 2, 4} \\ \tilde {p} _ {1 2, 3} \\ \tilde {\alpha} _ {i j k l m n p q r s t u v w x y z} \\ \end{array} \right) ^ {\top} \left( \begin{array}{c} 0 \\ \beta_ {i j k l m n p q r s t u v w x y z} \\ \end{array} \right). \\ = \frac {\beta}{2} (\tilde {p} _ {1 2, 3} + \tilde {p} _ {8, 3}) \\ \end{array} +$$ + +# J CONSTRUCTION FOR TWO LAGS AND SINGLE HEAD + +In the constructions illustrated so far, in order to store all the transitions in the history of the current token and not lose any information, we had to scale the number of heads at least as the number of lags in the task $K$ . This allows to achieve optimal sample complexity. However, driven by experimental evidence, we observed that scaling the number of heads as the number of lags is not necessary in the special case of $|\mathcal{K}| = 2$ . In this case indeed, there exists a solution, which transformers can learn, that achieves optimal sample complexity using only one head in the second layer. In the following we will report the construction that proves the previous statement while illustrating it for the case of $\mathcal{K} = \{1,3\}$ analogous to Section I. + +First layer: The structure of the first layer remains unchanged from Section 4. The important difference is that now the diagonals in the matrix $A^{(1)}$ with positive entries are only $2^{\mathrm{nd}}$ and $4^{\mathrm{th}}$ : + +$$ +\widetilde {A} ^ {(1)} = \left( \begin{array}{c c} \log P ^ {\top} & 0 \\ 0 & A ^ {(1)} \end{array} \right) +$$ + +$$ +A _ {i j} ^ {(1)} = \left\{ \begin{array}{l l} + \lambda & \text {i f} \quad j - i \in \mathcal {K} \\ - \lambda & \text {i f} \quad j - i \notin \mathcal {K}. \end{array} \right. +$$ + +$$ +A ^ {(1)} = \left( \begin{array}{c c c c c c c c c c} - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ + \lambda & - \lambda & + \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & + \lambda & - \lambda & + \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & + \lambda & - \lambda & + \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda & + \lambda & - \lambda & + \lambda & - \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda & - \lambda & + \lambda & - \lambda & + \lambda & - \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & + \lambda & - \lambda & + \lambda & - \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & + \lambda & - \lambda & + \lambda & - \lambda \\ - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & - \lambda & + \lambda & - \lambda & + \lambda & - \end{array} \right) +$$ + +Remarking that each input element $s_i$ is encoded as $h_i^{(0)} = [e_{s_i}, e_i] \in \{0, 1\}^{|S| + T}$ , the output token at index $i$ after the first layer still corresponds to a weighted average of the past tokens $h_{i - k}^{(0)}$ for $k \in \mathcal{K}$ where the weights are given by the normalized probabilities $\tilde{p}_{i,k}$ : + +$$ +\begin{array}{l} \hat {h} _ {i} ^ {(1)} = \operatorname {A t t n} (h _ {1: T} ^ {(0)}; \tilde {A} ^ {(1)}) _ {i} = \left\{ \begin{array}{c l} \sum_ {j = 1} ^ {i} \mathbb {1} \left[ i - j \in \mathcal {K} \right] \frac {P _ {s _ {j} , s _ {i}}}{\sum_ {r \in \mathcal {K}} P _ {s _ {r} , s _ {i}}} h _ {j} ^ {(0)} & \text {i f} i > 1 \\ h _ {1} ^ {(0)} & \text {i f} i = 1 \end{array} \right. \\ = \left\{ \begin{array}{c l} \sum_ {k \in \mathcal {K}, k < i} \tilde {p} _ {i, k} h _ {i - k} ^ {(0)} & \text {i f} i > 1 \\ h _ {1} ^ {(0)} & \text {i f} i = 1 \end{array} \right. \\ \end{array} +$$ + +Due to the lack of the entries on the $3^{\mathrm{rd}}$ diagonal, both the attention and the output token will change accordingly: + +$$ +\mathcal {A} ^ {(1)} = \left( \begin{array}{c c c c c c c c c c} 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ \frac {1}{2} & \frac {1}{2} & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ \frac {1}{3} & \frac {1}{3} & \frac {1}{3} & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ \bar {p} _ {4, 3} & 0 & \bar {p} _ {4, 1} & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & \bar {p} _ {5, 3} & 0 & \bar {p} _ {5, 1} & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & \bar {p} _ {6, 3} & 0 & \bar {p} _ {6, 1} & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & \bar {p} _ {7, 3} & 0 & \bar {p} _ {7, 1} & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & \bar {p} _ {8, 3} & 0 & \bar {p} _ {8, 1} & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & \bar {p} _ {9, 3} & 0 & \bar {p} _ {9, 1} & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & \bar {p} _ {1 , - 3} & 0 & \bar {p} _ {1 , - 1}, \end{array} \right) \hat {h} ^ {(1)} = \left( \begin{array}{c c c c c c c c c c} \tilde {s} _ {1} & \tilde {s} _ {2} & \tilde {s} _ {3} & \tilde {s} _ {4} & \tilde {s} _ {5} & \tilde {s} _ {6} & \tilde {s} _ {7} & \tilde {s} _ {8} & \tilde {s} _ {9} & \tilde {s} _ {1 0} \\ \frac {1}{1 / 2} & \frac {1}{2 / 3}, \bar {p} _ {4, 3} & 0 & 0 & 0 & 0 / - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + \\ 0 / \frac {1}{2 / 3}, \frac {1}{3 / 3}, \frac {\tilde {\rho}}{\tilde {\rho}} / \tilde {\rho} _ {-}, \frac {\tilde {\rho}}{\tilde {\rho}} / \tilde {\rho} _ {-}, \frac {\tilde {\rho}}{\tilde {\rho}} / \tilde {\rho} _ {-}, \frac {\tilde {\rho}}{\tilde {\rho}} / \tilde {\rho} _ {-}, \frac {\tilde {\rho}}{\tilde {\rho}} / \tilde {\rho} _ {-}, \frac {p _ {-}}{\tilde {\rho}} / p _ {-}, \frac {\tilde {\rho}}{\tilde {\rho}} / \tilde {\rho} _ {-}, \frac {\tilde {\rho}}{\tilde {\rho}} / \tilde {\rho} _ {-}, \frac {\tilde {\rho}}{\tilde {\rho}} / \tilde {\rho} _ {-}, \frac {\tilde {\rho}}{\tilde {\rho}} / \tilde {\rho} _ {-}, \\ \frac {1}{2 / 3}, \frac {1}{3 / 3}, \frac {\tilde {\rho}}{\tilde {\rho}} / \tilde {\rho} _ {-}, \frac {\tilde {\rho}}{\tilde {\rho}} / \tilde {\rho} _ {-}, \frac {\tilde {\rho}}{\tilde {\rho}} / \tilde {\rho} _ {-}, \frac {\tilde {\rho} _ {-}}{\tilde {\rho}} / \tilde {\rho} _ {-}, \\ \frac {1}{2 / 3}, \frac {1}{3 / 3}, \frac {\tilde {\rho}}{\tilde {\rho}} / \tilde {\rho} _ {-}, \frac {\tilde {\rho}}{\tilde {\rho}} / \tilde {\rho} _ {-}, \\ \frac {1}{2 / 3}, \frac {1}{3 / 3}, \frac {\tilde {\rho}}{\tilde {\rho}} / \tilde {\rho} _ {-}, \frac {\tilde {p}}{\tilde {\rho}}, \\ \frac {1}{2 / 3}, \frac {1}{3 / 3}, \frac {\tilde {\rho}}{\tilde {\rho}} / \tilde {\rho} _ {-}, \\ \frac {1}{2 / 3}, \frac {1}{3 / 3}, \frac {\tilde {\rho}}{\tilde {\rho}} / \tilde {\rho} _ {-}, \\ \frac {1}{2 / 3}, \frac {1}{3 / 3}, \frac {\tilde {\rho}}{\tilde {\rho}} / \tilde {\rho} _ {-}, \\ \frac {1}{2 / 4}, \frac {1}{3 / 4}, \frac {\tilde {\rho}}{\tilde {\rho}} / \tilde {\rho} _ {-}, \\ \frac {1}{2 / 4}, \frac {1}{3 / 4}, \frac {\tilde {\rho}}{\tilde {\rho}} / \tilde {\rho} _ {-}, \\ \frac {1}{2 / 4}, \frac {1}{3 / 4}, \frac {\tilde {\rho}}{p _ {-}}, \\ \frac {1}{2 / 4}, \frac {1}{3 / 4}, \frac {\tilde {\rho}}{p _ {-}}, \\ \frac {1}{2 / 4}, \frac {1}{3 / 4}, \frac {\tilde {\rho}}{p _ {-}}, \\ \frac {1}{2 / 4}, \frac {1}{3 / 4}, \frac {\tilde {\rho}}{p ^ {-}}, \\ \frac {1}{2 / 4}, \frac {1}{3 / 4}, \frac {\tilde {\rho}}{p ^ {-}}, \\ \frac {1}{2 / 4}, \frac {1}{3 / 4}, \\ \frac {1}{2 / 4}, \frac {1}{3 / 4}, \\ \frac {1}{2 / 4}, \\ \frac {1}{2 / 4}, \\ \frac {1}{2 / 4}, \\ \frac {1}{2 / 4}, \\ \frac {1}{2 / 4}, \\ \frac {1}{2 / 4}, \\ \frac {1}{2 / 4}, \\ \frac {1}{2 / 4}, \\ \frac {1}{2 / 4}, \\ \frac {1}{2/4}, \\ \frac {1}{2/4}, \\ \frac {1}{2/4}, \\ \frac {1}{2/4}, \\ \frac {1}{2/4}, \\ \frac {1}{2/4}, \\ \frac {1}{2/4}, \\ \frac {1}{2/4}, \\ \frac {1}{2/4}, \\ \frac {1}{2/4}, \\ \frac {1}{2 / 4}, \\ \frac {1}{2/4}, \\ \frac {1}{2/4}, \\ \frac {1}{2/4}, \\ \frac {1}{2/4}, \\ \frac {1}{2/4}, \\ \frac {1}{2/4}, \\ \frac {1}{2/4}, \\ \frac {1}{2/4}, \\ +$$ + +Second Layer: the second layer uses only the first head $\tilde{A}^{(2)} = \tilde{A}^{(2,1)}$ compared to the construction illustrated in Section I and the matrix $A^{(2)} = A^{(2,1)}$ remains identical. + +$$ +\tilde {A} ^ {(2)} = \left( \begin{array}{c c c} 0 & 0 & 0 \\ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + A ^ {(2)} \end{array} \right) A ^ {(2)} = \left( \begin{array}{c c c c c c c c c c c c} \lambda & \text {-} \lambda & \text {-} \lambda & \text {-} \lambda & \text {-} \lambda & \text {-} \lambda & \text {-} \lambda & \text {-} \lambda & \text {-} \lambda & \text {-} \lambda & \text {-} \lambda & \text {-} \lambda \\ \text {-} \lambda & \text {-} \lambda & \text {-} \lambda & \text {-} \lambda & \text {-} \lambda & \text {-} \lambda & \text {-} \lambda & \text {-} \lambda & \text {-} \lambda & \text {-} \lambda & \text {-} \lambda & \text {-} \lambda \\ \text {-} \lambda & \text {-} \lambda & \text {-} 1 & + \lambda & \text {-} \lambda & \text {-} \lambda & \text {-} \lambda & \text {-} \lambda & \text {-} \lambda & \text {-} \lambda & \text {-} \lambda & \text {-} \lambda \\ \text {-} \lambda & \text {-} 1 & \text {-} 1 & + 1 & + 1 & \text {-} 1 & \text {-} 1 & \text {-} 1 & \text {-} 1 & \text {-} 1 & \text {-} 1 & \text {-} 1 \\ \text {-} 1 & \text {-} 1 & \text {-} 1 & + 1 & + 1 & + 1 & + 1 & + 1 & + 1 & \text {-} 1 & \text {-} 1 & \text {-} 1 \\ \text {-} 1 & \text {-} 1 & \text {-} 1 & + 1 & + 1 & + 1 & + 1 & + 1 & + 1 & + 1 & \text {-} 1 & \text {-} 1 \\ \text {-} 1 & \text {-} 1 & \text {-} 1 & + 1 & + 1 & + 1 & + 1 & + 1 & + 1 & + 1 & + 1 & + 1 \\ \text {-} 1 & \text {-} 1 & \text {-} 1 & + 1 & + 1 & + 1 & + 1 & + 1 & + 1 & + 1 & + 1 & + 1 \\ \text {-} 1 & \text {-} 1 & \text {-} 1 & + 1 & + 1 & + 1 & + 1 & + 0. 5 < | x | | x | | x | | x | | x | | x | | x | | x | | x | | x | | x | | x | | x | | x | | x | | x | | x | | x | | x | | x | | x | | x | | x | | x | | x | | x | | x | | x | | x | | x | | x | | x | | x | | x | +$$ + +For the case of two lags examined here, we can derive a mathematical expression for the matrix $A^{(2)}$ which is valid for any set of lags. For convenience we introduce $\bar{k} = \min \mathcal{K}$ : + +$$ +A _ {i, j} ^ {(2)} = \left\{ \begin{array}{l l} 0, & \text {i f} i < \hat {k} \text {o r} j < \hat {k}, \\ \lambda , & \text {i f} j \leq i \text {a n d} \left(| i - j | \mod 2 (\hat {k} - \bar {k})\right) < (\hat {k} - \bar {k}), \\ 0, & \text {o t h e r w i s e} \end{array} \right. \tag {27} +$$ + +where the first condition ensures that all elements in the first $\hat{k}$ rows and the first $\hat{k}$ columns of the matrix are zero. The condition $j \leq i$ ensures that only the lower triangular part of the matrix (including the diagonal). Finally, the condition $(|i - j| \mod 2d) < d$ introduces a periodic pattern within the lower triangular part of the matrix. The modulo operation creates a repeating cycle of length $2(\hat{k} - \bar{k})$ , and the condition $< (\hat{k} - \bar{k})$ determines whether to place a one or a zero within each cycle segment. + +Third layer: the third layer instead has a different structure. As before, there are only two nonzero blocks $A^{(3)}$ and $B^{(3)}$ but the latter appears in the transpose position compared to the previous constructions: + +$$ +\tilde {A} ^ {(3)} = \left(\begin{array}{c c c c c c c c c}0&0&0&0&0&0\\0&A ^ {(3)}&0&0&0&B ^ {(3)}\\\hline -&0&0&0&0&-\\-&-&-&-&-&-\\0&0&0&0&0&-\\0&0&0&0&0&-\\0&0&0&0&0\end{array}\right) \quad A ^ {(3)} = \left(\begin{array}{c c c c c c c c c}\lambda&\lambda&\lambda&\lambda&\lambda&\lambda&\lambda&\lambda&\lambda\\\cdot \lambda&\cdot \lambda&\cdot \lambda&\cdot \lambda&\cdot \lambda&\cdot \lambda&\cdot \lambda&\cdot \lambda&\cdot \lambda\\+ \lambda&+ \lambda&- \lambda&- \lambda&- \lambda&- \lambda&- \lambda&- \lambda&- \lambda\\\cdot \lambda&+ \lambda&- \lambda&+ \lambda&- \lambda&- \lambda&- \lambda&- \lambda&- \lambda\\\cdot \lambda&\cdot \lambda&+ \lambda&- + \lambda&- \lambda&- \lambda&- \lambda&- \lambda&- \lambda\\\cdot \lambda&\cdot \lambda&- \lambda&+ \lambda&- + \lambda&- \lambda&- \lambda&- \lambda&- \lambda\\\cdot \lambda&\cdot \lambda&- \lambda&- \lambda&+ \lambda&- + \lambda&- \lambda&- \lambda&- \lambda\\\cdot \lambda&\cdot \lambda&- \lambda&- \lambda&- + \lambda&- + \lambda&- + \lambda&- + \lambda\\\cdot \lambda&\cdot \lambda&- \lambda&- \lambda&- + \lambda&- + \lambda&- + \lambda&+ + \lambda\\\cdot \lambda&- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, (2)\end{array}\right) B ^ {(3)} = \beta_ {1} ^ {\left( \right.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, (2) ^ {-} _ {3})} +$$ + +The matrix $A^{(3)}$ remains unchanged and has positive entries along the diagonals, corresponding to the lags shifted by one position. The main difference lies in the matrix $B^{(3)}$ , which now includes negative entries in positions that previously contained zeros. The general formulation of this matrix is the following: + +$$ +A _ {i j} ^ {(3)} = \left\{ \begin{array}{l l} + \lambda & \text {i f} \quad j - i + 1 \in \mathcal {K} \\ - \lambda & \text {i f} \quad j - i + 1 \notin \mathcal {K} \end{array} \right. \qquad B _ {i, j} ^ {(3)} = \left\{ \begin{array}{l l} 0, & \text {i f} j \geq i, \\ + \beta , & \text {i f} \left((i - j - 1) \mod 2 (\hat {k} - \bar {k})\right) < (\hat {k} - \bar {k}), \\ - \beta , & \text {o t h e r w i s e}. \end{array} \right. +$$ + +So far the matrix $B^{(3)}$ has been structured such that it would compute the selective sum of the normalized transition of the lag of the corresponding entry in the attention: $\tilde{A}_{ij}^{(3)} \propto h_i^{(2)\top} \tilde{A}^{(3)}h_{i - k + 1}^{(2)} \propto \sum_{j\leq i}\tilde{p}_{j,k}$ , where $i - k + 1$ are the only non-zero entries due to $A^{(3)}$ after applying softmax. To understand the impact of having negative entries, let us consider the previous example for the case of $\mathcal{K} = \{1,3\}$ and the output of the second attention for the $8^{\mathrm{th}},9^{\mathrm{th}}$ and $10^{\mathrm{th}}$ token: + +$$ +\begin{array}{c} \hat {h} _ {1 0} ^ {(2)} = \boxed {1 / 4} \cdot \left(\sum_ {i = 5, 6, 9, 1 0} e _ {s _ {i}} \quad 0 \quad 0 \quad 0 \quad 0 \quad 1 \quad 1 \quad 0 \quad 0 \quad 1 \quad 1 \quad \sum_ {i = 5, 6, 9, 1 0} \tilde {s} _ {i} \quad 0 \quad \tilde {p} _ {5, 3} \quad \tilde {p} _ {6, 3} \quad \tilde {p} _ {5, 1} \quad \tilde {p} _ {6, 1} \quad \tilde {p} _ {9, 3} \quad \tilde {p} _ {1 0, 3} \quad \tilde {p} _ {9, 1} \quad \tilde {p} _ {1 0, 1} \quad 0\right) \\ \hat {h} _ {9} ^ {(2)} = \boxed {1 / 4} \cdot \left(\sum_ {i = 4, 5, 8, 9} e _ {s _ {i}} \quad 0 \quad 0 \quad 0 \quad 1 \quad 1 \quad 0 \quad 0 \quad 1 \quad 1 \quad 0 \quad \sum_ {i = 4, 5, 8, 9} \tilde {s} _ {i} \quad \tilde {p} _ {4, 3} \quad \tilde {p} _ {5, 3} \quad \tilde {p} _ {4, 1} \quad \tilde {p} _ {5, 1} \quad \tilde {p} _ {8, 3} \quad \tilde {p} _ {9, 3} \quad \tilde {p} _ {8, 1} \quad \tilde {p} _ {9, 1} \quad 0 \quad 0\right) \\ \hat {h} _ {8} ^ {(2)} = \boxed {1 / 3} \cdot \left(\sum_ {i = 4, 7, 8} e _ {s _ {i}} \quad 0 \quad 0 \quad 0 \quad 1 \quad 0 \quad 0 \quad 1 \quad 1 \quad 0 \quad 0 \quad \sum_ {i = 4, 7, 8} \tilde {s} _ {i} \quad \tilde {p} _ {4, 3} \quad 0 \quad \tilde {p} _ {4, 1} \quad \tilde {p} _ {7, 3} \quad \tilde {p} _ {8, 3} \quad \tilde {p} _ {7, 1} \quad \tilde {p} _ {8, 1} \quad 0 \quad 0 \quad 0\right) \\ & p _ {\mathrm {8}} ^ {(2)} \end{array} +$$ + +and define $\hat{p}_i^{(2)}\in \mathbb{R}^T$ as the block of $\hat{h}_i^{(2)}$ which contains the normalized transition probabilities such that $\hat{h}_i^{(2)} = [\sum_{j\in N_i}e_{sj},\hat{m}_i^{(2)},\sum_{j\in N_i}\tilde{s}_j,\hat{p}_i^{(2)}]$ . By the different structure in Eq. (28) we can see how, when computing the attention for the concatenated tokens $h_i^{(2)} = [[e_{s_i},e_i],\hat{h}_i^{(1)},\hat{h}_i^{(2)}]$ , the order of the multiplication has been reversed ( $e_i$ is now on the left) and the matrix $B^{(3)}$ is applied to $\hat{p}_j^{(2)}$ : + +$$ +h _ {i} ^ {(2) \top} \tilde {A} ^ {(3)} h _ {j} ^ {(2)} = e _ {i} ^ {\top} B ^ {(3)} \hat {p} _ {j} ^ {(2)} + e _ {i} A ^ {(3)} e _ {j}. \tag {29} +$$ + +To better understand the implications of the reverse order in the multiplication and the presence of negative entries, consider the product $e_{10}^{\top} B^{(3,1)} \hat{p}_{8}^{(2)}$ in Eq. (31), which sums the transitions stored in + +$\hat{h}^{(2,1)}$ which, after softmax, will correspond to $\mathcal{A}_{10,8}^{(3)}$ : + +$$ +\begin{array}{l} e _ {1 0} ^ {\top} B ^ {(3)} \hat {p} _ {8} ^ {(2) \top} = \frac {\beta}{3} \left( \begin{array}{l} 0 \\ 0 \\ 0 \\ 0 \\ 0 \\ 0 \\ 0 \\ 0 \\ 0 \\ 1 \end{array} \right) ^ {\top} \left( \begin{array}{c c c c c c c c c c c} 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 1 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ - 1 & 1 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ - 1 & - 1 & 1 & 1 & 0 & 0 & 0 & 0 & 0 & 0 \\ 1 & - 1 & - 1 & 1 & 1 & 0 & 0 & 0 & 0 & 0 \\ 1 & 1 & - 1 & - 1 & 1 & 1 & 0 & 0 & 0 & 0 \\ - 1 & 1 & 1 & - 1 & - 1 & 1 & 1 & 0 & 0 & 0 \\ - 1 & - 1 & 1 & 1 & - 1 & - 1 & 1 & 1 & 0 & 0 \\ 1 & - 1 & - 1 & 1 & 1 & - 1 & - 1 & - 1 & 1 & 0 \end{array} \right) \left( \begin{array}{c} \tilde {p} _ {4, 3} \\ 0 \\ \tilde {p} _ {4, 1} \\ \tilde {p} _ {7, 3} \\ \tilde {p} _ {8, 3} \\ \tilde {p} _ {7, 1} \\ \tilde {p} _ {8, 1} \\ 0 \\ 0 \\ 0 \end{array} \right) = \frac {\beta}{3} \left( \begin{array}{c} 1 \\ - 1 \\ - 1 \\ 1 \\ - 1 \\ - 1 \\ - 1 \\ - 1 \\ - 1 \\ - 1 \\ - 1 \\ - 1 \\ - 1 \\ - \end{array} \right) ^ {\top} \left( \begin{array}{c} \tilde {p} _ {4, 3} \\ 0 \\ \tilde {p} _ {4, 1} \\ \tilde {p} _ {7, 3} \\ \tilde {p} _ {8, 3} \\ \tilde {p} _ {7, 1} \\ \tilde {p} _ {8, 1} \\ - p _ {4, 1} \end{array} \right) \quad (3) \end{array} +$$ + +where we observe how, the product involving $B^{(3)}$ , is now not only computing the sum of transitions for the lag 3 as for the previous constructions to copy the $8^{\text{th}}$ to predict the $11^{\text{th}}$ , it is also subtracting all the transitions of lag 3. To fully understand the implications, we also consider the entry of the attention correspondent to the other lag in the set, 1 and the relative product $e_{10}^{\top}B^{(3,1)}\hat{p}_{10}^{(2)}$ : + +$$ +\begin{array}{l} e _ {1 0} ^ {\top} B ^ {(4)} \hat {p} _ {1 0} ^ {(2) \top} = \frac {\beta}{3} \left( \begin{array}{l} 0 \\ 0 \\ 0 \\ 0 \\ 0 \\ 0 \\ 0 \\ 0 \\ 0 \\ 1 \end{array} \right) ^ {\top} \left( \begin{array}{c c c c c c c c c c c c} 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 1 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ - 1 & 1 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ - 1 & - 1 & 1 & 1 & 0 & 0 & 0 & 0 & 0 & 0 \\ 1 & - 1 & - 1 & 1 & 1 & 0 & 0 & 0 & 0 & 0 \\ 1 & 1 & - 1 & - 1 & 1 & 1 & 0 & 0 & 0 & 0 \\ - 1 & 1 & 1 & - 1 & - 1 & 1 & 1 & 0 & 0 & 0 \\ - 1 & - 1 & 1 & 1 & - 1 & - 1 & 1 & 1 & 0 & 0 \\ 1 & - 1 & - 1 & 1 & 1 & - 1 & - 1 & - 1 & 1 & 0 \\ \end{array} \right) \left( \begin{array}{c} 0 \\ \tilde {p} _ {5, 3} \\ \tilde {p} _ {6, 3} \\ \tilde {p} _ {5, 1} \\ \tilde {p} _ {6, 1} \\ \tilde {p} _ {9, 3} \\ \tilde {p} _ {1 0, 3} \\ \tilde {p} _ {9, 1} \\ \tilde {p} _ {1 0, 1} \\ 0 \end{array} \right) = \frac {\beta}{4} \left( \begin{array}{c} - 1 \\ - 1 \\ - 1 \\ - 1 \\ - 1 \\ - 1 \\ - 1 \\ - 1 \\ - 1 \\ - 1 \\ - \end{array} \right) ^ {\top} \left( \begin{array}{c} 0 \\ \tilde {p} _ {5, 3} \\ \tilde {p} _ {6, 3} \\ \tilde {p} _ {5, 1} \\ \tilde {p} _ {6, 1} \\ \tilde {p} _ {9, 3} \\ \tilde {p} _ {1 0, 3} \\ {\tilde {p}} _ {9, 1} \\ {\tilde {p}} _ {1 0, 1} \\ - \end{array} \right) \\ = \frac {\beta}{4} (\quad \tilde {p} _ {1 0, 1} + \quad \tilde {p} _ {9, 1} + \quad \tilde {p} _ {6, 1} + \quad \tilde {p} _ {5, 1} - \quad \tilde {p} _ {1 0, 3} - \quad \tilde {p} _ {9, 3} - \quad \tilde {p} _ {6, 3} - \quad \tilde {p} _ {5, 3}) \end{array} +$$ + +therefore both products contains the sum of the transitions for the respective lags and the negative sum of the other lag and notice how they are all computed on different elements of the past. The first one contains the transitions for the tokens 8,7,4 whereas the second one contains the remaining ones 10,9,6,5. If we now compute the softmax: + +$$ +\begin{array}{l} \mathcal {A} _ {1 0, 1 0} = \frac {\exp \left(e _ {1 0} ^ {\top} B ^ {(3)} \hat {p} _ {1 0} ^ {(2)} + \lambda\right)}{\sum_ {\stackrel {i = 1} {i \neq 8}} ^ {9} \exp \left(e _ {1 0} ^ {\top} B ^ {(3)} \hat {p} _ {j} ^ {(2)} - \lambda\right) + \exp \left(e _ {1 0} ^ {\top} B ^ {(3)} \hat {p} _ {8} ^ {(2)} + \lambda\right) + \exp \left(e _ {1 0} ^ {\top} B ^ {(3)} \hat {p} _ {1 0} ^ {(2)} + \lambda\right)} \\ = \frac {\exp \left(e _ {1 0} ^ {\top} B ^ {(3)} \hat {p} _ {1 0} ^ {(2)}\right)}{\sum_ {\stackrel {i = 1} {i \neq 8}} ^ {9} \exp \left(e _ {1 0} ^ {\top} B ^ {(3)} \hat {p} _ {j} ^ {(2)} - 2 \lambda\right) + \exp \left(e _ {1 0} ^ {\top} B ^ {(3)} \hat {p} _ {8} ^ {(2)}\right) + \exp \left(e _ {1 0} ^ {\top} B ^ {(3)} \hat {p} _ {1 0} ^ {(2)}\right)} \\ \end{array} +$$ + +Considering the limit of $\lambda \to \infty$ : + +$$ +\begin{array}{l} \lim _ {\lambda \to \infty} \mathcal {A} _ {1 0, 1 0} = \frac {\exp \left(e _ {1 0} ^ {\top} B ^ {(3)} \hat {p} _ {1 0} ^ {(2)}\right)}{\exp \left(e _ {1 0} ^ {\top} B ^ {(3)} \hat {p} _ {8} ^ {(2)}\right) + \exp \left(e _ {1 0} ^ {\top} B ^ {(3)} \hat {p} _ {1 0} ^ {(2)}\right)} \\ = \frac {1}{\exp \left(e _ {1 0} ^ {\top} B ^ {(3)} \hat {p} _ {8} ^ {(2)} - e _ {1 0} ^ {\top} B ^ {(3)} \hat {p} _ {1 0} ^ {(2)}\right) + 1} \\ = \frac {1}{\exp \left(+ \frac {\beta}{3} \sum_ {i \in \{8 , 7 , 4 \}} \tilde {p} _ {i , 3} - \frac {\beta}{3} \sum_ {i \in \{8 , 7 , 4 \}} \tilde {p} _ {i , 1} - \frac {\beta}{4} \sum_ {i \in \{1 0 , 9 , 6 , 5 \}} \tilde {p} _ {i , 1} + \sum_ {i \in \{1 0 , 9 , 6 , 5 \}} \tilde {p} _ {i , 3}\right) + 1} \\ \end{array} +$$ + +which is considering all the possible transitions as for the case of two heads therefore achieving optimal sample complexity. \ No newline at end of file diff --git a/ICLR/2025/Selective Induction Heads_ How Transformers Select Causal Structures in Context/images.zip b/ICLR/2025/Selective Induction Heads_ How Transformers Select Causal Structures in Context/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..da540fdc4b2f87bb8810c4194fb03cd7e0848fd5 --- /dev/null +++ b/ICLR/2025/Selective Induction Heads_ How Transformers Select Causal Structures in Context/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:654ece6e36fa1ef6d516fddb87bd5052b456085ec46d44060e00cf8213a164cf +size 3180395 diff --git a/ICLR/2025/Selective Induction Heads_ How Transformers Select Causal Structures in Context/layout.json b/ICLR/2025/Selective Induction Heads_ How Transformers Select Causal Structures in Context/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..11c9b0d3647b2c437dd096660d4c80d632ee3344 --- /dev/null +++ b/ICLR/2025/Selective Induction Heads_ How Transformers Select Causal Structures in Context/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:793d15fe3656ebe3faf6533e56a548a6e1724d844bd49bedf92e4fadd9a627e9 +size 1413691 diff --git a/ICLR/2025/Selective Label Enhancement Learning for Test-Time Adaptation/baeef0dd-a6b2-4471-befd-2fb3b48b023a_content_list.json b/ICLR/2025/Selective Label Enhancement Learning for Test-Time Adaptation/baeef0dd-a6b2-4471-befd-2fb3b48b023a_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..f279a590e724c8ab324c2cf3d2cab5e927c99407 --- /dev/null +++ b/ICLR/2025/Selective Label Enhancement Learning for Test-Time Adaptation/baeef0dd-a6b2-4471-befd-2fb3b48b023a_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9ca94be427c80a24c6273e3d7c7cf58b9ecd8dd3c7cc138e1c52f863dec2edce +size 155289 diff --git a/ICLR/2025/Selective Label Enhancement Learning for Test-Time Adaptation/baeef0dd-a6b2-4471-befd-2fb3b48b023a_model.json b/ICLR/2025/Selective Label Enhancement Learning for Test-Time Adaptation/baeef0dd-a6b2-4471-befd-2fb3b48b023a_model.json new file mode 100644 index 0000000000000000000000000000000000000000..8161d7787acf59a576e790de09f42ab5ab18577a --- /dev/null +++ b/ICLR/2025/Selective Label Enhancement Learning for Test-Time Adaptation/baeef0dd-a6b2-4471-befd-2fb3b48b023a_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4979d7642897a35817b11c5d23dd1c70312bfd5bf9ef19be0054dd7ef0075ab4 +size 185785 diff --git a/ICLR/2025/Selective Label Enhancement Learning for Test-Time Adaptation/baeef0dd-a6b2-4471-befd-2fb3b48b023a_origin.pdf b/ICLR/2025/Selective Label Enhancement Learning for Test-Time Adaptation/baeef0dd-a6b2-4471-befd-2fb3b48b023a_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..a6552b4ca6750529c7b28b3f0a913eda948733f6 --- /dev/null +++ b/ICLR/2025/Selective Label Enhancement Learning for Test-Time Adaptation/baeef0dd-a6b2-4471-befd-2fb3b48b023a_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6d5c6fe232b1151d00e2b274aa52700021879e121532b23ef8bbb05962196fbc +size 581629 diff --git a/ICLR/2025/Selective Label Enhancement Learning for Test-Time Adaptation/full.md b/ICLR/2025/Selective Label Enhancement Learning for Test-Time Adaptation/full.md new file mode 100644 index 0000000000000000000000000000000000000000..bb7cdc5a55915b4b8ccb3b7f411a6ccf7e0b4c67 --- /dev/null +++ b/ICLR/2025/Selective Label Enhancement Learning for Test-Time Adaptation/full.md @@ -0,0 +1,589 @@ +# SELECTIVE LABEL ENHANCEMENT LEARNING FOR TEST-TIME ADAPTATION + +Yihao Hu $^{1,2,*}$ , Congyu Qiao $^{1,2,*}$ , Xin Geng $^{1,2}$ , Ning Xu $^{1,2,\dagger}$ + +$^{1}$ School of Computer Science and Engineering, Southeast University, Nanjing, China + +$^{2}$ Key Laboratory of New Generation Artificial Intelligence Technology and Its Interdisciplinary Applications (Southeast University), Ministry of Education, China {yhhu, qiaocy, xgeng, xning}@seu.edu.cn + +# ABSTRACT + +Test-time adaptation (TTA) aims to adapt a pre-trained model to the target domain using only unlabeled test samples. Most existing TTA approaches rely on definite pseudo-labels, inevitably introducing false labels and failing to capture uncertainty for each test sample. This prevents pseudo-labels from being flexibly refined as the model adapts during training, limiting their potential for performance improvement. To address this, we propose the Progressive Adaptation with Selective Label Enhancement (PASLE) framework. Instead of definite labels, PASLE assigns candidate pseudo-label sets to uncertain ones via selective label enhancement. Specifically, PASLE partitions data into confident/uncertain subsets, assigning one-hot labels to confident samples and candidate sets to uncertain ones. The model progressively trains on certain/uncertain pseudo-labeled data while dynamically refining uncertain pseudo-labels, leveraging increasing target adaptation monitored throughout training. Experiments on various benchmark datasets validate the effectiveness of the proposed approach. The source code is available at https://github.com/palm-ml/PASLE. + +# 1 INTRODUCTION + +Deep neural networks often experience performance degradation when the training and testing data are drawn from different distributions. Test-time adaptation (TTA), an emerging paradigm that adapts a pre-trained model to a different domain using only unlabeled data during testing, aims to alleviate this problem. As the practicality of TTA, it has been successfully applied across various fields, including autonomous driving (Wang et al., 2022; Volpi et al., 2022), medical image segmentation (He et al., 2021; Karani et al., 2021), and speech processing (Kim et al., 2022; Lin et al., 2022). + +Most TTA approaches utilize pseudo-labeling-based methods, which first assign pseudo-labels to the unlabeled target data and then adapt the pre-trained model to the target domain through training on those pseudo-labeled samples. Some approaches utilize non-parametric classifiers to generate pseudo-labels by measuring the distance between samples and prototypical representations (Iwasawa & Matsuo, 2021) or leveraging neighboring feature similarities without model adaptation (Zhang et al., 2023). Other methods rely on the consistency between prototype-based pseudo-labels or nearest-neighbor-based pseudo-labels to guide model updates during adaptation (Jang et al., 2023; Wang et al., 2023; Sun et al., 2024). These approaches aim to improve the robustness and performance of TTA by directly using definite pseudo-labels. + +Due to distribution shifts, most previous approaches inevitably introduce false pseudo-labels by adopting definite pseudo-labels. These approaches may experience significant performance deterioration. The definite pseudo-labels lose the uncertainty information of each class corresponding to the test sample, leading to the fact that the unreliable pseudo-labels cannot be flexibly tuned according to the model's increasing adaptation during the learning process. Therefore, despite making + +efforts in pseudo-labeling, including prototype-based or nearest-neighbor-based methods, previous approaches usually do not fully unleash the potential of pseudo-labels for improving the performance of TTA. + +To address this issue, instead of assigning definite pseudo-labels to test samples, we propose a novel framework named PASLE, i.e., Progressive Adaptation with Selective Label Enhancement. PASLE selectively assigns one-hot pseudo-labels to confident test samples or assigns candidate pseudolabel sets to uncertain test samples in a label enhancement process (Xu et al., 2019; 2020). Specifically, PASLE partitions test samples into confident and uncertain subsets based on the selective label enhancement strategy, where confident samples receive one-hot pseudo-labels, and uncertain samples are assigned candidate pseudo-label sets. The model is then iteratively trained on certain pseudo-labeled target data and uncertain pseudo-labeled target data in a progressive manner while dynamically refining the candidate pseudo-label sets of uncertain samples by exploiting the model's evolving adaptation capability to the target domain, which is monitored during the training process. Our contributions can be summarized as follows: + +- We propose a selective label enhancement strategy, where PASLE partitions test samples into confident and uncertain subsets based on the model's predictive confidence scores, with confident samples receiving one-hot pseudo-labels and uncertain samples being assigned candidate pseudolabel sets. +- We introduce a progressive learning framework that trains the model on certain pseudo-labeled target data and uncertain pseudo-labeled target data in a progressive manner while dynamically refining the candidate pseudo-label sets of uncertain samples by exploiting the model's evolving adaptation capability to the target domain, which is monitored during the training process. +- We theoretically establish a generalization bound for TTA and assess the effectiveness of pseudolabels by quantifying them through the pseudo-label error term. + +# 2 RELATED WORK + +Test-time adaptation. Domain shifts often cause machine learning systems to suffer substantial drops in performance. To address this challenge, numerous techniques have been developed to enhance model robustness against distribution shifts. Domain generalization (Zhou et al., 2022) attempts to train a model on data from one or more source domains, enabling it to generalize effectively to unseen target domains. Domain adaptation (Kouw & Loog, 2021) relies on transductive learning, where knowledge from a labeled source domain is transferred to an unlabeled target domain. Test-time adaptation (Liang et al., 2025) differs by allowing a pre-trained model to adapt to a target domain using only unlabeled test data. Our research centers on online test-time adaptation (OTTA) (Wang et al., 2024), a scenario where test data from the target domain is presented sequentially, requiring real-time adaptation. + +Recent advancements in OTTA have explored various strategies. Some methods (Wang et al., 2021; Gong et al., 2022; Mirza et al., 2022; Zhao et al., 2023) focus on batch normalization (BN) calibration since BN layers can incorporate domain-specific knowledge through the normalization statistics they learn (Li et al., 2017b). Several strategies (Zhang et al., 2022; Jing et al., 2022; Niu et al., 2023; Lee et al., 2024) place emphasis on entropy minimization, aiming to encourage more confident and distinct predictions by reducing the uncertainty in the model's output. Numerous approaches focus on pseudo-labeling, where the model generates pseudo labels for unlabeled data and performs self-training to improve its performance. Iwasawa & Matsuo (2021) create a pseudo-prototype for each class and classify new samples based on the distances. Goyal et al. (2022) introduce a self-training method that utilizes a specialized soft label known as the conjugate pseudo label. Shin et al. (2022) introduce a selective fusion strategy to ensemble predictions from multiple modalities. Meanwhile, Yang et al. (2022) generate soft pseudo labels by averaging the predictions of neighboring samples stored in a memory bank. Döbler et al. (2023) use symmetric cross-entropy loss to enforce prediction consistency between the teacher and student model. Similarly, Jang et al. (2023) aim to reduce divergence between predictions from prototype-based and neighbor-based classifiers. Wang et al. (2023) propose test-time self-distillation for feature uniformity and memorized spatial local clustering for feature alignment. Sun et al. (2024) combine prototype-based and nearest-neighbor methods through a prototype graph model to enhance pseudo-label generation. + +Uncertainty modeling. The previous methods within unsupervised domain adaptation or source-free domain adaptation build up the uncertainty at the model or sample level. For example, at the model level, Zhan et al. (2023) leverage Monte Carlo dropout, and Lao et al. (2021) apply deep ensembles. At the sample level, Liang et al. (2020b); Roy et al. (2022) generate weights using prediction entropy, while Litrico et al. (2023) derive them by analyzing consensus among neighboring samples. Tan et al. (2024) capture both model uncertainty and sample uncertainty using a sub-network. Our proposed method models the uncertainty at the label level through candidate pseudo-label sets, where the uncertainty is directly manifested through the cardinality of the candidate pseudo-label set. Compared to existing approaches, our method imposes no constraints on pre-trained models and does not require additional computations during inference, making it particularly suitable for OTTA scenarios. + +# 3 PROPOSED METHOD + +# 3.1 PRELIMINARIES + +To begin with, some necessary notations are briefly introduced. Let $\mathcal{X} = \mathbb{R}^q$ denote the $q$ -dimensional instance space, $\mathcal{Y} = \{1,2,\dots,c\}$ be the label space with $c$ class labels, and $\Delta^{c-1}$ be the $c$ -dimensional probability simplex. A pre-trained predictive model $f:\mathcal{X}\mapsto \Delta^{c-1}$ with parameters $\Theta$ is initialized to $\Theta^0$ on a dataset from the source domain $S$ , i.e., $\mathcal{D}_S = \{(x_i,y_i)|1\leq i\leq n\}$ where $x_{i}\in \mathcal{X}$ denotes the $q$ -dimensional instance, $y_{i}\in \mathcal{V}$ denotes the correct label annotated to $x_{i}$ and each example $(x_{i},y_{i})$ is sampled from the distribution $p_S(x,y)$ . During test-time inference, the predictive model $f(\cdot;\Theta)$ streamingly receives $R$ mini-batch datasets from the target domain $T$ . At the $r$ -th step, the received dataset is denoted by $\mathcal{D}_T^r = \{\pmb{x}_i^r |1\leq i\leq m^r\}$ where the received instance $\pmb{x}_i^r\in \mathcal{X}$ and its unobserved correct label $y_{i}^{r}$ are from the misaligned distribution $p_T(\pmb{x},y)$ with $p_S(\pmb{x},y)$ , i.e., $p_T(\pmb{x},y)\neq p_S(\pmb{x},y)$ . The goal of OTTA is to continuously update the parameters $\Theta$ of the pre-trained predictive model $f$ to obtain the maximization of the following cumulative accuracy on $R$ mini-batch datasets from the target domain $T$ : + +$$ +\operatorname {A c c} (f, T) = \frac {\sum_ {r = 1} ^ {R} \sum_ {i = 1} ^ {m ^ {r}} \mathbb {I} \left[ y _ {i} ^ {r} = \arg \max _ {j \in \mathcal {Y}} f _ {j} \left(\boldsymbol {x} _ {i} ^ {r} ; \boldsymbol {\Theta} ^ {r}\right) \right]}{\sum_ {r = 1} ^ {R} m ^ {r}}, \tag {1} +$$ + +where $\Theta^r$ is the updated parameters of the model $f$ at the $r$ -th step, and $\mathbb{I}[\cdot]$ is the indicator function. To achieve this goal, the process of progressive label enhancement in our framework introduces pseudo-labels through soft labels output by the predictive model to handle the absence of correct labels during adaptation. The pseudo-label of the testing instance $\pmb{x}_i^r$ is denoted by a logical label vector $\pmb{l}_i^r = [l_i^{r,1}, l_i^{r,2}, \dots, l_i^{r,c}]^\top \in \{0,1\}^c$ , and the corresponding soft label is denoted by a vector $\pmb{d}_i^r = [d_i^{r,1}, d_i^{r,2}, \dots, d_i^{r,c}]^\top = [f_1(\pmb{x}_i^r; \Theta^r), f_2(\pmb{x}_i^r; \Theta^r), \dots, f_c(\pmb{x}_i^r; \Theta^r)] \in [0,1]^c$ satisfying $\sum_{j=1}^{c} d_i^{r,j} = 1$ . When $\sum_{j=1}^{c} l_i^{r,j} = 1$ , the pseudo-label of the testing instance $\pmb{x}_i^r$ is a one-hot pseudo-label. When $1 < \sum_{j=1}^{c} l_i^{r,j} < c$ , the pseudo-label of the testing instance $\pmb{x}_i^r$ is a candidate pseudo-label set. Besides, we prepare a buffer $\mathcal{B}^r$ initialized by $\mathcal{B}^0 = \emptyset$ with maximum size $K$ to save the received instances not used at the $r$ -th step. + +# 3.2 OVERVIEW + +Our framework trains the predictive model with the optimization objective on the split confident subset with one-hot pseudo-labels and the uncertain subset with candidate pseudo-label sets, which are constructed by a selective enhancement strategy using a dynamic threshold. This strategy follows the derived proposition about uncertainty information. Also, we select and incorporate the received instances that are not used at the current optimization step into the prepared buffer for subsequent use. Finally, as the predictive model becomes increasingly aligned with the target domain distribution, the threshold will decrease to progressively refine the pseudo-labels. In this way, we unleash the power of pseudo-labels in OTTA and improve the performance of the predictive model. Theoretically, we demonstrate that our framework achieves a tighter generalization bound by incorporating more target domain instances and evaluates the effectiveness of pseudo-labels by quantifying them through the pseudo-label error term. + +# 3.3 THE PASLE FRAMEWORK + +First of all, we introduce the overall objective $\mathcal{L}$ of the PASLE framework employed to optimize the predictive model parameters $\Theta^{r - 1}$ at $r$ -th step: + +$$ +\mathcal {L} = \frac {1}{| \mathcal {D} _ {H} ^ {r} |} \sum_ {\boldsymbol {x} \in \mathcal {D} _ {H} ^ {r}} \ell (f (\boldsymbol {x}; \boldsymbol {\Theta} ^ {r - 1}), \boldsymbol {l}) + \frac {1}{| \mathcal {D} _ {M} ^ {r} |} \sum_ {\boldsymbol {x} ^ {\prime} \in \mathcal {D} _ {M} ^ {r}} \ell^ {\prime} (f (\boldsymbol {x} ^ {\prime}; \boldsymbol {\Theta} ^ {r - 1}), \boldsymbol {l} ^ {\prime}), \tag {2} +$$ + +where $\ell(\cdot, \cdot)$ is the loss function to handle each instance $x$ from the confident subset $\mathcal{D}_H^r$ with its one-hot pseudo-label $l$ while $\ell'(\cdot, \cdot)$ is the loss function to handle each instance $x'$ from the uncertain subset $\mathcal{D}_M^r$ with its candidate pseudo-label $l'$ , and $|\cdot|$ represents the cardinality of a set. Practically, $\ell(\cdot, \cdot)$ is instantiated as the cross-entropy loss, which has been widely used in supervised learning tasks, while $\ell'(\cdot, \cdot)$ is instantiated as the classifier-consistent loss proposed by Feng et al. (2020): + +$$ +\ell^ {\prime} \left(f \left(\boldsymbol {x} ^ {\prime}; \boldsymbol {\Theta} ^ {r - 1}\right), \boldsymbol {l} ^ {\prime}\right) = - \log \sum_ {j = 1} ^ {c} l ^ {\prime j} f _ {j} \left(\boldsymbol {x} ^ {\prime}; \boldsymbol {\Theta} ^ {r - 1}\right), \tag {3} +$$ + +which has been validated to deal with candidate labels effectively. + +Note that Eq. (2) model the uncertainty information based on the confident subset $\mathcal{D}_H^r$ and uncertain subset $\mathcal{D}_M^r$ , which are split from the received dataset $\mathcal{D}_T^r$ and the buffer dataset $\mathcal{B}^{r-1}$ . The confident set $\mathcal{D}_H^r$ contains the instances whose correct labels could be determined, while the uncertain set $\mathcal{D}_M^r$ contains the instances whose correct labels could be only determined among some candidate labels. Hence, we assign the one-hot pseudo-label $l$ to each instance $\boldsymbol{x} \in \mathcal{D}_H^r$ , and the candidate pseudo-label $l'$ to each instance $\boldsymbol{x}' \in \mathcal{D}_M^r$ . + +Then, a selective label enhancement strategy is induced by the following proposition to construct the confident subset $\mathcal{D}_H^r$ and uncertain subset $\mathcal{D}_M^r$ by utilizing soft pseudo-labels, generating the one-hot pseudo-label $l$ for each instance $\boldsymbol{x} \in \mathcal{D}_H^r$ and candidate pseudo-label $l'$ for each instance $\boldsymbol{x}' \in \mathcal{D}_M^r$ . + +Let $\Theta^{\star}$ be the optimal parameters learned from supervised data from the target domain $T$ , i.e., $\Theta^{\star} = \arg \min_{\Theta} \mathbb{E}_{(\boldsymbol{x},y) \sim p_T(\boldsymbol{x},y)} \mathbb{I}[\arg \max_{j \in \mathcal{Y}} f_j(\boldsymbol{x};\Theta) \neq y]$ , $f(\boldsymbol{x};\Theta^{\star})$ be the class-posterior probabilities for the instance $\boldsymbol{x}$ on the target domain $T$ , i.e., $f_j(\boldsymbol{x};\Theta^{\star}) = p_T(y = j|\boldsymbol{x})$ , $p$ represent the class the highest score of the soft label $\boldsymbol{d}_i^r$ , i.e., $p = \arg \max_{j \in \mathcal{Y}} d_i^{r,j}$ , and $q$ denote the class with the second-highest score of the soft label $\boldsymbol{d}_i^r$ , i.e., $q = \arg \max_{j \in \mathcal{Y}, j \neq p} d_i^{r,j}$ . We provide the following proposition. + +Proposition 1 Assume that at adaptation step $r$ , the difference between $f(\cdot; \Theta^r)$ and $f(\cdot; \Theta^\star)$ on the instance $\boldsymbol{x}_i^r$ is bounded by $\frac{1}{2} \tau(r)$ , i.e., $|f_j(\boldsymbol{x}_i^r; \Theta^r) - f_j(\boldsymbol{x}_i^r; \Theta^\star)| \leq \frac{1}{2} \tau(r), \forall j \in \mathcal{Y}$ . For any $\boldsymbol{x}_i^r$ in the unlabeled data batch $\mathcal{D}_T^r$ , if $d_i^{r,p} - d_i^{r,j} > \tau(r)$ , then $j$ cannot be the correct label of $\boldsymbol{x}_i^r$ . Furthermore, if $d_i^{r,p} - d_i^{r,q} > \tau(r)$ , then $p$ is the correct label of $\boldsymbol{x}_i^r$ . + +The detailed proof can be found in the Appendix A. On the one hand, Proposition 1 provides a condition under which the label with the highest predicted score is guaranteed to be correct, allowing for the accurate assignment of a pseudo-single label to a part of the unlabeled samples. Hence, we could split a confident subset $\mathcal{D}_H^r$ from the received dataset $\mathcal{D}_T^r$ and the buffer dataset $\mathcal{B}^{r-1}$ based on the soft label of each instance and the threshold $\tau(r)$ at the $r$ -th step: + +$$ +\mathcal {D} _ {H} ^ {r} = \left\{\boldsymbol {x} \mid \boldsymbol {x} \in \mathcal {D} _ {T} ^ {r} \cup \mathcal {B} ^ {r - 1}, d ^ {p} - d ^ {q} > \tau (r) \right\}. \tag {4} +$$ + +After splitting the confident subset $\mathcal{D}_H^r$ , we generate the one-hot pseudo-label $l$ for each instance $\pmb{x} \in \mathcal{D}_H^r$ as follows: + +$$ +l ^ {j} = \left\{ \begin{array}{l l} 1, & \text {i f} j = p \text {a n d} d ^ {p} - d ^ {q} > \tau (r), \\ 0, & \text {o t h e r w i s e .} \end{array} \right. \tag {5} +$$ + +On the other hand, Proposition 1 provides a condition under which the label with the low predicted score is guaranteed to be incorrect, allowing for the ambiguous assignment of candidate pseudolabels to a part of the unlabeled samples. Hence, we could split an uncertain subset $\mathcal{D}_M^r$ from the + +# Algorithm 1 PASLE Algorithm + +Require: The pre-trained predictive model $f(\cdot; \Theta^0)$ , total adaption steps $R$ , initial threshold $\tau_{\mathrm{start}}$ , end threshold $\tau_{\mathrm{end}}$ , threshold descend constant $\tau_{\mathrm{des}}$ , buffer maximum size $K$ ; + +1: $\tau(1) \gets \tau_{\mathrm{start}}$ ; +2: Initialize the buffer $\mathcal{B}^0$ as empty; +3: for $r = 1,2,\ldots R$ do + +4: Obtain the confident subset $\mathcal{D}_H^r$ and uncertain subset $\mathcal{D}_M^r$ according to Eq. (4) and Eq. (6); + +5: Generate the one-hot pseudo-label $l$ for each instance $\boldsymbol{x} \in \mathcal{D}_H^r$ using Eq. (5) and the candidate pseudo-label $l'$ for each instance $\boldsymbol{x}' \in \mathcal{D}_M^r$ using Eq. (7); + +6: Optimize the predictive model parameters $\Theta^{r - 1}$ to $\Theta^r$ based on Eq. (2); +7: Update the buffer $\mathcal{B}^{r - 1}$ to $\mathcal{B}^r$ following Eq. (8); +8: Adjust the threshold according to Eq. (9); +9: end for + +Ensure: The predictive model $f(\cdot ;\Theta)$ . + +received dataset $\mathcal{D}_T^r$ and the buffer dataset $\mathcal{B}^{r - 1}$ based on the soft label of each instance and the threshold $\tau (r)$ at the $r$ -th step: + +$$ +\mathcal {D} _ {M} ^ {r} = \left\{\boldsymbol {x} ^ {\prime} \mid \boldsymbol {x} ^ {\prime} \in \mathcal {D} _ {T} ^ {r} \cup \mathcal {B} ^ {r - 1}, \exists j \in \mathcal {Y}, d ^ {t p} - d ^ {\prime j} > \tau (r) \right\}. \tag {6} +$$ + +After splitting the uncertain subset $\mathcal{D}_M^r$ , we generate the candidate pseudo-label $l'$ for each instance $\pmb{x}' \in \mathcal{D}_M^r$ based on the corresponding soft label $\pmb{d}'$ and the threshold $\tau(r)$ at the $r$ -th step as follows: + +$$ +l ^ {\prime j} = \left\{ \begin{array}{l l} 0, & \text {i f} d ^ {\prime p} - d ^ {\prime j} > \tau (r), \\ 1, & \text {o t h e r w i s e .} \end{array} \right. \tag {7} +$$ + +Besides, for the received instances which are not used in Eq. (2), i.e., $(\mathcal{D}_T^r \cup \mathcal{B}^{r-1}) \setminus (\mathcal{D}_H^r \cup \mathcal{D}_M^r)$ , we intend to store them in the new buffer $\mathcal{B}^r$ . If the number of samples to be stored exceeds the buffer's maximum size during the algorithm's operation, we prioritize retaining the samples with the top- $K$ largest margins, as these are likely to contribute to the model's updates earlier. The margin of an instance $\pmb{x}$ is defined as $\rho(\pmb{x}) = \pmb{d}^p - \pmb{d}^q$ . Denote $\rho_K$ the top- $K$ largest margin of the instance $\pmb{x} \in (\mathcal{D}_T^r \cup \mathcal{B}^{r-1}) \setminus (\mathcal{D}_H^r \cup \mathcal{D}_M^r)$ at adaptation step $r$ . Then, the sample selection process can be formulated as follows: + +$$ +\mathcal {B} ^ {r} = \left\{\boldsymbol {x} \mid \boldsymbol {x} \in \left(\mathcal {D} _ {T} ^ {r} \cup \mathcal {B} ^ {r - 1}\right) \backslash \left(\mathcal {D} _ {H} ^ {r} \cup \mathcal {D} _ {M} ^ {r}\right), \rho (\boldsymbol {x}) > \rho_ {K} \right\}, \tag {8} +$$ + +where the buffer's maximum capacity $K$ is restricted to a quarter of the target domain batch size in practice, considering resource consumption. + +Finally, since the model becomes increasingly aligned with the target domain distribution as adaptation progresses, the gap between the scoring function $f(\cdot ;\Theta^r)$ and the class-posterior probability $f(\cdot ;\Theta^{\star})$ is supposed to gradually decrease. Hence, to improve the reliability of pseudo-labels, the threshold $\tau (r)$ is manually reduced over time. In practice, $\tau (r)$ is initialized at a starting value $\tau_{\mathrm{start}}$ when $r = 1$ and is gradually decreased by a constant value $\tau_{\mathrm{des}}$ each step. This process continues until $\tau (r)$ reaches a predefined lower bound $\tau_{\mathrm{end}}$ . The adjustment of $\tau (r)$ can be formulated as: + +$$ +\tau (r) = \max \left\{\tau (r - 1) - \tau_ {\mathrm {d e s}}, \tau_ {\mathrm {e n d}} \right\}. \tag {9} +$$ + +In this way, the PASLE framework successfully leverages the uncertainty information and flexibly tunes pseudo-labels according to the model's evolving adaptation capability, thereby unleashing the potential of pseudo-labels and improving the performance of TTA. The algorithmic description of PASLE is presented in Algorithm 1. + +# 3.4 THEORETICAL ANALYSIS + +# 3.4.1 A GENERALIZATION BOUND FOR TTA + +We theoretically establish a generalization bound for TTA that by incorporating a greater number of target domain samples with effective supervision, a tighter generalization bound can be achieved. + +Suppose that at the $r$ -th step of adaptation, the classifier $h$ receives $m^r$ samples. Given the possibility of overlap between the source domain and the target domain, we assume $(1 - \beta)m^{r}$ samples are drawn from $S$ , and the remaining $\beta m^{r}$ samples are drawn from $T$ . The goal of the classifier is to find a hypothesis that minimizes the target error $\epsilon_T(h)$ . We focus on classifiers that minimize a convex combination of the empirical errors from the source and target domains (Ben-David et al., 2010), defined as: + +$$ +\hat {\epsilon} _ {\alpha} (h) = \alpha \hat {\epsilon} _ {T} (h) + (1 - \alpha) \hat {\epsilon} _ {S} (h), \tag {10} +$$ + +where $\alpha \in [0,1]$ . The corresponding weighted combination of the true source and target errors is denoted by $\epsilon_{\alpha}(h)$ . To quantify the distributional difference between the source domain and target domain, we use the disparity discrepancy introduced by Zhang et al. (2019). + +Definition 1 Given a hypothesis space $\mathcal{H}$ and a specific classifier $h\in \mathcal{H}$ , the Disparity Discrepancy induced by $h^\prime \in \mathcal{H}$ is defined by + +$$ +\begin{array}{l} d _ {h, \mathcal {H}} (S, T) \triangleq \sup _ {h ^ {\prime} \in \mathcal {H}} \left(\operatorname {d i s p} _ {T} \left(h ^ {\prime}, h\right) - \operatorname {d i s p} _ {S} \left(h ^ {\prime}, h\right)\right) \\ = \sup _ {h ^ {\prime} \in \mathcal {H}} \left(\mathbb {E} _ {T} \mathbb {I} [ h ^ {\prime} \neq h ] - \mathbb {E} _ {S} \mathbb {I} [ h ^ {\prime} \neq h ]\right). \tag {11} \\ \end{array} +$$ + +Based on the above assumptions and definition, we derive the following theorem. + +Theorem 1 Let $\mathcal{H}$ be a hypothesis space of VC dimension $d$ . Let $\widehat{S}$ and $\widehat{T}$ be unlabeled sample sets of size $m^{\prime}$ each, drawn from $S$ and $T$ respectively. A batch of samples of size $m^{r}$ is generated by random sampling at the $r$ -th step of adaptation. Given the possibility of overlap between the source domain and the target domain, we assume $(1 - \beta)m^{r}$ samples are drawn from $S$ , and the remaining $\beta m^{r}$ samples are drawn from $T$ , which are then labeled with the true labeling function. For simplicity in theoretical analysis, we allocate the loss weight proportionally to the number of samples from each domain, specifically setting $\alpha$ and $\beta$ to be equal. If $\hat{h} \in \mathcal{H}$ is the empirical minimizer of $\hat{\epsilon}_{\alpha}(h)$ on this batch and $h_T^* = \min_{h \in \mathcal{H}} \epsilon_T(h)$ is the target error minimizer, then for any $\delta > 0$ , with probability at least $1 - 2\delta$ , + +$$ +\begin{array}{l} \epsilon_ {T} (\hat {h}) \leq \epsilon_ {T} \left(h _ {T} ^ {*}\right) + 4 \sqrt {\frac {2 d \log (2 (m ^ {r} + 1)) + 2 \log \left(\frac {4}{\delta}\right)}{m ^ {r}}} \\ + 2 (1 - \beta) \left(d _ {h, \mathcal {H}} (\widehat {S}, \widehat {T}) + 2 \sqrt {\frac {2 d \log \frac {e m ^ {\prime}}{4 d}}{m ^ {\prime}}} + 2 \sqrt {\frac {\log \frac {2}{\delta}}{2 m ^ {\prime}}} + \lambda\right), \tag {12} \\ \end{array} +$$ + +where $\lambda = \mathrm{err}_S(h^*) + \mathrm{err}_T(h^*)$ and $h^* \triangleq \underset{h \in \mathcal{H}}{\arg \min} \left\{ \mathrm{err}_S(h) + \mathrm{err}_T(h) \right\}$ . + +The proof of Theorem 1 is provided in Appendix B. Theorem 1 provides a generalization bound on the target domain for the empirical minimizer on the given batch. Suppose we also have some target domain samples annotated with effective supervisory information provided alongside the well-annotated current data batch to guide the model's adaptation. In that case, the empirical minimizer's generalization bound on the target domain becomes tighter. Since the growth rate of the upper bound's second term is $\mathcal{O}(\sqrt{\frac{\log m}{m}})$ , it decreases as more samples are incorporated into training. Moreover, as the number of target domain samples increases, $\beta$ will also increase, resulting in a reduction of the third term in the upper bound. + +# 3.4.2 PSEUDO-LABEL EFFECTIVENESS QUANTIFICATION + +Next, we assess the effectiveness of pseudo-labels by quantifying them through pseudo-label error terms for TTA. Assume that during test-time inference, the predictive model streamingly receives $R$ mini-batch data from the target domain $T$ , accumulating a dataset $\mathcal{D}_T^R$ over $R$ mini-batches, with a total sample size of $N^R$ . For a target domain sample $\pmb{x}$ , let its Bayes class-probability distribution be denoted as $\pmb{p} = [P(y_1 \mid \pmb{x}), P(y_2 \mid \pmb{x}), \dots, P(y_c \mid \pmb{x})]$ , and its supervision information provided by the algorithm be denoted as $\pmb{q}$ (here it refers to the label distribution). We have the following theorem. + +Theorem 2 Suppose the loss function $\ell$ is bounded by $M$ , i.e., $M = \sup_{\boldsymbol{x} \in \mathcal{X}, f \in \mathcal{F}, y_j \in \mathcal{Y}} \ell(f(\boldsymbol{x}), y)$ . Fix a hypothesis class $\mathcal{F}$ of predictors $f: \mathcal{X} \mapsto \mathbb{R}^c$ , with induced class $\mathcal{H} \subset [0,1]^{\mathcal{X}}$ of functions $h(\boldsymbol{x}) = \ell(f(\boldsymbol{x}_i), \boldsymbol{q})$ . Suppose $\mathcal{H}$ has uniform covering number $\mathcal{N}_{inf}$ . Then for any $\delta \in (0,1)$ , with probability at least $1 - \delta$ , + +$$ +R (f) - \widehat {R} (f) \leq M \sqrt {c} \cdot \left(\mathbb {E} \left[ \| \boldsymbol {q} - \boldsymbol {p} \| _ {2} \right]\right) + \mathcal {O} \left(\sqrt {\mathbb {V} (f) \cdot \frac {\log \frac {\mathcal {M} _ {N R}}{\delta}}{N ^ {R}}} + \frac {\log \frac {\mathcal {M} _ {N R}}{\delta}}{N ^ {R}}\right), \tag {13} +$$ + +where $\mathcal{M}_{N^R} = \mathcal{N}_{\inf}\left(\frac{1}{N^R},\mathcal{H},2N^R\right)$ , and $\mathbb{V}(f)$ is the empirical variance of the loss values. + +The proof of Theorem 2 is provided in Appendix C. Theorem 2 demonstrates that as the target domain samples' label distribution $\pmb{q}$ provided by the algorithm becomes closer to the Bayes class-probability distribution $\pmb{p}$ , the gap between the empirical risk and the expected risk on the accumulated dataset $\mathcal{D}_T^R$ will decrease. The effectiveness of the supervision information can be quantified by the degree of closeness between its corresponding label distribution and the Bayes class-probability distribution and the pseudo-label error term is $\mathbb{E}\left[\| \pmb{q} - \pmb{p}\|_2\right]$ . Our algorithm provides one-hot pseudo-labels when it is more certain about the samples and a candidate pseudo-label set when it is uncertain. These actions can make the corresponding pseudo-labels' label distribution closer to the Bayes class-probability distribution, thereby making the empirical risk more closely aligned with the expected risk and thus better guiding the model toward adaptation to the target domain. + +# 4 EXPERIMENTS + +# 4.1 DATASETS + +Following recent works in OTTA (Jang et al., 2023; Wang et al., 2023; Sun et al., 2024), we use domain generalization datasets and image corruption datasets to evaluate our method. We employ four domain generalization datasets including PACS (Li et al., 2017a), VLCS (Torralba & Efros, 2011), OfficeHome (Venkateswara et al., 2017), and DomainNet (Peng et al., 2019). DomainNet is a large-scale dataset with 586,575 images across 345 classes, covering six domains: clipart, infographic, painting, quickdraw, real, and sketch. For source training, we designate one domain as the target and use the remaining domains as source domains. We allocated $20\%$ of the data from the source domains for validation purposes. + +Additionally, we employ two image corruption datasets: CIFAR-10-C and CIFAR-100-C (Hendrycks & Dietterich, 2019). Both datasets introduce 15 types of common image corruptions, categorized into four types: noise, blur, weather, and digital, to the test sets of CIFAR-10 and CIFAR-100 (Krizhevsky, 2009). We use the training sets of CIFAR-10 and CIFAR-100 as source domains and the highest level of corruption in CIFAR-10-C and CIFAR-100-C as target domains. The validation set partition follows the same approach as that used for the domain generalization datasets. + +# 4.2 BASELINES + +We compare the performance of PASLE with ten OTTA approaches. + +- ERM (Vapnik, 1998): A standard approach that directly outputs the model's predictions without adaptation. +- BN (Schneider et al., 2020): A BN calibration approach that replaces the activation statistics estimated by BN layers on the training set with the statistics of the target domain images. +- TENT (Wang et al., 2021): An entropy minimization approach that optimizes channel-wise affine transformations by reducing the entropy of model predictions on target domain data. +- PL (Lee, 2013): A pseudo-labeling approach that fine-tunes a pre-trained classifier by leveraging confident pseudo-labels derived from the model's predictions. +- SHOT-IM (Liang et al., 2020a): An information maximization approach that refines the source encoding module by maximizing the mutual information between intermediate feature representations and the classifier's outputs. + +Table 1: Classification accuracy of comparing methods on domain generalization datasets. + +
MethodsBackBonePACSVLCSOfficeHomeDomainNetAvg.
ERM79.3775.1462.4335.7663.18
BN83.0868.7962.2934.9562.28
TENT83.2369.2862.5135.3762.60
PL85.6674.6862.7135.2464.57
SHOT-IM83.0270.8063.9135.9263.41
T3AResNet-1881.7075.8363.9036.3164.44
TAST84.3171.6963.9635.7163.92
TAST-BN86.3575.1762.4335.8264.94
TSD87.8875.4763.4235.8665.66
PROGRAM83.5771.6463.3535.9763.63
DEYO86.2674.9163.3035.3764.96
PASLE88.1677.9163.9936.8966.74
ERM85.8476.0667.8443.1668.23
BN86.0067.7666.8241.5065.52
TENT86.5168.4167.2742.3866.14
PL85.6673.8067.3142.3867.29
SHOT-IM85.2768.4967.8943.4166.27
T3AResNet-5086.5476.5968.8544.0069.00
TAST86.9467.3268.7042.8466.45
TAST-BN89.4775.5967.9743.0369.02
TSD91.1374.7768.9742.4469.33
PROGRAM86.1668.8568.0343.3466.60
DEYO88.2371.5968.0842.4767.59
PASLE91.3678.7069.3744.9171.09
+ +Table 2: Classification accuracy of comparing methods on image corruption datasets. + +
MethodsCIFAR-10-CCIFAR-100-C
ERM20.665.84
BN75.3343.88
TENT75.4143.93
PL75.7044.24
SHOT-IM75.8544.36
T3A23.526.74
TAST74.1339.21
TAST-BN74.5631.84
TSD75.1444.19
PROGRAM75.0044.06
DEYO75.7444.28
PASLE76.6745.32
+ +- T3A (Iwasawa & Matsuo, 2021): A pseudo-labeling approach that predicts test data labels by measuring the distances between the test samples and pseudo-prototypes. +- TAST (Jang et al., 2023): A pseudo-labeling approach that updates the model by matching the nearest neighbor-based pseudo label and a prototype-based class distribution for the test data. +- TAST-BN (Jang et al., 2023): A pseudo-labeling approach, which is a modified version of TAST and refines the model by adjusting the parameters of the BN layers. + +Table 3: Classification accuracy (mean ± std) of PASLE and its variant on target domains of the OfficeHome dataset. The best performance is shown in boldface. + +
DomainPASLEPASLE-NC
A57.25±0.7556.11±0.92
C51.30±0.4150.85±0.68
P73.31±1.0472.13±1.43
R74.10±0.2073.87±0.45
+ +![](images/e1a9c02dd9f2c1a5a8888ac11d6c1221c25fba5a4e9264ac8e2ad00f0e6a3e12.jpg) +Figure 1: Sample utilization during testing. + +- TSD (Wang et al., 2023): A pseudo-labeling approach that employs a dynamic memory bank to compute class prototypes and generate pseudo-labels for refining the model. +- PROGRAM (Sun et al., 2024): A pseudo-labeling approach that leverages a graph structure that connects prototypes with test samples, allowing information to flow between them and enhancing the generation of pseudo-labels. +- DEYO (Lee et al., 2024): An entropy minimization approach that updates the model by minimizing the model output's entropy of samples with low entropy and high PLPD value concurrently. + +We evaluate all methods on domain generalization benchmarks using ResNet-18 and ResNet-50 models (He et al., 2016), both equipped with batch normalization (Ioffe & Szegedy, 2015). For image corruption benchmarks, we employ ResNet-18 as the backbone model. + +For source training, the models are trained using the Adam optimizer with a learning rate of $5e^{-5}$ for domain generalization benchmarks and $1e^{-3}$ for image corruption benchmarks. All weights are initialized from ImageNet-1K (Russakovsky et al., 2015) pre-trained models. We select the final pre-trained model with the highest validation accuracy. + +During testing, we also utilize the Adam optimizer to update all trainable layers without the need for a specific selection. The batch size for the online target domain data is set to 128, with the buffer capacity $K$ set to one-fourth of the batch size, i.e., 32. The learning rate is selected from the range between $1e^{-3}$ and $1e^{-6}$ . The value of $\tau_{\mathrm{start}}$ is determined by the number of classes in each dataset: for example, VLCS contains 5 classes, while DomainNet has 345 classes, leading to different $\tau_{\mathrm{start}}$ values for each dataset. The threshold gap, represented as $|\tau_{\mathrm{start}} - \tau_{\mathrm{end}}|$ , is consistently set at 0.1. Furthermore, $\tau_{\mathrm{des}}$ is uniformly set to $1e^{-3}$ for all datasets, except for the large-scale dataset DomainNet, where it is adjusted to $1e^{-4}$ . It is essential to highlight that all hyperparameters for the OTTA setting are finalized prior to accessing any test samples. We meticulously select the most suitable hyperparameters for each algorithm based on their performance on the training domain validation datasets (Gulrajani & Lopez-Paz, 2021; Wang et al., 2023). + +# 4.3 EXPERIMENTAL RESULTS + +We conduct 3 trials with different random seeds, reporting both the mean and standard deviation of the metrics, with full results detailed in Appendix E. Each method's classification accuracy across datasets' target domains is summarized in Table 1 and Table 2. The best performance is shown in boldface, and the second-best result is underlined. It is impressive to observe that: + +- PASLE achieves the best performance across all benchmark datasets and network architectures, outperforming all the compared approaches. +- PASLE consistently enhances the performance of the classifier on domain generalization benchmarks, achieving an average improvement of $5.63\%$ for ResNet-18 and $4.19\%$ for ResNet-50. +- PASLE outperforms the second-best methods on image corruption benchmarks, with an average performance gain of $1.08\%$ on CIFAR-10-C and $2.16\%$ on CIFAR-100-C. + +Figure 2: The parameter sensitivity analysis for PASLE. +![](images/2017ac8a7260cd33e70fe59e08c8fd1d724af05d21166ded1a549481b4350d06.jpg) +(a) The sensitivity of $\tau_{\mathrm{start}}$ and $\tau_{\mathrm{end}}$ on CIFAR-10-C. + +![](images/fccae62340b423a727b87380731a21875bd485878d36f67806f17bc9c6ff5062.jpg) +(b) The sensitivity of batch size on CIFAR-10-C. + +- Especially, we find that PASLE significantly improves the performance of the pre-trained classifier on the DomainNet benchmark, which is a large-scale dataset, indicating that PASLE holds strong potential for real-world applications. + +# 4.4 FURTHER ANALYSIS + +To demonstrate the effectiveness of the candidate pseudo-labels in PASLE, we conduct an ablation study using a vanilla variant, PASLE-NC. In PASLE-NC, all samples annotated with candidate pseudo-labels are excluded from model updates. As shown in Table 3, PASLE outperforms PASLE-NC on all target domains of the OfficeHome dataset with ResNet-18, highlighting the importance of candidate pseudo-labels in further improving performance during the testing phase. + +Furthermore, Figure 1 shows the sample utilization during the testing process for both PASLE and PASLE-NC on the clipart domain of OfficeHome dataset. It is evident that PASLE utilizes more effectively labeled samples than PASLE-NC as testing progresses, which further explains PASLE's better test-time adaptation performance. + +Besides, we perform a parameter sensitivity analysis to examine the impact of two hyperparameters $\tau_{\mathrm{start}}$ and $\tau_{\mathrm{end}}$ on our algorithm using the shot noise corruption of CIFAR-10-C dataset. $\tau_{\mathrm{start}}$ and $\tau_{\mathrm{end}}$ are assigned various values as illustrated in Figure 2(a), with $\tau_{\mathrm{des}}$ being set to $\frac{\tau_{\mathrm{start}} - \tau_{\mathrm{end}}}{R}$ specifically for the purpose of sensitivity analysis. Clearly, the performance of PASLE remains relatively stable across a broad range of each hyperparameter. This robustness is highly desirable, as the PASLE framework consistently delivers reliable test-time adaptation performance. + +Figure 2(b) presents the average accuracy of various methods across different batch sizes on shot noise corruption of CIFAR-10-C dataset. As depicted in the figure, our approach consistently outperforms the other methods under varying batch sizes. This robust performance makes PASLE well-suited for deployment in practical scenarios, where the batch size of real-world data streams can fluctuate significantly. + +More discussions of PASLE can be found in the appendix D. + +# 5 CONCLUSION + +In this paper, we focus on test-time adaptation and introduce a novel framework, PASLE, which selectively assigns one-hot pseudo-labels to confident test samples and candidate pseudo-label sets to uncertain test samples through a label enhancement process. The model is then progressively trained on both certain and uncertain pseudo-labeled target data. Throughout this process, the candidate pseudo-label sets for uncertain samples are dynamically refined by leveraging the model's evolving adaptation to the target domain, which is continuously monitored during training. Experiments on various benchmark datasets demonstrate the effectiveness and robustness of the proposed approach. + +# ACKNOWLEDGMENTS + +This research was supported by the Jiangsu Science Foundation (BG2024036), the National Science Foundation of China (62206050, 62125602, and U24A20324), the Fundamental Research Funds for the Central Universities (2242024k30035), and the Big Data Computing Center of Southeast University. + +# REFERENCES + +Shai Ben-David, John Blitzer, Koby Crammer, Alex Kulesza, Fernando Pereira, and Jennifer Wortman Vaughan. A theory of learning from different domains. Machine Learning, 79(1-2):151-175, 2010. +George Bennett. Probability inequalities for the sum of independent random variables. Journal of the American Statistical Association, 57(297):33-45, 1962. +Mario Döbler, Robert A. Marsden, and Bin Yang. Robust mean teacher for continual and gradual test-time adaptation. In Proceedings of the 2023 IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 7704-7714, Vancouver, Canada, 2023. +Lei Feng, Jiaqi Lv, Bo Han, Miao Xu, Gang Niu, Xin Geng, Bo An, and Masashi Sugiyama. Provably consistent partial-label learning. In Advances in Neural Information Processing Systems 33, pp. 10948-10960, Virtual Event, 2020. +Taesik Gong, Jongheon Jeong, Taewon Kim, Yewon Kim, Jinwoo Shin, and Sung-Ju Lee. Note: Robust continual test-time adaptation against temporal correlation. In Advances in Neural Information Processing Systems 35, pp. 27253-27266, New Orleans, LA, 2022. +Sachin Goyal, Mingjie Sun, Aditi Raghunathan, and J. Zico Kolter. Test time adaptation via conjugate pseudo-labels. In Advances in Neural Information Processing Systems 35, pp. 6204-6218, New Orleans, LA, 2022. +Ishaan Gulrajani and David Lopez-Paz. In search of lost domain generalization. In Proceedings of the 9th International Conference on Learning Representations, Virtual Event, 2021. +Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the 2016 IEEE Conference on Computer Vision and Pattern Recognition, pp. 770-778, Las Vegas, NV, 2016. +Yufan He, Aaron Carass, Lianrui Zuo, Blake E Dewey, and Jerry L Prince. Autoencoder based self-supervised test-time adaptation for medical image analysis. Medical Image Analysis, 72:102136, 2021. +Dan Hendrycks and Thomas G. Dietterich. Benchmarking neural network robustness to common corruptions and perturbations. In Proceedings of the 7th International Conference on Learning Representations, New Orleans, LA, 2019. +Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In Proceedings of the 32nd International Conference on Machine Learning, pp. 448-456, Lille, France, 2015. +Yusuke Iwasawa and Yutaka Matsuo. Test-time classifier adjustment module for model-agnostic domain generalization. In Advances in Neural Information Processing Systems 34, pp. 2427-2440, Virtual Event, 2021. +Minguk Jang, Sae-Young Chung, and Hye Won Chung. Test-time adaptation via self-training with nearest neighbor information. In Proceedings of the 11th International Conference on Learning Representations, Kigali, Rwanda, 2023. +Mengmeng Jing, Xiantong Zhen, Jingjing Li, and Cees Snoek. Variational model perturbation for source-free domain adaptation. In Advances in Neural Information Processing Systems 35, pp. 17173-17187, New Orleans, LA, 2022. + +Neerav Karani, Ertunc Erdil, Krishna Chaitanya, and Ender Konukoglu. Test-time adaptable neural networks for robust medical image segmentation. Medical Image Analysis, 68:101907, 2021. +Jangho Kim, Jun-Tae Lee, Simyung Chang, and Nojun Kwak. Variational on-the-fly personalization. In Proceedings of the 39th International Conference on Machine Learning, pp. 11134-11147, Baltimore, MD, 2022. +Wouter M. Kouw and Marco Loog. A review of domain adaptation without target labels. IEEE Transactions on Pattern Analysis and Machine Intelligence, 43(3):766-785, 2021. +Alex Krizhevsky. Learning multiple layers of features from tiny images. Technical report, University of Toronto, 2009. +Qicheng Lao, Xiang Jiang, and Mohammad Havaei. Hypothesis disparity regularized mutual information maximization. In Proceedings of the 35th AAAI Conference on Artificial Intelligence, pp. 8243-8251, Virtual Event, 2021. +Dong-Hyun Lee. Pseudo-label: The simple and efficient semi-supervised learning method for deep neural networks. In Working Notes of the ICML 2013 Workshop on Challenges in Representation Learning, Atlanta, GA, 2013. +Jonghyun Lee, Dahuin Jung, Saehyung Lee, Junsung Park, Juhyeon Shin, Uiwon Hwang, and Sungroh Yoon. Entropy is not enough for test-time adaptation: From the perspective of disentangled factors. In Proceedings of the 12th International Conference on Learning Representations, Vienna, Austria, 2024. +Da Li, Yongxin Yang, Yi-Zhe Song, and Timothy M. Hospedales. Deeper, broader and artier domain generalization. In Proceedings of the 2017 IEEE International Conference on Computer Vision, pp. 5543-5551, Venice, Italy, 2017a. +Yanghao Li, Naiyan Wang, Jianping Shi, Jiaying Liu, and Xiaodi Hou. Revisiting batch normalization for practical domain adaptation. In Proceedings of the 5th International Conference on Learning Representations Workshops, Toulon, France, 2017b. +Jian Liang, Dapeng Hu, and Jiashi Feng. Do we really need to access the source data? Source hypothesis transfer for unsupervised domain adaptation. In Proceedings of the 37th International Conference on Machine Learning, pp. 6028-6039, Virtual Event, 2020a. +Jian Liang, Yunbo Wang, Dapeng Hu, Ran He, and Jiashi Feng. A balanced and uncertainty-aware approach for partial domain adaptation. In Proceedings of the 16th European Conference on Computer Vision, volume 11, pp. 123-140, Glasgow, UK, 2020b. +Jian Liang, Ran He, and Tieniu Tan. A comprehensive survey on test-time adaptation under distribution shifts. International Journal of Computer Vision, 133(1):31-64, 2025. +Guan-Ting Lin, Shang-Wen Li, and Hung-yi Lee. Listen, adapt, better wer: Source-free single-utterance test-time adaptation for automatic speech recognition. In Proceedings of the 23rd Annual Conference of the International Speech Communication Association, pp. 2198-2202, Incheon, South Korea, 2022. +Mattia Litrico, Alessio Del Bue, and Pietro Morierio. Guiding pseudo-labels with uncertainty estimation for source-free unsupervised domain adaptation. In Proceedings of the 2023 IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 7640-7650, Vancouver, Canada, 2023. +Andreas Maurer and Massimiliano Pontil. Empirical bernstein bounds and sample-variance penalization. In Proceedings of the 22nd Conference on Learning Theory, Montreal, Canada, 2009. +Muhammad Jehanzeb Mirza, Jakub Micorek, Horst Possegger, and Horst Bischof. The norm must go on: Dynamic unsupervised domain adaptation by normalization. In Proceedings of the 2022 IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 14745-14755, New Orleans, LA, 2022. + +Mehryar Mohri, Afshin Rostamizadeh, and Ameet Talwalkar. Foundations of Machine Learning. MIT Press, 2012. +Shuaicheng Niu, Jiaxiang Wu, Yifan Zhang, Zhiquan Wen, Yaofo Chen, Peilin Zhao, and Mingkui Tan. Towards stable test-time adaptation in dynamic wild world. In Proceedings of the 11th International Conference on Learning Representations, Kigali, Rwanda, 2023. +Xingchao Peng, Qinxun Bai, Xide Xia, Zijun Huang, Kate Saenko, and Bo Wang. Moment matching for multi-source domain adaptation. In Proceedings of the 2019 IEEE/CVF International Conference on Computer Vision, pp. 1406-1415, Seoul, South Korea, 2019. +Subhankar Roy, Martin Trapp, Andrea Pilzer, Juho Kannala, Nicu Sebe, Elisa Ricci, and Arno Solin. Uncertainty-guided source-free domain adaptation. In Proceedings of the 17th European Conference on Computer Vision, volume 25, pp. 537-555, Tel Aviv, Israel, 2022. +Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya Khosla, Michael S. Bernstein, Alexander C. Berg, and Li Fei-Fei. Imagenet large scale visual recognition challenge. International Journal of Computer Vision, 115(3):211-252, 2015. +Steffen Schneider, Evgenia Rusak, Luisa Eck, Oliver Bringmann, Wieland Brendel, and Matthias Bethge. Improving robustness against common corruptions by covariate shift adaptation. In Advances in Neural Information Processing Systems 33, pp. 11539-11551, Virtual Event, 2020. +Inkyu Shin, Yi-Hsuan Tsai, Bingbing Zhuang, Samuel Schulter, Buyu Liu, Sparsh Garg, In So Kweon, and Kuk-Jin Yoon. Mm-tta: Multi-modal test-time adaptation for 3d semantic segmentation. In Proceedings of the 2022 IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 16907-16916, New Orleans, LA, 2022. +Haopeng Sun, Lumin Xu, Sheng Jin, Ping Luo, Chen Qian, and Wentao Liu. Program: Prototype graph model based pseudo-label learning for test-time adaptation. In Proceedings of the 12th International Conference on Learning Representations, Vienna, Austria, 2024. +Mingkui Tan, Guohao Chen, Jiaxiang Wu, Yifan Zhang, Yaofo Chen, Peilin Zhao, and Shuaicheng Niu. Uncertainty-calibrated test-time model adaptation without forgetting. arXiv preprint, arXiv:2403.11491, 2024. +Antonio Torralba and Alexei A. Efros. Unbiased look at dataset bias. In Proceedings of the 2011 IEEE Conference on Computer Vision and Pattern Recognition, pp. 1521-1528, Colorado Springs, CO, 2011. +Vladimir Vapnik. Statistical Learning Theory. John Wiley & Sons, 1998. +Hemanth Venkateswara, Jose Eusebio, Shayok Chakraborty, and Sethuraman Panchanathan. Deep hashing network for unsupervised domain adaptation. In Proceedings of the 2017 IEEE Conference on Computer Vision and Pattern Recognition, pp. 5385-5394, Honolulu, HI, 2017. +Riccardo Volpi, Pau De Jorge, Diane Larlus, and Gabriela Csurka. On the road to online adaptation for semantic image segmentation. In Proceedings of the 2022 IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 19184-19195, New Orleans, LA, 2022. +Dequan Wang, Evan Shelhamer, Shaoteng Liu, Bruno A. Olshausen, and Trevor Darrell. Tent: Fully test-time adaptation by entropy minimization. In Proceedings of the 9th International Conference on Learning Representations, Virtual Event, 2021. +Qin Wang, Olga Fink, Luc Van Gool, and Dengxin Dai. Continual test-time domain adaptation. In Proceedings of the 2022 IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 7191-7201, New Orleans, LA, 2022. +Shuai Wang, Daoan Zhang, Zipei Yan, Jianguo Zhang, and Rui Li. Feature alignment and uniformity for test time adaptation. In Proceedings of the 2023 IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 20050-20060, Vancouver, Canada, 2023. + +Zixin Wang, Yadan Luo, Liang Zheng, Zhuoxiao Chen, Sen Wang, and Zi Huang. In search of lost online test-time adaptation: A survey. International Journal of Computer Vision, 133(3): 1106-1139, 2024. +Ning Xu, Jiaqi Lv, and Xin Geng. Partial label learning via label enhancement. In Proceedings of the 33rd AAAI Conference on Artificial Intelligence, pp. 5557-5564, Honolulu, HI, 2019. +Ning Xu, Jun Shu, Yun-Peng Liu, and Xin Geng. Variational label enhancement. In Proceedings of the 37th International Conference on Machine Learning, pp. 10597-10606, Virtual Event, 2020. +Hongzheng Yang, Cheng Chen, Meirui Jiang, Quande Liu, Jianfeng Cao, Pheng-Ann Heng, and Qi Dou. Dltta: Dynamic learning rate for test-time adaptation on cross-domain medical images. IEEE Transactions on Medical Imaging, 41(12):3575-3586, 2022. +Runzhe Zhan, Xuebo Liu, Derek F. Wong, Cuilian Zhang, Lidia S. Chao, and Min Zhang. Test-time adaptation for machine translation evaluation by uncertainty minimization. In Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics, pp. 807-820, Toronto, Canada, 2023. +Marvin Zhang, Sergey Levine, and Chelsea Finn. Memo: Test time robustness via adaptation and augmentation. In Advances in Neural Information Processing Systems 35, pp. 38629-38642, New Orleans, LA, 2022. +Yifan Zhang, Xue Wang, Kexin Jin, Kun Yuan, Zhang Zhang, Liang Wang, Rong Jin, and Tieniu Tan. Adanpc: Exploring non-parametric classifier for test-time adaptation. In Proceedings of the 40th International Conference on Machine Learning, pp. 41647-41676, Honolulu, HI, 2023. +Yuchen Zhang, Tianle Liu, Mingsheng Long, and Michael I. Jordan. Bridging theory and algorithm for domain adaptation. In Proceedings of the 36th International Conference on Machine Learning, pp. 7404-7413, Long Beach, CA, 2019. +Bowen Zhao, Chen Chen, and Shu-Tao Xia. Delta: Degradation-free fully test-time adaptation. In Proceedings of the 11th International Conference on Learning Representations, Kigali, Rwanda, 2023. +Kaiyang Zhou, Ziwei Liu, Yu Qiao, Tao Xiang, and Chen Change Loy. Domain generalization: A survey. IEEE Transactions on Pattern Analysis and Machine Intelligence, 45(4):4396-4415, 2022. + +# A PROOFS OF PROPOSITION 1 + +According to the assumption of Proposition 1, we have the following bounds for $f_{p}(\boldsymbol{x}_{i}^{r};\Theta^{r})$ and $f_{j}(\boldsymbol{x}_{i}^{r};\Theta^{r})$ : + +$$ +f _ {p} \left(\boldsymbol {x} _ {i} ^ {r}; \boldsymbol {\Theta} ^ {\star}\right) - \frac {1}{2} \tau (r) \leq f _ {p} \left(\boldsymbol {x} _ {i} ^ {r}; \boldsymbol {\Theta} ^ {r}\right) \leq f _ {p} \left(\boldsymbol {x} _ {i} ^ {r}; \boldsymbol {\Theta} ^ {\star}\right) + \frac {1}{2} \tau (r), \tag {14} +$$ + +$$ +f _ {j} \left(\boldsymbol {x} _ {i} ^ {r}; \boldsymbol {\Theta} ^ {\star}\right) - \frac {1}{2} \tau (r) \leq f _ {j} \left(\boldsymbol {x} _ {i} ^ {r}; \boldsymbol {\Theta} ^ {r}\right) \leq f _ {p} \left(\boldsymbol {x} _ {i} ^ {r}; \boldsymbol {\Theta} ^ {\star}\right) + \frac {1}{2} \tau (r). \tag {15} +$$ + +Subtract inequality 15 from inequality 14, we can deduce that: + +$$ +d _ {i} ^ {r, p} - d _ {i} ^ {r, j} = f _ {p} \left(\boldsymbol {x} _ {i} ^ {r}; \boldsymbol {\Theta} ^ {r}\right) - f _ {j} \left(\boldsymbol {x} _ {i} ^ {r}; \boldsymbol {\Theta} ^ {r}\right) \leq f _ {p} \left(\boldsymbol {x} _ {i} ^ {r}; \boldsymbol {\Theta} ^ {\star}\right) - f _ {j} \left(\boldsymbol {x} _ {i} ^ {r}; \boldsymbol {\Theta} ^ {\star}\right) + \tau (r). \tag {16} +$$ + +Now, if $d_i^{r,p} - d_i^{r,j} > \tau(r)$ , then it follows that: + +$$ +\tau (r) < f _ {p} \left(\boldsymbol {x} _ {i} ^ {r}; \boldsymbol {\Theta} ^ {\star}\right) - f _ {j} \left(\boldsymbol {x} _ {i} ^ {r}; \boldsymbol {\Theta} ^ {\star}\right) + \tau (r), \tag {17} +$$ + +which simplifies to: + +$$ +f _ {j} \left(\boldsymbol {x} _ {i} ^ {r}; \boldsymbol {\Theta} ^ {\star}\right) < f _ {p} \left(\boldsymbol {x} _ {i} ^ {r}; \boldsymbol {\Theta} ^ {\star}\right) \tag {18} +$$ + +Therefore, $j$ cannot be the true label of $\pmb{x}_i^r$ . + +If $d_i^{r,p} - d_i^{r,q} > \tau(r)$ , then $q$ cannot be the true label of $\boldsymbol{x}_i^r$ . Moreover, for any $j \in \mathcal{Y} \setminus \{p, q\}$ , it follows that $d_i^{r,p} - d_i^{r,j} > \tau(r)$ , since $d_i^{r,j} < d_i^{r,q}$ . As a result, none of the labels in $\mathcal{Y} \setminus \{p\}$ can be the true label of $\boldsymbol{x}_i^r$ . Therefore, given $d_i^{r,p} - d_i^{r,q} > \tau(r)$ , $p$ must be the true label of $\boldsymbol{x}_i^r$ . The proof is completed. + +# B PROOFS OF THEOREM 1 + +Suppose that at the $r$ -th step of adaptation, the classifier $h$ receives $m^r$ samples. Given that the source domain and target domain may overlap, we assume $(1 - \beta)m^{r}$ samples are drawn from $S$ , and the remaining $\beta m^{r}$ samples are drawn from $T$ . The goal of the classifier is to find a hypothesis that minimizes the target error $\epsilon_T(h)$ . We focus on classifiers that minimize a convex combination of the empirical errors from the source and target domains (Ben-David et al., 2010), defined as: + +$$ +\hat {\epsilon} _ {\alpha} (h) = \alpha \hat {\epsilon} _ {T} (h) + (1 - \alpha) \hat {\epsilon} _ {S} (h), \tag {19} +$$ + +where $\alpha \in [0,1]$ . The corresponding weighted combination of the true source and target errors is denoted by $\epsilon_{\alpha}(h)$ . + +To quantify the distributional difference between the two domains, we use the disparity discrepancy introduced by Zhang et al. (2019). + +Definition 1 Given a hypothesis space $\mathcal{H}$ and a specific classifier $h\in \mathcal{H}$ , the Disparity Discrepancy induced by $h^\prime \in \mathcal{H}$ is defined by + +$$ +\begin{array}{l} d _ {h, \mathcal {H}} (S, T) \triangleq \sup _ {h ^ {\prime} \in \mathcal {H}} \left(\operatorname {d i s p} _ {T} \left(h ^ {\prime}, h\right) - \operatorname {d i s p} _ {S} \left(h ^ {\prime}, h\right)\right) \\ = \sup _ {h ^ {\prime} \in \mathcal {H}} \left(\mathbb {E} _ {T} \mathbb {I} [ h ^ {\prime} \neq h ] - \mathbb {E} _ {S} \mathbb {I} [ h ^ {\prime} \neq h ]\right). \tag {20} \\ \end{array} +$$ + +In domain adaptation theory (Ben-David et al., 2010), the symmetric difference hypothesis space is commonly defined as follows: + +Definition 2 Define $\mathcal{H}\Delta \mathcal{H} \triangleq \{h \mid h = h_1 \otimes h_2, h_1, h_2 \in \mathcal{H}\}$ as the symmetric difference hypothesis space of $\mathcal{H}$ , where $\otimes$ stands for the XOR operator. + +We begin by establishing an upper bound on the difference between the target error $\epsilon_T(h)$ and the weighted error $\epsilon_{\alpha}(h)$ . + +Lemma 1 Suppose $\epsilon_S(h) \leq \epsilon_T(h)$ . For any classifier $h$ , we have: + +$$ +\left| \epsilon_ {\alpha} (h) - \epsilon_ {T} (h) \right| \leq (1 - \alpha) \left[ d _ {h, \mathcal {H}} (S, T) + \lambda \right], \tag {21} +$$ + +where $\lambda = \mathrm{err}_S(h^*) + \mathrm{err}_T(h^*)$ and $h^* \triangleq \underset{h \in \mathcal{H}}{\arg \min} \left\{ \mathrm{err}_S(h) + \mathrm{err}_T(h) \right\}$ . + +Proof. + +$$ +\begin{array}{l} \left| \epsilon_ {\alpha} (h) - \epsilon_ {T} (h) \right| = (1 - \alpha) \left| \epsilon_ {S} (h) - \epsilon_ {T} (h) \right| \\ \leq (1 - \alpha) \left[ \left(\mathbb {E} _ {T} \mathbb {I} [ h ^ {*} \neq h ] - \mathbb {E} _ {S} \mathbb {I} [ h ^ {*} \neq h ]\right) + \left(\epsilon_ {S} (h ^ {*}) + \epsilon_ {T} (h ^ {*})\right) \right] \\ \leq (1 - \alpha) \left[ \sup _ {h ^ {\prime} \in \mathcal {H}} \left(\operatorname {d i s p} _ {T} \left(h ^ {\prime}, h\right) - \operatorname {d i s p} _ {S} \left(h ^ {\prime}, h\right)\right) + \lambda \right] \tag {22} \\ = (1 - \alpha) [ d _ {h, \mathcal {H}} (S, T) + \lambda ] \\ \end{array} +$$ + +Then, we introduce an upper bound on the difference between the empirical and expected disparity discrepancy. + +Lemma 2 Denote $\widehat{S}$ and $\widehat{T}$ the empirical distributions of datasets with $m$ and $n$ instances sampled from $S$ and $T$ , respectively. For any $\delta > 0$ and binary classifier $h \in \mathcal{H}$ , with probability $1 - 2\delta$ , + +$$ +\sup _ {h \in \mathcal {H}} \left(d _ {h, \mathcal {H}} (\mathcal {S}, \mathcal {T}) - d _ {h, \mathcal {H}} (\widehat {\mathcal {S}}, \widehat {\mathcal {T}})\right) \leq 2 \Re_ {m, \mathcal {S}} (\mathcal {H} \Delta \mathcal {H}) + \sqrt {\frac {\log \frac {2}{\delta}}{2 m}} + 2 \Re_ {n, \mathcal {T}} (\mathcal {H} \Delta \mathcal {H}) + \sqrt {\frac {\log \frac {2}{\delta}}{2 n}}. \tag {23} +$$ + +Proof. + +$$ +\begin{array}{l} d _ {h, \mathcal {H}} (S, T) - d _ {h, \mathcal {H}} (\widehat {S}, \widehat {T}) \\ = \sup _ {h ^ {\prime} \in \mathcal {H}} \left(\operatorname {d i s p} _ {T} \left(h ^ {\prime}, h\right) - \operatorname {d i s p} _ {S} \left(h ^ {\prime}, h\right)\right) - \sup _ {h ^ {\prime \prime} \in \mathcal {H}} \left(\operatorname {d i s p} _ {\widehat {T}} \left(h ^ {\prime \prime}, h\right) - \operatorname {d i s p} _ {\widehat {S}} \left(h ^ {\prime \prime}, h\right)\right) \\ \leq \sup _ {h ^ {\prime} \in \mathcal {H}} \left(\operatorname {d i s p} _ {T} \left(h ^ {\prime}, h\right) - \operatorname {d i s p} _ {S} \left(h ^ {\prime}, h\right) - \operatorname {d i s p} _ {\widehat {T}} \left(h ^ {\prime}, h\right) + \operatorname {d i s p} _ {\widehat {S}} \left(h ^ {\prime}, h\right)\right) \tag {24} \\ \leq \sup _ {h ^ {\prime} \in \mathcal {H}} \left(\mathrm {d i s p} _ {T} (h ^ {\prime}, h) - \mathrm {d i s p} _ {\widehat {T}} (h ^ {\prime}, h)\right) + \sup _ {h ^ {\prime \prime} \in \mathcal {H}} \left(\mathrm {d i s p} _ {\widehat {S}} (h ^ {\prime \prime}, h) - \mathrm {d i s p} _ {S} (h ^ {\prime \prime}, h)\right) \\ \end{array} +$$ + +Take supremum over $h\in \mathcal{H}$ , we have: + +$$ +\begin{array}{l} \sup _ {h \in \mathcal {H}} \left(d _ {h, \mathcal {H}} (S, T) - d _ {h, \mathcal {H}} (\widehat {S}, \widehat {T})\right) \\ \leq \sup _ {h, h ^ {\prime} \in \mathcal {H}} \left| \operatorname {d i s p} _ {T} \left(h ^ {\prime}, h\right) - \operatorname {d i s p} _ {\widehat {T}} \left(h ^ {\prime}, h\right) \right| + \sup _ {h, h ^ {\prime \prime} \in \mathcal {H}} \left| \operatorname {d i s p} _ {\widehat {S}} \left(h ^ {\prime \prime}, h\right) - \operatorname {d i s p} _ {S} \left(h ^ {\prime \prime}, h\right) \right| \\ = \sup _ {h, h ^ {\prime} \in \mathcal {H}} \left| \mathbb {E} _ {T} \mathbb {I} [ h ^ {\prime} \neq h ] - \mathbb {E} _ {\widehat {T}} \mathbb {I} [ h ^ {\prime} \neq h ] \right| + \sup _ {h, h ^ {\prime} \in \mathcal {H}} \left| \mathbb {E} _ {S} \mathbb {I} [ h ^ {\prime} \neq h ] - \mathbb {E} _ {\widehat {S}} \mathbb {I} [ h ^ {\prime} \neq h ] \right| \\ = \sup _ {g \in \mathcal {H} \Delta \mathcal {H}} | \mathbb {E} _ {T} \mathbb {I} [ g \neq 1 ] - \mathbb {E} _ {\widehat {T}} \mathbb {I} [ g \neq 1 ] | + \sup _ {g ^ {\prime} \in \mathcal {H} \Delta \mathcal {H}} | \mathbb {E} _ {S} \mathbb {I} [ g ^ {\prime} \neq 1 ] - \mathbb {E} _ {\widehat {S}} \mathbb {I} [ g ^ {\prime} \neq 1 ] | \tag {25} \\ = \sup _ {g \in \mathcal {H} \Delta \mathcal {H}} \left| \mathbb {E} _ {T} g - \mathbb {E} _ {\widehat {T}} g \right| + \sup _ {g ^ {\prime} \in \mathcal {H} \Delta \mathcal {H}} \left| \mathbb {E} _ {S} g ^ {\prime} - \mathbb {E} _ {\widehat {S}} g ^ {\prime} \right| \\ \leq 2 \Re_ {m, S} (\mathcal {H} \Delta \mathcal {H}) + \sqrt {\frac {\log \frac {2}{\delta}}{2 m}} + 2 \Re_ {n, T} (\mathcal {H} \Delta \mathcal {H}) + \sqrt {\frac {\log \frac {2}{\delta}}{2 n}}. \\ \end{array} +$$ + +The following lemma provides a probabilistic bound on the difference between the empirical and true error rates of the classifier $h$ . + +Lemma 3 A batch of samples of size $m$ is generated by taking $\beta m$ samples from $T$ and $(1 - \beta)m$ samples from $S$ , and then labeling them with the true labeling function $g(\pmb{x})$ . Then we can have: + +$$ +\Pr \left[ \left| \hat {\epsilon} _ {\alpha} (h) - \epsilon_ {\alpha} (h) \right| \geq \epsilon \right] \leq 2 \exp \left(\frac {- 2 m \epsilon^ {2}}{\frac {\alpha^ {2}}{\beta} + \frac {(1 - \alpha) ^ {2}}{1 - \beta}}\right). \tag {26} +$$ + +Proof. Let $x_{1}, \ldots, x_{\beta m}$ represent random variables corresponding to the $\beta m$ samples $\mathbf{x} \in T$ , taking values: + +$$ +\frac {\alpha}{\beta} \left| h (\boldsymbol {x}) - g (\boldsymbol {x}) \right|. \tag {27} +$$ + +Similarly, for the remaining $(1 - \beta)m$ samples $\pmb{x} \in S$ , let $x_{\beta m + 1}, \ldots, x_m$ be random variables that take on the values: + +$$ +\frac {1 - \alpha}{1 - \beta} | h (\boldsymbol {x}) - g (\boldsymbol {x}) |. \tag {28} +$$ + +The empirical weighted error $\hat{\epsilon}_{\alpha}(h)$ can be expressed as: + +$$ +\begin{array}{l} \hat {\epsilon} _ {\alpha} (h) = \alpha \hat {\epsilon} _ {T} (h) + (1 - \alpha) \hat {\epsilon} _ {S} (h) \\ = \alpha \frac {1}{\beta m} \sum_ {\boldsymbol {x} \in T} | h (\boldsymbol {x}) - g (\boldsymbol {x}) | + (1 - \alpha) \frac {1}{(1 - \beta) m} \sum_ {\boldsymbol {x} \in S} | h (\boldsymbol {x}) - g (\boldsymbol {x}) | = \frac {1}{m} \sum_ {i = 1} ^ {m} x _ {i}. \tag {29} \\ \end{array} +$$ + +Applying the linearity of expectation, we have: + +$$ +\begin{array}{l} \mathbb {E} \left[ \hat {\epsilon} _ {\alpha} (h) \right] = \frac {1}{m} \left(\beta m \cdot \frac {\alpha}{\beta} \epsilon_ {T} (h) + (1 - \beta) m \cdot \frac {1 - \alpha}{1 - \beta} \epsilon_ {S} (h)\right) \tag {30} \\ = \alpha \epsilon_ {T} (h) + (1 - \alpha) \epsilon_ {S} (h) = \epsilon_ {\alpha} (h). \\ \end{array} +$$ + +It is important to note that $x_{1}, \ldots, x_{\beta m} \in [0, \frac{\alpha}{\beta}]$ and $x_{\beta m + 1}, \ldots, x_{m} \in [0, \frac{1 - \alpha}{1 - \beta}]$ . Thus, Hoeffding's Inequality can be applied as follows: + +$$ +\begin{array}{l} \Pr \left[ | \hat {\epsilon} _ {\alpha} (h) - \epsilon_ {\alpha} (h) | \geq \epsilon \right] \leq 2 \exp \left(\frac {- 2 m ^ {2} \epsilon^ {2}}{\sum_ {i = 1} ^ {m} \operatorname {r a n g e} ^ {2} \left(x _ {i}\right)}\right) \\ = 2 \exp \left(\frac {- 2 m ^ {2} \epsilon^ {2}}{\beta m \left(\frac {\alpha}{\beta}\right) ^ {2} + (1 - \beta) m \left(\frac {1 - \alpha}{1 - \beta}\right) ^ {2}}\right) = 2 \exp \left(\frac {- 2 m \epsilon^ {2}}{\frac {\alpha^ {2}}{\beta} + \frac {(1 - \alpha) ^ {2}}{1 - \beta}}\right). \tag {31} \\ \end{array} +$$ + +Building on the above definition and lemma, we derive the following theorem: + +Theorem 1 Let $\mathcal{H}$ be a hypothesis space of VC dimension $d$ . Let $\widehat{S}$ and $\widehat{T}$ be unlabeled sample sets of size $m^{\prime}$ each, drawn from $S$ and $T$ respectively. A batch of samples of size $m^{r}$ is generated by random sampling at the $r$ -th step of adaptation. Given the possibility of overlap between the source domain and the target domain, we assume $(1 - \beta)m^{r}$ samples are drawn from $S$ , and the remaining $\beta m^{r}$ samples are drawn from $T$ , which are then labeled with the true labeling function. For simplicity in theoretical analysis, we allocate the loss weight proportionally to the number of samples from each domain, specifically setting $\alpha$ and $\beta$ to be equal. If $\hat{h} \in \mathcal{H}$ is the empirical minimizer of $\hat{\epsilon}_{\alpha}(h)$ on this batch and $h_{T}^{*} = \min_{h \in \mathcal{H}} \epsilon_{T}(h)$ is the target error minimizer, then for any $\delta > 0$ , with probability at least $1 - 2\delta$ , + +$$ +\begin{array}{l} \epsilon_ {T} (\hat {h}) \leq \epsilon_ {T} \left(h _ {T} ^ {*}\right) + 4 \sqrt {\frac {2 d \log (2 \left(m ^ {r} + 1\right)) + 2 \log \left(\frac {4}{\delta}\right)}{m ^ {r}}} \tag {32} \\ + 2 (1 - \beta) \left(d _ {h, \mathcal {H}} (\widehat {S}, \widehat {T}) + 2 \sqrt {\frac {2 d \log \frac {e m ^ {\prime}}{4 d}}{m ^ {\prime}}} + 2 \sqrt {\frac {\log \frac {2}{\delta}}{2 m ^ {\prime}}} + \lambda\right), \\ \end{array} +$$ + +Proof. According to Lemma 1, we have: + +$$ +\epsilon_ {T} (\hat {h}) \leq \epsilon_ {\alpha} (\hat {h}) + (1 - \alpha) \left(d _ {h, \mathcal {H}} (S, T) + \lambda\right). \tag {33} +$$ + +By applying Lemma 3, we deduce that: + +$$ +\begin{array}{l} \epsilon_ {T} (\hat {h}) \leq \hat {\epsilon} _ {\alpha} (\hat {h}) + 2 \sqrt {\frac {\alpha^ {2}}{\beta} + \frac {(1 - \alpha) ^ {2}}{1 - \beta}} \sqrt {\frac {2 d \log (2 (m ^ {r} + 1)) + 2 \log \left(\frac {4}{\delta}\right)}{m ^ {r}}} + (1 - \alpha) (d _ {h, \mathcal {H}} (S, T) + \lambda) \\ \leq \hat {\epsilon} _ {\alpha} (h _ {T} ^ {*}) + 2 \sqrt {\frac {\alpha^ {2}}{\beta} + \frac {(1 - \alpha) ^ {2}}{1 - \beta}} \sqrt {\frac {2 d \log (2 (m ^ {r} + 1)) + 2 \log \left(\frac {4}{\delta}\right)}{m ^ {r}}} + (1 - \alpha) (d _ {h, \mathcal {H}} (S, T) + \lambda) \\ \leq \epsilon_ {\alpha} \left(h _ {T} ^ {*}\right) + 4 \sqrt {\frac {\alpha^ {2}}{\beta} + \frac {(1 - \alpha) ^ {2}}{1 - \beta}} \sqrt {\frac {2 d \log (2 \left(m ^ {r} + 1\right)) + 2 \log \left(\frac {4}{\delta}\right)}{m ^ {r}}} + (1 - \alpha) \left(d _ {h, \mathcal {H}} (S, T) + \lambda\right). \tag {34} \\ \end{array} +$$ + +Based on Lemma 2, we obtain: + +$$ +\begin{array}{l} \epsilon_ {T} (\hat {h}) \leq \epsilon_ {T} (h _ {T} ^ {*}) + 4 \sqrt {\frac {\alpha^ {2}}{\beta} + \frac {(1 - \alpha) ^ {2}}{1 - \beta}} \sqrt {\frac {2 d \log (2 (m ^ {r} + 1)) + 2 \log \left(\frac {4}{\delta}\right)}{m ^ {r}}} \\ + 2 (1 - \alpha) \left(d _ {h, \mathcal {H}} (\widehat {S}, \widehat {T}) + 2 \Re_ {m ^ {\prime}, S} (\mathcal {H} \Delta \mathcal {H}) + \sqrt {\frac {\log \frac {2}{\delta}}{2 m ^ {\prime}}} + 2 \Re_ {m ^ {\prime}, T} (\mathcal {H} \Delta \mathcal {H}) + \sqrt {\frac {\log \frac {2}{\delta}}{2 m ^ {\prime}}} + \lambda\right). \tag {35} \\ \end{array} +$$ + +According to Lemma 3 and Mohri et al. (2012), it follows that: + +$$ +\begin{array}{l} \epsilon_ {T} (\hat {h}) \leq \epsilon_ {T} \left(h _ {T} ^ {*}\right) + 4 \sqrt {\frac {\alpha^ {2}}{\beta} + \frac {(1 - \alpha) ^ {2}}{1 - \beta}} \sqrt {\frac {2 d \log (2 (m ^ {r} + 1)) + 2 \log \left(\frac {4}{\delta}\right)}{m ^ {r}}} \\ + 2 (1 - \alpha) \left(d _ {h, \mathcal {H}} (\widehat {S}, \widehat {T}) + 2 \sqrt {\frac {2 d \log \frac {e m ^ {\prime}}{4 d}}{m ^ {\prime}}} + 2 \sqrt {\frac {\log \frac {2}{\delta}}{2 m ^ {\prime}}} + \lambda\right). \tag {36} \\ \end{array} +$$ + +If we allocate the loss weight according to the number of samples, that is, setting $\alpha = \beta$ , we can conclude: + +$$ +\begin{array}{l} \epsilon_ {T} (\hat {h}) \leq \epsilon_ {T} \left(h _ {T} ^ {*}\right) + 4 \sqrt {\frac {2 d \log \left(2 \left(m ^ {r} + 1\right)\right) + 2 \log \left(\frac {4}{\delta}\right)}{m ^ {r}}} \tag {37} \\ + 2 (1 - \beta) \left(d _ {h, \mathcal {H}} (\widehat {S}, \widehat {T}) + 2 \sqrt {\frac {2 d \log \frac {e m ^ {\prime}}{4 d}}{m ^ {\prime}}} + 2 \sqrt {\frac {\log \frac {2}{\delta}}{2 m ^ {\prime}}} + \lambda\right). \\ \end{array} +$$ + +This completes the proof. + +# C PROOFS OF THEOREM 2 + +First, let $\tilde{R}_V(f) = \mathbb{E}\left[\widehat{R}_V(f)\right]$ . Then, following the results in Maurer & Pontil (2009), which provides a uniform convergence form of Bennett's inequality (Bennett, 1962), we can derive: + +$$ +\tilde {R} _ {V} (f) - \widehat {R} _ {V} (f) \leq \mathcal {O} \left(\sqrt {\mathbb {V} (f) \cdot \frac {\log \frac {\mathcal {M} _ {N R}}{\delta}}{N ^ {R}}} + \frac {\log \frac {\mathcal {M} _ {N R}}{\delta}}{N ^ {R}}\right) \tag {38} +$$ + +Moreover, the following holds: + +$$ +\left| \tilde {R} _ {V} (f) - R _ {V} (f) \right| = \left| \mathbb {E} \left[ \widehat {R} _ {V} (f) \right] - \mathbb {E} \left[ \widehat {R} _ {V} ^ {\star} (f) \right] \right| \leq \mathbb {E} [ \| \boldsymbol {q} - \boldsymbol {p} \| _ {2} \cdot \sqrt {\sum_ {j = 1} ^ {c} \ell^ {2} \left(f \left(\boldsymbol {x} _ {i}\right) , e ^ {y _ {j}}\right)} ]. \tag {39} +$$ + +Table 4: Running time of different methods on the clipart domain of the DomainNet dataset. + +
MethodsTime (s)
ERM19.54
BN21.03
TENT57.23
PL77.94
SHOT-IM77.02
T3A46.57
TAST86.89
TAST-BN128.46
TSD105.55
PROGRAM113.58
DEYO92.49
PASLE99.28
+ +Table 5: Classification accuracy of PASLE under broader parameter range on the CIFAR-10-C dataset. + +
τstartτendAcc
0.90.877.90
0.80.777.97
0.70.677.96
0.60.577.99
0.50.477.89
0.40.377.84
0.30.277.84
0.20.177.79
+ +Table 6: Classification accuracy of PASLE and its variants (PASLE-NB and PASLE-NR) on the OfficeHome dataset. The best performance is shown in boldface. + +
MethodsACPR
PASLE57.25±0.7551.30±0.4173.31±1.0474.10±0.20
PASLE-NB56.98±0.8251.14±0.4473.14±0.8773.00±0.25
PASLE-NR57.02±0.7651.11±0.3973.09±1.2172.98±0.33
+ +Thus, we have + +$$ +R _ {V} (f) - \tilde {R} (f) \leq M \sqrt {c} \cdot \mathbb {E} \left[ \| \boldsymbol {q} - \boldsymbol {p} \| _ {2} \right]. \tag {40} +$$ + +Finally, combining Eq.38 and Eq.40 completes the proof. + +# D FURTHER ANALYSIS (APPENDIX) + +Running Time Analysis. To evaluate the computational cost, experiments were carried out on the clipart domain of the DomainNet dataset, using ResNet-18 as the backbone with a batch size of 128 on an NVIDIA Titan Xp GPU. The reported runtime excludes data loading time, ensuring fairness by using torch.cuda.synchronize to accurately measure the computational overhead. The results are shown in Table 4. Our method has a similar time complexity to PL in pseudo-label generation. It is a bit slower than PL because our sample utilization rate is high, and as a result, better performance has been achieved. + +Performance over a Broader Parameter Range. We conducted a parameter sensitivity analysis experiment on the CIFAR-10-C dataset under shot noise with a broader range of hyperparameters. The value of $\tau_{start}$ was selected from a wider range, specifically between 0.2 and 0.9. The threshold gap represented as $|\tau_{start} - \tau_{end}|$ , was fixed at 0.1. For testing purposes, $\tau_{des}$ was set to $\frac{\tau_{start} - \tau_{end}}{R}$ . The results are summarized in Table 5. The results indicate that the algorithm achieves optimal performance when $\tau$ is within the range of 0.5 to 0.8. Within a reasonable range of $\tau$ , the algorithm also delivers comparable results. However, when $\tau$ is set too low (e.g., within the range of 0.1 to 0.2), many samples with incorrect supervision are introduced, leading to a decline in performance. + +Ablation Study of Modules in PASLE. We additionally conducted ablation studies using two simplified variants of our framework: PASLE-NB and PASLE-NR. In PASLE-NB, the buffer is removed from the framework, while in PASLE-NR, the strategy of threshold reduction is excluded. For this study, we utilized the OfficeHome dataset and employed ResNet-18 as the backbone. The results + +Table 7: Classification accuracy of PASLE with different candidate label selection strategies on the OfficeHome dataset. The best performance is shown in boldface. + +
MethodsACPR
PASLE57.25±0.7551.30±0.4173.31±1.0474.10±0.20
PASLE-TB57.07±0.6351.13±0.4573.11±0.9473.92±0.34
PASLE-KB56.31±0.5950.69±0.3572.82±0.6973.56±0.21
+ +Figure 3: The parameter sensitivity of $\tau_{\mathrm{start}}$ and $\tau_{\mathrm{end}}$ for PASLE. +![](images/e1383a051db3878dd48e5177c79fb66a52818f9956cddad7431c45cc96620771.jpg) +(a) The sensitivity of $\tau_{\mathrm{start}}$ and $\tau_{\mathrm{end}}$ on OfficeHome. (b) The sensitivity of $\tau_{\mathrm{start}}$ and $\tau_{\mathrm{end}}$ on DomainNet. + +![](images/849b269989f2c56b26d9220386e3c3ca6331f67405e9d2dcdd7341e6316fe5cb.jpg) + +are shown in Table 6, highlighting that the buffer mechanism and threshold reduction strategy, as pluggable modules in our framework, further improve its performance. + +Different Candidate Labels Generation Methods. We further explored two approaches for generating candidate labels. The first is a threshold-based approach (PASLE-TB), where a threshold is set, and all classes with prediction probabilities exceeding this threshold are selected as candidate labels. This method generates both one-hot pseudo-labels and candidate pseudo-label sets. The second approach is top- $k$ based (PASLE-KB), where prediction probabilities are sorted in descending order, and the top- $k$ classes are chosen as candidate labels. Unlike the first method, this approach only produces candidate pseudo-label sets. The threshold and $k$ are dynamically adjusted during the adaptation process. Experiments were conducted on the OfficeHome dataset using ResNet-18 as the backbone, and the results are presented in Table 7. It can be observed that PASLE-TB achieves performance comparable to PASLE, while PASLE-KB, which lacks sample selection and directly uses the top- $k$ predicted classes of all samples as candidate labels, performs significantly worse than PASLE. + +More Parameter Sensitivity Analysis Results We additionally conducted sensitivity analyses on $\tau_{start}$ and $\tau_{end}$ using the clipart domain of the OfficeHome dataset and the clipart domain of the DomainNet dataset as target domains. We also compared the performance of our method and the baseline methods under varying batch sizes, using the sketch domain of DomainNet and the shot noise corruption in CIFAR-100-C as target domains. The results are shown in Figure 3 and Figure 4. It can be observed that PASLE is robust to hyperparameter selection and consistently outperforms other methods across different batch sizes. + +# E FULL EXPERIMENTAL RESULTS + +Table 8: Full results on the PACS dataset. + +
MethodsBackBoneACPSAvg.
ERM78.73±1.6974.84±0.5495.03±0.3168.87±3.3679.37
BN82.03±0.5581.09±0.4596.08±0.3373.12±0.4483.08
TENT82.19±0.5981.27±0.4795.85±0.3373.62±0.6883.23
PL85.29±1.1983.72±0.9795.99±0.4277.65±2.5185.66
SHOT-IM84.75±0.6681.83±1.2796.33±0.7869.18±0.5583.02
T3AResNet-1880.75±1.4578.16±0.6195.89±0.5572.01±2.9981.70
TAST83.32±0.8882.44±0.9296.27±0.5475.19±0.8984.31
TAST-BN87.09±0.3283.89±1.3796.69±0.3977.74±1.4586.35
TSD87.81±0.6487.09±0.5096.71±0.5779.89±0.3287.88
PROGRAM84.72±0.5580.36±0.6096.05±0.3973.14±0.4083.57
DEYO85.84±1.1083.39±0.5696.13±0.4879.67±0.8086.26
PASLE88.19±1.4287.09±0.2496.83±0.4880.51±1.2888.16
ERM85.84±0.7879.78±2.1596.47±0.3781.27±2.1285.84
BN86.73±0.8284.13±1.9896.79±0.0776.36±1.5386.00
TENT87.00±0.9284.51±1.8996.89±0.1077.65±1.5386.51
PL88.80±0.8882.94±4.9095.35±2.3275.53±5.0485.66
SHOT-IM85.68±1.5683.52±0.4795.05±0.6376.83±1.9385.27
T3AResNet-5086.51±0.4181.67±1.6496.85±0.1881.12±2.0386.54
TAST87.84±0.5384.56±2.2197.35±0.1978.00±1.1386.94
TAST-BN89.94±0.3186.68±1.0197.49±0.4883.77±1.7789.47
TSD91.06±0.5690.67±0.6897.70±0.1585.09±1.2191.13
PROGRAM87.21±1.3084.09±1.8696.89±0.0676.44±1.6486.16
DEYO88.36±0.9485.24±1.6197.05±0.1282.26±0.5488.23
PASLE91.57±0.4889.88±1.5397.74±0.2886.25±0.7891.36
+ +Table 9: Full results on the VLCS dataset. + +
MethodsBackBoneVLCSAvg.
ERM95.66±1.3163.09±1.5969.17±0.8872.62±3.7075.14
BN82.71±2.4658.83±1.5562.20±0.8671.42±2.1368.79
TENT83.30±2.3659.26±1.5762.77±1.0271.80±1.9169.28
PL92.32±1.6363.87±1.4169.47±0.9773.05±1.4274.68
SHOT-IM88.06±3.5058.58±1.6263.50±1.9473.06±2.0270.80
T3AResNet-1898.49±1.2764.02±1.6068.90±0.8271.92±4.0075.83
TAST94.74±2.0456.63±2.0763.97±0.6271.41±2.6171.69
TAST-BN97.34±0.8465.02±1.5765.71±0.8772.61±5.4075.17
TSD96.30±0.4765.47±0.1467.84±0.5372.25±2.8875.47
PROGRAM95.87±1.4558.71±0.8160.12±1.4371.85±2.4771.64
DEYO95.16±1.3563.93±0.3767.20±0.9773.33±1.8074.91
PASLE96.04±1.5366.48±0.5172.64±0.4576.48±0.2977.91
ERM97.15±0.4363.08±0.6570.63±0.7673.37±1.1476.06
BN77.90±4.5256.66±2.0963.36±1.1473.11±0.3767.76
TENT79.15±4.6757.05±2.0663.92±1.0973.50±0.1868.41
PL91.31±3.1861.60±3.9070.97±0.0571.32±2.6673.80
SHOT-IM80.60±3.9555.78±2.6363.51±1.9474.06±0.7368.49
T3AResNet-5098.18±0.1164.13±1.1072.04±2.3771.99±0.8176.59
TAST81.70±4.2052.10±0.4262.29±1.4573.20±1.0467.32
TAST-BN96.77±1.4261.33±0.0668.96±4.1475.30±0.1975.59
TSD93.92±1.2858.03±1.0469.65±2.5277.49±0.9974.77
PROGRAM85.05±4.1558.42±0.4060.12±1.4371.82±1.5068.85
DEYO84.38±1.7060.92±1.9767.20±0.9773.85±0.2171.59
PASLE96.01±0.8966.20±1.9876.01±0.9176.59±0.8878.70
+ +Table 10: Full results on the OfficeHome dataset. + +
MethodsBackBoneACPRAvg.
ERM55.76±0.8048.66±0.4371.46±0.6773.84±0.2362.43
BN54.96±0.5849.74±0.3770.95±0.9173.50±0.4362.29
TENT55.13±0.6550.00±0.2171.27±0.8973.63±0.4362.51
PL55.09±0.3650.74±0.1971.17±1.2573.83±0.3962.71
SHOT-IM56.75±1.1252.03±0.5772.77±0.0574.10±0.3363.91
T3AResNet-1856.52±1.1250.62±0.6773.45±0.7174.99±0.3363.90
TAST55.75±0.8951.71±0.4973.93±0.9574.46±0.3463.96
TAST-BN55.28±0.6550.49±0.6471.89±1.4672.07±0.4462.43
TSD57.27±0.7150.60±1.5972.24±0.8573.55±0.2163.42
PROGRAM56.69±1.4550.94±0.5171.80±0.4073.98±0.4763.35
DEYO56.50±0.3050.80±0.1571.97±1.0273.92±0.4163.30
PASLE57.25±0.7551.30±0.4173.31±1.0474.10±0.2063.99
ERM63.04±0.4853.88±0.1876.55±0.4177.89±0.1967.84
BN62.00±0.8153.45±0.4775.08±0.6676.76±0.7466.82
TENT62.44±0.7254.11±0.4875.68±0.6776.84±0.5767.27
PL63.32±0.3954.73±0.9973.89±1.2277.30±0.4667.31
SHOT-IM62.95±1.1554.56±0.4476.37±0.9577.66±0.2967.89
T3AResNet-5063.26±0.2355.30±0.3278.13±0.4478.72±0.4568.85
TAST63.42±0.5955.61±0.5978.01±0.8177.74±0.4668.70
TAST-BN62.76±0.6255.01±0.4377.01±0.8577.11±0.7467.97
TSD64.32±0.4156.91±0.9777.19±0.6777.46±0.4568.97
PROGRAM63.36±0.8754.27±0.2377.24±0.6977.24±0.4968.03
DEYO63.77±0.2354.90±1.1076.36±0.5177.28±0.5668.08
PASLE65.47±0.8356.08±0.8278.11±0.6577.83±0.3069.37
+ +Table 11: Full results on the DomainNet dataset. + +
MethodsBackBoneclipartinfographpaintingquickdrawrealsketchAvg
ERM50.48±0.2115.31±0.1541.86±0.1211.66±0.4951.71±0.2943.53±0.0235.76
BN50.74±0.0911.38±0.0340.76±0.1211.29±0.3951.78±0.1943.72±0.2634.95
TENT51.13±0.0712.52±0.1941.91±0.1410.57±0.3851.31±0.2544.76±0.1735.37
PL50.88±0.0612.87±0.7041.22±0.1010.84±0.7451.62±0.2944.01±0.2535.24
SHOT-IM51.02±0.0712.75±0.3941.41±0.1313.71±0.3252.26±0.1544.38±0.2335.92
T3AResNet-1850.34±0.2615.11±0.2040.35±0.1216.24±0.2353.13±0.3042.68±0.1736.31
TAST50.31±0.1612.64±0.0940.66±0.0514.59±0.5153.58±0.1542.49±0.2635.71
TAST-BN50.44±0.2713.21±0.1340.97±0.1214.72±0.4952.39±0.4143.19±0.2835.82
TSD50.74±0.1113.58±0.0742.93±0.2411.78±0.3451.95±0.2144.20±0.2035.86
PROGRAM51.07±0.1613.27±0.2641.52±0.1213.40±0.4152.31±0.2844.27±0.2535.97
DEYO50.86±0.0513.19±0.2941.23±0.1211.19±0.5051.81±0.2143.96±0.2335.37
PASLE51.76±0.3914.98±0.2843.06±0.1513.67±0.2652.69±0.1845.15±0.2736.89
ERM61.00±0.2420.81±0.1949.58±0.0613.57±0.2661.95±0.1652.07±0.3643.16
BN60.58±0.2315.11±0.1748.64±0.0811.92±0.2061.06±0.1651.70±0.1641.50
TENT61.64±0.1517.41±0.0150.40±0.1710.11±0.5861.40±0.1453.30±0.0842.38
PL61.04±0.2217.90±0.2049.90±0.0611.57±0.1561.26±0.0452.61±0.1942.38
SHOT-IM61.29±0.2117.56±0.1449.81±0.1016.50±0.5262.52±0.1052.79±0.2243.41
T3AResNet-5061.05±0.2320.94±0.1448.71±0.0818.55±0.3963.19±0.0851.57±0.2744.00
TAST60.65±0.2217.93±0.1949.03±0.1915.17±0.2862.62±0.1251.64±0.0742.84
TAST-BN61.03±0.3218.04±0.2249.65±0.1914.75±0.4162.71±0.0751.97±0.0943.03
TSD60.76±0.2417.89±0.1749.82±0.6512.21±0.2661.66±0.1752.27±0.1842.44
PROGRAM61.15±0.2618.08±0.0449.85±0.0615.53±0.4062.14±0.0453.30±0.2043.34
DEYO61.04±0.2218.17±0.1149.84±0.0511.99±0.2361.25±0.0252.50±0.2142.47
PASLE62.46±0.3920.67±0.1251.74±0.1616.73±0.5163.76±0.0954.11±0.2644.91
+ +![](images/5d1bab03c2cdbf167881d32e1bdfb19791914851725988cee0429514ad61a69e.jpg) +(a) The sensitivity of batch size on CIFAR-100-C. +Figure 4: The parameter sensitivity of batch size for PASLE. + +![](images/b22a475305bf462ec22b9c32e44f1e6b8d04f0b4df2d98e950210df5dec43c2e.jpg) +(b) The sensitivity of batch size on DomainNet. + +Table 12: Full results on the CIFAR-10-C dataset. + +
MethodsshotmotnsnowpixelgaussdefocbritfogzoomfrostglassimpulcontrjpegelastAvg.
ERM24.9319.4026.1221.6224.5219.5928.4113.4819.5319.1318.3118.3410.9324.9320.5920.66
BN76.7975.9378.1780.1377.3379.1383.0870.6479.2576.0568.4965.8062.8280.1676.1675.33
TENT76.8076.1178.2380.0777.2979.1283.1370.8079.3176.2168.5766.0363.1980.2476.0475.41
PL77.0776.4578.2580.4277.5979.5683.2071.2679.7776.5068.7466.2263.9580.2176.3475.70
SHOT-IM77.2076.6778.4380.5477.6379.7783.3571.3579.9076.4268.8566.6064.4680.2476.3075.85
T3A29.9720.2729.9326.0429.3019.8134.0013.6420.0221.0321.2821.9115.9428.3321.2923.52
TAST75.2775.1677.0778.9976.0278.0582.1069.3978.0175.4766.7464.4262.5578.1174.6474.13
TAST-BN75.8274.8477.2879.3576.5678.2983.3069.3478.6475.1767.7464.7362.1779.4575.6974.56
TSD76.5475.5878.2879.9677.1878.7983.1670.3278.8476.0368.0166.0662.1080.0976.1875.14
PROGRAM76.7376.2277.8779.9877.1078.8383.2169.8678.7476.0167.8865.4061.2179.9576.0675.00
DEYO77.0276.8978.4180.5277.4279.7983.2571.2879.9076.4168.5066.1864.0480.3676.2075.74
PASLE78.0377.4079.0881.1678.2280.8183.8372.3180.8177.2869.3467.0767.1780.7576.7776.67
+ +Table 13: Full results on the CIFAR-100-C dataset. + +
MethodsshotmotnsnowpixelgaussdefocbritfogzoomfrostglassimpulcontrjpegelastAvg.
ERM7.883.868.306.957.954.0711.021.633.955.895.135.451.088.545.895.84
BN44.1746.2344.9850.0144.2748.3650.3637.5548.8944.0238.7834.5731.6948.7845.5743.88
TENT44.1946.2345.0249.9744.3448.5550.4737.5348.8944.0738.8134.5731.6848.9145.6543.93
PL44.5747.0545.0950.1144.3649.2750.5837.3249.4944.3539.2934.9432.2249.0145.9244.24
SHOT-IM44.5147.2345.2050.3444.8149.2250.7637.9349.2544.3339.1634.9033.0549.0445.6044.36
T3A8.245.289.148.198.595.0412.942.235.506.186.235.971.089.496.986.74
TAST39.6542.2940.3544.8339.8643.7245.0033.1343.3739.1335.6831.4525.9143.2340.5039.21
TAST-BN32.7533.9232.9635.8232.8535.3237.3427.1535.4433.1027.7724.7920.6035.5932.2231.84
TSD44.5446.5545.3250.4744.7648.9250.9737.3849.4644.2539.0534.6231.3649.2645.9544.19
PROGRAM44.1946.6344.9749.9144.6348.7650.3637.7648.7444.3738.8734.7832.4248.7845.6744.06
DEYO44.6847.2145.0050.1944.5649.0650.5737.8849.3944.4139.3634.9832.1348.9245.8244.28
PASLE45.8848.4446.2851.4345.6050.0551.9239.1250.4245.1739.9436.0032.8750.0546.6345.32
\ No newline at end of file diff --git a/ICLR/2025/Selective Label Enhancement Learning for Test-Time Adaptation/images.zip b/ICLR/2025/Selective Label Enhancement Learning for Test-Time Adaptation/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..cc0bc29bff3e49a341912d3dc9ed60ae847f8605 --- /dev/null +++ b/ICLR/2025/Selective Label Enhancement Learning for Test-Time Adaptation/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6270b3c8850d6b47bcd08462e8b2ca46d0d88ddb72c2d2ffb933b81bbb09d09f +size 1698198 diff --git a/ICLR/2025/Selective Label Enhancement Learning for Test-Time Adaptation/layout.json b/ICLR/2025/Selective Label Enhancement Learning for Test-Time Adaptation/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..4144a65ea452f7e320c1edd6836301f34cc2604f --- /dev/null +++ b/ICLR/2025/Selective Label Enhancement Learning for Test-Time Adaptation/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:514144bab708e6f69d829880156cc89d79a623ca0836f50fd995ea571975e544 +size 863803 diff --git a/ICLR/2025/Selective Task Group Updates for Multi-Task Optimization/6e303ff4-738b-4014-87fd-6d6df18a6e54_content_list.json b/ICLR/2025/Selective Task Group Updates for Multi-Task Optimization/6e303ff4-738b-4014-87fd-6d6df18a6e54_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..46b8d0958b4d478c8d2ed800ac906e397f79ab2a --- /dev/null +++ b/ICLR/2025/Selective Task Group Updates for Multi-Task Optimization/6e303ff4-738b-4014-87fd-6d6df18a6e54_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:04d2af21ea3c7b9edadc1f09aa2acf56aa47968cea8e36672c3e980660be8b96 +size 240134 diff --git a/ICLR/2025/Selective Task Group Updates for Multi-Task Optimization/6e303ff4-738b-4014-87fd-6d6df18a6e54_model.json b/ICLR/2025/Selective Task Group Updates for Multi-Task Optimization/6e303ff4-738b-4014-87fd-6d6df18a6e54_model.json new file mode 100644 index 0000000000000000000000000000000000000000..3a2aeea571b7c68aaa24c51cf800b030d12bf44a --- /dev/null +++ b/ICLR/2025/Selective Task Group Updates for Multi-Task Optimization/6e303ff4-738b-4014-87fd-6d6df18a6e54_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b0463ed0cb22057594017f197aa8924dc837c89687dcef32b3604d69b942ceb5 +size 271229 diff --git a/ICLR/2025/Selective Task Group Updates for Multi-Task Optimization/6e303ff4-738b-4014-87fd-6d6df18a6e54_origin.pdf b/ICLR/2025/Selective Task Group Updates for Multi-Task Optimization/6e303ff4-738b-4014-87fd-6d6df18a6e54_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..643cb3c7015a63943374523e5717e91db3c03273 --- /dev/null +++ b/ICLR/2025/Selective Task Group Updates for Multi-Task Optimization/6e303ff4-738b-4014-87fd-6d6df18a6e54_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:830068ad9cd5a81a1da5c5e07aee3ee1f37b70f5d0e8db813c3f09a9ec9b471f +size 13561486 diff --git a/ICLR/2025/Selective Task Group Updates for Multi-Task Optimization/full.md b/ICLR/2025/Selective Task Group Updates for Multi-Task Optimization/full.md new file mode 100644 index 0000000000000000000000000000000000000000..011ba3244b0adc369ad23ae6efeacea78627c1e0 --- /dev/null +++ b/ICLR/2025/Selective Task Group Updates for Multi-Task Optimization/full.md @@ -0,0 +1,882 @@ +# SELECTIVE TASK GROUP UPDATES FOR MULTI-TASK OPTIMIZATION + +Wooseong Jeong & Kuk-Jin Yoon + +Korea Advanced Institute of Science and Technology + +{stk14570,kjyoon}@kaist.ac.kr + +# ABSTRACT + +Multi-task learning enables the acquisition of task-generic knowledge by training multiple tasks within a unified architecture. However, training all tasks together in a single architecture can lead to performance degradation, known as negative transfer, which is a main concern in multi-task learning. Previous works have addressed this issue by optimizing the multi-task network through gradient manipulation or weighted loss adjustments. However, their optimization strategy focuses on addressing task imbalance in shared parameters, neglecting the learning of task-specific parameters. As a result, they show limitations in mitigating negative transfer, since the learning of shared space and task-specific information influences each other during optimization. To address this, we propose a different approach to enhance multi-task performance by selectively grouping tasks and updating them for each batch during optimization. We introduce an algorithm that adaptively determines how to effectively group tasks and update them during the learning process. To track inter-task relations and optimize multi-task networks simultaneously, we propose proximal inter-task affinity, which can be measured during the optimization process. We provide a theoretical analysis on how dividing tasks into multiple groups and updating them sequentially significantly affects multi-task performance by enhancing the learning of task-specific parameters. Our methods substantially outperform previous multi-task optimization approaches and are scalable to different architectures and various numbers of tasks. + +# 1 INTRODUCTION + +Multi-task learning (MTL) stands out as a key approach for crafting efficient and robust deep learning models that can adeptly manage numerous tasks within a unified architecture (Caruana, 1997). By training related tasks within a single network, MTL facilitates the acquisition of universal knowledge spanning multiple tasks, thereby enhancing generalization and accelerating convergence. Additionally, MTL reduces the need for expensive computing and storage resources by employing a shared network across tasks, making it a favorable choice for future generalized networks across many applications. + +The goal of MTL is to mitigate negative transfer (Crawshaw, 2020) between tasks. Since each task possesses its own distinct objective function, improving performance in one task can potentially impede the performance of others. This phenomenon, characterized by a trade-off among tasks' performances, is referred to as negative transfer. To mitigate negative transfer during optimization, task-specific gradients are manipulated (Désidéri, 2012; Sener & Koltun, 2018; Yu et al., 2020; Liu et al., 2021a,b; Navon et al., 2022; Senushkin et al., 2023), tasks' losses are adaptively weighted (Kendall et al., 2018; Guo et al., 2018; Liu et al., 2019; 2024), or a combination of both approaches is used (Liu et al., 2021b). Previous research focused on balancing the influence of different tasks by considering unbalance in gradients of shared parameters. However, these analyses overlooked the role of task-specific parameters. Since the learning of shared space and task-specific information influence each other during optimization, a balanced shared space across tasks cannot be achieved without learning task-specific information in the task-specific parameters. + +Therefore, we take a fundamentally different approach to mitigate negative transfer in MTL (see Figure 1). Our experiments reveal a notable difference in multi-task performance depending on whether task losses are updated collectively or sequentially. By grouping tasks and updating them + +![](images/6418be5aed5c96c50c791f14336d9ce3552e332bee10ab1bea6b0d91f3e6345b.jpg) +(a) +Figure 1: Comparison of multi-task optimization methods. $\Theta$ represents the network parameters, and $\{\mathcal{L}\}_{i=1}^{\mathcal{K}}$ denotes the task-specific losses for $\mathcal{K}$ tasks. (a) Loss-based approaches balance the loss by adjusting the weights $\{w_i\}_{i=1}^{\mathcal{K}}$ during optimization. (b) Gradient-based approaches modify the task-specific gradients $\{g_i\}_{i=1}^{\mathcal{K}}$ with respect to $\Theta$ . (c) Our method divides the tasks into $\mathcal{M}$ groups (in this case, $\mathcal{M} = 2$ ) and updates them sequentially for each batch during optimization. + +![](images/2d288058d469c8dc6b15a3992aeb45a0323d332839b53b769d4f6a1d3f39df27.jpg) +(b) + +![](images/64e4665e19582683fc6c760ffe4cf13d901e6a7447ba8a26c13ac03c9eada975.jpg) +(c) + +sequentially, the network can focus on specific task groups in turn, facilitating the learning of task-specific parameters. Thus, our main objective is to identify optimal strategies for grouping and updating tasks during optimization. Inter-task affinity (Fifty et al., 2021), which evaluates the loss change of one task when updating another task's gradients in the shared parameters, is a useful metric for understanding task relations. However, directly incorporating inter-task affinity into optimization presents several challenges: (i) It only considers updates to shared parameters, ignoring the influence of task-specific parameter updates. (ii) Inter-task affinity varies significantly throughout optimization, so relying on the average across time steps may not fully capture task relations. (iii) Measuring inter-task affinity is computationally intensive because it involves recursive gradient updates, tracking changes in loss, and reverting to previous parameter states. To address these issues, we introduce proximal inter-task affinity (Section 3.1), which concurrently explains the updates of shared and task-specific parameters. This metric can be tracked over time to approximate inter-task relations during optimization without significant computational overhead. + +By capturing task relations, we introduce an algorithm that dynamically updates task groups using proximal inter-task affinity to effectively mitigate negative transfer between tasks (Section 3.2). Additionally, we present practical methods for inferring proximal inter-task affinity during task group updates. In the theoretical analysis (Section 4), we explain how this sequential update strategy can improve multi-task performance from an optimization standpoint. Previous approaches have demonstrated convergence to Pareto-stationary points, where the sum of all task-specific gradients equals zero (Désidéri, 2012; Sener & Koltun, 2018; Yu et al., 2020; Liu et al., 2021a,b; Navon et al., 2022; Senushkin et al., 2023). However, conventional convergence analysis cannot explain why sequential updates yield better multi-task performance with comparable stability, as they handle the learning of shared and task-specific parameters separately. Instead, we provide a theoretical explanation of the relations between the updates of shared and task-specific parameters and how the update sequence affects this. This perspective is not addressed in traditional multi-task optimization, which typically deals with the learning of shared and task-specific parameters independently. As a result, our approach facilitates the learning of task-specific parameters with stability similar to other optimization methods, while achieving faster convergence compared to previous gradient-based approaches. Experimental results demonstrate that adaptively partitioning the task set and sequentially updating them during the optimization process significantly enhances multi-task performance compared to previous works. Our main contributions are threefold: + +- We propose an algorithm that dynamically groups tasks for updating each batch during multi-task optimization. To do this, we introduce proximal inter-task affinity, which we can track throughout the optimization process to group tasks accordingly. +- We provide a theoretical explanation of the advantages of sequentially updating task groups based on proximal inter-task affinity. We discuss how sequential updates can enhance the learning of task-specific parameters and improve multi-task performance, a result that traditional multi-task optimization analyses do not explain. +- Our methods demonstrate superior performance across various benchmarks when compared to previous multi-task optimization techniques, including both loss-based and gradient-based approaches. + +# 2 RELATED WORK + +Optimization methods in MTL can be broadly categorized into those that manipulate task-specific gradients (Chen et al., 2018; 2020; Javaloy & Valera, 2021; Désideri, 2012; Sener & Koltun, 2018; Yu et al., 2020; Liu et al., 2021a; b; Phan et al., 2022; Navon et al., 2022; Senushkin et al., 2023; Jeong & Yoon, 2024) and those that adjust the weighting of task-specific losses (Kendall et al., 2018; Guo et al., 2018; Liu et al., 2019; 2024). Addressing the imbalance in task influence, normalized gradients are utilized (Chen et al., 2018) to prevent task spillover. Introducing stochasticity to the network's parameters based on gradient consistency, GradDrop (Chen et al., 2020) drops gradients. RotoGrad (Javaloy & Valera, 2021) rotates the network's feature space to align tasks. MGDA (Sener & Koltun, 2018) treats MTL as a multi-objective problem, minimizing the norm point in the convex hull. CAGrad (Liu et al., 2021a) minimizes multiple loss functions and regulates trajectory using worst local improvements of individual tasks. Aligned-MTL (Senushkin et al., 2023) stabilizes optimization by aligning principal components of gradient matrix. The weighting of losses significantly impacts multi-task performance as tasks with higher losses can dominate training. Addressing this, tasks' losses are weighted based on task-dependent uncertainty (Kendall et al., 2018). Prioritizing tasks according to difficulty by evaluating validation results (Guo et al., 2018), or balancing multi-task loss reflecting loss descent rates (Liu et al., 2019), are also proposed strategies. Previous works on multi-task optimization that directly modify task-specific gradients Chen et al. (2018; 2020); Javaloy & Valera (2021); Désideri (2012); Sener & Koltun (2018); Yu et al. (2020); Liu et al. (2021a;b); Phan et al. (2022); Navon et al. (2022); Senushkin et al. (2023); Jeong & Yoon (2024) focus on learning the shared parameters of the network without considering their interaction with task-specific parameters during the optimization step. In contrast, we propose fundamentally different strategies to mitigate negative transfer by sequentially updating task groups which lead to better multi-task performance, a phenomenon not explained by conventional multi-task optimization analysis. + +# 3 SELECTIVE TASK GROUP UPDATES FOR MULTI-TASK OPTIMIZATION + +# 3.1 THE GOAL OF MULTI-TASK LEARNING AND INTER-TASK AFFINITY + +In the context of MTL, we deal with multiple tasks with its own objective function denoted as $\{\mathcal{L}_i\}_{i=1}^K$ , where $\mathcal{K}$ represents the number of tasks. The network parameters $\Theta$ are partitioned into $\{\Theta_s, \Theta_1, \Theta_2, \dots, \Theta_K\}$ , where $\Theta_s$ refers to the shared parameters while $\Theta_i$ represents the task-specific parameters for the task $i$ . To simplify the discussion, we assumed that $\Theta_s$ is shared across all tasks. However, the following discussion can still apply even when it is only partially shared for specific task sets. The goal of MTL is to find Pareto-optimal parameters (Sener & Koltun, 2018), denoted as $\Theta^*$ , that minimize the weighted sum of task-specific losses. This can be expressed as $\Theta^* = \arg \min_{\Theta} \sum_{i=1}^K w_i \mathcal{L}_i(\Theta_s, \Theta_i)$ , where $w_i$ represents the weight for the loss of task $i$ . + +The concept of inter-task affinity (Fifty et al., 2021) aims to identify tasks that enhance each other's performance when learned together on shared networks. It measures the extent to which the gradient of a specific task with respect to the shared parameters $\Theta_{s}$ , affects the loss of other tasks. + +Definition 1 (Inter-Task Affinity). Consider a multi-task network shared by tasks $i$ and $k$ . For a data sample $z^t$ and a learning rate $\eta$ , the task-specific gradients from $\mathcal{L}_i$ are applied to update the shared parameters of the network as follows: $\Theta_{s|i}^{t+1} = \Theta_s^t - \eta \nabla_{\Theta_s^t} \mathcal{L}_i(z^t, \Theta_s^t, \Theta_i^t)$ . The inter-task affinity from task $i$ to task $k$ at time step $t$ is then defined as: + +$$ +\mathcal {A} _ {i \rightarrow k} ^ {t} = 1 - \frac {\mathcal {L} _ {k} \left(z ^ {t} , \Theta_ {s \mid i} ^ {t + 1} , \Theta_ {k} ^ {t}\right)}{\mathcal {L} _ {k} \left(z ^ {t} , \Theta_ {s} ^ {t} , \Theta_ {k} ^ {t}\right)} \tag {1} +$$ + +In the context of task grouping (Fifty et al., 2021), task affinity is computed and utilized in two stages. Initially, task affinity within a shared network is assessed by monitoring how the loss for each task changes when updating the loss of the other task at each step. Subsequently, using the averaged task affinity, task groups are organized, and each group is trained in separate networks. However, directly incorporating inter-task affinity for multi-task optimization presents several challenges. First, it only tracks the learning of shared parameters, $\Theta_s$ , and their influence on task losses, without considering task-specific parameters, $\{\Theta_i\}_{i=1}^K$ . In practice, both shared and task-specific parameters need to be optimized simultaneously. Second, since inter-task affinity fluctuates significantly during + +optimization, it must be tracked continuously to capture evolving task relations. This process is computationally expensive, requiring recursive gradient updates, monitoring loss changes, and reverting to previous parameter states. + +# 3.2 PROXIMAL INTER-TASK AFFINITY FOR MULTI-TASK OPTIMIZATION + +To address the issues mentioned above, we propose practical methods based on the concept of proximal inter-task affinity to track task relations and use this information for concurrent multi-task optimization. Firstly, we integrate the learning of task-specific parameters into the estimation of inter-task affinity to incorporate this affinity into ongoing optimization. Secondly, we extend the concept of inter-task affinity to elucidate relations between task groups rather than individual pairs of tasks. This allows us to monitor these affinities when a set of tasks is collectively backpropagated. Practically, proximal inter-task affinity serves as an approximation of inter-task affinity; however, it also plays a crucial role in theoretical analysis, as discussed in Section 4, explaining why updating task groups sequentially yields distinct multi-task performance. To be specific, we lay out guidelines for updating proximal inter-task affinity by distinguishing between inter-group relations and intra-group relations. We then incorporate the concept of proximal inter-task affinity to explore the task update strategy, grouping tasks based on their affinity, which has a significant impact on multi-task performance. + +Before delving into the algorithm, let's establish some notations building upon those introduced in Section 3.1. Our objective is to partition tasks into several groups, denoted as $\{G_1, G_2, \dots, G_{\mathcal{M}}\}$ , where $\mathcal{M}$ is the number of task groups. Each group set contains tasks' indices as their components, for example, $G_k = \{i, j\}$ . When selecting tasks to form these groups, we require the task groups to be mutually exclusive, meaning that $G_i \cap G_j = \emptyset$ for any $i$ and $j$ ( $i \neq j$ ). + +Tracking inter-task affinity during optimization, as defined in eq. (1), is impractical. This is because it is difficult to assess the influence of individual tasks on shared network parameters when multiple tasks are updated simultaneously. Additionally, task-specific parameters $\{\Theta_i\}_{i=1}^K$ must also be updated concurrently, which is essential for MTL settings. Therefore, we practically approximate inter-task affinity by utilizing proximal inter-task affinity, taking into account updates of multiple tasks with task-specific parameters. The difference between inter-task affinity and proximal inter-task affinity is difficult to detect, so we provide a more detailed discussion in Appendix A.1. + +Definition 2 (Proximal Inter-Task Affinity). Consider a multi-task network shared by the task set $G$ , with their respective losses defined as $\mathcal{L}_G$ . For a data sample $z^t$ and a learning rate $\eta$ , the gradients of task set $G$ are updated to the parameters of the network as follows: $\Theta_{s|G}^{t+1} = \Theta_s^t - \eta \nabla_{\Theta_s^t} \mathcal{L}_G(z^t, \Theta_s^t, \Theta_G^t)$ and $\Theta_k^{t+1} = \Theta_k^t - \eta \nabla_{\Theta_k^t} \mathcal{L}_k(z^t, \Theta_s^t, \Theta_k^t)$ for $k \in G$ . Then, the proximal inter-task affinity from the task set $G$ to $\tau_k$ at time step $t$ is defined as: + +$$ +\mathcal {B} _ {G \rightarrow k} ^ {t} = 1 - \frac {\mathcal {L} _ {k} \left(z ^ {t} , \Theta_ {s \mid G} ^ {t + 1} , \Theta_ {k} ^ {t + 1}\right)}{\mathcal {L} _ {k} \left(z ^ {t} , \Theta_ {s} ^ {t} , \Theta_ {k} ^ {t}\right)} \tag {2} +$$ + +As it's not feasible to simultaneously track inter-task affinity and optimize networks, we instead track the proximal inter-task affinity and utilize it for multi-task optimization. We explain the benefits of integrating inter-task affinity into optimization in the view of conventional multi-task optimization. Theorem 1 suggests that grouping tasks with high inter-task affinity leads to better alignment of their gradients compared to grouping tasks with lower affinity. In analysis, we use the extended version of $\mathcal{A}$ for multiple tasks (e.g., $\mathcal{A}_{G\rightarrow k}$ ) for ease of notation. + +Theorem 1. Let $g_{k}$ denote the task-specific gradients backpropagated from the loss function $\mathcal{L}_k$ with respect to the parameters $\Theta_s^t$ . At a given time step $t$ , if the inter-task affinity from task group $\{i, k\}$ to task $k$ is greater than or equal to the inter-task affinity from group $\{j, k\}$ to task $k$ , denoted as $A_{i, k \to k}^t \geq A_{j, k \to k}^t$ . Then for a sufficiently small learning rate $\eta \ll 1$ , it follows that $g_{i} \cdot g_{k} \geq g_{j} \cdot g_{k}$ . + +The results also apply to proximal inter-task affinity $\mathcal{B}$ instead of $\mathcal{A}$ , as the only difference is the inclusion of task-specific parameters for task $k$ . + +We analyze how this alignment in task-specific gradients reduces the loss of task $k$ in Theorem 2. + +Theorem 2. Let $g_{k}$ denote the task-specific gradients backpropagated from the loss function $\mathcal{L}_k$ with respect to the parameters $\Theta_s^t$ . Let $\Theta_{s|k}^{t + 1}$ represent the updated parameters after applying the + +gradients. Assume that for tasks $i$ , $j$ , and $k$ , the inequality $g_{i} \cdot g_{k} \geq g_{j} \cdot g_{k}$ holds. Then, for a sufficiently small learning rate $\eta \ll 1$ , the inequality $\mathcal{L}_k(z^t, \Theta_{s|i,k}^{t+1}, \Theta_k^t) \leq \mathcal{L}_k(z^t, \Theta_{s|j,k}^{t+1}, \Theta_k^t)$ holds. + +The result indicates that when the gradients $g_{i}$ align better with $g_{k}$ than with $g_{j}$ , the loss on the reference task $k$ using the updated gradients $g_{i} + g_{k}$ is lower than that using the updated gradients $g_{j} + g_{k}$ . Theorems 1 and 2 suggest that updating tasks jointly with high proximal inter-task affinity at each optimization step is a reasonable approach. + +# 3.3 TRACKING PROXIMAL INTER-TASK AFFINITY IN SELECTIVE GROUP UPDATES + +From now on, we'll explain how we track proximal inter-task affinity in the sequential updates of task groups. For ease of explanation, we start with an already clustered (or initialized) task set $\{G_i\}_{i=1}^{\mathcal{M}}$ obtained from the tracked proximal inter-task affinity in the previous time step. $\mathcal{M}$ is the number of task groups. We'll provide more explanation at the end of this section on how the tracked proximal inter-task affinity is utilized in clustering the task set. + +Inter-Group Relations. We begin by forwarding the sample $z^t$ to the shared multi-task network, from which we obtain the multi-task loss $\{\mathcal{L}_i(z^t,\Theta_s^t,\Theta_i^t)\}_{i = 1}^K$ . Based on the task grouping $\{G_{i}\}_{i = 1}^{\mathcal{M}}$ , we divide each time step into $\mathcal{M}$ steps to update each task set. For simplicity of discussion, we update the first group $G_{1}$ in steps from $t$ to $t + 1 / \mathcal{M}$ , but the following discussion can be extended to all sequential updates between $t$ and $t + 1$ . + +$$ +\Theta_ {s \mid G _ {1}} ^ {t + 1 / \mathcal {M}} = \Theta_ {s} ^ {t} - \eta \sum_ {i \in G _ {1}} w _ {i} \nabla_ {\Theta_ {s} ^ {t}} \mathcal {L} _ {i} \left(z ^ {t}, \Theta_ {s} ^ {t}, \Theta_ {i} ^ {t}\right) \tag {3} +$$ + +$\Theta_{s|G_1}^{t+1/\mathcal{M}}$ represents the resulting parameter after updating the gradient from task group $G_1$ to the parameter $\Theta_s^t$ . Upon forwarding $z^t$ once more, we can access $\{\mathcal{L}_i(z^t,\Theta_{s|G_1}^{t+1/\mathcal{M}},\Theta_i^{t+1/\mathcal{M}})\}_{i=1}^K$ . For tasks that do not belong to $G_1$ , their task-specific parameters remain unchanged, satisfying $\Theta_i^{t+1/\mathcal{M}} = \Theta_i^t$ . Consequently, we can assess the proximal inter-task affinity from group $G_1$ to other tasks. In case where target task $\tau_j$ does not belong to $G_1$ , we refer to this as inter-group relations as follows: + +$$ +\mathcal {B} _ {G _ {1} \rightarrow j} ^ {t} \simeq \mathcal {B} _ {i \rightarrow j} ^ {t} = \mathcal {A} _ {i \rightarrow j} ^ {t} = 1 - \frac {\mathcal {L} _ {j} \left(z ^ {t} , \Theta_ {s \mid G _ {1}} ^ {t + 1 / \mathcal {M}} , \Theta_ {j} ^ {t}\right)}{\mathcal {L} _ {j} \left(z ^ {t} , \Theta_ {s} ^ {t} , \Theta_ {j} ^ {t}\right)} \quad \text {w h e r e} \tau_ {i} \in G _ {1} \text {a n d} \tau_ {j} \notin G _ {1} \tag {4} +$$ + +To be precise, eq. (4) represents the proximal inter-task affinity from $G_{1}$ to $\tau_{j}$ . However, since $\tau_{i}$ belongs to $G_{1}$ , which is a group of tasks similar to $\tau_{i}$ , we approximate the relations between $\tau_{i}$ and $\tau_{j}$ using $G_{1}$ and $\tau_{j}$ . We explain how approximation $\mathcal{B}_{G_1\to j}^t\simeq \mathcal{B}_{i\to j}^t$ can be justified in task group updates from the results of Theorem 3. We can repeat this process iteratively $\mathcal{M}$ times, with each step updating each task group in $\{G_i\}_{i = 1}^{\mathcal{M}}$ . + +Intra-Group Relations. Inter-group relation addresses inter-task relations where the source task $\tau_{i}$ and the target task $\tau_{j}$ do not belong to the same group. Conversely, intra-group relation refers to the influence between tasks within the same task group, and it follows a slightly different process. Since both the source and target tasks are updated simultaneously, we must infer inter-task relations based on how the tasks' losses change. Let's suppose we're updating the task set $G_{1}$ . The proximal inter-task affinity between tasks within the same group can be calculated as follows: + +$$ +\mathcal {B} _ {G _ {1} \rightarrow j} ^ {t} \simeq \mathcal {B} _ {i \rightarrow j} ^ {t} = 1 - \frac {\mathcal {L} _ {j} \left(z ^ {t} , \Theta_ {s \mid G _ {1}} ^ {t + 1 / \mathcal {M}} , \Theta_ {j} ^ {t + 1 / \mathcal {M}}\right)}{\mathcal {L} _ {j} \left(z ^ {t} , \Theta_ {s} ^ {t} , \Theta_ {j} ^ {t}\right)} \quad \text {w h e r e} \tau_ {i} \in G _ {1} \text {a n d} \tau_ {j} \in G _ {1} \tag {5} +$$ + +Similarly to the inter-group case, we approximate the relations from $\tau_{i}$ to $\tau_{j}$ using the relations from $G_{1}$ to $\tau_{j}$ and this also can be justified by Theorem 3 when we use it to cluster task sets. Since the target task $\tau_{j}$ is included in $G_{1}$ , we infer the inter-task relations by dividing cases into two. If both $\mathcal{B}_{i\rightarrow j}^{t}$ and $\mathcal{B}_{j\rightarrow i}^{t}$ have positive signs, we infer that the inter-task affinity between $\tau_{i}$ and $\tau_{j}$ is positive. Otherwise, if at least one of $\mathcal{B}_{i\rightarrow j}^{t}$ or $\mathcal{B}_{j\rightarrow i}^{t}$ has a negative sign, the inter-task affinity between $\tau_{i}$ and $\tau_{j}$ is negative. This inference is intuitive, as an increase in one task's loss during the decrease of the other task's loss implies that they transfer negative influences. However, it results in faster convergence compared to previous gradient-based optimization methods, which require a number + +Algorithm 1: Tracking Proximal Inter-Task Affinity for Task Group Updates +Require: Loss function $\{\mathcal{L}_i\}_{i=1}^K$ , Dataset $\{z_i\}_{i=1}^n$ , Total iteration $T$ , +Proximal inter-task affinity (w/ decay) $\mathcal{B}^t (\tilde{\mathcal{B}}^t)$ , Task group set $\{G_i\}_{i=1}^M$ , Decay rate $\beta \in (0,1)$ +Initialize: Proximal inter-task affinity $\tilde{\mathcal{B}}^0 = 0_{\mathcal{K}\times \mathcal{K}}$ , +Task group $G_i = \{\tau_i\}$ for $i = 1,\dots,\mathcal{M}$ ( $\mathcal{M} = \mathcal{K}$ for initialization) +for $t = 1,\dots,T$ do +Randomly mix the sequence of task group $\{G_i\}_{i=1}^M$ and calculate $\{\mathcal{L}_i(z^t,\Theta_s^t,\Theta_i^t)\}_{i=1}^K$ +for $k = 1,\dots,\mathcal{M}$ do +Update gradients $\sum_{\tau_i\in G_k}w_i\nabla L_i$ backpropagated from losses in $G_k$ +Forward $z^t$ and calculate $\mathcal{L}_i(z^t,\Theta_s^{t+k/M},\Theta_i^{t+k/M})$ for all $i = 1,\dots,\mathcal{K}$ +Calculate $\mathcal{B}_{i\rightarrow j}^{t+(k-1)/M}$ and $\mathcal{B}_{j\rightarrow i}^{t+(k-1)/M}$ where $\tau_i\in G_k$ for all $j = 1,\dots,\mathcal{K}$ +if $\tau_j\notin G_k$ or $\mathcal{B}_{i\rightarrow j}^{t+(k-1)/M}\cdot \mathcal{B}_{j\rightarrow i}^{t+(k-1)/M} \geq 0$ then + $\tilde{\mathcal{B}}_{i\rightarrow j}^{t+(k-1)/M} = (1-\beta)\tilde{\mathcal{B}}_{i\rightarrow j}^{t+(k-2)/M} + \beta \mathcal{B}_{i\rightarrow j}^{t+(k-1)/M}$ +else + $\tilde{\mathcal{B}}_{i\rightarrow j}^{t+(k-1)/M} = (1-\beta)\tilde{\mathcal{B}}_{i\rightarrow j}^{t+(k-2)/M} - \beta \max(|\mathcal{B}_{i\rightarrow j}^{t+(k-1)/M}|,|\mathcal{B}_{j\rightarrow i}^{t+(k-1)/M}|)$ +Divide task groups $\{G_i\}_{i=1}^M$ based on proximal inter-task affinity $\tilde{\mathcal{B}}^{(t+\mathcal{M}-1)/M}$ + +of backpropagations equal to the number of tasks, along with gradient manipulation. This is further analyzed in Section 5. In the initial phase of learning, we initialize task groups by assigning each task to a different group to facilitate the learning of proximal inter-task affinity. For stable tracking, we employ a decay rate $\beta$ . Using the tracked proximal inter-task affinity, the next task groups $\{G_i\}_{i=1}^{\mathcal{M}'}$ are formed by grouping tasks with positive affinity, where $\mathcal{M}'$ is the number of task sets for the next step. During optimization, the number of clustered task sets $\mathcal{M}'$ continuously fluctuates along with their composition. The entire process is outlined in Algorithm 1. + +We explain how it effectively approximates inter-task affinity in selective task group updates in Theorem 3. To be specific, we compare the inter-task affinity when the target task is included in the source task group versus when it is not. + +Theorem 3. The affinity between $\{i, k\} \to k$ and $i \to k$ satisfies $\mathcal{A}_{i,k \to k}^t \geq \mathcal{A}_{i \to k}^t$ . + +When task $i$ and $k$ are within the same task group, we can only access $\mathcal{B}_{i,k\to k}^{t}$ rather than $\mathcal{B}_{i\to k}^{t}$ during the optimization process. If $\mathcal{B}_{i,k\to k}^{t}\leq 0$ , the inter-task affinity also satisfies $\mathcal{A}_{i,k\to k}^{t}\leq 0$ as $\mathcal{A}_{i,k\to k}^{t}\leq \mathcal{B}_{i,k\to k}^{t}$ (see the end of appendix A.1). According to Theorem 3, this condition implies $\mathcal{A}_{i\to k}^{t}\leq 0$ . The proposed algorithm separates these tasks into different groups when $\mathcal{B}_{i,k\to k}^{t}\leq 0$ which justifies our grouping rules. + +Conversely, when tasks $\tau_{i}$ and $\tau_{j}$ belong to separate task groups, we only have access to $\mathcal{B}_{i\rightarrow k}^{t}$ instead of $\mathcal{B}_{i,k\rightarrow k}^{t}$ . In this scenario, the proposed algorithm merges these tasks into the same group if $\mathcal{B}_{i\rightarrow k}^{t}\geq 0$ . This inequality also implies $\mathcal{A}_{i\rightarrow k}^{t}\geq 0$ as $\mathcal{B}_{i\rightarrow k}^{t} = \mathcal{A}_{i\rightarrow k}^{t}$ (see the end of appendix A.1), justifying the merging of tasks $\tau_{i}$ and $\tau_{k}$ based on $\mathcal{B}_{i\rightarrow k}^{t}$ during optimization. + +# 4 THEORETICAL ANALYSIS + +We outline the benefits of grouping tasks with positive inter-task affinity and updating them in multi-task optimization in Theorem 1 and Theorem 2. We validate the feasibility of tracking proximal inter-task affinity and forming task groups based on this in our grouping updates strategy in Theorem 3. In this section, we clarify why, from the viewpoint of standard convergence analysis in Theorem 4, it's difficult to demonstrate that updating task groups sequentially leads to better performance than joint learning. We then explore how sequentially updating grouped task sets can improve multi-task performance, as discussed in Theorem 5. + +# 4.1 CONVERGENCE ANALYSIS + +We perform conventional convergence analysis to determine the convergence points of the sequential updates of task groups, as outlined in Theorem 4. Conventional analyses treat the learning of shared and task-specific parameters separately, which fails to explain why sequential updates result in better multi-task performance while maintaining comparable stability. + +Theorem 4 (Convergence Analysis). Given a set of differentiable losses $\{\mathcal{L}_i\}_{i=1}^{\mathcal{K}}$ and Lipschitz continuous gradients with a constant $H > 0$ , $\|\nabla \mathcal{L}_i(x) - \nabla \mathcal{L}_i(y)\| \leq H\|x - y\|$ for all $i = 1,2,\ldots,\mathcal{K}$ . If we sequentially update task groups $\{G_i\}_{i=1}^{\mathcal{M}}$ based on inter-task affinity, employing a sufficiently small step size $\eta \leq \min\left(\frac{2}{H\mathcal{K}}, \frac{1}{H|G_m|}\right)$ where $|G_m|$ is the number of tasks in $G_m$ , then the following inequalities are satisfied for any task group $G_m$ . + +$$ +\begin{array}{l} \sum_ {k = 1} ^ {\mathcal {M}} \mathcal {L} _ {G _ {k}} \left(z ^ {t}, \Theta_ {s | G _ {m}} ^ {t + m / \mathcal {M}}, \Theta_ {G _ {k}} ^ {t + 1}\right) \leq \sum_ {k = 1} ^ {\mathcal {M}} \mathcal {L} _ {G _ {k}} \left(z ^ {t}, \Theta_ {s | G _ {m}} ^ {t + (m - 1) / \mathcal {M}}, \Theta_ {G _ {k}} ^ {t}\right) (6) \\ - \eta g _ {s, G _ {m}} ^ {t + (m - 1) / \mathcal {M}} \cdot \left(\sum_ {k = 1} ^ {\mathcal {M}} g _ {s, G _ {k}} ^ {t + (m - 1) / \mathcal {M}} - g _ {s, G _ {m}} ^ {t + (m - 1) / \mathcal {M}}\right) - \frac {\eta}{2} \left| \left| g _ {t s, G _ {m}} ^ {t} \right| \right| ^ {2} (7) \\ \end{array} +$$ + +where $g_{s,G_m}$ and $g_{ts,G_m}$ represent the gradients of the shared parameters and task-specific parameters, respectively, for group $G_m$ . Previous approaches, which handle updates of shared and task-specific parameters independently, failing to capture their interdependence during optimization. The term, $g_{s,G_m}^{t + (m - 1) / \mathcal{M}}\cdot (\sum_{k = 1}^{\mathcal{M}}g_{s,G_k}^{t + (m - 1) / \mathcal{M}})$ , fluctuates during optimization. When the gradients of group $G_m$ align well with the gradients of the other groups $\{G_k\}_{i = 1,i\neq m}^{\mathcal{M}}$ , their dot product yields a positive value, leading to a decrease in multi-task losses. In practice, the sequential update strategy demonstrates a similar level of stability in optimization, which appears to contradict the conventional results. Thus, we assume a correlation between the learning of shared parameters and task-specific parameters, where the learning of task-specific parameters reduces gradient conflicts in shared parameters. Under this assumption, the sequential update strategy can guarantee convergence to Pareto-stationary points. This assumption is reasonable, as task-specific parameters capture task-specific information, thereby reducing conflicts in the shared parameters across tasks. + +# 4.2 ADVANTAGES OF SELECTIVE TASK GROUP UPDATES + +Nonetheless, sequentially updating task groups facilitates the learning of task-specific parameters, a concept not covered by conventional analysis. We directly compare the loss of joint learning with the loss of the sequential group updates strategy. To do this, we introduce two-step proximal inter-task affinity, an expanded concept of proximal inter-task affinity over multiple steps, as defined in Appendix A.6. We analyze the benefits of sequential updates using this two-step proximal inter-task affinity based on the plausible assumptions delineated in Theorem 5. + +Theorem 5. Consider three tasks $\{i,j,k\}$ , where task groups are formed with positive inter-task affinity as $\{i,k\}$ and $\{j\}$ . Assume all losses are convex and differentiable, and the change in affinity during a single step from $t + (m - 1) / \mathcal{M}$ to $t + m / \mathcal{M}$ is negligible. The affinity, which learns all tasks jointly, is denoted as $\mathcal{B}_{i,j,k\to k}^{t + (m - 1) / \mathcal{M}}$ . The affinity for the updating sequence $(\{i,k\},\{j\})$ is represented as $\mathcal{B}_{i,k;j\to k}^{t + (m - 1) / \mathcal{M}}$ , while for the sequence $(\{j\},\{i,k\})$ , it is represented as $\mathcal{B}_{j;i,k\to k}^{t + (m - 1) / \mathcal{M}}$ . Then, for a sufficiently small learning rate $\eta \ll 1$ , the following holds: + +$$ +\mathcal {B} _ {i, j, k \rightarrow k} ^ {t + (m - 1) / \mathcal {M}} \simeq \mathcal {B} _ {i, k; j \rightarrow k} ^ {t + (m - 1) / \mathcal {M}} \quad \mathcal {B} _ {i, j, k \rightarrow k} ^ {t + (m - 1) / \mathcal {M}} \leq \mathcal {B} _ {j; i, k \rightarrow k} ^ {t + (m - 1) / \mathcal {M}} \tag {8} +$$ + +This suggests that grouping tasks with proximal inter-task affinity and subsequently updating these groups sequentially result in lower multi-task loss compared to jointly backpropagating all tasks. This disparity arises because the network can discern superior task-specific parameters to accommodate task-specific information during sequential learning. Notably, the order in which tasks are updated impacts multi-task outcomes within a single batch. However, as the optimization progresses, this influence diminishes, as demonstrated in the following experimental results. + +Table 1: Comparison of time complexity and memory consumption between our optimization methods and other multi-task optimization approaches, including loss-based and gradient-based methods. + +
MethodForward PassBackpropagationGradient ManipulationOptimizer StepAffinity UpdateMemory
Loss-based MethodsO(1)O(1)XO(1)XO(1)
Gradient-based MethodsO(1)O(K)✓O(1)XO(K)
OursO(M)O(M)XO(M)✓O(1)
Forward PassBackpropagationGradient ManipulationOptimizer StepClustering + Affinity Update
GD
UW
DTP
DWA
GradDrop
PCGrad
CAGrad
Aligned-MTL
Nash-MTL
FAMO
Ours
Time(s)012
+ +Figure 2: Comparison of the average time required by each optimization process to handle a single batch for 5 tasks on PASCAL-Context (left) and 11 tasks on Taskonomy (right). + +# 5 EXPERIMENTS + +Experimental settings. We assess the proposed techniques using three datasets: NYUD-V2 for indoor vision tasks (Silberman et al., 2012), PASCAL-Context for outdoor scenarios (Mottaghi et al., 2014), and Taskonomy (Zamir et al., 2018) for large number of tasks. Multi-task performance is compared using the metric introduced by (Maninis et al., 2019). This metric calculates the per-task performance by averaging it relative to the single-task baseline $b$ : $\triangle_{m} = (1 / \mathcal{K})\sum_{i = 1}^{\mathcal{K}}(-1)^{li}(M_{m,i} - M_{b,i}) / M_{b,i}$ where $l_{i} = 1$ if a lower value of measure $M_{i}$ means indicates better performance for task $\tau_{i}$ , and 0 otherwise. More details are introduced in Appendix C. + +Baselines. We selected conventional multi-task optimization methods as our baselines: 1) Single-task learning, where each task is trained independently; 2) GD, where all task gradients are updated jointly without manipulation; 3) Gradient-based optimization methods that include gradient manipulation, such as GradDrop (Chen et al., 2020), MGDA (Sener & Koltun, 2018), PCGrad (Yu et al., 2020), CAGrad (Liu et al., 2021a), Aligned-MTL (Senushkin et al., 2023), and Nash-MTL (Navon et al., 2022); 4) Loss-based optimization methods, including UW (Kendall et al., 2018), DTP (Guo et al., 2018), DWA (Liu et al., 2019), and FAMO (Liu et al., 2024); and 5) A hybrid approach combining gradient and loss-based methods, specifically IMTL (Liu et al., 2021b). Each experiment was conducted three times with different random seeds to ensure a fair comparison. + +Architectures. We use the most common multi-task architecture, employing a shared encoder and multiple decoders, each dedicated to a specific task. For our encoder, we mainly use ViT Dosovitskiy et al. (2020), coupled with a single convolutional layer as the decoder. + +We conduct experimental analysis to address several key statements and questions. For additional and comprehensive experimental results, please refer to Appendix D. + +Computational cost and memory consumption. In Table 1, we compare the time complexity and memory consumption of previous approaches with our methods. Additionally, Figure 2 presents the average time required by each optimization process to handle a single batch. Loss-based approaches, such as FAMO, DWA, DTP, and UW, exhibit the lowest computational cost and memory usage because they do not require multiple forward passes or backpropagation. In contrast, gradient-based approaches, including Nash-MTL, Aligned-MTL, CAGrad, PCGrad, and GradDrop, incur significantly higher computational costs due to the iterative backpropagation required for each task $(\mathcal{K})$ , even though they have the potential for better performance. These approaches also need to store task-specific gradients, which demands $\mathcal{K}$ times more memory. Our methods, however, require $\mathcal{M}$ (number of groups) forward passes and backward passes, where $\mathcal{M} < \mathcal{K}$ . As shown in Figure 3c, the number of groups changes during optimization on Taskonomy, with our methods maintaining an average $\mathcal{M} = 1.8$ with ViT-L, much lower than $\mathcal{K} = 11$ for the Taskonomy benchmark. Despite the need for multiple forward passes, our methods remain computationally competitive because the majority of the computational load is concentrated on backpropagation and gradient manipulation. + +Table 2: Experimental results on the Taskonomy dataset using ViT-L. The best results in each column are shown in bold, while convergence failures are indicated with a dash. + +
TaskDEDZEOETK2K3NCRS2S2.5△m(↑)
L1 Dist. ↓L1 Dist. ↓L1 Dist. ↓L1 Dist. ↓L1 Dist. ↓L1 Dist. ↓L1 Dist. ↓RMSE ↓L1 Dist. ↓L1 Dist. ↓L1 Dist. ↓
Single Task0.01550.01600.10120.17130.16200.0820.21690.71030.13570.17000.1435-
GD0.01630.01670.12110.17420.17150.0930.23330.75270.16250.18370.1487-8.65 ±0.229
GradDrop0.01680.01720.12290.17440.17270.0910.25620.76150.16560.18620.1511-10.81 ±0.377
MGDA------------
UW0.01670.01510.12120.17280.17120.0890.23600.74710.16070.18290.1538-7.65 ±0.087
DTP0.01690.01530.12130.17200.17070.0890.25170.74810.16030.18140.1503-8.16 ±0.081
DWA0.01470.01550.12090.17250.17110.0890.26190.74860.16130.18450.1543-7.92 ±0.077
PCGrad0.01610.01650.12060.17350.16960.0900.23010.75400.16250.18300.1483-7.72 ±0.206
CAGrad0.01620.01660.12020.17690.16510.0910.25650.76530.16610.18610.1571-10.05 ±0.346
IMTL0.01620.01650.12060.17410.17100.0900.22680.74970.16170.18320.1543-8.03 ±0.179
Aligned-MTL0.01500.01550.11350.17250.16300.0860.25130.80390.16460.18000.1438-6.22 ±0.285
Nash-MTL------------
FAMO0.01570.01550.12110.17300.17020.0900.24330.74790.16100.18230.1527-7.58 ±0.211
Ours0.01400.01450.11360.17350.16790.0870.20290.71660.15000.17690.1469-1.42 ±0.208
+ +![](images/52fd2b8cd8dd7505133e611ad5ed0a7819b42e98647e0260113b318fa8625c80.jpg) +(a) $\{G\}_{i = 1}^{\mathcal{M}}$ with ViT-L + +![](images/f754eab56dee88f7091f774046ae525109ca391e9eec1607b8bcf7904edb798d.jpg) +(b) $\{G\}_{i = 1}^{\mathcal{M}}$ with ViT-T + +![](images/e85cb519dcc135efb1fd5e708e7ed144a57e4a7fa85f73fda1ad70520cbeff5c.jpg) +(c) Change of $\mathcal{M}$ +Figure 3: The averaged grouping results $\{G\}_{i = 1}^{\mathcal{M}}$ on the Taskonomy benchmark are shown for ViT-L in (a) and for ViT-T in (b). (c) illustrates how the number of task groups, $\mathcal{M}$ , changes during optimization. (d) shows the change in proximal inter-task affinity from DE to C. + +![](images/e403b389189b3a876f9677f4f174372ab69c238a0065125b1c3c6071472758d6.jpg) +(d) Change of $\mathcal{B}^t$ + +This trend becomes more advantageous as the number of tasks increases. Our methods achieve a computational cost that falls between loss-based and gradient-based methods, while maintaining similar memory consumption to loss-based methods. + +**Optimization results comparison.** We compare the results of multi-task optimization on Taskonomy in Table 2 and on NYUD-v2 and PASCAL-Context in Table 3. Our methods achieve superior multi-task performance across all benchmarks, demonstrating their practical effectiveness. One key observation is that the tasks showing the greatest performance improvements differ between our methods and previous approaches, reflecting the distinct motivations behind each optimization design. Recent methods like Nash-MTL, IMTL, and Aligned-MTL focus on improving edge detection, often at the expense of other tasks. This is due to their emphasis on balancing task losses or gradients, which are affected by unbalanced loss scales. Since edge detection shows the lowest loss scale across the optimization process, these methods prioritize enhancing its performance. Loss-based approaches such as FAMO, DWA, DTP, and UW share a similar motivation but exhibit limited performance compared to gradient-based methods. In contrast, our methods enhance performance across all tasks compared to GD by optimizing task-specific parameters in a grouping update, which benefits all tasks. Furthermore, our methods achieve stable convergence with many tasks, unlike MGDA or Nash-MTL, which struggle to converge in such scenarios on Taskonomy. + +Grouping results of selective task group updates. In Figure 3, we illustrate how the grouping strategy evolves during the optimization process. Specifically, in Figures 3a and 3b, we show the frequency with which different tasks are grouped together throughout the entire optimization process. Similar tasks, such as depth euclidean (DE) and depth zbuffer (DZ), tend to be grouped more often, whereas depth-related tasks are less frequently grouped with tasks of other types. Overall, the trends in task grouping are consistent across different backbone network sizes. However, one notable observation is that the overall level of grouping increases as the backbone size grows. This suggests that larger models are better at extracting generalizable features across multiple tasks, leading to higher inter-task affinity. In Figure 3c, we present the average number of task groups $\mathcal{M}$ throughout the optimization process. During optimization, $\mathcal{M}$ tends to increase as proximal inter-task affinity decreases, suggesting that task competition grows more intense over time. Moreover, $\mathcal{M}$ grows as the backbone network's capacity increases, which aligns with the grouping patterns observed for different backbone sizes in Figures 3a and 3b. We provide an example of proximal inter-task affinity in Figure 3d, with all task pairs shown in Figure D.2. + +Table 3: We assess the proposed method alongside previous multi-task optimization approaches on both NYUD-v2 and PASCAL-Context. The best results are highlighted in bold. + +
MethodNYUD-v2PASCAL-Context
Semseg mIoU ↑Depth RMSE ↓Normal mErr ↓Edge odsF ↑△m % ↑Semseg mIoU ↑Parsing mIoU ↑Saliency maxF ↑Normal mErr ↓Edge odsF ↑△m % ↑
Single Task39.350.66122.1459.7-67.9658.9083.7615.6547.7-
GD38.510.64125.6453.0-6.54 ± 0.17167.4855.4681.3618.4139.0-9.06 ± 0.095
GradDrop38.420.63825.7553.0-6.60 ± 0.26467.1855.3581.3218.5339.0-9.35 ± 0.092
MGDA20.930.87036.6659.8-35.96 ± 0.117------
UW38.200.63125.3253.0-5.99 ± 0.19667.1155.2281.3318.4438.6-9.46 ± 0.113
DTP38.520.63325.6052.8-6.26 ± 0.21467.0955.2381.3518.4038.6-9.41 ± 0.108
DWA38.560.63425.6252.8-6.30 ± 0.22067.1155.2381.3418.4438.6-9.46 ± 0.116
PCGrad38.260.63325.4054.0-5.70 ± 0.08366.6255.1181.8218.1640.0-8.58 ± 0.101
CAGrad38.310.64126.1158.0-5.10 ± 0.24366.3154.9681.2818.6844.9-7.46 ± 0.067
Aligned-MTL36.200.65523.7758.5-4.12 ± 0.12160.7854.4282.2917.4445.5-7.20 ± 0.075
IMTL37.190.65223.4557.8-3.31 ± 0.21363.9155.2382.2317.8344.2-7.07 ± 0.104
Nash-MTL36.940.64123.6058.0-3.14 ± 0.11568.5010.3275.6322.2535.3-31.91 ± 0.166
FAMO38.570.63625.6153.1-6.23 ± 0.16667.1255.2381.3418.4438.6-9.46 ± 0.115
Ours40.020.61824.0953.9-2.58 ± 0.20568.1457.1582.5217.1939.5-6.24 ± 0.192
+ +![](images/92018c1f3ff4e5792b48fc1d4ae34d5ed942d97ec76bd843ea1572cc03f4dd6c.jpg) +(a) + +![](images/03211e87f8d864f8e63b22f421dec706405e9cfd534df75b966388852c1bf573.jpg) +(b) +Figure 4: The averaged grouping results $\{G\}_{i=1}^{\mathcal{M}}$ are shown for NYUD-v2 in (a) and PASCAL-Context in (b). (c) illustrates how the decaying factor $\beta$ influences the stable tracking of proximal inter-task affinity. + +![](images/7ef712a41e10e2cc0f41988e245110335b7123e6641dfe10d93c7ab50102a787.jpg) +(c) + +Table 5: Ablation studies on Taskonomy exploring the impact of group order and type of grouping. + +
Method△m(↑)
Order of Group
Forward-1.41 ±0.211
Backward-1.44 ±0.209
Grouping Methods
Joint (GD)-8.65 ±0.229
Separate-2.48 ±0.651
Ours-1.42 ±0.208
+ +Stability of optimization. In Tables 2 and 3, we also report the variance in multi-task performance. Our methods demonstrate a similar level of variance compared to previous optimization approaches. Additionally, we assess how the order of task group updates and the type of grouping affect performance and optimization stability in Table 5. Using the task groups identified from tracked proximal inter-task affinity, we compare performance when updating in forward order, backward order, and randomly selected order. The results show that the order of task group updates does not significantly impact the final multi-task performance or algorithm stability. When comparing our method to gradient descent (GD), where all tasks are grouped together $(\mathcal{M} = 1)$ , and a scenario where each task is placed in a separate group $(\mathcal{M} = \mathcal{K})$ , our approach demonstrates better performance and greater stability by grouping tasks with high proximal inter-task affinity. + +The effect of the decay rate on tracking affinity. The affinity decay rate $\beta$ influences the tracking of proximal inter-task affinity as shown in Figure 4c. A larger $\beta$ results in more dynamic fluctuations in affinity, resulting in more frequent changes in task groupings. In contrast, a smaller $\beta$ leads to slower adjustments in task groupings. We observe that the affinity decay rate $\beta$ does not significantly impact multi-task performance, which enhances the method's applicability. In our experiments, we set $\beta$ to 0.001. We anticipate that $\beta$ can be easily adjusted by monitoring the variation of proximal inter-task affinity. The overall results are shown in Figure D.5. + +# 6 CONCLUSION + +We propose a novel approach to mitigate negative transfer by dynamically dividing task groups during optimization. Through empirical experimentation, we observed significant differences in multi-task performance depending on whether task losses are backpropagated collectively or updated sequentially. Building on this insight, we introduce an algorithm that adaptively separates task sets and updates them within a single shared architecture during optimization. To facilitate simultaneous tracking of inter-task relations and network optimization, we introduce proximal inter-task affinity, which can be measured throughout the optimization process. Our analysis highlights the profound impact of sequential updates on the learning of task-specific representations. Ultimately, our methods substantially enhance multi-task performance compared to previous multi-task optimization. + +# REFERENCES + +Alessandro Achille, Michael Lam, Rahul Tewari, Avinash Ravichandran, Subhransu Maji, Charless C Fowlkes, Stefano Soatto, and Pietro Perona. Task2vec: Task embedding for meta-learning. In Proceedings of the IEEE/CVF international conference on computer vision, pp. 6430-6439, 2019. +Alessandro Achille, Giovanni Paolini, Glen Mbeng, and Stefano Soatto. The information complexity of learning tasks, their structure and their distance. Information and Inference: A Journal of the IMA, 10(1):51-72, 2021. +Deblina Bhattacharjee, Tong Zhang, Sabine Susstrunk, and Mathieu Salzmann. Mult: an end-to-end multitask learning transformer. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 12031-12041, 2022. +David Bruggemann, Menelaos Kanakis, Stamatios Georgoulis, and Luc Van Gool. Automated search for resource-efficient branched multi-task networks. arXiv preprint arXiv:2008.10292, 2020. +Rich Caruana. Multitask learning. Machine learning, 28:41-75, 1997. +Zhao Chen, Vijay Badrinarayanan, Chen-Yu Lee, and Andrew Rabinovich. Gradnorm: Gradient normalization for adaptive loss balancing in deep multitask networks. In International conference on machine learning, pp. 794-803. PMLR, 2018. +Zhao Chen, Jiquan Ngiam, Yanping Huang, Thang Luong, Henrik Kretzschmar, Yuning Chai, and Dragomir Anguelov. Just pick a sign: Optimizing deep multitask models with gradient sign dropout. Advances in Neural Information Processing Systems, 33:2039-2050, 2020. +Zitian Chen, Yikang Shen, Mingyu Ding, Zhenfang Chen, Hengshuang Zhao, Erik G Learned-Miller, and Chuang Gan. Mod-squad: Designing mixtures of experts as modular multi-task learners. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 11828-11837, 2023. +Michael Crawshaw. Multi-task learning with deep neural networks: A survey. arXiv preprint arXiv:2009.09796, 2020. +Jifeng Dai, Kaiming He, and Jian Sun. Instance-aware semantic segmentation via multi-task network cascades. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 3150-3158, 2016. +Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In 2009 IEEE conference on computer vision and pattern recognition, pp. 248-255. IEEE, 2009. +Jean-Antoine Désideri. Multiple-gradient descent algorithm (mgda) for multiobjective optimization. Comptes Rendus Mathematique, 350(5-6):313-318, 2012. +Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, et al. An image is worth 16x16 words: Transformers for image recognition at scale. arXiv preprint arXiv:2010.11929, 2020. +David Eigen and Rob Fergus. Predicting depth, surface normals and semantic labels with a common multi-scale convolutional architecture. In Proceedings of the IEEE international conference on computer vision, pp. 2650-2658, 2015. +Mark Everingham and John Winn. The pascal visual object classes challenge 2012 (voc2012) development kit. Pattern Anal. Stat. Model. Comput. Learn., Tech. Rep, 2007:1-45, 2012. +Zhiwen Fan, Rishov Sarkar, Ziyu Jiang, Tianlong Chen, Kai Zou, Yu Cheng, Cong Hao, Zhangyang Wang, et al. $\mathbf{M}^3$ vit: Mixture-of-experts vision transformer for efficient multi-task learning with model-accelerator co-design. Advances in Neural Information Processing Systems, 35:28441-28457, 2022. + +Chrisantha Fernando, Dylan Banarse, Charles Blundell, Yori Zwols, David Ha, Andrei A Rusu, Alexander Pritzel, and Daan Wierstra. Pathnet: Evolution channels gradient descent in super neural networks. arXiv preprint arXiv:1701.08734, 2017. +Chris Fifty, Ehsan Amid, Zhe Zhao, Tianhe Yu, Rohan Anil, and Chelsea Finn. Efficiently identifying task groupings for multi-task learning. Advances in Neural Information Processing Systems, 34: 27503-27516, 2021. +Yuan Gao, Jiayi Ma, Mingbo Zhao, Wei Liu, and Alan L Yuille. Nddr-cnn: Layerwise feature fusing in multi-task cnns by neural discriminative dimensionality reduction. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 3205-3214, 2019. +Michelle Guo, Albert Haque, De-An Huang, Serena Yeung, and Li Fei-Fei. Dynamic task prioritization for multitask learning. In Proceedings of the European conference on computer vision (ECCV), pp. 270–287, 2018. +Pengsheng Guo, Chen-Yu Lee, and Daniel Ulbricht. Learning to branch for multi-task learning. In International Conference on Machine Learning, pp. 3854-3863. PMLR, 2020. +Ziniu Hu, Zhe Zhao, Xinyang Yi, Tiansheng Yao, Lichan Hong, Yizhou Sun, and Ed Chi. Improving multi-task generalization via regularizing spurious correlation. Advances in Neural Information Processing Systems, 35:11450-11466, 2022. +Adrián Javaloy and Isabel Valera. Rotograd: Gradient homogenization in multitask learning. arXiv preprint arXiv:2103.02631, 2021. +Wooseong Jeong and Kuk-Jin Yoon. Quantifying task priority for multi-task optimization. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 363-372, 2024. +Junguang Jiang, Baixu Chen, Junwei Pan, Ximei Wang, Dapeng Liu, Jie Jiang, and Mingsheng Long. Forkmerge: Mitigating negative transfer in auxiliary-task learning. Advances in Neural Information Processing Systems, 36, 2024. +Zhuoliang Kang, Kristen Grauman, and Fei Sha. Learning with whom to share in multi-task feature learning. In Proceedings of the 28th International Conference on Machine Learning (ICML-11), pp. 521-528, 2011. +Alex Kendall, Yarin Gal, and Roberto Cipolla. Multi-task learning using uncertainty to weigh losses for scene geometry and semantics. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 7482-7491, 2018. +Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014. +Abhishek Kumar and Hal Daume III. Learning task grouping and overlap in multi-task learning. arXiv preprint arXiv:1206.6417, 2012. +Da Li, Yongxin Yang, Yi-Zhe Song, and Timothy Hospedales. Sequential learning for domain generalization. In European Conference on Computer Vision, pp. 603-619. Springer, 2020. +Bo Liu, Xingchao Liu, Xiaojie Jin, Peter Stone, and Qiang Liu. Conflict-averse gradient descent for multi-task learning. Advances in Neural Information Processing Systems, 34:18878-18890, 2021a. +Bo Liu, Yihao Feng, Peter Stone, and Qiang Liu. Famo: Fast adaptive multitask optimization. Advances in Neural Information Processing Systems, 36, 2024. +Liyang Liu, Yi Li, Zhanghui Kuang, J Xue, Yimin Chen, Wenming Yang, Qingmin Liao, and Wayne Zhang. Towards impartial multi-task learning. iclr, 2021b. +Shikun Liu, Edward Johns, and Andrew J Davison. End-to-end multi-task learning with attention. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 1871-1880, 2019. + +Ze Liu, Yutong Lin, Yue Cao, Han Hu, Yixuan Wei, Zheng Zhang, Stephen Lin, and Baining Guo. Swin transformer: Hierarchical vision transformer using shifted windows. In Proceedings of the IEEE/CVF international conference on computer vision, pp. 10012-10022, 2021c. +Yongxi Lu, Abhishek Kumar, Shuangfei Zhai, Yu Cheng, Tara Javidi, and Rogerio Feris. Fully-adaptive feature sharing in multi-task networks with applications in person attribute classification. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 5334-5343, 2017. +Jiaqi Ma, Zhe Zhao, Xinyang Yi, Jilin Chen, Lichan Hong, and Ed H Chi. Modeling task relationships in multi-task learning with multi-gate mixture-of-experts. In Proceedings of the 24th ACM SIGKDD international conference on knowledge discovery & data mining, pp. 1930-1939, 2018. +Kevis-Kokitsi Maninis, Ilija Radosavovic, and Iasonas Kokkinos. Attentive single-tasking of multiple tasks. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 1851-1860, 2019. +Roozbeh Mottaghi, Xianjie Chen, Xiaobai Liu, Nam-Gyu Cho, Seong-Whan Lee, Sanja Fidler, Raquel Urtasun, and Alan Yuille. The role of context for object detection and semantic segmentation in the wild. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 891-898, 2014. +Basil Mustafa, Carlos Riquelme, Joan Puigcerver, Rodolphe Jenatton, and Neil Houlsby. Multimodal contrastive learning with limoe: the language-image mixture of experts. Advances in Neural Information Processing Systems, 35:9564-9576, 2022. +Aviv Navon, Aviv Shamsian, Idan Achituve, Haggai Maron, Kenji Kawaguchi, Gal Chechik, and Ethan Fetaya. Multi-task learning as a bargaining game. arXiv preprint arXiv:2202.01017, 2022. +Hoang Phan, Lam Tran, Ngoc N Tran, Nhat Ho, Dinh Phung, and Trung Le. Improving multi-task learning via seeking task-based flat regions. arXiv preprint arXiv:2211.13723, 2022. +Carlos Riquelme, Joan Puigcerver, Basil Mustafa, Maxim Neumann, Rodolphe Jenatton, André Susano Pinto, Daniel Keysers, and Neil Houlsby. Scaling vision with sparse mixture of experts. Advances in Neural Information Processing Systems, 34:8583-8595, 2021. +Ozan Sener and Vladlen Koltun. Multi-task learning as multi-objective optimization. Advances in neural information processing systems, 31, 2018. +Dmitry Senushkin, Nikolay Patakin, Arseny Kuznetsov, and Anton Konushin. Independent component alignment for multi-task learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 20083-20093, 2023. +Yuge Shi, Jeffrey Seely, Philip HS Torr, N Siddharth, Awni Hannun, Nicolas Usunier, and Gabriel Synnaeve. Gradient matching for domain generalization. arXiv preprint arXiv:2104.09937, 2021. +Nathan Silberman, Derek Hoiem, Pushmeet Kohli, and Rob Fergus. Indoor segmentation and support inference from rgbd images. In Computer Vision-ECCV 2012: 12th European Conference on Computer Vision, Florence, Italy, October 7-13, 2012, Proceedings, Part V 12, pp. 746-760. Springer, 2012. +Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556, 2014. +Ayan Sinha, Zhao Chen, Vijay Badrinarayanan, and Andrew Rabinovich. Gradient adversarial training of neural networks. 2018. +Samuel L Smith, Benoit Dherin, David GT Barrett, and Soham De. On the origin of implicit regularization in stochastic gradient descent. arXiv preprint arXiv:2101.12176, 2021. +Trevor Standley, Amir Zamir, Dawn Chen, Leonidas Guibas, Jitendra Malik, and Silvio Savarese. Which tasks should be learned together in multi-task learning? In International conference on machine learning, pp. 9120-9132. PMLR, 2020. + +Guolei Sun, Thomas Probst, Danda Pani Paudel, Nikola Popovic, Menelaos Kanakis, Jagruti Patel, Dengxin Dai, and Luc Van Gool. Task switching network for multi-task learning. In Proceedings of the IEEE/CVF international conference on computer vision, pp. 8291-8300, 2021. +Simon Vandenhende, Stamatos Georgoulis, Bert De Brabandere, and Luc Van Gool. Branched multi-task networks: deciding what layers to share. arXiv preprint arXiv:1904.02920, 2019. +Simon Vandenhende, Stamatos Georgoulis, and Luc Van Gool. Mti-net: Multi-scale task interaction networks for multi-task learning. In Computer Vision-ECCV 2020: 16th European Conference, Glasgow, UK, August 23-28, 2020, Proceedings, Part IV 16, pp. 527-543. Springer, 2020. +Wenhai Wang, Enze Xie, Xiang Li, Deng-Ping Fan, Kaitao Song, Ding Liang, Tong Lu, Ping Luo, and Ling Shao. Pyramid vision transformer: A versatile backbone for dense prediction without convolutions. In Proceedings of the IEEE/CVF international conference on computer vision, pp. 568-578, 2021a. +Wenxiao Wang, Lu Yao, Long Chen, Binbin Lin, Deng Cai, Xiaofei He, and Wei Liu. Crossformer: A versatile vision transformer hinging on cross-scale attention. arXiv preprint arXiv:2108.00154, 2021b. +Yongxian Wei, Zixuan Hu, Li Shen, Zhenyi Wang, Yu Li, Chun Yuan, and Dacheng Tao. Task groupings regularization: Data-free meta-learning with heterogeneous pre-trained models. arXiv preprint arXiv:2405.16560, 2024. +Enze Xie, Wenhai Wang, Zhiding Yu, Anima Anandkumar, Jose M Alvarez, and Ping Luo. Segformer: Simple and efficient design for semantic segmentation with transformers. Advances in Neural Information Processing Systems, 34:12077-12090, 2021. +Dan Xu, Wanli Ouyang, Xiaogang Wang, and Nicu Sebe. Pad-net: Multi-tasks guided prediction-and-distillation network for simultaneous depth estimation and scene parsing. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 675-684, 2018. +Xiaogang Xu, Hengshuang Zhao, Vibhav Vineet, Ser-Nam Lim, and Antonio Torralba. Mtformer: Multi-task learning via transformer and cross-task reasoning. In Computer Vision-ECCV 2022: 17th European Conference, Tel Aviv, Israel, October 23-27, 2022, Proceedings, Part XXVII, pp. 304-321. Springer, 2022. +Yangyang Xu, Xiangtai Li, Haobo Yuan, Yibo Yang, and Lefei Zhang. Multi-task learning with multi-query transformer for dense prediction. IEEE Transactions on Circuits and Systems for Video Technology, 2023a. +Yangyang Xu, Yibo Yang, and Lefei Zhang. Demt: Deformable mixer transformer for multi-task learning of dense prediction. In Proceedings of the AAAI conference on artificial intelligence, volume 37, pp. 3072-3080, 2023b. +Jianwei Yang, Chunyuan Li, Pengchuan Zhang, Xiyang Dai, Bin Xiao, Lu Yuan, and Jianfeng Gao. Focal self-attention for local-global interactions in vision transformers. arXiv preprint arXiv:2107.00641, 2021. +Hanrong Ye and Dan Xu. Inverted pyramid multi-task transformer for dense scene understanding. In Computer Vision-ECCV 2022: 17th European Conference, Tel Aviv, Israel, October 23-27, 2022, Proceedings, Part XXVII, pp. 514-530. Springer, 2022a. +Hanrong Ye and Dan Xu. Invpt: Inverted pyramid multi-task transformer for dense scene understanding. arXiv preprint arXiv:2203.07997, 2022b. +Hanrong Ye and Dan Xu. Taskprompt: Spatial-channel multi-task prompting for dense scene understanding. In The Eleventh International Conference on Learning Representations, 2022c. +Hanrong Ye and Dan Xu. Taskexpert: Dynamically assembling multi-task representations with memorial mixture-of-experts. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 21828-21837, 2023. + +Tianhe Yu, Saurabh Kumar, Abhishek Gupta, Sergey Levine, Karol Hausman, and Chelsea Finn. Gradient surgery for multi-task learning. Advances in Neural Information Processing Systems, 33: 5824-5836, 2020. +Amir R Zamir, Alexander Sax, William Shen, Leonidas J Guibas, Jitendra Malik, and Silvio Savarese. Taskonomy: Disentangling task transfer learning. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 3712-3722, 2018. +Xiaofeng Zhang, Yikang Shen, Zeyu Huang, Jie Zhou, Wenge Rong, and Zhang Xiong. Mixture of attention heads: Selecting attention heads per token. arXiv preprint arXiv:2210.05144, 2022. +Zhanpeng Zhang, Ping Luo, Chen Change Loy, and Xiaou Tang. Facial landmark detection by deep multi-task learning. In Computer Vision-ECCV 2014: 13th European Conference, Zurich, Switzerland, September 6-12, 2014, Proceedings, Part VI 13, pp. 94-108. Springer, 2014. +Zhenyu Zhang, Zhen Cui, Chunyan Xu, Yan Yan, Nicu Sebe, and Jian Yang. Pattern-affinitive propagation across depth, surface normal and semantic segmentation. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 4106-4115, 2019. + +# A PROOFS OF THEORETICAL ANALYSIS + +Before diving into the theoretical analysis proof, we'll briefly introduce the basic concepts used in our proof to ensure the paper is self-contained. + +Definition 3 (Lipschitz continuity). $f$ is $\lambda$ -Lipschitz if for any two points $u, v$ in the domain of $f$ , we have following inequality: + +$$ +\left| f (u) - f (v) \right| \leq \lambda \| u - v \| \tag {9} +$$ + +# A.1 DIFFERENCE BETWEEN INTER-TASK AFFINITY AND PROXIMAL INTER-TASK AFFINITY + +Firstly, let's reiterate the definitions of inter-task affinity and proximal inter-task affinity from the main paper. + +In a typical SGD process for task $i$ at time step $t$ with input $z^t$ , the update rule for $\Theta_s$ is as follows: $\Theta_{s|i}^{t + 1} = \Theta_s^t - \eta w_i \nabla_{\Theta_s^t} \mathcal{L}_i(z^t, \Theta_s^t, \Theta_i^t)$ where $z^t$ represents the input data and $\eta$ is the learning rate, $\Theta_{s|i}^{t + 1}$ is the updated shared parameters with loss $\mathcal{L}_i$ . Then the affinity from task $i$ to $k$ at time step $t$ , denoted as $\mathcal{A}_{i\rightarrow k}^t$ , is: + +$$ +\mathcal {A} _ {i \rightarrow k} ^ {t} = 1 - \frac {\mathcal {L} _ {k} \left(z ^ {t} , \Theta_ {s \mid i} ^ {t + 1} , \Theta_ {k} ^ {t}\right)}{\mathcal {L} _ {k} \left(z ^ {t} , \Theta_ {s} ^ {t} , \Theta_ {k} ^ {t}\right)} \tag {10} +$$ + +For proximal inter-task affinity, let's consider a multi-task network shared by the task set $G$ , with their respective losses defined as $\mathcal{L}_G$ . For a data sample $z^t$ and a learning rate $\eta$ , the gradients of task set $G$ are updated to the parameters of the network as follows: $\Theta_{s|G}^{t+1} = \Theta_s^t - \eta \nabla_{\Theta_s^t} \mathcal{L}_G(z^t, \Theta_s^t, \Theta_G^t)$ and $\Theta_k^{t+1} = \Theta_k^t - \eta \nabla_{\Theta_k^t} \mathcal{L}_k(z^t, \Theta_s^t, \Theta_k^t)$ for $k \in G$ . Then, the proximal inter-task affinity from group $G$ to task $k$ at time step $t$ is defined as: + +$$ +\mathcal {B} _ {G \rightarrow k} ^ {t} = 1 - \frac {\mathcal {L} _ {k} \left(z ^ {t} , \Theta_ {s \mid G} ^ {t + 1} , \Theta_ {k} ^ {t + 1}\right)}{\mathcal {L} _ {k} \left(z ^ {t} , \Theta_ {s} ^ {t} , \Theta_ {k} ^ {t}\right)} \tag {11} +$$ + +The primary distinction between the two affinities lies in the incorporation of the task set and the update of task-specific parameters (indicated by red letters). Proximal inter-task affinity is an expanded concept that integrates the task set rather than individual tasks as the source task. This difference is evident from the notation, where $i \to k$ in Equation (10) and $G \to k$ in Equation (11). + +The second main difference lies in the update of task-specific parameters. In the inter-task affinity in Equation (10), the denominator includes $\Theta_k^t$ , while in the proximal inter-task affinity in Equation (11), it includes $\Theta_k^{t + 1}$ , which is a subtle distinction that may not be noticed by readers. These two modifications allow us to track proximal inter-task affinity while simultaneously optimizing multi-task networks. + +When measuring affinity under the assumption of a convex objective, the proximal inter-task affinity is equal to or greater than the inter-task affinity. This also aligns well with real-world scenarios, as proximal inter-task affinity reflects updates to task-specific parameters, as shown below. + +$$ +\mathcal {A} _ {i \rightarrow k} ^ {t} = 1 - \frac {\mathcal {L} _ {k} \left(z ^ {t} , \Theta_ {s | i} ^ {t + 1} , \Theta_ {k} ^ {t}\right)}{\mathcal {L} _ {k} \left(z ^ {t} , \Theta_ {s} ^ {t} , \Theta_ {k} ^ {t}\right)} \leq 1 - \frac {\mathcal {L} _ {k} \left(z ^ {t} , \Theta_ {s | i} ^ {t + 1} , \Theta_ {k} ^ {t + 1}\right)}{\mathcal {L} _ {k} \left(z ^ {t} , \Theta_ {s} ^ {t} , \Theta_ {k} ^ {t}\right)} = \mathcal {B} _ {i \rightarrow k} ^ {t} \tag {12} +$$ + +This inequality can also be applied to an expanded setting that incorporates task sets. If we expand the concept of inter-task affinity from individual task to task set as $\mathcal{A}_{G\to k}^{t}$ , then the inequality $\mathcal{A}_{G\to k}^{t}\leq \mathcal{B}_{G\to k}^{t}$ is satisfied. If $k\notin G$ then, $\mathcal{A}_{G\to k}^{t} = \mathcal{B}_{G\to k}^{t}$ holds. + +For ease of notation, we use the expanded version of the affinity for multiple tasks throughout the proof, as follows: + +$$ +\mathcal {A} _ {G \rightarrow k} ^ {t} = 1 - \frac {\mathcal {L} _ {k} \left(z ^ {t} , \Theta_ {s \mid G} ^ {t + 1} , \Theta_ {k} ^ {t}\right)}{\mathcal {L} _ {k} \left(z ^ {t} , \Theta_ {s} ^ {t} , \Theta_ {k} ^ {t}\right)} \tag {13} +$$ + +This differs from proximal inter-task affinity, as it does not consider the update of task-specific parameters. + +# A.2 PROOF OF THEOREM 1 + +Theorem 1. Let $g_{k}$ denote the task-specific gradients backpropagated from the loss function $\mathcal{L}_k$ with respect to the parameters $\Theta_s^t$ . At a given time step $t$ , if the inter-task affinity from task group $\{i, k\}$ to task $k$ is greater than or equal to the inter-task affinity from group $\{j, k\}$ to task $k$ , denoted as $A_{i, k \to k}^t \geq A_{j, k \to k}^t$ . Then for a sufficiently small learning rate $\eta \ll 1$ , it follows that $g_{i} \cdot g_{k} \geq g_{j} \cdot g_{k}$ . + +Proof. Let's consider a scenario where we update the network parameters $\Theta$ with task-specific losses $\mathcal{L}_i$ and $\mathcal{L}_k$ simultaneously at time step $t$ with input $z^t$ . Applying the Taylor expansion, we obtain the following: + +$$ +\begin{array}{l} \mathcal {L} _ {k} \left(z ^ {t}, \Theta_ {s \mid i, k} ^ {t + 1}, \Theta_ {k} ^ {t}\right) \simeq \mathcal {L} _ {k} \left(z ^ {t}, \Theta_ {s} ^ {t}, \Theta_ {k} ^ {t}\right) + \left(\Theta_ {s \mid i, k} ^ {t + 1} - \Theta_ {s} ^ {t}\right) \nabla_ {\Theta_ {s} ^ {t}} \mathcal {L} _ {k} \left(z ^ {t}, \Theta_ {s} ^ {t}, \Theta_ {k} ^ {t}\right) + O \left(\eta^ {2}\right) (14) \\ = \mathcal {L} _ {k} \left(z ^ {t}, \Theta_ {s} ^ {t}, \Theta_ {k} ^ {t}\right) - \eta g _ {k} \cdot \left(g _ {i} + g _ {k}\right) + O \left(\eta^ {2}\right) (15) \\ \end{array} +$$ + +where $g_{i}$ and $g_{k}$ represent the gradients backpropagated from the losses $\mathcal{L}_i$ and $\mathcal{L}_k$ , respectively, with respect to the shared parameters $\Theta_s^t$ . For instance, $g_{i} = \nabla_{\Theta_{s}^{t}}\mathcal{L}_{i}(z^{t},\Theta_{s}^{t},\Theta_{i})$ . + +Reorganizing the inequality to align with the format of inter-task affinity, we obtain: + +$$ +\mathcal {A} _ {i, k \rightarrow k} ^ {t} = 1 - \frac {\mathcal {L} _ {k} \left(z ^ {t} , \Theta_ {s | i , k} ^ {t + 1} , \Theta_ {k} ^ {t}\right)}{\mathcal {L} _ {k} \left(z ^ {t} , \Theta_ {s} ^ {t} , \Theta_ {k} ^ {t}\right)} \simeq \frac {1}{\mathcal {L} _ {k} \left(z ^ {t} , \Theta_ {s} ^ {t} , \Theta_ {k} ^ {t}\right)} \left(\eta g _ {k} \cdot \left(g _ {i} + g _ {k}\right) + O \left(\eta^ {2}\right)\right) \tag {16} +$$ + +Similar results can be obtained for $A_{j,k\to k}^{t}$ + +$$ +\mathcal {A} _ {j, k \rightarrow k} ^ {t} = 1 - \frac {\mathcal {L} _ {k} \left(z ^ {t} , \Theta_ {s | j , k} ^ {t + 1} , \Theta_ {k} ^ {t}\right)}{\mathcal {L} _ {k} \left(z ^ {t} , \Theta_ {s} ^ {t} , \Theta_ {k} ^ {t}\right)} \simeq \frac {1}{\mathcal {L} _ {k} \left(z ^ {t} , \Theta_ {s} ^ {t} , \Theta_ {k} ^ {t}\right)} \left(\eta g _ {k} \cdot \left(g _ {j} + g _ {k}\right) + O \left(\eta^ {2}\right)\right) \tag {17} +$$ + +From $\mathcal{A}_{i,k\to k}^{t}\geq \mathcal{A}_{j,k\to k}^{t}$ and by ignoring the $O(\eta^2)$ term with a sufficiently small learning rate $\eta \ll 1$ , we can derive the result: + +$$ +g _ {i} \cdot g _ {k} \geq g _ {j} \cdot g _ {k} \tag {18} +$$ + +![](images/fd83a48698ebea458fffb44adbfa0f33e1d0345e510266f5ced437cdf051e5df.jpg) + +The findings indicate that grouping tasks with positive inter-task affinity exhibits better alignment in task-specific gradients compared to grouping tasks with negative inter-task affinity, thereby validating the grouping strategies employed by our algorithm. Furthermore, we analyze how this alignment in task-specific gradients contributes to reducing the loss of task $k$ in Theorem 2. + +# A.3 PROOF OF THEOREM 2 + +Theorem 2. Let $g_{k}$ denote the task-specific gradients backpropagated from the loss function $\mathcal{L}_k$ with respect to the parameters $\Theta_s^t$ . Let $\Theta_{s|k}^{t+1}$ represent the updated parameters after applying the gradients. Assume that for tasks $i, j$ , and $k$ , the inequality $g_{i} \cdot g_{k} \geq g_{j} \cdot g_{k}$ holds. Then, for a sufficiently small learning rate $\eta \ll 1$ , the inequality $\mathcal{L}_k(z^t, \Theta_{s|i,k}^{t+1}, \Theta_k^t) \leq \mathcal{L}_k(z^t, \Theta_{s|j,k}^{t+1}, \Theta_k^t)$ holds. + +Proof. Let's consider a scenario where we update the network parameters $\Theta_s^t$ with task-specific losses $\mathcal{L}_i$ and $\mathcal{L}_k$ simultaneously at time step $t$ with input $z^t$ . Let $g_i$ denote the gradients backpropagated from the loss $\mathcal{L}_i$ with respect to the shared parameters $\Theta_s^t$ , expressed as $g_i = \nabla \Theta_s^t \mathcal{L}_i(z^t, \Theta_s^t, \Theta_i)$ . + +Using the first-order Taylor approximation of $\mathcal{L}_k$ for $\Theta_s^t$ , we obtain: + +$$ +\begin{array}{l} \mathcal {L} _ {k} \left(z ^ {t}, \Theta_ {s \mid i, k} ^ {t + 1}, \Theta_ {k} ^ {t}\right) = \mathcal {L} _ {k} \left(z ^ {t}, \Theta_ {s} ^ {t}, \Theta_ {k} ^ {t}\right) + \left(\Theta_ {s \mid i, k} ^ {t + 1} - \Theta_ {s} ^ {t}\right) \nabla_ {\Theta_ {s} ^ {t}} \mathcal {L} _ {k} \left(z ^ {t}, \Theta_ {s} ^ {t}, \Theta_ {k} ^ {t}\right) + O \left(\eta^ {2}\right) (19) \\ = \mathcal {L} _ {k} \left(z ^ {t}, \Theta_ {s} ^ {t}, \Theta_ {k} ^ {t}\right) - \eta \left(g _ {i} + g _ {k}\right) \cdot g _ {k} + O \left(\eta^ {2}\right) (20) \\ \end{array} +$$ + +For task $j$ , we can follow a similar process as follows: + +$$ +\mathcal {L} _ {k} \left(z ^ {t}, \Theta_ {s | j, k} ^ {t + 1}, \Theta_ {k} ^ {t}\right) = \mathcal {L} _ {k} \left(z ^ {t}, \Theta_ {s} ^ {t}, \Theta_ {k} ^ {t}\right) - \eta \left(g _ {j} + g _ {k}\right) \cdot g _ {k} + O \left(\eta^ {2}\right) \tag {21} +$$ + +With a sufficiently small learning rate $\eta \ll 1$ , subtract eq. (21) from eq. (20), then: + +$$ +\begin{array}{l} \mathcal {L} _ {k} \left(z ^ {t}, \Theta_ {s | i, k} ^ {t + 1}, \Theta_ {k} ^ {t}\right) - \mathcal {L} _ {k} \left(z ^ {t}, \Theta_ {s | j, k} ^ {t + 1}, \Theta_ {k} ^ {t}\right) = - \eta \left(g _ {i} + g _ {k}\right) \cdot g _ {k} + \eta \left(g _ {j} + g _ {k}\right) \cdot g _ {k} (22) \\ = - \eta \left(g _ {i} - g _ {j}\right) \cdot g _ {k} \leq 0 (23) \\ \end{array} +$$ + +which proves the results. + +The result indicates that when the gradients $g_{i}$ from task $i$ align better with those of the reference task $k$ compared to task $j$ , the loss on the reference task $k$ tends to be lower with updated gradients $g_{i} + g_{k}$ compared to $g_{j} + g_{k}$ , especially for sufficiently small learning rates $\eta$ . + +# A.4 PROOF OF THEOREM 3 + +Theorem 3. The affinity between $\{i,k\} \to k$ and $i\rightarrow k$ satisfies $\mathcal{A}_{i,k\to k}^t\geq \mathcal{A}_{i\to k}^t$ + +Proof. Let's begin with the definition of inter-task affinity between $\{i,j\} \to k$ and $i\rightarrow k$ as follows: + +$$ +\mathcal {A} _ {i, k \rightarrow k} ^ {t} = 1 - \frac {\mathcal {L} _ {k} \left(z ^ {t} , \Theta_ {s | i , k} ^ {t + 1} , \Theta_ {k} ^ {t}\right)}{\mathcal {L} _ {k} \left(z ^ {t} , \Theta_ {s} ^ {t} , \Theta_ {k} ^ {t}\right)} \quad \mathcal {A} _ {i \rightarrow k} ^ {t} = 1 - \frac {\mathcal {L} _ {k} \left(z ^ {t} , \Theta_ {s | i} ^ {t + 1} , \Theta_ {k} ^ {t}\right)}{\mathcal {L} _ {k} \left(z ^ {t} , \Theta_ {s} ^ {t} , \Theta_ {k} ^ {t}\right)} \tag {24} +$$ + +When updating $i$ and $k$ simultaneously, we can derive the first-order Taylor approximation of $\mathcal{L}_k$ for $\Theta_s^t$ as follows: + +$$ +\begin{array}{l} \mathcal {L} _ {k} \left(z ^ {t}, \Theta_ {s \mid i, k} ^ {t + 1}, \Theta_ {k} ^ {t}\right) = \mathcal {L} _ {k} \left(z ^ {t}, \Theta_ {s} ^ {t}, \Theta_ {k} ^ {t}\right) + \left(\Theta_ {s \mid i, k} ^ {t + 1} - \Theta_ {s} ^ {t}\right) \nabla_ {\Theta_ {s} ^ {t}} \mathcal {L} _ {k} \left(z ^ {t}, \Theta_ {s} ^ {t}, \Theta_ {k} ^ {t}\right) + O \left(\eta^ {2}\right) (25) \\ = \mathcal {L} _ {k} \left(z ^ {t}, \Theta_ {s} ^ {t}, \Theta_ {k} ^ {t}\right) - \eta \left(g _ {i} + g _ {k}\right) \cdot g _ {k} + O \left(\eta^ {2}\right) (26) \\ \end{array} +$$ + +Similarly, when updating $i$ alone, the first-order Taylor approximation of $\mathcal{L}_k$ for $\Theta_s^t$ is as follows: + +$$ +\begin{array}{l} \mathcal {L} _ {k} \left(z ^ {t}, \Theta_ {s | i} ^ {t + 1}, \Theta_ {k} ^ {t}\right) = \mathcal {L} _ {k} \left(z ^ {t}, \Theta_ {s} ^ {t}, \Theta_ {k} ^ {t}\right) + \left(\Theta_ {s | i} ^ {t + 1} - \Theta_ {s} ^ {t}\right) \nabla_ {\Theta_ {s} ^ {t}} \mathcal {L} _ {k} \left(z ^ {t}, \Theta_ {s} ^ {t}, \Theta_ {k} ^ {t}\right) + O \left(\eta^ {2}\right) (27) \\ = \mathcal {L} _ {k} \left(z ^ {t}, \Theta_ {s} ^ {t}, \Theta_ {k} ^ {t}\right) - \eta g _ {i} \cdot g _ {k} + O \left(\eta^ {2}\right) (28) \\ \end{array} +$$ + +With a sufficiently small learning rate $\eta$ , the difference between the two inter-task affinities in eq. (24) can be expressed as follows: + +$$ +\begin{array}{l} \mathcal {A} _ {i, k \rightarrow k} ^ {t} - \mathcal {A} _ {i \rightarrow k} ^ {t} = 1 - \frac {\mathcal {L} _ {k} \left(z ^ {t} , \Theta_ {s | z , k} ^ {t + 1} , \Theta_ {k} ^ {t}\right)}{\mathcal {L} _ {k} \left(z ^ {t} , \Theta_ {s} ^ {t} , \Theta_ {k} ^ {t}\right)} - \left(1 - \frac {\mathcal {L} _ {k} \left(z ^ {t} , \Theta_ {s | i} ^ {t + 1} , \Theta_ {k} ^ {t}\right)}{\mathcal {L} _ {k} \left(z ^ {t} , \Theta_ {s} ^ {t} , \Theta_ {k} ^ {t}\right)}\right) (29) \\ = \frac {\mathcal {L} _ {k} \left(z ^ {t} , \Theta_ {s \mid i} ^ {t + 1} , \Theta_ {k} ^ {t}\right) - \mathcal {L} _ {k} \left(z ^ {t} , \Theta_ {s \mid i , k} ^ {t + 1} , \Theta_ {k} ^ {t}\right)}{\mathcal {L} _ {k} \left(z ^ {t} , \Theta_ {s} ^ {t} , \Theta_ {k} ^ {t}\right)} (30) \\ = \frac {\mathcal {L} _ {k} \left(z ^ {t} , \Theta_ {s} ^ {t} , \Theta_ {k} ^ {t}\right) - \eta g _ {i} \cdot g _ {k} - \left(\mathcal {L} _ {k} \left(z ^ {t} , \Theta_ {s} ^ {t} , \Theta_ {k} ^ {t}\right) - \eta \left(g _ {i} + g _ {k}\right) \cdot g _ {k}\right)}{\mathcal {L} _ {k} \left(z ^ {t} , \Theta_ {s} ^ {t} , \Theta_ {k} ^ {t}\right)} (31) \\ = \frac {\eta \left\| g _ {k} \right\| ^ {2}}{\mathcal {L} _ {k} \left(z ^ {t} , \Theta_ {s} ^ {t} , \Theta_ {k} ^ {t}\right)} (32) \\ \geq 0 (33) \\ \end{array} +$$ + +The inequality in eq. (33) proves that $\mathcal{A}_{i,k\to k}^t\geq \mathcal{A}_{i\to k}^t$ + +When tasks $i$ and $k$ are within the same task group, we can access $\mathcal{B}_{i,k\to k}^{t}$ during the optimization process. If $\mathcal{B}_{i,k\to k}^{t}\leq 0$ , the inter-task affinity also satisfies $\mathcal{A}_{i,k\to k}^{t}\leq 0$ as $\mathcal{A}_{i,k\to k}^{t}\leq \mathcal{B}_{i,k\to k}^{t}$ . According to Theorem 3, this condition implies $\mathcal{A}_{i\to k}^{t}\leq 0$ . The proposed algorithm separates these tasks into different groups when $\mathcal{B}_{i,k\to k}^{t}\leq 0$ which justifies our grouping rules. + +Conversely, when tasks $i$ and $j$ belong to separate task groups, we only have access to $\mathcal{B}_{i\rightarrow k}^{t}$ instead of $\mathcal{B}_{i,k\rightarrow k}^{t}$ . In this scenario, the proposed algorithm merges these tasks into the same group if $\mathcal{B}_{i\rightarrow k}^{t} = \mathcal{A}_{i\rightarrow k}^{t}\geq 0$ . This inequality also implies $\mathcal{A}_{i,k\rightarrow k}^{t}\geq 0$ , justifying the merging of tasks $i$ and $k$ based on $\mathcal{B}_{i\rightarrow k}^{t}$ during optimization. + +# A.5 PROOF OF THEOREM 4 + +Theorem 4 (Convergence Analysis). Given a set of differentiable losses $\{\mathcal{L}_i\}_{i=1}^{\mathcal{K}}$ and Lipschitz continuous gradients with a constant $H > 0$ , $\|\nabla \mathcal{L}_i(x) - \nabla \mathcal{L}_i(y)\| \leq H\|x - y\|$ for all $i = 1,2,\ldots,\mathcal{K}$ . If we sequentially update task groups $\{G_i\}_{i=1}^{\mathcal{M}}$ based on inter-task affinity, employing a sufficiently small step size $\eta \leq \min\left(\frac{2}{H\mathcal{K}}, \frac{1}{H|G_m|}\right)$ where $|G_m|$ is the number of tasks in $G_m$ , then the following inequalities are satisfied for any task group $G_m$ . + +$$ +\begin{array}{l} \sum_ {k = 1} ^ {\mathcal {M}} \mathcal {L} _ {G _ {k}} \left(z ^ {t}, \Theta_ {s | G _ {m}} ^ {t + m / \mathcal {M}}, \Theta_ {G _ {k}} ^ {t + 1}\right) \leq \sum_ {k = 1} ^ {\mathcal {M}} \mathcal {L} _ {G _ {k}} \left(z ^ {t}, \Theta_ {s | G _ {m}} ^ {t + (m - 1) / \mathcal {M}}, \Theta_ {G _ {k}} ^ {t}\right) (6) \\ - \eta g _ {s, G _ {m}} ^ {t + (m - 1) / \mathcal {M}} \cdot \left(\sum_ {k = 1} ^ {\mathcal {M}} g _ {s, G _ {k}} ^ {t + (m - 1) / \mathcal {M}} - g _ {s, G _ {m}} ^ {t + (m - 1) / \mathcal {M}}\right) - \frac {\eta}{2} \| g _ {t s, G _ {m}} ^ {t} \| ^ {2} (7) \\ \end{array} +$$ + +Let's represent the sum of losses of tasks included in $G_{m}$ as $\mathcal{L}_{G_m}$ , defined as follows: + +$$ +\mathcal {L} _ {G _ {m}} \left(z ^ {t}, \Theta_ {s | G _ {m}} ^ {t + m / \mathcal {M}}, \Theta_ {G _ {m}} ^ {t + m / \mathcal {M}}\right) = \sum_ {k \in G _ {m}} \mathcal {L} _ {k} \left(z ^ {t}, \Theta_ {s | G _ {m}} ^ {t + m / \mathcal {M}}, \Theta_ {k} ^ {t + m / \mathcal {M}}\right) \tag {34} +$$ + +where $\Theta_{s|G_m}^{t + m / \mathcal{M}}$ denotes the shared parameters, while $\Theta_{G_m}^{t + m / \mathcal{M}}$ represents the set of task-specific parameters within $G_{m}$ after updating tasks in $G_{m}$ . + +We begin by expanding the task-specific loss $\mathcal{L}_{G_m}$ in terms of the shared parameter $\Theta_{s|G_m}^{t + m / \mathcal{M}}$ and the task-specific parameters $\Theta_{G_m}^{t + m / \mathcal{M}}$ using a quadratic expansion. During this process, the task-specific parameters $\Theta_{G_m}^{t + (m - 1) / \mathcal{M}} = \Theta_{G_m}^t$ and $\Theta_{G_m}^{t + m / \mathcal{M}} = \Theta_{G_m}^{t + 1}$ , since the task-specific parameters in $G_{m}$ are updated only once from $\Theta_{G_m}^{t + (m - 1) / \mathcal{M}}$ to $\Theta_{G_m}^{t + m / \mathcal{M}}$ . + +$$ +\begin{array}{l} \mathcal {L} _ {G _ {m}} \left(z ^ {t}, \Theta_ {s \mid G _ {m}} ^ {t + m / \mathcal {M}}, \Theta_ {G _ {m}} ^ {t + 1}\right) \leq \mathcal {L} _ {G _ {m}} \left(z ^ {t}, \Theta_ {s \mid G _ {m - 1}} ^ {t + (m - 1) / \mathcal {M}}, \Theta_ {G _ {m}} ^ {t}\right) (35) \\ + \nabla_ {\Theta_ {s | G _ {m - 1}} ^ {t + (m - 1) / \mathcal {M}}} \mathcal {L} _ {G _ {m}} \left(z ^ {t}, \Theta_ {s | G _ {m - 1}} ^ {t + (m - 1) / \mathcal {M}}, \Theta_ {G _ {m}} ^ {t}\right) \left(\Theta_ {s | G _ {m}} ^ {t + m / \mathcal {M}} - \Theta_ {s | G _ {m - 1}} ^ {t + (m - 1) / \mathcal {M}}\right) (36) \\ + \frac {1}{2} \nabla_ {\Theta_ {s | G _ {m - 1}} ^ {t + (m - 1) / \mathcal {M}}} ^ {2} \mathcal {L} _ {G _ {m}} \left(z ^ {t}, \Theta_ {s | G _ {m - 1}} ^ {t + (m - 1) / \mathcal {M}}, \Theta_ {G _ {m}} ^ {t}\right) \left(\Theta_ {s | G _ {m}} ^ {t + m / \mathcal {M}} - \Theta_ {s | G _ {m}} ^ {t + (m - 1) / \mathcal {M}}\right) ^ {2} (37) \\ + \nabla_ {\Theta_ {G _ {m}} ^ {t}} \mathcal {L} _ {G _ {m}} \left(z ^ {t}, \Theta_ {s | G _ {m - 1}} ^ {t + (m - 1) / \mathcal {M}}, \Theta_ {G _ {m}} ^ {t}\right) \left(\Theta_ {G _ {m}} ^ {t + 1} - \Theta_ {G _ {m}} ^ {t}\right) (38) \\ + \frac {1}{2} \nabla_ {\Theta_ {G _ {m}} ^ {t}} ^ {2} \mathcal {L} _ {G _ {m}} \left(z ^ {t}, \Theta_ {s | G _ {m - 1}} ^ {t + (m - 1) / \mathcal {M}}, \Theta_ {G _ {m}} ^ {t}\right) \left(\Theta_ {G _ {m}} ^ {t + 1} - \Theta_ {G _ {m}} ^ {t}\right) ^ {2} (39) \\ \leq \mathcal {L} _ {G _ {m}} \left(z ^ {t}, \Theta_ {s | G _ {m}} ^ {t + (m - 1) / \mathcal {M}}, \Theta_ {G _ {m}} ^ {t}\right) (40) \\ + \nabla_ {\Theta_ {s | G _ {m - 1}} ^ {t + (m - 1) / \mathcal {M}}} \mathcal {L} _ {k} \left(z ^ {t}, \Theta_ {s | G _ {m - 1}} ^ {t + (m - 1) / \mathcal {M}}, \Theta_ {G _ {m}} ^ {t}\right) \left(\Theta_ {s | G _ {m}} ^ {t + m / \mathcal {M}} - \Theta_ {s | G _ {m - 1}} ^ {t + (m - 1) / \mathcal {M}}\right) (41) \\ + \frac {1}{2} H \left| G _ {m} \right| \left(\Theta_ {s \mid G _ {m}} ^ {t + m / \mathcal {M}} - \Theta_ {s \mid G _ {m - 1}} ^ {t + (m - 1) / \mathcal {M}}\right) ^ {2} (42) \\ + \nabla_ {\Theta_ {G _ {m}} ^ {t}} \mathcal {L} _ {G _ {m}} \left(z ^ {t}, \Theta_ {s | G _ {m - 1}} ^ {t + (m - 1) / \mathcal {M}}, \Theta_ {G _ {m}} ^ {t}\right) \left(\Theta_ {G _ {m}} ^ {t + 1} - \Theta_ {G _ {m}} ^ {t}\right) (43) \\ + \frac {1}{2} H \left| G _ {m} \right| \left(\Theta_ {G _ {m}} ^ {t + 1} - \Theta_ {G _ {m}} ^ {t}\right) ^ {2} (44) \\ \end{array} +$$ + +where $|G_m|$ represents the number of tasks in $G_{m}$ . The inequality holds with the Lipschitz continuity of $\nabla \mathcal{L}$ with a constant $H$ . + +For the shared parameters of the network, the update rule is as follows: + +$$ +\begin{array}{l} \Theta_ {s \mid G _ {m}} ^ {t + m / \mathcal {M}} = \Theta_ {s \mid G _ {m - 1}} ^ {t + (m - 1) / \mathcal {M}} - \eta \nabla_ {\Theta_ {s \mid G _ {m - 1}} ^ {t + (m - 1) / \mathcal {M}}} \mathcal {L} _ {G _ {m}} \left(z ^ {t}, \Theta_ {s \mid G _ {m - 1}} ^ {t + (m - 1) / \mathcal {M}}, \Theta_ {G _ {m}} ^ {t}\right) (45) \\ = \Theta_ {s | G _ {m - 1}} ^ {t + (m - 1) / \mathcal {M}} - \eta g _ {s, G _ {m}} ^ {t + (m - 1) / \mathcal {M}} (46) \\ \end{array} +$$ + +where $g_{s,G_m}^{t + (m - 1) / \mathcal{M}}$ is the gradients of the shared parameters with respect to loss of tasks in $G_{m}$ . Similarly, the task-specific parameters of the network, the update rule is as follows: + +$$ +\Theta_ {G _ {m}} ^ {t + 1} = \Theta_ {G _ {m}} ^ {t} - \eta \nabla_ {\Theta_ {G _ {m}} ^ {t}} \mathcal {L} _ {G _ {m}} (z ^ {t}, \Theta_ {s | G _ {m - 1}} ^ {t + (m - 1) / \mathcal {M}}, \Theta_ {G _ {m}} ^ {t}) = \Theta_ {G _ {m}} ^ {t} - \eta g _ {t s, G _ {m}} ^ {t} \tag {47} +$$ + +where $g_{ts,G_m}^t$ is the gradients of the task-specific parameters with respect to the loss of tasks in $G_m$ . If we substitute eq. (46) and eq. (47) into the result of eq. (35), it becomes as follows: + +$$ +\begin{array}{l} \mathcal {L} _ {G _ {m}} \left(z ^ {t}, \Theta_ {s | G _ {m}} ^ {t + m / \mathcal {M}}, \Theta_ {G _ {m}} ^ {t + 1}\right) \leq \mathcal {L} _ {G _ {m}} \left(z ^ {t}, \Theta_ {s | G _ {m - 1}} ^ {t + (m - 1) / \mathcal {M}}, \Theta_ {G _ {m}} ^ {t}\right) (48) \\ - \eta | | g _ {s, G _ {m}} ^ {t + (m - 1) / \mathcal {M}} | | ^ {2} + \frac {\eta^ {2} H | G _ {m} |}{2} | | g _ {s, G _ {m}} ^ {t + (m - 1) / \mathcal {M}} | | ^ {2} (49) \\ - \eta | | g _ {t s, G _ {m}} ^ {t} | | ^ {2} + \frac {\eta^ {2} H | G _ {m} |}{2} | | g _ {t s, G _ {m}} ^ {t} | | ^ {2} (50) \\ \end{array} +$$ + +We can derive similar results for the loss of task group $G_{i}$ , where the index $i$ is not the same as the updating group sequence $m$ ( $i \neq m$ ). This process follows similarly to the one described above. For the step from $t + (m - 1) / \mathcal{M}$ to $t + m / \mathcal{M}$ , the task-specific parameters in $G_{i}$ remain unchanged. + +$$ +\begin{array}{l} \mathcal {L} _ {G _ {i}} \left(z ^ {t}, \Theta_ {s \mid G _ {m}} ^ {t + m / \mathcal {M}}, \Theta_ {G _ {i}} ^ {t}\right) \leq \mathcal {L} _ {G _ {i}} \left(z ^ {t}, \Theta_ {s \mid G _ {m - 1}} ^ {t + (m - 1) / \mathcal {M}}, \Theta_ {G _ {i}} ^ {t}\right) (51) \\ + \nabla_ {\Theta_ {s | G _ {m - 1}} ^ {t + (m - 1) / \mathcal {M}}} \mathcal {L} _ {G _ {i}} \left(z ^ {t}, \Theta_ {s | G _ {m - 1}} ^ {t + (m - 1) / \mathcal {M}}, \Theta_ {G _ {i}} ^ {t}\right) \left(\Theta_ {s | G _ {m}} ^ {t + m / \mathcal {M}} - \Theta_ {s | G _ {m - 1}} ^ {t + (m - 1) / \mathcal {M}}\right) (52) \\ + \frac {1}{2} \nabla_ {\Theta_ {s | G _ {m - 1}} ^ {t + (m - 1) / \mathcal {M}}} ^ {2} \mathcal {L} _ {G _ {i}} \left(z ^ {t}, \Theta_ {s | G _ {m - 1}} ^ {t + (m - 1) / \mathcal {M}}, \Theta_ {G _ {i}} ^ {t}\right) \left(\Theta_ {s | G _ {m}} ^ {t + m / \mathcal {M}} - \Theta_ {s | G _ {m}} ^ {t + (m - 1) / \mathcal {M}}\right) ^ {2} (53) \\ \leq \mathcal {L} _ {G _ {i}} \left(z ^ {t}, \Theta_ {s | G _ {m}} ^ {t + (m - 1) / \mathcal {M}}, \Theta_ {G _ {i}} ^ {t}\right) (54) \\ + \nabla_ {\Theta_ {s | G _ {m - 1}} ^ {t + (m - 1) / \mathcal {M}}} \mathcal {L} _ {G _ {i}} \left(z ^ {t}, \Theta_ {s | G _ {m - 1}} ^ {t + (m - 1) / \mathcal {M}}, \Theta_ {G _ {i}} ^ {t}\right) \left(\Theta_ {s | G _ {m}} ^ {t + m / \mathcal {M}} - \Theta_ {s | G _ {m - 1}} ^ {t + (m - 1) / \mathcal {M}}\right) (55) \\ + \frac {1}{2} H \left| G _ {i} \right| \left(\Theta_ {s \mid G _ {m}} ^ {t + m / \mathcal {M}} - \Theta_ {s \mid G _ {m - 1}} ^ {t + (m - 1) / \mathcal {M}}\right) ^ {2} (56) \\ \leq \mathcal {L} _ {G _ {i}} \left(z ^ {t}, \Theta_ {s \mid G _ {m}} ^ {t + (m - 1) / \mathcal {M}}, \Theta_ {G _ {i}} ^ {t}\right) (57) \\ - \eta g _ {s, G _ {i}} ^ {t + (m - 1) / \mathcal {M}} \cdot g _ {s, G _ {m}} ^ {t + (m - 1) / \mathcal {M}} + \frac {\eta^ {2} H | G _ {i} |}{2} \| g _ {s, G _ {m}} ^ {t + (m - 1) / \mathcal {M}} \| ^ {2} (58) \\ \end{array} +$$ + +Then the total loss of multiple task groups can be expressed as follows: + +$$ +\begin{array}{l} \sum_ {k = 1} ^ {\mathcal {M}} \mathcal {L} _ {G _ {k}} \left(z ^ {t}, \Theta_ {s | G _ {m}} ^ {t + m / \mathcal {M}}, \Theta_ {G _ {k}} ^ {t + 1}\right) \leq \sum_ {k = 1} ^ {\mathcal {M}} \mathcal {L} _ {G _ {k}} \left(z ^ {t}, \Theta_ {s | G _ {m}} ^ {t + (m - 1) / \mathcal {M}}, \Theta_ {G _ {k}} ^ {t}\right) (60) \\ - \eta \sum_ {k = 1} ^ {\mathcal {M}} g _ {s, G _ {k}} ^ {t + (m - 1) / \mathcal {M}} \cdot g _ {s, G _ {m}} ^ {t + (m - 1) / \mathcal {M}} + \frac {\eta^ {2} H}{2} | | g _ {s, G _ {m}} ^ {t + (m - 1) / \mathcal {M}} | | ^ {2} \sum_ {k = 1} ^ {\mathcal {M}} | G _ {k} | (61) \\ - \eta | | g _ {t s, G _ {m}} ^ {t} | | ^ {2} + \frac {\eta^ {2} H | G _ {m} |}{2} | | g _ {t s, G _ {m}} ^ {t} | | ^ {2} (62) \\ \leq \sum_ {k = 1} ^ {\mathcal {M}} \mathcal {L} _ {G _ {k}} \left(z ^ {t}, \Theta_ {s | G _ {m}} ^ {t + (m - 1) / \mathcal {M}}, \Theta_ {G _ {k}} ^ {t}\right) (63) \\ - \eta \sum_ {k = 1} ^ {\mathcal {M}} g _ {s, G _ {k}} ^ {t + (m - 1) / \mathcal {M}} \cdot g _ {s, G _ {m}} ^ {t + (m - 1) / \mathcal {M}} + \eta | | g _ {s, G _ {m}} ^ {t + (m - 1) / \mathcal {M}} | | ^ {2} - \frac {\eta}{2} | | g _ {t s, G _ {m}} ^ {t} | | ^ {2} (64) \\ = \sum_ {k = 1} ^ {\mathcal {M}} \mathcal {L} _ {G _ {k}} \left(z ^ {t}, \Theta_ {s \mid G _ {m}} ^ {t + (m - 1) / \mathcal {M}}, \Theta_ {G _ {k}} ^ {t}\right) (65) \\ - \eta g _ {s, G _ {m}} ^ {t + (m - 1) / \mathcal {M}} \cdot \left(\sum_ {k = 1} ^ {\mathcal {M}} g _ {s, G _ {k}} ^ {t + (m - 1) / \mathcal {M}} - g _ {s, G _ {m}} ^ {t + (m - 1) / \mathcal {M}}\right) - \frac {\eta}{2} \| g _ {t s, G _ {m}} ^ {t} \| ^ {2} (66) \\ \end{array} +$$ + +The inequality between eq. (61) and the first term in eq. (64) requires $\eta \leq \frac{2}{H \cdot \sum_{k=1}^{M} |G_k|} = \frac{2}{HK}$ , while the inequality between eq. (62) and the second term in eq. (64) requires $\eta \leq \frac{1}{H |G_M|}$ . Therefore, the inequality in eq. (63) holds when $\eta \leq \min\left(\frac{2}{HK}, \frac{1}{H |G_M|}\right)$ . Previous approaches, which handle updates of shared and task-specific parameters independently, failing to capture their interdependence during optimization. The term, $g_{s,G_m}^{t+(m-1)/\mathcal{M}} \cdot \left(\sum_{k=1}^{\mathcal{M}} g_{s,G_k}^{t+(m-1)/\mathcal{M}}\right)$ , fluctuates during optimization. When the gradients of group $G_m$ align well with the gradients of the other groups $\{G_k\}_{i=1,i \neq m}$ , their dot product yields a positive value, leading to a decrease in multi-task losses. However, in practice, the sequential update strategy demonstrates a similar level of stability in optimization, which appears to contradict the conventional results. Thus, we assume a correlation between the learning of shared parameters and task-specific parameters, where the learning of task-specific parameters reduces gradient conflicts in shared parameters. Under this assumption, the sequential update strategy can guarantee convergence to Pareto-stationary points. This assumption is reasonable, as task-specific parameters capture task-specific information, thereby reducing conflicts in the shared parameters across tasks. + +# A.6 TWO-STEP PROXIMAL INTER-TASK AFFINITY + +Before delving into the proof of Theorem 5, let's introduce the concept of two-step proximal inter-task affinity, which extends the notion of proximal inter-task affinity over two update steps. + +Definition 4 (Two-Step Proximal Inter-Task Affinity). Consider a multi-task network shared by the tasks $i, j, k$ , with their respective losses denoted as $\mathcal{L}_i, \mathcal{L}_j, \mathcal{L}_k$ . Sequential updates of $(\{j\}, \{i, k\})$ result in parameters being updated from $\Theta_s^t \to \Theta_{s|j}^{t+1} \to \Theta_{s|i,k}^{t+2}$ and $\Theta_k^t \to \Theta_k^{t+1} \to \Theta_k^{t+2}$ . Then, the two-step proximal inter-task affinity from sequential update $(\{j\}, \{i, k\})$ to $k$ at time step $t$ is defined as follows: + +$$ +\begin{array}{l} \mathcal {B} _ {j; i, k \rightarrow k} ^ {t} = 1 - \left(1 - \mathcal {B} _ {j \rightarrow k} ^ {t}\right)\left(1 - \mathcal {B} _ {i, k \rightarrow k} ^ {t + 1}\right) \tag {67} \\ = 1 - \frac {\mathcal {L} _ {k} \left(z ^ {t} , \Theta_ {s | j} ^ {t + 1} , \Theta_ {k} ^ {t + 1}\right)}{\mathcal {L} _ {k} \left(z ^ {t} , \Theta_ {s} ^ {t} , \Theta_ {k} ^ {t}\right)} \cdot \frac {\mathcal {L} _ {k} \left(z ^ {t} , \Theta_ {s | i , k} ^ {t + 2} , \Theta_ {k} ^ {t + 2}\right)}{\mathcal {L} _ {k} \left(z ^ {t} , \Theta_ {s | j} ^ {t + 1} , \Theta_ {k} ^ {t + 1}\right)} = 1 - \frac {\mathcal {L} _ {k} \left(z ^ {t} , \Theta_ {s | i , k} ^ {t + 2} , \Theta_ {k} ^ {t + 2}\right)}{\mathcal {L} _ {k} \left(z ^ {t} , \Theta_ {s} ^ {t} , \Theta_ {k} ^ {t}\right)} (6 8) \\ \end{array} +$$ + +# A.7 PROOF OF THEOREM 5 + +Theorem 5. Consider three tasks $\{i,j,k\}$ , where task groups are formed with positive inter-task affinity as $\{i,k\}$ and $\{j\}$ . Assume all losses are convex and differentiable, and the change in affinity + +during a single step from $t + (m - 1) / \mathcal{M}$ to $t + m / \mathcal{M}$ is negligible. The affinity, which learns all tasks jointly, is denoted as $\mathcal{B}_{i,j,k\to k}^{t + (m - 1) / \mathcal{M}}$ . The affinity for the updating sequence $(\{i,k\}, \{j\})$ is represented as $\mathcal{B}_{i,k;j\to k}^{t + (m - 1) / \mathcal{M}}$ , while for the sequence $(\{j\}, \{i,k\})$ , it is represented as $\mathcal{B}_{j;i,k\to k}^{t + (m - 1) / \mathcal{M}}$ . Then, for a sufficiently small learning rate $\eta \ll 1$ , the following holds: + +$$ +\mathcal {B} _ {i, j, k \rightarrow k} ^ {t + (m - 1) / \mathcal {M}} \simeq \mathcal {B} _ {i, k; j \rightarrow k} ^ {t + (m - 1) / \mathcal {M}} \quad \mathcal {B} _ {i, j, k \rightarrow k} ^ {t + (m - 1) / \mathcal {M}} \leq \mathcal {B} _ {j; i, k \rightarrow k} ^ {t + (m - 1) / \mathcal {M}} \tag {8} +$$ + +Proof. We compare the loss after jointly updating three tasks $\{i,j,k\}$ with the loss after sequentially updating the task sets $\{i,k\}$ and $\{j\}$ . To assess the impact of the updating order of task sets, we also conduct the analysis on the reverse order of task set $\{j\}, \{i,k\}$ . + +(i) Let's begin with the definition of proximal inter-task affinity between $\{i,k\} \to k$ and $j\rightarrow k$ taking into account the updates of task-specific parameters as follows: + +$$ +\mathcal {B} _ {i, j, k \rightarrow k} ^ {t + (m - 1) / \mathcal {M}} = 1 - \frac {\mathcal {L} _ {k} \left(z ^ {t} , \Theta_ {s | i , j , k} ^ {t + m / \mathcal {M}} , \Theta_ {k} ^ {t + m / \mathcal {M}}\right)}{\mathcal {L} _ {k} \left(z ^ {t} , \Theta_ {s} ^ {t + (m - 1) / \mathcal {M}} , \Theta_ {k} ^ {t + (m - 1) / \mathcal {M}}\right)} \tag {69} +$$ + +$$ +\mathcal {B} _ {i, k \rightarrow k} ^ {t + (m - 1) / \mathcal {M}} = 1 - \frac {\mathcal {L} _ {k} \left(z ^ {t} , \Theta_ {s | i , k} ^ {t + m / \mathcal {M}} , \hat {\Theta} _ {k} ^ {t + m / \mathcal {M}}\right)}{\mathcal {L} _ {k} \left(z ^ {t} , \Theta_ {s} ^ {t + (m - 1) / \mathcal {M}} , \Theta_ {k} ^ {t + (m - 1) / \mathcal {M}}\right)} \tag {70} +$$ + +$$ +\begin{array}{l} \mathcal {B} _ {j \rightarrow k} ^ {t + m / \mathcal {M}} = 1 - \frac {\mathcal {L} _ {k} \left(z ^ {t} , \Theta_ {s | j} ^ {t + (m + 1) / \mathcal {M}} , \Theta_ {k} ^ {t + (m + 1) / \mathcal {M}}\right)}{\mathcal {L} _ {k} \left(z ^ {t} , \Theta_ {s | i , k} ^ {t + m / \mathcal {M}} , \hat {\Theta} _ {k} ^ {t + m / \mathcal {M}}\right)} (71) \\ = 1 - \frac {\mathcal {L} _ {k} \left(z ^ {t} , \Theta_ {s | j} ^ {t + (m + 1) / \mathcal {M}} , \hat {\Theta} _ {k} ^ {t + m / \mathcal {M}}\right)}{\mathcal {L} _ {k} \left(z ^ {t} , \Theta_ {s | i , k} ^ {t + m / \mathcal {M}} , \hat {\Theta} _ {k} ^ {t + m / \mathcal {M}}\right)} (72) \\ \end{array} +$$ + +where $\hat{\Theta}_k^{t + m / \mathcal{M}}$ represents the resulting task-specific parameters of $k$ immediately after updating the task set $\{i,j\}$ . This notation is used to differentiate it from the task-specific parameter $\Theta_k^{t + m / \mathcal{M}}$ obtained after jointly updating all tasks. + +The two-step proximal inter-task affinity with the sequence $\{i,k\}$ and $\{j\}$ can be represented as follows: + +$$ +\begin{array}{l} \mathcal {B} _ {i, k; j \rightarrow k} ^ {t + (m - 1) / \mathcal {M}} = 1 - \left(1 - \mathcal {B} _ {i, k \rightarrow k} ^ {t + (m - 1) / \mathcal {M}}\right) \cdot \left(1 - \mathcal {B} _ {j \rightarrow k} ^ {t + m / \mathcal {M}}\right) (73) \\ = 1 - \frac {\mathcal {L} _ {k} \left(z ^ {t} , \Theta_ {s | i , k} ^ {t + m / \mathcal {M}} , \hat {\Theta} _ {k} ^ {t + m / \mathcal {M}}\right)}{\mathcal {L} _ {k} \left(z ^ {t} , \Theta_ {s} ^ {t + (m - 1) / \mathcal {M}}, \Theta_ {k} ^ {t + (m - 1) / \mathcal {M}}\right)} \cdot \frac {\mathcal {L} _ {k} \left(z ^ {t} , \Theta_ {s | j} ^ {t + (m + 1) / \mathcal {M}} , \hat {\Theta} _ {k} ^ {t + m / \mathcal {M}}\right)}{\mathcal {L} _ {k} \left(z ^ {t} , \Theta_ {s | i , k} ^ {t + m / \mathcal {M}} , \hat {\Theta} _ {k} ^ {t + m / \mathcal {M}}\right)} (74) \\ = 1 - \frac {\mathcal {L} _ {k} \left(z ^ {t} , \Theta_ {s | j} ^ {t + (m + 1) / \mathcal {M}} , \hat {\Theta} _ {k} ^ {t + m / \mathcal {M}}\right)}{\mathcal {L} _ {k} \left(z ^ {t} , \Theta_ {s} ^ {t + (m - 1) / \mathcal {M}} , \Theta_ {k} ^ {t + (m - 1) / \mathcal {M}}\right)} (75) \\ \end{array} +$$ + +Our objective is to compare $\mathcal{B}_{i,j,k\to k}^{t + (m - 1) / \mathcal{M}}$ from eq. (69) with $\mathcal{B}_{i,k;j\to k}^{t + (m - 1) / \mathcal{M}}$ from eq. (75) to assess each update's effect on the final loss. Since both equations share a common denominator, we only need to compare the numerators of each equation. Using the first-order Taylor approximation of $\mathcal{L}_k(z^t,\Theta_{s|j}^{t + (m + 1) / \mathcal{M}},\hat{\Theta}_k^{t + m / \mathcal{M}})$ in eq. (75), we have: + +$$ +\begin{array}{l} \mathcal {L} _ {k} \left(z ^ {t}, \Theta_ {s | j} ^ {t + (m + 1) / \mathcal {M}}, \hat {\Theta} _ {k} ^ {t + m / \mathcal {M}}\right) = \mathcal {L} _ {k} \left(z ^ {t}, \Theta_ {s | i, k} ^ {t + m / \mathcal {M}}, \hat {\Theta} _ {k} ^ {t + m / \mathcal {M}}\right) (76) \\ + \left(\Theta_ {s | j} ^ {t + (m + 1) / \mathcal {M}} - \Theta_ {s | i, k} ^ {t + m / \mathcal {M}}\right) \nabla_ {\Theta_ {s | i, k} ^ {t + m / \mathcal {M}}} \mathcal {L} _ {k} \left(z ^ {t}, \Theta_ {s | i, k} ^ {t + m / \mathcal {M}}, \hat {\Theta} _ {k} ^ {t + m / \mathcal {M}}\right) + O (\eta^ {2}) (77) \\ = \mathcal {L} _ {k} \left(z ^ {t}, \Theta_ {s | i, k} ^ {t + m / \mathcal {M}}, \hat {\Theta} _ {k} ^ {t + m / \mathcal {M}}\right) - \eta g _ {s; j} ^ {t + m / \mathcal {M}} \cdot g _ {s; k} ^ {t + m / \mathcal {M}} + O \left(\eta^ {2}\right) (78) \\ \end{array} +$$ + +The subscript $s$ in gradients indicates that it represents the gradients of the shared parameters of the network. Conversely, we will use the subscript $ts$ for gradients of the task-specific network in the following derivation. Similarly, $\mathcal{L}_k(z^t,\Theta_{s|i,k}^{t + m / \mathcal{M}},\hat{\Theta}_k^{t + m / \mathcal{M}})$ in eq. (76) can also be further expanded using Taylor expansion as follows: + +$$ +\mathcal {L} _ {k} \left(z ^ {t}, \Theta_ {s | i, k} ^ {t + m / \mathcal {M}}, \hat {\Theta} _ {k} ^ {t + m / \mathcal {M}}\right) = \mathcal {L} _ {k} \left(z ^ {t}, \Theta_ {s} ^ {t + (m - 1) / \mathcal {M}}, \Theta_ {k} ^ {t + (m - 1) / \mathcal {M}}\right) \tag {79} +$$ + +$$ ++ \left(\Theta_ {s \mid i, k} ^ {t + m / \mathcal {M}} - \Theta_ {s} ^ {t + (m - 1) / \mathcal {M}}\right) \nabla_ {\Theta_ {s} ^ {t + (m - 1) / \mathcal {M}}} \mathcal {L} _ {k} \left(z ^ {t}, \Theta_ {s} ^ {t + (m - 1) / \mathcal {M}}, \Theta_ {k} ^ {t + (m - 1) / \mathcal {M}}\right) \tag {80} +$$ + +$$ ++ \left(\hat {\Theta} _ {k} ^ {t + m / \mathcal {M}} - \Theta_ {k} ^ {t + (m - 1) / \mathcal {M}}\right) \nabla_ {\Theta_ {k} ^ {t + (m - 1) / \mathcal {M}}} \mathcal {L} _ {k} \left(z ^ {t}, \Theta_ {s} ^ {t + (m - 1) / \mathcal {M}}, \Theta_ {k} ^ {t + (m - 1) / \mathcal {M}}\right) + O \left(\eta^ {2}\right) \tag {81} +$$ + +$$ += \mathcal {L} _ {k} \left(z ^ {t}, \Theta_ {s} ^ {t + (m - 1) / \mathcal {M}}, \Theta_ {k} ^ {t + (m - 1) / \mathcal {M}}\right) - \eta \left(g _ {s; i} ^ {t + (m - 1) / \mathcal {M}} + g _ {s; k} ^ {t + (m - 1) / \mathcal {M}}\right) \cdot g _ {s; k} ^ {t + (m - 1) / \mathcal {M}} \tag {82} +$$ + +$$ +- \eta g _ {t s; k} ^ {t + (m - 1) / \mathcal {M}} \cdot g _ {t s; k} ^ {t + (m - 1) / \mathcal {M}} + O \left(\eta^ {2}\right) \tag {83} +$$ + +By substituting eq. (76) with the results of eq. (82) and eq. (83), we can obtain the following results: + +$$ +\mathcal {L} _ {k} \left(z ^ {t}, \Theta_ {s | j} ^ {t + (m + 1) / \mathcal {M}}, \hat {\Theta} _ {k} ^ {t + m / \mathcal {M}}\right) = \mathcal {L} _ {k} \left(z ^ {t}, \Theta_ {s} ^ {t + (m - 1) / \mathcal {M}}, \Theta_ {k} ^ {t + (m - 1) / \mathcal {M}}\right) \tag {84} +$$ + +$$ +- \eta g _ {s; j} ^ {t + m / \mathcal {M}} \cdot g _ {s; k} ^ {t + m / \mathcal {M}} - \eta \left(g _ {s; i} ^ {t + (m - 1) / \mathcal {M}} + g _ {s; k} ^ {t + (m - 1) / \mathcal {M}}\right) \cdot g _ {s; k} ^ {t + (m - 1) / \mathcal {M}} \tag {85} +$$ + +$$ +- \eta g _ {t s; k} ^ {t + (m - 1) / \mathcal {M}} \cdot g _ {t s; k} ^ {t + (m - 1) / \mathcal {M}} + O \left(\eta^ {2}\right) \tag {86} +$$ + +For the scenario where all tasks $\{i,j,k\}$ are jointly updated, the numerator of eq. (69) can also be expanded as follows: + +$$ +\mathcal {L} _ {k} \left(z ^ {t}, \Theta_ {s | i, j, k} ^ {t + m / \mathcal {M}}, \Theta_ {k} ^ {t + m / \mathcal {M}}\right) = \mathcal {L} _ {k} \left(z ^ {t}, \Theta_ {s} ^ {t + (m - 1) / \mathcal {M}}, \Theta_ {k} ^ {t + (m - 1) / \mathcal {M}}\right) \tag {87} +$$ + +$$ ++ \left(\Theta_ {s \mid i, j, k} ^ {t + m / \mathcal {M}} - \Theta_ {s} ^ {t + (m - 1) / \mathcal {M}}\right) \nabla_ {\Theta_ {s} ^ {t + (m - 1) / \mathcal {M}}} \mathcal {L} _ {k} \left(z ^ {t}, \Theta_ {s} ^ {t + (m - 1) / \mathcal {M}}, \Theta_ {k} ^ {t + (m - 1) / \mathcal {M}}\right) \tag {88} +$$ + +$$ ++ \left(\Theta_ {k} ^ {t + m / \mathcal {M}} - \Theta_ {k} ^ {t + (m - 1) / \mathcal {M}}\right) \nabla_ {\Theta_ {k} ^ {t + (m - 1) / \mathcal {M}}} \mathcal {L} _ {k} \left(z ^ {t}, \Theta_ {s} ^ {t + (m - 1) / \mathcal {M}}, \Theta_ {k} ^ {t + (m - 1) / \mathcal {M}}\right) + O \left(\eta^ {2}\right) \tag {89} +$$ + +$$ += \mathcal {L} _ {k} \left(z ^ {t}, \Theta_ {s} ^ {t + (m - 1) / \mathcal {M}}, \Theta_ {k} ^ {t + (m - 1) / \mathcal {M}}\right) \tag {90} +$$ + +$$ +- \eta \left(g _ {s, i} ^ {t + (m - 1) / \mathcal {M}} + g _ {s, j} ^ {t + (m - 1) / \mathcal {M}} + g _ {s, k} ^ {t + (m - 1) / \mathcal {M}}\right) \cdot g _ {s, k} ^ {t + (m - 1) / \mathcal {M}} \tag {91} +$$ + +$$ +- \eta g _ {t s, k} ^ {t + (m - 1) / \mathcal {M}} \cdot g _ {t s, k} ^ {t + (m - 1) / \mathcal {M}} + O \left(\eta^ {2}\right) \tag {92} +$$ + +Finally, we can compare $\mathcal{B}_{i,j,k\to k}^{t + (m - 1) / \mathcal{M}}$ with $\mathcal{B}_{i,k;j\to k}^{t + (m - 1) / \mathcal{M}}$ by comparing the losses we obtained: $\mathcal{L}_k(z^t,\Theta_{s|j}^{t + (m + 1) / \mathcal{M}},\Theta_k^{t + (m - 1) / \mathcal{M}})$ with $\mathcal{L}_k(z^t,\Theta_{s|i,j,k}^{t + m / \mathcal{M}},\Theta_k^{t + (m - 1) / \mathcal{M}})$ . We assume a sufficiently small learning rate $\eta$ that allows us to ignore terms larger than order two with $\eta$ . + +$$ +\mathcal {L} _ {k} \left(z ^ {t}, \Theta_ {s | j} ^ {t + (m + 1) / \mathcal {M}}, \hat {\Theta} _ {k} ^ {t + m / \mathcal {M}}\right) - \mathcal {L} _ {k} \left(z ^ {t}, \Theta_ {s | i, j, k} ^ {t + m / \mathcal {M}}, \Theta_ {k} ^ {t + m / \mathcal {M}}\right) \tag {93} +$$ + +$$ += - \eta g _ {s, j} ^ {t + m / \mathcal {M}} \cdot g _ {s, k} ^ {t + m / \mathcal {M}} - \eta \left(g _ {s, i} ^ {t + (m - 1) / \mathcal {M}} + g _ {s, k} ^ {t + (m - 1) / \mathcal {M}}\right) \cdot g _ {s, k} ^ {t + (m - 1) / \mathcal {M}} \tag {94} +$$ + +$$ +- \eta g _ {t s, k} ^ {t + (m - 1) / \mathcal {M}} \cdot g _ {t s, k} ^ {t + (m - 1) / \mathcal {M}} \tag {95} +$$ + +$$ ++ \eta \left(g _ {s, i} ^ {t + (m - 1) / \mathcal {M}} + g _ {s, j} ^ {t + (m - 1) / \mathcal {M}} + g _ {s, k} ^ {t + (m - 1) / \mathcal {M}}\right) \cdot g _ {s, k} ^ {t + (m - 1) / \mathcal {M}} \tag {96} +$$ + +$$ ++ \eta g _ {t s, k} ^ {t + (m - 1) / \mathcal {M}} \cdot g _ {t s, k} ^ {t + (m - 1) / \mathcal {M}} \tag {97} +$$ + +$$ += \eta \left(g _ {s, j} ^ {t + (m - 1) / \mathcal {M}} \cdot g _ {s, k} ^ {t + (m - 1) / \mathcal {M}} - g _ {s, j} ^ {t + m / \mathcal {M}} \cdot g _ {s, k} ^ {t + m / \mathcal {M}}\right) \tag {98} +$$ + +$$ +\simeq 0 \tag {99} +$$ + +The approximation in eq. (99) holds as we assume inter-task affinity change during a single time step from $t + (m - 1) / \mathcal{M}$ to $t + m / \mathcal{M}$ is negligible. + +(ii) In case we update task groups in reverse order the results would differ with (i). Similarly, we begin with the definition of proximal inter-task affinity with reverse order between $j \to k$ and $\{i,j\} \to k$ as follows: + +$$ +\begin{array}{l} \mathcal {B} _ {j \rightarrow k} ^ {t + (m - 1) / \mathcal {M}} = 1 - \frac {\mathcal {L} _ {k} \left(z ^ {t} , \Theta_ {s | j} ^ {t + m / \mathcal {M}} , \Theta_ {k} ^ {t + m / \mathcal {M}}\right)}{\mathcal {L} _ {k} \left(z ^ {t} , \Theta_ {s | i , k} ^ {t + (m - 1) / \mathcal {M}} , \Theta_ {k} ^ {t + (m - 1) / \mathcal {M}}\right)} (100) \\ = 1 - \frac {\mathcal {L} _ {k} \left(z ^ {t} , \Theta_ {s | j} ^ {t + m / \mathcal {M}} , \Theta_ {k} ^ {t + (m - 1) / \mathcal {M}}\right)}{\mathcal {L} _ {k} \left(z ^ {t} , \Theta_ {s} ^ {t + (m - 1) / \mathcal {M}}, \Theta_ {k} ^ {t + (m - 1) / \mathcal {M}}\right)} (101) \\ \end{array} +$$ + +$$ +\begin{array}{l} \mathcal {B} _ {i, k \rightarrow k} ^ {t + m / \mathcal {M}} = 1 - \frac {\mathcal {L} _ {k} \left(z ^ {t} , \Theta_ {s | i , k} ^ {t + (m + 1) / \mathcal {M}} , \hat {\Theta} _ {k} ^ {t + (m + 1) / \mathcal {M}}\right)}{\mathcal {L} _ {k} \left(z ^ {t} , \Theta_ {s | j} ^ {t + m / \mathcal {M}} , \Theta_ {k} ^ {t + m / \mathcal {M}}\right)} (102) \\ = 1 - \frac {\mathcal {L} _ {k} \left(z ^ {t} , \Theta_ {s | i , k} ^ {t + (m + 1) / \mathcal {M}} , \hat {\Theta} _ {k} ^ {t + (m + 1) / \mathcal {M}}\right)}{\mathcal {L} _ {k} \left(z ^ {t} , \Theta_ {s | j} ^ {t + m / \mathcal {M}} , \Theta_ {k} ^ {t + (m - 1) / \mathcal {M}}\right)} (103) \\ \end{array} +$$ + +The two-step proximal inter-task affinity with the sequence $\{j\}$ and $\{i,k\}$ can be represented as follows: + +$$ +\begin{array}{l} \mathcal {B} _ {j; i, k \rightarrow k} ^ {t + (m - 1) / \mathcal {M}} = 1 - \left(1 - \mathcal {B} _ {j \rightarrow k} ^ {t + (m - 1) / \mathcal {M}}\right) \cdot \left(1 - \mathcal {B} _ {i, k \rightarrow k} ^ {t + m / \mathcal {M}}\right) (104) \\ = 1 - \frac {\mathcal {L} _ {k} \left(z ^ {t} , \Theta_ {s | j} ^ {t + m / \mathcal {M}} , \Theta_ {k} ^ {t + (m - 1) / \mathcal {M}}\right)}{\mathcal {L} _ {k} \left(z ^ {t} , \Theta_ {s} ^ {t + (m - 1) / \mathcal {M}} , \Theta_ {k} ^ {t + (m - 1) / \mathcal {M}}\right)} \cdot \frac {\mathcal {L} _ {k} \left(z ^ {t} , \Theta_ {s | i , k} ^ {t + (m + 1) / \mathcal {M}} , \hat {\Theta} _ {k} ^ {t + (m + 1) / \mathcal {M}}\right)}{\mathcal {L} _ {k} \left(z ^ {t} , \Theta_ {s | j} ^ {t + m / \mathcal {M}} , \Theta_ {k} ^ {t + (m - 1) / \mathcal {M}}\right)} (105) \\ = 1 - \frac {\mathcal {L} _ {k} \left(z ^ {t} , \Theta_ {s \mid i , k} ^ {t + (m + 1) / \mathcal {M}} , \hat {\Theta} _ {k} ^ {t + (m + 1) / \mathcal {M}}\right)}{\mathcal {L} _ {k} \left(z ^ {t} , \Theta_ {s} ^ {t + (m - 1) / \mathcal {M}} , \Theta_ {k} ^ {t + (m - 1) / \mathcal {M}}\right)} (106) \\ \end{array} +$$ + +Our objective is to compare $\mathcal{B}_{i,j,k\to k}^{t + (m - 1) / \mathcal{M}}$ from eq. (69) with $\mathcal{B}_{j;i,k\to k}^{t + (m - 1) / \mathcal{M}}$ from eq. (106) to assess each update's effect on the final loss. Since both equations share a common denominator, we only need to compare the numerators of each equation. Using the first-order Taylor approximation of $\mathcal{L}_k(z^t,\Theta_{s|i,k}^{t + (m + 1) / \mathcal{M}},\hat{\Theta}_k^{t + (m + 1) / \mathcal{M}})$ in eq. (106), we have: + +$$ +\begin{array}{l} \mathcal {L} _ {k} \left(z ^ {t}, \Theta_ {s | i, k} ^ {t + (m + 1) / \mathcal {M}}, \hat {\Theta} _ {k} ^ {t + (m + 1) / \mathcal {M}}\right) = \mathcal {L} _ {k} \left(z ^ {t}, \Theta_ {s | j} ^ {t + m / \mathcal {M}}, \Theta_ {k} ^ {t + m / \mathcal {M}}\right) (107) \\ + \left(\Theta_ {s | i, k} ^ {t + (m + 1) / \mathcal {M}} - \Theta_ {s | j} ^ {t + m / \mathcal {M}}\right) \nabla_ {\Theta_ {s | j} ^ {t + m / \mathcal {M}}} \mathcal {L} _ {k} \left(z ^ {t}, \Theta_ {s | j} ^ {t + m / \mathcal {M}}, \Theta_ {k} ^ {t + m / \mathcal {M}}\right) (108) \\ + \left(\hat {\Theta} _ {k} ^ {t + (m + 1) / \mathcal {M}} - \Theta_ {k} ^ {t + m / \mathcal {M}}\right) \nabla_ {\Theta_ {k} ^ {t + m / \mathcal {M}}} \mathcal {L} _ {k} \left(z ^ {t}, \Theta_ {s | j} ^ {t + m / \mathcal {M}}, \Theta_ {k} ^ {t + m / \mathcal {M}}\right) + O \left(\eta^ {2}\right) (109) \\ = \mathcal {L} _ {k} \left(z ^ {t}, \Theta_ {s | j} ^ {t + m / \mathcal {M}}, \Theta_ {k} ^ {t + m / \mathcal {M}}\right) - \eta \left(g _ {s; i} ^ {t + m / \mathcal {M}} + g _ {s; k} ^ {t + m / \mathcal {M}}\right) \cdot g _ {s; k} ^ {t + m / \mathcal {M}} (110) \\ - \eta g _ {t s; k} ^ {t + m / \mathcal {M}} \cdot g _ {t s; k} ^ {t + m / \mathcal {M}} + O \left(\eta^ {2}\right) (111) \\ \end{array} +$$ + +Similarly, $\mathcal{L}_k(z^t,\Theta_{s|i,k}^{t + m / \mathcal{M}},\Theta_k^{t + m / \mathcal{M}})$ in eq. (107) can also be further expanded using Taylor expansion as follows: + +$$ +\begin{array}{l} \mathcal {L} _ {k} \left(z ^ {t}, \Theta_ {s | j} ^ {t + m / \mathcal {M}}, \Theta_ {k} ^ {t + m / \mathcal {M}}\right) = \mathcal {L} _ {k} \left(z ^ {t}, \Theta_ {s | j} ^ {t + m / \mathcal {M}}, \Theta_ {k} ^ {t + (m - 1) / \mathcal {M}}\right) (112) \\ = \mathcal {L} _ {k} \left(z ^ {t}, \Theta_ {s} ^ {t + (m - 1) / \mathcal {M}}, \Theta_ {k} ^ {t + (m - 1) / \mathcal {M}}\right) (113) \\ + \left(\Theta_ {s | j} ^ {t + m / \mathcal {M}} - \Theta_ {s} ^ {t + (m - 1) / \mathcal {M}}\right) \nabla_ {\Theta_ {s} ^ {t + (m - 1) / \mathcal {M}}} \mathcal {L} _ {k} \left(z ^ {t}, \Theta_ {s | j} ^ {t + m / \mathcal {M}}, \Theta_ {k} ^ {t + (m - 1) / \mathcal {M}}\right) (114) \\ = \mathcal {L} _ {k} \left(z ^ {t}, \Theta_ {s} ^ {t + (m - 1) / \mathcal {M}}, \Theta_ {k} ^ {t + (m - 1) / \mathcal {M}}\right) (115) \\ - \eta g _ {s; j} ^ {t + (m - 1) / \mathcal {M}} \cdot g _ {s; k} ^ {t + (m - 1) / \mathcal {M}} + O \left(\eta^ {2}\right) (116) \\ \end{array} +$$ + +By substituting eq. (107) with the results of eq. (115) and eq. (116), we can obtain the following results: + +$$ +\begin{array}{l} \mathcal {L} _ {k} \left(z ^ {t}, \Theta_ {s \mid i, k} ^ {t + (m + 1) / \mathcal {M}}, \hat {\Theta} _ {k} ^ {t + (m + 1) / \mathcal {M}}\right) = \mathcal {L} _ {k} \left(z ^ {t}, \Theta_ {s} ^ {t + (m - 1) / \mathcal {M}}, \Theta_ {k} ^ {t + (m - 1) / \mathcal {M}}\right) (117) \\ - \eta \left(g _ {s; i} ^ {t + m / \mathcal {M}} + g _ {s; k} ^ {t + m / \mathcal {M}}\right) \cdot g _ {s; k} ^ {t + m / \mathcal {M}} - \eta g _ {t s; k} ^ {t + m / \mathcal {M}} \cdot g _ {t s; k} ^ {t + m / \mathcal {M}} (118) \\ - \eta g _ {s; j} ^ {t + (m - 1) / \mathcal {M}} \cdot g _ {s; k} ^ {t + (m - 1) / \mathcal {M}} + O \left(\eta^ {2}\right) (119) \\ \end{array} +$$ + +Finally, we can compare $\mathcal{B}_{i,j,k\to k}^{t + (m - 1) / \mathcal{M}}$ with $\mathcal{B}_{j;i,k\to k}^{t + (m - 1) / \mathcal{M}}$ by comparing the losses we obtained: $\mathcal{L}_k(z^t,\Theta_{s|j}^{t + (m + 1) / \mathcal{M}},\Theta_k^{t + (m - 1) / \mathcal{M}})$ with $\mathcal{L}_k(z^t,\Theta_{s|i,j,k}^{t + m / \mathcal{M}},\Theta_k^{t + (m - 1) / \mathcal{M}})$ . We assume a sufficiently small learning rate $\eta$ that allows us to ignore terms larger than order two with $\eta$ . + +$$ +\begin{array}{l} \mathcal {L} _ {k} \left(z ^ {t}, \Theta_ {s | i, k} ^ {t + (m + 1) / \mathcal {M}}, \hat {\Theta} _ {k} ^ {t + (m + 1) / \mathcal {M}}\right) - \mathcal {L} _ {k} \left(z ^ {t}, \Theta_ {s | i, j, k} ^ {t + m / \mathcal {M}}, \Theta_ {k} ^ {t + m / \mathcal {M}}\right) (120) \\ = - \eta \left(g _ {s; i} ^ {t + m / \mathcal {M}} + g _ {s; k} ^ {t + m / \mathcal {M}}\right) \cdot g _ {s; k} ^ {t + m / \mathcal {M}} - \eta g _ {t s; k} ^ {t + m / \mathcal {M}} \cdot g _ {t s; k} ^ {t + m / \mathcal {M}} (121) \\ - \eta g _ {s; j} ^ {t + (m - 1) / \mathcal {M}} \cdot g _ {s; k} ^ {t + (m - 1) / \mathcal {M}} (122) \\ + \eta \left(g _ {s, i} ^ {t + (m - 1) / \mathcal {M}} + g _ {s, j} ^ {t + (m - 1) / \mathcal {M}} + g _ {s, k} ^ {t + (m - 1) / \mathcal {M}}\right) \cdot g _ {s, k} ^ {t + (m - 1) / \mathcal {M}} (123) \\ + \eta g _ {t s, k} ^ {t + (m - 1) / \mathcal {M}} \cdot g _ {t s, k} ^ {t + (m - 1) / \mathcal {M}} (124) \\ = - \eta \left(g _ {s; i} ^ {t + m / \mathcal {M}} + g _ {s; k} ^ {t + m / \mathcal {M}}\right) \cdot g _ {s; k} ^ {t + m / \mathcal {M}} + \eta \left(g _ {s, i} ^ {t + (m - 1) / \mathcal {M}} + g _ {s, k} ^ {t + (m - 1) / \mathcal {M}}\right) \cdot g _ {s, k} ^ {t + (m - 1) / \mathcal {M}} (125) \\ - \eta g _ {t s; k} ^ {t + m / \mathcal {M}} \cdot g _ {t s; k} ^ {t + m / \mathcal {M}} + \eta g _ {t s, k} ^ {t + (m - 1) / \mathcal {M}} \cdot g _ {t s, k} ^ {t + (m - 1) / \mathcal {M}} (126) \\ \simeq - \eta g _ {t s; k} ^ {t + m / \mathcal {M}} \cdot g _ {t s; k} ^ {t + m / \mathcal {M}} + \eta g _ {t s, k} ^ {t + (m - 1) / \mathcal {M}} \cdot g _ {t s, k} ^ {t + (m - 1) / \mathcal {M}} (127) \\ \leq 0 (128) \\ \end{array} +$$ + +The approximation in eq. (127) holds under the assumption that the change in inter-task affinity during a single time step from $t + (m - 1) / \mathcal{M}$ to $t + m / \mathcal{M}$ is negligible. Since we assume convex loss functions, the magnitude of task-specific gradients $g_{ts;k}$ would increase after updating the loss of $j$ , which exhibits negative inter-task affinity with $k$ ( $\mathcal{A}_{j\rightarrow k} < 0$ ). Therefore, the inequality in eq. (128) holds. + +This suggests that grouping tasks with proximal inter-task affinity and subsequently updating these groups sequentially result in lower multi-task loss compared to jointly backpropagating all tasks. This disparity arises because the network can discern superior task-specific parameters to accommodate task-specific information during sequential learning. + +# B ADDITIONAL RELATED WORKS + +Task Grouping. Early Multi-Task Learning research is founded on the belief that simultaneous learning of similar tasks within a multi-task framework can enhance overall performance. Kang et al. Kang et al. (2011) identify tasks that contribute to improved multi-task performance through the clustering of related tasks with online stochastic gradient descent. This strategy challenges the prevailing assumption that all tasks are inherently interrelated. In parallel, Kumar et al. Kumar & Daume III (2012) present a framework for MTL designed to enable selective sharing of information across tasks. They suggest that each task parameter vector can be expressed as a linear combination of a finite number of underlying basis tasks. However, these initial methodologies face limitations in their applicability and analysis, particularly in scaling to deep neural networks. Finding out related tasks is more dynamically explored in the transfer learning domain Achille et al. (2019; 2021). They find related tasks by measuring task similarity which can be comparing the similarity of features extracted from the same depth of the independent task's network or directly measuring the transfer performance between tasks. Recent research has concentrated on identifying related tasks by directly assessing the relations among them within shared networks. This focus stems from the recognition that the measured inter-task relations in transfer learning fail to fully elucidate the dynamics within the MTL domain Standley et al. (2020); Fifty et al. (2021). + +Multi-Task Architectures. Multi-task architectures can be classified based on how much the parameters or features are shared across tasks in the network. The most commonly used structure is a shared trunk which consists of a common encoder shared by multiple tasks and a dedicated decoder for each task Dai et al. (2016); Ma et al. (2018); Simonyan & Zisserman (2014); Zhang et al. (2014). A tree-like architecture, featuring multiple division points for each task group, offers a more generalized structure Lu et al. (2017); Vandenhende et al. (2019); Bruggemann et al. (2020); Guo et al. (2020). The cross-talk architecture employs separate symmetrical networks for each task, facilitating feature exchange between layers at the same depth for information sharing between tasks Gao et al. (2019); Xu et al. (2018). The prediction distillation model Eigen & Fergus (2015); Xu et al. (2018); Vandenhende et al. (2020); Zhang et al. (2019) incorporates cross-task interactions at the end of the shared encoder, while the task switching network Sun et al. (2021); Sinha et al. (2018); Fernando et al. (2017); Maninis et al. (2019) adjusts network parameters depending on the task. + +MTL in Vision Transformers. Recent advancements in multi-task architecture have explored the integration of Vision Transformer Dosovitskiy et al. (2020); Liu et al. (2021c); Wang et al. (2021a); Yang et al. (2021); Xie et al. (2021); Wang et al. (2021b) into MTL. MTFormer Xu et al. (2022) adopts a shared transformer encoder and decoder with a cross-task attention mechanism. MulT Bhattacharjee et al. (2022) leverages a shared attention mechanism to capture task dependencies, inspired by the Swin transformer. InvPT Ye & Xu (2022a) emphasizes global spatial position and multi-task context for dense prediction tasks through multi-scale feature aggregation. The Mixture of Experts (MoE) divides the model into predefined expert groups, dynamically shared or dedicated to specific tasks during the learning phase Riquelme et al. (2021); Zhang et al. (2022); Fan et al. (2022); Mustafa et al. (2022); Chen et al. (2023); Ye & Xu (2023). Task prompter Xu et al. (2023a,b); Ye & Xu (2022c) employs task-specific tokens to encapsulate task-specific information and utilizes cross-task interactions to enhance multi-task performance. + +Multi-Task Domain Generalization. Task grouping based on their relations has also been explored in the field of domain adaptation. In particular, (Wei et al., 2024) proposes grouping heterogeneous tasks to regularize them, thereby promoting the learning of more generalized features across domain shifts. (Smith et al., 2021) explores generalization strategies at the mini-batch level. (Li et al., 2020) addresses diverse domain shift scenarios by incorporating all possible sequential domain learning paths to generalize features for unseen domains. (Shi et al., 2021) focuses on generalization to unseen domains by reducing dependence on specific domains through inter-domain gradient matching. Additionally, (Hu et al., 2022) analyzes the problem of spurious correlations in MTL and proposes regularization methods to mitigate this issue. The effect of gradient conflicts, which are considered the primary cause of negative transfer between tasks, is thoroughly examined in (Jiang et al., 2024). This work also proposes combining task distributions to identify better network parameters from a generalization perspective. The objectives of conventional multi-task optimization and domain generalization differ fundamentally. Conventional multi-task optimization typically assumes that the source and target domains share similar data distributions. In contrast, domain generalization focuses on scenarios involving significant domain shifts. This distinction leads to different approaches in + +leveraging task relations to achieve their respective goals. In multi-task optimization, simultaneously updating heterogeneous tasks with conflicting gradients results in suboptimal optimization. On the other hand, domain generalization leverages task sets as a tool to extract generalized features applicable to various unseen domains. Overfitting to similar tasks can harm performance on unseen domains, making it advantageous to use heterogeneous tasks as a form of regularization. + +# C EXPERIMENTAL DETAILS + +We implement our experiments on top of publicly available code from Ye & Xu (2022b). We run our experiments on A6000 GPUs. + +Datasets. We assess our method on multi-task datasets: NYUD-v2 Silberman et al. (2012), PASCAL-Context Mottaghi et al. (2014), and Taskonomy Zamir et al. (2018). These datasets encompass various vision tasks. NYUD-v2 comprises 4 vision tasks: depth estimation, semantic segmentation, surface normal prediction, and edge detection. Meanwhile, PASCAL-Context includes 5 tasks: semantic segmentation, human parts estimation, saliency estimation, surface normal prediction, and edge detection. In Taskonomy, we use 11 vision tasks: Depth Euclidean (DE), Depth Zbuffer (DZ), Edge Texture (ET), Keypoints 2D (K2), Keypoints 3D (K3), Normal (N), Principal Curvature (C), Reshading (R), Segment Unsup2d (S2), and Segment Unsup2.5D (S2.5). + +Metrics. To assess task performance, we employed widely used metrics across different tasks. For semantic segmentation, we utilized mean Intersection over Union (mIoU). The performance of surface normal prediction was gauged by computing the mean angle distances between the predicted output and ground truth. Depth estimation task performance was evaluated using Root Mean Squared Error (RMSE). For saliency estimation and human part segmentation, we utilized mean Intersection over Union (mIoU). Edge detection performance was assessed using optimal-dataset-scale-F-measure (odsF). For the Taskonomy benchmark, curvature was evaluated using RMSE, while the other tasks were evaluated using L1 distance, following the settings in Chen et al. (2023). + +To evaluate multi-task performance, we adopted the metric proposed in Maninis et al. (2019). This metric measures per-task performance by averaging it with respect to the single-task baseline $b$ , as shown in the equation: $\triangle_{m} = (1 / T)\sum_{i = 1}^{T}(-1)^{l_{i}}(M_{m,i} - M_{b,i}) / M_{b,i}$ where $l_{i} = 1$ if a lower value of measure $M_{i}$ means better performance for task $i$ , and 0 otherwise. + +Table C.1: Hyperparameters for experiments. + +
HyperparameterValue
OptimizerAdam Kingma & Ba (2014)
SchedulerPolynomial Decay
Minibatch size8
Number of iterations40000
Backbone (Transformer)ViT Dosovitskiy et al. (2020)
Learning rate0.00002
Weight Decay0.000001
Affinity decay factor β0.001
+ +Implementation Details. For experiments, we adopt ViT Dosovitskiy et al. (2020) pre-trained on ImageNet-22K Deng et al. (2009) as the multi-task encoder. Task-specific decoders merge the multi-scale features extracted by the encoder to generate the outputs for each task. The models are trained for 40,000 iterations on both NYUD Silberman et al. (2012) and PASCAL Everingham & Winn (2012) datasets with batch size 8. We used Adam optimizer with learning rate $2 \times 10^{-5}$ and $1 \times 10^{-6}$ of a weight decay with a polynomial learning rate schedule. The cross-entropy loss was used for semantic segmentation, human parts estimation, and saliency, edge detection. Surface normal prediction and depth estimation used L1 loss. The tasks are weighted equally to ensure a fair comparison. For the Taskonomy Benchmark Zamir et al. (2018), we use the dataloader from the open-access code provided by Chen et al. (2023), while maintaining experimental settings identical to those used for NYUD-v2 and PASCAL-Context. We use the same experimental setup for the other hyperparameters as in previous works Ye & Xu (2022a;c), as detailed in Table C.1. + +# D ADDITIONAL EXPERIMENTAL RESULTS + +Comparison of optimization results with different backbone sizes. We compare the results of multi-task optimization on Taskonomy across various sizes of vision transformers, as shown in Tables D.1 to D.3. Our method consistently achieves superior performance across all backbone sizes. Unlike previous approaches that focus on learning shared parameters, our optimization strategy enhances the learning of task-specific parameters. This leads to significant performance improvements, especially with smaller backbones, where competition between tasks is more intense due to the limited number of shared parameters. How tasks are grouped, as visualized in fig. D.1, depends on the backbone size. + +Visualization of Proximal Inter-Task Affinity. In Figure D.2, we present the tracked proximal inter-task affinity for each pair of tasks in Taskonomy. The changes in proximal inter-task affinity depend on the nature of the task pair, but as the backbone size increases, the affinity tends to become more positive. This trend is more noticeable in NYUD-v2 and PASCAL-Context, where there are fewer tasks, as shown in Figures D.3 and D.4. This pattern also aligns with the number of clustered tasks in Figure 3c, where the number of groups increases as the backbone size decreases. + +Effect of the Decay Rate with Visualization. In Figure D.5, we visualize the proximal inter-task affinity tracked during optimization with various decay rates $\beta$ , ranging from 0.01 to 1e-5 on a logarithmic scale. The decay rate $\beta$ helps stabilize the tracking of proximal inter-task affinity as it fluctuates during optimization. Additionally, it aids in understanding inter-task relations over time, independent of input data. For vision transformers, a decay rate of $\beta = 0.001$ demonstrates stable tracking. In real-world applications, multi-task performance is not highly sensitive to the decay rate $\beta$ . In Table D.4, we evaluate how $\beta$ impacts multi-task performance on the Taskonomy benchmark. The results demonstrate that the proposed optimization method consistently improves performance across various $\beta$ values, minimizing the need for extensive hyperparameter tuning in practical scenarios. + +The Influence of Task Grouping Strategy. In Table D.5, we present results comparing different task grouping strategies. These include randomly grouping tasks with a predefined number, grouping heterogeneous tasks, and grouping homogeneous tasks (our approach). The results clearly demonstrate that grouping homogeneous task sets yields superior performance under the proposed settings. This contrasts with the multi-task domain generalization approach, which groups heterogeneous tasks as a form of regularization to enhance generalization to unseen domains. This difference arises from the fundamentally distinct objectives of conventional multi-task optimization and domain generalization. Conventional multi-task optimization typically assumes that the source and target domains share similar data distributions, while domain generalization addresses scenarios with significant domain shifts. Consequently, the approaches to leveraging task relations differ to meet these distinct goals. As demonstrated in Theorems 1 and 2 of our work, in multi-task optimization, simultaneously updating heterogeneous tasks with low task affinity leads to suboptimal optimization and higher losses compared to updating similar task sets with high task affinity. This observation aligns with findings from previous multi-task optimization studies referenced in the related works section. + +Influence of Batch Size. In Table D.6, we compare our method with single-gradient descent (GD) to evaluate its robustness in improving multi-task performance across varying batch sizes. The proposed optimization method consistently demonstrates performance improvements $(\triangle_{m} (\%) \uparrow)$ of $5.27\%$ , $5.71\%$ , and $6.13\%$ across different batch sizes. These results highlight the robustness and adaptability of the proposed algorithm across diverse scenarios. + +![](images/4365e0004ad3ea53c8462eaeb9890aee23d2a02dbe53b2c0548075966e62e628.jpg) +(a) $\{G\}_{i = 1}^{\mathcal{M}}$ with ViT-L + +![](images/1d039a9e380e697e2e94ec076bb81db2bcd3a2bd97873cfaf6cf6b685d2e8dca.jpg) +(b) $\{G\}_{i = 1}^{\mathcal{M}}$ with ViT-B + +![](images/0fc28e346c4e088d1428e15dcc426c5201d0c3ff3f58c6aa68edff96595eb037.jpg) +(c) $\{G\}_{i = 1}^{\mathcal{M}}$ with ViT-S +Figure D.1: The averaged grouping results $\{G\}_{i=1}^{\mathcal{M}}$ on the Taskonomy benchmark are shown for (a) ViT-L, (b) ViT-B, (c) ViT-S, and (d) ViT-T, respectively. + +![](images/375581c31631073096365193f6c81ec91bb5d215327341713d0027307b1bea46.jpg) +(d) $\{G\}_{i = 1}^{\mathcal{M}}$ with ViT-T + +Table D.1: Comparison with previous multi-task optimization approaches on Taskonomy with ViT-B. + +
TaskDEDZEOETK2K3NCRS2S2.5△m(↑)
L1 Dist. ↓L1 Dist. ↓L1 Dist. ↓L1 Dist. ↓L1 Dist. ↓L1 Dist. ↓L1 Dist. ↓RMSE ↓L1 Dist. ↓L1 Dist. ↓L1 Dist. ↓
Single Task0.01830.01860.10890.17130.16300.08630.29530.75220.15040.17380.1530-
GD0.01880.01970.12830.17450.17180.09330.25990.79110.17990.18850.1631-6.35
GradDrop0.01950.02060.13180.17480.17350.09450.30180.80600.18660.19200.1607-9.54
MGDA
UW0.01880.01980.12850.17450.17190.09330.25350.79150.18000.18830.1629-6.19
DTP0.01870.01980.12830.17450.17200.09330.25580.79120.18040.18840.1634-6.25
DWA0.01880.01970.12870.17450.17190.09330.25700.79270.18060.18870.1632-6.33
PCGrad0.01850.01880.12850.17380.17030.09280.25570.79640.18100.18820.1569-5.22
CAGrad0.01920.01960.13060.17330.16540.09390.28710.81470.19010.19060.1659-8.34
IMTL0.01890.02000.12870.17450.17200.09340.26180.79280.18110.18880.1635-6.75
Aligned-MTL0.01910.02020.12630.17290.16630.09440.30610.85600.19360.18720.1585-8.93
Nash-MTL0.01750.01820.12080.17300.16630.09010.26860.79580.17070.18390.1577-2.79
FAMO0.01890.02000.12850.17450.17200.09340.27150.79290.18070.18910.1640-7.21
Ours0.01670.01690.12280.17390.16950.09100.23440.76000.16910.18360.1571-0.64
+ +Table D.2: Comparison with previous multi-task optimization approaches on Taskonomy with ViT-S. + +
TaskDEDZEOETK2K3NCRS2S2.5\( \bigtriangleup_{m} \) (↑)
L1 Dist. ↓L1 Dist. ↓L1 Dist. ↓L1 Dist. ↓L1 Dist. ↓L1 Dist. ↓L1 Dist. ↓L1 Dist. ↓RMSE ↓L1 Dist. ↓L1 Dist. ↓L1 Dist. ↓
Single Task0.02640.02590.13480.17400.16670.09730.34810.85980.19050.18570.1691-
GD0.02640.02720.15740.17750.18380.10380.43700.92370.24750.20760.1858-11.39
GradDrop0.02740.02800.16090.17790.18560.10420.44720.93660.25490.21060.1821-13.14
MGDA------------
UW0.02630.02690.15700.17750.18320.10370.43620.92020.24650.20750.1856-11.11
DTP0.02620.02730.15680.17780.18310.10370.48840.92070.24660.20730.1849-12.52
DWA0.02640.02710.15720.17760.18340.10380.43360.92150.24690.20750.1856-11.20
PCGrad0.02710.02740.15700.17660.17840.10340.45220.93430.25250.20710.1811-11.78
CAGrad0.02890.02820.16110.17690.17060.10620.47230.95570.26890.21220.1902-15.09
IMTL-L0.02550.02580.15100.17440.17160.10050.43390.94590.24660.20360.1825-8.90
Aligned-MTL0.02860.02900.16030.17440.17110.10330.45961.00220.27830.20900.1854-15.06
Nash-MTL0.02550.02580.15100.17440.17160.10050.43390.94590.24660.20360.1825-8.79
FAMO0.02630.02720.15730.17740.18350.10350.43260.92080.24640.20770.1858-11.23
Ours0.02250.02290.14440.17620.17750.09950.39830.86200.21560.19970.1774-2.83
+ +Table D.3: Comparison with previous multi-task optimization approaches on Taskonomy with ViT-T. + +
TaskDEDZEOETK2K3NCRS2S2.5△m(↑)
L1 Dist. ↓L1 Dist. ↓L1 Dist. ↓L1 Dist. ↓L1 Dist. ↓L1 Dist. ↓L1 Dist. ↓RMSE ↓L1 Dist. ↓L1 Dist. ↓L1 Dist. ↓
Single Task0.02890.02900.14050.17740.16820.09700.38370.89680.20960.19040.1729-
GD0.02790.02850.16040.17890.18600.10430.47040.94880.26130.20860.1914-9.21
GradDrop0.02870.02920.16300.17950.18680.10520.47950.96210.26970.21180.1878-10.68
MGDA------------
UW0.02790.02850.16040.17890.18590.10430.46990.94880.26130.20850.1914-9.21
DTP0.02780.02880.16030.17900.18590.10420.46970.94880.26140.20880.1915-9.27
DWA0.02790.02850.16040.17890.18590.10430.46930.94890.26130.20860.1913-9.20
PCGrad0.02830.02900.16040.17690.18030.10360.47200.96450.26830.20900.1866-9.28
CAGrad0.03000.03040.16440.17430.17210.10550.48380.98180.28470.21430.1974-12.12
IMTL0.02760.02820.15530.17540.17430.10180.46210.98090.26230.20510.1878-7.55
Aligned-MTL0.02960.03180.16330.17650.17570.11500.48061.02700.29350.21090.1887-13.70
Nash-MTL0.02760.02820.15530.17540.17430.10180.46210.98090.26230.20510.1878-7.46
FAMO0.02790.02850.16040.17890.18590.10430.47180.94880.26120.20850.1913-9.33
Ours0.02520.02570.15260.17740.18270.10190.43370.91000.24020.20260.1845-3.67
+ +![](images/473016465397d8040d9365a420b459df23924ac0dfddaff92b2d3974e5a1220f.jpg) +Figure D.2: Changes in proximal inter-task affinity during the optimization process of ViT-L with Taskonomy benchmark. + +![](images/03314aa93b96c2094cdcf9a8a5d9a7ba281a5d98cbd3fd5d45e1ce009dc69bef.jpg) +Figure D.2: Changes in proximal inter-task affinity during the optimization process with Taskonomy benchmark. + +![](images/16a647943c6d09e351dcdf80a34a41d044f358b4e1ed62970e3a9ccc2e2b7b69.jpg) + +![](images/d6c7c9949dd219b891c70d9118a4a919f8cfca58b184630fbbffaf2a76585dce.jpg) + +![](images/77bbe1a6ffb4ae8a801338a70a69b34c1cedcd566a3409a6c4f0fb3ba6c086e5.jpg) + +![](images/4e6449fe2cc534e267b0938ea64b0c9000d8a090e44e780de437e7ca97fc8a35.jpg) + +![](images/06b664bca572b25fbd7f2a437500fd852b7df5e4a11ef9a9b3b2fa5718f89814.jpg) + +![](images/3772da80e80b877e64aa5c096ce66e846d3d3d3c9d3a6515819df22bc9fbfdcc.jpg) + +![](images/c77bbaace62c673dbdf8b463c313c7a22f19981052fe57d59a28940a4e2bc06e.jpg) + +![](images/06b508c76cebd54e8118faf1feb16c29bbd66b8ade29007f7d779b29771d90f2.jpg) + +![](images/8cbd5bc6bea07a5b96d19c225253c41d0ab373f91d39fd5790bb0f4f7723ba07.jpg) +Figure D.3: Changes in the proximal inter-task affinity during the optimization process of different sizes of ViT with NYUD-v2. + +![](images/9686f941e9be7d9086cdc6b2722a482995d78e484afe52e42efb3addf5be6c14.jpg) + +![](images/03c9b363fbe05159e3300139e190e05476840fa556c36f1e1e8a1d88ce1322c8.jpg) + +![](images/a8f322b3ea4ebc3d007d2f63068e45b3818cd7508b37be8fbf897810071a8589.jpg) + +Table D.4: Results on Taskonomy with different affinity decay rates $\beta$ . + +
TaskDEDZEOETK2K3NCRS2S2.5\( \bigtriangleup_{m} (↑) \)
L1 Dist. ↓L1 Dist. ↓L1 Dist. ↓L1 Dist. ↓L1 Dist. ↓L1 Dist. ↓L1 Dist. ↓RMSE ↓L1 Dist. ↓L1 Dist. ↓L1 Dist. ↓
Single Task0.01830.01860.10890.17130.16300.08630.29530.75220.15040.17380.1530-
GD0.01880.01970.12830.17450.17180.09330.25990.79110.17990.18850.1631-6.35
\( \beta=0.0001 \)0.01650.01680.12240.17390.16930.09070.23040.75810.16830.18310.1571-0.18
\( \beta=0.001 \)0.01670.01690.12280.17390.16950.09100.23440.76000.16910.18360.1571-0.64
\( \beta=0.01 \)0.01670.01710.12320.17390.16980.09120.23620.76230.17050.18340.1576-1.01
\( \beta=0.1 \)0.01670.01710.12310.17390.16950.09120.23550.76310.16970.18310.1575-0.87
+ +Table D.5: Comparison of different grouping strategies on the Taskonomy benchmark. + +
TaskDEDZEOETK2K3NCRS2S2.5\( \Delta_m(↑) \)
L1 Dist. ↓L1 Dist. ↓L1 Dist. ↓L1 Dist. ↓L1 Dist. ↓L1 Dist. ↓L1 Dist. ↓RMSE ↓L1 Dist. ↓L1 Dist. ↓L1 Dist. ↓
Heterogeneous0.01720.01760.12520.17410.17000.09200.24750.77810.17430.18490.1660-3.10
Random (N(M)=2)0.01770.01800.12590.17410.17070.09230.26620.78070.17570.18710.1617-4.24
Random (N(M)=3)0.01720.01770.12500.17410.17030.09200.26190.77540.17490.18660.1607-3.35
Random (N(M)=4)0.01830.01870.12770.17460.17060.09360.28120.78410.18040.18820.1636-6.12
Random (N(M)=5)0.01860.01840.12740.17470.17080.09350.31500.78420.18000.18880.1640-7.17
Random (N(M)=6)0.02080.02090.13490.17500.17210.09610.33340.82220.19760.19350.1703-13.20
Ours0.01670.01690.12280.17390.16950.09100.23440.76000.16910.18360.1571-0.64
+ +# E ALGORITHM COMPLEXITY AND COMPUTATIONAL LOAD + +We also provide a detailed time comparison of previous multi-task optimization methods on Taskonomy. As shown in Table E.1, our approach effectively optimizes multiple tasks with more efficient training times. Our method converges faster than gradient-based approaches, as the primary bottleneck in optimization lies in backpropagation and gradient manipulation. + +![](images/b469d9a2fb2eb70dc28b379406d6c6546c2d8be92d7a322d90d287b4a522f4ae.jpg) + +![](images/230e2c44f6bf36817448c8bf04952870e304fe9fa06ce491c0371372d877b643.jpg) + +![](images/a5ef5905fdc9d5d049da885683594fc880a2910b347d6ddd326777b3b5085ade.jpg) + +![](images/73aaf7d8964432b46fef3ea0a0664ff5f38dd1e3e52563cd5d226c2e5d8dbb2b.jpg) + +![](images/0d8c7bc5e784e140170eb891194dca60fc4d52325ab43e974d4cf3926d011432.jpg) + +![](images/84d60fccf80f0391ad7d62ba57ebf9c33397f059b39cf4d5e7c3371dcc7a7524.jpg) + +![](images/6f4cfbb3fc064780225cdedad4911aeb0d8404e927db9102f0cf909823e27760.jpg) + +![](images/e0b9f741ed352ea5a20ca3e22ee23dc369290b6a7cbd5267c69379ff0da9e8e2.jpg) + +![](images/dc36d58db8aa551e63c4c63c2032a5377c4e3d253f83e5456c8e2a027075407c.jpg) + +![](images/df31cb95053844e59b9461fcb817c6eb1cc089ebf1c72701a41f9245148a735f.jpg) + +![](images/1710dd54415e05d67e8ed9ddb637f82c1b75fb3c341772192b85fd6695a134df.jpg) + +![](images/ad4b4e2b97dc8f2e4b859b561694176944934962579683ddc9b88b3702de5548.jpg) + +![](images/a6f6434a6f97363d300244195433a0bd08f642707e6e64345ce79726a0dcd8a7.jpg) + +![](images/14758e421a2277d301d48b76b12e1c7ecbb3268a4b4e8fb2d1ea8e3e70ac0999.jpg) + +![](images/486cb4558ee4d5f20bbc9f81a2a9078718a0fc2c8761a937607de25c38932da2.jpg) + +![](images/646f212a89b570cd2106e614f8d4bdc93e38fe0b1a748c5b528161bbcb97496a.jpg) + +![](images/946a834bc7bb1f683d3421153dc48eb54b0bca8eaa8aabc10ccafdf59e5d8f0c.jpg) +Figure D.4: Changes in proximal inter-task affinity during the optimization process of different sizes of ViT with PASCAL-Context. + +![](images/88f9b98da4d83ab00423ff1fa2cd571c1dbcb2216f4e61103e6fe83e1473aab2.jpg) + +![](images/59f806bf15ae3b1a96d099c38c496d541953f87d892506348acf1bbe1a4e652d.jpg) + +![](images/d7a24ea7e408ed7b36fc3feab303069cf6a9d50a171e19ebf694ef4752d7e60b.jpg) + +Table D.6: Results on Taskonomy with varying batch sizes using ViT-B (batch sizes in brackets). + +
TaskDEDZEOETK2K3NCRS2S2.5\( \bigtriangleup_{m} (↑) \)
L1 Dist. ↓L1 Dist. ↓L1 Dist. ↓L1 Dist. ↓L1 Dist. ↓L1 Dist. ↓L1 Dist. ↓RMSE ↓L1 Dist. ↓L1 Dist. ↓L1 Dist. ↓
Single Task0.01830.01860.10890.17130.16300.08630.29530.75220.15040.17380.1530-
GD(4)0.02080.02140.13230.17470.17230.09520.27680.82140.19360.19210.1677-10.88
Ours(4)0.01850.01900.12730.17410.17090.09280.27390.79570.18090.18880.1632-6.19
GD(8)0.01880.01970.12830.17450.17180.09330.25990.79110.17990.18850.1631-6.35
Ours(8)0.01670.01690.12280.17390.16950.09100.23440.76000.16910.18360.1571-0.64
GD(16)0.01720.01800.12480.17420.17110.09200.22800.76410.17060.18480.1589-1.94
Ours(16)0.01530.01540.11860.17370.16820.08930.19670.73340.15810.17800.1516+4.19
+ +![](images/455a237eb50b65e11a612783eafc44e9d561688954e69d306fe88e436275568a.jpg) + +![](images/f5d07bdc550016a0df6ada71d7a7adca33903371a8b01f6cd283f6091584fd88.jpg) + +![](images/539304bf48daec64ee76c99207cb4e32c5b42d84ee10d451a232a79ed32557e1.jpg) + +![](images/1f2c26e5c5d9cb7f2c26d9a7d108510571c93f4310fdda3ac26369f9b5ebb2eb.jpg) + +![](images/9e12f066a89712f2c210d5687cecde4bd9439272c65e5cdc99d0e511159a68a2.jpg) + +![](images/759a8232d242a008a28ccaab3e1ac3c19ff9e08a336d6637ce294bf2ab5bc78c.jpg) + +![](images/9168d4fb500dbe052cde5642f50a222ea10c28fdf5b2762da763fe7f125be486.jpg) + +![](images/4b9d9e1a25bb243794963a208537d9816949f86dddd08fa19e7d71fc2f687c3f.jpg) + +![](images/6829d64c8413657f2504bda4b003289d31ee3ce1ae62e104af500a14d5894935.jpg) +Figure D.5: Changes in proximal inter-task affinity during the optimization process with different decay rates, $\beta$ . + +![](images/99e0d481f934edd992c877dc329e551f7c696728100a8bcb61c87020269fa84a.jpg) + +![](images/a02c45710a024d26bc33cd01ab114668f0a83bfe2bae321ee31eafb6bf65ffbd.jpg) + +![](images/64293b8cb58e45f55e9691492b1767e323383a754207c0d1d05e9afb59ff2067.jpg) + +Table E.1: Comparison of the average time required by each optimization process to handle a single batch for 11 tasks on Taskonomy. + +
Process (sec)Forward PassBackpropagationGradient ManipulationOptimizer StepClustering + Affinity UpdateTotal
GD0.030(9.04%)0.198(59.26%)-0.106(31.69%)-0.33
UW0.030(8.82%)0.198(58.24%)-0.112(32.94%)-0.34
DTP0.030(8.70%)0.199(57.68%)-0.116(33.62%)-0.34
DWA0.031(9.01%)0.198(57.56%)-0.115(33.43%)-0.34
GradDrop0.030(1.13%)2.05(80.54%)0.411(16.02%)0.059(2.30%)-2.57
MGDA0.033(0.086%)2.06(5.36%)36.29(94.47%)0.031(0.081%)-38.42
PCGrad0.030(0.63%)2.07(44.09%)2.57(54.62%)0.031(0.66%)-4.70
CAGrad0.030(0.57%)2.06(39.39%)3.11(59.44%)0.031(0.59%)-5.23
Aligned-MTL0.027(0.86%)2.07(64.99%)1.06(33.20%)0.030(0.95%)-3.19
FAMO0.030(8.72%)0.198(57.56%)-0.116(33.72%)-0.34
Ours0.072(7.13%)0.576(56.72%)-0.323(31.82%)0.044(4.33%)1.02
\ No newline at end of file diff --git a/ICLR/2025/Selective Task Group Updates for Multi-Task Optimization/images.zip b/ICLR/2025/Selective Task Group Updates for Multi-Task Optimization/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..e3e569e1f5ffccfdbda07c7886f7eddfddb0d80a --- /dev/null +++ b/ICLR/2025/Selective Task Group Updates for Multi-Task Optimization/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3a2e5830d6481e6b1bab2a9c0a181f6a8bf04c8355ac69cb8e073331a2bbb4b3 +size 2992568 diff --git a/ICLR/2025/Selective Task Group Updates for Multi-Task Optimization/layout.json b/ICLR/2025/Selective Task Group Updates for Multi-Task Optimization/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..ed8d988b7144690335e585b7f16304d3ef3a0b37 --- /dev/null +++ b/ICLR/2025/Selective Task Group Updates for Multi-Task Optimization/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7f3362f4a92cf157c1b3efeea6e2e488c16e58993f55e3761d3c80d9521b26c9 +size 1247906 diff --git a/ICLR/2025/Selective Unlearning via Representation Erasure Using Domain Adversarial Training/8ce8aa33-2a96-422f-b575-479d4e72ae9f_content_list.json b/ICLR/2025/Selective Unlearning via Representation Erasure Using Domain Adversarial Training/8ce8aa33-2a96-422f-b575-479d4e72ae9f_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..8f0f5c41f24b0f2eed44d7bdc8ffdf3a07f446fa --- /dev/null +++ b/ICLR/2025/Selective Unlearning via Representation Erasure Using Domain Adversarial Training/8ce8aa33-2a96-422f-b575-479d4e72ae9f_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f92b47db9621d5349b3191109036259941408329778227381ed2c154cbf7c8b9 +size 117270 diff --git a/ICLR/2025/Selective Unlearning via Representation Erasure Using Domain Adversarial Training/8ce8aa33-2a96-422f-b575-479d4e72ae9f_model.json b/ICLR/2025/Selective Unlearning via Representation Erasure Using Domain Adversarial Training/8ce8aa33-2a96-422f-b575-479d4e72ae9f_model.json new file mode 100644 index 0000000000000000000000000000000000000000..bebe5e61877822b0dcd0335dba51e07de43f4392 --- /dev/null +++ b/ICLR/2025/Selective Unlearning via Representation Erasure Using Domain Adversarial Training/8ce8aa33-2a96-422f-b575-479d4e72ae9f_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9754ce428c962904e5cfb8f17939192c6ba67fff35322ac7975da1c589d567f5 +size 132434 diff --git a/ICLR/2025/Selective Unlearning via Representation Erasure Using Domain Adversarial Training/8ce8aa33-2a96-422f-b575-479d4e72ae9f_origin.pdf b/ICLR/2025/Selective Unlearning via Representation Erasure Using Domain Adversarial Training/8ce8aa33-2a96-422f-b575-479d4e72ae9f_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..19b62a3ace3033f12ea889e67b2695facebfc69c --- /dev/null +++ b/ICLR/2025/Selective Unlearning via Representation Erasure Using Domain Adversarial Training/8ce8aa33-2a96-422f-b575-479d4e72ae9f_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:406dd277a50f4975830d7c78c95261b175adac42ea0ba2f585fa4a58f326a2a8 +size 3724617 diff --git a/ICLR/2025/Selective Unlearning via Representation Erasure Using Domain Adversarial Training/full.md b/ICLR/2025/Selective Unlearning via Representation Erasure Using Domain Adversarial Training/full.md new file mode 100644 index 0000000000000000000000000000000000000000..2dd8c92ac07ea105222193bda2113a73e9b3b44d --- /dev/null +++ b/ICLR/2025/Selective Unlearning via Representation Erasure Using Domain Adversarial Training/full.md @@ -0,0 +1,436 @@ +# SELECTIVE UNLEARNING VIA REPRESENTATION ERASURE USING DOMAIN ADVERSARIAL TRAINING + +Nazanin Mohammadi Sepahvand\* Eleni Triantafillou2 Hugo Larochelle2 Doina Precup1,2 + +James J. Clark $^{1}$ Daniel M. Roy $^{3}$ Gintare Karolina Dziugaite $^{1,2}$ + +1McGill University, Mila, Canada 2Google DeepMind 3University of Toronto, Canada + +# ABSTRACT + +When deploying machine learning models in the real world, we often face the challenge of "unlearning" specific data points or subsets after training. Inspired by Domain-Adversarial Training of Neural Networks (DANN), we propose a novel algorithm, SURE, for targeted unlearning. SURE treats the process as a domain adaptation problem, where the "forget set" (data to be removed) and a validation set from the same distribution form two distinct domains. We train a domain classifier to discriminate between representations from the forget and validation sets. Using a gradient reversal strategy similar to DANN, we perform gradient updates to the representations to "fool" the domain classifier and thus obfuscate representations belonging to the forget set. Simultaneously, gradient descent is applied to the retain set (original training data minus the forget set) to preserve its classification performance. Unlike other unlearning approaches whose training objectives are built based on model outputs, SURE directly manipulates the representations. This is key to ensure robustness against a set of more powerful attacks than currently considered in the literature, that aim to detect which examples were unlearned through access to learned embeddings. Our thorough experiments reveal that SURE has a better unlearning quality to utility trade-off compared to other standard unlearning techniques for deep neural networks. + +# 1 INTRODUCTION + +In machine learning, the principle of unlearning is essential for selectively removing the influence of specific data points from a trained model. The gold standard is exact unlearning, which demands that the model behaves as if it never encountered the data to be forgotten (the "forget set"). Exact unlearning, however, presents significant challenges in deep learning models due to their non-linear learning dynamics. A naive implementation of exact unlearning may require retraining the model on a subset of the data that excludes the forget set, which is often prohibitively costly. As a result, the focus has shifted towards approximate unlearning methods, which aim to mimic the behavior of an oracle model - a model retrained from scratch without the forget set. + +Traditional approximate unlearning methods primarily focus on aligning the model's output after unlearning with that of the oracle model. However, we hypothesize, and show empirically, that it may be possible for an unlearning algorithm to appear to have forgotten, if considering only information in the output space, while information about the forget set may in fact remain hidden in intermediate layers and may be recoverable. This is an important setting to consider in case an attacker gains white-box access to the model weights. Motivated by this observation, we study algorithms and metrics that operate directly in the representation space. Interestingly, by visualizing the embedding space (where the model represents data internally), we in fact observe that successful unlearning is often correlated with representations closely resembling the oracle's, suggesting that directly manipulating representations during unlearning is also a promising approach for designing improved algorithms. Conversely, a mismatch in representations can potentially expose the model to a type of membership inference attacks (MIAs), which aim to identify whether a specific data point was part of the training data. + +Motivated by these findings, we introduce SURE (Selective Unlearning via Representation Erasure), a novel unlearning method that shifts the focus from the output space to the representation space. SURE aims to adjust the model's representations to closely match those of the oracle, effectively erasing the influence of the forget set. + +Through extensive empirical evaluation, we demonstrate that SURE not only achieves a superior trade-off between unlearning effectiveness and model utility but also exhibits reduced vulnerability to representation-space MIAs. + +# Contributions. + +- Enhanced Unlearning Quality: SURE demonstrates superior unlearning quality as assessed by standard Membership Inference Attacks (MIAs) and the accuracy difference between the unlearned model and the oracle model. This is further corroborated by comparing the accuracy of unlearned and oracle models on retain, forget, and test sets across various unlearning scenarios, including random, partial class, and class unlearning, as well as scenarios with a forget set containing outliers from different distributions. +- Improved Stability in Unlearning: Addressing a significant limitation of existing unlearning methods, SURE offers enhanced stability. Unlike methods where minor changes in hyperparameters or forget set size can lead to substantial variations in results, SURE demonstrates consistent performance across different forget set sizes, and when averaging results over multiple epochs, ensuring reliability in real-world scenarios. +- Reduced Vulnerability to Representation Space Attacks: SURE effectively mitigates vulnerabilities to MIAs targeting the representation space, a weakness exhibited by some existing methods. This is achieved through the proposed representation erasure technique and is visualized using t-SNE plots, showcasing the distinct advantage of SURE in enhancing privacy. + +# 2 PRELIMINARIES + +# 2.1 DANN: DOMAIN-ADVERSARIAL NEURAL NETWORK + +We start by describing the key framework that we adopt, DANN, as introduced by Ganin et al. (2016). The authors proposed a simple yet powerful idea for unsupervised domain adaptation with the goal of improved performance under domain shifts. The main insight incorporated into DANN is to force the neural network to learn features (representations) that are: (1) discriminative for the task; and (2) domain-invariant, meaning that the features should not reveal whether the input data came from the source domain or the target domain. + +Figure 1 provides a schematic overview of the DANN framework. DANN comprises three key components, each with their own parameterizations: + +- Feature extractor module $G_{f}(\cdot ;\theta_{f})$ : In this work, the backbone of a ResNet-18 is used for this module. +- Label classification module $G_{y}(\cdot;\theta_{y})$ : This module takes feature extractor outputs, and maps them to labels. Here, this is a simple fully-connected classification layer with $K$ neurons, where $K$ is the number of classes. +- Domain regressor module $G_{d}(\cdot;\theta_{d})$ : This is a binary classification component modelling the probability that a given input is from the source vs target domain. In this work we use a two-layer fully connected neural networks for this module. + +Take a feature extractor module trained on some source data, parameterized by $\theta_{f}$ . Informally, the training process for DANN simultaneously optimizes the following: domain regressor module parameters $\theta_{d}$ are trained to distinguish between the source and target features (discrimination task); the feature extractor $\theta_{f}$ is fine-tuned to fool the domain regressor; the label classification module $\theta_{y}$ is trained to maximize performance on the source data (classification task). To fine-tune the feature extractor, a Gradient Reversal Layer (GRL) is inserted between the feature extractor and the domain regressor module. GRL reverses the sign of the gradients flowing from the domain regressor + +![](images/b8d4e170884af2ea3102ee26aacb043f4d38c3761ab6aa02deaeb38ea80e53ca.jpg) +Figure 1: A schematic representation of SURE. The feature extractor is illustrated in blue, classification module in yellow, and domain regressor in red, with the gradient reversal layer in between the feature extractor and domain regressor. Note that a similar schematic representation also captures DANN but with different input distributions. + +back to the feature extractor while, during forward propagation, the GRL functions as an identity transformation. This forces the feature extractor to learn features that make it difficult for the domain regressor to distinguish between the source and target domains. + +# 2.2 UNLEARNING SETTING + +Let $X$ denote the input space, and $Y = \{0, \dots, K - 1\}$ the set of $K$ possible labels. The source training dataset, $D = (x_i, y_i)_{i=1}^N$ , comprises $N$ i.i.d. samples drawn from the data distribution. During unlearning, $D$ is partitioned into two mutually exclusive subsets: a forget set $D_{\mathrm{f}}$ , containing samples for which the model must "unlearn" information; and retain set $D_{\mathrm{r}} = D \setminus D_{\mathrm{f}}$ . + +In addition, we assume access to a validation set $D_{\mathrm{val}}$ . For simplicity of presentation, this validation set is assumed to be of the same size as the forget set. Samples in the validation set were not seen during the original training, may be unlabeled, and are drawn from a target distribution of interest (which could be the same as the source distribution). The set to which each sample $x$ belongs is discerned through the domain labels $d \in \{0,1\}$ (the class label here is irrelevant or may not be given). This label is set to one for the forget set and zero for the validation set. + +We use $D_{\mathrm{val}}^x$ and $D_{\mathrm{f}}^x$ to denote only the input space samples without the labels from the validation and forget sets respectively; $D_{\mathrm{test}}$ refers to the test set. + +# 3 UNLEARNING DEFINITIONS AND ASSOCIATED METRICS + +# 3.1 FROM CLASSICAL NOTIONS TO REPRESENTATION-FOCUSED UNLEARNING DEFINITION + +A perfect unlearning algorithm would ensure a model behaves exactly as if the removed data never existed. This notion can be formalized by drawing parallels to differential privacy (Dwork, 2006). We begin by defining a measure of closeness between distributions: two distributions $\mu, \nu$ are said to be $(\epsilon, \delta)$ -close if $\mu(B) \leq e^{\epsilon} \nu(B) + \delta$ and $\nu(B) \leq e^{\epsilon} \mu(B) + \delta$ for all measurable events $B$ . With this notion of closeness, we can formally define an unlearning algorithm: + +Definition 3.1. An unlearning algorithm $\mathcal{U}$ is an $(\epsilon, \delta)$ -unlearner for a learning algorithm $\mathcal{A}$ , and training set $D$ if, for all subsets $D_{\mathrm{f}} \subseteq D$ of fixed size, the distribution of $\mathcal{A}(D \backslash D_{\mathrm{f}})$ and $\mathcal{U}(\mathcal{A}(D), D_{\mathrm{f}})$ are $(\epsilon, \delta)$ -close. + +This definition captures the essence of unlearning by quantifying the difference between a model trained without the forget set and a model that underwent unlearning the forget set. However, this raises a crucial question: on what output distribution are we measuring this difference? + +In Definition 3.1, the (potentially randomized) learning algorithm $\mathcal{A}$ takes a training set $D$ and produces a distribution over outputs. A common approach is to consider $\mathcal{A}(\cdot)$ as returning a distribution over loss values. If $\theta$ represents the learned weights (which are random variables due to the stochastic nature of training), and $f(\cdot; \theta)$ is the neural network parameterized by $\theta$ , then the distribution + +considered in previous work is the average loss over the forget set: $L(D_{\mathrm{f}}^{y}, f(D_{\mathrm{f}}^{x}; \theta))$ . Alternatively, one could consider the individual losses of each input in $D_{\mathrm{f}}$ . This approach to evaluating unlearning quality was used in the NeurIPS'23 competition (Triantafillou et al., 2024) and in defining the LiRA membership inference attack (Carlini et al., 2022) which was adapted to the context of unlearning in Hayes et al. (2024). + +Another possibility is to directly compare the distributions of the learned weights $(\theta^{\prime}\mathrm{s})$ . However, the high dimensionality and permutation symmetries of neural networks make this comparison challenging, and it remains largely unexplored. A third option involves comparing lower-dimensional representations learned by the network, such as penultimate layer activations, which are usually used for the so-called conjugate kernel computation (e.g., (Hu & Huang, 2021)). + +Due to the data processing inequality, we know that the information signal, and thus the closeness between $\mathcal{A}(D\setminus D_{\mathrm{f}})$ and $\mathcal{U}(\mathcal{A}(D),D_{\mathrm{f}})$ (as measured by $(\epsilon ,\delta))$ , cannot be increased when moving from comparing $\theta$ 's to comparing $L(D_{\mathrm{f}}^{y},f(D_{\mathrm{f}}^{x};\theta))$ . Therefore, comparing unlearned models to retrained models based on losses might provide a more optimistic view of unlearning performance relative to comparisons based on weights. + +In our work, we go beyond comparing losses and evaluate the closeness between $\mathcal{A}(D\setminus D_{\mathrm{f}})$ and $\mathcal{U}(\mathcal{A}(D),D_{\mathrm{f}})$ using various outputs, including learned weights and internal representations, as described in Section 3.2. + +# 3.2 UNLEARNING METRICS + +Efficiency: The primary goal of approximate unlearning is to efficiently and effectively remove the influence of forget samples while achieving performance comparable to exact unlearning. To measure computation efficiency, we report the Relative Run Time (RRT), calculated as the ratio of the time taken to unlearn the samples to the time required for an identical model to retrain from scratch on $D_{\mathrm{r}}$ (oracle). To assess effectiveness, we compare the unlearned model to the oracle using various metrics to determine how closely it mimics the oracle's behavior. Specifically, we use the following metrics: + +Accuracy Gap: We compare the unlearned model with the oracle by evaluating the an accuracy gap, i.e., difference in accuracy between the two models, on different subsets of data, each measuring distinct aspects of unlearning (Liu et al., 2024). Remaining Accuracy (RA), defined as retain set accuracy gap, assesses the fidelity of the unlearning method; Utility, defined as test set accuracy gap, reflects generalization ability; and Unlearning Accuracy (UA), defined as forget set accuracy gap, measures the effectiveness of unlearning. Additionally, for class unlearning scenarios, Class Test Accuracy (CTA) measures test set accuracy gap for the specific class undergoing partial or complete unlearning. + +Canary Unlearning: To further evaluate the effectiveness of our unlearning method, we consider the concept of unintended memorization. Carlini et al. (2019) observed that neural networks may inadvertently memorize out-of-distribution (OOD) training samples, even though these samples, by definition, are unrelated to the target distribution and do not contribute to improving model accuracy. This phenomenon can inadvertently reveal the presence of specific samples in the training data. Specifically, we replace 50 samples from the forget set with OOD samples, referred to as "canaries", as described in (Carlini et al., 2019), creating a mixed forget set comprising both in-distribution (IN) and OOD samples. The original model (before unlearning) is trained using this modified training set, which serves as the starting point for all unlearning methods. This experimental setup allows us to investigate the robustness of our unlearning method in handling unintended memorization and effectively removing the influence of these OOD samples. + +Membership Inference Attack: Membership Inference Attacks (MIAs) serve as a crucial tool for evaluating the effectiveness of unlearning techniques by assessing the extent to which a model has truly "forgotten" the data it was instructed to unlearn. In the unlearning literature, various versions of MIAs have been introduced (Carlini et al., 2022; Golatkar et al., 2021; Goel et al., 2022b). In this work we use two of the commonly employed ones. The first version (MIA-I) involves training a binary classifier to distinguish between samples from the forget set, $D_{\mathrm{f}}$ , and those from the test set, $D_{\mathrm{test}}$ , (Kurmanji et al., 2024). This classifier relies on the loss values produced by the unlearned model when presented with these samples. A higher accuracy of this classifier indicates that the + +![](images/9c3f872a6094a590cfab28ea3bf83c7094d70c8c20b3c151110a198ddfb54117.jpg) +Figure 2: Canary outlier experiment results. The forget set, $D_{\mathrm{f}}$ consists of 1000 samples, 50 of which are completely scrambled (OOD samples), while the remaining samples are randomly selected from the training set (IN samples). Shorter bars reflect narrower accuracy gaps, suggesting that the performance is closer to that of the oracle. The summary plot (far right) displays all the plots from the first four panels stacked on top of each other. + +![](images/83accb81bebac27349f267d751e3df1364e114ad26cf58e1f066c0f6dd4f0993.jpg) + +![](images/5dd6f2aaa48817656b044114e8ca63a279b5af744c31b0f411a2c872c60cd382.jpg) + +![](images/d3f1c2588819ef7dd32937fec224fe9f0eee38acf12df7e3e71153c0cb6adda1.jpg) + +![](images/e3bdcb9bed89d11c0ffa94ad31189f45b2f592b49dc148194fb965e2213f94ac.jpg) + +unlearned model still retains information about the forget set, making it susceptible to membership inference. The second version of MIA (MIA-II) trains a classifier to differentiate between training, $D$ , and test samples, $D_{\mathrm{test}}$ , based on the model's confidence in its predictions (Liu et al., 2024; Jia et al., 2023; Song & Mittal, 2021). This classifier is then used to classify forget samples, $D_{\mathrm{f}}$ , during inference. A higher percentage of forget samples classified as test samples suggests that the model has successfully unlearned the forget set, as its confidence values resemble those of samples it has never seen before. For both types of MIAs, the performance of the unlearned model is compared to that of the oracle model (a model retrained from scratch without the forget set) to assess the effectiveness of the unlearning technique. + +Membership Inference Attacks (MIA) are traditionally conducted as black-box attacks, where the attacker relies solely on the model's outputs to determine whether a specific data point was included in the training set. In this work, we extend MIA to white-box attacks (Sablayrolles et al., 2019), assuming the attacker has access to the model's internal representation space, potentially through its weights. This is achieved by implementing modified versions of the two discussed MIAs. Specifically, the modified version of MIA-I involves training a k-Nearest Neighbors (KNN) classifier for a binary classification task, aimed at distinguishing between the forgotten set, $D_{\mathrm{f}}$ , and the test set, $D_{\mathrm{test}}$ , based on their embedding representations. Conversely, the modified version of MIA-II trains a KNN classifier to distinguish between train samples, $D$ , and test samples, $D_{\mathrm{test}}$ , based on their representations, subsequently applying this trained KNN to classify the forget samples, $D_{\mathrm{f}}$ . While traditional black-box attacks often use logistic regression, we opt for KNN in the embedding space. This choice is motivated by the higher dimensionality of the embedding space compared to the output space, as well as the potentially small size of the forget set, making a non-parametric classifier more suitable. For brevity, we refer to MIA in Representation Space as MIARS. + +Weight Space Comparisons: To assess the post-unlearning representation in the embedding space, one effective method is to compare the weights and/or activations of the penultimate layer to those of the oracle. However, directly comparing these values is complicated by the permutation invariance property (Ainsworth et al., 2022) of neural networks, which arises from the permutation symmetries of the neurons in each layer (Brea et al., 2019). As noted by Nielsen, multiple arrangements of weights can represent the same underlying function, making it challenging to draw meaningful comparisons between the weights of two separately trained networks (Hecht-Nielsen, 1990). To address this issue, we first align the weights of the unlearned model and the oracle using Git Re-Basin, a matching algorithm (Ainsworth et al., 2022) designed to find a set of permutations that minimizes the distance between the two sets of weights/activations. Weights are then compared using Euclidean distance. + +# 4 SURE: SELECTIVE UNLEARNING VIA REPRESENTATION ERASURE + +Most networks designed for classification tasks can be viewed as consisting of two primary modules: the feature-extractor $(G_{f}(\cdot ;\theta_{f}))$ and the classifier $(G_{y}(\cdot ;\theta_{y}))$ . Our proposed unlearning-enabled network, SURE, can be viewed as an extension of the original architecture, augmented with an additional domain regressor module during the unlearning process. Unlike in DANN, however, in SURE the domain regressor will be aiming to distinguish between the forget set, and a validation set that the original model never trained on (instead of the source and target domains). In our + +![](images/c2a98439b205ea6eaeb58a272508a2b6b4ca8407e6f52bf057b0f92b7919596a.jpg) +Figure 3: Results for random, partial class, and full class unlearning. For each benchmark, the plot displays the absolute value of the gap between the unlearned model and the oracle, so the ideal is to be as close to the center as possible. The forget set size is 1000 samples for random unlearning and 100 for partial unlearning. Results are averaged over 5 runs, each with a distinct forget set. To enhance the visual clarity of the plot, we normalized each metric's values to the maximum value. + +experimental framework, the validation set comes from the same distribution as the forget set. The primary goal of the domain regressor module is to assist the network in unlearning in the feature space. This is accomplished by encouraging the network to change learned features in a way that would be discriminative for the primary label classification task, while being non-discriminative when identifying the forget set samples from the validation ones. + +Using a similar training procedure as DANN, SURE fine-tunes the original network features to remove any signature of the forget set examples on the learned representation space while maintaining classification performance. + +Let $L_{y}$ and $L_{d}$ denote the loss functions for training the label classification module and the domain regressor respectively, defined as + +$$ +L _ {d} (\hat {d}, d) = d \log \frac {1}{\hat {d}} + (1 - d) \log \frac {1}{1 - \hat {d}}, \quad \text {a n d} \tag {1} +$$ + +$$ +L _ {y} (\hat {y}, y) = - \sum_ {k} y _ {k} \log \hat {y} _ {k} \tag {2} +$$ + +for arbitrary inputs $(\hat{d}, d)$ and $(\hat{y}, y)$ . The network is then trained by performing back-propagation on the sum of the following two objectives capturing the classification and discrimination tasks: + +$$ +\frac {1}{| D _ {\mathrm {r}} |} \sum_ {(x, y) \in D _ {\mathrm {r}}} L _ {y} \left(G _ {y} \left(G _ {f} \left(x; \theta_ {f}\right); \theta_ {y}\right), y\right), \quad \text {a n d} \tag {3} +$$ + +$$ +\frac {\lambda}{\left| D _ {f} ^ {x} \right|} \sum_ {x \in D _ {f} ^ {x} \cup D _ {\text {v a l}} ^ {x}} L _ {d} \left(G _ {d} \left(\mathcal {R} \left(G _ {f} (x; \theta_ {f})\right); \theta_ {d}\right), \mathbb {1} \left(x \in D _ {\mathrm {f}} ^ {x}\right)\right), \tag {4} +$$ + +where $\mathcal{R}$ represents a so-called gradient reversal layer, such that $\mathcal{R}(x) = x$ on the forward pass and $\mathrm{d}\mathcal{R}(x) / \mathrm{d}x$ is the negative identity matrix on the backward pass. In Appendix C, we describe how this approach defines a saddle-point objective that the domain regressor maximizes and the feature extractor and classification modules minimize. (Note that we assume $|D_f^x| = |D_{\mathrm{val}}^x|$ . If not, the sum in Eq. (4) would need to weigh each term in inverse proportion to the respective size of each set.) + +The feature-extractor and classification modules, as defined in Section 2.1, are initialized with weights learned during pre-training on $D$ . The domain-regressor is initialized randomly. + +# 5 EXPERIMENTS + +In this section, we present our findings showing that our method not only achieves a superior tradeoff between performance and unlearning efficiency compared to existing approaches but also addresses some of the limitations of current unlearning techniques. Specifically, our method mitigates the instability issues seen in previous methods, where results can change significantly with minor adjustments to the unlearning setup-compared to the one used for hyperparameter tuning (Fan et al., + +Table 1: Gap in Top-1 and Top-5 accuracy across all accuracy metrics for the four top performing unlearning methods. For each metric, the best values are highlighted in bold. + +
Top-1 AccuracyTop-5 Accuracy
MetricSUREL1SparseSCRUBRLSUREL1SparseSCRUBRL
ΔRA.46±.10.03±.021.50±.647.82±2.09.42±.072.15±.501.33±.516.37 ±2.24
ΔUA1.0±.633.0±1.102.±2.534.2 ±2.562.52±1.23.0±1.463.88±2.5714.64±2.50
ΔUtility.34±.27.62±.261.26±.30.40±.21.66±.161.48±.141.02±.36.88±.81
ΔCTA.84±.282.04±1.571.68±1.152.34±1.562.41±.962.53±1.072.24±1.233.34±.56
+ +2023). In addition, SURE reduces vulnerabilities to basic membership inference attacks in the representation space that are exhibited by some other methods. We assess our method across three distinct unlearning scenarios: random unlearning, where forget samples are randomly selected from the entire training set; partial class unlearning, where the forget set $(D_{\mathrm{f}})$ is a randomly chosen subset of a specific class; and class unlearning, where the forget set $(D_{\mathrm{f}})$ comprises all samples from a particular class, with the primary focus on the partial class unlearning scenario. + +![](images/f1e8f395df2ad909ceb5d111793e562725d16d5d0a0b2927ba55dfcdf156a886.jpg) + +![](images/0fbe3e0075af24537bd784c12bd28f653b2b2e448211fa344f5ea5967a70eb4f.jpg) + +![](images/67b57d682503340ab3df8bda85fe4ef58b7f5ce5aae6bd23e89ee4476e0b0125.jpg) + +![](images/eee748b867a247d819bda4d20341ad9f5b819f9f911c9ece2be5054b87ae4fbe.jpg) + +![](images/55937dba6397da2c7d947d5e91bea88f71ca27a498f3a60b5382d2269c5f9369.jpg) + +![](images/dc10abeeadda7cc3d626fb1a1e93182e647b7c5dfdc5e3d1d5848c82cc9cf3ea.jpg) + +![](images/f2fcfbc7511c4e2c21e99ee94ed4fadfccc0eebf011abed5df71871fe2c33000.jpg) + +![](images/b9cbb42e28e8672826cdbd859def857d4a023837beb35256ec6c9e5cb07c7235.jpg) + +![](images/351f5b21ea2359af1ab45c80f09e1a659e50998a6be13b2a540d0d05a462bd98.jpg) + +![](images/e5588c8b8e98e939fd12dd41db835ed06834b744a3e96b02dcefed1de9ed0d99.jpg) + +![](images/7d95d37e98101f7667953cde390a50e82b6c54dde2796b2a1820607c83865f93.jpg) +Figure 4: Gap in Top-1 accuracy for forget set sizes of 500 (top), 100 (middle), and 10 (bottom). All three experiments employed the same set of hyperparameters, tuned specifically for the forget set size of 500. A shorter bar (smaller gap) indicates performance is closer to that of the oracle. + +![](images/fab9441a639824849433ceb5fe065bba7c423f56ad3dea8a279dd88eb80d615d.jpg) + +![](images/d0c9759f61fa61d3265659a4ad7973ef970e6480daff4a3de0bf9c33cac1f90c.jpg) + +![](images/6cef8e138a1bc40f4d259f6ffbcd72d9ae2e19f6e0c4c5995b0ca79d8e878652.jpg) + +![](images/aeaae58ab55d2397ec3a3d0b0b369ef0395ffc699d4dd7c4fd1797fa99fe2dd0.jpg) + +# 5.1 EXPERIMENT SETUP + +Stability Experiments: To assess the stability of unlearning methods, we conduct two sets of experiments. First, we report the average accuracy over the top 5 epochs rather than just the best epoch, to ensure that the results are not merely due to an anomalously good epoch. Second, we evaluate the methods across various forget set sizes. + +Baselines: We compare our method with several baselines: Oracle, which retrans the model from scratch using only $D_{\mathrm{r}}$ ; FineTune, which fine-tunes the original model on $D_{\mathrm{r}}$ ; NegGrad, which uses gradient ascent on $D_{\mathrm{f}}$ ; SCRUB (Kurmanji et al., 2024), a student-teacher framework where unlearning is achieved by minimizing KL divergence between the student and teacher for $D_{\mathrm{r}}$ and maximizing it for $D_{\mathrm{f}}$ ; BTeacher (Chundawat et al., 2023), another student-teacher framework with a pre-trained good teacher and a randomly initialized bad teacher, where the unlearning loss is the sum of KL divergence between the student and the good teacher for $D_{\mathrm{r}}$ , and between the student and + +![](images/1334484ffc7bfe39704884d5847734afd0724a5581929fc03b626ba3eaa9b597.jpg) +(a) Weight Distance (L2) between oracle and unlearned model vs Average Error Gap for each unlearning method. + +![](images/bc1d2cf3a5238e55f47a2f3948d06874dec60bdab6e4e5018d2528a406730fba.jpg) +(b) MIARS-I accuracy gap. Attacker is trained to distinguish between forget and test examples. + +![](images/cf6aa5f96c0401f489d542ea230bbae997f10f09024e2f2d985b3254c61deaeb.jpg) +(c) MIARS-II accuracy gap. Attacker is trained to distinguish between training and test examples. +Figure 5: Comparison of the post-unlearning embedding space with that of the oracle using weight comparison (left), MIARS-I attack (middle) and MIARS-II attack (right). The results are plotted across all unlearning methods for the partial class unlearning case with forget size of 10 samples. + +the bad teacher for $D_{\mathrm{f}}$ ; $\mathbf{BE}$ (Chen et al., 2023) introduces a new class for all forget samples, which is then removed; BS (Chen et al., 2023) replaces each forget sample's label with that of a similar image from a different class, based on gradient space similarity; L1Sparse (Liu et al., 2024) applies L1 regularization to the objective function to promote sparsity and facilitate unlearning and finally RL replaces forget sample labels with random ones. + +It is important to note that we faced difficulties achieving good results with NegGrad, BE, and BS due to instability during unlearning. To address this, inspired by Kurmanji et al. (2024), we enhanced these methods by incorporating an additional term into the objective function: cross-entropy loss trained on the $D_{\mathrm{r}}$ . We refer to these enhanced methods as NegGrad+, BE+, and BS+ respectively. + +Implementation Details: Extensive hyperparameter tuning was conducted independently for each method. The primary hyperparameters optimized were the learning rate and $\alpha$ , where $\alpha$ controls the weight of the retain set loss in methods with a weighted loss function that combines losses for the retain and forget sets. Additional hyperparameters, including batch size for the forget set and learning rate scheduling, were also tuned. Optimal hyperparameters for each model were determined through Bayesian optimization to achieve the best unlearning to utility trade-off. The same original model was used across all unlearning methods, trained for 150 epochs with a learning rate of 0.01 and a weight decay of 0.0005, without data augmentation, with the learning rate reduced by an order of magnitude at epochs 80 and 150. For the random unlearning method, hyperparameter tuning was carried out with a forget set comprising 5,000 samples. In contrast, for (partial) class unlearning, the forget set was considered to contain 500 samples. In the (partial) class unlearning experiments, we initially selected one class at random (class 5) and conducted all experiments for that particular class. + +Additional Experiments: To gain further insight into our method's effectiveness, we conduct additional experiments involving different datasets, architectures, benchmarks, and analyses, which are not included here due to space constraints. These results are provided in the appendices. More specifically, we evaluate our method on two additional datasets: CINIC-10 (Darlow et al., 2018), an extension of CIFAR-10 augmented with samples from ImageNet, and Tiny ImageNet (Le & Yang, 2015) in Appendix D. We also test our method on ViT-Small, an example of a larger model architecture, trained on CIFAR-10, as detailed in Appendix D. Additionally, we investigate the effectiveness of our method on a non-privacy-related benchmark, Removing Confusion Kurmanji et al. (2024), in Appendix E. Finally, we conduct a sensitivity analysis to evaluate the method's robustness to slight changes in hyperparameters, as presented in Appendix F. + +# 5.2 EXPERIMENT RESULTS + +In this section, we examine the effectiveness of our method against both oracle and multiple baselines across various unlearning benchmarks. + +![](images/0e7dbb0ee1c6c3c2026810bc142277bf0f3fbb5296b4796e81260e9f61818239.jpg) +Figure 6: t-SNE visualization of the post-unlearning embedding space for the entire CIFAR-10 training set across all unlearned models. The first column compares these embeddings against the original (top) and oracle models (bottom). Cyan represents retain samples from the forget class, blue indicates other retain samples, and red denotes the 10 forget samples from the same class. + +Result reporting: For each experiment, results are presented for the best epoch, defined as the one for which the utility versus privacy trade-off is optimized. Since most baselines, except for SCRUB, did not provide an explicit selection process, we applied our own method to determine the epoch for reporting results. For SCRUB, the best epoch is selected according to the criteria outlined in the original paper (corresponding to the SCRUB-R version of the algorithm). Additionally, unless stated otherwise, the figures and tables in this section do not present the performance of the unlearned models, but rather the gap between their performance and that of the oracle for a particular benchmark. The gap is calculated as the absolute value of their differences; thus, a smaller value indicates better performance of the method. The difference is averaged over five separate runs, with the original model remaining constant while the randomly selected forget set varies. Error bars represent the variance across these five runs. + +Accuracy and MIA: Fig. 3 presents a summary of the results for three key sets of benchmarks: Accuracy metrics, MIAs and RRT, across all three unlearning scenarios and methods (see Appendix B for more detailed plots). Overall, our method outperforms all other unlearning methods in most benchmarks across these scenarios. In the random unlearning scenario, the L1Sparse method closely follows ours. While SURE outperforms L1Sparse overall but one of the benchmarks, L1Sparse achieves better RRT. This discrepancy is primarily due to the additional module in our approach—the domain regressor—which tends to slow down performance compared to the others. Regarding MIA attacks, our results indicate that these attacks are largely ineffective in this scenario, with all methods, including the oracle, yielding similar outcomes. In contrast, we observed that these attacks are more effective in class unlearning scenarios. Notably, our method excels in these scenarios, outperforming all other methods across all accuracy benchmarks and both MIA attacks while maintaining competitive RRT. + +Canary Unlearning: Fig. 2 presents the accuracy results from the canary unlearning experiment. SURE outperforms all other methods across all accuracy measures. It effectively unlearns both the IN and OOD samples while maintaining strong generalizability (Utility) and fidelity (RA). + +Representations and MIARS: The primary motivation for our method is the hypothesis that a correlation exists between the similarity of the post-unlearning model's representation to that of the oracle and the effectiveness of the unlearning process. To investigate this hypothesis, we plot the Average Error Gap against the L2 distance between the penultimate layer's weights of the unlearned model and the oracle, as shown in Fig. 5a. The Average Error Gap is defined as the average absolute value of the difference between the unlearned model and the oracle across five key unlearning benchmarks: UA, Utility, RA, CTA, and MIARS-I. The results clearly indicate a correlation be + +tween the alignment of the unlearned representation with the oracle and the success of unlearning. In addition, our method has the lowest Average Error Gap and second smallest weight distance, After L1Sparse. The t-SNE visualization of the embedding space for all unlearned models, shown in Fig. 6, further suggests a correlation. Notably, the most effective unlearning methods, SURE followed by L1Sparse, exhibit representations that closely resemble the oracle. + +In addition to subpar unlearning performance, discrepancies between the unlearned model and the oracle in the representation space can render the model vulnerable to simple MIAs. The results are shown in Fig. 5b and 5c. As with previous plots, the y-axis indicates the difference in MIA accuracy between the unlearned model and the oracle. The model unlearned with SURE exhibit is most successful in defending both attacks. Also, overall models whose representation is closer to oracle (measured by weight distance) are less susceptible to attacks. + +Stability: For an unlearning method to be effective in real-world applications, it must demonstrate stability. We assess stability by conducting two sets of experiments. In the first set of experiments, we report the top-5 accuracy, calculated as the average accuracy over the top 5 epochs for the four highest-performing unlearning methods, in Table.1. We compare these results to the top-1 accuracy, which reflects the performance from the best epoch. Our findings indicate that SURE outperforms the other three methods overall and across most individual metrics. + +In the second experiment, we perform unlearning for different forget sizes (100 and 10), other than the one used for hyperparameter tuning (500). This experiment assesses how sensitive each unlearning method is to slight changes in the setup for which it is optimized. The results are presented in Fig. 4. While L1Sparse and SCRUB both show performance comparable to SURE for the forget set size used for hyperparameter tuning (top plot), the gap between their performance and that of SURE widens as the difference between the forget set used for unlearning and the original forget set grows (middle and bottom plots). + +# 6 CONCLUSION AND FUTURE WORK + +In this work, we propose SURE, an approximate unlearning method that focuses on unlearning in the representation space rather than solely in the output space. This approach is motivated by our observation that achieving similarity with the oracle in the representation space leads to more successful unlearning. Through extensive experiments, we demonstrate that our method consistently yields superior or comparable results compared to existing techniques across a range of scenarios and for a variety of unlearning benchmarks, including multiple accuracy metrics and two MIAs. Furthermore, we empirically validate that the post-unlearning representation of the unlearned model closely resemble that of the oracle. Finally, our approach exhibits greater stability and reduced susceptibility to white-box attacks in the representation space, enhancing overall model security. + +One observed limitation of our method is the need for more unlearning updates compared to other techniques, especially in the random unlearning scenario where forget samples are randomly selected from any class. A potential solution could be to employ a class-conditional discriminator instead of a generic one, allowing the discriminator to focus on differentiating between class-specific forget and validation samples. While promising, such an approach would come at a cost of training and storing multiple discriminators. + +# ACKNOWLEDGEMENT + +We thank Mila – Quebec AI Institute and Google DeepMind for providing the computational resources that supported this work. We also sincerely appreciate Devin Kwok for his valuable input and for providing the implementation code, both of which were instrumental for our analyses in the representation space. We also thank Katja Filippova for providing feedback on the drafts of this work. Daniel M. Roy is supported by the funding through NSERC Discovery Grant and Canada CIFAR AI Chair at the Vector Institute. + +# REPRODUCIBILITY + +To ensure reproducibility, we provide a comprehensive outline of our experimental setup in Section 5.1, including details on hyperparameters, hyperparameter tuning strategies, datasets, and algorithms. The precise hyperparameter settings are further documented in the Appendix G. Our stability experiments, as detailed in Section 5.2, significantly enhance reproducibility and reveal inherent instability in some previously proposed methods. Furthermore, we address a critical and often overlooked aspect of unlearning algorithms in Section 5.2 by carefully outlining our stopping criteria selection process. Finally, all average numerical values in our experimental results are presented with error bars computed over 5 independent runs. + +# REFERENCES + +Samuel K Ainsworth, Jonathan Hayase, and Siddhartha Srinivasa. Git re-basin: Merging models modulo permutation symmetries. arXiv preprint arXiv:2209.04836, 2022. +Johanni Brea, Berfin Simsek, Bernd Illing, and Wulfram Gerstner. Weight-space symmetry in deep networks gives rise to permutation saddles, connected by equal-loss valleys across the loss landscape. arXiv preprint arXiv:1907.02911, 2019. +Yinzhi Cao and Junfeng Yang. Towards making systems forget with machine unlearning. In 2015 IEEE symposium on security and privacy, pp. 463-480. IEEE, 2015. +Nicholas Carlini, Chang Liu, Ülfar Erlingsson, Jernej Kos, and Dawn Song. The secret sharer: Evaluating and testing unintended memorization in neural networks. In 28th USENIX security symposium (USENIX security 19), pp. 267-284, 2019. +Nicholas Carlini, Steve Chien, Milad Nasr, Shuang Song, Andreas Terzis, and Florian Tramer. Membership inference attacks from first principles. In 2022 IEEE Symposium on Security and Privacy (SP), pp. 1897-1914. IEEE, 2022. +Min Chen, Weizhuo Gao, Gaoyang Liu, Kai Peng, and Chen Wang. Boundary unlearning: Rapid forgetting of deep networks via shifting the decision boundary. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 7766-7775, 2023. +Vikram S Chandawat, Ayush K Tarun, Murari Mandal, and Mohan Kankanhalli. Can bad teaching induce forgetting? unlearning in deep networks using an incompetent teacher. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 37, pp. 7210-7217, 2023. +R Dennis Cook and Sanford Weisberg. Criticism and influence analysis in regression. Sociological methodology, 13:313-361, 1982. +Luke N Darlow, Elliot J Crowley, Antreas Antoniou, and Amos J Storkey. Cinic-10 is not imagenet or CIFar-10. arXiv preprint arXiv:1810.03505, 2018. +Cynthia Dwork. Differential privacy. In International colloquium on automata, languages, and programming, pp. 1-12. Springer, 2006. +Chongyu Fan, Jiancheng Liu, Yihua Zhang, Dennis Wei, Eric Wong, and Sijia Liu. Salun: Empowering machine unlearning via gradient-based weight saliency in both image classification and generation. arXiv preprint arXiv:2310.12508, 2023. +Yaroslav Ganin, Evgeniya Ustinova, Hana Ajakan, Pascal Germain, Hugo Larochelle, François Laviolette, Mario March, and Victor Lempitsky. Domain-adversarial training of neural networks. Journal of machine learning research, 17(59):1-35, 2016. +Shashwat Goel, Ameya Prabhu, and Ponnurangam Kumaraguru. Evaluating inexact unlearning requires revisiting forgetting. CoRR abs/2201.06640, 2022a. +Shashwat Goel, Ameya Prabhu, Amartya Sanyal, Ser-Nam Lim, Philip Torr, and Ponnurangam Kumaraguru. Towards adversarial evaluations for inexact machine unlearning. arXiv preprint arXiv:2201.06640, 2022b. + +Aditya Golatkar, Alessandro Achille, and Stefano Soatto. Eternal sunshine of the spotless net: Selective forgetting in deep networks. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 9304-9312, 2020a. +Aditya Golatkar, Alessandro Achille, and Stefano Soatto. Forgetting outside the box: Scrubbing deep networks of information accessible from input-output observations. In Computer Vision-ECCV 2020: 16th European Conference, Glasgow, UK, August 23-28, 2020, Proceedings, Part XXIX 16, pp. 383-398. Springer, 2020b. +Aditya Golatkar, Alessandro Achille, Avinash Ravichandran, Marzia Polito, and Stefano Soatto. Mixed-privacy forgetting in deep networks. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 792–801, 2021. +Chuan Guo, Tom Goldstein, Awni Hannun, and Laurens Van Der Maaten. Certified data removal from machine learning models. arXiv preprint arXiv:1911.03030, 2019. +Jamie Hayes, Ilia Shumailov, Eleni Triantafillou, Amr Khalifa, and Nicolas Papernot. Inexact unlearning needs more careful evaluations to avoid a false sense of privacy. arXiv preprint arXiv:2403.01218, 2024. +Robert Hecht-Nielsen. On the algebraic structure of feedforward network weight spaces. In Advanced Neural Computers, pp. 129-135. Elsevier, 1990. +Zhengmian Hu and Heng Huang. On the random conjugate kernel and neural tangent kernel. In International Conference on Machine Learning, pp. 4359-4368. PMLR, 2021. +Zachary Izzo, Mary Anne Smart, Kamalika Chaudhuri, and James Zou. Approximate data deletion from machine learning models. In International Conference on Artificial Intelligence and Statistics, pp. 2008-2016. PMLR, 2021. +Jinghan Jia, Jiancheng Liu, Parikshit Ram, Yuguang Yao, Gaowen Liu, Yang Liu, Pranay Sharma, and Sijia Liu. Model sparsification can simplify machine unlearning. arXiv preprint arXiv:2304.04934, 1(2):3, 2023. +Pang Wei Koh and Percy Liang. Understanding black-box predictions via influence functions. In International conference on machine learning, pp. 1885-1894. PMLR, 2017. +Meghdad Kurmanji, Peter Triantafillou, Jamie Hayes, and Eleni Triantafillou. Towards unbounded machine unlearning. Advances in Neural Information Processing Systems, 36, 2024. +Ya Le and Xuan Yang. Tiny imagenet visual recognition challenge. CS 231N, 7(7):3, 2015. +Jiancheng Liu, Parikshit Ram, Yuguang Yao, Gaowen Liu, Yang Liu, PRANAY SHARMA, Sijia Liu, et al. Model sparsity can simplify machine unlearning. Advances in Neural Information Processing Systems, 36, 2024. +Alexandre Sablayrolles, Matthijs Douze, Cordelia Schmid, Yann Ollivier, and Hervé Jégou. White-box vs black-box: Bayes optimal strategies for membership inference. In International Conference on Machine Learning, pp. 5558-5567. PMLR, 2019. +Liwei Song and Prateek Mittal. Systematic evaluation of privacy risks of machine learning models. In 30th USENIX Security Symposium (USENIX Security 21), pp. 2615-2632, 2021. +Eleni Triantafillou, Peter Kairouz, Fabian Pedregosa, Jamie Hayes, Meghdad Kurmanji, Kairan Zhao, Vincent Dumoulin, Julio Jacques Junior, Ioannis Mitliagkas, Jun Wan, et al. Are we making progress in unlearning? findings from the first neurips unlearning competition. arXiv preprint arXiv:2406.09073, 2024. + +![](images/203a2f3390fc663d6007c564d3a5e51c72f72af31e1165e1b7ce8fdf5b7428fe.jpg) +Figure 7: Top-1 accuracy for the three accuracy metrics, as indicated in the title of each plot, during unlearning across all unlearned models for the random unlearning case. In contrast to the results section, the values shown here represent the actual accuracy rather than the gap. The gray dashed line in each plot illustrates the performance of the oracle. + +# A RELATED WORK + +Unlearning was first introduced in (Cao & Yang, 2015) who proposed a forgetting algorithm for statistical query learning. Nowadays, a plethora of unlearning methods have been proposed that attempt to selectively remove the influence of the forget set from the trained model. Golatkar et al. (2020a) introduced an information-theoretic method that uses a Newton step and adds noise to erase the forget set. Golatkar et al. (2020b) proposed NTK forgetting, employing a first-order Taylor expansion to estimate the weights that would have been obtained if training without the forget set. These methods work well under assumptions of stability of SGD. Izzo et al. (2021); Koh & Liang (2017) proposed unlearning algorithms based on influence functions Cook & Weisberg (1982), drawing connections to $(\epsilon, \delta)$ -forgetting (Guo et al., 2019). Goel et al. (2022a) introduced two approximate unlearning methods: Catastrophic Forgetting-k(CF-K) and Exact Unlearning-k (EU-k). In both methods, the first $k$ layers of the pre-trained model are frozen. In CF-K, the remaining layers are fine-tuned on $D_{\mathrm{r}}$ while in EU-k forgetting, they are trained from scratch on $D_{\mathrm{r}}$ . (Chundawat et al., 2023; Kurmanji et al., 2024) proposed teacher-student formulations, where the teacher is the original model and the student is initialized from the teacher and, through specially-crafted distillation procedures (where the teacher is frozen and the student is updated), turns into the unlearned model. In (Chundawat et al., 2023), the student distills retain set knowledge from the teacher, while being encouraged to agree with another "incompetent" teacher on the forget set, whereas SCRUB (Chundawat et al., 2023) considers only one teacher, and encourages the student to agree with it on the retain set while disagreeing with it on the forget set. Chen et al. ((Chen et al., 2023)) adopted a unique strategy for class unlearning by adjusting the decision boundary of the original model to mimic the oracle's decision-making. They introduced two boundary shift methods: Boundary Expanding, which creates a new class for all forget samples that will later be removed, and Boundary Shrinking, which assigns forget samples labels from similar images in different classes. Liu et al. (2024) proposed L1Sparse, adding an L1-penalty into the fine-tuning baseline, after conducting an investigation that shows that sparsity makes unlearning easier. Fan et al. (2023) proposed a localized unlearning approach that targets only a subset of parameters that are deemed-to-be the most critical for the forget set. + +# B UNLEARNING RESULTS FOR CIFAR-10 + +Fig. 7 and Fig. 10 illustrate the accuracy metrics (UA, RA, and Utility, and in the case of class unlearning, CTA) during the unlearning process across different methods for random and partial class unlearning scenarios respectively. The gray dashed line in each plot represents the oracle performance. + +The label Original denotes the original model which serves as the starting point for all unlearning methods. To evaluate the effectiveness of each unlearning method we compare the performance of the unlearned model with that of the oracle on all accuracy metrics. For each unlearning method, the comparison is made at the best epoch. The absolute value of the difference between the unlearned model and the oracle model for each method is displayed in Fig. 8 and Fig. 11. In the random unlearning scenario, the forget set consists of 1,000 samples randomly selected from the entire + +![](images/ae2584e7ca6de723763521a01927679bdb2e197c41280bac6196a1bf05265519.jpg) +Figure 8: Gap in Top-1 accuracy for various accuracy metrics, as indicated in the title of each plot, for the random unlearning scenario with a forget size of 1000, across all unlearned models. Results are reported for the best epoch. + +![](images/eb7af4cbdb27ec72fe4f12caf2d4afc162ad02ecc08760aef38e9ce92b71cb96.jpg) + +![](images/a9747a5c5aebd912b573377160b005b6a5096e1bf46c80fec78b98a4cab17642.jpg) + +![](images/e27cb38edbe684d4e07e7e187e447fc2863df05296cfac187e37e75724b9f73c.jpg) + +training set, while in the partial unlearning scenario, it consists of 100 samples randomly chosen from class 5. + +![](images/942965542f8e4ee7419697a8a16ee031e2495dc35f6e14d621cc0bb1a2d43c78.jpg) +Figure 9: MIA-I (left) and MIA-II (right) in output space across all unlearned models for random unlearning. Red line represents the performance of the oracle. + +![](images/4af94bfb303797579a84087f0a4ee31f02e82a0552312240adb4983fad4970f8.jpg) + +The results for MIA-I and MIA-II in the random and partial unlearning cases are shown in Fig. 9 and Fig. 12, respectively. The red line indicates the attack accuracy on the oracle, serving as a reference point for all unlearning methods. MIA-I does not appear to be effective in the random unlearning scenario, as nearly all unlearning methods seem equally successful at defending against it. However, this is not the case for the partial class unlearning scenario, where our method's success rate is very close to that of the oracle. For MIA-II, our method outperforms the others, showing an overall success rate closest to the oracle's for both random and partial unlearning scenarios, although the results for the random scenario are quite similar across all methods. + +![](images/29eb093aeab0510059dc05d3a365591b616acc715da0485b318eea02071a101a.jpg) +Figure 10: Top-1 accuracy across all unlearned models for the partial class unlearning case with the forget size of 100. Each panel presents a different accuracy metric, as indicated in the title. The gray dashed line in each plot illustrates the performance of the oracle. + +![](images/5636dfc5316a78a3484b5e22b746b7b684ae8285f84dec6c1a596e42e2183048.jpg) + +![](images/dbd24e41145ca44ac9f7d00383ff919973c131836f884075c952d781bf4a114a.jpg) + +![](images/fb4b534e3e7168378d5193b4351ebb600feb7f6947bcea268458b45398027533.jpg) + +![](images/c0b4c82d78b2c46e6f1b4050e1c7e445c4b69dbc20dc3bb7d0dfeeac70ca1275.jpg) +Figure 11: Gap in Top-1 accuracy for various accuracy metrics for the partial unlearning case across all unlearned models. + +![](images/e235aa4e51d5ff38a51480f5988cee92b78fe65b0dbf56773970af04b9bd202a.jpg) + +![](images/7da8cd904ad69e9202f79d497d51bd137ef97539099df2e8f63671ad6eddc44f.jpg) + +![](images/721d782706e26a5f941d12f6283f30ec070be8289bbdea5508ca5deca84b4474.jpg) + +![](images/aced2164862cef049726d9028f26d8e2903ec0a8ac1d941f90f55848275fdc91.jpg) + +![](images/33bcf6ba489efe74117ef9379da2b96d77cf2a53624eed86d25ddcac2e6099fe.jpg) +Figure 12: MIA-I (left) and MIA-II (right) results for the partial class unlearning scenario. Red line represents the performance of the oracle. + +![](images/2658610c4508013a4f9865c2e344f9c4d953cc75b9b98b4656d4226f81f448c6.jpg) + +# C GRADIENT UPDATES + +The purpose of this section is to describe the mathematical optimization problem underlying training. We will see that it is implemented succinctly with a gradient reversal layer (GRL), which is how we describe it in the main paper (Eqs. (3) and (4)). Readers may find one of these two equivalent descriptions more intuitive. + +Define + +$$ +\begin{array}{l} E \left(\theta_ {f}, \theta_ {y}, \theta_ {d}\right) = \frac {1}{\left| D _ {\mathrm {r}} \right|} \sum_ {(x, y) \in D _ {\mathrm {r}}} L _ {y} \left(G _ {y} \left(G _ {f} (x; \theta_ {f}); \theta_ {y}\right), y\right) \\ - \frac {\lambda}{| D _ {f} ^ {x} |} \sum_ {x \in D _ {\mathrm {f}} ^ {x} \cup D _ {\mathrm {v a l}} ^ {x}} L _ {d} (G _ {d} (G _ {f} (x; \theta_ {f})); \theta_ {d}), \mathbb {1} (x \in D _ {\mathrm {f}} ^ {x})). \\ \end{array} +$$ + +This objective is the objective underlying domain adversarial neural networks (Ganin et al., 2016). The first term captures the training error on the classification task and depends on the feature extractor and classification modules. The second term captures the error on the discrimination task, and depends on the feature extractor and domain-regressor modules. + +We optimize this objective for training in SURE. In particular, the goal of domain adversarial training is to find a saddle point, where the optimal parameters for each module satisfy + +$$ +\left(\hat {\theta} _ {f}, \hat {\theta} _ {y}\right) = \underset {\theta_ {f}, \theta_ {y}} {\arg \min } E \left(\theta_ {f}, \theta_ {y}, \hat {\theta} _ {d}\right), \tag {5} +$$ + +$$ +\hat {\theta} _ {d} = \underset {\theta_ {d}} {\arg \max } E \left(\hat {\theta} _ {f}, \hat {\theta} _ {y}, \theta_ {d}\right). \tag {6} +$$ + +![](images/8faa90ea8e7532f8a20ebcea5368f6de5ad20438b7555f48bb88523f09bde8c5.jpg) +Figure 13: Results for the random and partial class unlearning scenarios on CINIC-10. Each benchmark plot illustrates the absolute difference between the unlearned model and the oracle. For random unlearning, the forget set contains 1,000 samples, while for partial unlearning, it consists of 100 samples. The results are averaged over five distinct runs, each with a unique forget set. To enhance visual clarity, the values for each metric have been normalized to their maximum value. + +Following Ganin et al. (2016), we use the following gradient updates to seek a saddle-point: + +$$ +\theta_ {f} \leftarrow \theta_ {f} - \mu \left(\frac {\partial L _ {y}}{\partial \theta_ {f}} - \lambda \frac {\partial L _ {d}}{\partial \theta_ {f}}\right), \tag {7} +$$ + +$$ +\theta_ {y} \leftarrow \theta_ {y} - \mu \left(\frac {\partial L _ {y}}{\partial \theta_ {y}}\right), \tag {8} +$$ + +$$ +\theta_ {d} \leftarrow \theta_ {d} - \mu \lambda \left(\frac {\partial L _ {d}}{\partial \theta_ {d}}\right), \tag {9} +$$ + +where $\mu$ is the learning rate. As discussed in (Ganin et al., 2016), these updates closely resemble SGD updates for a simple feed-forward deep model objective function, with one key difference: the gradients from the domain regressor are subtracted instead of added. This adjustment ensures that, while the regressor's task is to distinguish between forget and validation samples, the feature extractor aims to deceive the regressor. As a result, the feature extractor learns a set of indiscriminative features that cannot differentiate between the forget samples and previously unseen samples. + +![](images/bd8d4009c17286cb59b8d27cd89260a2b5fa6760da2f5a6df4fda6ab7289fce0.jpg) +Figure 14: Results for the random and partial class unlearning scenarios on the Tiny ImageNet dataset. For random unlearning, the forget set contains 1,000 samples, while for partial class unlearning, it contains 400 samples. Results are averaged over five runs, each with a unique forget set. + +![](images/3ee37504804f8c1898f11bec0a38e76e6a1875bdae2f28fe86287e7c2ce12cd0.jpg) + +As noted by Ganin et al. (2016), this modification to the usual update rules is cumbersome to implement naively in most deep learning libraries. To address this, the authors introduced a special "gradient reversal layer" (GRL), which has no associated parameters. During forward propagation, + +![](images/02e3176bab321b19e5a5cf4e72a68a0383f9370db9f01dff354a4e963d661f8c.jpg) +Figure 15: Results for the random and partial class unlearning scenarios using a Small-ViT trained on CIFAR-10. For random unlearning, the forget set contains 1,000 samples, while for partial class unlearning, it contains 10 samples. Results are averaged over five runs, each with a unique forget set. + +the GRL acts as an identity transformation. During backpropagation, however, it takes the gradient from the subsequent layer and reverses its sign (i.e., multiplies it by the negative identity) before passing it to the preceding layer. Because the computation involving the domain regressor weights comes after the GRL, gradient descent minimizes the discrimination task objective in the domain regressor weights. In contrast, the computation involving the feature extractor weights come before the GRL, and so gradient descent maximizes the discrimination task objective in the feature extractor weights. + +In conclusion, if we perform backpropagation of the computation representing sum of Eq. (3) and Eq. (4), the latter of which includes the GRL, we obtain updates identical to Eq. (7). This objective with a GRL can be optimized using standard auto-differentiation tools. + +
MethodRetain ErrForget ErrTest ErrIC RetainFGT RetainIC TestFGT Test
SURE0.08 ± 0.1112.25 ± 4.5722.75 ± 0.310.0 ± 0.00.4 ± 0.490.16 ± 0.0129.4 ± 3.88
SCRUB0.32 ± 0.310.5 ± 2.0325.36 ± 1.010.0 ± 0.04.0 ± 4.860.17 ± 0.0135.6 ± 6.56
L1Sparse0.08 ± 0.1112.25 ± 3.122.18 ± 0.530.0 ± 0.00.2 ± 0.40.15 ± 0.0127.0 ± 3.63
FineTune2.77 ± 0.7329.75 ± 5.3326.89 ± 0.460.07 ± 0.012.6 ± 1.850.32 ± 0.0117.4 ± 3.61
BE+0.0 ± 0.0100.0 ± 0.028.61 ± 0.580.58 ± 0.1225.0 ± 13.610.64 ± 0.0810.0 ± 5.4
BS+2.13 ± 1.9885.75 ± 3.9234.14 ± 1.660.07 ± 0.047.8 ± 15.60.45 ± 0.0213.0 ± 3.22
RL13.65 ± 1.2519.75 ± 3.126.53 ± 0.480.07 ± 0.0160.4 ± 14.360.17 ± 0.0138.4 ± 6.44
NegGrad+0.0 ± 0.0100.0 ± 0.028.6 ± 0.580.5 ± 0.03960.0 ± 0.00.5 ± 0.01000.0 ± 0.0
BTeacher1.17 ± 0.298.75 ± 3.4527.67 ± 0.570.05 ± 0.012.0 ± 2.610.35 ± 0.0111.6 ± 3.2
+ +Table 2: Performance comparison of multiple unlearning methods on the RC task across various metrics. Results are averaged over 5 runs. + +# D MORE UNLEARNING RESULTS + +In this section, we evaluate the performance of our unlearning method across additional datasets and architectures. Specifically, we extend our analysis to CINIC-10, Tiny ImageNet, and ViT-Small, comparing our method against other unlearning approaches across various benchmarks. + +In Fig. 13, we compare the performance of our method on the CINIC-10 dataset against all other baselines across various unlearning metrics, similar to Fig. 3. The figure displays the absolute difference between the unlearned model and the oracle for all accuracy metrics (UA, RA, Utility, and CTA), as well as for RRT and MIAs. We observe that SURE outperforms most benchmarks in both scenarios. Consistent with the results from CIFAR-10, L1Sparse ranks as the second-best performing method, occasionally surpassing SURE on a few metrics. + +In addition, we evaluate the performance of our method on the Tiny ImageNet dataset, comparing it against three other top-performing methods identified in previous experiments: L1Sparse, FineTune, and SCRUB. The results, presented in Fig. 14, show that our method outperforms all others across all benchmarks except for RRT, consistent with our findings on CIFAR-10 and CINIC-10. For random + +![](images/28cae4bc0b2481ccd63fcb6801caa57e9acdf764b7e44e9eacbd5a4332d70a94.jpg) + +![](images/4dc4004a4a998b7f97e38d1d6a959a769bd6df1150a8a41c80256898a073c82b.jpg) + +![](images/f3a531bb034f09a124c7edfe7e7835fd0de0416b1d1a51054541a334fcc58946.jpg) +Figure 16: Heatmaps illustrating the sensitivity analysis of SURE's performance with respect to the two key hyperparameters: $lr$ and $\alpha$ , across the four main accuracy benchmarks: UA (top-left), Utility (top-right), RA (bottom-left), and VTA (bottom-right). Each heatmap shows performance variations relative to the best-tuned hyperparameter settings. + +![](images/38c49c175fa0615eb0cb11618f8daaa5b82edeba5700cdedd16c077f62495b8a.jpg) + +unlearning, we were unable to identify a set of hyperparameters for FineTune and SCRUB that achieved successful unlearning. Both methods fail to achieve the desired unlearning-utility tradeoff, as they completely unlearn all information. In the case of class unlearning, FineTune and SCRUB are more competitive; however, the primary competition remains between our method (SURE) and L1Sparse, with SURE outperforming L1Sparse in nearly all benchmarks. + +To explore the effectiveness of our method on larger models, we tested its performance using ViT-Small across both random and class unlearning scenarios. Results are presented in Fig. 15. For random unlearning, our method demonstrates a slight edge over L1Sparse. We were unable to find hyperparameters for SCRUB that enabled effective unlearning, as models using this method failed to achieve the desired unlearning-utility tradeoff. For class unlearning, the results are more balanced: our method outperforms L1Sparse on 4 out of 7 benchmarks, while L1Sparse outperforms on the remaining 3. These findings highlight the robustness of our approach, while also demonstrating that pruning-based methods like L1Sparse can remain competitive in specific settings. + +# E UNLEARNING RESULTS FOR THE RESOLVING CONFUSION TASK + +In this section, we apply our unlearning method to the Resolving Confusion (RC) task introduced in Kurmanji et al. (2024). This task serves as an example of a non-privacy-related application where unlearning is beneficial for resolving confusion between classes caused by a portion of the model's original training set being mislabeled. + +We evaluated the performance of SURE on the RC task using a ResNet-18 model trained on the CIFAR-10 dataset. We compared our method against all eight competing unlearning methods introduced in the paper. In our implementation, the forget set consists of a randomly selected subset $(1\%)$ of training samples from classes 0 and 1, which are intentionally mislabeled as the opposite class. Given that all samples in the forget set are mislabeled, the objective of unlearning in this context is to resolve the induced confusion. An unlearning method is considered successful if, at the end of the unlearning process, the forget samples are correctly relabeled while maintaining the model's performance on the test and retain sets. + +To evaluate the performance of our unlearning method, we report the forget error (Forget Err) alongside the test (Test Err) and retain errors (Retain Err). An effective method is expected to exhibit low + +error values across all three metrics. In addition to these, and in line with the original paper Kurmanji et al. (2024), we also report the Interclass Confusion Error (IC-ERR) and FGT-ERR. Unlike the previously introduced errors, which count all types of incorrect predictions, IC-ERR specifically measures errors involving the confused classes (in our setup, class 0 and class 1). It counts instances where a sample from class 0 is predicted to belong to any other class, and vice versa for class 1. FGT-ERR, on the other hand, is even more specific, as it counts only cases where a sample from class 0 is mislabeled as class 1, or a sample from class 1 is mislabeled as class 0. IC-ERR and FGT-ERR are reported for both retain and test sets. Our results presented in Table 2 demonstrate that SURE is the top-performing approach, alongside L1Sparse, yielding similar results for many metrics. + +# F SENSITIVITY ANALYSIS OF HYPERPARAMETERS + +To assess the sensitivity of our method's performance to variations in its hyperparameter values, we conducted a sensitivity analysis focusing on the two most critical hyperparameters: $\alpha$ and the learning rate $(lr)$ . This analysis was carried out for the class unlearning scenario using a ResNet-18 model trained on the CIFAR-10 dataset, with a forget set consisting of 100 samples. Using a grid search approach, we varied each parameter's value within a range of $-20\%$ to $+20\%$ around its optimal value and analyzed the resulting changes across multiple unlearning benchmarks. + +The observed performance variations are illustrated in Fig. 16. The figure presents four heatmaps, each providing a sensitivity analysis for a specific accuracy benchmark as a function of these hyperparameters. These heatmaps highlight the differences in performance relative to the model trained with the best hyperparameter configuration from tuning. The visualizations reveal the sensitivity to each parameter and their interactions, showing that, compared to other methods (see Section 4 and Figure 2 in Fan et al. (2023)), SURE demonstrates low sensitivity to hyperparameter variations. For comparison, Fan et al. (2023) reports fluctuations of approximately 40 points in the average performance gap between the unlearned model and the oracle for the Influence Unlearning method. While there is always room for improvement, our results suggest that sensitivity to hyperparameters is not a significant limitation of SURE. + +# G UNLEARNING HYPERPARAMETERS + +The optimized values for all hyperparameters across unlearning methods in both random and partial class unlearning scenarios are presented in Table 3 and Table 4, respectively. The main hyperparameters we tuned in this work are the learning rate, $lr$ , $\alpha$ (retain set loss weight in unlearning methods with a weighted objective function), forget set batch size, and the learning rate scheduling, defined by the epoch at which the learning rate drops. + +
ParamsSUREL1SparseSCRUBFineTuneBteachBE+BS+RLNegGrad+
rl.045.0045.0008.0043.035.0092.0079.0671.0072
α.807.00044.997-.954.982.998-.991
fbatch size256322562568128128328
lr decay1010188814101418
+ +Table 3: Optimized hyperparameters for the random unlearning scenario: learning rate $(lr)$ , $\alpha$ , forget set batch size (fbatch size), and the epoch for learning rate decay $(lr$ decay). + +
ParamsSUREL1SparseSCRUBFineTuneBteachBS+BE+RLNegGrad+
lr.0372.0038.001.0025.0320.0047.0058.0014.0694
α.4241.00024.6089-.3453.9841.4639-.9981
fbatch size128256323264812864256
lr decay41861881241018
+ +Table 4: Optimized hyperparameters for the (partial) class unlearning scenario: learning rate $(lr)$ , $\alpha$ , forget set batch size (fbatch size), and the epoch for learning rate decay $(lr$ decay). \ No newline at end of file diff --git a/ICLR/2025/Selective Unlearning via Representation Erasure Using Domain Adversarial Training/images.zip b/ICLR/2025/Selective Unlearning via Representation Erasure Using Domain Adversarial Training/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..4b4a401201001a53de2a2582cbd4e90fd2069044 --- /dev/null +++ b/ICLR/2025/Selective Unlearning via Representation Erasure Using Domain Adversarial Training/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1eb50eecf8b5e77da9b067bc07e5769ef64dde7eda03b493f8bb9e8390a953c4 +size 981937 diff --git a/ICLR/2025/Selective Unlearning via Representation Erasure Using Domain Adversarial Training/layout.json b/ICLR/2025/Selective Unlearning via Representation Erasure Using Domain Adversarial Training/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..506a706cf67f26e56b764eeb1b3eaa056368e6de --- /dev/null +++ b/ICLR/2025/Selective Unlearning via Representation Erasure Using Domain Adversarial Training/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ad4b1621810980fa23c8e30670a87000570c7d8e39948440db9904d2f7830676 +size 535690 diff --git a/ICLR/2025/Self-Attention-Based Contextual Modulation Improves Neural System Identification/1b641983-90d5-4476-84b1-8cac37f2a2d8_content_list.json b/ICLR/2025/Self-Attention-Based Contextual Modulation Improves Neural System Identification/1b641983-90d5-4476-84b1-8cac37f2a2d8_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..41aae36ea0e98381a379e6e20e5117c260a9042e --- /dev/null +++ b/ICLR/2025/Self-Attention-Based Contextual Modulation Improves Neural System Identification/1b641983-90d5-4476-84b1-8cac37f2a2d8_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:649ba38fd9b27f8a924f86b71db6f47a73f7003066115c982265e017fabdabf9 +size 118509 diff --git a/ICLR/2025/Self-Attention-Based Contextual Modulation Improves Neural System Identification/1b641983-90d5-4476-84b1-8cac37f2a2d8_model.json b/ICLR/2025/Self-Attention-Based Contextual Modulation Improves Neural System Identification/1b641983-90d5-4476-84b1-8cac37f2a2d8_model.json new file mode 100644 index 0000000000000000000000000000000000000000..5c0ff4296f2d52f8bb34b1a6224fa25f1f40cda4 --- /dev/null +++ b/ICLR/2025/Self-Attention-Based Contextual Modulation Improves Neural System Identification/1b641983-90d5-4476-84b1-8cac37f2a2d8_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:23a703d34441eca3adebf3051ccb33b67e738574ade05fb28619f9087960a138 +size 136291 diff --git a/ICLR/2025/Self-Attention-Based Contextual Modulation Improves Neural System Identification/1b641983-90d5-4476-84b1-8cac37f2a2d8_origin.pdf b/ICLR/2025/Self-Attention-Based Contextual Modulation Improves Neural System Identification/1b641983-90d5-4476-84b1-8cac37f2a2d8_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..c428e774983be6c90711892e885fec9412fdd1e9 --- /dev/null +++ b/ICLR/2025/Self-Attention-Based Contextual Modulation Improves Neural System Identification/1b641983-90d5-4476-84b1-8cac37f2a2d8_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fb17510df7b90bfe218b2482b2fc79dde281b1bd24630bc2951f9b8257a7e627 +size 8567429 diff --git a/ICLR/2025/Self-Attention-Based Contextual Modulation Improves Neural System Identification/full.md b/ICLR/2025/Self-Attention-Based Contextual Modulation Improves Neural System Identification/full.md new file mode 100644 index 0000000000000000000000000000000000000000..0fcf2d16d8d414edb309d569da04c0236da42b47 --- /dev/null +++ b/ICLR/2025/Self-Attention-Based Contextual Modulation Improves Neural System Identification/full.md @@ -0,0 +1,384 @@ +# SELF-ATTENTION-BASED CONTEXTUAL MODULATION IMPROVES NEURAL SYSTEM IDENTIFICATION + +Isaac Lin $^{1,*}$ , Tianye Wang $^{2}$ , Shang Gao $^{1,3}$ , Shiming Tang $^{2}$ , Tai Sing Lee $^{1,*}$ + +$^{1}$ Carnegie Mellon University, $^{2}$ Peking University, $^{3}$ Massachusetts Institute of Technology + +# ABSTRACT + +Convolutional neural networks (CNNs) have been shown to be state-of-the-art models for visual cortical neurons. Cortical neurons in the primary visual cortex are sensitive to contextual information mediated by extensive horizontal and feedback connections. Standard CNNs integrate global contextual information to model contextual modulation via two mechanisms: successive convolutions and a fully connected readout layer. In this paper, we find that self-attention (SA), an implementation of non-local network mechanisms, can improve neural response predictions over parameter-matched CNNs in two key metrics: tuning curve correlation and peak tuning. We introduce peak tuning as a metric to evaluate a model's ability to capture a neuron's top feature preference. We factorize networks to assess each context mechanism, revealing that information in the local receptive field is most important for modeling overall tuning, but surround information is critically necessary for characterizing the tuning peak. We find that self-attention can replace posterior spatial-integration convolutions when learned incrementally, and is further enhanced in the presence of a fully connected readout layer, suggesting that the two context mechanisms are complementary. Finally, we find that decomposing receptive field learning and contextual modulation learning in an incremental manner may be an effective and robust mechanism for learning surround-center interactions. + +# 1 INTRODUCTION + +Feedforward CNN models have been shown in recent years to be an effective approach for modeling and predicting visual cortical neurons' responses to arbitrary natural images (Kindel et al., 2019; Klindt et al., 2018; Yamins & DiCarlo, 2016; Zhang et al., 2018; Cadena et al., 2017; Kriegeskorte, 2015). Neurons in the primate visual cortex are known to have extensive horizontal and feedback recurrent connections for mediating contextual modulation (Felleman & van Essen, 1991; Markov et al., 2014). Feedforward CNNs can model the influence of contextual surround on the responses of the neurons via two mechanisms: successive convolution layers and a fully connected layer. Both can make the neural model's responses sensitive to the global image context, outside the traditional classical receptive fields of neurons. Interestingly, feedforward CNNs trained on image classification tasks have also been shown to exhibit contextual surround modulation similar to what has been observed in neurophysiological experiments of the visual cortex (Pan et al., 2023). + +In the context of neural prediction, it is found that including the inductive bias of horizontal recurrent connections can improve the model's predictive capabilities (Zhang et al., 2022). On the other hand, replacing a feedforward layer with a recurrent layer using a Markovian local kernel consistently outperforms parameter-matched feedforward CNNs in image classification tasks (Han et al., 2018; Nayebi et al., 2018; Kubilius et al., 2019; Zhang et al., 2022). However, contextual modulation in the visual cortex involves both the near surround and far surround, with the far surround being mediated by top-down feedback (Angelucci & Bressloff, 2006; Sasaki et al., 2013; Shushruth et al., 2013). In addition, there is evidence that contextual modulation is dynamic and highly image-dependent, suggesting a flexible gating mechanism (Coen-Cagli et al., 2015). Such a flexible gating mechanism can be modeled by a combination of Gaussian mixture models, implemented either by image-dependent normalization (Coen-Cagli et al., 2015) or by non-local networks and the self-attention mechanism + +![](images/d82096aa8ae9d3d4e8a04a1800ccb34c5bb03ec553f6eba1175ac9f1c4b0537a.jpg) +Figure 1: Macaque neuronal response dataset. (a) shows a two-photon image with cells. (b) shows a feedforward CNN used to model neural response. (c) shows the response of one neuron to $50\mathrm{k}$ stimuli and the top 20 images that induced the strongest responses. On average, less than $0.5\%$ of the images induce responses greater than half peak height. Each site contains around 300 neurons. + +in deep learning (Fei & Pitkow, 2022). Self-attention-based architectures such as vision transformers have recently been shown to be effective in modeling mouse V1 neurons (Li et al., 2023). However, these networks are complex, with a large number of layers and multiple attention heads, making it difficult to isolate the key factors contributing to their superior performance. + +In this paper, we demonstrate that adding a simple self-attention layer to a CNN can improve neural response prediction of macaque V1 neurons in two performance metrics: overall tuning correlation and prediction of the tuning peaks. To understand the mechanism driving improvement, we assessed the three contextual modulation mechanisms - convolutions, self-attention, and a fully connected readout layer. We found that while the three context mechanisms complement one another to produce the best prediction performance when used in conjunction, they have specific roles. First, the fully connected layer plays a critical role in peak prediction, though self-attention can further enhance it. Second, self-attention alone can improve tuning curve correlation but is insufficient for predicting the response peak or top feature preference. Third, the performance of self-attention models can be greatly enhanced when the feedforward receptive fields are learned first before learning the self-attention network, rather than learning everything from scratch simultaneously. The benefits of such incremental learning (van de Ven et al., 2022; Cotton et al., 2020) in this context suggest that decoupling the learning of feedforward receptive fields and recurrent connections may allow the system to learn a richer representation of contextual modulation. These observations provide new insights into the underlying computational mechanisms of cortical development and organization. + +# 2 RELATED WORKS + +Modeling neural response prediction Feedforward deep neural networks have proven effective in modeling and predicting neural responses in early visual brain areas (Kindel et al., 2019; Klindt et al., 2018; Yamins & DiCarlo, 2016; Zhang et al., 2018; Cadena et al., 2017; Kriegeskorte, 2015). However, the brain's visual areas contain abundant recurrent connections that are essential for generating neural responses (Felleman & van Essen, 1991; Markov et al., 2014; Spoerer et al., 2020). Incorporating biologically-inspired simple recurrent circuits, in the form of a Markov network, into convolutional neural networks has been shown to enhance efficiency compared to purely feedforward models, achieving similar performance in image classification and neural prediction tasks (Zhang et al., 2022). In the context of neural prediction, the underlying assumption is that the closer a model can replicate the neural computation mechanisms responsible for a real neuron's response, the more accurate the model's predictive capabilities become (Pogoncheff et al., 2023; Willeke et al., 2023; Li et al., 2019). + +![](images/b25a658029942dc3c8efe7b4360351982d9f5c436db8b1d7903fb4874c23acfd.jpg) +Figure 2: Models explored in this study. Models are constructed from two types of convolutional processing blocks (CPB): $\alpha$ CPB and $\beta$ CPB. $\alpha$ CPB has a fixed convolution kernel size $= 5$ and max pooling kernel size $= 2$ . $\beta$ CPB takes an input convolution kernel size of $k$ , and has no pooling layers. The two final layer readout modes are fully connected (FCL) and center hypercolumn only (CTL). Self-attention (SA) takes as input a boolean $\gamma$ that determines whether the value (V) vector is transformed; if $\gamma = \text{True}$ then V is mapped, otherwise V is equal to the input. All models with SA utilize single-headed attention. (a) shows the feedforward CNN. (b) shows the feedforward CNN augmented with self-attention. (c) shows the receptive field CNN. (d) shows the receptive field CNN augmented with self-attention. + +Self-attention for global dependencies Self-attention mechanisms have recently become a pivotal component in deep learning models, especially in natural language processing and increasingly in computer vision tasks (Vaswani et al., 2023; Zhao et al., 2020; Kim et al., 2021). In computer vision, self-attention performs a weighted average operation based on the context of input features, computing attention weights dynamically through a similarity function between pixel pairs (Vaswani et al., 2023; Pan et al., 2022). This flexibility allows the attention module to adaptively focus on different regions and capture informative features (Ramachandran et al., 2019). Self-attention has also been integrated with CNNs to enhance their representational power (Pan et al., 2022; Yang et al., 2019; Bello et al., 2020). By enabling CNNs to consider distant spatial relationships within an image, self-attention improves the network's ability to capture global context. This mechanism overcomes the limitations of traditional CNNs, which primarily concentrate on local features because of their convolutional structure. Taking the complementary properties of convolution and self-attention, the benefits of each paradigm can be extracted by integrating the two and using self-attention to augment convolution modules (Dai et al., 2021; Yang et al., 2019; Pan et al., 2022; Cordonnier et al., 2020). + +# 3 APPROACH + +In this study, we developed a set of deep learning models to model V1 neural response to natural images, with the goal of evaluating the potential roles of the self-attention mechanism in neural computation within the visual cortex. We obtained a dataset of neuronal responses measured using two-photon imaging with GCaMP5 from two awake behaving macaque monkeys performing + +a fixation task, consisting of 302 neurons from monkey 1 (M1S1) and 299 neurons from monkey 2 (M2S1), in response to $34\mathrm{k}$ and $49\mathrm{k}$ natural images extracted from the ImageNet dataset. The neurons were recorded across five days and tracked anatomically based on landmarks as well as based on their responses to 200 fingerprint images tested every day. The images were presented in sequence with $500~\mathrm{ms}$ per image preceded by 1500 second of blank screen. The $30\mathrm{k}-50\mathrm{k}$ images in the training set were presented once, and the 1000 images in the validation set were tested once with 10 repeats. Images were $100 \times 100$ pixels, with $30 \times 30$ pixels for 1 degree visual angle. The eccentricity of the recording sites were 3 degrees and 1.79 degrees, with average receptive field sizes (diameters at half-height) of about 0.75 and 0.5 degrees, respectively. We preprocessed the dataset before modeling, and notably downsampled input images to $50 \times 50$ pixels, yielding $15 \times 15$ pixels per degree visual angle. The receptive fields of neurons from each $1\mathrm{mm} \times 1\mathrm{mm}$ site (the scale/size of a hypercolumn) in macaque monkeys exhibited significant overlap. These fields were mapped using oriented bars or SmoothGrad feature attribution on our deep learning model. The standard deviation of the receptive field centers, all of which are contained within the center hypercolumn of our CNN models, was less than 1 pixel (1/15 degree visual angle). See Appendix A.1 for more details of the macaque experimental setup. + +# 3.1 AUGMENTING FEEDFORWARD CNNS WITH SELF-ATTENTION + +First, we investigate whether incorporating self-attention into the baseline feedforward CNN model enhances neural response prediction performance. See Appendix A.3 for comparisons to other established models. + +Baseline feedforward model (ff-CNN) See Figure 2(a) for the architecture. The baseline feedforward model is comprised of two $\alpha$ -convolutional processing blocks ( $\alpha$ CPB) and two $\beta$ -convolutional processing blocks ( $\beta$ CPB), followed by a fully connected readout layer (FCL). A single ff-CNN model is fitted to each neuron. All models described below are derived from this baseline model. Given a grayscale input image with dimensions $50 \times 50$ pixels, the two $\alpha$ CPB layers with a $5 \times 5$ kernel encode the input of size $(1 \times 50 \times 50)$ into $(c \times 9 \times 9)$ where $c \in \mathbb{N}$ is the number of channels ( $c \in \{30, 32\}$ in this study). The center hypercolumn of the post- $\alpha$ CPB encoding has a centered effective receptive field size of $13 \times 13$ pixels. In other words, the center hypercolumn of the latent representation after the $\alpha$ CPB layers will have a $13 \times 13$ (or $0.8 \times 0.8$ degree visual angle) feedforward receptive field at the center of input $50 \times 50$ image. Note that the real neurons' receptive fields are contained inside the receptive field of the center hypercolumn. In the baseline model, the two $\alpha$ CPB layers are followed by two $\beta$ CPB layers with $3 \times 3$ kernels to further expand the effective receptive field of the center-hypercolumn. Finally, ff-CNN has access to the entirety of the input image in the final layer as the readout has full access to all the hypercolumns. Thus, the baseline ff-CNN CNN has two modalities of contextual modulation - convolutions and a fully connected layer. + +Feedforward with self-attention model (ff+sa-CNN) See Figure 2(b) for the architecture. We augment ff-CNN with a self-attention layer immediately after the last $\alpha$ CPB and before the first $\beta$ CPB. This placement enables SA to act on an adequately convolved feature representation, but also be further modulated by convolutions before feeding into the final layer. We compare the performance of ff+sa-CNN against that of ff-CNN, controlling the parameter counts to be roughly equal by decreasing the number of channels, which is maintained throughout entire model, from $c = 32$ in the baseline CNNs to $c = 30$ in the self-attention models to account for the addition of the SA layer. In the context of contextual modulation, ff+sa-CNN intermixes spatial interactions and inter-channel mixing across SA, the posterior $\beta$ CPBs, and the FCL. + +# 3.2 FACTORIZING THE CONTEXTUAL MODULATION MECHANISMS + +There are three mechanisms in $\mathrm{ff} + \mathrm{sa} - \mathrm{CNN}$ mediating contextual interactions. We proceed to factorize $\mathrm{ff} + \mathrm{sa} - \mathrm{CNN}$ by removing the contextual modulation contributed by the $\beta$ CPBs and the FCL to assess the standalone capability of SA in incorporating surrounding context. This is accomplished by constructing a baseline receptive field model and a model where only SA is mediating horizontal connections. + +Baseline receptive field model (rf-CNN) See Figure 2(c) for the architecture. We first construct the rf-CNN model, which is devoid of contextual modulation, by subtracting from ff-CNN: the kernel size in the $\beta$ CPBs are changed from $3\times 3$ to $1\times 1$ and the fully connected layer is changed to look only at the center hypercolumn (CTL). The $1\times 1$ convolutions perform no spatial expansion before feeding into the CTL. Thus, rf-CNN is making predictions solely based on the center hypercolumn receptive field produced by the $\alpha$ CPBs, which covers the center $13\times 13$ pixels of the input image. + +Receptive field with self-attention model (rf+sa-CNN) See Figure 2(d) for the architecture. We add self-attention to rf-CNN prior to the $\beta$ CPBs to construct rf+sa-CNN. Self-attention is the only mechanism for incorporating surround context in this model. The parameter counts are again controlled by reducing the number of channels from $c = 32$ (in rf-CNN) to $c = 30$ (see Appendix A.10 for more details). We compare the performance of the two receptive field models, alongside the feedforward models. Note that in rf+sa-CNN, $\gamma$ is False in the SA layer, meaning SA operates exclusively on the horizontal spatial interactions between hypercolumns without any inter-channel mixing. In contrast, $\gamma$ is True in the SA layer of ff+sa-CNN, which allows channel mixing in SA. Channel mixing potentially provides self-attention greater flexibility (see Appendix A.9 and A.11). + +# 3.3 INIncrementAL LEARNING: FACTORIZING THE LEARNING PROCESS + +Discussed in Section 4.2, comparing the four models above reveals that contextual modulation introduced in rf+sa-CNN via SA did not produce better performance relative to rf+CNN, despite ff+sa-CNN having clear performance improvements over ff-CNN. This is not due to the difference in channel mixing (the $\gamma$ parameter in SA). We hypothesize that bottle-necking all the gradient signals solely through the center hypercolumn during backpropagation makes it difficult for the network to properly learn the $\alpha$ CPB layers and the SA layer simultaneously. Thus, we investigate an incremental learning paradigm where we allow the receptive fields of the $\alpha$ CPBs to be learned before incorporating any context mechanisms. We then incrementally add and learn a self-attention layer followed by a fully connected readout layer. + +The following progression of models, rf-CNN, $\mathrm{rf + sa - CNN^{*}}$ , and $\mathrm{ff + sa - CNN^{*}}$ (as shown in Figure 3), incrementally expands the capacity of contextual modulation. An important distinction between incremental models and models shown in Figure 2, marked by $^{*}$ , is a $1\times 1$ kernel in the $\beta$ CPB, which maintains channel mixing but removes further spatial integration through convolution. rf-CNN (shown in Figure 3(a) or Figure 2(c)) has information only from the center receptive field. $\mathrm{rf + sa - CNN^{*}}$ (shown in Figure 3(b)) uses only the self-attention mechanism for contextual modulation. $\mathrm{ff + sa - CNN^{*}}$ (shown in Figure 3(c)-(d)) has the same surround-center modulation as $\mathrm{rf + sa - CNN^{*}}$ from self-attention, but allows spatial integration of the global context by changing the CTL to FCL at the end. As hori + +![](images/98aabd7f24f26ce0eab1cfa07aa60dcf70a928b4d13c412a1b394c1713254f89.jpg) +Figure 3: Incremental learning models. (a) shows the baseline receptive field CNN, equivalent to Figure 2(c). (b) shows (a) augmented with SA and learned incrementally; the $\alpha$ CPBs are taken from (a) and the remaining layers are learned. The * denotes slight modification from $rf + sa - CNN$ , Figure 2(d), namely $\gamma$ is changed to True. (c), (d) show the result of replacing the CTL in (b) with a FCL, and learned incrementally; (c) freezes only the center hypercolumn in the FCL $(FC_{1})$ whereas (d) allows the FCL to learn freely $(FC_{2})$ . (c) and (d) have all other layers taken from (b). The * denotes slight modification from $ff + sa - CNN$ , Figure 2(b), namely $k$ in $\beta$ CPB is changed to $k = 1$ . (Simul.) models are equivalent in architecture, except all blocks are learned. + +![](images/5fed0a9fa5ba400d2646485e1794924ba55c7013457de274e01ae5ba38d9b434.jpg) +Figure 4: Neuronal tuning curves of ff-CNN, ff+sa-cnn, and rf-CNN. Pearson correlation does not reflect peak tuning. Despite rf-CNN having the better correlation, it is clear that ff+sa-CNN is able to capture the peak significantly better, at the cost of a noisier overall tuning. Example shown is M1S1 neuron 238. See Appendix A.8 for population averages. + +![](images/4daefaab07bef05f8d21bf9fae7a53d503fd2fd13f656fee33c15ae5fa4757d7.jpg) + +![](images/ef80e6ad2e6315554786e26a2577591ab599bec9a84d279839be0240531e8fde.jpg) + +zontal connections in the visual cortex are known to mature after the development of the receptive fields, we designed an incremental learning setup where rf-CNN first learns the receptive fields, then $\mathrm{rf} + \mathrm{sa} - \mathrm{CNN}^*$ (Incr.) learns a self-attention layer only after rf-CNN has already learned the αCPB receptive fields. Finally, $\mathrm{ff} + \mathrm{sa} - \mathrm{CNN}^*$ (Incr.FC1) and $\mathrm{ff} + \mathrm{sa} - \mathrm{CNN}^*$ (Incr.FC2) inherit the receptive fields and self-attention structures of $\mathrm{rf} + \mathrm{sa} - \mathrm{CNN}^*$ , but differ in the change to a FCL readout. Models labelled (Incr.) are learned incrementally as such, and models labelled (Simul.) are traditionally trained simultaneously. + +# 3.4 HYPERPARAMETER SELECTION AND MODEL TRAINING + +Rather than splitting the evaluation set for hyperparameter selection, we partitioned our population of neurons to select hyperparameters (training and architectural). We fine-tuned, by experimenting with batch size, learning rate, epochs, number of layers, number of channels per layer, etc., model hyperparameters on a subset of 50 neurons using a relatively coarse grid search. We list key training hyperparameters here: (1) batch size = 50, (2) learning rate = 0.001, (3) optimizer = Adam, (4) loss = MSE, (5) epochs = 50. Training and computations were performed on an in-house computing cluster with GPU (NVIDIA V100 or similar) nodes. Training hyperparameters were held constant across all models. Architectural hyperparameters were held constant across layers shared between models. We do not optimize hyperparameters for models other than the baseline ff-CNN. + +The primary objective of this project is to demonstrate that self-attention can enhance neural response prediction relative to the baseline feedforward CNN, despite hyperparameters being optimized only for the baseline model. Since we show that $\text{ff} + \text{sa} - \text{CNN}$ improves upon $\text{ff} - \text{CNN}$ in both evaluation metrics (see Section 4.1), further hyperparameter optimization is unnecessary for our objective. Instead, we are interested in understanding the reason behind this improvement. The other models tested in this study are architectural subsets of the $\text{ff} + \text{sa} - \text{CNN}$ , designed to dissect their contributions to its success. We do not anticipate any derivative models outperforming $\text{ff} + \text{sa} - \text{CNN}$ , justifying holding hyperparameters constant across models for fair comparison. + +# 3.5 MODEL EVALUATION METRICS + +To quantify performance, models were evaluated on two criteria, Pearson correlation and peak tuning index. Pearson correlation represents the overall tuning similarity between a model's predicted responses and the real neuron's recorded responses. The peak tuning index is used to quantify how well a model can predict and match in magnitude the strongest responses recorded by the real neuron. This lets us evaluate how well a model can discriminate between, as well as model the response magnitude of, images that are strongly excitatory and images that incite a weak response. + +Pearson correlation: The Pearson correlation (CORR.) is taken between neuron responses and model-predicted responses. Pearson correlation is a standard measure for evaluating neural response prediction. Other established measures, including FEV, $r_{er}^{2}$ , and $\mathrm{CC}_{\mathrm{norm}}^{2}$ (Willeke et al., 2022; Cadena et al., 2017; Pospisil & Bair, 2021; Zhang et al., 2022), were used as well and yielded similar results to Pearson correlation (see Appendix A.3 and A.4). + +In this paper, we explored a set of measures to assess the peak of a neuronal tuning curve. In our macaque V1 dataset, we found that neurons exhibit sharp stimulus selectivity, consistent with findings from Tang et al. (2018a,b), reinforcing the diversity and complexity of V1 neurons (see Appendix A.2). We found that Pearson correlation and other standard metrics (see Appendix A.4) are successful in measuring a model's fit to the overall tuning curve, but often fail to represent the peak tuning preference of neurons, of which is a key aspect of a neuronal function. For example, Figure 4 demonstrates that while $\text{rf} + \text{CNN}$ achieves a higher correlation in approximating the overall tuning curve compared to $\text{ff} + \text{sa} - \text{CNN}$ , the latter outperforms in modeling the neuron's tuning curve peak. To address this issue, we developed two new metrics to better assess a model's ability to capture the peak tuning of neurons. + +Peak tuning index: The peak tuning index (PT) is a membership metric of the strongest predictions above a threshold determined by the top $1\%$ of real responses. PT can be roughly interpreted as the percentage of the peak that a model captures, under a magnitude prior. The index is calculated as: + +$$ +\mathrm {PT} = \frac {\# \text {of top} 1 \% \text {predictions} \geq \min (\text {top} 1 \% \text {real responses})}{\# \text {of responses in the top} 1 \%} \times 100 \% +$$ + +PT is divided into $\mathrm{PT}_J$ and $\mathrm{PT}_S$ , based on how # of top $1 \%$ predictions is defined. $\mathrm{PT}_J$ is when predictions are jointly rank ordered with respect to the real responses. $\mathrm{PT}_S$ is when predictions are separately rank ordered independently of the real responses. $\mathrm{PT}_J$ is a stricter measure. Note that because we train with MSE loss, models are incentivized to minimize the absolute difference between predictions and real responses, rather than match the curvature of the tuning curve. This minimizes the risk of PT being misrepresentative due to lateral shifts in the tuning curve. + +# 4 RESULTS + +# 4.1 SELF-ATTENTION IMPROVES NEURAL RESPONSE PREDICTION + +Table 1: Average Pearson correlation and peak tuning metrics for models trained on M1S1 and M2S1. Correlation SEM = 0.009 was consistent across models and monkeys. Despite rf-CNN unexpectedly outperforming $\text{rf} + \text{sa} - \text{CNN}$ , the difference is recovered when $\text{rf} + \text{sa} - \text{CNN}$ is trained incrementally (see Section 4.2). + +
ModelM1S1M2S1
CORR.Δ ff-CNNPTJPTSCORR.Δ ff-CNNPTJPTS
ff-CNN0.3930.0%3.3 ± 0.55.6 ± 0.90.4770.0%8.6 ± 0.916.2 ± 1.6
ff+sa-CNN0.416+6.6%5.6 ± 0.610.5 ± 1.10.491+3.3%11.5 ± 0.923.5 ± 1.8
rf-CNN0.420+8.6%1.1 ± 0.31.8 ± 0.50.496+4.3%4.4 ± 0.66.6 ± 1.0
rf+sa-CNN0.414+7.2%0.7 ± 0.21.0 ± 0.30.486+2.4%3.4 ± 0.55.1 ± 0.8
+ +We compared the performance of the $\mathrm{ff + sa - CNN}$ model to the parameter-matched baseline $\mathrm{ff - CNN}$ model and found that incorporating self-attention significantly improved correlation and both peak tuning metrics (see first two rows of Table 1). This indicates that self-attention enhances modeling of both the overall tuning and peak tuning aspects of the neurons, with consistent results across both monkeys. + +It is important to note that the ff-CNN center hypercolumn at the readout layer has a receptive field much larger than the real neuron's receptive field, due to successive convolutions in the $\alpha$ CPBs and $\beta$ CPBs. Additionally, the fully connected readout layer also incorporates long-range spatial dependencies. Thus, the self-attention layer in $ff + sa - CNN$ acts as an additional mechanism for modeling horizontal connections, and provides additional performance benefits. + +To better understand the role of self-attention in contextual modulation, we constructed a baseline receptive field model, rf-CNN, that is devoid of all contextual modulation mechanisms. rf-CNN's CTL readout only uses the center-hypercolumn of the convolved feature space to make predictions. Note that the feedforward receptive field of the center hypercolumn after the two $\alpha$ CPBs is a centered $13\times 13$ pixel portion of the input image. Moreover, between the $\alpha$ CPB layers and the CTL layer, + +the size of the center hypercolumn receptive field does not expand due the the $1\times 1$ kernel in the $\beta$ CPBs. This means that predictions are being made solely based on the center $13\times 13$ pixels, which corresponds roughly to the real neuron's receptive field. + +Surprisingly, we found that rf-CNN achieved the highest correlation, indicating that models focusing primarily on the classical receptive field offer the best fit to the overall tuning curve (see Table 1). However, correlation fails to reflect the model's shortcomings in fitting the peak of the tuning curve. Table 1 also reveals that while rf-CNN has the highest Pearson correlation, it performs worse at capturing the tuning peak compared to $\text{ff} + \text{sa} - \text{CNN}$ and $\text{ff} - \text{CNN}$ . Thus, we conclude that contextual modulation plays a crucial role in peak tuning, and that the three mechanisms in $\text{ff} + \text{sa} - \text{CNN}$ for integrating surround information are complementary. + +# 4.2 DISSECTING CONTEXTUAL MODULATION MECHANISMS VIA INIncrementAL LEARNING + +We explore the relative contributions of the different contextual modulation mechanisms. Specifically, we first ask: Is self-attention alone sufficient to model contextual modulation? To answer this question, we added SA to rf-CNN to produce rf+sa-CNN. We found that without posterior $\beta$ CPBs and a FCL, the self-attention in rf+sa-CNN is not useful. In fact, the performance is worse than rf-CNN in overall correlation and both peak tuning metrics (see Table 1). This result is somewhat unexpected, as the addition of self-attention in ff+SA-CNN does improve upon ff-CNN. It is possible that the spatial integration mechanisms in the $\beta$ CPBs, along with the FCL, are necessary to provide sufficient pathways for backpropagating the gradients during learning, so that both the $\alpha$ CPB receptive fields and self-attention kernels can be properly learned. + +To test this hypothesis, we explored whether an incremental learning approach, where different network components are learned sequentially, could yield a model that performs on par with $\text{ff} + \text{sa} - \text{CNN}$ . We show that learning the feedforward kernels in the $\alpha$ CPBs first, followed by learning the self-attention layer, and finally the fully connected layer, can nearly match the performance of $\text{ff} + \text{sa} - \text{CNN}$ . This indicates that although the spatial integration by $\beta$ CPBs contributes to performance, the self-attention layer plays a more critical role in capturing horizontal interactions crucial for modeling peak tuning. + +Table 2: Average Pearson correlation for models incrementally and simultaneously trained on M1S1 and M2S1. Correlation SEM = 0.009 was consistent across models and monkeys. + +
Model (Training Method)M1S1M2S1
CORR.Δrf-CNNCORR.Δrf-CNN
rf-CNN(Simul.)0.4200.0%0.4960.0%
rf+sa-CNN*(Simul.)0.409-2.6%0.480-3.2%
rf+sa-CNN*(Incr.)0.421+0.6%0.493-0.3%
ff+sa-CNN*(Simul.)0.416-0.8%0.490-0.7%
ff+sa-CNN*(Incr.FC1)0.430+3.0%0.494-0.1%
ff+sa-CNN*(Incr.FC2)0.414-1.3%0.488-1.1%
+ +Incremental learning offers a valuable approach for accurately assessing the potential of each spatial integration mechanism in modeling contextual modulation and evaluating their interdependence in generating an effective model. Table 2 highlights several incremental models we tested and their relative improvements. Learning the receptive field first, followed by learning self-attention in $\mathrm{rf} + \mathrm{SA} - \mathrm{CNN}^*$ (Incr.), outperforms learning both simultaneously in $\mathrm{rf} + \mathrm{SA} - \mathrm{CNN}^*$ (Simul.) (see second and third rows of Table 2, and middle pairs in Figure 5). This supports our hypothesis that jointly learning the $\alpha$ CPB receptive fields and self-attention may overwhelm the system when gradients are constrained to propagate through the center hypercolumn alone. Incremental learning can improve $\mathrm{rf} + \mathrm{sa} - \mathrm{CNN}^*$ to match the peak prediction performance of $\mathrm{rf} - \mathrm{CNN}$ , but not beyond. This suggests that, when used with a CTL readout, self-attention alone is insufficient to fully capture peak tuning. + +Table 2 and Figure 5 demonstrate that removing the CTL restriction-i.e., allowing the readout to access information from the hypercolumns in the final convolutional layer via FCL, as in $\text{ff} + \text{sa} - \text{CNN}^*$ enables the network to nearly match the performance of the $\text{ff} + \text{sa} - \text{CNN}$ . $\text{ff} + \text{sa} - \text{CNN}^*$ is named as such because it closely resembles $\text{ff} + \text{sa} - \text{CNN}$ , with the only difference being that $\text{ff} + \text{sa} - \text{CNN}^*$ + +![](images/af0f509e1f66ea2963ecaf83a96b78d6c6aaa3cc98882eb692d91a5e091e84f7.jpg) +Average $\mathsf{PT}_I$ Index for M1S1 + +![](images/3d0ac6d866f07bacf665183f8a0a836fb4328450d70883ea0ee1e8ed08b2e5d2.jpg) +Average $\mathsf{PT}_S$ Index for M1S1 + +![](images/e91f60e772939c3e7ea0cc946843e94bf8564e49e7713d75854d4006ce24833c.jpg) +Average PT Index for M2S1 +Figure 5: Average peak tuning indices for incrementally and simultaneously trained models. Top row: bar charts for M1S1. Bot row: bar charts for M2S1. Left col: average $\mathrm{PT}_J$ values. Right col: average $\mathrm{PT}_s$ values. Error bars are SEM. + +![](images/38fc6d14ec0028b2ebce65c9fd9d55ac709b27754595383fbdbdb2e1d7dea52f.jpg) +Average $\mathsf{PT}_5$ Index for M2S1 + +ence being the use of a $1 \times 1$ kernel instead of a $3 \times 3$ kernel in the $\beta$ CPBs. These findings suggest that posterior convolution is not required for spatial integration after the self-attention layer when the model is trained incrementally. + +A reoccurring observation is that focusing on receptive field information tends to improve overall correlation, while emphasizing contextual information enables the network to better model peak tuning. This pattern is evident when comparing rf-CNN with ff+sa+CNN in Table 1. A similar contrast exists between ff+sa-CNN* (Incr.FC $_1$ ) and ff+sa-CNN* (Incr.FC $_2$ ). In ff+sa-CNN* (Incr.FC $_1$ ), the model inherits the center hypercolumn weights and then learns the surrounding hypercolumn contributions through the FCL. In contrast, ff+sa-CNN* (Incr.FC $_2$ ) learns the weights of all hypercolumns in the FCL simultaneously. While the former excels in correlation, the latter performs better in peak tuning. This suggests that the receptive field is most important towards overall tuning, whereas surround-center interactions are key to capturing peak tuning. + +The $\mathrm{ff} + \mathrm{sa} - \mathrm{CNN}^*$ models saw an improvement in $\mathrm{PT}_J$ and $\mathrm{PT}_S$ over the $\mathrm{rf} + \mathrm{sa} - \mathrm{CNN}^*$ models. This suggests that either the fully connected layer (FCL) plays a critical role in predicting peak responses, or that constraining the readout to the center hypercolumn (CTL) in $\mathrm{rf} + \mathrm{sa} - \mathrm{CNN}^*$ limits error propagation to the self-attention block during training. As a result, self-attention may be inadequately learned in these cases, impairing the model's ability to effectively implement contextual modulation. + +# 4.3 INIncremental LEARNING EMPHASIZES THE CONTRIBUTION OF THE CLASSICAL RECEPTIVE FIELD + +A well-established neurophysiological principle is that stimuli within the classical receptive field of V1 neurons are the primary driver of neural responses, while the contextual surround modulates them. We found that when the entire network is trained simultaneously, as in $\text{ff} + \text{sa} - \text{CNN}^*$ (Simul.), performance is weaker and the network does not follow this principle. However, with incremental learning, the center hypercolumn develops into the dominant contributor, as observed in $\text{ff} + \text{sa} - \text{CNN}^*$ ( $\text{Incr. FC}_1$ ) and $\text{ff} + \text{sa} - \text{CNN}^*$ ( $\text{Incr. FC}_2$ ). Figure 6 illustrates + +![](images/fa0b05c8f9592328c38c6888e85b918502a34dd5c9857eec7445f468b4c519b1.jpg) +Figure 6: Average FCL decomposition of $\mathsf{ff} + \mathsf{sa} - \mathsf{CNN}^*$ when trained differently. The center contribution (green) and the total surround contribution (pink) sum to the prediction tuning curve (orange). Plots are rank ordered with respect to predicted responses. Averages are calculated by plotting rank ordered decomposed tuning curve for each neuron, then averaging across each image. Individual contributions from hypercolumns can be found in Appendix A.5. + +![](images/74b345962e3de60097c3e3937ac09060ec9cbee694af4d89f803a23dd19664b3.jpg) + +![](images/fd50b1f76349aa73d2ac92bb617f59e335d17d0b71f7d582948ee34d5d19130e.jpg) + +trates the sum of connection weights from the readout, showing that in $\text{ff+sa-CNN}^*$ (Simul.), weights are evenly distributed, whereas in the incrementally trained models, the center hypercolumn, corresponding to the classical receptive field, is emphasized. Incremental learning fosters this center-surround division and modulation, yielding interpretable performance benefits. + +# 5 DISCUSSION + +CNNs are widely used and effective models for visual cortical neurons, and they inherently include two mechanisms for contextual modulation: successive convolutions and a fully connected layer, which allow the global image context to be accessible to the readout. In this paper, we demonstrated that augmenting CNN models of cortical neurons with self-attention enhances predictions of both the overall tuning curve and the tuning peak. Self-attention, resembling three-way interactions in probabilistic graphical models, facilitates flexible center-surround interaction via contextual variables (Coen-Cagli et al., 2015; Fei & Pitkow, 2022). This provides additional flexibility and complementary benefits to the CNN's inherent context mechanisms. While large-scale transformer models with multiple attention heads have achieved state-of-the-art performance in modeling mouse V1 neurons by capturing long-range dependencies (Li et al., 2023), our work isolates the contributions of self-attention in CNNs for modeling horizontal circuits, highlighting the dependencies and complementarity among three different mechanisms of contextual modulation. + +Several key findings emerged from this work that advance our understanding of cortical computation and neural codes. First, we found that focusing on receptive field information, as in rf-CNN, yields the highest Pearson correlation, alongside other standard measures (see Appendix A.4), for overall neuronal tuning curves (see Table 1). This suggests that the classical receptive field is the primary driver behind a neuron's overall response. Our incremental learning experiments further reinforce the importance of focusing first on the bottom-up information within the classical receptive field before learning the horizontal connections (see Figure 6). Second, we demonstrated that contextual modulation is important for predicting the peak response, with self-attention playing a pivotal role. A trade-off, however, exists between the receptive field and surround modulation: RF-centric models fit overall tuning curves more accurately, while increased contextual surround modulation enhances peak tuning, though often at the expense of overall tuning correlation. Incremental learning, which fosters a strong receptive field bias, may help even out this trade-off. This is consistent with neurophysiological evidence supporting a dominant classical receptive field and weaker surround modulation, with recurrent connections being fine-tuned after receptive field development. + +A recent CNN-based model of mouse V1 neurons revealed that the most excitable images often involve stimulus features outside the receptive fields that are consistent with the concept of pattern completion (Fu et al., 2023). Similarly, we found that models capable of capturing peak tuning display interpretable contextual modulation, such as association fields and pattern completion, within the self-attention module (see Appendix A.6). Additionally, incorporating a self-attention layer improved models' data efficiency (see Appendix A.7). Further theoretical and experimental investigations are needed to characterize and evaluate the interactions facilitated by self-attention, so as to uncover how these mechanisms may be implemented by biological circuits. + +# 6 ETHICS STATEMENT + +All procedures involving animals for generating the data of this paper were in accordance with the Guide for the Institutional Animal Care and Use Committee (IACUC) of Peking University. + +# 7 ACKNOWLEDGMENTS + +This work was supported by NSF CISE RI 1816568 and NIH R01 EY030226-01A1 awarded to Tai Sing Lee. Isaac Lin is supported by the NSF REU supplement of RI 1816568. Imaging data was produced by Tianye Wang and Shiming Tang with the support of STI2030-Major Projects 2022ZD0204600, National Natural Science Foundation of China U1909205, and funds from the Peking-Tsinghua Center for Life Sciences to ST. + +# REFERENCES + +Alessandra Angelucci and Paul C. Bressloff. Contribution of feedforward, lateral and feedback connections to the classical receptive field center and extra-classical receptive field surround of primate v1 neurons. In S. Martinez-Conde, S.L. Macknik, L.M. Martinez, J.-M. Alonso, and P.U. Tse (eds.), Visual Perception, volume 154 of Progress in Brain Research, pp. 93-120. Elsevier, 2006. doi: https://doi.org/10.1016/S0079-6123(06)54005-1. URL https://www.sciencedirect.com/science/article/pii/S0079612306540051. +Irwan Bello, Barret Zoph, Ashish Vaswani, Jonathon Shlens, and Quoc V. Le. Attention augmented convolutional networks, 2020. +Santiago A. Cadena, George H. Denfield, Edgar Y. Walker, Leon A. Gatys, Andreas S. Tolias, Matthias Bethge, and Alexander S. Ecker. Deep convolutional models improve predictions of macaque v1 responses to natural images. 2017. doi: 10.1101/201764. +James Cavanaugh, Wyeth Bair, and J Movshon. Nature and interaction of signals from the receptive field center and surround in macaque v1 neurons. Journal of neurophysiology, 88:2530-46, 12 2002. doi: 10.1152/jn.00692.2001. +Ruben Coen-Cagli, Adam Kohn, and Odelia Schwartz. Flexible gating of contextual influences in natural vision. Nature neuroscience, 18, 10 2015. doi: 10.1038/nn.4128. +Jean-Baptiste Cordonnier, Andreas Loukas, and Martin Jaggi. On the relationship between self-attention and convolutional layers, 2020. +R. James Cotton, Fabian H. Sinz, and Andreas S. Tolias. Factorized neural processes for neural processes: $k$ -shot prediction of neural responses, 2020. +Zihang Dai, Hanxiao Liu, Quoc V. Le, and Mingxing Tan. Coatnet: Marrying convolution and attention for all data sizes, 2021. +Yicheng Fei and Xaq Pitkow. Attention as inference with third-order interactions. In NeurIPS '22 Workshop on All Things Attention: Bridging Different Perspectives on Attention, 2022. URL https://openreview.net/forum?id=s2VfopqfA0. +Daniel J. Felleman and David C. van Essen. Distributed hierarchical processing in the primate cerebral cortex. *Cerebral cortex*, 1 1:1-47, 1991. URL https://api-semanticscholar.org/CorpusID:9334496. +Jiakun Fu, Suhas Shrinivasan, Kayla Ponder, Taliah Muhammad, Zhuokun Ding, Eric Wang, Zhiwei Ding, Dat T. Tran, Paul G. Fahey, Stelios Papadopoulos, Saumil Patel, Jacob Reimer, Alexander S. Ecker, Xaq Pitkow, Ralf M. Haefner, Fabian H. Sinz, Katrin Franke, and Andreas S. Tolias. Pattern completion and disruption characterize contextual modulation in mouse visual cortex. bioRxiv, 2023. doi: 10.1101/2023.03.13.532473. URL https://www.biorxiv.org/content/early/2023/03/14/2023.03.13.532473. +Kuan Han, Haiguang Wen, Yizhen, Di Fu, Eugenio Culurciello, and Zhongming Liu. Deep predictive coding network with local recurrent processing for object recognition, 2018. +Kyungmin Kim, Bichen Wu, Xiaoliang Dai, Peizhao Zhang, Zhicheng Yan, Peter Vajda, and Seon Kim. Rethinking the self-attention in vision transformers. In 2021 IEEE/CVF Conference on Computer Vision and Pattern Recognition Workshops (CVPRW), pp. 3065–3069, 2021. doi: 10.1109/CVPRW53098.2021.00342. +William F. Kindel, Elijah D. Christensen, and Joel Zylberberg. Using deep learning to probe the neural code for images in primary visual cortex. Journal of Vision, 19(4):29-29, 04 2019. ISSN 1534-7362. doi: 10.1167/19.4.29. URL https://doi.org/10.1167/19.4.29. +David A. Klindt, Alexander S. Ecker, Thomas Euler, and Matthias Bethge. Neural system identification for large populations separating "what" and "where", 2018. + +Nikolaus Kriegeskorte. Deep neural networks: A new framework for modeling biological vision and brain information processing. Annual Review of Vision Science, 1 (Volume 1, 2015):417-446, 2015. ISSN 2374-4650. doi: https://doi.org/10.1146/annurev-vision-082114-035447. URL https://www.annualreviews.org/content/journals/10.1146/annurev-vision-082114-035447. +Jonas Kubilius, Martin Schrimpf, Kohitij Kar, Ha Hong, Najib J. Majaj, Rishi Rajalingham, Elias B. Issa, Pouya Bashivan, Jonathan Prescott-Roy, Kailyn Schmidt, Aran Nayebi, Daniel Bear, Daniel L. K. Yamins, and James J. DiCarlo. Brain-like object recognition with high-performing shallow recurrent anns, 2019. +Bryan M. Li, Isabel M. Cornacchia, Nathalie L. Rochefort, and Arno Onken. V1t: large-scale mouse v1 response prediction using a vision transformer, 2023. URL https://arxiv.org/abs/2302.03023. +Ming Li, Fang Liu, Hongfei Jiang, Tai Sing Lee, and Shiming Tang. Long-term two-photon imaging in awake macaque monkey. Neuron, 93(5):1049-1057.e3, 2017. ISSN 0896-6273. doi: https://doi.org/10.1016/j.neuron.2017.01.027. URL https://www.sciencedirect.com/science/article/pii/S089662731730051X. +Zhe Li, Wieland Brendel, Edgar Y. Walker, Erick Cobos, Taliah Muhammad, Jacob Reimer, Matthias Bethge, Fabian H. Sinz, Xaq Pitkow, and Andreas S. Tolias. Learning from brains how to regularize machines, 2019. +Konstantin-Klemens Lurz, Mohammad Bashiri, Konstantin Willeke, Akshay Jagadish, Eric Wang, Edgar Y. Walker, Santiago A Cadena, Taliah Muhammad, Erick Cobos, Andreas S. Tolias, Alexander S Ecker, and Fabian H. Sinz. Generalization in data-driven models of primary visual cortex. In International Conference on Learning Representations, 2021. URL https://openreview.net/forum?id=Tp7kI90Htd. +Nikola T. Markov, Julien Vezoli, Pascal Chameau, Arnaud Falchier, René Quilodran, Cyril Huissoud, Camille Lamy, Pierre Misery, Pascale Giroud, Shimon Ullman, Pascal Barone, Colette Dehay, Kenneth Knoblauch, and Henry Kennedy. Anatomy of hierarchy: Feedforward and feedback pathways in macaque visual cortex. Journal of Comparative Neurology, 522(1):225-259, 2014. doi: https://doi.org/10.1002/cne.23458. URL https://onlinelibrary.wiley.com/doi/abs/10.1002/cne.23458. +Aran Nayebi, Daniel Bear, Jonas Kubilius, Kohitij Kar, Surya Ganguli, David Sussillo, James J. DiCarlo, and Daniel L. K. Yamins. Task-driven convolutional recurrent models of the visual system, 2018. +Xu Pan, Annie DeForge, and Odelia Schwartz. Generalizing biological surround suppression based on center surround similarity via deep neural network models. bioRxiv, 2023. doi: 10.1101/2023.03.18.533295. URL https://www.biorxiv.org/content/early/2023/03/19/2023.03.18.533295. +Xuran Pan, Chunjiang Ge, Rui Lu, Shiji Song, Guanfu Chen, Zeyi Huang, and Gao Huang. On the integration of self-attention and convolution, 2022. +Galen Pogoncheff, Jacob Granley, and Michael Beyeler. Explaining v1 properties with a biologically constrained deep learning architecture, 2023. +Dean A. Pospisil and Wyeth Bair. The unbiased estimation of the fraction of variance explained by a model. PLOS Computational Biology, 17(8):1-36, 08 2021. doi: 10.1371/journal.pcbi.1009212. URL https://doi.org/10.1371/journal.pcbi.1009212. +Prajit Ramachandran, Niki Parmar, Ashish Vaswani, Irwan Bello, Anselm Levskaya, and Jonathon Shlens. Stand-alone self-attention in vision models, 2019. +Kosei Sasaki, Elizabeth C. Cropper, Klaudiusz R. Weiss, and Jian Jing. Functional differentiation of a population of electrically coupled heterogeneous elements in a microcircuit. Journal of Neuroscience, 33(1):93-105, 2013. ISSN 0270-6474. doi: 10.1523/JNEUROSCI.3841-12.2013. URL https://www.jneurosci.org/content/33/1/93. + +S. Shushruth, Lauri Nurminen, Maryam Bijanzadeh, Jennifer M. Ichida, Simo Vanni, and Alessandra Angelucci. Different orientation tuning of near- and far-surround suppression in macaque primary visual cortex mirrors their tuning in human perception. The Journal of Neuroscience, 33: 106–119, 2013. URL https://api-semanticscholar.org/CorpusID:13650720. +Courtney J Spoerer, Tim C Kietzmann, Johannes Mehrer, Ian Charest, and Nikolaus Kriegeskorte. Recurrent neural networks can explain flexible trading of speed and accuracy in biological vision. bioRxiv, 2020. doi: 10.1101/677237. URL https://www.biorxiv.org/content/early/2020/08/21/677237. +Shiming Tang, Yimeng , Zhihao Li, Ming Li, Fang Liu, Hongfei Jiang, and Tai Sing Lee. Large-scale two-photon imaging revealed super-sparse population codes in the v1 superficial layer of awake monkeys. eLife, 7:e33370, apr 2018a. ISSN 2050-084X. doi: 10.7554/eLife.33370. URL https://doi.org/10.7554/eLife.33370. +Shiming Tang, Tai Sing Lee, Ming Li, Yimeng, Yue Xu, Fang Liu, Benjamin Teo, and Hongfei Jiang. Complex pattern selectivity in macaque primary visual cortex revealed by large-scale two-photon imaging. Current Biology, 28(1):38-48.e3, 2018b. ISSN 0960-9822. doi: https://doi.org/10.1016/j.cub.2017.11.039. URL https://www.sciencedirect.com/science/article/pii/S096098221731521X. +Gido van de Ven, Tinne Tuytelaars, and Andreas Tolias. Three types of incremental learning. Nature Machine Intelligence, 4:1-13, 12 2022. doi: 10.1038/s42256-022-00568-3. +Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need, 2023. +Konstantin F. Willeke, Paul G. Fahey, Mohammad Bashiri, Laura Hansel, Christoph Blessing, Konstantin-Klemens Lurz, Max F. Burg, Santiago A. Cadena, Zhiwei Ding, Kayla Ponder, Taliah Muhammad, Saumil S. Patel, Kaiwen Deng, Yuanfang Guan, Yiqin Zhu, Kaiwen Xiao, Xiao Han, Simone Azeglio, Ulisse Ferrari, Peter Neri, Olivier Marre, Adrian Hoffmann, Kirill Fedyanin, Kirill Vishniakov, Maxim Panov, Subash Prakash, Kishan Naik, Kantharaju Narayanappa, Alexander S. Ecker, Andreas S. Tolias, and Fabian H. Sinz. Retrospective on the sensorium 2022 competition. In Marco Ciccone, Gustavo Stolovitzky, and Jacob Albrecht (eds.), Proceedings of the NeurIPS 2022 Competitions Track, volume 220 of Proceedings of Machine Learning Research, pp. 314-333. PMLR, 28 Nov-09 Dec 2022. URL https://proceedings.mlr.press/v220/willeke23a.html. +Konstantin F. Willeke, Kelli Restivo, Katrin Franke, Arne F. Nix, Santiago A. Cadena, Tori Shinn, Cate Nealley, Gabrielle Rodriguez, Saumil Patel, Alexander S. Ecker, Fabian H. Sinz, and Andreas S. Tolias. Deep learning-driven characterization of single cell tuning in primate visual area v4 unveils topological organization. bioRxiv, 2023. doi: 10.1101/2023.05.12.540591. URL https://www.biorxiv.org/content/early/2023/05/13/2023.05.12.540591. +Daniel Yamins and James J. DiCarlo. Using goal-driven deep learning models to understand sensory cortex. Nature Neuroscience, 19:356-365, 2016. URL https://api-semanticscholar.org/CorpusID:16970545. +Baosong Yang, Longyue Wang, Derek Wong, Lidia S. Chao, and Zhaopeng Tu. Convolutional self-attention networks, 2019. +Yimeng Zhang, Tai Sing Lee, Ming Li, Fang Liu, and Shiming Tang. Convolutional neural network models of v1 responses to complex patterns. Journal of Computational Neuroscience, 46:33 - 54, 2018. URL https://api(semanticscholar.org/CorpusID:46934991. +Yimeng Zhang, Harold Rockwell, Sicheng Dai, Ge Huang, Stephen Tsou, Yuanyuan Wei, and Tai Sing Lee. Recurrent networks improve neural response prediction and provide insights into underlying cortical circuits, 2022. URL https://arxiv.org/abs/2110.00825. +Hengshuang Zhao, Jiaya Jia, and Vladlen Koltun. Exploring self-attention for image recognition, 2020. + +# A APPENDIX + +# A.1 ADDITIONAL DETAILS ON MACAQUE EXPERIMENTAL SETUP + +We collected data using a nearly identical experimental protocol as detailed in (Tang et al., 2018a;b), except that our dataset was considerably larger, including up to $34\mathrm{K}$ and $49\mathrm{K}$ stimulus-response pairs for the two monkeys respectively. + +During each fixation task, a blank screen was presented for $1500~\mathrm{ms}$ after the monkey established fixation, followed by the presentation of a visual stimulus for $500~\mathrm{ms}$ . 34,000 stimuli were tested in monkey 1 and 49,000 stimuli were tested in monkey 2 over a data collection period of 5 days. Neurons were registered anatomically and also by testing a 200 stimuli finger-print each day. To quantify the neural response, a differential image of GCamp5s calcium signals between the stimulus period and blank period was computed for each trial. The dF/F was then calculated based on a $200~\mathrm{ms}$ to $600~\mathrm{ms}$ window after stimulus onset. We note that GCamp5s is slow, but the signal has been found to be correlated with firing rate (Li et al., 2017). The training set was collected with 1 repeat for each stimulus. The validation set consists of 1000 stimuli, each with 10 repeats. + +# A.2 V1 PREFERRED FEATURES + +![](images/409aa2bcc09ea0be4dfe86ac9d110c5c09e631e0c24b8d6e8c2de3211f4e9c2d.jpg) +Figure 7: V1 neuron exhibit diversity and complexity in preferred features. Individual CNNs were used to model neurons' responses to a large set of natural images. Mid row: visualizations of the optimal stimuli for ff-CNN models for 28 neurons. Neurons are clustered into 7 equally sized classes representing preferences for curves, rings (eyes), textures, grating, bars, corners, and other more complex higher order features. Top row: top 5 natural images in the validation set that elicited the largest response from real neurons in each class. Bot row: top 5 artificial stimuli that elicited the largest response from ff-CNN models of neurons in each class. The artificial stimuli preferences are consistent with the optimal stimuli seen in the middle row. + +A driving motivation of our study was to identify the natural image features that V1 neurons prefer, which include corners, curvatures, junctions, rings and other higher order features, rather than the traditional orientation and frequency tunings. While traditional artificial stimuli produce a tuning curve, these stimuli rarely represent the neuron's most preferred stimulus. The studies referenced above show that the neurons' true preferences are not necessarily a specific orientation or spatial frequency, and may not be well modeled by Gabor functions and traditional linear/nonlinear models. Rather, the preferred features, which are encoded by the peak responses of neurons as visualized in Figure 7, exhibited diversity and complexity in the tuned features. The objective of this study is not to prove or argue for the diversity and complexity of V1 neural codes, but to explore the mechanisms contributing to them. A key finding of this paper is that the surround contextual mechanism, implemented by a non-local network (i.e. self-attention), positively contributes to the generation of the response peak, and is related to the encoding of preferred higher-order features in neurons. As such, this study aims to model the peak response of neurons and develop a novel metric to evaluate the model's accuracy in capturing the peak of each neuron's "natural image tuning curve." + +# A.3 COMPARISONS TO OTHER ESTABLISHED MODELS + +![](images/0c9450b67a9a1993077b9cf9828ba94268405a066563997e16e21db92ae3cbfc.jpg) +Figure 8: Comparing the performance of ff-CNN. (A), (C) shows the Pearson correlation comparisons of ff-CNN with the "what and where" (shared core factorized) model and the transfer learning (goal driven VGG) model, respectively. (B), (D) show CC norm squared comparisons between models. (E) shows hyperparameter experiments on a subset of 50 neurons from M2S1. (F) Comparison between ff-CNN and the "what and where" model on the ability to capture M2S1 tuning peaks. All results on M1S1 are similar. + +![](images/dbdcdbbb2ae64d010856e9b40f18d6e855016bc20abd9ef8bcc3f2fa4b6c460b.jpg) + +![](images/265129c548d9564fa2ef28f218bdc3f9e63077664621fbb1a74957ca045e2e21.jpg) + +![](images/4091183a227cce98b15dbe9e922de9df5b9ffa3793ed172942d04699cb0bc819.jpg) + +
Hyperparameter ChangesCORR.
ff-CNN with:N/A (original ff-CNN)0.444
L1 regularization in readout layer0.401
Poisson loss during training0.409
All dropout layers removed0.410
+ +(E) + +
ModelPTJPTS
ff-CNN0.159 ± 0.0230.290 ± 0.041
"What and where"
Model0.100 ± 0.0240.210 ± 0.045
+ +(F) + +Four major classes of models are found in neural response prediction literature: (1) transfer learning models, (2) single CNN feedforward models, the (3) shared core factorized ("what and where") model (Klindt et al., 2018; Lurz et al., 2021), and more recently a (4) transformer based model for mouse V1. The first three types of models have been used in macaque V1, whereas the transformer based model has only been used in mouse V1. We experimented with the first three classes of models and found that for our dataset, the performance of our baseline feedforward models (ff-CNN) are comparable, and at times better, to the transfer learning model and the shared core factorized mode (see Figure 8). Thus, we used the single CNN feedforward model as our baseline model. We did not compare our model with transformer based models such as ViT (Li et al., 2023), which use deep and complex layers to achieve SOTA neural response prediction. The focus of our research and our contributions are different. We demonstrate that surround contextual modulation is critical in predicting the peak responses of macaque V1 neurons in response to natural images. Towards this, we used self-attention to model horizontal interactions, rather than just using an entire transformer module to achieve SOTA performance. + +# A.4 COMPARISONS TO OTHER ESTABLISHED METRICS + +![](images/087860bc8789772c2dbea63c44a5f7dfb2eeea87df3546cc1fd5b65fb3daccf4.jpg) +Figure 9: Pearson correlation versus FEV scatter plot for different models. Average FEV is calculated by averaging over neurons in M2S1. Note that the performance of models improve relative to the ff-CNN baseline when evaluated based on FEV, following a similar trend to that of Pearson correlation. + +![](images/eacaa46317cc1e6e843cae75826c4d343163028088ea757774a8dcc49a5d196b.jpg) + +![](images/36962b249b09e85ffffa55787543596269360e1e983795a52cab0527f0af8c5e.jpg) + +![](images/a733c3660d3db81d988dcc71c138ecb9ffa793c25ff54550cccb53765ac06394.jpg) + +![](images/3d87dd778bb64e6e678ae5ec2dd262e5bf9057d3e2f364ce2bf108f099864c64.jpg) +Figure 10: Pearson correlation versus $r_{er}^{2}$ scatter plot for different models. Average $r_{er}^{2}$ is calculated by averaging over neurons in M2S1. Note that the performance of models improve relative to the ff-CNN baseline when evaluated based on $r_{er}^{2}$ , following a similar trend to that of Pearson correlation. + +![](images/8a1575ba6a12579ea903a08a592d58ec70f2a1c8f02bb5271aa9cebd70cd3924.jpg) + +![](images/24b5297b9894a9fa5dbf9f2f34e949b6d822f16b97f0553c5c34a0e0549c514b.jpg) + +![](images/92fc27fff95b168ad096654350e57eb4f9358fa5aaced868bcdaf04b3c3aaee2.jpg) + +We compute measures FEV and $r_{er}^{2}$ for each of our models. We calculated the average FEV and $r_{er}^{2}$ across all neurons in M2S1 for different models. Similar to Pearson correlation and $CC_{norm}^{2}$ , FEV and $r_{er}^{2}$ measures are similar across models used in our study, and are comparable to established baselines (see Figure 9 and Figure 10). Despite FEV and $r_{er}^{2}$ taking prediction magnitudes into account, they are still unable to capture the peak tuning properties. This can be attributed to the high degree of sparsity in individual neurons' tuning curve (to natural stimuli), where only $0.4\%$ of the stimuli above half height on average. Because standard measures of performance are heavily influenced by remaining $99\%$ low-responding stimuli, they are not sufficient for capturing the sharp tuning curves peaks we observed (i.e. recognizing the most preferred stimuli of the neurons). + +# A.5 FCL DECOMPOSITION: AVERAGE CONTRIBUTION FROM EACH HYPERCOLUMN + +![](images/0198d7d9e3259ca0c0cd370fefe46f1c3ffb9536738baecc4724852773d298e9.jpg) +Figure 11: Average FCL contribution from each hypercolumn for M1S1. Center hypercolumn outlined in red. Each heatmap is independently contrast normalized. Note that the distribution in the first heatmap is evenly distributed compared to the others (see contrast scale). + +![](images/5282fcdc8ae8131b49b2ff47f052ab0662a31dbcf53786f976c92227080f4a41.jpg) + +![](images/152bfffc1c8e6a539efe66b3766ed7be24dd6ee403cbd85778d85195b84a5f54.jpg) + +Figure 6 plots the individual contribution of the center hypercolumn with the sum of all surrounding hypercolumns. We observed an evenly distributed contribution from all hypercolumns in the simultaneously trained model, but a strong center contribution in incrementally learned models. This effect is further observed when we display the average contribution of each hypercolumn (see Figure 11). + +# A.6 MODELS THAT CAN CAPTURE PEAK TUNING EXHIBIT INTERPRETABLE CONTEXTAL MODULATION SUCH AS ASSOCIATION FIELDS IN THE SELF-ATTENTION MODULE + +![](images/4a45d4b1d4326669fcdd1ae96fa0101052bab5541ee52ed8b9978b186490f4b1.jpg) +Figure 12: Attention highlighting for incremental learning models. Top two highest response inducing image are shown for M1S1 neuron 153. Note that $\text{rf} + \text{sa} - \text{CNN}^* (\text{Incr})$ , $\text{ff} + \text{sa} - \text{CNN}^* (\text{Incr}. \text{FC}_1)$ , and $\text{ff} + \text{sa} - \text{CNN}^* (\text{Incr}. \text{FC}_2)$ all have the same attention map due to the freezing scheme. The center hypercolumn is queried for highlighted images. + +![](images/b399395b23aabae4cb3fd7da44bfa12a4dd4ebee50e794b9d829272e3e502519.jpg) + +![](images/297258a29efeaaf452ad05be2161f00ea3dad06954eb21675bdeba3183cd9425.jpg) + +Comparing the attention highlighting between self-attention models from the incremental learning experiment, we observe that models learned incrementally have a more focused attention versus equivalent-architecture counterparts trained simultaneously (as shown in Figure 12). Models with strong peak tuning, which incorporate the surround properly, displays association field effects, focusing on similar patterns as present in the receptor field. Furthermore, because of the incremental freezing scheme between all incremental models, they have the same attention despite variations in the readout layer. However, incremental models display a focused attention, meaning the initially trained SA representation using the CTL (in $rf + sa - CNN^*$ (Incr)) allows for proper learning of attention weights. This further supports that the 30 to 1 parameter bottleneck in the CTL is not a limiting factor, and the gain in performance in the latter incremental models (in $ff + sa - CNN^*$ (Incr.FC $_1$ ) and $ff + sa - CNN^*$ (Incr.FC $_2$ )) are associated with the FCL. + +# A.7 SELF-ATTENTION CNNS ARE DATA EFFICIENT + +Table 3: Average Pearson correlation and peak tuning metrics for models trained at different data sizes of M1S1. Correlation SEM = 0.008 was consistent across models. + +
Model25% of M1S150% of M1S1
Δ CORR. of ff-CNNPTJPTSΔCORR. of ff-CNNPTJPTS
ff-CNN0.0%0.2321.0260.0%0.7621.556
ff+sa-CNN+7.2%0.9271.656+7.6%1.0262.715
rf-CNN+26.9%0.0000.000+21.1%0.0000.000
rf+sa-CNN+23.6%0.0000.000+19.8%0.0000.000
+ +We trained baseline feedforward CNN models and their counterparts with self-attention at various training dataset sizes. We conclude that percentage improvements over ff-CNN are furthered at lower data constraints (as shown in Table 3), alluding to the potential efficiency of SA in accumulating surround information compared to other context mechanisms. We note that rf-CNN is the most data efficient when evaluated solely on Pearson correlation. However, it is important to see from Table 3 that at $25\%$ and $50\%$ data, rf-CNN and rf+sa-CNN completely fail in the peak tuning index, indicating that the models were entirely unable to model the response magnitude of the highest excitatory images. This lends to our claim that although rf-CNN does well in correlation, contextual information (as is present in ff-CNN and ff+sa-CNN) is necessary to capture peak responses. + +# A.8 POPULATION TUNING CURVES + +![](images/3b8d3b6945b5937dd3dd0e5256b960a60b0c851cd5598cfb0689ff146e5993c8.jpg) +Figure 13: Population average tuning curves for M1S1. + +![](images/26397dda53e92de944fb1827d5a2dd615c34c4dbc2df4ddab24b4bf1e61b90ab.jpg) + +![](images/76d9a9c8fe8722ba80c466e9aec91f8108332310a2abf2d4a7485f55a937c671.jpg) + +![](images/7aeb779cd56e12a6b9c089a4f6457706233488cbad5f0faa8f835bb5c7f9756b.jpg) + +Differences in peak tuning can also be observed in the population tuning curves (see Figure 13). Average curves are derived by calculating rank ordered tuning curves for each neuron individually, then averaging over the image number across neurons. + +# A.9 V MAPPING PARAMETER $\gamma$ IN SELF-ATTENTION + +In the self-attention layer (as shown in Figure 2), the V mapping parameter $\gamma$ allows further factorization of inter-channel mixing and spatial interactions. Toggling $\gamma =$ False removes the transformed value vector, and attention weights instead directly on the input representation. Note that the $\gamma$ parameter does make a difference performance wise. The only difference between $rf + sa - CNN^{*}$ and $rf + sa - CNN$ is the presence of a SA with $\gamma =$ True block in the former and a SA with $\gamma =$ False block in the latter. $rf + sa - CNN^{*}$ has better correlation, $\mathrm{PT}_J$ , and $\mathrm{PT}_S$ values, meaning allowing for the V mapping in SA allows for more flexibility, despite the lack of a $3\times 3$ convolution and FCL layer in these models. + +# A.10 CTL CHANNEL NUMBER BOTTLENECK + +In models with a CTL readout, the final layer is performing a 30 to 1 or 32 to 1 weighted sum, depending on the number of channels. Thus, an issue we considered was that such a narrow final layer would inhibit proper backpropagation of error signals to upstream modules. To address the concern of a $30 \to 1$ mapping in the CTL layer being too tight of an initial bottleneck, we trained rf+sa-CNN with $c = 375$ channels, so that it would have a $375 \to 1$ CTL mapping instead. The results were comparable to the rf+sa-CNN with $c = 30$ , meaning the drop in performance from rf-CNN cannot be attributed to a parameter bottleneck. + +# A.11 IMPORTANCE OF POST-SELF-ATTENTION CHANNEL MIXING + +Additionally, we tested self-attention models without post-SA convolutions (i.e. no $\beta$ CPB layers) and observed sharp drops in performances compared to baseline CNNs. This suggests that inter-channel mixing is crucial in processing the output of self-attention into a interpretable representation by the readout layer. We note that transformer block in modern computer vision models employ a multi-layer perceptron immediately after self-attention, which aligns with our findings. + +To compare the importance of the $3 \times 3$ versus $1 \times 1$ kernel size and FCL vs CTL readout as a means of incorporating surround information, we compared the following models: $[\alpha \mathrm{CPB} \to \alpha \mathrm{CPB} \to \mathrm{SA}(\gamma = \mathrm{True}) \to \beta \mathrm{CPB}(k = 1) \to \beta \mathrm{CPB}(k = 1) \to \mathrm{FCL}] \stackrel{\mathrm{vs}}{\iff} [\alpha \mathrm{CPB} \to \alpha \mathrm{CPB} \to \mathrm{SA}(\gamma = \mathrm{True}) \to \beta \mathrm{CPB}(k = 3) \to \beta \mathrm{CPB}(k = 3) \to \mathrm{CTL}]$ . + +The former with $\beta \mathrm{CPB}(k = 1)$ and FCL outperformed the latter with $\beta \mathrm{CPB}(k = 3)$ and CTL. Thus, direct access to all spatial features with a fully connected layer is stronger than convolving the surround into the center. We observe that the FCL is the strongest factor for predicting the peak responses, and is bolstered by the addition SA, as ff+sa-CNN outperforms ff-CNN in peak tuning. + +# A.12 RECEPTIVE FIELD CHARACTERISTICS AND POPULATION-LEVEL RF DISTRIBUTION + +We mapped the neural networks' receptive fields using optimally oriented short bars. The left and center panel of Figure 14 illustrates two example neurons' receptive fields, indicating that a short bar outside the classical receptive fields does not elicit a response greater than the baseline. The half-height maximum receptive field diameter is approximately 3 pixels (0.4 degree visual angle), corresponding to a 2-STD contour diameter of about 0.8 degree visual angle, consistent with experimentally determined receptive field sizes. The right panel of Figure 14 displays the distribution of mapped receptive fields of neurons for one site. + +![](images/0442e19f88c289d03a7ffd37b346e7fe7e4395c5909702563d6884d10f801719.jpg) +Figure 14: Receptive field properties of neurons and their population-level distribution. Left and Center: two sample neurons' response maps fitted with an elliptical Gaussian. Right: histogram showing the distribution of receptive field diameters (in degree visual angle) for 279 neurons. + +![](images/edfaaf181d87c6599e63b7a30287c950cbbf43715dcd7c333520c8d2281fb547.jpg) + +![](images/1e4da294d61b5f164a33f1913b9fe4a9d11ff4486b94f0518c9df131f5704a65.jpg) + +![](images/9d6b8d9f42d88da4ef1582f6977aba6d6f5a894fc08e3916be3556a109e9ea3b.jpg) + +# A.13 CAPTURING MODULATORY PROPERTIES OF EXTRA-CLASSICAL RECEPTIVE FIELDS + +To verify that our neural networks exhibit the extra-classical receptive field contextual modulation phenomena noted by the reviewer, we replicated following experiment by (Cavanaugh et al., 2002) on our digital neurons. + +The following describes the methodology of the experiment. Neurons were presented with center grating stimuli in optimal orientation and spatial frequency of varying diameters (center-only stimuli), centered on their receptive fields. The diameter of the smallest center-only stimulus eliciting at least $95\%$ of the neuron's maximum response defines the GSF (grating summation field). Each neuron was also presented with surround grating stimuli (with gray apertures centered on the receptive field) of varying sizes. The classical receptive field was estimated as the aperture diameter at which the annular stimulus response is significantly below the neuron's maximum response to a circular grating patch. This aperture, referred to as the AMRF, represents where surround-only stimuli do not elicit significant responses above the baseline response. When the center-only stimulus is significantly larger than the size of the classical receptive field, surround suppression—a characteristic example of extra-classical receptive field modulation—is observed. + +Figure 15A shows four example neurons from Cavanaugh et al.'s study demonstrating the classical surround suppression phenomena. Figure 15B and 15C shows our replication of their experiment, comparing results for the baseline model (ff-CNN) and the self attention model (ff+sa-CNN). The classical receptive field size of our neurons estimated using AMRF was approximately 0.8 degree visual angle. We found that when the center-only stimulus exceeded this classical receptive field size, surround suppression—a hallmark of extra-classical receptive field modulation—was consistently observed. + +![](images/b67d77c90e72ead95cc948187dc641c62629954611013f3b772de9f5ef45be0a.jpg) +Figure 15: Capturing basic modulatory nature of extra-classical receptive fields. (A) shows four example neurons from (Cavanaugh et al., 2002) study demonstrating the classical surround suppression phenomena. (B), (C) shows the average population response to the center only stimuli and the surround only stimuli for two models, ff-CNN and ff+sa-CNN. + +# A.14 PERFORMANCE COMPARISON OF DIFFERENT MODELS AT VARYING DATA SIZES + +
Table 1: M2S1 Performance Metrics when Trained with 12.5% Data
ModelCORRPTSPTJ
ff-CNN0.2600.0000.000
ff+sa-CNN0.2720.0000.000
Recurrent CNN (1 layer, 7 iterations)0.2912.1741.304
+ +(A) + +
Table 2: M2S1 Performance Metrics when Trained with 25% Data
ModelCORRPTSPTJ
ff-CNN0.2950.0000.000
ff+sa-CNN0.3170.0330.013
Recurrent CNN (1 layer, 7 iterations)0.2982.1741.304
+ +(B) +Table 3: M2S1 Performance Metrics when Trained with ${100}\%$ Data + +
ModelCORR\( {\mathrm{{PT}}}_{S} \)\( {\mathrm{{PT}}}_{J} \)
ff-CNN0.47417.3338.667
ff+sa-CNN0.49819.66711.000
Recurrent CNN (1 layer, 7 iterations)0.4355.6673.333
+ +(C) + +Figure 16: Performance of ff-CNN, ff+sa-CNN, and recurrent CNN at varying data sizes. (A) shows performance metrics at $12.5\%$ data. (B) shows performance metrics at $25\%$ data. (C) shows performance metrics at $100\%$ data + +Our results indicate that when the full training dataset (100% data) is utilized, the feedforward CNN augmented with self-attention (ff+SA-CNN) outperforms the recurrently augmented CNN across both overall tuning metrics and peak tuning metrics. However, consistent with the findings of Zhang et al. (2022), the recurrent augmented CNN exhibits superior data efficiency. Specifically, when the training dataset size is reduced to 25% or less, the recurrent augmented CNN surpasses both ff-CNN and the ff+sa-CNN in performance. + +# A.15 CODE FOR EXPERIMENTS + +The code is hosted at the github repository: https://github.com/lucanren/sacnn \ No newline at end of file diff --git a/ICLR/2025/Self-Attention-Based Contextual Modulation Improves Neural System Identification/images.zip b/ICLR/2025/Self-Attention-Based Contextual Modulation Improves Neural System Identification/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..8a3b76e78eb019a4b94f3af699f8d49782ab7e44 --- /dev/null +++ b/ICLR/2025/Self-Attention-Based Contextual Modulation Improves Neural System Identification/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cfac48fb05b6abe164e7ad905c57837a53ecfe25a6c2d050cc6b7acbb00ed27a +size 965286 diff --git a/ICLR/2025/Self-Attention-Based Contextual Modulation Improves Neural System Identification/layout.json b/ICLR/2025/Self-Attention-Based Contextual Modulation Improves Neural System Identification/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..aca70d01b2fdc963253866fd3197d134e9505a52 --- /dev/null +++ b/ICLR/2025/Self-Attention-Based Contextual Modulation Improves Neural System Identification/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:99427c0856a9ef336474e3cbb41282953249c6fb3cba70e2689a0622b2a53f31 +size 626700 diff --git a/ICLR/2025/Self-Boosting Large Language Models with Synthetic Preference Data/28d3f90c-8ab2-417a-a84c-6397ea6f5a7c_content_list.json b/ICLR/2025/Self-Boosting Large Language Models with Synthetic Preference Data/28d3f90c-8ab2-417a-a84c-6397ea6f5a7c_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..efdbb183cbac127ff08efa9bc63988c03de7ed41 --- /dev/null +++ b/ICLR/2025/Self-Boosting Large Language Models with Synthetic Preference Data/28d3f90c-8ab2-417a-a84c-6397ea6f5a7c_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:59c3d9d0137be52a2f77c1249cbe9844d57bf74a9c95214b79c6fcbef34b0bed +size 140846 diff --git a/ICLR/2025/Self-Boosting Large Language Models with Synthetic Preference Data/28d3f90c-8ab2-417a-a84c-6397ea6f5a7c_model.json b/ICLR/2025/Self-Boosting Large Language Models with Synthetic Preference Data/28d3f90c-8ab2-417a-a84c-6397ea6f5a7c_model.json new file mode 100644 index 0000000000000000000000000000000000000000..1a39207be201aea425d0858cec9c5ee0a31c3abc --- /dev/null +++ b/ICLR/2025/Self-Boosting Large Language Models with Synthetic Preference Data/28d3f90c-8ab2-417a-a84c-6397ea6f5a7c_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a04e5bd0878d708301f3ab82dd4c9b1e42101b9d541417f67b3a8425f9faa650 +size 171709 diff --git a/ICLR/2025/Self-Boosting Large Language Models with Synthetic Preference Data/28d3f90c-8ab2-417a-a84c-6397ea6f5a7c_origin.pdf b/ICLR/2025/Self-Boosting Large Language Models with Synthetic Preference Data/28d3f90c-8ab2-417a-a84c-6397ea6f5a7c_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..7de2c01d6d7a5dea1493e80d7ca60af450518237 --- /dev/null +++ b/ICLR/2025/Self-Boosting Large Language Models with Synthetic Preference Data/28d3f90c-8ab2-417a-a84c-6397ea6f5a7c_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:eed50935366e8c631fc4d863440979cf721002ea06123e44adadabdcc37e1d7c +size 750396 diff --git a/ICLR/2025/Self-Boosting Large Language Models with Synthetic Preference Data/full.md b/ICLR/2025/Self-Boosting Large Language Models with Synthetic Preference Data/full.md new file mode 100644 index 0000000000000000000000000000000000000000..14f628053079176d09526df676df8ce8cea1f996 --- /dev/null +++ b/ICLR/2025/Self-Boosting Large Language Models with Synthetic Preference Data/full.md @@ -0,0 +1,483 @@ +# SELF-BOOSTING LARGE LANGUAGE MODELS WITH SYNTHETIC PREFERENCE DATA + +Qingxiu Dong† Li Dong‡ Xingxing Zhang‡ Zhifang Sui† Furu Wei‡ + +†State Key Laboratory of Multimedia Information Processing, + +School of Computer Science, Peking University $\ddagger$ Microsoft Research + +# ABSTRACT + +Through alignment with human preferences, Large Language Models (LLMs) have advanced significantly in generating honest, harmless, and helpful responses. However, collecting high-quality preference data is a resource-intensive and creativity-demanding process, especially for the continual improvement of LLMs. We introduce SynPO, a self-boosting paradigm that leverages synthetic preference data for model alignment. SynPO employs an iterative mechanism wherein a self-prompt generator creates diverse prompts, and a response improver refines model responses progressively. This approach trains LLMs to autonomously learn the generative rewards for their own outputs and eliminates the need for large-scale annotation of prompts and human preferences. After four SynPO iterations, Llama3-8B and Mistral-7B show significant enhancements in instruction-following abilities, achieving over $22.1\%$ win rate improvements on AlpacaEval 2.0 and ArenaHard. Simultaneously, SynPO improves the general performance of LLMs on various tasks, validated by a 3.2 to 5.0 average score increase on the well-recognized Open LLM leaderboard. + +# 1 INTRODUCTION + +Large Language Models (LLMs) have made remarkable progress in following user instructions and generating honest, harmless, and helpful responses (Achiam et al., 2023; Dubey et al., 2024). This advancement is primarily achieved in the model alignment stage, which involves training reward models or LLMs directly on datasets curated from human preferences (Ouyang et al., 2022b; Bai et al., 2022a), typically employing Reinforcement Learning from Human Feedback (RLHF) (Ouyang et al., 2022b) or Direct Preference Optimization (DPO) (Rafailov et al., 2024). + +Recent research has made significant strides in model alignment by collecting high-quality preference data (Hu et al., 2024), sampling and ranking on-policy responses (Meng et al., 2024; Wu et al., 2024b), or introducing LLM-as-a-Judge as substitutes for human preferences (Yuan et al., 2024; Cui et al., 2023). However, most work still relies on static, pre-collected preference datasets from human or stronger LLM annotation. As LLMs improve rapidly, collecting large, high-quality preference data for effective learning becomes increasingly challenging and costly, whether from humans or stronger models (Shi et al., 2023). According to Yin et al. (2024), directly sampling preference pairs, which closely resembles an on-policy setting, can result in performance declines due to inherent volatility and inefficiency. Therefore, constructing effective preference data to continuously improve LLMs remains a critical research problem. + +In this work, we present a self-boosting paradigm for LLM alignment, SynPO. This paradigm leverages a small set of supervised fine-tuning (SFT) data to steer the generation of synthetic preference data, thereby enabling LLMs to iteratively extend their capabilities through optimizing on synthetic data. To support iterative preference learning across diverse scenarios, SynPO first trains a self-prompt generator to create large-scale synthetic prompts. Unlike previous approaches that require more powerful LLMs and instruction examples (Wang et al., 2022), our generator utilizes only the LLM itself and three random keywords as input. To generate preference pairs for the synthetic prompts, SynPO utilizes the initial model generated responses as rejected candidates and employs a response improver to refine these responses into chosen ones. The response improver comes from two straightforward intuitions: (1) LLMs excel at identifying distribution gaps between texts (Zhong + +![](images/fb007735b7aa9e8902dd24312d7158f523ee1f80182d9a80846e9ede19162ef4.jpg) +Figure 1: Length-controlled win rate on AlpacaEval 2.0 improves with SynPO iterations, approaching GPT-4 level for the base versions of Llama3-8B and Mistral-7B. + +
ModelSizeLC (%)WR (%)
gpt4_1106 preview-50.050.0
GPT-4 (03/14)-35.322.1
Meta-Llama-3-70B-Instruct70B34.433.2
Mistral-Base-SynPO Iter47B34.036.4
Mistral Large (24/02)123B32.721.4
Mistral-Base-SynPO Iter37B31.733.8
GPT-4 (06/13)-30.215.8
Claude 2-28.217.2
Claude 2.1-27.317.0
Mistral-Base-SynPO Iter27B25.728.1
gemini-pro-24.418.2
Mixtral-8x7B-Instruct-v0.18x7B23.718.3
Mistral-7B-Instruct-v0.27B17.114.7
Mistral-Base-SynPO Iter17B13.315.3
Mistral-Base-SFT7B6.63.6
+ +Table 1: Results on AlpacaEval 2.0 leaderboard. LC and WR represent length-controlled and raw win rate, respectively. + +et al., 2022; Singh et al., 2022), and (2) refining a response is generally easier than generating a high-quality response from scratch (Madaan et al., 2023; Lu et al., 2023; Nguyen et al., 2024). In each iteration, we train the same initial model to be a response improver, focusing on identifying distribution gaps between current model outputs and gold standard responses in seed data. We then use the response improver to refine the initial model outputs, thereby providing generative rewards to the responses. Through iterative training the initial model on synthetic preference data, SynPO allows the LLM to make subtle improvements and gradually push its boundaries. By leveraging small high-quality data and the current model state to guide the generation of synthetic data, we introduce stronger supervision in an iterative manner. + +Experimental results demonstrate that SynPO not only benefits LLM alignment with human preferences, but also improves generalist capabilities across various tasks. Trained solely on synthetic data, SynPO significantly improves the instruction-following abilities of Llama3-8B and Mistral-7B (as shown in Figure 1 and Table 1), achieving over a $26\%$ length-controlled win rate improvement on AlpacaEval 2.0 (Dubois et al., 2024) and a $22\%$ to $30\%$ improvement on Arena-hard (Li et al., 2024c) (as shown in Table 2). Furthermore, self-boosted models achieve $3.2\%$ to $5.0\%$ higher average performance than SFT models on the Open LLM leaderboard (Beeching et al., 2023), indicating SynPO also enhances general LLM performance. + +To summarize, our contribution includes: + +- We introduce SynPO, a self-boosting mechanism that iteratively induces LLMs to synthesize high-quality data for training. Without requiring human-annotated preference data, SynPO significantly enhances the diversity and quality of synthetic prompts and responses. +- SynPO dynamically guides LLMs to improve their own outputs, using pre- and post-refinement generations as synthetic preference pairs for training. This approach effectively integrates generative rewards for preference learning, enabling LLMs to gradually push their boundaries. +- SynPO significantly enhances both the instruction-following capabilities and the general performance of LLMs, showing substantial improvements over three to four iterations. + +# 2 SELF-BOOSTING LLM WITH SYNTHETIC PREFERENCE DATA + +SynPO is a self-boosting scheme designed to iteratively generate high-quality preference data. An overview of SynPO is presented in Figure 2. It begins with a small set of SFT data as seed data, denoted as $\{(\mathbf{x}_i^*,\mathbf{y}_i^*)\}_{i = 0}^n$ , and the initial policy model $\pi_{\theta_0}$ . By incorporating both the self-prompt generator and the response improver, SynPO provides sufficient prompts for iterative training and leverages the generative rewards in the synthetic preference data. This approach allows the policy model to make subtle improvements and gradually expand its boundaries. + +![](images/3fde624723bf1da2e8e9a9c3f5f2537203db1d8a8ef5d5d6bcc8c891d7ab67df.jpg) +Figure 2: Overview of SynPO in the $\mathbf{t}^{\mathrm{th}}$ iteration. Starting with the previous iteration model $M_{t-1}$ , SynPO first learns a response improver $R_t$ to identify discrepancies between model responses $(y_{t-1}^*)$ and gold standard responses $(y^*)$ on seed data, and learns to refine model responses. Subsequently, on the self-generated prompts $x$ (elaborated in Section 2.1), SynPO employs $R_t$ to refine the $M_{t-1}$ responses $(y_{t-1})$ into improved responses $(y_{t-1}^w)$ . The valid synthetic prompts $x$ , refined responses $(y_{t-1}^w)$ , and initial model $M_0$ responses $(y_0)$ to form synthetic preference data. These data are incorporated into the synthetic preference dataset for preference optimization, resulting in an updated $M_t$ for the next iteration. The iterative process continually enhances LLM capabilities in instruction-following and task performance. +Figure 3: Prompt used in SynPO for LLMs to act as self-prompt generators. + +Question Generation Prompt +```txt +## Background +Design ONE question/instruction (and its solution) with given keywords. +## Requirements +The question/instruction should try to contain the keywords in '#Given Keywords'. The solu- +tion MUST BE CORRECT, including detailed reasoning steps and dense knowledge. +## Given Keywords +{keywords} +## Output Format + $= =$ GENERATED QUESTION & CORRECT SOLUTION $= =$ + question content ... + correct solution ... +## Output + $= =$ GENERATED QUESTION & CORRECT SOLUTION $= =$ +``` + +# 2.1 SYNTHETIC PROMPT CREATION + +Diverse and ample prompts are crucial for effective preference learning (Shi et al., 2023; Yuan et al., 2024; Song et al., 2024). Diversity facilitates generalization and a sufficient number of prompts allows data selection from a large candidate pool. In SynPO, we propose a novel strategy for synthetic prompt generation. We design a keywords-to-text task to guide the training of a self-prompt generator and create pseudo-label data from the seed SFT data. + +Self-Prompt Generator Training We train the LLM itself to serve as a high-quality prompt generator. For each prompt $\mathbf{x}_i^*$ in seed data, we randomly extract two keywords from $\mathbf{x}_i^*$ and one noise keyword from $\mathbf{x}_j^*$ , where $j \in \{1, 2, \dots, n\} \setminus \{i\}$ . The inclusion of the noise keyword enhances the robustness of the prompt generator. It learns to filter out irrelevant keywords during training and ensure that the generated prompts are fluent. This process yields a keyword list, $k_i$ for $\mathbf{x}_i^*$ . Next, we insert $k_i$ into a prompt template (see Figure 3) to create a prompt and use $(\mathbf{x}_i^*, \mathbf{y}_i^*)$ as the corresponding completion. This process constructs training data for the prompt generator. We then optimize $\theta_0$ through SFT to transform the model into a prompt generator $\mathcal{G}$ . $\mathcal{G}$ possesses the capability to generate unlimited, diverse, and high-quality user instructions, controlled by the given keywords. + +![](images/458a49a3ce0d2e89c58c8abc01368a0a4fa6a2c5d8f75d5e32026c3e7e8ab80f.jpg) +Figure 4: The top 25 most common topics (outer circle) and the top 12 most common intentions (inner circle) in SynPO generated prompts. We aggregate the other topics and intentions to the 'Others' group. + +![](images/a92f7e5d2594ca0c8f087ac86b728a10a0c2a5998f9de5c7a3f37fc5fc5f2ce3.jpg) +Figure 5: Inter-prompt similarity distributions for 1,000 randomly sampled prompts from SynPO, UltraFeedback (Cui et al., 2023), Self-Instruct (Wang et al., 2022), and UltraChat (Ding et al., 2023). We used SentenceTransformer (Reimers & Gurevych, 2019) to compute sentence embeddings and calculated the cosine similarity between each prompt and all others, then averaged these values for each prompt. The results suggest that our method, SynPO, generates more diverse prompts with lower inter-prompt similarity. + +Keywords Sampling and Prompt Generating To enhance the overall diversity of prompts, we sample keywords from pretrain corpus paragraphs. We select three keywords from a same paragraph to maintain the inherent distribution between keywords, and sample from different paragraphs to ensure overall diversity. Specifically, we randomly sample keyword lists from the RefinedWeb paragraphs (Penedo et al., 2023) and generate $m$ synthetic prompts, denoted $\{\mathbf{x}_i\}_{i=1}^m$ , $\mathbf{x}_i \sim \mathcal{G}(\cdot|\mathbf{k}_i)$ . + +Benefiting from the self-prompt generator, our approach requires only a small SFT data to enable the model to generate diverse prompts independently, no in-context learning examples or predefined topic lists are required. Due to the high combinatorial possibilities of keyword sampling, the self-prompt generator can produce a huge variety of synthetic prompts for preference learning. + +For further analysis, we randomly sampled 1k self-generated prompts from the Llama3-8B-Base prompt generator and used GPT-4 Turbo to classify the intentions and topics behind these prompts1. The results, shown in Figure 4, demonstrate significant diversity across various topics and user intentions. Even compared to prompts from GPT3.5-Turbo (Ding et al., 2023) or a collection of prompts from different sources (Cui et al., 2023), as shown in Figure 5, SynPO generated prompts exhibit lower inter-prompt similarity and greater diversity. + +# 2.2 SYNTHETIC PREFERENCE GENERATION + +A primary challenge in leveraging synthetic prompts is the lack of high-quality responses to provide sufficient supervision (Li et al., 2024b). To address this, we introduce a response improver to enhance the quality of model responses to synthetic prompts. Pre- and post-improvement responses naturally become the rejected and chosen candidates, respectively, with the chosen ones providing clear guidance on what approximates a gold standard response. + +Response Improver Training In each iteration, we train the LLM as a response improver to further reduce the gap between policy model outputs and gold standard responses. Formally, let $\pi_{\theta_{t-1}}$ denote the policy model at the beginning of the $t$ -th iteration. We generate outputs from $\pi_{\theta_{t-1}}$ for the seed data prompts: $\mathbf{y}_{(t-1),i}^{*} \sim \pi_{\theta_{t-1}}(\cdot|\mathbf{x}_{i}^{*}), i \in \{1,\dots,m\}$ . These outputs, along with the seed data responses, form the training set for the response improver, following the template provided in Appendix B. Each training example consists of the prompt and the policy model output $(\mathbf{x}_{i}^{*},\mathbf{y}_{(t-1),i}^{*})$ as the input, and the gold standard response $\mathbf{y}_{i}^{*}$ as the output. We fine-tune $\pi_{\theta_0}$ on the + +training set to obtain the response improver $\mathcal{R}_t$ . This response improver refines the policy model outputs, aligning them more closely with the gold standard responses. + +Response Improving Subsequently, we use $\mathcal{R}_t$ to refine model responses to synthetic prompts, obtaining pre- and post-improvement responses as synthetic preference pairs. For each synthetic prompt $\mathbf{x}_i$ , we first obtain the current model output $\mathbf{y}_{(t - 1),i}\sim \pi_{\boldsymbol{\theta}_{t - 1}}(\cdot |\mathbf{x}_i)$ , for $i\in \{1,\ldots ,m\}$ . The response improver then refines this completion to produce $\overline{\mathbf{y}_{(t - 1),i}}\sim \mathcal{R}_t(\cdot |\mathbf{x}_i,\mathbf{y}_{(t - 1),i})$ , considered the chosen response. As we fine-tune the initial model in each iteration, the initial policy model output $\mathbf{y}_{(0),i}$ serves as the on-policy rejected response for $\mathbf{x}_i$ . Here, $\mathbf{y}_{(0),i}\sim \pi_{\boldsymbol{\theta}_0}(\cdot |\mathbf{x}_i)$ . This method generates numerous synthetic preference candidates, including both chosen and rejected responses. + +Data Filtering Unlike data from humans or strong teacher LLMs, which come with clear standard responses, self-generated data require proper filtering to ensure quality (Gulcehre et al., 2023). As our policy model improves, many responses no longer need refining; we only need to retain data with a preference gap between the chosen and rejected responses. Instead of using GPT4-Turbo-as-a-Judge for data filtering (Rosset et al., 2024), SynPO employs only a small model (e.g., a 0.4B PairRM (Jiang et al., 2023)) or the model itself for scoring. Similar to SimPO (Meng et al., 2024) and SPPO (Wu et al., 2024b), this ensures the process does not rely on a more powerful teacher model. We retain $\overline{\mathbf{y}_{(t - 1),i}}$ and $\mathbf{y}_{(0),i}$ with significant preference differences (i.e., a large score gap). $\overline{\mathbf{y}_{(t - 1),i}}$ is regarded as the chosen response, $\mathbf{y}_i^w$ , while $\mathbf{y}_{(0),i}$ is regarded as the rejected response, $\mathbf{y}_i^l$ . Along with the corresponding prompt $\mathbf{x}_i$ , they form a valid instance $(\mathbf{x}_i,\mathbf{y}_i^w,\mathbf{y}_i^l)$ . All valid data is then integrated into the synthetic preference data for subsequent iterations. + +# 2.3 SYNTHETIC PREFERENCE OPTIMIZATION + +The large-scale synthetic preference data naturally facilitate the multi-iteration process of self-boosting. In each iteration, we follow SimPO (Meng et al., 2024) for training; actually, our method is also compatible with other preference optimization training methods, such as DPO (Rafailov et al., 2024) and KTO (Ethayarajh et al., 2024). Denoting $\mathcal{D}$ as the synthetic preference data, we have: + +$$ +\boldsymbol {\theta} _ {t} \gets \underset {\boldsymbol {\theta}} {\arg \min } \mathbb {E} _ {(\mathbf {x} _ {i}, \mathbf {y} _ {i} ^ {w}, \mathbf {y} _ {i} ^ {l}) \sim \mathcal {D}} \left[ \log \sigma \left(\frac {\beta}{| \mathbf {y} _ {i} ^ {w} |} \log \pi_ {\theta_ {t - 1}} (\mathbf {y} _ {i} ^ {w} \mid \mathbf {x} _ {i}) - \frac {\beta}{| \mathbf {y} _ {i} ^ {l} |} \log \pi_ {\theta_ {t - 1}} (\mathbf {y} _ {i} ^ {l} \mid \mathbf {x} _ {i}) - \gamma\right) \right] +$$ + +$\beta$ and $\gamma$ are hyperparameters. Different from the vanilla SimPO, SynPO is a iterative process and all the preference data are synthetic ones. The response improver continuously refines the generation distribution to align with the ideal data distribution across multiple iterations. + +Overall, the response improver automatically learns to generate implicit generative rewards for the outputs of the LLM. Unlike using a discriminative reward model straightforwardly, this approach helps the model learning to improve its outputs. We present the Synthetic Preference Optimization algorithm in Appendix A. The entire optimization process is performed on synthetic preference data, requiring only a small amount of high-quality data for validation. This strategy maintains two key advantages: (1) Compared to the limited and hard-to-collect preference data, SynPO generates an unlimited amount of new self-synthetic data to meet the needs of iterative model improvement. (2) Using small, high-quality validation data prevents the model from deviating during training and consistently guides the generation of more relevant synthetic data. + +# 3 EXPERIMENTS + +We carry out comprehensive experiments to demonstrate the effectiveness of SynPO in enhancing model alignment and improving general model performance. + +# 3.1 EXPERIMENTAL SETUP + +Models and Training We perform synthetic preference optimization on both Mistral-Base 7B and Llama3-8B Base. Following Meng et al. (2024), we employ supervised fine-tuned models as the initial models. Specifically, the Mistral-Base 7B model (mistralai/Mistral-7B-v0.1) and the Llama3-8B Base model (meta-llama/Meta-Llama-3-8B-Base) were fine-tuned on the UltraChat-200k dataset + +
Data ConstructionMistral-Base (7B)Llama3-Base (8B)
AlpacaEval 2.0Arena-HardAlpacaEval 2.0Arena-Hard
LC (%)WR (%)WR (%)LC (%)WR (%)WR (%)
SFT6.63.62.05.43.12.7
Manual Collection21.520.816.822.019.823.2
Sampling-RankingIter16.54.44.17.24.34.4
Sampling-RankingIter29.36.44.37.74.76.2
Sampling-RankingIter310.67.57.913.88.28.4
Sampling-RankingIter411.68.09.614.28.410.4
Self-RewardingIter119.519.811.920.120.320.8
Self-RewardingIter222.423.519.221.722.420.5
Self-RewardingIter324.626.320.822.424.123.8
Self-RewardingIter426.128.021.124.825.625.0
SYNPOIter113.315.39.810.610.711.6
SYNPOIter225.728.120.823.424.124.6
SYNPOIter331.733.824.128.631.532.5
SYNPOIter434.036.422.832.133.631.4
+ +Table 2: Results on AlpacaEval 2.0 and Arena-Hard. LC and WR denote length-controlled and raw win rates, respectively. After four SYNPO iterations, Mistral-Base and Llama3-Base increase LC by $27.4\%$ and $26.7\%$ , respectively, on AlpacaEval 2.0. In Arena-Hard, SYNPO achieves the highest WR by the third iteration, improving both models by over $22.1\%$ . + +as part of the Zephyr (Tunstall et al., 2023) training pipeline. Subsequently, we utilize 18k seed data to SFT the self-prompt generator and then generate 50k synthetic prompts per iteration. For data filtering, we employ the 0.4B PairRM (Jiang et al., 2023) as a small pairwise scoring model for the Mistral-Base 7B. For Llama3-Base 8B, we use Llama3 itself (ArmoRM-Llama3-8B-v0.1 $^3$ ) as a scoring model for data filtering, given its superior alignment with human scoring (Meng et al., 2024). In each iteration $t = 1,\dots,T$ , we use model $\pi_{\theta_{t - 1}}$ from the previous iteration to generate synthetic preference data and then preference optimize the initial models again. More details on training parameters, filtering thresholds, and implementation environments are provided in Appendix C. + +Seed Data Construction We randomly sample UltraFeedback (Cui et al., 2023) prompts and their GPT-4 Turbo completions as our seed data. The seed data is multipurposely transformed for the training of self-prompt generator, response improver, and the validation of synthetic preference optimization. The complete UltraFeedback dataset contains 61k instructions from sources including TruthfulQA (Lin et al., 2021), FalseQA (Hu et al., 2023), Evol-Instruct (Xu et al., 2023a), UltraChat (Ding et al., 2023), and ShareGPT (Chiang et al., 2023). To construct seed SFT data with high-quality responses, we randomly sampled 18k prompts and obtained the corresponding completions generated by GPT-4 Turbo. + +Baselines As baselines, we use the initial supervised fine-tuned models and those optimized with data from various preference construction methods, including manual collection and iterative approaches. We recognize the UltraFeedback preference data (Cui et al., 2023) as a product of manual collection. It is gathered from six high-quality datasets and various models, with preferences annotated by GPT-4 (Achiam et al., 2023). For iterative construction approaches, we compare against Sampling-Ranking and Self-Rewarding. For Sampling-Ranking, similar to Meng et al. (2024) and Wu et al. (2024b), we use LLMs in sampling five responses per prompt in each iteration. The same scoring models, i.e., PairRM and ArmoRM-Llama3-8B-v0.1, are then used to select the highest and lowest scoring responses as the chosen and rejected responses, respectively. For the Self-Rewarding method (Yuan et al., 2024), we generate preference data based on model's own rewards via LLM-as-a-Judge prompting. We employ our 18k seed data as the initial instruction-following data. Given that Self-Rewarding requires additional LLM-as-a-Judge training data, we generate 16k + +
Data ConstructionMistral-BaseLlama3-Base
Turn 1Turn 2Turn 1Turn 2
SFT6.045.656.555.36
Manual Collection6.736.827.297.00
Sampling-Ranking Iters*6.836.187.066.99
Self-Rewarding Iters*6.716.637.307.28
SYNPO Iter16.536.416.996.65
SYNPO Iter26.666.657.347.30
SYNPO Iter36.866.827.347.34
SYNPO Iter46.736.697.437.04
+ +Table 3: Multi-turn evaluation on MT-Bench. An asterisk (*) denotes the best score across multiple iterations. For Sampling-Ranking, Llama's best is from iteration 4 and Mistral's from iteration 3. For Self-Rewarding, both are from iteration 3. SYNPO progressively enhances the multi-turn instruction-following capabilities of LLMs. + +![](images/c3fffa74193a8e75e473ab3c9386ba41c1c930ab68915ddc5f4c78b0fcfcdf17.jpg) +Figure 6: Radar chart for Llama3-8B-Base-SYNPO on MT-Bench. SYNPO achieves notable improvements across various prompt categories, particularly in RolePlay, STEM, Reasoning, and Coding tasks. + +seed data with GPT-4 Turbo. For all settings, we adopt SimPO (Meng et al., 2024) for preference optimization. More detailed are elaborated in Appendix C.5. + +# 3.2 PREFERENCE ALIGNMENT + +We evaluate the model alignment performance on three benchmarks: AlpacaEval 2.0 (Dubois et al., 2024), Arena-Hard (Li et al., 2024c), and MT-Bench (Zheng et al., 2024). AlpacaEval 2.0 includes 805 user prompts and utilizes pair-wise comparison with LLM-as-a-Judge. Specifically, the win rate against the baseline GPT-4 Turbo model is determined based on GPT-4 Turbo evaluation. Arena-Hard includes 500 more challenging user queries, employing GPT-4-Turbo to judge the model responses against GPT-4. MT-Bench features 80 multi-turn questions spanning various domains, with GPT-4 scoring the model responses out of $10$ . + +Single-Turn Dialogues We compare the instruction-following and human preference alignment capabilities on AlpacaEval 2.0 (Dubois et al., 2024) and Arena-Hard (Li et al., 2024c) in Table 2. Compared to the initial model post-SFT, SynPO shows sustained improvement over four iterations in win rate against GPT-4 Turbo or GPT-4. On AlpacaEval 2.0, Mistral-Base achieves a $27.4\%$ increase in length-controlled win rate and a $32.8\%$ increase in raw win rate after four iterations. Similarly, Llama3 exhibits a $26.7\%$ rise in length-controlled win rate and a $30.5\%$ improvement in raw win rate after the same number of iterations. In the more challenging Arena-Hard setting, SynPO reaches the highest win rate after the third iteration. Compared to the baseline methods, SynPO's iterative preference learning on synthetic data yielded more significant improvements. + +Multi-Turn Dialogues For the multi-turn benchmark MT-Bench, we report both the first-turn and second-turn scores (in Table 3) as well as a radar chart depicting performance across different question types (refer to Figure 6). The results indicate that SynPO enhances not only first-turn performance, with an increase of over 0.7 points, but also subsequent turns, with an increase of over 1.2 points. Compared to the initial model, SynPO shows improved performance across various question types, particularly in humanities, writing, STEM, and roleplaying. + +# 3.3 DOWNSSTREAM TASK PERFORMANCE + +In terms of the general model performance on various tasks, we report the average scores on the well-recognized Open LLM Leaderboard (Beeching et al., 2023) and 6 additional benchmarks from Language Model Evaluation Harness library (LLM Harness) (Gao et al., 2024). Open LLM Leaderboard (Beeching et al., 2023) is recognized as a standard assessment for the general per + +
ModelArcHellaSwagTQAMMLUWinograndeGSM8kAverage
Mistral-Base-SFT58.0280.8940.3758.7876.4034.7258.20
Manual Collection62.7183.3950.6958.4777.3532.8360.91
Sampling-Ranking Iters*60.3281.8044.4359.0976.9536.8559.91
Self-Rewarding Iters*60.1581.8443.2558.9876.4834.7259.24
Mistral-Base-SYNPO Iter160.4982.2550.3659.0076.4836.3960.83
Mistral-Base-SYNPO Iter263.6583.2458.0458.7476.4827.3561.25
Mistral-Base-SYNPO Iter363.5483.1458.1158.3775.7725.2660.70
Mistral-Base-SYNPO Iter463.5783.0456.1258.7575.7731.0861.39
LLama3-Base-SFT60.9281.2845.3763.8076.7251.9363.34
Manual Collection66.7282.8959.4763.1077.8245.7265.95
Sampling-Ranking Iters*66.3882.7159.8463.3777.2754.4067.33
Self-Rewarding Iters*64.7682.4855.5463.4277.0354.5966.30
LLama3-Base-SYNPO Iter163.9982.6654.2064.0277.5156.1066.41
LLama3-Base-SYNPO Iter265.7083.2261.7364.0376.5656.2567.92
LLama3-Base-SYNPO Iter366.5583.5763.5363.9176.8055.2768.27
LLama3-Base-SYNPO Iter466.4783.4463.6963.7976.9055.7268.34
+ +Table 4: Open LLM Leaderboard results. TQA stands for TruthfulQA. The asterisk (*) represents the best performance across multiple iterations. Compared to the SFT versions, SYNPO achieves an overall improvement of $3.19\%$ for Mistral and $5.00\%$ for Llama3 on the average score. + +formance of LLMs. It includes six different datasets, evaluating LLMs on commonsense reasoning (Arc (Clark et al., 2018), HellaSwag (Zellers et al., 2019), Winogrande (Sakaguchi et al., 2021)), wide knowledge (MMLU (Hendrycks et al., 2020), TruthfulQA (Lin et al., 2021)), and math (GSM8k (Cobbe et al., 2021)). The six additional LLM Harness tasks include Openbook Question Answering (OBQA) (Mihaylov et al., 2018) and Haerae (Son et al., 2023) for model knowledge, MathQA (Amini et al., 2019), XNLI (Conneau et al., 2018), and PROST (Aroca-Ouellette et al., 2021) for reasoning, as well as Toxigen (Hartvigsen et al., 2022) for toxicity evaluation. $^6$ + +Open LLM Leaderboard On the Open LLM leaderboard, we observe an overall improvement of $3.19\%$ of Mistral-Base-SFT and $5.00\%$ of Llama3-Base-SFT on the average score. Specifically, SynPO achieves over $6\%$ improvement on the ARC challenge and over $16\%$ on TruthfulQA compared to the SFT model, after four rounds of self-boosting. Notably, the performance of Mistral-Base on GSM8K has experienced a decline, whereas Llama3-Base has demonstrated an improvement of nearly 4 points on the same benchmark. This disparity likely stems from the superior data filtering capability of ArmoRM-Llama3-8B-v0.1 compared to the 0.4B PairRM. ArmoRM-Llama3-8B-v0.1 effectively mitigates erroneous responses and enhances mathematical problem-solving performance. + +LLM Harness Tasks The advantages above are also reflected in the results for more diverse tasks in LLM Harness, as evidenced by Table 5. Previous works (Wu et al., 2024b; Meng et al., 2024) demonstrate that preference optimization can induce the "alignment tax" - aligning models with human preferences can improve performance for only $1\sim 2$ iterations or even degrade overall performance on downstream tasks (Askell et al., 2021). Our method exhibits similar behavior on MathQA; however, overall, SynPO shows improvements across more iterations on other tasks. This is because synthesizing better chosen candidates introduces additional supervision, partially mitigating the alignment tax issue and enabling LLMs to continuously enhance their capabilities on downstream tasks at the same time of alignment. + +# 4 ABLATION STUDIES + +# 4.1 SYNTHETIC PROMPTS AND RESPONSES + +We have demonstrated the diversity of prompts generated by SynPO in Section 2.1. To further validate the self-prompt generator, we compare the generated prompts with manual collected + +
ModelOBQAHaeraeMathQAXNLIToxigenPROSTAverage
Mistral-Base-SFT46.4039.9636.2543.7660.1152.0446.42
Manual Collection50.2040.3536.7244.6562.8354.6648.24
Sampling-Ranking Iters*47.6040.1536.2144.7162.4553.7447.48
Self-Rewarding Iters*48.6040.1536.2544.1761.2853.2947.29
Mistral-Base-SynPO Iter148.0039.7836.0544.2360.7452.3946.87
Mistral-Base-SynPO Iter250.4040.0536.8543.9760.9653.0447.55
Mistral-Base-SynPO Iter351.2040.5135.8844.3760.7453.4547.69
Mistral-Base-SynPO Iter451.4040.8836.4844.4763.4055.0548.61
Llama3-Base-SFT46.2061.7842.0445.4768.8352.4052.79
Manual Collection51.6061.5942.5144.7774.3855.9655.14
Sampling-Ranking Iters*50.8062.0542.8146.6774.6855.4155.40
Self-Rewarding Iters*48.6062.4242.7846.3174.1554.2354.75
Llama3-Base-SynPO Iter148.2061.9642.7146.1571.1753.7753.99
Llama3-Base-SynPO Iter250.8062.6042.7546.3474.0454.8555.23
Llama3-Base-SynPO Iter351.0062.5142.7846.3775.1155.2955.51
Llama3-Base-SynPO Iter452.0062.5142.6546.2775.1856.1455.79
+ +Table 5: Downstream performance in each SynPO iteration on six tasks in LM Evaluation Harness. An asterisk (*) represents the best performance across multiple iterations. + +prompts (Cui et al., 2023) and Self-Instruct prompts (Wang et al., 2022). For each prompt construction approach, we randomly sample 20k prompts and construct response pairs through both SynPO and Sampling-Ranking. We compare the single iteration results of Llama3-8B. As shown in Table 6, whether through self-refinement or Sampling-Ranking, synthetic prompts generated by SynPO lead to better-aligned models, validating the quality of these prompts. It is worth mentioning that SynPO prompts are even more effective than the superset of its seed training data, UltraFeedback prompts. This increased effectiveness may be attributed to the greater diversity of SynPO prompts, achieved through the keyword sampling process in prompt synthesis. Results of mixing SynPO and manual collected prompts further indicate the potential of SynPO in augmenting existing prompts. + +# 4.2 IMPACT OF SEED DATA + +SynPO involves training LLMs solely on synthetic preference data while using seed SFT data for validation. To investigate the maximum impact of the seed SFT data, we compare SynPO with the following settings: 1) Seed SFT: Directly fine-tuning the LLM using seed data. 2) Seed PO: For each prompt in the seed SFT data, using the gold standard response in the seed data as the chosen response and the initial policy model response as the rejected response for preference optimization. 3) Seed $SFT + PO$ : To avoid distribution shifts in directly using seed SFT data, we first obtain a model fine-tuned on seed data as in 1), then construct preference data using the model output and gold standard responses. 4) Seed $SFT + PO^{me}$ : Training on data from 3) for multiple epochs. The results on AlpacaEval 2.0 are presented in Table 7. Among the evaluated methods except for SynPO, setting 3) is most analogous to SynPO, and proves to be the most effective. However, due to the limited quantity of seed data, the improvement is less than that achieved by iterative SynPO on synthetic data. Training under such conditions for multiple epochs does not yield further improvements and even degrades performance. These findings validate that SynPO is a promising approach to construct preference data and maximize the utilization of minimal high-quality data. + +# 5 RELATED WORK + +Preference Data Construction Preference data are triplets consisting of user prompts, user-preferred responses, and non-preferred responses. Acquiring preference data from humans can be resource intensive, often constrained by the data collection platform (Ouyang et al., 2022a) or the cost of human annotation (Bai et al., 2022a; Ethayarajh et al., 2022; Nakano et al., 2021). To alleviate this problem, researchers have started using teacher LLMs, such as GPT-4 (Achiam et al., 2023), + +
PromptsSynPOSampling-Ranking
LC (%)WR (%)LC (%)WR (%)
Manual Collection23.825.67.86.2
Self-Instruct21.721.49.14.6
SynPO24.324.59.25.3
SynPO Mix.23.429.414.26.9
+ +Table 6: Comparison of various prompt generation methods on AlpacaEval 2.0. SynPO Mix. combines SynPO prompts with manually collected prompts. + +
MethodLC (%)WR (%)
Seed SFT20.119.7
Seed PO11.610.7
Seed SFT + PO24.620.9
Seed SFT + POme22.415.0
SynPO Iter432.133.6
+ +Table 7: Impact analysis of seed data on AlpacaEval 2.0. POme refers to preference optimization over multiple epochs. + +to simulate human preferences (Cui et al., 2023; Ding et al., 2023; Huang et al., 2024). Given user prompts and candidate responses, this line of work employs a stronger model to annotate preferences, thereby overcoming the scarcity and constraints of existing preference data (Cui et al., 2023). However, the prompts still need to be collected (Cui et al., 2023), which limits the domain, diversity, and quantity of the data. Both human annotation and the utilization of large teacher model APIs incur substantial costs (Shi et al., 2023). Moreover, relying solely on reward scores or win-lose annotation fails to fully capture the subtleties and complexities of human preferences. + +LLM Self-Boosting Previous work has advanced the self-boosting of LLMs by searching for high-reward behaviors (Tian et al., 2024; Zhang et al., 2024), using LLMs as judges to select responses (Yuan et al., 2024; Wang et al., 2024a; Wu et al., 2024a; Kim et al., 2024), and leveraging self-play strategies (Chen et al., 2024; Cheng et al., 2024; Luo et al., 2024; Wu et al., 2024b). These works typically use a fixed set of existing prompts, limiting the LLM ability to learn across wide scenarios. Furthermore, the deterministic reward signals in these methods do not help the model recognize subtle discrepancies between its responses and ideal responses. Prior to our work, Constitutional AI (Bai et al., 2022b) and SELF (Lu et al., 2023) used AI to generate non-deterministic feedback for training. Constitutional AI used refinement data for reward models, while SELF employed GPT-4 for data generation and taught models self-refinement. However, these methods did not utilize comparative information between pre- and post-revision texts for training. + +Synthetic Data for LLMs Acquiring human-generated data is costly and time-consuming, leading to the use of synthetic data for LLM training (Wang et al., 2022; Xu et al., 2023a; Li et al., 2024b). Unnatural Instructions (Honovich et al., 2022) and Self-Instruct (Wang et al., 2022) use seed instructions to generate new prompts, while WizardLM (Xu et al., 2023a) and WizardMath (Luo et al., 2023) rewrite these instructions into more complex forms using ChatGPT. Seed topics also produce textbook-like data (Li et al., 2023; 2024b) or self-chat dialogues (Xu et al., 2023b; Ding et al., 2023) for instruction tuning. These methods often require strong LLMs or examples, benefiting from model distillation (Xu et al., 2023a; Li et al., 2024b;a). Our approach uses the model itself to generate prompts and responses without needing carefully designed topics, extending beyond the model's inherent sampling space. This brings generative rewards to the LLM self-boosting process, particularly benefiting initially weaker models. It resembles direct preference knowledge distillation (Li et al., 2024d) but does not rely on large-scale teacher model responses for supervision. Additionally, our work shares a similar spirit with CommonGen (Lin et al., 2020) in generating sentences from keywords and CHEF (Seo et al., 2023) in creating synthetic data for contrastive learning. + +# 6 CONCLUSION + +We introduce self-boosting LLM with synthetic preference data, SynPO, a method for LLM alignment through iterative training on synthetic data. In SynPO, we innovatively base the entire training process on synthetic data and only employ limited SFT data for validation. SynPO diversifies the prompts and dynamically guides LLMs to improve their own output, using pre- and post-refinement generations as synthetic preference pairs for training in the next iteration. Experimental results show that SynPO leads to significant improvements on both instruction-following capabilities and task performance. This strategy sheds light on high-quality synthetic data generation and self-alignment with minimal supervision, both of which are critical for the continuous development of LLMs. + +# 7 ACKNOWLEDGEMENT + +This paper is supported by NSFC project 62476009. + +# REFERENCES + +Josh Achiam, Steven Adler, Sandhini Agarwal, Lama Ahmad, Ilge Akkaya, Florencia Leoni Aleman, Diogo Almeida, Janko Altenschmidt, Sam Altman, Shyamal Anadkat, et al. Gpt-4 technical report. arXiv preprint arXiv:2303.08774, 2023. +Aida Amini, Saadia Gabriel, Peter Lin, Rik Koncel-Kedziorski, Yejin Choi, and Hannaneh Hajishirzi. Mathqa: Towards interpretable math word problem solving with operation-based formalisms, 2019. +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, pp. 4597-4608, Online, August 2021. Association for Computational Linguistics. URL https://aclanthology.org/2021-findings-acl.404. +Amanda Askell, Yuntao Bai, Anna Chen, Dawn Drain, Deep Ganguli, Tom Henighan, Andy Jones, Nicholas Joseph, Benjamin Mann, Nova Dassarma, Nelson Elhage, Zac Hatfield-Dodds, Danny Hernandez, John Kernion, Kamal Ndousse, Catherine Olsson, Dario Amodei, Tom B. Brown, Jack Clark, Sam McCandlish, Christopher Olah, and Jared Kaplan. A general language assistant as a laboratory for alignment. ArXiv, abs/2112.00861, 2021. URL https://api-semanticscholar.org/CorpusID:244799619. +Yuntao Bai, Andy Jones, Kamal Ndousse, Amanda Askell, Anna Chen, Nova DasSarma, Dawn Drain, Stanislav Fort, Deep Ganguli, Tom Henighan, Nicholas Joseph, Saurav Kadavath, Jackson Kernion, Tom Conerly, Sheer El-Showk, Nelson Elhage, Zac Hatfield-Dodds, Danny Hernandez, Tristan Hume, Scott Johnston, Shauna Kravec, Liane Lovitt, Neel Nanda, Catherine Olsson, Dario Amodei, Tom Brown, Jack Clark, Sam McCandlish, Chris Olah, Ben Mann, and Jared Kaplan. Training a helpful and harmless assistant with reinforcement learning from human feedback, 2022a. +Yuntao Bai, Saurav Kadavath, Sandipan Kundu, Amanda Askell, John Kernion, Andy Jones, Anna Chen, Anna Goldie, Azalia Mirhoseini, Cameron McKinnon, Carol Chen, Catherine Olsson, Christopher Olah, Danny Hernandez, Dawn Drain, Deep Ganguli, Dustin Li, Eli Tran-Johnson, E Perez, Jamie Kerr, Jared Mueller, Jeff Ladish, J Landau, Kamal Ndousse, Kamilé Lukoiūtē, Liane Lovitt, Michael Sellitto, Nelson Elhage, Nicholas Schiefer, Noem'i Mercado, Nova Dassarma, Robert Lasenby, Robin Larson, Sam Ringer, Scott Johnston, Shauna Kravec, Sheer El Showk, Stanislav Fort, Tamera Lanham, Timothy Telleen-Lawton, Tom Conerly, Tom Henighan, Tristan Hume, Sam Bowman, Zac Hatfield-Dodds, Benjamin Mann, Dario Amodei, Nicholas Joseph, Sam McCandlish, Tom B. Brown, and Jared Kaplan. Constitutional ai: Harmlessness from ai feedback. ArXiv, abs/2212.08073, 2022b. URL https://api-semanticscholar.org/CorpusID:254823489. +Edward Beeching, Clémentine Fourrier, Nathan Habib, Sheon Han, Nathan Lambert, Nazneen Rajani, Omar Sanseviero, Lewis Tunstall, and Thomas Wolf. Open llm leaderboard. https://huggingface.co/spaces/open-llm-leaderboard-old/open_1lm_leaderboard, 2023. +Zixiang Chen, Yihe Deng, Huizhuo Yuan, Kaixuan Ji, and Quanquan Gu. Self-play fine-tuning converts weak language models to strong language models. arXiv preprint arXiv:2401.01335, 2024. +Pengyu Cheng, Tianhao Hu, Han Xu, Zhisong Zhang, Yong Dai, Lei Han, and Nan Du. Selfplaying adversarial language game enhances llm reasoning. ArXiv, abs/2404.10642, 2024. URL https://api-semanticscholar.org/CorpusID:269157364. +Wei-Lin Chiang, Zhuohan Li, Zi Lin, Ying Sheng, Zhanghao Wu, Hao Zhang, Lianmin Zheng, Siyuan Zhuang, Yonghao Zhuang, Joseph E. Gonzalez, Ion Stoica, and Eric P. Xing. Vicuna: An + +open-source chatbot impressing gpt-4 with $90\%$ chatgpt quality, March 2023. URL https://lmsys.org/blog/2023-03-30-vicuna/. +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, 2018. +Karl Cobbe, Vineet Kosaraju, Mohammad Bavarian, Mark Chen, Heewoo Jun, Lukasz Kaiser, Matthias Plappert, Jerry Tworek, Jacob Hilton, Reiichiro Nakano, et al. Training verifiers to solve math word problems. arXiv preprint arXiv:2110.14168, 2021. +Alexis Conneau, Rudy Rinott, Guillaume Lample, Adina Williams, Samuel R. Bowman, Holger Schwenk, and Veselin Stoyanov. Xnli: Evaluating cross-lingual sentence representations. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing. Association for Computational Linguistics, 2018. +Ganqu Cui, Lifan Yuan, Ning Ding, Guanming Yao, Wei Zhu, Yuan Ni, Guotong Xie, Zhiyuan Liu, and Maosong Sun. Ultrafeedback: Boosting language models with high-quality feedback, 2023. +Ning Ding, Yulin Chen, Bokai Xu, Yujia Qin, Zhi Zheng, Shengding Hu, Zhiyuan Liu, Maosong Sun, and Bowen Zhou. Enhancing chat language models by scaling high-quality instructional conversations, 2023. +Abhimanyu Dubey, Abhinav Jauhri, Abhinav Pandey, Abhishek Kadian, Ahmad Al-Dahle, Aiesha Letman, Akhil Mathur, Alan Schelten, Amy Yang, Angela Fan, et al. The llama 3 herd of models. arXiv preprint arXiv:2407.21783, 2024. +Yann Dubois, Balázs Galambosi, Percy Liang, and Tatsunori B Hashimoto. Length-controlled alpacaeval: A simple way to debias automatic evaluators. arXiv preprint arXiv:2404.04475, 2024. +Kawin Ethayarajh, Yejin Choi, and Swabha Swayamdipta. Understanding dataset difficulty with $\nu$ -usable information. In Kamalika Chaudhuri, Stefanie Jegelka, Le Song, Csaba Szepesvari, Gang Niu, and Sivan Sabato (eds.), Proceedings of the 39th International Conference on Machine Learning, volume 162 of Proceedings of Machine Learning Research, pp. 5988-6008. PMLR, 2022. +Kawin Ethayarajh, Winnie Xu, Niklas Muennighoff, Dan Jurafsky, and Douwe Kiela. Kto: Model alignment as prospect theoretic optimization. ArXiv, abs/2402.01306, 2024. URL https://api.sementicscholar.org/CorpusID:267406810. +Leo Gao, Jonathan Tow, Baber Abbasi, Stella Biderman, Sid Black, Anthony DiPofi, Charles Foster, Laurence Golding, Jeffrey Hsu, Alain Le Noac'h, Haonan Li, Kyle McDonell, Niklas Muennighoff, Chris Ociepa, Jason Phang, Laria Reynolds, Hailey Schoelkopf, Aviya Skowron, Lintang Sutawika, Eric Tang, Anish Thite, Ben Wang, Kevin Wang, and Andy Zou. A framework for few-shot language model evaluation, 07 2024. URL https://zenodo.org/records/12608602. +Caglar Gulcehre, Tom Le Paine, Srivatsan Srinivasan, Ksenia Konyushkova, Lotte Weerts, Abhishek Sharma, Aditya Siddhant, Alexa Ahern, Miaosen Wang, Chenjie Gu, Wolfgang Macherey, A. Doucet, Orhan First, and Nando de Freitas. Reinforced self-training (rest) for language modeling. ArXiv, abs/2308.08998, 2023. URL https://api-semanticscholar.org/ CorpusID:261031028. +Thomas Hartvigsen, Saadia Gabriel, Hamid Palangi, Maarten Sap, Dipankar Ray, and Ece Kamar. Toxigen: A large-scale machine-generated dataset for implicit and adversarial hate speech detection. In Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics, 2022. +Dan Hendrycks, Collin Burns, Steven Basart, Andy Zou, Mantas Mazeika, Dawn Song, and Jacob Steinhardt. Measuring massive multitask language understanding. arXiv preprint arXiv:2009.03300, 2020. + +Or Honovich, Thomas Scialom, Omer Levy, and Timo Schick. Unnatural instructions: Tuning language models with (almost) no human labor. ArXiv, abs/2212.09689, 2022. URL https://api-semanticscholar.org/CorpusID:254853659. +Shengding Hu, Yi-Xiao Luo, Huadong Wang, Xingyi Cheng, Zhiyuan Liu, and Maosong Sun. Won't get fooled again: Answering questions with false premises. In Annual Meeting of the Association for Computational Linguistics, 2023. URL https://apisemantic scholar.org/ CorpusID:259341789. +Yulan Hu, Qingyang Li, Ouyang Sheng, Ge Chen, Kaihui Chen, Lijun Mei, Xucheng Ye, Fuzheng Zhang, and Yong Liu. Towards comprehensive preference data collection for reward modeling. ArXiv, abs/2406.16486, 2024. URL https://api_semanticscholar.org/ CorpusID:270703662. +Shengyi Costa Huang, Agustín Piqueres, Kashif Rasul, Philipp Schmid, Daniel Vila, and Lewis Tunstall. Open hermes preferences. https://huggingface.co/datasets/argilla/OpenHermesPreferences, 2024. +Dongfu Jiang, Xiang Ren, and Bill Yuchen Lin. Llm-blender: Ensembling large language models with pairwise ranking and generative fusion. In Annual Meeting of the Association for Computational Linguistics, 2023. URL https://api_semanticscholar.org/CorpusID:259075564. +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), pp. 2567-2577, 2019. +Dongyoung Kim, Kimin Lee, Jinwoo Shin, and Jaehyung Kim. Aligning large language models with self-generated preference data. ArXiv, abs/2406.04412, 2024. URL https://api.sementicscholar.org/CorpusID:270357971. +Tom Kwiatkowski, Jennimaria Palomaki, Olivia Redfield, Michael Collins, Ankur Parikh, Chris Alberti, Danielle Epstein, Illia Polosukhin, Matthew Kelcey, Jacob Devlin, Kenton Lee, Kristina N. Toutanova, Llion Jones, Ming-Wei Chang, Andrew Dai, Jakob Uszkoreit, Quoc Le, and Slav Petrov. Natural questions: a benchmark for question answering research. Transactions of the Association of Computational Linguistics, 2019. +Guokun Lai, Qizhe Xie, Hanxiao Liu, Yiming Yang, and Eduard Hovy. RACE: Large-scale ReAding comprehension dataset from examinations. In Martha Palmer, Rebecca Hwa, and Sebastian Riedel (eds.), Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pp. 785-794, Copenhagen, Denmark, September 2017. Association for Computational Linguistics. doi: 10.18653/v1/D17-1082. URL https://aclanthology.org/D17-1082. +Ang Li, Qiugen Xiao, Peng Cao, Jian Tang, Yi Yuan, Zijie Zhao, Xiaoyuan Chen, Liang Zhang, Xiangyang Li, Kaitong Yang, Weidong Guo, Yukang Gan, Jeffrey Xu Yu, Dan Tong Wang, and Ying Shan. Hrlaif: Improvements in helpfulness and harmlessness in open-domain reinforcement learning from ai feedback. ArXiv, abs/2403.08309, 2024a. URL https://api.sementicscholar.org/CorpusID:268379328. +Haoran Li, Qingxiu Dong, Zhengyang Tang, Chaojun Wang, Xingxing Zhang, Haoyang Huang, Shaohan Huang, Xiaolong Huang, Zeqiang Huang, Dongdong Zhang, Yuxian Gu, Xin Cheng, Xun Wang, Si-Qing Chen, Li Dong, Wei Lu, Zhifang Sui, Benyou Wang, Wai Lam, and Furu Wei. Synthetic data (almost) from scratch: Generalized instruction tuning for language models. ArXiv, abs/2402.13064, 2024b. URL https://api_semanticscholar.org/ CorpusID:267759981. +Tianle Li, Wei-Lin Chiang, Evan Frick, Lisa Dunlap, Tianhao Wu, Banghua Zhu, Joseph E. Gonzalez, and Ion Stoica. From crowdsourced data to high-quality benchmarks: Arena-hard and bench-builder pipeline. ArXiv, abs/2406.11939, 2024c. URL https://api-semanticscholar.org/CorpusID:270562889. + +Yixing Li, Yuxian Gu, Li Dong, Dequan Wang, Yu Cheng, and Furu Wei. Direct preference knowledge distillation for large language models. ArXiv, abs/2406.19774, 2024d. URL https://api_semanticscholar.org/CorpusID:270845775. +Yuanzhi Li, Sébastien Bubeck, Ronen Eldan, Allie Del Giorno, Suriya Gunasekar, and Yin Tat Lee. Textbooks are all you need ii: phi-1.5 technical report. arXiv preprint arXiv:2309.05463, 2023. +Percy Liang, Rishi Bommasani, Tony Lee, Dimitris Tsipras, Dilara Soylu, Michihiro Yasunaga, Yian Zhang, Deepak Narayanan, Yuhuai Wu, Ananya Kumar, Benjamin Newman, Binhang Yuan, Bobby Yan, Ce Zhang, Christian Cosgrove, Christopher D. Manning, Christopher Ré, Diana Acosta-Navas, Drew A. Hudson, Eric Zelikman, Esin Durmus, Faisal Ladhak, Frieda Rong, Hongyu Ren, Huaxiu Yao, Jue Wang, Keshav Santhanam, Laurel J. Orr, Lucia Zheng, Mert Yuk-sekgönül, Mirac Suzgun, Nathan Kim, Neel Guha, Niladri S. Chatterji, Omar Khattab, Peter Henderson, Qian Huang, Ryan Chi, Sang Michael Xie, Shibani Santurkar, Surya Ganguli, Tatsunori Hashimoto, Thomas Icard, Tianyi Zhang, Vishrav Chaudhary, William Wang, Xuechen Li, Yifan Mai, Yuhui Zhang, and Yuta Koreeda. Holistic evaluation of language models. Trans. Mach. Learn. Res., 2023, 2023. URL https://openreview.net/forum?id=iO4LZibEqW. +Bill Yuchen Lin, Ming Shen, Wangchunshu Zhou, Pei Zhou, Chandra Bhagavatula, Yejin Choi, and Xiang Ren. *Commongen: A constrained text generation challenge for generative commonsense reasoning*. In *Dipanjan Das*, Hannaneh Hajishirzi, Andrew McCallum, and Sameer Singh (eds.), *Conference on Automated Knowledge Base Construction*, *AKBC* 2020, Virtual, June 22-24, 2020, 2020. URL https://www.akbc.ws/2020/papers/yuD2q50HWv. +Stephanie Lin, Jacob Hilton, and Owain Evans. Truthfulqa: Measuring how models mimic human falsehoods. arXiv preprint arXiv:2109.07958, 2021. +Jian Liu, Leyang Cui, Hanmeng Liu, Dandan Huang, Yile Wang, and Yue Zhang. Logiqa: A challenge dataset for machine reading comprehension with logical reasoning, 2020. +Jianqiao Lu, Wanjun Zhong, Wenyong Huang, Yufei Wang, Fei Mi, Baojun Wang, Weichao Wang, Lifeng Shang, and Qun Liu. Self: Self-evolution with language feedback. 2023. URL https://api-semanticscholar.org/CorpusID:263334155. +Haipeng Luo, Qingfeng Sun, Can Xu, Pu Zhao, Jianguang Lou, Chongyang Tao, Xiubo Geng, Qing-wei Lin, Shifeng Chen, and Dongmei Zhang. Wizardmath: Empowering mathematical reasoning for large language models via reinforced evol-instruct. arXiv preprint arXiv:2308.09583, 2023. +Haipeng Luo, Qingfeng Sun, Can Xu, Pu Zhao, Qingwei Lin, Jianguang Lou, Shifeng Chen, Yansong Tang, and Weizhu Chen. Arena learning: Build data flywheel for llms posttraining via simulated chatbot arena. ArXiv, abs/2407.10627, 2024. URL https://api.sementicscholar.org/CorpusID:271213086. +Aman Madaan, Niket Tandon, Prakhar Gupta, Skyler Hallinan, Luyu Gao, Sarah Wiegreffe, Uri Alon, Nouha Dziri, Shrimai Prabhumoye, Yiming Yang, Sean Welleck, Bodhisattwa Prasad Majumder, Shashank Gupta, Amir Yazdanbakhsh, and Peter Clark. Self-refine: Iterative refinement with self-feedback. ArXiv, abs/2303.17651, 2023. URL https://api.sementicscholar.org/CorpusID:257900871. +Yu Meng, Mengzhou Xia, and Danqi Chen. Simpo: Simple preference optimization with a reference-free reward. arXiv preprint arXiv:2405.14734, 2024. +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. +Nasrin Mostafazadeh, Nathanael Chambers, Xiaodong He, Devi Parikh, Dhruv Batra, Lucy Vanderwende, Pushmeet Kohli, and James Allen. A corpus and evaluation framework for deeper understanding of commonsense stories, 2016. +Reiichiro Nakano, Jacob Hilton, Suchir Balaji, Jeff Wu, Long Ouyang, Christina Kim, Christopher Hesse, Shantanu Jain, Vineet Kosaraju, William Saunders, Xu Jiang, Karl Cobbe, Tyna Eloundou, Gretchen Krueger, Kevin Button, Matthew Knight, Benjamin Chess, and John Schulman. Webgpt: Browser-assisted question-answering with human feedback. In arXiv, 2021. + +Thao Nguyen, Jeffrey Li, Sewoong Oh, Ludwig Schmidt, Jason Weston, Luke Zettlemoyer, and Xian Li. Better alignment with instruction back-and-forth translation. 2024. URL https://api-semanticscholar.org/CorpusID:271768943. +Long Ouyang, Jeff Wu, Xu Jiang, Diogo Almeida, Carroll L. Wainwright, Pamela Mishkin, Chong Zhang, Sandhini Agarwal, Katarina Slama, Alex Ray, John Schulman, Jacob Hilton, Fraser Kelton, Luke Miller, Maddie Simens, Amanda Askell, Peter Welinder, Paul Christiano, Jan Leike, and Ryan Lowe. Training language models to follow instructions with human feedback, 2022a. +Long Ouyang, Jeff Wu, Xu Jiang, Diogo Almeida, Carroll L. Wainwright, Pamela Mishkin, Chong Zhang, Sandhini Agarwal, Katarina Slama, Alex Ray, John Schulman, Jacob Hilton, Fraser Kelton, Luke E. Miller, Maddie Simens, Amanda Askell, Peter Welinder, Paul Francis Christiano, Jan Leike, and Ryan J. Lowe. Training language models to follow instructions with human feedback. ArXiv, abs/2203.02155, 2022b. URL https://api-semanticscholar.org/CorpusID:246426909. +Samuel J. Paech. Eq-bench: An emotional intelligence benchmark for large language models, 2023. +Anselmo Peñas, Eduard H. Hovy, Pamela Forner, Álvaro Rodrigo, Richard F. E. Sutcliffe, and Roser Morante. Qa4mre 2011-2013: Overview of question answering for machine reading evaluation. In CLEF, 2013. +Guilherme Penedo, Quentin Malartic, Daniel Hesslow, Ruxandra Cojocaru, Alessandro Cappelli, Hamza Alobeidli, Baptiste Pannier, Ebtesam Almazrouei, and Julien Launay. The RefinedWeb dataset for Falcon LLM: outperforming curated corpora with web data, and web data only. arXiv preprint arXiv:2306.01116, 2023. +Rafael Rafailov, Archit Sharma, Eric Mitchell, Christopher D Manning, Stefano Ermon, and Chelsea Finn. Direct preference optimization: Your language model is secretly a reward model. Advances in Neural Information Processing Systems, 36, 2024. +Nils Reimers and Iryna Gurevych. Sentence-bert: Sentence embeddings using siamese bert-networks. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing. Association for Computational Linguistics, 11 2019. URL https://arxiv.org/abs/1908.10084. +Corby Rosset, Ching-An Cheng, Arindam Mitra, Michael Santacroce, Ahmed Awadallah, and Tengyang Xie. Direct nash optimization: Teaching language models to self-improve with general preferences. ArXiv, abs/2404.03715, 2024. URL https://api_semanticscholar.org/ CorpusID:268987488. +Keisuke Sakaguchi, Ronan Le Bras, Chandra Bhagavatula, and Yejin Choi. Winogrande: An adversarial winograd schema challenge at scale. Communications of the ACM, 64(9):99-106, 2021. +Maarten Sap, Hannah Rashkin, Derek Chen, Ronan Le Bras, and Yejin Choi. Social iqa: Common-sense reasoning about social interactions. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pp. 4463-4473, 2019. +Jaehyung Seo, Hyeonseok Moon, Jaewook Lee, Sugyeong Eo, Chanjun Park, and Heuiseok Lim. CHEF in the language kitchen: A generative data augmentation leveraging korean morpheme ingredients. In Houda Bouamor, Juan Pino, and Kalika Bali (eds.), Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing, EMNLP 2023, Singapore, December 6-10, 2023, pp. 6014-6029. Association for Computational Linguistics, 2023. doi: 10.18653/V1/2023.EMNLP-MAIN.367. URL https://doi.org/10.18653/v1/2023.emnlp-main.367. +Taiwei Shi, Kai Chen, and Jieyu Zhao. Safer-instruct: Aligning language models with automated preference data. ArXiv, abs/2311.08685, 2023. URL https://api(semanticscholar.org/CorpusID:265212888. +Chandan Singh, John Xavier Morris, Jyoti Aneja, Alexander M Rush, and Jianfeng Gao. Explaining patterns in data with language models via interpretable autoprompting. 2022. + +Guijin Son, Hanwoo Lee, Suwan Kim, Huiseo Kim, Jaecheol Lee, Je Won Yeom, Jihyu Jung, Jung Woo Kim, and Songseong Kim. Hae-rae bench: Evaluation of korean knowledge in language models, 2023. +Feifan Song, Bowen Yu, Hao Lang, Haiyang Yu, Fei Huang, Houfeng Wang, and Yongbin Li. Scaling data diversity for fine-tuning language models in human alignment. In International Conference on Language Resources and Evaluation, 2024. URL https://api.sementicscholar.org/CorpusID:268512826. +Ye Tian, Baolin Peng, Linfeng Song, Lifeng Jin, Dian Yu, Haitao Mi, and Dong Yu. Toward self-improvement of llms via imagination, searching, and criticizing. ArXiv, abs/2404.12253, 2024. URL https://api.sementicscholar.org/CorpusID:269214525. +Lewis Tunstall, Edward Beeching, Nathan Lambert, Nazneen Rajani, Kashif Rasul, Younes Belkada, Shengyi Huang, Leandro von Werra, Clémentine Fourrier, Nathan Habib, Nathan Sarrazin, Omar Sanseviero, Alexander M. Rush, and Thomas Wolf. Zephyr: Direct distillation of lm alignment, 2023. +Tianlu Wang, Ilia Kulikov, Olga Golovneva, Ping Yu, Weizhe Yuan, Jane Dwivedi-Yu, Richard Yuanzhe Pang, Maryam Fazel-Zarandi, Jason Weston, and Xian Li. Self-taught evaluators. 2024a. URL https://api-semanticscholar.org/CorpusID:271709606. +Yizhong Wang, Yeganeh Kordi, Swaroop Mishra, Alisa Liu, Noah A. Smith, Daniel Khashabi, and Hannaneh Hajishirzi. Self-instruct: Aligning language models with self-generated instructions. In Annual Meeting of the Association for Computational Linguistics, 2022. URL https://apisemantic scholar.org/CorpusID:254877310. +Yubo Wang, Xueguang Ma, Ge Zhang, Yuansheng Ni, Abhranil Chandra, Shiguang Guo, Weiming Ren, Aaran Arulraj, Xuan He, Ziyan Jiang, Tianle Li, Max Ku, Kai Wang, Alex Zhuang, Rongqi Fan, Xiang Yue, and Wenhu Chen. Mmlu-pro: A more robust and challenging multi-task language understanding benchmark, 2024b. +Tianhao Wu, Weizhe Yuan, Olga Golovneva, Jing Xu, Yuandong Tian, Jiantao Jiao, Jason Weston, and Sainbayar Sukhbaatar. Meta-rewarding language models: Self-improving alignment with llm-as-a-meta-judge. 2024a. URL https://api_semanticscholar.org/CorpusID: 271533411. +Yue Wu, Zhiqing Sun, Huizhuo Yuan, Kaixuan Ji, Yiming Yang, and Quanquan Gu. Self-play preference optimization for language model alignment. 2024b. +Can Xu, Qingfeng Sun, Kai Zheng, Xiubo Geng, Pu Zhao, Jiazhan Feng, Chongyang Tao, and Daxin Jiang. Wizardlm: Empowering large language models to follow complex instructions. arXiv preprint arXiv:2304.12244, 2023a. +Canwen Xu, Daya Guo, Nan Duan, and Julian McAuley. Baize: An open-source chat model with parameter-efficient tuning on self-chat data. arXiv preprint arXiv:2304.01196, 2023b. +Yueqin Yin, Zhendong Wang, Yujia Xie, Weizhu Chen, and Mingyuan Zhou. Self-augmented preference optimization: Off-policy paradigms for language model alignment. ArXiv, abs/2405.20830, 2024. URL https://api(semanticscholar.org/CorpusID:270199610. +Weizhe Yuan, Richard Yuanzhe Pang, Kyunghyun Cho, Sainbayar Sukhbaatar, Jing Xu, and Jason Weston. Self-rewarding language models. ArXiv, abs/2401.10020, 2024. URL https://api.sementicscholar.org/CorpusID:267035293. +Rowan Zellers, Yonatan Bisk, Roy Schwartz, and Yejin Choi. Swag: A large-scale adversarial dataset for grounded commonsense inference. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing (EMNLP), 2018. +Rowan Zellers, Ari Holtzman, Yonatan Bisk, Ali Farhadi, and Yejin Choi. Hellaswag: Can a machine really finish your sentence? arXiv preprint arXiv:1905.07830, 2019. + +Dan Zhang, Sining Zhoubian, Yisong Yue, Yuxiao Dong, and Jie Tang. Rest-mcts*: Llm self-training via process reward guided tree search. ArXiv, abs/2406.03816, 2024. URL https://api-semanticscholar.org/CorpusID:270285630. +Lianmin Zheng, Wei-Lin Chiang, Ying Sheng, Siyuan Zhuang, Zhanghao Wu, Yonghao Zhuang, Zi Lin, Zhuohan Li, Dacheng Li, Eric Xing, et al. Judging llm-as-a-judge with mt-bench and chatbot arena. Advances in Neural Information Processing Systems, 36, 2024. +Ruiqi Zhong, Charlie Snell, Dan Klein, and Jacob Steinhardt. Describing differences between text distributions with natural language. In International Conference on Machine Learning, pp. 27099-27116. PMLR, 2022. +Wanjun Zhong, Ruixiang Cui, Yiduo Guo, Yaobo Liang, Shuai Lu, Yanlin Wang, Amin Saied, Weizhu Chen, and Nan Duan. Agieval: A human-centric benchmark for evaluating foundation models, 2023. + +# LIMITATIONS + +Our approach begins with a small SFT dataset and does not necessitate specifically labeled data for training a response improver. We assume that model-generated outputs closely resemble the gold standard responses in the SFT, enabling them to serve as training data for the response improver. This necessitates filtering out pairs where the gold standard is inferior to the model-generated output. Such data can cause the response improver to rewrite text through paraphrasing or substantial alteration, as the training data comprises pseudo pairs rather than minimally edited original responses. While prompting a more powerful LLM to generate rewriting-specific data, as suggested by Lu et al. (2023), can alleviate this, it sacrifices the benefit of learning the distribution gap. + +SynPO leverages a small, high-quality dataset repeatedly to guide synthetic data generation, making the seed data quality vital. This approach requires only a small amount of high-quality data for validation, significantly reducing annotation costs. Additionally, recent work on direct on-policy sampling methods (Wu et al., 2024b), which do not need additional SFT data, shows considerable promise. After our final round of improvements, the model-generated responses are already of high quality. Future enhancements can incorporate on-policy preference optimization techniques to further refine the model. + +# APPENDIX + +# A ALGORITHM + +We provide the overall pipeline of SynPO in Algorithm 1. + +Algorithm 1 Synthetic Preference Optimization(SynPO) + +1: Input: Initial policy $\pi_{\theta_0}$ , validation set $\{(\mathbf{x}_i^*,\mathbf{y}_i^*)\}_{i = 0}^n$ , keyword list set $\mathcal{K}$ , prompt generator $\mathcal{G}$ , data filter $\mathcal{F}$ , synthetic preference data $\mathcal{D} = \emptyset$ +2: for $t = 1,2,\ldots$ do +3: Generate $m$ synthetic prompts $\{\mathbf{x}_i\}_{i=1}^m$ with $\mathbf{x}_i \sim \mathcal{G}(\cdot|\mathbf{k}_i)$ , where $\mathbf{k}_i$ represents a list of keywords randomly sampled from $\mathcal{K}$ . +4: Train the response improver $\mathcal{R}_t$ from $\pmb{\theta}_0$ , $\mathcal{R}_t \gets \arg \min_{\pmb{\theta}} \sum_{i=0}^{n} \mathcal{L}(\pi_{\pmb{\theta}}(\mathbf{x}_i^*, \mathbf{y}_{(t-1), i}^*), \mathbf{y}_i^*)$ , where $\mathbf{y}_{(t-1), i}^* \sim \pi_{\pmb{\theta}_{t-1}}(\cdot | \mathbf{x}_i^*)$ for $i \in \{1, \dots, n\}$ . +5: Generate $\pi_{\theta_{t-1}}$ completions and self-refined completions on the synthetic prompts: $\mathbf{y}_{(t-1),i} \sim \pi_{\theta_{t-1}}(\cdot|\mathbf{x}_i), \overline{\mathbf{y}_{(t-1),i}} \sim \mathcal{R}_t(\cdot|\mathbf{x}_i, \mathbf{y}_{(t-1),i})$ for $i \in \{1,\dots,m\}$ . +6: Filter out invalid refinements and integrate valid data into the synthetic preference dataset: + +$$ +\mathcal {D} \leftarrow \mathcal {D} \cup \left\{\left(\mathbf {x} _ {i}, \overline {{\mathbf {y} _ {(t - 1) , i}}}, \mathbf {y} _ {(0), i}\right) \mid \mathcal {F} (\mathbf {x} _ {i}, \overline {{\mathbf {y} _ {(t - 1) , i}}}, \mathbf {y} _ {(0), i}) = \text {v a l i d}, i \in \{1, \dots , m \} \right\}, \mathbf {y} _ {(0), i} \sim \pi_ {\boldsymbol {\theta} _ {0}} (\cdot | \mathbf {x} _ {i}) +$$ + +7: Optimize $\pi_{\theta_0}$ using the SimPO (Meng et al., 2024) objective, where $\sigma$ and $\gamma$ are hyperparameters: + +$$ +\boldsymbol {\theta} _ {t} \leftarrow \underset {\boldsymbol {\theta}} {\arg \min } \mathbb {E} _ {(\mathbf {x} _ {i}, \overline {{\mathbf {y}}} _ {(t - 1), i}, \mathbf {y} _ {(0), i}) \sim_ {\mathcal {D}}} \left[ \log \sigma \left(\frac {\beta}{| \overline {{\mathbf {y}}} _ {(t - 1) , i} |} \log \pi_ {\theta} (\overline {{\mathbf {y}}} _ {(t - 1), i} \mid \mathbf {x} _ {i}) - \frac {\beta}{| \mathbf {y} _ {(0) , i} |} \log \pi_ {\theta} (\mathbf {y} _ {(0), i} \mid \mathbf {x} _ {i}) - \gamma\right) \right] +$$ + +8: end for + +# B PROMPT FOR RESPONSE-REFINER + +The prompt template used for training and inference in the response improver is shown in Figure 7. + +# Self-Improver Prompt + +You are a smart AI assistant. For a given question-answer pair, improve the answer by correcting errors, bolstering informativeness, aligning with the question, and providing comprehensive detail. + +Given Question: {self-generated_question} + +Original Answer: {original_model Completion} + +Rewritten Answer: + +Figure 7: Prompt in SynPO for the LLM to act as a response-refiner. + +# C EXPERIMENTAL DETAILS + +Here we list additional experimental details for our implementation and experiments. + +# C.1 SELF-PROMPT GENERATOR TRAINING + +The hyperparameters for self-prompt generator training are detailed below. During SFT for the self-prompt generator, we employ a learning rate of $1.0 \times 10^{-6}$ for Mistral-Base and Llama3-Base, with a batch size of 32, a warm-up ratio of 0.1, and an AdamW optimizer. We set the maximum sequence length to 8,000 and train the model for 3 epochs. + +To generate diverse synthetic prompts, we randomly sampled 1 million paragraphs from Refined-Web (Penedo et al., 2023) and randomly selected 3 keywords from each paragraph. This process yields a large keyword list pool containing 1 million keyword lists. These keyword lists serve as the input for the self-prompt generator in each iteration. For each iteration, we generate between 36,000 and 72,000 keyword lists (depending on the filtering ratio at each iteration) and exclude lists containing personal names or stopwords. We use vllm for inference and set the sampling temperature to 0.7. + +# C.2 RESPONSE IMPROVER TRAINING + +As the model iterates and self-improves, it may produce responses superior to those of the seed data. Our objective is for the response improver to learn from its deficiencies. Therefore, we identify instances where the model output is inferior to the original response using the same scoring model as the filtering stage. This ensures that the response improver only learns positive optimizations or semantic paraphrasing, rather than negative optimizations. Specifically, for a given $\S_{i}$ , if the score difference between the gold standard completion and the model completion exceeds the threshold, we include this data for response improver training. In the Mistral-Base setting, we set the PairRM scoring threshold to 0.20. In the Llama3-Base setting, the ArmoRM-Llama3-8B-v0.1 scoring threshold is set to 0.02. + +Since the response improver data are automatically derived from SFT data conversion, the model also learns paraphrasing. Using a more powerful model, such as GPT-4, to create data that introduce only minor improvements for rewritten training is a promising research direction. However, to explore the potential for self-boosting, we did not introduce additional data or stronger models for data construction, resulting in inevitable paraphrasing by the response improver. + +During SFT for the response improver, most training parameters are same to the parameters in self-prompt generator training. Some miner differences lie in: we set the max sequence length to 6,000. + +# C.3 RESPONSE IMPROVING AND FILTERING SETTING + +To produce synthetic preference (chosen and rejected) completions for the $t$ -th iteration, we utilize the current policy model to generate a completion and employ the response improver to refine it. We use vllm for inference, with the decoding temperature set at $T = 0.7$ . + +During synthetic data filtering, we set a threshold 0.20 for PairRM scores and a threshold 0.02 for ArmoRM-Llama3-8B-v0.1 scores. In addition, we filter out all the data that contain over $50\%$ repetition patterns to avoid model collapse on synthetic data. In our experiments, we randomly incorporated 10,000 preference pairs from each iteration to the whole synthetic preference data. + +# C.4 OPTIMIZATION + +As the parameter $\beta$ is crucial for achieving optimal performance in SimPO (Meng et al., 2024), we individually search the $\beta$ in the range of [2, 4, 6, 8, 10, 12] for each optimization process. We use a fixed $\gamma = 1.6$ for the Mistral-Base model and Llama3-Base. + +# C.5 BASELINES + +In experiments involving iterative baselines, we control various conditions to ensure fairness. We maintain the same training data size for both iterative baselines and SynPO. We adopt the SimPO loss (Meng et al., 2024) for preference optimization, as it is more effective than DPO (Rafailov et al., 2024). We all use self-generated prompts, which have been shown to be superior to prompts generated by other methods, as validated in Section 2.1 and Section 4.1. All preference construction processes are iterated until performance no longer improves. + +Regarding the baseline models trained on UltraFeedback 61k, we straightforwardly adopt the well-trained versions available from the SimPO repository at https://github.com/princeton-nlp/SimPO. + +# C.6 DECODING HYPERPARAMETERS + +For the AlpacaEval 2 (Dubois et al., 2024) evaluation, we use a sampling-based decoding approach to generate responses. Specifically, we employ vllm for inference, setting the temperature to 0.7 and the maximum tokens to 2048 for both the Mistral-Base and Llama3-Base configurations. All other parameters adhere to the default settings in vllm. As for MT-Bench (Zheng et al., 2024), we adhere to the official decoding setup, which specifies varying sampling temperatures tailored to distinct categories. + +# D ADDITIONAL DETAILS ON SEED DATA ABLATION + +In setting 2), 3), and 4), to prevent cases where rejected responses are better than the chosen ones, we filter the preference data using the same method as SynPO, specifically employing ArmoRM-Llama3-8B-v0.1 to select valid preference data. We fix the threshold at 0.02, as our search among $\{0, 0.1, 0.2\}$ reveal that 0.02 consistently performs the best. + +# E API USAGE + +For GPT-4 Turbo, we all use the latest turbo-2024-04-09 API on Azure OpenAI Service https://learn.microsoft.com/en-us/azure/ai-services/openai/concepts/models#gpt-4-turbo. + +# F PROMPT ANALYSIS + +Here we provide the prompt used for prompt topic and intention analysis in Figure 8, along with a more detailed distribution bar plot for different intentions and topics in Figure 9. The topic word list is derived from UltraChat (Ding et al., 2023), while the intention word list was designed by us. + +# G EVALUATION DETAILS + +For instruction-following ability evaluation, Table 8 presents the detailed information for three alignment benchmarks we use, including AlpacaEval 2.0, Arena-Hard and MT-Bench. Additionally, we display the radar chart for MT-Bench scores on different prompt types (see Figure 10). + +As for general LLM capability evaluation, we provide the few-shot example numbers on Open LLM Leaderboard in Table 9 and a comprehensive comparison of SynPO. + +
# InstancesBaseline ModelJudge ModelScoring Type
AlpacaEval 2.0805GPT-4 TurboGPT-4 TurboPairwise comparison
Arena-Hard500GPT-4-0314GPT-4 TurboPairwise comparison
MT-Bench80-GPT-4 TurboSingle-answer grading
+ +Table 8: Details for three alignment benchmarks. + +# Topic and Intention Classification Prompt + +You are a smart AI assistant. Below the '###' Given text section, a user's instruction/query will be provided. Please determine which topic this question belongs to and output ONE most suitable topic from the 'topics' list. Also, output ONE most suitable intention of the user from the 'intentions' list. (Note: try your best to use the words or phrases in the given lists, but if none of them fits, you can output a new one.) + +Given Text + +{given_text} + +## Topic List topics = ["Technology", "Health and wellness", "Travel and adventure", "Food and drink", "Art and culture", "Science and innovation", "Fashion and style", "Relationships and dating", "Sports and fitness", "Nature and the environment", "Music and entertainment", "Politics and current events", "Education and learning", "Money and finance", "Work and career", "Philosophy and ethics", "History and nostalgia", "Social media and communication", "Creativity and inspiration", "Personal growth and development", "Spirituality and faith", "Pop culture and trends", "Beauty and self-care", "Family and parenting", "Entrepreneurship and business", "Literature and writing", "Gaming and technology", "Mindfulness and meditation", "Diversity and inclusion", "Travel and culture exchange"] + +```java +#!/## Intention List intentions = ["Seek advice", "Design help", "Plan something", "Discuss topics", "Analyze something", "Evaluate something", "Search help", "Learn something", "Writing/polishing help", "Quality chat", "Create something", "Fix something", "Compare something", "Transfer something", "Calculate something", "Navigate", "Explore something new", "Play a game", "Install/uninstall help", "Book/cancel help", "Buy/sell suggestions", "Register/enroll help", "Translation help", "Proofreading/editing help", "Mental health advice", "Recommendations", "Troubleshoot help", "Project feedback", "Creative brainstorming", "Time management help", "Organization help", "Public speaking help", "Job application help", "Networking help", "Language learning help", "Technology setup help", "Event coordination help", "Social media management help", "Conflict resolution help", "Sustainable living advice"] + +## Output Format Format your chosen topic and intention only as a python dictionary with no extraneous output e.g. "topic": "...", "intention": "...". Each value only contain ONE topic or intention. + +![](images/8949ad712e75379b13cdd540a0d7d007bf55aa1887ec39d5cd994bb2596a4d23.jpg) +Figure 8: Prompt for using GPT-4 Turbo as a intention and topic classifier. + +![](images/ea9e942867f180481bb04b1deb3b15d6ed900e40207206376db6a524ee3f2803.jpg) +Figure 9: Topic and intention distribution bar plot for the synthetic prompts in SynPO and Ultra-Feedback. + +# H ANALYSIS ON KEYWORDS FOR PROMPT GENERATION + +In this section, we systematically investigate the impact of various factors on the quality and diversity of prompts through preliminary experiments on Llama3. We explore the effects of excluding noise keywords (Table 10), the types of keywords used (Table 11), the order of keywords (Table 12), and the number of keywords (Table 13). Our experiments involve training and evaluating the prompt generator with different configurations, measuring average similarity using Sentence-Transformer and assessing prompt quality with GPT-4 Turbo as an LLM-as-a-Judge on a scale from 1 to 10. + +Results indicate that the inclusion of noise keywords improves prompt quality as LLMs learn to ignore unrelated words, while using noun phrases enhances diversity and quality. Keyword order has a minimal impact, with randomization slightly enhancing diversity. Additionally, using 3-5 keywords provides the best balance between diversity and quality, with too many keywords degrading prompt quality. These findings collectively guide the implementation of the self-prompt generator. + +# I DATA LEAKAGE ANALYSIS + +To ensure the robustness of our evaluation, we conduct a thorough analysis to detect any potential data leakage between our training datasets and the test sets. Specifically, we compare the n-grams + +
TaskArcHellaSwagTruthfulQAMMLUWinograndeGSM8k
# Few-shot Examples25100555
Metricsacc_normacc_normmc2accaccacc
+ +Table 9: Number of few-shot examples in Open LLM Leaderboard evaluation. + +![](images/92e08db30773bf27589857e9e3562a1034f47d856dd0ddc46869fe6043afcd7f.jpg) +Figure 10: MT-Bench scores on different prompt types. The left radar chart represents results from SynPO on Llama3 and the right comes from Mistral. + +![](images/2e9d8ef1bb5a4454003501c34d76ef2b620b2a68e50fd2bdd1ef98d97459cd0a.jpg) + +of our training datasets (seed SFT data, synthetic preference data, and UltraFeedback for reference) with the n-grams of the test set data to identify any overlaps. If any n-gram from a test data entry appears in our dataset n-grams, that entry is marked as leaked, and we calculate the proportion of leaked data for each test dataset. For datasets with candidate answers, we concatenate the question with candidate answers for analysis; for those without candidate answers, we use only the question. Following Liang et al. (2023), we set the n-gram size to 13. + +As shown in Table 14 and Table 15, the overlap between training datasets (UltraFeedback, seed data, and synthetic preference data) and the test sets is very low, indicating that there is no data leakage problem. Interestingly, synthetic preference data generally shows even less overlap with the test sets than other data. These findings enhance the robustness of our research and confirm the integrity of our evaluation process. + +# J EXTENDED EVALUATION ON DIVERSE TASKS + +For a comprehensive evaluation across a broader range of tasks, we include ten more tasks from LM Evaluation Harness (see Table 16), including biomedical domain and complex reasoning. We also report the domain-specific results on the AGIEval benchmark (Zhong et al., 2023) (in Table 17), which is a comprehensive benchmark specifically designed to assess foundation models in the context of human-centric standardized exams across diverse domains. + +The results indicate that while SynPO is not specifically designed for complex reasoning, it performs competitively across a variety of tasks, particularly in specialized domains. For instance, SynPO 4 iter shows significant improvements over the SFT model in tasks such as EQ-Bench (Paech, 2023). In the AGIEval benchmark, SynPO 4 iter also outperforms the SFT model in each specific domains. + +# K PERFORMANCE GAINS ON TRUTHFULQA + +Similar to SimPO Meng et al. (2024), SynPO shows significant enhancement on TruthfulQA Lin et al. (2021). There are two primary reasons for the observed performance gains on the TruthfulQA benchmark. First, there is a strong correlation between preference alignment and TruthfulQA. TruthfulQA evaluates the truthfulness of responses from language models, a goal that closely aligns with preference alignment. Our synthetic preference dataset, which includes instances emphasizing truth- + +
Noise ConditionAvg. SimilarityQuality
No noise0.05727.92
With noise0.05748.99
+ +Table 10: Effect of noise keywords. + +
Extraction FormAvg. SimilarityQuality
Noun Phrases0.05748.99
Verb Phrases0.08658.74
Noun + Verb Phrases0.06108.67
All Phrases0.05698.67
Noun Words0.06048.98
Verb Words0.08948.76
Noun + Verb Words0.07258.52
All Words0.05988.61
+ +Table 11: Effect of keyword types. + +fulness, enhances the model's ability to accurately interpret context and generate truthful responses. This aligns with findings from Meng et al. (2024). Similarly, we hypothesize that the preference dataset contains instances that emphasize truthfulness, which helps the model better understand the context and generate more truthful responses." Second, we utilize SimPO loss for preference optimization, which has significantly boosted TruthfulQA performance compared to other methods, as detailed in Table 9 of the SimPO paper (Meng et al., 2024). + +
OrderAvg. SimilarityQuality
Keep original order0.06059.01
Random0.05748.99
+ +Table 12: Effect of keyword order. + +
# of keywordsAvg. SimilarityQuality
10.06218.71
30.05748.99
50.05438.63
100.05417.08
+ +Table 13: Effect of number of keywords. + +
DataArcHellaSwagTQAMMLUWinograndeGSM8k
UltraFeedback (for reference)0.000850.000300.001220.001990.000000.00531
Seed SFT Data0.000850.000100.001220.000360.000790.00076
Synthetic Preference Data0.000000.000000.001220.000640.000000.00000
+ +Table 14: Proportion of leaked data for various test datasets when compared with UltraFeedback, Seed SFT Data, and Synthetic Preference Data. + +
DataAlpacaEval 2.0Areana-HardMT-Bench
UltraFeedback0.002480.006000.01250
Seed SFT Data0.003730.012000.01250
Synthetic Preference Data0.001240.008000.00000
+ +Table 15: Proportion of leaked data for additional test datasets when compared with UltraFeedback, Seed SFT Data, and Synthetic Preference Data. + +
ModelLogiQA(Liu et al., 2020)MMLU-Pro(Wang et al., 2024b)SiQA(Sap et al., 2019)QA4MRE(Peñas et al., 2013)NQ(Kwiatkowski et al., 2019)
SFT30.8836.1246.2146.1311.55
SynPO 4 iters31.9537.2849.1849.3012.80
ModelPubMedQA(Jin et al., 2019)RACE(Lai et al., 2017)SWAG(Zellers et al., 2018)EQ-Bench(Paech, 2023)Story Cloze(Mostafazadeh et al., 2016)
SFT73.2044.5976.9146.7910.55
SynPO 4 iters75.4446.7077.1955.8212.80
+ +Table 16: Evaluation results on 10 additional LM Evaluation Harness tasks, using Llama3. + +
ModelHistoryBiologyChemistryPhysicsMathQA
Llama3-SFT38.2934.2924.6432.0024.22
SynPO 4 iters45.5339.0531.8835.0028.49
+ +Table 17: Evaluation results on AGIEval for different domains, using Llama3. \ No newline at end of file diff --git a/ICLR/2025/Self-Boosting Large Language Models with Synthetic Preference Data/images.zip b/ICLR/2025/Self-Boosting Large Language Models with Synthetic Preference Data/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..22f659939c2fc3a61b8d77420e75d65f79fb4441 --- /dev/null +++ b/ICLR/2025/Self-Boosting Large Language Models with Synthetic Preference Data/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:88e121873d23c1f7ee8c91c77455b15469fbe94520807707d7519983d5599848 +size 954027 diff --git a/ICLR/2025/Self-Boosting Large Language Models with Synthetic Preference Data/layout.json b/ICLR/2025/Self-Boosting Large Language Models with Synthetic Preference Data/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..b66dd7dc52ee301caccf031f1289a33d6ce0fe32 --- /dev/null +++ b/ICLR/2025/Self-Boosting Large Language Models with Synthetic Preference Data/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:45060efce8ba21418cc9295a3656b0f73742086e70cb87b6643d2da775970d51 +size 639886 diff --git a/ICLR/2025/Self-Correcting Decoding with Generative Feedback for Mitigating Hallucinations in Large Vision-Language Models/beb8e10f-3c83-4a4a-9f89-ed17c9f59072_content_list.json b/ICLR/2025/Self-Correcting Decoding with Generative Feedback for Mitigating Hallucinations in Large Vision-Language Models/beb8e10f-3c83-4a4a-9f89-ed17c9f59072_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..9dcf300c09025a5e036224dbe7a2595973bb83dc --- /dev/null +++ b/ICLR/2025/Self-Correcting Decoding with Generative Feedback for Mitigating Hallucinations in Large Vision-Language Models/beb8e10f-3c83-4a4a-9f89-ed17c9f59072_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c017cb5baca7ebdb27991dab6c18d8caa30bb487412ab4200bbba00fe8498070 +size 238601 diff --git a/ICLR/2025/Self-Correcting Decoding with Generative Feedback for Mitigating Hallucinations in Large Vision-Language Models/beb8e10f-3c83-4a4a-9f89-ed17c9f59072_model.json b/ICLR/2025/Self-Correcting Decoding with Generative Feedback for Mitigating Hallucinations in Large Vision-Language Models/beb8e10f-3c83-4a4a-9f89-ed17c9f59072_model.json new file mode 100644 index 0000000000000000000000000000000000000000..36e4b59d681ec3575665a813929d86d79c782087 --- /dev/null +++ b/ICLR/2025/Self-Correcting Decoding with Generative Feedback for Mitigating Hallucinations in Large Vision-Language Models/beb8e10f-3c83-4a4a-9f89-ed17c9f59072_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bb1d3e12f7bbddcf4ed923b1b1ccbf42f7cbad68191e05a2de1ae501a84ecb8d +size 271513 diff --git a/ICLR/2025/Self-Correcting Decoding with Generative Feedback for Mitigating Hallucinations in Large Vision-Language Models/beb8e10f-3c83-4a4a-9f89-ed17c9f59072_origin.pdf b/ICLR/2025/Self-Correcting Decoding with Generative Feedback for Mitigating Hallucinations in Large Vision-Language Models/beb8e10f-3c83-4a4a-9f89-ed17c9f59072_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..752d30de8712df8ee2b8c2844233acea4f1015e2 --- /dev/null +++ b/ICLR/2025/Self-Correcting Decoding with Generative Feedback for Mitigating Hallucinations in Large Vision-Language Models/beb8e10f-3c83-4a4a-9f89-ed17c9f59072_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:79a2866b5f00e9b90adc7f33e4569fb9043a4624c68e1ded014cfaae97343ff7 +size 27228927 diff --git a/ICLR/2025/Self-Correcting Decoding with Generative Feedback for Mitigating Hallucinations in Large Vision-Language Models/full.md b/ICLR/2025/Self-Correcting Decoding with Generative Feedback for Mitigating Hallucinations in Large Vision-Language Models/full.md new file mode 100644 index 0000000000000000000000000000000000000000..10843df2b4c75f74e1b9e713921c6a53eefd359f --- /dev/null +++ b/ICLR/2025/Self-Correcting Decoding with Generative Feedback for Mitigating Hallucinations in Large Vision-Language Models/full.md @@ -0,0 +1,1007 @@ +# SELF-CORRECTING DECODING WITH GENERATIVE FEEDBACK FOR MITIGATING HALLUCINATIONS IN LARGE VISION-LANGUAGE MODELS + +Ce Zhang $^{1}$ Zifu Wan $^{1}$ Zhehan Kan $^{2}$ Martin Q. Ma $^{1}$ Simon Stepputtis $^{1}$ +Deva Ramanan $^{1}$ Russ Salakhutdinov $^{1}$ Louis-Philippe Morency $^{1}$ Katia Sycara $^{1}$ Yaqi Xie $^{1}$ + +1School of Computer Science, Carnegie Mellon University + +Shenzhen International Graduate School, Tsinghua University + +# ABSTRACT + +While recent Large Vision-Language Models (LVLMs) have shown remarkable performance in multi-modal tasks, they are prone to generating hallucinatory text responses that do not align with the given visual input, which restricts their practical applicability in real-world scenarios. In this work, inspired by the observation that the text-to-image generation process is the inverse of image-conditioned response generation in LVLMs, we explore the potential of leveraging text-to-image generative models to assist in mitigating hallucinations in LVLMs. We discover that generative models can offer valuable self-feedback for mitigating hallucinations at both the response and token levels. Building on this insight, we introduce self-correcting Decoding with Generative Feedback (DeGF), a novel training-free algorithm that incorporates feedback from text-to-image generative models into the decoding process to effectively mitigate hallucinations in LVLMs. Specifically, DeGF generates an image from the initial response produced by LVLMs, which acts as an auxiliary visual reference and provides self-feedback to verify and correct the initial response through complementary or contrastive decoding. Extensive experimental results validate the effectiveness of our approach in mitigating diverse types of hallucinations, consistently surpassing state-of-the-art methods across six benchmarks. Code is available at https://github.com/zhangce01/DeGF. + +# 1 INTRODUCTION + +Large Vision-Language Models (LVLMs) have demonstrated remarkable performance across various multi-modal tasks, such as image captioning and visual question answering, by extending the capabilities of powerful Large Language Models (LLMs) to incorporate visual inputs (Liu et al., 2023; Li et al., 2023b; Dai et al., 2023; Bai et al., 2023; Ye et al., 2024). Despite their proficiency in interpreting both visual and textual modalities, these models often suffer from hallucinations, where LVLMs erroneously produce responses that are inconsistent with the visual input (Li et al., 2023d; Gunjal et al., 2024; Yin et al., 2023; Wu et al., 2024). This potential for misinformation raises significant concerns, limiting the models' reliability and restricting their broader deployment in real-world scenarios (Liu et al., 2024b; Bai et al., 2024; Chen et al., 2024b; Zhao et al., 2024). + +Recent research has revealed that a major cause of hallucinations in LVLMs is the over-reliance on language priors due to biased training sets, which can override the visual content in response generation (Bai et al., 2024; Liu et al., 2024b; Leng et al., 2024). In response, various strategies have been developed to detect and mitigate these hallucinations by directly introducing additional training (Chen et al., 2024a; Sun et al., 2023; Jiang et al., 2024; Chen et al., 2023; Zhang et al., 2024), demonstrating promising results in reducing over-reliance. However, the need for additional data and costly training processes hinders their deployment in downstream tasks. More recently, a new paradigm of methods has emerged to tackle the hallucination problem in LVLMs by intervening in the decoding process (Huang et al., 2024; Deng et al., 2024; Kim et al., 2024). Among these, recent training-free contrastive decoding-based methods (Li et al., 2023c) have proven effective in mitigating undesired hallucinations by contrasting token predictions derived from original visual input with bias-inducing counterparts, such as no/distorted visual input (Favero et al., 2024; Leng et al., 2024), disturbed instructions (Wang et al., 2024), or premature layers (Chuang et al., 2024). + +![](images/55ce576fcd42d958a2e96242229897aad79349bf8e0791770e004293a2aba4be.jpg) +Figure 1: Generative models can visualize and help correct various types of hallucinations in the initial response. In the first query, we provide LLaVA-1.5 (Liu et al., 2023) with the prompt "Describe this image in detail" to produce captions for two examples from LLaVA-Bench. Based on the initial response, we utilize Stable Diffusion XL (Podell et al., 2024) to generate a new image $v'$ , which effectively highlights hallucinations and provides valuable self-feedback. In the second query, our approach incorporates both the original image $v$ and the generated image $v'$ into the decoding process, using the feedback to successfully correct various types of hallucinations. + +While these contrastive decoding-based methods effectively mitigate hallucinations arising from language priors, we recognize that hallucinations can also originate beyond language bias, stemming from visual deficiencies in LVLMs (Tong et al., 2024). For instance, in counting hallucinations, language does not imply any count information; instead, miscounts largely arise from visual recognition errors of LVLMs, as complex scenes include numerous, similar objects at ambiguous positions which may confuse the LVLMs, leading to incorrect visual understanding and, consequently, hallucinated answers. Therefore, we argue that current contrastive decoding-based methods may struggle to generalize effectively across different types of hallucinations. + +In this work, we explore the potential of leveraging powerful text-to-image generative models (e.g., Stable Diffusion (Rombach et al., 2022; Podell et al., 2024)) to mitigate various types of hallucinations in LVLMs. Our work is based on a simple yet intuitive hypothesis: Given a visual input and a textual prompt to an LVLM, if the generated response conditioned on the original image is accurate and non-hallucinatory, a text-to-image generative model should be capable of reversing this process to produce a similar image from that response. Alternatively, if there is a discrepancy between the original image and the one generated from the response, this difference can serve as valuable self-feedback, guiding the decoding process to correct potential hallucinations in the initial response. To verify this hypothesis, we conduct an empirical study (in Section 3.2), demonstrating that generative models can provide valuable self-feedback for mitigating hallucinations at both the response and token levels. + +Building on this insight, we introduce self-correcting Decoding with Generative Feedback (DeGF), a novel training-free decoding algorithm that effectively incorporates feedback from text-to-image generative models to recursively enhance the accuracy of LVLM responses. Specifically, for each instance, we generate a new image based on the initial response, which serves as an auxiliary visual reference to assess and verify the accuracy of the initial output. We propose self-correcting decoding that either enhances or contrasts predictions from the original and this reference based on the auxiliary visual reference, confirming or revising the initial LVLM response based on the degree of divergence between the two predictions. By integrating this additional visual reference and generative feedback, LVLMs can gain enhanced visual insights and verify the initial response to ensure accurate visual details in the text outputs. In Figure 1, we demonstrate that incorporating generative feedback in our approach can reduce various types of hallucinations, including object existence, visual appearance, counting, etc. To the best of our knowledge, we are the first work to explore the use of text-to-image generative feedback as a self-correcting mechanism for mitigating hallucinations in LVLMs. + +The effectiveness of DeGF is evaluated on LLaVA-1.5, InstructBLIP, and Qwen-VL across six benchmarks: POPE (Li et al., 2023d), CHAIR (Rohrbach et al., 2018), MME-Hallucination (Fu et al., 2023), MMBench (Liu et al., 2024d), MMVP (Tong et al., 2024), and LLaVA-Bench. Extensive experimental results validate the effectiveness of our DeGF in mitigating various types of hallucinations in LVLMs. Qualitative case studies and GPT-4V-aided evaluation on LLaVA-Bench further demonstrate that our approach enhances both the accuracy and detailedness of the LVLM responses. + +The contributions of this paper are summarized as follows: + +- We investigate the potential of text-to-image generative models in mitigating hallucinations in LVLMs and demonstrate that text-to-image generative models can provide valuable self-feedback for mitigating hallucinations at both the response and token levels. +- We propose self-correcting Decoding with Generative Feedback (DeGF), a novel training-free decoding algorithm for LVLMs that recursively enhances the accuracy of responses by integrating feedback from text-to-image generative models with complementary/contrastive decoding. +- Extensive experimental evaluations across six benchmarks demonstrate that our DeGF consistently outperforms state-of-the-art approaches in effectively mitigating hallucinations in LVLMs. + +# 2 RELATED WORK + +Hallucination in LVLMs. With advances of autoregressive LLMs (Touvron et al., 2023; Chowdhery et al., 2023; Chiang et al., 2023), researchers have extended these powerful models to process visual inputs, leading to the development of LVLMs (Liu et al., 2023; Dai et al., 2023; Bai et al., 2023; Ye et al., 2024). These models typically train a modality alignment module to project visual tokens into the textual embedding space of the LLM, demonstrating impressive performance in various multi-modal tasks such as visual question answering and image captioning (Liu et al., 2024b; Bai et al., 2024). However, LVLMs are prone to hallucinations, where contradictions arise between the visual content and the generated textual response (Li et al., 2023d; Liu et al., 2024b; Bai et al., 2024). + +To mitigate hallucinations in LVLMs, early works have introduced various approaches, including reinforcement learning from human feedback (RLHF) (Gunjal et al., 2024; Sun et al., 2023), applying auxiliary supervision (Jiang et al., 2024; Chen et al., 2023), incorporating negative (Liu et al., 2024a) or noisy data (Yue et al., 2024), and training post-hoc revisors for correction (Zhou et al., 2024; Yin et al., 2023). Despite promising results, these methods often lack practicality due to their reliance on additional data and costly training processes. To address this, another line of work focuses on training-free methods that can be seamlessly integrated into existing LVLMs. Such methods encompass contrastive decoding (Leng et al., 2024; Favero et al., 2024) and guided decoding with auxiliary information (Chen et al., 2024d; Deng et al., 2024; Woo et al., 2024). In this work, we present a novel training-free approach that recursively enhances the accuracy of the LVLM response by incorporating text-to-image generative feedback. To the best of our knowledge, we are the first work to effectively utilize feedback from text-to-image generative models to mitigate hallucinations in LVLMs. + +Text-to-Image Synthesis. Text-to-image synthesis aims to create realistic images from textual descriptions (Zhu et al., 2019; Ge et al., 2023). In recent years, significant progress has been achieved in this area, largely due to the advent of deep generative models (Zhan et al., 2023; Goodfellow et al., 2014). These advances include Generative Adversarial Networks (GAN) (Sauer et al., 2023; Kang et al., 2023), autoregressive models (Chang et al., 2023; Yu et al., 2022), and diffusion models (Ho et al., 2020; Karras et al., 2022; Nichol et al., 2022; Sahara et al., 2022; Rombach et al., 2022). Among these, diffusion-based methods have been particularly distinguished due to their ability to generate high-quality, detailed images with fine-grained control over the synthesis process (Yang et al., 2023; Croitoru et al., 2023). Pre-trained on large-scale text-image datasets such as LAION (Schuhmann et al., 2022), diffusion-based methods have demonstrated strong vision-language alignment, making them valuable for downstream tasks such as classification (Li et al., 2023a) and semantic segmentation (Amit et al., 2021; Wolleb et al., 2022). + +More recently, Jiao et al. (2024) incorporate text-to-image generative models to enhance fine-grained image recognition in LVLMs by introducing the Img-Diff dataset, which generates pairs of similar images using Stable Diffusion XL (Podell et al., 2024). Their results demonstrate that fine-tuning LVLMs with this additional data leads to improved performance on several VQA tasks. In contrast, in this work, we directly leverage a pre-trained diffusion model to provide valuable self-feedback for refining the generated responses of LVLMs in the decoding process, dynamically improving the accuracy and consistency of the model's response without modifying the underlying LVLMs. + +# 3 METHOD + +In this work, we present DeGF, a novel training-free algorithm that recursively improves the accuracy of LVLM responses using text-to-image generative feedback, as illustrated in Figure 2. + +![](images/6b07add88f2e8a2eeef3a5d4940c6747ba661a24ad0ffd40aac790f7690c9e4d.jpg) +Figure 2: Overview of our proposed DeGF. Our method follows a two-step process: first, a generative model produces a high-quality image based on the initial response; second, this image acts as an auxiliary visual reference, providing feedback to refine the next-token predictions. Additionally, we introduce self-correcting decoding, which either enhances or contrasts the next-token predictions conditioned on the original and generated images to mitigate hallucinations in the LVLM response. + +# 3.1 PRELIMINARY: DECODING OF LVLMS + +We consider an LVLM parameterized by $\theta$ , which processes an input image $v$ and a textual query $\mathbf{x}$ , aiming to autoregressively generate a fluent sequence of textual responses $\mathbf{y}$ . The visual input $v$ is first processed by a vision encoder and then projected into visual tokens within the textual input space using a vision-language alignment module (e.g., Q-Former (Li et al., 2023b) or linear projection (Liu et al., 2023)). These visual tokens, along with the textual query tokens, are then fed into the language encoder for conditioned autoregressive generation. We denote the autoregressive generation process as + +$$ +y _ {t} \sim p _ {\theta} \left(y _ {t} \mid v, \mathbf {x}, \mathbf {y} _ {< t}\right) \propto \exp f _ {\theta} \left(y _ {t} \mid v, \mathbf {x}, \mathbf {y} _ {< t}\right), \tag {1} +$$ + +where $y_{t}$ represents the token at time step $t$ , $\mathbf{y}_{SetupMethodLLaVA-1.5InstructBLIPQwen-VLAcc. ↑Prec. ↑F1 ↑Acc. ↑Prec. ↑F1 ↑Acc. ↑Prec. ↑F1 ↑MS-COCORandomRegular83.1381.9483.4483.0783.0283.0887.4393.5686.48VCD87.0086.1387.1586.2388.1485.8888.8093.8988.11M3ID87.5087.3887.5286.6788.0986.4189.8395.4489.17RITUAL88.8789.2388.8188.8390.4888.6089.4796.3288.62Ours89.0391.2088.7488.8393.7387.7189.7393.1989.31PopularRegular81.1778.2882.0877.0073.8278.4484.7088.2483.96VCD83.1079.9683.9480.0777.6780.8985.1387.2784.69M3ID84.3081.5884.9580.9777.9381.8586.2789.1985.73RITUAL85.8384.1786.1781.9778.9082.8784.5784.0984.67Ours86.6387.7586.2882.7384.0282.1086.5089.8785.71AdversarialRegular77.4373.3179.2674.6071.2676.4579.8380.1379.73VCD77.1772.1879.4777.2074.2978.4981.3380.6081.55M3ID78.2373.5180.2277.4773.6879.1482.0381.4782.19RITUAL78.8074.4380.5478.7374.5780.3982.8083.1582.71Ours81.6380.5981.9480.3080.9080.1183.4784.4982.98A-OKVQARandomRegular81.9076.6383.5380.6376.8281.9286.2790.6685.48VCD83.8378.0585.3484.2080.9085.0087.8790.0687.53M3ID84.6779.2585.9785.4381.7786.2388.1392.0687.55RITUAL85.1779.7986.4087.1383.9287.7187.7392.4987.01Ours86.9384.2887.4287.4087.6787.2687.9089.1687.58PopularRegular75.0768.5878.7775.1770.1577.9184.6087.9983.88VCD76.6369.5980.1978.6373.5380.7286.2387.3086.03M3ID77.8070.9880.9178.8073.3881.0086.5089.5985.95RITUAL78.8371.9981.6878.7372.8381.1786.3688.7386.20Ours80.9075.6882.6681.4778.6182.3586.4390.7486.52AdversarialRegular67.2361.5673.7069.8764.5474.5476.9075.5977.48VCD67.4061.3974.2171.0065.4175.4579.1376.0480.30M3ID68.6062.2275.1170.1064.2875.1679.5077.5480.21RITUAL68.5762.2674.9970.2764.1575.5580.2079.0880.58Ours72.7066.7076.8673.9369.3676.6780.7580.3780.46GQARandomRegular82.2376.3284.0379.6776.0580.9984.9089.5183.96VCD83.2376.7385.0582.8380.1683.5685.2192.0584.21M3ID84.2078.0085.7783.0780.0683.8785.6993.1184.67RITUAL86.1080.3087.3184.8782.5285.3986.1393.7884.81Ours87.4083.5188.0985.4085.6485.1285.9594.2285.08PopularRegular73.4766.8377.8473.3368.7276.2681.3383.3880.74VCD72.3765.2777.5876.1371.1078.6881.9782.8281.73M3ID73.8766.7078.4975.1769.9478.0482.1384.5881.48RITUAL74.8067.5079.1574.5069.1777.6181.1385.4881.03Ours78.1071.5680.9876.9073.8978.2782.1086.3981.85AdversarialRegular68.6062.4374.8468.6063.9473.1079.0380.4378.54VCD68.8362.2675.4371.0065.7575.1480.8781.0780.80M3ID68.6762.1675.2871.1765.7975.3681.0382.9380.94RITUAL68.2361.7575.1070.1764.7674.7881.0783.2980.41Ours74.0767.4278.2273.6370.0875.1181.1384.1880.57 + +# 4.2 RESULTS AND DISCUSSIONS + +Results on POPE. In Table 1, we compare the performance of our method against other baselines on the POPE benchmark under three different negative sampling settings, across three datasets. As shown in the table, our method consistently outperforms other decoding methods on three LVLMs, achieving state-of-the-art accuracies across all settings, with improvements of up to $5.24\%$ in accuracy, $6.33\%$ in precision, and $2.79\%$ in F1 score compared to the second-best approach. This suggests that incorporating a generative reference enables the LVLMs to perceive more fine-grained visual details, thereby effectively addressing object hallucinations. Moreover, while most decoding methods tend to be overconfident in their responses, the self-correcting decoding mechanism in our method makes it more conservative in responding Yes, as evidenced by significantly higher precision across all settings. This highlights its enhanced performance in filtering out false positives and suppressing misinformation. + +Table 2: Results on CHAIR (Rohrbach et al., 2018) benchmark. We limit the maximum number of new tokens to 64. Lower $(\downarrow)$ CHAIR $_S$ , CHAIR $_I$ and higher $(\uparrow)$ recall and length indicate better performance. The best results in each setting are bolded, and the second-best are underlined. + +
MethodLLaVA-1.5InstructBLIP
CHAIRS↓CHAIRI↓Recall ↑Length ↑CHAIRS↓CHAIRI↓Recall ↑Length ↑
Regular26.29.458.553.431.211.159.053.6
VCD24.47.963.354.230.010.161.854.2
M3ID21.46.364.453.530.810.462.653.4
RITUAL22.46.963.054.926.68.963.455.3
Woodpecker24.97.560.849.731.210.862.351.3
HALC21.77.163.453.424.58.063.855.1
Ours18.46.162.754.124.07.767.255.5
+ +Table 3: Results on MME-Hallucination (Fu et al., 2023) and MMBench (Liu et al., 2024d) benchmark. We report the average MME scores along with the standard deviation across three random seeds for each subset. We also report the overall accuracy achieved by the different methods on the MMBench benchmark in the final column. Higher scores ( $\uparrow$ ) indicate better performance. The best results are bolded, and the second-best are underlined. + +
MethodObject-levelAttribute-levelMME Score↑MMBench ↑
Existence ↑Count ↑Position ↑Color ↑
Regular173.75 (±4.79)121.67 (±12.47)117.92 (±3.69)149.17 (±7.51)562.50 (±3.96)64.1
DoLa176.67 (±2.89)113.33 (±10.41)90.55 (±8.22)141.67 (±7.64)522.22 (±16.78)63.8
OPERIA183.33 (±6.45)137.22 (±6.31)122.78 (±2.55)155.00 (±5.00)598.33 (±10.41)64.4
VCD186.67 (±5.77)125.56 (±3.47)128.89 (±6.73)139.45 (±12.51)580.56 (±15.13)64.6
M3ID186.67 (±5.77)128.33 (±10.41)131.67 (±5.00)151.67 (±20.88)598.11 (±20.35)64.4
RITUAL187.50 (±2.89)139.58 (±7.64)125.00 (±10.27)164.17 (±6.87)616.25 (±20.38)63.8
Woodpecker187.50 (±2.89)125.00 (±0.00)126.66 (±2.89)149.17 (±17.34)588.33 (±10.00)64.0
HALC183.33 (±0.00)133.33 (±5.77)107.92 (±3.69)155.00 (±5.00)579.58 (±9.07)64.2
Ours188.33 (±2.89)150.00 (±7.64)133.89 (±3.85)172.22 (±3.47)644.44 (±9.18)65.5
+ +Another notable finding is that our method shows significantly improved performance in the popular and adversarial settings, which are more challenging than the random setting. In the popular and adversarial settings, non-existent negative objects frequently appear and co-occur with other objects (Li et al., 2023d), making them more susceptible to hallucination by LVLMs, as evidenced by the varying degrees of performance degradation across all baselines. However, our method exhibits a lower performance drop compared to other baselines, demonstrating its effectiveness in addressing hallucinations arising from object co-occurrence. + +Results on CHAIR. We also compare the performance of our methods and other state-of-the-art methods in the open-ended captioning task and report the CHAIR scores, recall, and the average length of responses in Table 2, Table C1, and Table C2. The results, evaluated across two different LVLMs, consistently demonstrate performance improvements achieved by our method over the compared approaches. Specifically, our method outperforms the second-best approach by $3.0\%$ and $2.6\%$ on the $\mathrm{CHAIR}_S$ metric, while also enhancing the detailedness of generated responses compared to regular decoding, as indicated by the higher recall and increased response length. These results demonstrate that by incorporating generative feedback into the decoding process of LVLMs, our method effectively mitigates object hallucinations in open-ended captioning tasks. + +Results on MME-Hallucination and MMBench. Beyond object hallucinations, we further compare the performance of our method with other approaches using the more comprehensive MME-Hallucination benchmark, which includes both object-level and attribute-level hallucinations. The results in Table 3 and Table C3 demonstrate that our method significantly outperforms the compared methods, with substantial margins in the total score metric (e.g., +18.19 on LLaVA-1.5 and +21.11 on InstructBLIP) and consistently superior performance across various evaluation settings, achieving the best results in 6 out of 8 settings. Moreover, our method shows notable improvements on the attribute-level color subset, which is particularly challenging as it requires models to accurately capture subtle attribute information. This further illustrates the effectiveness of our approach in addressing a wide range of hallucinations, both at the object existence level and in finer-grained attribute recognition. Additionally, our proposed DeGF enhances the general multi-modal understanding capabilities of LVLMs, as evidenced by its superior performance on the MMBench benchmark. + +![](images/544ca3acc5e95f20478c41dc514275926bbc2fc87395a8828986f232a603432f.jpg) +Figure 4: Results on MMVP (Tong et al., 2024). We apply our approach to LLaVA-1.5 (Liu et al., 2024c) and compare its performance against other hallucination mitigation methods. + +
MethodLLaVA-1.5InstructBLIP
Acc. ↑Det. ↑Acc. ↑Det. ↑
Regular2.883.293.423.96
Ours4.294.544.384.79
VCD3.623.833.714.21
Ours4.044.384.174.58
M3ID3.884.084.004.33
Ours4.044.294.084.50
+ +Table 4: GPT-4V-aided evaluation on LLaVA-Bench. Higher accuracy and detailedness (↑) indicate better performance. The evaluation is performed on LLaVA-1.5 (Liu et al., 2024c). + +![](images/755c6ff348ba2ff2b30cc2c03a781cc89fb48f174d1fc8590911ef5195cc52c1.jpg) +Visual Input: +Query: Describe this photo in detail. +Figure 5: Case study on the LLaVA-Bench benchmark. We compare the responses generated by regular decoding and our method using LLaVA-1.5. GPT-4V-aided evaluation results are also provided alongside the responses. Hallucinated and accurate content is highlighted in red and green. + +# [Regular Decoding] + +This image portrays a strategically placed tropical hill, punctured with a road branching out through it, giving the appearance of a mountain. The island below the mountain appears to have beautiful blue waters, making for a picturesque view. On the East coast of the bay, there are several houses and buildings, some situated on the beach near the water. The overall skyline captures a cohesive and captivating island landscape. Take a closer look at the cloudy sky, which creates a serene and natural atmosphere for the charming scene. + +# [Our Approach] + +GPT-4V-Aided Evaluation: Accuracy: 7 Detailedness: 7 + +The image displays a bird's eye view of an island with a large mountain in the center. The mountain is steep and appears to be a volcano, with greenery surrounding it. The island is located near the ocean, and it has a road running along the bottom of the mountain. The surrounding area is filled with houses, indicating that the island is inhabited. The island is surrounded by mountains, providing a picturesque and serene landscape. The combination of the ocean, the mountain, and the houses creates a unique and beautiful environment. + +Results on MMVP. We conduct experiments on the MMVP benchmark to assess the fine-grained visual recognition capabilities of LVLMs. As shown in Figure 4, applying our self-correcting decoding approach to LLaVA-1.5 significantly improves performance from $22.67\%$ to $27.33\%$ . Our approach also demonstrates notable advantages over other hallucination mitigation baselines, further showcasing its superiority in handling nuanced visual recognition tasks. These results suggest that our approach significantly enhances the model's capacity to discern and correctly interpret fine-grained distinctions between images with similar appearances but different contents. By integrating generative feedback, our approach effectively reduces misinterpretations and improves the precision of visual recognition tasks, contributing to more reliable and accurate performance in complex scenarios. + +Results on LLaVA-Bench. In Figure 5, we present a case study on LLaVA-Bench comparing our method's response with the response generated by regular decoding using the LLaVA-1.5 model. Specifically, regular decoding often leads to hallucinated or inaccurate content, such as describing "the island below the mountain". Besides, the response generated by regular decoding tends to focus on elements like the "cloudy sky" and "cohesive and captivating island landscape" without providing specific information about the central features of the image. In contrast, our response is more detailed, mentioning the volcano, the road, the surrounding greenery, and the inhabited areas, which gives a clearer understanding of the image's content. The GPT-4V-aided evaluation shown in Table 4 further confirms that our method enhances both the accuracy and detailedness of the generated response, outperforming other hallucination mitigation approaches such as VCD and M3ID. Due to the page limit, please refer to Section D of the Appendix for more case studies. + +# 4.3 ABLATION STUDIES + +Analysis of Distance Threshold $\gamma$ . In Section 3.3, we introduce a distance threshold $\gamma$ to determine the appropriate decoding algorithm for each generated token. Table 5 presents an analysis of our method's performance with various values of $\gamma$ across three benchmarks. For simplicity, we report + +Table 5: Sensitivity analysis of distance threshold $\gamma$ . We present the performance of our approach, based on the LLaVA-1.5 backbone, across three benchmarks for varying values of $\gamma$ . + +
Values of γPOPE Acc.CHAIRSCHAIRIMME Score
γ = 087.9321.07.2622.50
γ = 0.0188.0721.06.8632.22
γ = 0.0588.6719.46.3637.50
γ = 0.189.0318.46.1644.44
γ = 0.588.7319.86.4646.67
γ = 188.4321.66.6638.33
+ +Table 6: Effects of different generative models. We report the performance of different variants of our method, utilizing various stable diffusion models, on the LLaVA-1.5 backbone. + +
ModelsPOPE Acc.CHAIRSCHAIRIMME Score
Regular83.1326.29.4562.50
SD-v1.188.3719.36.5638.33
SD-v1.589.0318.46.1644.44
SD-v2.188.7018.86.7632.22
SD-XL-v0.988.8718.66.1642.50
SD-XL-v1.088.6017.95.8648.33
+ +the performance on the MS-COCO dataset with random setting for all POPE results in the ablation studies. Notably, when $\gamma$ is set to either 0 or 1—corresponding to the exclusive use of contrastive or complementary decoding for all tokens—the performance exhibits a significant decline, by $0.6\%$ and $1.1\%$ in POPE accuracy, respectively. Moreover, our default setting of $\gamma = 0.1$ achieves the optimal performance in 3 out of 4 evaluated metrics. Additional sensitivity analyses for other hyperparameters are provided in Section C of the Appendix. + +Effects of Different Generative Models. Table 6 presents the performance of various variants of our method that incorporate different generative models (i.e., different versions of Stable Diffusion) while using the same LLaVA-1.5 backbone. The results indicate that the effectiveness of our DeGF is robust to the choice of generative models, as performance remains largely unaffected by the specific model used, and all variants demonstrate consistent improvements over the original regular decoding approach. Although utilizing SD-XL-v1.0 (Podell et al., 2024) yields slightly better performance, we opt for SD-v1.5 as the default due to its faster image generation speed (3.8 s/image vs. 11.3 s/image). + +# 4.4 EFFICIENCY COMPARISON + +In Table 7, we compare the efficiency of our approach with other methods on the CHAIR benchmark using the LLaVA-1.5 model, with the maximum token length set to 128. Our approach involves two queries and incorporates a text-to-image generative model to mitigate hallucinations, resulting in a $4.04 \times$ increase in latency and a $1.21 \times$ increase in GPU memory usage. Specifically, our method consists of three stages: initial response generation, image generation, and response self-correction, which take + +Table 7: Efficiency comparison. For each method, we present the average inference latency per instance and peak GPU memory. Experiments are conducted on a single RTX A6000 Ada GPU. + +
MethodAvg. Latency ↓GPU Memory ↓CHAIRS ↓
Regular3.44 s (×1.00)15778 MB (×1.00)55.0
VCD6.91 s (×2.01)16634 MB (×1.05)54.4
OPERA24.70 s (×7.18)22706 MB (×1.44)52.6
Woodpecker10.68 s (×3.10)22199 MB (×1.41)57.6
HALC22.61 s (×6.51)23084 MB (×1.46)51.0
Ours13.89 s (×4.04)19119 MB (×1.21)48.8
+ +an average of 3.4 seconds, 3.8 seconds, and 6.6 seconds per instance, respectively. Compared to other approaches, while our method is slower than regular decoding and contrastive decoding-based methods, it demonstrates efficiency advantages over OPERA and HALC. Note that our approach also achieves the lowest hallucination rates among all compared methods. In Appendix C.9, we discuss several strategies to accelerate our approach, such as limiting the length of the initial response and reducing the number of inference steps in the diffusion process. + +# 5 CONCLUSION + +In this work, we present self-correcting Decoding with Generative Feedback (DeGF), a novel training-free approach that leverages feedback from text-to-image generative models to recursively improve the accuracy of generated responses. Specifically, we generate a new image based on the initial response given by LVLMs, which serves as a visual reference and provides token-level feedback for mitigating hallucinations. Building on this, we propose a corresponding self-correcting decoding algorithm that measures the discrepancy between next-token predictions conditioned on the original and generated images, selecting either contrastive or complementary decoding to reduce the likelihood of hallucinatory responses. Extensive experimental results across six benchmarks demonstrate that our DeGF consistently outperforms state-of-the-art methods in mitigating hallucinations in LVLMs. + +# ACKNOWLEDGEMENTS + +This work has been funded in part by the Army Research Laboratory (ARL) award W911NF-23-2-0007 and W911QX-24-F-0049, DARPA award FA8750-23-2-1015, and ONR award N00014-23-1-2840. MM and LPM are partially supported by Meta and National Institutes of Health awards R01MH125740, R01MH132225, and R21MH130767. RS is supported in part by the ONR grant N00014-23-1-2368. + +# ETHICS STATEMENT + +Our work focuses on enhancing the reliability of current large vision-language models. Our research does not involve human subjects, sensitive data, or any practices that pose privacy or security concerns. We also discuss the broader ethical and societal implications of this work in Appendix A. + +# REPRODUCIBILITY STATEMENT + +The large vision-language models utilized in our experiments, such as LLaVA and InstructBLIP, are open-source and publicly available. We have detailed our experimental setup, including hyperparameter configurations, prompts, and other key design choices, in Section 4 of the main paper and Section B of the Appendix to ensure reproducibility. Code is publicly available at https://github.com/zhangce01/DeGF. + +# REFERENCES + +Tomer Amit, Tal Shaharbany, Eliya Nachmani, and Lior Wolf. Segdiff: Image segmentation with diffusion probabilistic models. arXiv preprint arXiv:2112.00390, 2021. 3 +Jinze Bai, Shuai Bai, Shusheng Yang, Shijie Wang, Sinan Tan, Peng Wang, Junyang Lin, Chang Zhou, and Jingren Zhou. Qwen-vl: A frontier large vision-language model with versatile abilities. arXiv preprint arXiv:2308.12966, 2023. 1, 3, 6 +Zechen Bai, Pichao Wang, Tianjun Xiao, Tong He, Zongbo Han, Zheng Zhang, and Mike Zheng Shou. Hallucination of multimodal large language models: A survey. arXiv preprint arXiv:2404.18930, 2024. 1, 3 +Huiwen Chang, Han Zhang, Jarred Barber, Aaron Maschinot, Jose Lezama, Lu Jiang, Ming-Hsuan Yang, Kevin Patrick Murphy, William T Freeman, Michael Rubinstein, et al. Muse: Text-to-image generation via masked generative transformers. In International Conference on Machine Learning, pp. 4055-4075. PMLR, 2023. 3 +Beitao Chen, Xinyu Lyu, Lianli Gao, Jingkuan Song, and Heng Tao Shen. Alleviating hallucinations in large vision-language models through hallucination-induced optimization. Advances in Neural Information Processing Systems, 2024a. 1 +Jiawei Chen, Dingkang Yang, Tong Wu, Yue Jiang, Xiaolu Hou, Mingcheng Li, Shunli Wang, Dongling Xiao, Ke Li, and Lihua Zhang. Detecting and evaluating medical hallucinations in large vision language models. arXiv preprint arXiv:2406.10185, 2024b. 1 +Xuweiyi Chen, Ziqiao Ma, Xuejun Zhang, Sihan Xu, Shengyi Qian, Jianing Yang, David Fouhey, and Joyce Chai. Multi-object hallucination in vision language models. In The Thirty-eighth Annual Conference on Neural Information Processing Systems, 2024c. URL https://openreview.net/forum?id=KNrwaFEi1u.24 +Zhaorun Chen, Zhuokai Zhao, Hongyin Luo, Huaxiu Yao, Bo Li, and Jiawei Zhou. HALC: Object hallucination reduction via adaptive focal-contrast decoding. In International Conference on Machine Learning, pp. 7824–7846. PMLR, 2024d. 3, 6 +Zhiyang Chen, Yousong Zhu, Yufei Zhan, Zhaowen Li, Chaoyang Zhao, Jinqiao Wang, and Ming Tang. Mitigating hallucination in visual language models with visual supervision. arXiv preprint arXiv:2311.16479, 2023. 1, 3 + +Mehdi Cherti, Romain Beaumont, Ross Wightman, Mitchell Wortsman, Gabriel Ilharco, Cade Gordon, Christoph Schuhmann, Ludwig Schmidt, and Jenia Jitsev. Reproducible scaling laws for contrastive language-image learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 2818-2829, 2023. 5 +Wei-Lin Chiang, Zhuohan Li, Zi Lin, Ying Sheng, Zhanghao Wu, Hao Zhang, Lianmin Zheng, Siyuan Zhuang, Yonghao Zhuang, Joseph E. Gonzalez, Ion Stoica, and Eric P. Xing. Vicuna: An open-source chatbot impressing gpt-4 with $90\%$ * chatgpt quality, March 2023. URL https://lmsys.org/blog/2023-03-30-vicuna/. 3, 6 +Aakanksha Chowdhery, Sharan Narang, Jacob Devlin, Maarten Bosma, Gaurav Mishra, Adam Roberts, Paul Barham, Hyung Won Chung, Charles Sutton, Sebastian Gehrmann, et al. Palm: Scaling language modeling with pathways. Journal of Machine Learning Research, 24(1):1-113, 2023. ISSN 1532-4435. 3 +Yung-Sung Chuang, Yujia Xie, Hongyin Luo, Yoon Kim, James R. Glass, and Pengcheng He. Dola: Decoding by contrasting layers improves factuality in large language models. In International Conference on Learning Representations, 2024. URL https://openreview.net/forum?id=Th6NyL07na.1,6 +Florinel-Alin Croitoru, Vlad Hondru, Radu Tudor Ionescu, and Mubarak Shah. Diffusion models in vision: A survey. IEEE Transactions on Pattern Analysis and Machine Intelligence, 45(9): 10850-10869, 2023. 3 +Wenliang Dai, Junnan Li, Dongxu Li, Anthony Tiong, Junqi Zhao, Weisheng Wang, Boyang Li, Pascale Fung, and Steven Hoi. Instructclip: towards general-purpose vision-language models with instruction tuning. Advances in Neural Information Processing Systems, 36:49250-49267, 2023. 1, 3, 6, 17, 18 +Ailin Deng, Zhirui Chen, and Bryan Hooi. Seeing is believing: Mitigating hallucination in large vision-language models via clip-guided decoding. arXiv preprint arXiv:2402.15300, 2024. 1, 3 +Alessandro Favero, Luca Zancato, Matthew Trager, Siddharth Choudhary, Pramuditha Perera, Alessandro Achille, Ashwin Swaminathan, and Stefano Soatto. Multi-modal hallucination control by visual information grounding. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 14303-14312, 2024. 1, 3, 6, 18 +Chaoyou Fu, Peixian Chen, Yunhang Shen, Yulei Qin, Mengdan Zhang, Xu Lin, Jinrui Yang, Xiawu Zheng, Ke Li, Xing Sun, et al. Mme: A comprehensive evaluation benchmark for multimodal large language models. arXiv preprint arXiv:2306.13394, 2023. 2, 6, 8, 17, 18, 19 +Songwei Ge, Taesung Park, Jun-Yan Zhu, and Jia-Bin Huang. Expressive text-to-image generation with rich text. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 7545-7556, 2023. 3 +Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial nets. Advances in Neural Information Processing Systems, 27, 2014. 3 +Anisha Gunjal, Jihan Yin, and Erhan Bas. Detecting and preventing hallucinations in large vision language models. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 38, pp. 18135-18143, 2024. 1, 3 +Jack Hessel, Ari Holtzman, Maxwell Forbes, Ronan Le Bras, and Yejin Choi. Clipscore: A reference-free evaluation metric for image captioning. In Proceedings of the Conference on Empirical Methods in Natural Language Processing, pp. 7514-7528, 2021. 22 +Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. Advances in Neural Information Processing Systems, 33:6840-6851, 2020. 3 +Qidong Huang, Xiaoyi Dong, Pan Zhang, Bin Wang, Conghui He, Jiaqi Wang, Dahua Lin, Weiming Zhang, and Nenghai Yu. Opera: Alleviating hallucination in multi-modal large language models via over-trust penalty and retrospection-allocation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 13418-13427, 2024. 1, 6 + +Drew A Hudson and Christopher D Manning. Gqa: A new dataset for real-world visual reasoning and compositional question answering. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 6700-6709, 2019. 16 +Chaoya Jiang, Haiyang Xu, Mengfan Dong, Jiaxing Chen, Wei Ye, Ming Yan, Qinghao Ye, Ji Zhang, Fei Huang, and Shikun Zhang. Hallucination augmented contrastive learning for multimodal large language model. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 27036-27046, 2024. 1, 3 +Qirui Jiao, Daoyuan Chen, Yilun Huang, Yaliang Li, and Ying Shen. Img-diff: Contrastive data synthesis for multimodal large language models. arXiv preprint arXiv:2408.04594, 2024.3 +Minguk Kang, Jun-Yan Zhu, Richard Zhang, Jaesik Park, Eli Shechtman, Sylvain Paris, and Taesung Park. Scaling up gans for text-to-image synthesis. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 10124-10134, 2023. 3 +Tero Karras, Miika Aittala, Timo Aila, and Samuli Laine. Elucidating the design space of diffusion-based generative models. Advances in Neural Information Processing Systems, 35:26565-26577, 2022. 3 +Junho Kim, Hyunjun Kim, Yeonju Kim, and Yong Man Ro. Code: Contrasting self-generated description to combat hallucination in large multi-modal models. Advances in Neural Information Processing Systems, 2024. 1 +Sicong Leng, Hang Zhang, Guanzheng Chen, Xin Li, Shijian Lu, Chunyan Miao, and Lidong Bing. Mitigating object hallucinations in large vision-language models through visual contrastive decoding. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 13872-13882, 2024. 1, 3, 6, 17, 18, 20, 23 +Alexander C Li, Mihir Prabhudesai, Shivam Duggal, Ellis Brown, and Deepak Pathak. Your diffusion model is secretly a zero-shot classifier. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 2206-2217, 2023a. 3 +Junnan Li, Dongxu Li, Silvio Savarese, and Steven Hoi. Blip-2: Bootstrapping language-image pre-training with frozen image encoders and large language models. In International Conference on Machine Learning, pp. 19730-19742. PMLR, 2023b. 1, 4 +Xiang Lisa Li, Ari Holtzman, Daniel Fried, Percy Liang, Jason Eisner, Tatsunori B Hashimoto, Luke Zettlemoyer, and Mike Lewis. Contrastive decoding: Open-ended text generation as optimization. In Proceedings of the Annual Meeting of the Association for Computational Linguistics, pp. 12286-12312, 2023c. 1, 6, 17 +Yifan Li, Yifan Du, Kun Zhou, Jinping Wang, Wayne Xin Zhao, and Ji-Rong Wen. Evaluating object hallucination in large vision-language models. In Proceedings of the Conference on Empirical Methods in Natural Language Processing, pp. 292-305, 2023d. 1, 2, 3, 5, 6, 7, 8, 16, 17, 18, 23 +Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dóllár, and C Lawrence Zitnick. Microsoft coco: Common objects in context. In European Conference on Computer Vision, pp. 740-755. Springer, 2014. 5, 16 +Fuxiao Liu, Kevin Lin, Linjie Li, Jianfeng Wang, Yaser Yacoob, and Lijuan Wang. Mitigating hallucination in large multi-modal models via robust instruction tuning. In International Conference on Learning Representations, 2024a. URL https://openreview.net/forum?id=J44HfH4JCg.3 +Hanchao Liu, Wenyuan Xue, Yifei Chen, Dapeng Chen, Xiutian Zhao, Ke Wang, Liping Hou, Rongjun Li, and Wei Peng. A survey on hallucination in large vision-language models. arXiv preprint arXiv:2402.00253, 2024b. 1, 3 +Haotian Liu, Chunyuan Li, Qingyang Wu, and Yong Jae Lee. Visual instruction tuning. Advances in Neural Information Processing Systems, 36:34892-34916, 2023. 1, 2, 3, 4, 17, 18 + +Haotian Liu, Chunyuan Li, Yuheng Li, and Yong Jae Lee. Improved baselines with visual instruction tuning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 26296-26306, 2024c. 6, 9 +Yuan Liu, Haodong Duan, Yuanhan Zhang, Bo Li, Songyang Zhang, Wangbo Zhao, Yike Yuan, Jiaqi Wang, Conghui He, Ziwei Liu, et al. Mmbench: Is your multi-modal model an all-around player? In European Conference on Computer Vision, pp. 216-233. Springer, 2024d. 2, 6, 8, 17 +Alexander Quinn Nichol, Prafulla Dhariwal, Aditya Ramesh, Pranav Shyam, Pamela Mishkin, Bob McGrew, Ilya Sutskever, and Mark Chen. Glide: Towards photorealistic image generation and editing with text-guided diffusion models. In International Conference on Machine Learning, pp. 16784-16804. PMLR, 2022. 3 +Dustin Podell, Zion English, Kyle Lacey, Andreas Blattmann, Tim Dockhorn, Jonas Müller, Joe Penna, and Robin Rombach. SDXL: Improving latent diffusion models for high-resolution image synthesis. In International Conference on Learning Representations, 2024. URL https://openreview.net/forum?id=di52zR8xgf.2,3,10 +Anna Rohrbach, Lisa Anne Hendricks, Kaylee Burns, Trevor Darrell, and Kate Saenko. Object hallucination in image captioning. In Proceedings of the Conference on Empirical Methods in Natural Language Processing, pp. 4035-4045, 2018. 2, 5, 6, 8, 17, 18, 19 +Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Björn Ommer. High-resolution image synthesis with latent diffusion models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 10684-10695, 2022. 2, 3 +Chitwan Sahara, William Chan, Saurabh Saxena, Lala Li, Jay Whang, Emily L Denton, Kamyar Ghasemipour, Raphael Gontijo Lopes, Burcu Karagol Ayan, Tim Salimans, et al. Photorealistic text-to-image diffusion models with deep language understanding. Advances in Neural Information Processing Systems, 35:36479-36494, 2022. 3 +Axel Sauer, Tero Karras, Samuli Laine, Andreas Geiger, and Timo Aila. Stylegan-t: Unlocking the power of gans for fast large-scale text-to-image synthesis. In International Conference on Machine Learning, pp. 30105-30118. PMLR, 2023. 3 +Christoph Schuhmann, Romain Beaumont, Richard Vencu, Cade Gordon, Ross Wightman, Mehdi Cherti, Theo Coombes, Aarush Katta, Clayton Mullis, Mitchell Wortsman, et al. Laion-5b: An open large-scale dataset for training next generation image-text models. Advances in Neural Information Processing Systems, 35:25278-25294, 2022. 3 +Dustin Schwenk, Apoorv Khandelwal, Christopher Clark, Kenneth Marino, and Roozbeh Mottaghi. A-okvqa: A benchmark for visual question answering using world knowledge. In European Conference on Computer Vision, pp. 146-162. Springer, 2022. 16 +Zhiqing Sun, Sheng Shen, Shengcao Cao, Haotian Liu, Chunyuan Li, Yikang Shen, Chuang Gan, Liang-Yan Gui, Yu-Xiong Wang, Yiming Yang, et al. Aligning large multimodal models with factually augmented rlhf. arXiv preprint arXiv:2309.14525, 2023. 1, 3 +Shengbang Tong, Zhuang Liu, Yuexiang Zhai, Yi Ma, Yann LeCun, and Saining Xie. Eyes wide shut? exploring the visual shortcomings of multimodal llms. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 9568-9578, 2024. 2, 6, 9, 17, 18 +Hugo Touvron, Thibaut Lavril, Gautier Izacard, Xavier Martinet, Marie-Anne Lachaux, Timothée Lacroix, Baptiste Rozière, Naman Goyal, Eric Hambro, Faisal Azhar, et al. Llama: Open and efficient foundation language models. arXiv preprint arXiv:2302.13971, 2023. 3, 6 +Xintong Wang, Jingheng Pan, Liang Ding, and Chris Biemann. Mitigating hallucinations in large vision-language models with instruction contrastive decoding. In *Findings of the Association for Computational Linguistics ACL* 2024, pp. 15840-15853, 2024. 1 +Julia Wolleb, Robin Sandkuhler, Florentin Bieder, Philippe Valmaggia, and Philippe C Cattin. Diffusion models for implicit image segmentation ensembles. In International Conference on Medical Imaging with Deep Learning, pp. 1336-1348. PMLR, 2022. 3 + +Sangmin Woo, Jaehyuk Jang, Donguk Kim, Yubin Choi, and Changick Kim. Ritual: Random image transformations as a universal anti-hallucination lever in lvlms. arXiv preprint arXiv:2405.17821, 2024. 3, 6, 18 +Mingrui Wu, Jiayi Ji, Oucheng Huang, Jiale Li, Yuhang Wu, Xiaoshuai Sun, and Rongrong Ji. Evaluating and analyzing relationship hallucinations in lvlms. In International Conference on Machine Learning, pp. 53553-53570. PMLR, 2024. 1, 24 +Ling Yang, Zhilong Zhang, Yang Song, Shenda Hong, Runsheng Xu, Yue Zhao, Wentao Zhang, Bin Cui, and Ming-Hsuan Yang. Diffusion models: A comprehensive survey of methods and applications. ACM Computing Surveys, 56(4):1-39, 2023. 3 +Qinghao Ye, Haiyang Xu, Jiabo Ye, Ming Yan, Anwen Hu, Haowei Liu, Qi Qian, Ji Zhang, and Fei Huang. mplug-owl2: Revolutionizing multi-modal large language model with modality collaboration. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 13040-13051, 2024. 1, 3, 24 +Shukang Yin, Chaoyou Fu, Sirui Zhao, Tong Xu, Hao Wang, Dianbo Sui, Yunhang Shen, Ke Li, Xing Sun, and Enhong Chen. Woodpecker: Hallucination correction for multimodal large language models. arXiv preprint arXiv:2310.16045, 2023. 1, 3, 6, 17 +Jiahui Yu, Yuanzhong Xu, Jing Yu Koh, Thang Luong, Gunjan Baid, Zirui Wang, Vijay Vasudevan, Alexander Ku, Yinfei Yang, Burcu Karagol Ayan, Ben Hutchinson, Wei Han, Zarana Parekh, Xin Li, Han Zhang, Jason Baldridge, and Yonghui Wu. Scaling autoregressive models for content-rich text-to-image generation. Transactions on Machine Learning Research, 2022. ISSN 2835-8856. URL https://openreview.net/forum?id=AFDcYJKhND.3 +Weihao Yu, Zhengyuan Yang, Linjie Li, Jianfeng Wang, Kevin Lin, Zicheng Liu, Xinchao Wang, and Lijuan Wang. MM-vet: Evaluating large multimodal models for integrated capabilities. In International Conference on Machine Learning, 2024. URL https://openreview.net/forum?id=KOTutrSR2y.20 +Zihao Yue, Liang Zhang, and Qin Jin. Less is more: Mitigating multimodal hallucination from an EOS decision perspective. In Proceedings of the Annual Meeting of the Association for Computational Linguistics, pp. 11766-11781, 2024. 3 +Fangneng Zhan, Yingchen Yu, Rongliang Wu, Jiahui Zhang, Shijian Lu, Lingjie Liu, Adam Kortylewski, Christian Theobalt, and Eric Xing. Multimodal image synthesis and editing: A survey and taxonomy. IEEE Transactions on Pattern Analysis and Machine Intelligence, 45(12):15098-15119, 2023. 3 +Jinrui Zhang, Teng Wang, Haigang Zhang, Ping Lu, and Feng Zheng. Reflective instruction tuning: Mitigating hallucinations in large vision-language models. In European Conference on Computer Vision, pp. 196-213. Springer, 2024. 1 +Xinran Zhao, Hongming Zhang, Xiaoman Pan, Wenlin Yao, Dong Yu, Tongshuang Wu, and Jianshu Chen. Fact-and-reflection (FaR) improves confidence calibration of large language models. In Findings of the Association for Computational Linguistics ACL 2024, pp. 8702-8718, 2024. 1 +Yiyang Zhou, Chenhang Cui, Jaehong Yoon, Linjun Zhang, Zhun Deng, Chelsea Finn, Mohit Bansal, and Huaxiu Yao. Analyzing and mitigating object hallucination in large vision-language models. In International Conference on Learning Representations, 2024. URL https://openreview.net/forum?id=oZDJKT10Ue.3 +Deyao Zhu, Jun Chen, Xiaoqian Shen, Xiang Li, and Mohamed Elhoseiny. MiniGPT-4: Enhancing vision-language understanding with advanced large language models. In International Conference on Learning Representations, 2024. URL https://openreview.net/forum?id=1tZbq88f27. 24 +Minfeng Zhu, Pingbo Pan, Wei Chen, and Yi Yang. Dm-gan: Dynamic memory generative adversarial networks for text-to-image synthesis. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 5802-5810, 2019. 3 + +# SELF-CORRECTING DECODING WITH GENERATIVE FEEDBACK FOR MITIGATING HALLUCINATIONS IN LARGE VISION-LANGUAGE MODELS + +# APPENDIX + +In this supplementary document, we provide additional details and experimental results to enhance understanding and insights into our method. This supplementary document is organized as follows: + +- The limitations and broader impacts of this work are discussed in Section A. +- Additional experimental details, including further implementation details, descriptions of other implemented baselines, and license information for the utilized code and datasets, are provided in Section B. +Additional experimental results are presented in Section C. +- More case studies and GPT-4V-aided evaluations are provided in Section D. +- Potential directions for future work are discussed in Section E. + +# A LIMITATIONS AND BROADER IMPACTS + +Limitations. Although our method effectively mitigates hallucinations in LVLMs, it relies on pretrained text-to-image generative models, which introduces additional computational complexity. The process of generating images also adds time, potentially slowing down LVLM response generation and making it less suitable for real-time applications. However, our method is training-free, reducing the overhead typically associated with fine-tuning large models, and offering broader applicability across various tasks. Moreover, the use of generative feedback improves the model's ability to verify and correct responses, particularly in complex scenarios. Thus, while the computational trade-offs may limit real-time performance, our method excels in settings where accuracy and reliability are prioritized over speed. We also hope that advances in efficient diffusion-based models will improve the feasibility of our approach in real-world applications in the future. + +Broader Impacts. In this work, our goal is to develop more reliable large vision-language models (LVLMs) by incorporating feedback from generative models. By using this feedback mechanism, we aim to address a critical issue faced by current multi-modal models: hallucinations, where models produce responses that are inconsistent with the visual input. Hallucinations not only degrade model performance but also pose risks in real-world applications by generating inaccurate or misleading information. Our approach leverages the strengths of generative models to detect and mitigate these hallucinations, improving the overall accuracy and reliability of LVLMs. In doing so, we contribute to enhancing trustworthiness and reducing the spread of misinformation in systems that rely on multi-modal AI, making them safer and more effective for a wide range of applications. + +# B MORE EXPERIMENTAL DETAILS + +# B.1 BENCHMARKS AND METRICS + +We conduct extensive experiments on the following benchmarks: + +- POPE (Li et al., 2023d) is a widely used benchmark for assessing object hallucinations in LVLMs. It tests the models with yes-or-no questions regarding the presence of specific objects, such as, "Is there a {object} in the image?" The benchmark draws data from three existing datasets: MSCOCO (Lin et al., 2014), A-OKVQA (Schwenk et al., 2022), and GQA (Hudson & Manning, 2019), and comprises three distinct subsets—random, popular, and adversarial—based on how the negative samples are generated. For each dataset setting, the benchmark provides 6 questions per image, resulting in 3,000 test instances. We evaluate the performance of different methods using four metrics: accuracy, precision, recall, and F1 score. + +- CHAIR (Rohrbach et al., 2018) evaluates object hallucinations in open-ended captioning tasks. It prompts the LVLMs to describe specific images selected from a random sample of 500 images from the MSCOCO validation set and assesses performance based on two metrics: + +$$ +\mathrm {C H A I R} _ {I} = \frac {\# \text {h a l l u c i n a t e d o b j e c t s}}{\# \text {a l l o b j e c t s m e n t i o n e d}}, \quad \mathrm {C H A I R} _ {S} = \frac {\# \text {s e n t e n c e s w i t h h a l l u c i n a t e d o b j e c t}}{\# \text {a l l s e n t e n c e s}}. \tag {6} +$$ + +Additionally, we assess the recall and the average length of the generated responses. + +- MME-Hallucination (Fu et al., 2023) is a comprehensive benchmark for LVLMs consisting of four subsets: existence and count for object-level hallucinations, and position and color for attribute-level hallucinations. Each subset includes 30 images and 60 questions, with two questions per image. Similar to POPE (Li et al., 2023d), these questions are structured as yes-or-no queries, and performance is assessed based on binary accuracy. Following the official implementation, the reported score is calculated by combining accuracy and accuracy+, where accuracy is based on individual questions, and accuracy+ is based on images where both questions are answered correctly. +- MMBench (Liu et al., 2024d) is a comprehensive evaluation benchmark designed to assess the multimodal understanding and reasoning capabilities of AI models. It focuses on tasks requiring the integration of visual and textual information, testing a model's ability to handle diverse, real-world scenarios. In particular, MMBench employs a hierarchical ability taxonomy, designating Perception and Reasoning as Level-1 (L-1) abilities. It further refines the taxonomy by incorporating more detailed ability dimensions, organizing them into six Level-2 (L-2) and twenty Level-3 (L-3) dimensions. +- MMVP (Tong et al., 2024) collects CLIP-blind pairs and evaluates the fine-grained visual recognition capabilities of LVLMs. It consists of 150 image pairs, each accompanied by a binary-option question. Each image is queried independently, and for a given pair, the LVLM's response is considered correct only if both associated questions are answered accurately. +- LLaVA-Bench3 provides 24 images featuring complex scenes, memes, paintings, and sketches, along with 60 challenging questions. We select examples from this dataset to provide qualitative comparisons between the responses generated by different decoding methods. We also follow Yin et al. (2023) to evaluate the accuracy and detailedness of generated responses of different methods using the advanced LVLM, GPT-4V4. + +# B.2 MORE IMPLEMENTATION DETAILS + +In our experiments, we adhere to the default query format for the input data used in both LLaVA-1.5 (Liu et al., 2023) and InstructBLIP (Dai et al., 2023). Additionally, we set $\alpha_{1} = 3$ , $\alpha_{2} = 1$ , and $\gamma = 0.1$ by default in our decoding process. We follow VCD (Leng et al., 2024) to implement adaptive plausibility constraints (Li et al., 2023c): + +$$ +p _ {\theta} (y _ {t}) = 0, \quad \text {i f} y _ {t} \notin \mathcal {V} (y _ {< t}) +$$ + +$$ +\text {w h e r e} \mathcal {V} \left(y _ {< t}\right) = \left\{y _ {t} \in \mathcal {V}: p _ {\theta} \left(y _ {t} \mid v, \mathbf {x}, \mathbf {y} _ {< t}\right) \geq \beta \max _ {w} p _ {\theta} \left(w \mid v, \mathbf {x}, \mathbf {y} _ {< t}\right) \right\} \tag {7} +$$ + +Here, $\mathcal{V}$ is the whole vocabulary of LVLM, and hyperparameter $\beta \in [0,1]$ controls the truncation of the next token distribution. A larger $\beta$ indicates more aggressive truncation, keeping only the high-probability tokens. In our implementation, we set the logits for $y_{t} \notin \mathcal{V}(y_{MethodLLaVA-1.5InstructBLIPCHAIRS↓CHAIRI↓Recall ↑Length ↑CHAIRS↓CHAIRI↓Recall ↑Length ↑Regular55.016.371.997.357.017.668.3100.4VCD54.416.675.197.060.417.872.599.9M3ID56.615.776.894.562.218.171.999.8RITUAL49.614.874.796.248.414.572.2100.0Woodpecker57.616.770.393.260.817.669.797.6HALC51.014.875.395.853.815.771.999.1Ours48.814.676.096.449.214.472.298.9 + +Table C2: Results on CHAIR (Rohrbach et al., 2018) benchmark. We limit the maximum number of new tokens to 256. Lower $(\downarrow)$ CHAIR $_S$ , CHAIR $_I$ and higher $(\uparrow)$ recall and length indicate better performance. The best results in each setting are bolded, and the second-best are underlined. + +
MethodLLaVA-1.5InstructBLIP
CHAIRS↓CHAIRI↓Recall ↑Length ↑CHAIRS↓CHAIRI↓Recall ↑Length ↑
Regular58.017.774.1106.361.018.268.9112.0
VCD58.216.778.0103.563.018.672.9106.3
M3ID56.816.180.798.265.819.972.4102.7
RITUAL51.015.176.0100.950.415.372.0102.0
Ours49.814.777.2103.349.815.172.3103.3
+ +Table C3: Results on MME-Hallucination (Fu et al., 2023) benchmark. We report the average MME scores along with the standard deviation across three random seeds for each subset. We also report the total scores achieved by the different methods across all four subsets in the final column. Higher scores $(\uparrow)$ indicate better performance. The best results are bolded, and the second-best are underlined. + +
ModelMethodObject-levelAttribute-levelTotal Score ↑
Existence ↑Count ↑Position ↑Color ↑
LLaVA-1.5Regular173.75 (±4.79)121.67 (±12.47)117.92 (±3.69)149.17 (±7.51)562.50 (±3.96)
DoLa176.67 (±2.89)113.33 (±10.41)90.55 (±8.22)141.67 (±7.64)522.22 (±16.78)
OPERA183.33 (±6.45)137.22 (±6.31)122.78 (±2.55)155.00 (±5.00)598.33 (±10.41)
VCD186.67 (±5.77)125.56 (±3.47)128.89 (±6.73)139.45 (±12.51)580.56 (±15.13)
M3ID186.67 (±5.77)128.33 (±10.41)131.67 (±5.00)151.67 (±20.88)598.11 (±20.35)
RITUAL187.50 (±2.89)139.58 (±7.64)125.00 (±10.27)164.17 (±6.87)616.25 (±20.38)
Ours188.33 (±2.89)150.00 (±7.64)133.89 (±3.85)172.22 (±3.47)644.44 (±9.18)
InstructBLIPRegular160.42 (±5.16)79.17 (±8.22)79.58 (±8.54)130.42 (±17.34)449.58 (±24.09)
DoLa175.00 (±5.00)55.00 (±5.00)48.89 (±3.47)113.33 (±6.67)392.22 (±7.88)
OPERA175.00 (±3.33)61.11 (±3.47)53.89 (±1.92)120.55 (±2.55)410.56 (±9.07)
VCD158.89 (±5.85)91.67 (±18.34)66.11 (±9.76)121.67 (±12.58)438.33 (±16.07)
M3ID160.00 (±5.00)87.22 (±22.63)69.44 (±9.18)125.00 (±7.64)441.67 (±17.32)
RITUAL182.50 (±6.45)74.58 (±5.99)67.08 (±10.31)139.17 (±0.96)463.33 (±12.40)
Ours186.67 (±2.89)89.44 (±8.22)58.33 (±4.41)150.00 (±1.89)484.44 (±11.34)
Qwen-VLRegular155.00 (±3.54)127.67 (±13.36)131.67 (±7.73)173.00 (±9.75)587.33 (±31.06)
VCD156.00 (±6.52)131.00 (±6.19)128.00 (±3.61)181.67 (±5.14)596.67 (±11.61)
M3ID178.33 (±2.89)143.33 (±2.89)150.00 (±2.89)175.00 (±5.00)646.66 (±8.50)
RITUAL178.33 (±2.89)142.22 (±16.19)156.66 (±2.89)178.33 (±2.89)655.55 (±14.99)
Ours180.00 (±0.00)148.89 (±6.74)155.00 (±7.64)178.33 (±2.89)662.22 (±4.37)
+ +# C.1 ADDITIONAL RESULTS ON CHAIR + +In Table C1 and Table C2, we present performance comparisons on the CHAIR benchmark with maximum number of tokens set to 128 and 256. The results indicate that our approach also achieves competitive performance across two LVLMs in mitigating hallucinations during long-sequence generation scenarios. + +Table C4: Detailed results on MMBench benchmark. Abbreviations adopted: LR for Logical Reasoning; AR for Attribute Reasoning; RR for Relation Reasoning; FP-S for Fine-grained Perception (Single Instance); FP-C for Fine-grained Perception (Cross Instance); CP for Coarse Perception. The best results are bolded. + +
MethodLRARRRFP-SFP-CCPOverall
Regular30.5171.3652.1767.5858.7476.3564.09
VCD30.5173.3753.0467.9257.3477.0364.60
M3ID30.5172.3653.0467.5857.3477.3664.43
RITUAL28.8172.8654.7865.8758.0476.0163.83
Ours31.3670.8560.8768.6058.7477.3665.46
+ +Table C5: Detailed results on MM Vet benchmark with regular sampling. Abbreviations adopted: Rec for Recognition, OCR for Optical Character Recognition, Know for Knowledge, Gen for Language Generation, Spat for Spatial Awareness, Math for Mathematics. The best results are bolded, and the second best are underlined. + +
MethodRecOCRKnowGenSpatMathTotal
Regular30.819.014.517.926.911.526.1
VCD35.621.918.321.928.93.830.9
M3ID35.019.718.819.026.07.729.9
RITUAL36.320.619.521.124.77.730.6
Ours35.927.219.222.430.411.533.0
+ +# C.2 FULL RESULTS ON MME-HALLUCINATION + +In Table C3, we present the full results on the MME-Hallucination benchmark across three LVLMs. + +# C.3 FULL RESULTS ON MMBENCH + +In Table C4, we present the overall performance on the MMBench benchmark, as well as the detailed performance across six Level-2 abilities: Logical Reasoning (LR), Attribute Reasoning (AR), Relation Reasoning (RR), Fine-grained Perception - Single Instance (FP-S), Fine-grained Perception - Cross Instance (FP-C), and Coarse Perception (CP). We follow VCD (Leng et al., 2024) to conduct experiments on the MMBench-dev set. + +# C.4 RESULTS ON MM-VET + +In Table C5 and Table C6, we present the overall performance on the MM-Vet (Yu et al., 2024) benchmark with random sampling decoding and greedy decoding strategies, respectively. We use LLaVA-1.5 as the LVLM backbone. From the results, we observed that our method consistently outperforms others on the MMVet benchmark. Notably, it significantly excels in the OCR, spatial awareness, and math subsets. + +# C.5 RESULTS ON POPE USING GREEDY DECODING + +In Table C7, we present performance comparisons on the POPE benchmark with random sampling from the MS-COCO dataset. The experiment is conducted using the LLaVA-1.5 backbone. + +# C.6 EFFECTS OF $\alpha_{1}$ AND $\alpha_{2}$ IN SELF-CORRECTING DECODING + +In Section 3, we present two decoding approaches: complementary decoding and contrastive decoding. We also introduce two balancing hyperparameters, $\alpha_{1}$ and $\alpha_{2}$ , which control the relative influence of + +Table C6: Detailed results on MM Vet benchmark with greedy decoding. Abbreviations adopted: Rec for Recognition, OCR for Optical Character Recognition, Know for Knowledge, Gen for Language Generation, Spat for Spatial Awareness, Math for Mathematics. The best results are bolded, and the second best are underlined. + +
MethodRecOCRKnowGenSpatMathTotal
Greedy37.022.617.520.224.97.731.8
VCD38.222.822.524.625.13.833.4
M3ID37.923.620.420.726.011.533.2
RITUAL35.621.718.919.924.77.730.6
Ours37.925.020.219.532.815.034.0
+ +Table C7: Results on POPE using greedy decoding. + +
ValuesPOPE
Acc.Prec.Rec.F1
Greedy87.7388.1987.1387.66
VCD87.4786.6488.6087.61
M3ID89.0789.5488.4789.00
RITUAL89.2390.1788.0789.11
Ours89.4094.4483.7388.76
+ +the original and generated images in next-token prediction. In Table C8 and Table C9, we analyze the effect of varying $\alpha_{1}$ or $\alpha_{2}$ while keeping all other hyperparameters at their default settings. The results indicate that our default choice of $\alpha_{1} = 3$ and $\alpha_{2} = 1$ consistently yields the best performance across two benchmarks. Moreover, compared to setting these hyperparameters to 0, which effectively reduces complementary/contrastive decoding to standard decoding, the performance improvements demonstrate that our proposed decoding approaches significantly contribute to the overall effectiveness of DeGF in mitigating hallucinations in LVLMs. + +# C.7 EFFECT OF $\beta$ IN ADAPTIVE PLAUSIBILITY CONSTRAINT + +We further conduct an ablation study on $\beta$ introduced in Equation (7), where we vary $\beta$ from 0 to 0.5 while keeping all other hyperparameters fixed. The results in Table C10 show that setting $\beta = 0$ , which imposes no constraint, results in suboptimal performance across both benchmarks. Additionally, in the POPE benchmark, where LVLMs handle yes-or-no questions, a more aggressive truncation with $\beta = 0.25$ yields the best performance. In contrast, for the open-ended CHAIR benchmark, a lower value of $\beta = 0.1$ leads to the best results. + +# C.8 SCALING UP THE LVLMS + +We further extend our evaluation to larger-scale 13B variants of the LLaVA-1.5 model to assess the scalability of our approach. Table C11 compares our experimental results with other state-of-the-art approaches across all three subsets of the POPE benchmark using the 13B-sized LLaVA-1.5 model. We observe that scaling up the LLaVA-1.5 model does not alleviate the hallucination issues, as evidenced by the comparable performance of both the 7B and 13B models. Using the 13B-sized model, our DeGF consistently achieves improved performance across all subsets compared to other approaches, demonstrating its general effectiveness and scalability. + +# C.9 SPEEDING UP OUR APPROACH + +In this section, we propose two strategies to accelerate our approach: limiting the length of the initial response and reducing the number of inference steps in the diffusion process. + +Table C8: Sensitivity analysis of hyperparameter $\alpha_{1}$ . We present the performance of our approach, based on the LLaVA-1.5 backbone, across two benchmarks for varying values of $\alpha_{1}$ . Note that we fix $\alpha_{2} = 1$ in this experiment. + +
ValuesPOPECHAIR
Acc.Prec.Rec.F1CHAIRSCHAIRI
α1=087.5086.7187.4987.1022.87.6
α1=187.9787.2887.3487.3120.66.9
α1=288.9089.3987.7588.5619.46.3
α1=389.0391.2086.4088.7418.46.1
α1=488.6790.5685.2887.8422.68.1
+ +Table C9: Sensitivity analysis of hyperparameter $\alpha_{2}$ . We present the performance of our approach, based on the LLaVA-1.5 backbone, across two benchmarks for varying values of $\alpha_{2}$ . Note that we fix $\alpha_{1} = 3$ in this experiment. + +
ValuesPOPECHAIR
Acc.Prec.Rec.F1CHAIRSCHAIRI
α2=086.7785.1786.5885.8723.68.2
α2=189.0391.2086.4088.7418.46.1
α2=288.7389.8686.6688.2321.87.5
α2=388.0387.9786.2887.1222.87.3
α2=487.1386.5286.1686.3423.67.9
+ +- Reducing Diffusion Inference Steps. By default, we set the number of diffusion inference steps to 50 to ensure high-quality image generation. To improve the response generation speed, we can reduce the number of diffusion steps. In Table C12, we report the performance on the CHAIR benchmark after reducing the diffusion inference steps in the model. By reducing the diffusion inference steps from 50 to 10, the average latency decreases by 2.85 seconds per instance, while the performance on CHAIR remains robust. This demonstrates that reducing the inference steps of the diffusion model is an effective way to speed up our approach. +- Restricting Length of Initial Response. Our method involves two queries to the LVLM for self-correcting decoding. To enhance efficiency, we can limit the length of the initial response. In Table C13, we present the efficiency and CHAIR performance results after decreasing the maximum token limit for the initial response. We can see that reducing the maximum number of tokens in the initial response from 128 to 96 decreases the latency by 0.72 seconds per instance while maintaining competitive performance. However, further reductions result in performance degradation, as a shorter initial response fails to adequately cover the entire scene, limiting its ability to generate an image that effectively reflects and mitigates hallucinations. + +Note that these two strategies are not conflicting; instead, they are complementary. Setting the diffusion steps to 10 and limiting the maximum number of tokens in the initial response to 96 further reduces the inference latency to 10.21 seconds per instance while maintaining robust performance. + +# C.10 QUANTITATIVE ASSESSMENT OF GENERATED IMAGE QUALITY + +Our approach incorporates a text-to-image generation model to mitigate hallucinations. We evaluate the quality of the generated images on all 4 subsets on the MME benchmark using CLIPScore (Hessel et al., 2021). Specifically, we utilize the CLIP backbone with ViT-B/32 backbone for our evaluation. We list the results in Table C14. As we can see from the table, our text-to-image generative model (specifically, SD-v1.5) achieves an average CLIPScore of over 30 across all subsets. For comparison, + +Table C10: Sensitivity analysis of hyperparameter $\beta$ . We present the performance of our approach, based on the LLaVA-1.5 backbone, across two benchmarks for varying values of $\beta$ . + +
ValuesPOPECHAIR
Acc.Prec.Rec.F1CHAIRSCHAIRI
β = 087.1787.4585.3086.3621.27.1
β = 0.0588.2789.8586.1287.9519.16.3
β = 0.188.3389.0486.0487.5218.46.1
β = 0.2589.0391.2086.4088.7419.36.5
β = 0.587.8088.7985.4887.1020.26.9
+ +Table C11: Results on POPE (Li et al., 2023d) benchmark using 13B-sized LLaVA-1.5. Higher (↑) accuracy, precision, recall, and F1 indicate better performance. + +
SetupMethodLLaVA-1.5
Acc. ↑Prec. ↑Rec. ↑F1 ↑
MS-COCORandomRegular82.5378.5789.4783.67
VCD84.8080.6791.5385.76
M3ID85.3781.3091.8786.26
RITUAL87.8084.4592.6788.37
Ours88.4088.1488.6188.37
PopularRegular80.5376.1788.8782.03
VCD82.2376.8892.2083.84
M3ID82.6077.9191.0083.95
RITUAL84.0779.0092.8085.35
Ours85.3084.1886.9385.53
AdversarialRegular75.8070.4189.0078.62
VCD77.3371.4491.0780.07
M3ID77.4371.6590.8080.09
RITUAL78.0071.7292.4780.78
Ours81.4378.6187.0482.61
+ +the advanced DALL-E 3 model achieves a score of 32.0, while DALL-E 2 achieves 31.4. These results highlight the capability of our model to generate high-quality images that closely align with the initial response. + +# D MORE CASE STUDIES + +# D.1 DETAILS ABOUT GPT-4V-AIDED EVALUATION + +Following VCD (Leng et al., 2024), we use GPT-4V to evaluate responses in open-ended generation scenarios, scoring them based on accuracy and detailedness. Leveraging the strong human-like capabilities of GPT-4V, it can detect incorrect colors, positions, and relationships, providing a comprehensive evaluation of the responses. Specifically, we apply the prompt provided in Table D15 to instruct GPT-4V to rate the two responses on a scale of 1 to 10 for both accuracy and detailedness: + +- Accuracy measures the consistency between the responses/descriptions generated by the LVLMs and the given image. A lower score is assigned if GPT-4V detects any inconsistencies in the content of the responses. +- Detailedness evaluates the depth and specificity of the responses provided by the LVLMs. A higher score is awarded if the response includes comprehensive descriptions, captures fine-grained details + +Table C12: Effect of reducing diffusion infer- Table C13: Effect of restricting the number of ence steps. token in the initial response. + +
Diff. StepsAvg. Latency ↓CHAIRS ↓CHAIRI ↓
5013.89 s48.814.6
3012.56 s48.914.7
2011.87 s49.214.8
1011.04 s48.814.9
+ +
# TokensAvg. Latency ↓CHAIRS ↓CHAIRI ↓
12813.89 s48.814.6
9613.17 s48.814.9
6412.20 s49.514.8
3211.33 s51.214.9
+ +Table C14: CLIPScore evaluation across different MME subsets. + +
MME SubsetExistenceCountPositionColor
Avg. CLIPScore31.3430.6930.0931.69
+ +of the image, and provides well-elaborated explanations. Conversely, a lower score is given if the response is vague or lacks sufficient detail. + +# D.2 MORE QUALITATIVE RESULTS + +In Figure D1 and Figure D2, we provide additional case studies on LLaVA-Bench to qualitatively demonstrate the effectiveness of our methods in mitigating hallucinations. We also included GPT-4V evaluations of accuracy and detailedness scores for each instance. + +In Figure D3-D6, we provide qualitative evaluations of the images generated by the generative model, including both success and failure cases, across all four subsets of the MME benchmark to better understand the effectiveness of the generative models. Our results show that, despite occasional failure cases, the generative model consistently produces high-quality and realistic images that accurately visualize the initial response, providing effective self-feedback. + +# E FUTURE WORK + +In future work, we aim to extend the evaluation of our method to a broader range of LVLMs, such as Mini-GPT4 (Zhu et al., 2024) and mPLUG-Owl2 (Ye et al., 2024), as well as additional benchmarks, including R-Bench (Wu et al., 2024), which focuses on relation hallucination, and ROPE (Chen et al., 2024c), which addresses multiple-object hallucination. This expanded evaluation will allow us to more comprehensively assess the generalizability and effectiveness of our approach across diverse models and tasks. + +Furthermore, we plan to investigate integrating generative feedback directly into the instruction tuning phase. This integration has the potential to eliminate the computational overhead associated with applying our method during inference, thereby significantly improving efficiency without compromising performance. By pursuing these directions, we hope to further enhance the practical applicability and scalability of our approach. + +# Description: + +AI that scores image description accuracy and detailedness. + +# Instructions: + +You are an AI designed to evaluate and score the performance of two AI assistants in describing a given image. Your primary focus is on the accuracy and detailedness of their descriptions. You will assess the accuracy by checking for hallucinations - any part of the description that is inconsistent with the image content. For detailedness, you will consider how rich the response is in necessary details, excluding any hallucinated parts. You will provide scores on a scale from 1 to 10 for each assistant separately, based on these criteria. After scoring, you will offer an explanation for your evaluation, ensuring it is free from bias and not influenced by the order of presentation of the responses. + +Input format: + +[Assistant 1] + +{Response 1} + +[End of Assistant 1] + +[Assistant 2] + +{Response 2} + +[End of Assistant 2] + +Output format: + +Accuracy: + +Scores of the two answers: + +Reason: + +Detailedness: + +Scores of the two answers: + +Reason: + +Table D15: GPT-4V-aided evaluation setup. We present the prompt we provided to GPT-4V to evaluate the LVLM responses based on accuracy and detailedness. + +![](images/647f4f7e3888aab9463324e00f2d2c7eaacf02ea86a2bc01f8892983d15b1da6.jpg) +Visual Input: +Query: Describe this photo in detail. + +# [Regular Decoding] + +# GPT-4V-Aided Evaluation: Accuracy: 3 Detailedness: 4 + +The image features a table with four black fruit, possibly berries, cut in half to reveal their white interiors. The fruits are placed on the table, with one on the left side, one in the center, and two on the right side. In addition to the fruits, there are two bananas in the scene. One banana is located on the left side of the table, while the other is on the right side. The combination of fruits and bananas creates a colorful and appetizing display. + +# [Our Approach] + +# GPT-4V-Aided Evaluation: Accuracy: 7 Detailedness: 6 + +The image displays an arrangement of black and green fruits on a wooden surface, possibly a wooden table. The fruits are the central focus, covering a large portion of the foreground. Four of these fruit cut in half can be seen, with some positioned closer to the viewer's perspective, making them the most noticeable elements of the scene. The other two fruits on the table are partially visible but appear to be obscured by the more central fruits, adding an interesting contrast between the visible and obscured elements in the image. + +![](images/bc6677fc0b52bc67323947a9cc758bb30bf8433b13f30cfbf1fabe5c508ab25f.jpg) +Visual Input: +Query: Describe this photo in detail. + +# [Regular Decoding] + +# GPT-4V-Aided Evaluation: Accuracy: 2 Detailedness: 3 + +The image is a painting of a dog wearing an Elizabethan style ruff or collar, giving it a "painted" appearance alongside Pinocchio. The dog is posing for the painting, as if it's commissioned. It's seated while holding a book in its paws. In the background of the painting, there is another large dog visible, perhaps meant to further emphasize the dog's artistic appearance. Around the scene, a handbag can be seen positioned near the top-right corner of the painting. + +# [Our Approach] + +# GPT-4V-Aided Evaluation: Accuracy: 7 Detailedness: 6 + +The image features a dog wearing a hood and a gown, giving it an artistic and mysterious appearance. The dog is positioned in the center of the scene, and its attire appears to be inspired by the famous Mona Lisa painting. The hood and gown give the dog a regal and enigmatic look, reminiscent of the famous portrait of the Mona Lisa. The image is painted in a black and white style, further emphasizing the artistic nature of the scene. + +![](images/adba3f57c8c8f570c6added6ba32e4b5c6a8cf38515b4ced403af41f54890fc5.jpg) +Visual Input: +Query: Describe this photo in detail. + +# [Regular Decoding] + +# GPT-4V-Aided Evaluation: Accuracy: 3 Detailedness: 4 + +The scene depicts a man sitting on a small folding chair, ironing a blue shirt on the back of a yellow city cab parked on a crowded city street. A red car is parked in front of the yellow cab, in close proximity to the overall scene. There are several other vehicles on the street as well, including a truck and a few cars nearer to the foreground. Among the parked cars, there is a teddy bear visible, adding a playful touch to the urban surroundings. The man seems to be catching a break by doing some duty in the midst of traffic. + +# [Our Approach] + +# GPT-4V-Aided Evaluation: Accuracy: 4 Detailedness: 5 + +The image depicts a man riding on the back of a yellow taxi while ironing clothes. He is sitting on a portable ironing board, which is strapped to the taxi's back. The truck is driving down a busy street, with other vehicles such as cars and a bus visible in the scene. There are several plants placed along the street, adding some greenery to the urban environment. The man appears to be enjoying his unique mode of transportation while taking care of his laundry. + +![](images/4bfdbdc5fcb4abccdee3b9212935d36741671f5b6951eb7d284257817e4803c0.jpg) +Visual Input: +Query: Describe this photo in detail. + +# [Regular Decoding] + +# GPT-4V-Aided Evaluation: Accuracy: 4 Detailedness: 4 + +The image features a well-stocked refrigerator filled with a variety of food items. On its shelves, there are several bottles, some filled and others empty, occupying varying positions and heights. In addition to the bottles, there are fresh fruits like grapes and strawberries displayed, and multiple carrots arranged in the bottom part of the fridge. The diverse array of items, including some fruits, vegetables, and beverages, showcase an organized and well-stocked refrigerator with a focus on healthy eating options. + +# [Our Approach] + +# GPT-4V-Aided Evaluation: Accuracy: 6 Detailedness: 6 + +The image displays a well-stocked refrigerator filled with a variety of food items. There are several carrots placed in different compartments, with some in a plastic container and others in a green tray. The refrigerator also contains milk, yogurt, juice, and strawberries, all neatly arranged to create an organized and visually appealing display. In addition to the food items, there are a few bowls placed within the refrigerator, possibly for holding leftovers or additional ingredients. The refrigerator is filled with a diverse assortment of foods, showcasing a well-stocked and well-organized kitchen. + +Figure D1: Case studies on the LLaVA-Bench benchmark. We compare the responses generated by regular decoding and our method using LLaVA-1.5. GPT-4V-aided evaluation results are also provided alongside the responses. Hallucinated and accurate content is highlighted in red and green. + +# Visual Input: + +Sometimes I just look at pictures of the earth from space and I marvel at how beautiful it all is. + +![](images/15971f5ba84547fcbf84c5ef18edf8dcf82d140ac27758bf5582649c0f1214a4.jpg) + +Query: Can you explain this meme in detail? + +# [Regular Decoding] + +GPT-4V-Aided Evaluation: Accuracy: 3 Detailedness: 4 + +In this image, there is a pan placed on the stovetop topped with multiple pieces of golden fried chicken. The cooked chicken pieces are scattered around the pan, creating a circle formation around it. The arrangement of the chicken pieces and their positioning over the pan give the impression of the Earth, as if the pieces of chicken are flying in the sky or traveling through space. This creative presentation gives the appearance of a global exposure or "I marveled at how beautiful it all is." + +# [Our Approach] + +GPT-4V-Aided Evaluation: Accuracy: 7 Detailedness: 6 + +The image features a fried chicken patty in the shape of a world map, placed on a metal baking sheet. The chicken patty is cut into several pieces, resembling different countries around the globe. The chicken pieces are arranged to represent various countries, with some pieces being larger and more prominent than others. The unique presentation of the chicken as a world map makes it an interesting and creative dish. + +# Visual Input: + +![](images/18e8cd20ae404b028cc5d3b0fa80960fe7d93602ead5e4922261c97fa20ccffc.jpg) + +Query: Give a detailed description of this meme. + +# [Regular Decoding] + +GPT-4V-Aided Evaluation: Accuracy: 2 Detailedness: 3 + +The image is a comic strip featuring a man with a stack of heads on his chest, symbolizing a stack of layers, and several points on his face. He is talking about stacking layers. The comic is placed next to a smaller version of the same scene, and both scenes appear to be related to the topic of neural networks or layered systems. In addition to the man with the stack of heads, there is another pop character, John McClane himself, whose face is also incorporated into the scene, making a humorous connection to the main concept. + +# [Our Approach] + +GPT-4V-Aided Evaluation: Accuracy: 4 Detailedness: 5 + +The image consists of two comics depicting a person teaching statistics. In the first comic, the person is shown pointing to a graph, while in the second comic, they are pointing to a different graph. The person is explaining layers, stack more layers, and neural networks to the audience. The image is filled with various graphs and diagrams, which are used to illustrate the concepts being discussed. The person appears to be angry while teaching, emphasizing the importance of the topic. The comic is a mix of serious and humorous elements, making it an engaging and informative visual. + +# Visual Input: + +![](images/8b0e45e5f8cf230a737a8f533bdabfc63148441e838398c802bec65405dbdda4.jpg) + +Query:This is the logo of LLaVA, Large Language and Vision Assistant, based on the LLaMA architecture. Please explain this logo in detail, and how do you think of its design. + +# [Regular Decoding] + +GPT-4V-Aided Evaluation: Accuracy: 2 Detailedness: 3 + +The LLaVA logo features a large eyeball, possibly a goofy looking one, with vibrant orange and red flames licking upward around its borders. The overall design appears to be quite intricate and abstract. The choice of colors and the unconventional design might be inspired by an amusing parody or a playful take on artificial intelligence and the classic HAL 9000 reference from 2001:A Space Odyssey. The stark contrast between the eerily composed "eye" and the flames gives the logo a unique aesthetic, sparking curiosity and attention for the viewer, while possibly conveying the concept of artificial intelligence. The air of humor or creative unsettlement may effectively communicate the underlying message and lure more people to appreciate the idea behind LLaVA. + +# [Our Approach] + +GPT-4V-Aided Evaluation: Accuracy: 8 Detailedness: 7 + +The LLaVA logo is a playful and unique design featuring a fire-breathing toy camel. The camel is standing on two black feet, with flames coming out of its mouth and legs. The glasses on the camel's face add a touch of whimsy to the design. The overall appearance of the logo is visually engaging and memorable, likely aiming to represent the innovative and creative nature of the LLaMA architecture. The design choice of using a camel as the central figure is an unconventional and eye-catching element, which can help the logo stand out and make a strong impression on viewers. + +# Visual Input: + +![](images/bac48f85c2e4a845628d338474d46b03198b27dc453140a03c83675428098ee5.jpg) + +Query: Describe this photo in detail. + +# [Regular Decoding] + +GPT-4V-Aided Evaluation: Accuracy: 2 Detailedness: 3 + +The scene displays a delicious meal with a bowl of soup, a bowl of gyro, and another bowl containing greed. There's also a fried egg on rice in a bowl, offering a tempting mix of colors and textures. A spoon and a fork are placed near the soup, ready for use when enjoying this mouthwatering assortment. The various foods and bowls present an enticing feast likely appealing to those with a diverse appetite. + +# [Our Approach] + +GPT-4V-Aided Evaluation: Accuracy: 4 Detailedness: 5 + +The image features a dining table with a large bowl of delicious noodles, meat, and vegetables. The bowl is filled with various ingredients, such as onions, carrots, and green peppers, making it an appetizing meal. In addition to the main bowl, there are several smaller bowls placed on the table, containing different food items. A spoon is also visible on the table, likely for serving the noodle dish. The arrangement of the bowls and the spoon suggests that this is a meal shared among friends or family. + +Figure D2: Case studies on the LLaVA-Bench benchmark. We compare the responses generated by regular decoding and our method using LLaVA-1.5. GPT-4V-aided evaluation results are also provided alongside the responses. Hallucinated and accurate content is highlighted in red and green. + +Query: Is there a tie in this image? Describe relevant details about this. + +![](images/8a6980f8339b2fe1842402abdc9fd26588b72a92d6fd26ff2ec35e74cf6bbdb3.jpg) + +![](images/c7d23525c6a5c52eb64067d77416de564ec601b8edfc80edf2c7840b19fcdaa4.jpg) + +Yes, there is a large, four-tiered wedding cake in the image, and it is adorned after being done. The cake features unique details like pink flowers. It stands on top of a white cake plate, and the overall appearance is perfect for a special event, such as a wedding. + +![](images/be0f455b7ef61d0d606cdb7e57f4217f622ee20dcb9211404002c00a68cba3f2.jpg) + +![](images/e4563071fe7805420ece8df5600d948cabda596cc576c4d86e1ebcb0b9eb12a9.jpg) + +Correct Generation + +Query: Is there a kite in this image? Describe relevant details about this. + +![](images/eb9fdd25a6c3e4fdd6c89f5559336a13b4ed9d343a300e8baa86a38703f58554.jpg) + +![](images/5cb4882beb179549d4e73b1c27a28f4a2d61d5795fad2b366a5fefce65bb253e.jpg) + +Yes, there is a kite that can be seen in the image. It is being flown by someone in an open yard near the fire hydrant. This scene serves as a contrast between the urban setting with the fire hydrant and pole, and the more recreational activity taking place in the kite flying. + +![](images/8e13aa366c85ac4babd920cec14b23f01fc3b60e5f18d7735697932f899bc25b.jpg) + +![](images/90879ca207b813e0b521fd5fe66e200880c3f1108fbfcfef29ec73ee88bb06e1.jpg) + +Correct Generation + +Query: Is there a car in this image? Describe relevant details about this. + +![](images/910265d69082ac24fee04ab53c8aba231a7d9baf2ae7f4a647116e9a95353d0d.jpg) + +![](images/ed2dd61980fed7401a254d36ad3bba6620c04277a32848f0323c09caea773278.jpg) + +Yes, there is a car in the image. There is a red car on the street, which is parked next to some buildings and traffic lights. The car appears to be lining up to enter a business area behind a man standing near the street crossing sign. + +![](images/b5a3f36fd6129aabfc9ce9661945963fe46c032ac9378c9d17cb4fdcf02b3353.jpg) + +![](images/d81826bbc8ca69bf1d39c97e439dfd885d858c1a588103adb182af47216d84f1.jpg) + +Correct Generation + +Query: Is there a skateboard in this image? Describe relevant details about this. + +![](images/d527815f849e30fe092100b6dc98204856421602bfa63a5534925cbd7add7b7f.jpg) + +![](images/852db5ab3703d3e26b350e06353552631255d87f418739fd52ec421b1c4f3fdf.jpg) + +Yes, there is a skateboard in this image. A man is jumping mid-air on the skateboard with his hands and feet out. The skateboard and the man on it are in motion, which adds to the excitement and action of the scene. + +![](images/ed56fa5de6ff84cdc1060d6239af137960f9b65e619e9d9fad21753c1ee4c393.jpg) + +![](images/1d6eaeb5e13404655bf3e47859a2bf9f892efe4fb8e5cc5823d5710999211c77.jpg) + +Correct Generation + +Query: Is there a mouse in this image? Describe relevant details about this. + +![](images/6eaa867e0b1f90c3b81efc99196198a1c396564be75a81ccdc56c45cba505a5b.jpg) + +![](images/1f5147d8e3b0e24c832681f1b4471ac86190b3c7bc4d6644b9899b25d21bbaab.jpg) + +There is a mouse in the image, but it appears to be a cell phone rather than a regular computer mouse. It is placed together with the phone and other items, such as a paper, a glass, and possibly a keyboard, on the desk. + +![](images/19d9e9b018028986884a37d01f6337e4dc7fe1e6120892479f88c18ac2924053.jpg) + +![](images/d196f3b379a2ec17fc173d6184e8719eca63739a3bcefb0d332139e24d072ee7.jpg) + +Incorrect Generation + +Figure D3: Qualitative evaluation of images generated by the generative model on the existence subset of the MME benchmark. Specifically, the left displays the original image input, the middle presents the initial response generated by the LVLMs, and the right shows the image generated based on this response. This figure showcases four success cases and one failure case of our Diffusion models in generating high-quality images that align with the initial response. + +Query: Are there a total of two dogs in the picture? Describe relevant details about this. + +![](images/4417f5b29900d00cc0ce81546dcb03cff33da51bc0316000aa4da26b01cfb4b9.jpg) + +# Initial Response + +Yes, there are a total of two dogs in the picture. One of the dogs is lying down and looking at the computer, resting its head on the keyboard. The other dog is visible just behind or to the side of the main dog. + +![](images/8fc381ae7a0b5f446a509eb3e59e6e525adc673d0aca70119a46eb21174d35b3.jpg) + +![](images/083a6888b3ebc05849239046294be739ae52738c4bf798173eeaf98c83a6f19e.jpg) + +Correct Generation + +Query: Is there an elephant in this image? Describe relevant details about this. + +![](images/51c05788f945c3a9d9f28644257590e8703abb8f7d3f08d78929e291861ad279.jpg) + +# Initial Response + +Yes, there is an elephant in the image. It is a baby elephant with a gray and muddy coat, standing in mud with its ears spread out. + +![](images/9bf17cf4b2afc546bfb5ded69a2c63b184a22026abfb34036d8ba58df237a94a.jpg) + +![](images/211e7de2b6fb592ee5349812ebfed7455d869888bcc24864f646a24491c15404.jpg) + +Correct Generation + +Query: Are there two bowls in this image? Describe relevant details about this. + +![](images/375ad72714b9f06edf632c7e6ed1dd6b0db1c19115904ff056c44c374bb7ccd6.jpg) + +# Initial Response + +Yes, there are two bowls in the image, and both are filled with a fruit salad containing fruits such as strawberries, blueberries, mango, and walnuts. The bowls are sitting on a table or counter top. + +![](images/2f0d85ed19ac80242dcc653fb3b14e8c89dd9f0d4cad4a7b4d49b9512835fbc8.jpg) + +![](images/c5282055acfbc7cd7ab3fd88e7a38ad76475a5bffd81d464debad52a7818b1e7.jpg) + +Correct Generation + +Query: Are there three remotes in this image? Describe relevant details about this. + +![](images/57f5d998ff1b400bbb5bb551f1c04b83ad673b7ce335adff83cf24c434126750.jpg) + +# Initial Response + +Yes, there are three remotes in this image. Two of them are white, similar to a Nintendo Wii remote, while the third one has a more traditional-looking design. They are placed on top of a bed, which has a white handle and a comforter on top. + +![](images/5952155e2f0859d7f61ea1b6095c8d21c3156e32ecd223a9b3918c27aa474c80.jpg) + +![](images/91479debec354807d3656c321133216b7caf6c699bc763237c0ac3a2b85ce10d.jpg) + +Correct Generation + +Query: Are there three neckties in the image? Describe relevant details about this. + +![](images/d769e7e934000d1e8d6e7317a02abf30755753cbbb48a3ce7ea212d34cffdfbf.jpg) + +# Initial Response + +Yes, there is an image of a bald man wearing three different neckties, indicating a playful and unique sense of style. + +![](images/8631646f431786f2522873cd4a4a8273f47d7884be8349b3a53882e85079e577.jpg) + +![](images/aa0f7c1f30a716e9e1887a8a82cc1256188198ec61a2f1e3261d8cc45fe73e82.jpg) + +Incorrect Generation + +Figure D4: Qualitative evaluation of images generated by the generative model on the count subset of the MME benchmark. Specifically, the left displays the original image input, the middle presents the initial response generated by the LVLMs, and the right shows the image generated based on this response. This figure showcases four success cases and one failure case of our Diffusion models in generating high-quality images that align with the initial response. + +Query: Are the pedestrians on the left of the bus? Describe relevant details about this. + +![](images/3ef36fe39902beaec498813c0e3443bf4b5cc2ba8b5481671a2d5cde78d2d7ef.jpg) + +![](images/c051a56787fb87aab8dd00a842778bc3c60f88262bb64ed42fc0d5248a098e97.jpg) + +# Initial Response + +Yes, the pedestrians are on the left side of the bus. One pedestrian is standing near the road, while two other people are waiting in line to board the yellow city bus. + +![](images/0f1dfca27fea2a40dba8953d5267f2acb8acacb3d47c5e7af0002a0df828158d.jpg) + +![](images/77b7ad37bc0afad5af036ba26fb04a8ac7c9a99b3b71fdb2e84cc4e23186645a.jpg) + +Correct Generation + +Query: Is the TV on the right of the lamp? Describe relevant details about this. + +![](images/0444a1e5ed816525477e98aae558fbed2c8dea744fbfaf6828ea274aabdf8888.jpg) + +![](images/06a9768e869d281c408f077df3f9ee630b73f431dc4ac52baf891c5570ec2946.jpg) + +# Initial Response + +Yes, the TV is on the right of the lamp. The room appears to be old-style, and there is a couch set accompanied by a television. There are also several TV remotes on the table near the couch, indicating the presence of multiple control options for the TV. + +![](images/1504164bb092b4ecad2c1a187d0cd05fe5c049c9315919c547592b74b93f9844.jpg) + +![](images/f8734970df719abde70864c2d234c0ab6719913a0008040153f5090d3a0ce68a.jpg) + +Correct Generation + +Query: Is the refrigerator on the left side of the picture? Describe relevant details about this. + +![](images/e6417c522946e4ac0771ba49788b885996a806a7ab21f3e225efe48a546b4ebd.jpg) + +![](images/38058c18a01535e5ce52ce4960da0a80b10c59d7c1daa39c96eef89fdade6481.jpg) + +# Initial Response + +Yes, the refrigerator is located on the left side of the picture. It has a picture placed on the refrigerator door. + +![](images/a04edcf963a86cabc3fec1b2adeb135f1131d3695b16abd779e8daa48d45ec5f.jpg) + +![](images/87c6e55c45024a2e68faea70c127aabc9a2dd78d014efd7b9e2101607081f2c1.jpg) + +Correct Generation + +Query: Is the sea behind people in the image? Describe relevant details about this. + +![](images/048affb7279bc97843cda2d1f895f8c6ede96a1b4a86de344607abe577c815bb.jpg) + +![](images/56f761ebe6c5c6d0df6b94c0bc794a89f99ab2e6bc1134ed1130fa5be9e1f310.jpg) + +# Initial Response + +Yes, the sea is behind people in the image. Located in a sandy beach area, the two men are riding horses, and in the distance, there is an ocean, providing a picturesque and serene setting for the scene. + +![](images/34b6f71b2d885baaeb9148d6f9646dd92dd38647579121c45082f5f55e042edc.jpg) + +![](images/67592d82ad4a65ab482582568f979cea4051945ca0b3698d941361433434c884.jpg) + +Correct Generation + +Query: Is the vase on the right of the bottle? Describe relevant details about this. + +![](images/e2facc9b7ed1ec8938cb0c78149b4d6c8d75d60f2455f2077efab790d60a3016.jpg) + +![](images/8640f4a5a306ac5949f3d3af252270f4f9b5f262867cde2990e2278ec2dd93f3.jpg) + +# Initial Response + +Yes, the vase is on the right of the bottle. It sits on a table near the kitchen counter with a tray holding the gourmet food. + +![](images/3d8faf0d6bb40eb983d154db60223d92c6e290b512d84b99ab68119a3f23528f.jpg) + +![](images/5fc77b894dcab42e649916e0274ff2b7a4fd7ef5b597809479f6f733fd34aba7.jpg) + +Incorrect Generation + +Figure D5: Qualitative evaluation of images generated by the generative model on the position subset of the MME benchmark. Specifically, the left displays the original image input, the middle presents the initial response generated by the LVLMs, and the right shows the image generated based on this response. This figure showcases four success cases and one failure case of our Diffusion models in generating high-quality images that align with the initial response. + +Query: Is there a blue and orange fire hydrant in the image? Describe relevant details about this. + +![](images/4908258ade3ac8bb0c54abf643f9d73cb6fe69b3a9550409bbfe90757a07afe2.jpg) + +![](images/5945720e421faa961e9f437c04325eebe8b537d73d419311563ff4c7d4a65207.jpg) + +# Initial Response + +The image features a blue and orange engine company fire hydrant on the side of the street. It is a large, metal fire hydrant near an intersection. + +![](images/675cd5f82409784b072ee50c51779d6fee662b31011820d67dfa12be38380d14.jpg) + +![](images/6898da438f7d1bf78199f3c2f71a886a303593578dfce96ec6e5a25ab6270d83.jpg) + +Correct Generation + +Query: Is there a red hat in the image? Describe relevant details about this. + +![](images/e3b6bb36f4b356cd8be8d9a47ac8c02c8fa4aef1c2dfe6f805b87ee01d766af8.jpg) + +![](images/3b67ae645b53d8e4fa7845e0b417623b0548fc04e737e603dbb153e3ef1b2103.jpg) + +# Initial Response + +Yes, a dog wearing a red hat is a notable aspect of this image. The dog is wearing a green top hat as well, which adds to the entertaining and whimsical nature of the scene. + +![](images/5a12d9b46b326a8cd65951323aac1dc1a5b0a8e220b4107053c986e970694ab4.jpg) + +![](images/ce81a94a3dac7b3b2aabb7bc25440f1d0f760e32f04da190d0bcf2413ad7cb28.jpg) + +Correct Generation + +Query: Is there a living room painted yellow in the image? Describe relevant details about this. + +![](images/4b2d99d662085b754224f0a15492427bad8bbf8426aa2b7cc55bcee367896411.jpg) + +![](images/d28a87f18e086243dd9c5e338cc2cdbc83f49716ba5717e9664cafe76e13e51a.jpg) + +# Initial Response + +Yes, the image shows a living room that is painted yellow. It is an old yellow living room. + +![](images/c4d83b7527aea302c25a6cf61425fda456db300487fc81f82de199260715d8c6.jpg) + +![](images/98a92d8b60816681f9bde19f7583c285755453406fd2b2e97676c6dc42fc8600.jpg) + +Correct Generation + +Query: Is there a brown and black dog in the image? Describe relevant details about this. + +![](images/dff06d8fc140d713daaf952662f8dcd7725aec831a70f4ad4b65b28850d21218.jpg) + +![](images/4746b3bf246fbb3d13fbcab9a3ea276f29da1ee80a5fbd9fdf0aa8fca6c20a74.jpg) + +# Initial Response + +Yes, there is a brown and black dog given the name Max in the image, which is likely a Dachshund. This dog is laying on its side next to a person, possibly on a bed or a desk with a laptop. + +![](images/847a60061de29896407101d701df341b0634330d2c8d33fd40a031c03bc2667a.jpg) + +![](images/acdd3cbdc94c2fc0ae5bdacfef5360d94334d1d500a61b62cbb45694a683d22f.jpg) + +Correct Generation + +Query: Is there a red bicycle with white handlebars in the image? Describe relevant details about this. + +![](images/23f3d90641af15ad90edf94dce963f35e08a94021d2c49291d76bf77b89e6ca3.jpg) + +![](images/693aeada777a027b55b36139122f3af0eddd58106dc44492620ede0a90a075c4.jpg) + +# Initial Response + +Yes, there is an old red bicycle sitting locked up against a pole, featuring pink handlebars. It is parked underneath a parking meter, indicating that the owner has tied it to the bike rail to ensure its security while they are away. + +![](images/1506c6011a16e0c655441a0889b12aaf2aca36665181b53043b8221c28b563e7.jpg) + +![](images/0b9686d29c81fd4e5b1231fed53ef01b048f82f26321204cf979f853ef1e0256.jpg) + +Incorrect Generation + +Figure D6: Qualitative evaluation of images generated by the generative model on the color subset of the MME benchmark. Specifically, the left displays the original image input, the middle presents the initial response generated by the LVLMs, and the right shows the image generated based on this response. This figure showcases four success cases and one failure case of our Diffusion models in generating high-quality images that align with the initial response. \ No newline at end of file diff --git a/ICLR/2025/Self-Correcting Decoding with Generative Feedback for Mitigating Hallucinations in Large Vision-Language Models/images.zip b/ICLR/2025/Self-Correcting Decoding with Generative Feedback for Mitigating Hallucinations in Large Vision-Language Models/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..1a9ccfcdbfb68d411204ca25aafa80fcf115539c --- /dev/null +++ b/ICLR/2025/Self-Correcting Decoding with Generative Feedback for Mitigating Hallucinations in Large Vision-Language Models/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:20e1026021c6ec1dc786ee9b542aa6a4bd062f4e8e03a6a42babf2db9e68b650 +size 1943733 diff --git a/ICLR/2025/Self-Correcting Decoding with Generative Feedback for Mitigating Hallucinations in Large Vision-Language Models/layout.json b/ICLR/2025/Self-Correcting Decoding with Generative Feedback for Mitigating Hallucinations in Large Vision-Language Models/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..6de61d9d739e323ebd16510b293016894fdc7cf4 --- /dev/null +++ b/ICLR/2025/Self-Correcting Decoding with Generative Feedback for Mitigating Hallucinations in Large Vision-Language Models/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:22f41b04359105f816cc97ec5b4d30c741b3806ecf73dd80900e1eb8b9220a85 +size 1063947 diff --git a/ICLR/2025/Self-Evolving Multi-Agent Collaboration Networks for Software Development/dfa0715d-961b-461e-82c5-8077521a7dc5_content_list.json b/ICLR/2025/Self-Evolving Multi-Agent Collaboration Networks for Software Development/dfa0715d-961b-461e-82c5-8077521a7dc5_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..c2c06f0d793b5147f1d327230d9c55d667915e23 --- /dev/null +++ b/ICLR/2025/Self-Evolving Multi-Agent Collaboration Networks for Software Development/dfa0715d-961b-461e-82c5-8077521a7dc5_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:32d14db700aa7b40fd4af2b0c291c0c2ffbf9fde19e9aca22e7c594e6f5aaf3c +size 146560 diff --git a/ICLR/2025/Self-Evolving Multi-Agent Collaboration Networks for Software Development/dfa0715d-961b-461e-82c5-8077521a7dc5_model.json b/ICLR/2025/Self-Evolving Multi-Agent Collaboration Networks for Software Development/dfa0715d-961b-461e-82c5-8077521a7dc5_model.json new file mode 100644 index 0000000000000000000000000000000000000000..0a57a79e805ccd368d1ad7c2e76f605451e91cef --- /dev/null +++ b/ICLR/2025/Self-Evolving Multi-Agent Collaboration Networks for Software Development/dfa0715d-961b-461e-82c5-8077521a7dc5_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:33d51b70050cc99aea81d602e57e35cfcc97fc378956b2fcd58923eec7824931 +size 171779 diff --git a/ICLR/2025/Self-Evolving Multi-Agent Collaboration Networks for Software Development/dfa0715d-961b-461e-82c5-8077521a7dc5_origin.pdf b/ICLR/2025/Self-Evolving Multi-Agent Collaboration Networks for Software Development/dfa0715d-961b-461e-82c5-8077521a7dc5_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..409c1b8dcbbc1943ab832a61bafd9fad1ef19dcf --- /dev/null +++ b/ICLR/2025/Self-Evolving Multi-Agent Collaboration Networks for Software Development/dfa0715d-961b-461e-82c5-8077521a7dc5_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f8b66745e5fb7f4fba104d7b304c4abf98675885cd6309b693f0fe39ee964aa7 +size 7873984 diff --git a/ICLR/2025/Self-Evolving Multi-Agent Collaboration Networks for Software Development/full.md b/ICLR/2025/Self-Evolving Multi-Agent Collaboration Networks for Software Development/full.md new file mode 100644 index 0000000000000000000000000000000000000000..7011adb5c1072f6da4fa3c3d041f4c78a0e66329 --- /dev/null +++ b/ICLR/2025/Self-Evolving Multi-Agent Collaboration Networks for Software Development/full.md @@ -0,0 +1,779 @@ +# SELF-EVOLVING MULTI-AGENT COLLABORATION NETWORKS FOR SOFTWARE DEVELOPMENT + +Yue Hu $^{1}$ , Yuzhu Cai $^{2,3}$ , Yaxin Du $^{1}$ , Xinyu Zhu $^{1}$ , Xiangrui Liu $^{1}$ , Zijie Yu $^{1}$ , Yuchen Hou $^{1}$ , Shuo Tang $^{1}$ , Siheng Chen $^{1,3}$ + +1 Shanghai Jiao Tong University, 2 Beihang University, 3 Shanghai AI Laboratory + +1 {1867112931,sihengc}@sjtu.edu.cn, caiyuzhu@buaa.edu.cn + +# ABSTRACT + +LLM-driven multi-agent collaboration (MAC) systems have demonstrated impressive capabilities in automatic software development at the function level. However, their heavy reliance on human design limits their adaptability to the diverse demands of real-world software development. To address this limitation, we introduce EvoMAC, a novel self-evolving paradigm for MAC networks. Inspired by traditional neural network training, EvoMAC obtains text-based environmental feedback by verifying the MAC network's output against a target proxy and leverages a novel textual backpropagation to update the network. To extend coding capabilities beyond function-level tasks to more challenging software-level development, we further propose rSDE-Bench, a requirement-oriented software development benchmark, which features complex and diverse software requirements along with automatic evaluation of requirement correctness. Our experiments show that: i) The automatic requirement-aware evaluation in rSDE-Bench closely aligns with human evaluations, validating its reliability as a software-level coding benchmark. ii) EvoMAC outperforms previous SOTA methods on both the software-level rSDE-Bench and the function-level HumanEval benchmarks, reflecting its superior coding capabilities. The benchmark can be downloaded at https://yuzhu-cai.github.io/rSDE-Bench/. + +# 1 INTRODUCTION + +Automatic software development focuses on generating code from natural language requirements. Code is a universal problem-solving tool, and this automation presents significant potential to provide substantial benefits across all areas of our lives Li et al. (2022a). Recently, the industry has introduced several large language model (LLM)-driven coding assistants, including Microsoft's Copilot Microsoft (2023), Amazon's CodeWhisperer Amazon (2022), and Google's Codey Google (2023). These coding assistants significantly advance human efficiency and yield considerable commercial benefits. Despite the initial success of LLMs in assisting with line-level coding, they struggle to tackle more complex coding tasks. This limitation stems from the restricted reasoning abilities of single LLMs and their lack of capacity for long-context understanding Wang et al. (2024a); Li et al. (2024a); Wang et al. (2024b). + +To handle function-level coding tasks, numerous multiple language agent collaboration (MAC) systems have been proposed Li et al. (2023); Hong et al. (2023); Chan et al. (2024); Islam et al. (2024); Yang et al. (2024b); Li et al. (2022b); Osika (2023). These MAC systems function as LLM-driven agentic workflow. They follow human-designed standardized operating procedures to divide the complex coding tasks into simpler subtasks within the workflow, allowing each agent to conquer specific subtasks. These MAC systems significantly advance coding capabilities from line-level to function-level tasks. However, current MAC systems rely on heuristic designs. These human-crafted static systems have two inherent limitations: i) their performance is confined to human initialization. Given the diversity of real-world coding tasks, human design cannot fully address the specific needs of each task; and ii) they lack the flexibility to adapt to new tasks. This rigidity necessitates that researchers and developers manually decompose tasks and create prompts. The complexity of this process inhibits effective human optimization for adapting to new challenges. + +To address these limitations, we present EvoMAC, a novel self-evolving paradigm for MAC networks. EvoMAC's key feature is its ability to iteratively adapt both agents and their connections during test time for each task. Inspired from the standard neural network training, the core idea of self-evolution is to obtain text-based environmental feedback by verifying the MAC network's generation against a target proxy, then leverage a novel textual back-propagation to update the MAC network. Following this general paradigm, we specify EvoMAC for software development, which comprises three essential components: i) an adaptable MAC network-based coding team that generates code through feed-forward; ii) a specifically designed testing team that creates unit test cases serving as the target proxy and verifies the generated code in the compiler to produce objective feedback; and iii) an updating team that uses the textual back-propagation algorithm to update the coding team. By cycling these three components, the coding team can iteratively evolve and generate codes that are better aligned with the unit test cases, eventually fulfilling more requirements of the coding task. + +Our self-evolving MAC network has the potential to further advance coding capabilities from function-level to more complex software-level tasks. As it can iteratively address lengthier task requirements and cater to realistic software development demands. However, existing benchmarks typically focus on specific individual functions Chen et al. (2021); Austin et al. (2021); Yang et al. (2024a); Khan et al. (2023) or bug-fixing Jimenez et al. (2023), leaving a significant gap in providing comprehensive requirements for software development. This gap makes it difficult to fully assess the potential of our self-evolving MAC network. + +To support the development of software-level coding capabilities, we propose rSDE-Bench, a novel requirement-oriented software development benchmark. It is the first benchmark that features both complex and diverse software requirements, as well as the automatic evaluation of requirement correctness. rSDE-Bench involves 53 coding tasks with 616 requirements, covering two typical software types, Website, and Game, and two requirement difficulty levels, Basic and Advanced. Each coding task consists of two components: i) multiple requirements that clearly outline measurable software functionalities, item by item, and ii) paired black-box test cases that automatically verify the correctness of each requirement. rSDE-Bench can achieve automatic evaluation with these synchronized pairs of requirements and test cases. The rSDE-Bench introduces new software-level challenges, including lengthy requirement analysis and long-context coding, which are essential in real-world software development but are absent in existing benchmarks. + +To validate the effectiveness of our proposed EvoMAC and rSDE-Bench, we conduct three key evaluations. First, we compare our automatic evaluation in rSDE-Bench with human evaluation, achieving a coherence score of $99.22\%$ , demonstrating its reliability. Second, we compare EvoMAC against five multi-agent and three single-agent baselines. EvoMAC significantly outperforms previous SOTAs by $26.48\%$ , $34.78\%$ , and $6.10\%$ on Website Basic, Game Basic, and HumanEval, respectively, underscoring its effectiveness. Third, we evaluate EvoMAC with varying evolving times and two different driving LLMs. The results indicate that EvoMAC consistently improves with more evolving times and shows convincing enhancements regardless of the driving LLM used, further demonstrating the effectiveness of our self-evolving design. + +To sum up, our contributions are: + +- We propose EvoMAC, a novel self-evolving MAC network, and apply it to software development. EvoMAC can iteratively adapt both agents and their connections during test time for each task. +- We propose rSDE-Bench, a novel requirement-oriented software development benchmark. It is the first benchmark that features both complex and diverse software requirements, as well as the automatic evaluation of requirement correctness. +- We conduct comprehensive experiments and validate that: automatic evaluation in rSDE-Bench is highly aligned with human evaluation; EvoMAC outperforms previous SOTAs, and self-evolving promises continuous improvement with evolving times. + +# 2 RELATED WORKS + +LLM-based multi-agent collaboration. LLM-driven multi-agent collaboration (MAC) systems Xu et al. (2023); Hua et al. (2023); Ziems et al. (2024); Wu et al. (2023); Hong et al. (2023); Chan et al. (2024); Mandi et al. (2024a) enable multiple agents to share information and collaboratively complete the overall task. These MAC systems function as agentic workflows. They have demonstrated enhanced problem-solving capabilities in various domains, such as mathematics Islam et al. (2024), + +software development Qian et al. (2023); Hong et al. (2023), embodied task Mandi et al. (2024b) and social simulation Ziems et al. (2024); Pang et al. (2024); Li et al. (2024b). However, these systems Wu et al. (2023); Chen et al. (2023) heavily rely on manually designed workflows, which lack generalizability and the labor-intensive nature of manual design poses significant limitations. To address this issue, we propose a novel self-evolving paradigm, which allows agents to update and improve through external feedback, enabling dynamic adaptation and more advanced performance across varied tasks. + +Software development benchmarks. Software development benchmarks aim to evaluate models in the task of generating code from natural language descriptions Zheng et al. (2023). These benchmarks typically include task definitions and evaluation criteria. Existing benchmarks can be categorized into three types: i) function completion (HumanEval Chen et al. (2021), MBPP Austin et al. (2021), EvalPlus Liu et al. (2023), xCodeEval Khan et al. (2023)); ii) bug repair (SWE-bench Jimenez et al. (2023)); and iii) software generation (SRDD Qian et al. (2023), SoftwareDev Hong et al. (2023)). Function completion and bug repair benchmarks are confined to function-level task definitions, missing the diverse realistic software requirements. Software generation benchmarks often depend on expensive human evaluations or indirect similarity-based measurements, unable to automatically and accurately verify the requirement correctness. To address these limitations, we introduce rSDE-Bench, the first benchmark contains both diverse software requirements and automatic evaluation of requirement correctness. It can support the development of more realistic software-level coding capabilities. + +# 3 EVOMAC: SELF-EVOLVING MULTI-AGENT COLLABORATION NETWORK + +This section presents EvomAC, a novel self-evolving multi-agent collaboration network and its application to software development. The key feature of EvomAC is its ability to iteratively adapt both agents and their connections during test-time for each task, mimicking the back-propagation process, a core algorithm in neural network training. We first formulate a general self-evolving paradigm in Sec. 3.1 and then describe its application to software development in Sec. 3.2. + +# 3.1 A GENERAL SELF-EVOLVING PARADIGM VIA TEXTUAL BACK PROPAGATION + +Multi-agent collaboration network. A multi-agent collaboration (MAC) network is a computational graph representing agentic workflows, where multiple agents empowered by LLMs interact as interconnected nodes to coordinate and share information for complex task-solving. The intuition behind to divide the complex task into more specific and manageable subtasks for each agent, allowing the overall task to be gradually conquered through the agentic workflow. Mathematically, we represent a MAC network with $N$ autonomous agents as a directed acyclic graph $\mathcal{A} = (\mathcal{V},\mathcal{E})$ , where $\mathcal{V} = \{v_{i}\}_{i=1}^{N}$ is the set of $N$ nodes, and $\mathcal{E} = \{e_{i,j}\}_{i,j\in [1,\dots,N],i\neq j}$ is the set of directed edges with no circles. The $i$ -th node $v_{i}$ represents the $i$ -th autonomous agent with the prompt $p_{i}$ , which specifies its subtask. The edge $e_{i,j}$ represents the task dependency between the $i$ -th agent and the $j$ -th agent, indicating that the $j$ -th agent's subtask should be executed after the $i$ -th agent's subtask in the agentic workflow. The overall graph topology specifies the agentic workflow. Analogy to traditional neural networks, agents function similarly to neurons, with agent prompts serving as neurons' weights and the agentic workflow as the layers and connections. + +The feed-forward pass of MAC network is the execution of the agentic workflow. In this process, each agent is given two inputs: the initial task requirement and the output from the previous agent. Using these, each agent produces an output that fulfills its specific subtask. Eventually, the last agent's generation constitutes the final output, integrating all completed subtasks. Note that the initial task requirement is input to each agent as context, providing supplementary details to aid in the implementation of each subtask. + +Recently, various MAC networks have been designed using human expertise to assign fixed agent prompts and workflows Hong et al. (2023); Chan et al. (2024), resembling untrained neural networks. However, these designs solely rely on human priors and lack adaptability, causing limited performance improvement over a single agent. To overcome this, inspired by neural network training, we propose a self-evolving paradigm for multi-agent collaboration networks, enabling both agents and their connections to dynamically evolve during test-time for each given task. + +Optimization problem. Here we consider a general generation task. During test-time, given a task, the MAC network performs a feed-forward pass to generate the final output without knowing its + +![](images/b701b99b1aef116d195d5efaf68a579632496a71b8b99b77db610c3d90eed0d6.jpg) +Figure 1: The general self-evolving paradigm. + +![](images/4f2fd8286ace63dc9776770f893f435437a1f9f9d46ff79cf7563f333a80491d.jpg) + +![](images/555d2a3820cfc11d0d917049c5022e757ff1403e98656596b7eede415fff6fcb.jpg) + +quality. The key to evolution during test-time is to set up a target proxy for the MAC network to guide its improvements in the generated output. Here we consider this target proxy as the conditions for task completion, such as unit tests in coding, and we can produce such a target proxy by another group of autonomous agents based on the same task description. Then, the quality of each generated output can be verified according to the target proxy. This approach relies on two key assumptions: (i) generating a target proxy is significantly simpler than completing the original generation task, and (ii) the generated output can be correctly verified against the target proxy through an objective environment. These assumptions are practical in many applications. For example, in code generation, producing unit tests, the expected input-output pairs, is much easier than generating the entire code; meanwhile, a code compiler naturally acts as the objective environment to check the correctness of the generated code against the unit test, providing objective and informative feedback. + +Mathematically, let $\mathbf{X}$ be the textual description of a task. Given the MAC network $\mathcal{A}_g$ , the generated output is $\mathbf{G} = \Phi (\mathbf{X},\mathcal{A}_g)$ , where $\Phi (\cdot ,\cdot)$ is the general feed-forward operator that executes the agentic workflow, processing the input text through the MAC network. Similarly, the target proxy is $\mathbf{T} = \Phi (\mathbf{X},\mathcal{A}_t)$ , where $\mathcal{A}_t$ is another MAC network designed for producing the target proxy. Note that we aim to evolve and optimize $\mathcal{A}_g$ , while keep $\mathcal{A}_t$ predefined and fixed. The optimization of our self-evolution is formulated as, + +$$ +\mathcal {A} _ {g} ^ {*} = \min _ {\mathcal {A} _ {g}} \left\langle \Phi (\mathbf {X}, \mathcal {A} _ {g}), \mathbf {T} \right\rangle_ {E}, \text {s u b j e c t t o :} \mathbf {T} = \Phi (\mathbf {X}, \mathcal {A} _ {t}), \tag {1} +$$ + +where $\langle \cdot ,\cdot \rangle_{E}$ is an objective environment executor that receives the generated output and the target proxy as inputs and outputs a text-based environmental feedback. Akin to the loss function in traditional neural network training, which quantifies the difference between the generated output and the ground-truth, the objective in (1) evaluates whether the generated output meets the conditions of the task completion using the environment, subsequently producing execution reports as the text-based environmental feedback. Here the minimization operation min is defined to reduce the failures during execution. With the guidance of the target proxy and the objective feedback given by the environment, the MAC network can improve its success rate of task completion during test time. + +Note that, another straightforward way to enable the MAC network's evolution is through the self-critique strategy Zhou et al. (2024); Valmeekam et al. (2023); Xu et al. (2024); Asai et al. (2023), which employs a critique agent to assess the generated output directly. This approach has two inherent limitations: i) the critique may be subjective and biased, and ii) the critique agent can have hallucinations, causing inconsistencies and errors. These limitations can cause the MAC network to become entrenched in its own preferences or evolve in the wrong direction, especially iterating multiple times; see our experimental validations in Tab. 2. In comparison, our approach leverages an environment executor to provide objective feedback, preventing bias and hallucinations. + +While we use the analogy between our self-evolution process and neural network training for motivating, they are significantly different in three key aspects: (i) our self-evolution occurs at test time without a dedicated training phase; (ii) it evolves for each specific task individually rather than over a batch of samples; and (iii) the environmental feedback are usually texts, not be numerical values, which cannot be optimized by the standard backpropagation. This motivates us to propose our textual backpropagation. + +Solution based on textual backpropagation. The self-evolution solution iteratively updates the MAC network using a textual backpropagation algorithm, guided by the environmental feedback. The core idea is to analyze the influence of each agent in the MAC network $\mathcal{A}_g$ to the final environmental feedback and use these analyses to update the agent prompts and the agentic workflow in $\mathcal{A}_g$ . This + +![](images/0c973ffd94f11882f61d6277c9648d13ac6d636e097f5a254878fb79f492255d.jpg) +Figure 2: EvoMAC takes task requirements as input and iteratively updates the coding team to generate code that better fulfills the requirements. + +is achieved by two collaborative agents, each responsible for one of the two key steps: (i) textual gradient analysis and (ii) network update. The overall algorithm can refer to Alg. 1 in the appendix. + +First, the gradient agent takes the environmental feedback as the input and outputs textual gradients that describe the impact of each agent in the MAC network. Let $\mathcal{A}_g^{(k)}$ and $\mathbf{L}^{(k)}$ be the MAC network and the environment feedback at the $k$ -th iteration. The textual gradient is then $\nabla \mathbf{L}^{(k)} = \mathcal{G}(\mathcal{A}_g^{(k)}, \mathbf{L}^{(k)})$ , where $\mathcal{G}(\cdot, \cdot)$ is the gradient analysis operator managed by the gradient agent; see its prompt in Appendix. The textual gradient details three-fold information for each agent inside $\mathcal{A}_g^{(k)}$ : 1) whether this agent's subtask is fulfilled; 2) whether this agent introduces errors; and 3) whether any subtask is missed in the current MAC network. + +Second, based on the textual gradients, the updating agent iterates the MAC network as $\mathcal{A}_g^{(k + 1)} = \mathcal{U}(\mathcal{A}_g^{(k)},\nabla \mathbf{L}^{(k)})$ , where $\mathcal{U}(\cdot ,\cdot)$ is the updating operator managed by the updating agent. This operator guides the updates from three-folds: 1) removing the agents whose subtasks have been completed; 2) revising the erroneous agent's prompts by adding potential solutions provided in the gradient analysis; and 3) adding new agents for missing subtasks and restructuring the workflows based on the subtask dependencies noted in the gradient analysis; see the prompt details in Appendix. These adjustments address existing issues and fulfill unmet requirements in the current generation of the MAC network, promising improvements in the updated version. + +Note that, the key of the textual backpropagation is the prompt designs for both gradient analysis and network updates. The design must i) thoroughly evaluate the subtask of each agent in the MAC network according to the objective environment feedback and determine necessary adjustments to the MAC network to address existing issues, fulfilling the unmet requirements; and ii) maintain coherence, ensuring that issues identified by the gradient agent can be effectively resolved by the updating agent's modifications to the MAC network. + +# 3.2 SELF-EVOLUTION FOR SOFTWARE DEVELOPMENT + +In this section, we apply the self-evolving paradigm to the task of software development. The overall architecture of the proposed self-evolving multi-agent collaboration network for software development is illustrated in Fig. 1. Given a coding task, the coding team, corresponding to the MAC network $\mathcal{A}_g$ , generates all the codes through its forward-pass; the testing team, associated with the MAC network $\mathcal{A}_t$ , is responsible for creating the target proxy; that is, unit tests of the coding task; and the objective environment tool is realized through the compiler. The identified bugs during execution form the textual environmental feedback. The updating team, consisting of two collaborative agents, manages the textual backpropagation. By continuously cycling through feed-forward, feedback collection, and textual backpropagation processes, the coding team is iteratively refined to align more closely with the test cases. + +Since unit test generation is much easier than the original logical code generation, the testing team usually can produce high-quality test cases, which are closely aligned with the task requirements. + +![](images/114f99da73b75a349be60040e23dfd61a40b1e2e637e8c69e7f4f6611cc8db6c.jpg) +Figure 3: Comparison between instruction-oriented and requirement-oriented evaluations. rSDE-Bench accurately reflects requirement fulfillment with the proposed accuracy score of 2/13, while the indirection evaluation misjudges with high scores (0.89), failing to detect missing functionality. + +![](images/f4c6350b96aabb87cce273b631deae82ea90e02b6c94f1011be873ffab17e68e.jpg) + +![](images/e56b27b7b07ae5e33e6250f533e6922312a02142800f65c3bc5012e5174168df.jpg) + +Then, improving alignment with the unit tests through MAC network updates ensures better adherence to the actual task requirements. + +Coding team for feed-forward. In the feed-forward process, the coding team synthesizes code according to the given coding task. To handle the extensive software requirements, the coding team is implemented as a MAC network. It divides the comprehensive requirements into a sequence of smaller, more specific function implementation subtasks, and progressively conquers them through the agentic workflow. Unlike existing MAC systems that heuristically decompose coding tasks and define the agentic workflow, we initialize the MAC network using a novel self-organizing approach. A coding organizer agent automatically and flexibly decomposes the task requirements into subtasks and assembles the coding agent team accordingly. The number of coding agents is dynamic, adjusting in response to the task requirements. Note that, the quality of the generated code is unknown during the forward pass, which necessitates the self-evolving paradigm to iteratively refine the generation. + +Testing team and compiler for feedback collection. To verify whether the generated code meets the requirements of the coding task, we employ unit tests as the target proxy. These test cases consist of input-output pairs tailored to specific requirements. For example, a test case for a keyboard control requirement would detail the type of control as the input and describe the expected behavior as the output. To create flexible and comprehensive unit tests, we set up the testing team as a MAC network and also initialize it in a self-organized way. A testing organizer agent automatically decomposes our specified key testing criteria into subtasks and accordingly forms the testing agent team. + +Once the test cases and generated code are ready, they are executed in the compiler, which functions as the environmental tool, producing execution logs. These logs clearly point out the gap between the generated code and the test cases. It shows satisfied testing requirements, existing function errors, and unmet testing requirements. This feedback information can be used to verify whether each agent's subtask is accomplished and guide the MAC network update. + +Updating team for textual back-propagation. The updating team consists of two collaborative agents: the gradient agent and the updating agent, adjusting the MAC network based on the execution logs, including the agent prompts and workflows. This process consists of two steps. First, the gradient agent summarizes the textual gradient by identifying accomplished subtasks for satisfied requirements, appending new subtasks for unmet requirements, and analyzing errors to detail their originating agents and revising suggestions. Second, the updating agent modifies the coding agent team by removing agents that have completed their subtasks, adding new agents for the new subtasks, and revising agent prompts to address issues identified in the previous generation. The agent workflow is updated once the agent team is revised, based on the dependencies among the subtasks. + +# 4 RSDE-BENCH: REQUIREMENT-ORIENTED SOFTWARE DEVELOPMENT ENGINEERING BENCHMARK + +This section introduces rSDE-Bench, a requirement-oriented benchmark designed to assess the ability of models to handle software-level coding tasks. Each coding task involves multiple detailed software requirements. These requirements specify each functionality and constraint of the software, item by item, serving as measurable benchmarks for assessing the software's effectiveness. As shown in Fig. 3, unlike previous instruction-oriented approaches Qian et al. (2023); Hong et al. (2023) which + +rely on brief instructions as input, rSDE-Bench uses comprehensive software requirements as input, complemented by unit test cases to automatically evaluate the correctness. This benchmark provides software-level coding tasks and automatic evaluation, aligning more closely with real-world software development practices. + +# 4.1 BENCHMARK CONSTRUCTION + +rSDE-Bench involves two typical real-world software types: game and website. They can reflect different coding capacities demanded in realistic software development. Game often requires handling dynamic interactions, real-time state changes, and user-driven operations, focusing on elements like logic execution, initialization, and game state transitions. Website emphasizes static and dynamic content management, user interaction through forms and buttons, and ensuring page elements are displayed and functional. + +rSDE-Bench involves diverse requirements, each paired with a test case. Specifically, rSDE-Bench provides 53 unique coding tasks and 616 test cases. rSDE-Bench introduces two requirement difficulty levels, including basic and advanced, to reflect the varying complexity of real-world software development tasks. For details on the benchmark construction, software statistics, software requirements, and test case examples, see Sec. 7 in the Appendix. + +# 4.2 AUTOMATIC EVALUATION + +rSDE-Bench supports automatic evaluation of requirement correctness. It achieves this by pairing a specifically designed black-box test case with each requirement. The test case can directly verify whether the generated code achieved the requirement. Its evaluation metric is the accuracy, which quantifies the proportion of correctly passed test cases. It is similar to the pass@1 metric in HumanEval Chen et al. (2021), which evaluates the pass ratio of correctly achieved functions against the total functions via unit test verification. It is a fully automated evaluation process, eliminating the need for human involvement while still providing accurate and reliable assessments. + +Previous benchmarks for software code generation mainly rely on two evaluation methods. One method is human evaluation Hong et al. (2023), which is time-consuming and not scalable for large datasets. The other method is indirect evaluations Qian et al. (2023), which defines metrics like consistency, completeness, and quality. Consistency measures how closely the generated software aligns with the original requirement description by comparing the cosine similarity between the two. Completeness is determined by detecting the presence of placeholder (such as pass or Todo), which results in a binary value of 0 or 1. Quality is then calculated as the product of several factors: consistency, completeness, and executability. As illustrated in Fig. 3, they could not measure the correctness of the generated code in fulfilling requirements. In contrast, rSDE-Bench's test cases-based evaluation is more rigorous and precise. These test cases can accurately verify the correctness of generated code in fulfilling the requirements. rSDE-Bench promises reliable and scalable automatic evaluation. We have validated the significant advantages of the proposed automatic evaluation over the previous metrics, including consistency and quality; see Fig. 4. + +# 5 EXPERIMENTS + +# 5.1 EXPERIMENTAL SETUP + +Baselines. To validate the effectiveness of our EvoMAC, we conducted comparisons against both single-agent and multi-agent baselines. The single-agent baselines involve three prominent large models: GPT-4o-Mini (gpt-4o-mini), Claude-3.5-Sonnet (claude-3-5-sonnet-20240620), and Gemini (gemini-1.5-flash). For multi-agent baselines, we included five state-of-the-art (SOTA) methods: MetaGPT Hong et al. (2023), Autogen Wu et al. (2023), Mapcoder Islam et al. (2024), Agent-verse Chen et al. (2023), and ChatDev Qian et al. (2023). To ensure a fair comparison, all multi-agent baselines, including our EvoMAC, are powered by the efficient and powerful GPT-4o-Mini model. Additionally, to demonstrate the adaptability and robustness of our EvoMAC, we developed two EvoMAC variants using GPT-4o-Mini and Claude-3.5-Sonnet. + +Datasets. Our experiments cover both the proposed rSDE-Bench and the standard coding benchmark HumanEval Chen et al. (2021). HumanEval comprises 164 Python function completion problems, where the task is to generate code from a single function description. + +# 5.2 EFFECTIVENESS OF RSDE-BENCH'S EVALUATION AND EVOMAC + +rSDE-Bench's automatic evaluation metric (accuracy) is highly aligned with human evaluation. Our primary goal is to validate the effectiveness of the proposed automatic evaluation in rSDE-Bench + +![](images/cda56edcb35c0969f2a8ff76d43dde5b1ea6567ed1322c521928baeb9fb7fa53.jpg) +Figure 4: Performance of four methods in terms of four evaluation metrics, including human evaluation, our automatic evaluation (accuracy), consistency, and quality. WB/GB and WA/GA represent Web/Game Basic and Web/Game Advanced respectively. Our accuracy metric is highly aligned with human evaluation across four dataset settings. + +Table 1: Comparison of EvoMAC with five multi-agent and three single-agent SOTA baselines, all powered by GPT-4o-Mini. Red values represent the percentage improvement of EvoMAC, shade in pink, over the single-agent baselines, shade in grey. + +
MethodModelrSDE-BenchHumanEval (%) Pass@1
Website(%)Game(%)
BasicAdvancedBasicAdvanced
Single-AgentGemini-1.5-Flash29.79±1.0011.61±2.3421.74±6.396.45±6.9773.17
Claude-3.5-Sonnet58.90±1.4837.11±1.0644.20±5.4118.29±13.2689.02
GPT-4o-Mini62.90±2.5244.40±4.2142.76±15.5030.10±11.8788.41
Multi-AgentMetaGPT15.41±0.000.00±0.0016.67±2.710.00±0.0088.41
Autogen25.68±4.145.40±3.3417.39±1.780.00±0.0085.36
MapCoder34.70±1.5914.57±0.6629.71±6.727.52±6.1090.85
Agentverse15.41±0.000.00±0.0037.67±8.2016.13±4.5590.85
ChatDev62.67±0.2843.45±0.7753.63±5.7032.26±4.5570.73
EvoMAC89.38±1.01 +26.4865.05±1.56 +20.6577.54±2.04 +34.7851.60±4.54 +21.5094.51 +6.10
+ +by comparing it with two existing evaluation metrics: consistency and quality, both from SRDD Qian et al. (2023). For a fair comparison, our golden standard is human evaluation, conducted by two expert code engineers who manually verify the fulfillment of requirements by interacting with the developed software. This process is tedious, taking around four hours per expert to evaluate the entire benchmark. The effectiveness of an evaluation metric depends on how closely it aligns with human evaluation. + +Fig. 4 presents the performance of four methods in terms of four evaluation metrics, including human evaluation, our automatic evaluation, consistency, and quality. We see that: i) our automatic evaluation is highly aligned with human evaluation across two software types (Website and Game), four methods, (GPT-4o-Mini, MetaGPT, ChatDev, and our EvoMAC), and two requirement difficulties (Basic and Advanced). The correlation coefficient between human evaluation and our accuracy metric is 0.9922, demonstrating the effectiveness of the proposed automatic evaluation in rSDE-Bench; ii) Consistency and quality metrics differ significantly from human evaluation, with correlation coefficients of 0.2583 and 0.3041, respectively. This discrepancy occurs because consistency in SRDD measures similarity, and quality in SRDD focuses on executability, which does not guarantee that all requirements are met. This highlights the need for rSDE-Bench, as the SRDD benchmark does not support requirement-oriented software development. + +EvoMAC outperforms previous SOTAs on both software-level and function-level coding benchmarks: rSDE-Bench and HumanEval. Tab. 1 compares EvoMAC with five multi-agent and three single-agent SOTA baselines, all powered by GPT-4o-Mini for a fair comparison. We see that EvoMAC significantly outperforms previous SOTAs across all datasets. EvoMAC outperforms single-agent methods by $26.48\%$ on the rSDE-Bench Website Basic and $34.78\%$ on the rSDE-Bench Game Basic, as well as surpassing existing multi-agent methods by over $20\%$ . This highlights the effectiveness of multi-agent collaboration and the power of EvoMAC. + +# 5.3 EFFECTIVENESS OF EVOLVING + +Fig. 6 shows the accuracy of EvoMAC over multiple evolving iterations on the rSDE-Bench and HumanEval. Each figure presents two curves: one for EvoMAC powered by GPT-4o-Mini (red) and the other by Claude-3.5 (blue). We have the following findings: + +![](images/b184beb92dcda2ef1587baebd7766ce295ece75a63e8b656c469ba62d838c51b.jpg) +(a) Website + +![](images/0648c910b9e85fdfcea950392a070ca919ebbf8c436db0b459da70ac65df3933.jpg) +(b) Game + +![](images/4f31ea7a1cbefc7e252c6b31577d38c8f8703ab77df561d07670815f02298f40.jpg) +(c) HumanEval + +Table 2: Ablation study about coding/testing team with single/multi-agent, with/without evolving, and with/without environment tool. Best performances are bolded. + +
CodingTestingEvol.Env.Website(%)Game(%)
BasicAdvancedBasicAdvanced
a)Single---63.7041.7042.7630.10
b)Multi---67.4739.2768.1041.93
c)SingleSingle✓✓80.8260.3271.7341.93
d)MultiSingle✓✓83.9060.7276.0841.93
e)SingleMulti✓✓83.5661.9473.9145.16
f)MultiMulti✓-78.0852.2355.8033.32
g)MultiMulti✓✓90.7567.2077.5451.60
+ +![](images/d93f21ab819e518457f222162029644156c132007e96ceac9417e92369f565f2.jpg) +Figure 6: Effect of EvoMAC performance across evolving times empowered by GPT-4o-Mini and Claude-3.5-Sonnet on Website, Game, and HumanEval datasets. The figure shows EvoMAC continuously improves with the evolving times on both LLM drives. +Figure 5: Failure case distribution across evolving times on Website and Game. + +EvoMAC continuously improves with the evolving times. Fig. 6 shows that as evolving iterations increase, performance consistently improves across all five dataset settings, covering two difficulty levels, two software types, and both requirement-oriented and function complement benchmarks. This highlights the effectiveness, generalizability, and robustness of the self-evolving approach, encouraging EvoMAC to evolve whenever possible. + +EvoMAC indistinguishably improves with different driving LLM. From Fig. 6, we see that: i) both EvoMAC variants continuously improve with evolving iterations, demonstrating the robustness of the self-evolving design; ii) the two curves do not intersect, indicating that the EvoMAC variant powered by a more powerful single model consistently outperforms the other, highlighting the advantage of using a stronger model. Success builds on success. + +Failure case analysis. Fig. 5 shows the failure case statistics across iterations for Website and Game, showing a general decrease in errors as iterations progress. We see that: i) the most common errors are page display issues in Website and logic errors in Game; ii) page errors are resolved more quickly, while logic errors persist, suggesting that more isolated issues are easier to fix during the evolution process. This results in a sharp initial performance improvement as sipler problems are addressed early, followed by a plateau as more complex issues remain unresolved, shown in Fig. 6. + +# 5.4 ABLATION STUDY + +To assess the effectiveness of each component, Tab. 2 details an ablation study featuring seven EvoMAC variants. + +Effectiveness of objective environment feedback. Environment feedback, such as code execution logs, is essential for software development. Variant f) omits this tool, instead using an LLM-driven agent to critique the code. Comparing Variant g) with Variant f) shows a notable performance drop: Website tasks decrease by $12.67\%$ and $14.97\%$ , and Game tasks by $21.74\%$ and $18.28\%$ for Basic and Advanced levels, respectively. This underscores the importance of objective environmental feedback, as agent-driven critiques may introduce bias and fail to guide the evolution effectively. + +Effectiveness of multi-agent collaboration in coding team and testing team. Comparing Variant g) to Variant e), we observe a performance decrease of $7.19\%$ and $5.26\%$ on Website Basic and Advanced respectively, when the coding team is reduced to a single agent. Similarly, comparing Variant g) to Variant d), there is a performance drop of $6.85\%$ and $6.48\%$ on Website Basic and Advanced respectively, also when the team is reduced to a single agent. These results demonstrate + +![](images/2e047edf0c25a982ce47b3e72fb16fe4441b07bc6f984185f78fc4725d972918.jpg) +Figure 7: EvoMAC outperforms previous multi-agent and single-agent systems across all the context lengths across the four dataset settings on rSDE-Bench. + +![](images/d751fcac3d428fd8554a633261aaa0c976eaa9afcb7aac137f1a38a85420be9f.jpg) +GPT-4o-Mini ChatDev EvoMAC + +![](images/fe614fce0b60997e062dc5c72a39d535dd4c73eacf94891f77adfc1a1a51b6cb.jpg) + +![](images/2ce5d082b86d20dbeef25266b10484bc1b4f317f17bd9d525cd8ad2be890a858.jpg) + +![](images/d192b5946c0512f63b8825db3c90b407d73b1d88166271843f308223020947ef.jpg) + +![](images/ca393c3271d027daa7c8563e56638d7e09a227dbde5ee2b9de6bd9bf590da951.jpg) + +![](images/0f0e0e2ec5f52fc3ab73488d58a0285bd8bd0326f3946da8e58414cfd67380af.jpg) + +![](images/d05eb44491af05ace7579edf33835ed27aa96e82e3fe22291807365a47f39efa.jpg) + +![](images/27ed9d91b31d88e2e1384dff54a09ad190f097aca4c1be47eeee78f9bce406b1.jpg) +Figure 8: We show the generated code of single-agent, GPT-4o-Mini, and multi-agent systems, ChatDev, and our EvoMAC (iteration $=0/1$ ) given the Website task (RecipeHub). After evolving, EvoMAC can revise previous issues and fulfill the task requirement. + +![](images/f148dde8716928659f8dcf070e321c698ccfb6cd1aa72c939f4e39c71be13cdf.jpg) + +![](images/b0a683f04253ce1f80c512d8eabe843f253a305ba7ebda2a41344e3e504e52c7.jpg) + +the necessary for involving multi-agent collaboration, highlighting that multi-agent setups offer more flexible adjustments and enhanced capabilities for evolution. + +Effectiveness in handling varied task token lengths. Fig. 7 shows a comparison of task token lengths and performance across GPT-4o-Mini, ChatDev, and EvoMAC. We see that: i) EvoMAC consistently outperforms ChatDev and GPT-4o-Mini across all context lengths, with its self-evolving mechanism enabling the identification and correction of missed contexts and errors during iterations; ii) EvoMAC experiences less performance degradation on the rSDE-Bench Website than on the Game, as Website tasks are more modular and can be broken into subtasks, whereas Game tasks require more coordinated management, making them more challenging. + +# 5.5 CASE STUDY + +Fig. 8 presents the generated code by a single agent, GPT-4o-Mini, multi-agent systems, ChatDev, and our EvoMAC before and after evolving (iteration=0/1). We see that: i) EvoMAC after evolving can correct issues from previous iterations and successfully fulfill the task requirements; ii) multi-agent systems tend to better comprehend the task requirements and produce more well-structured code. More generated software can refer to Sec. 10 in the Appendix. + +# 6 CONCLUSION + +We propose EvoMAC, a novel self-evolving paradigm for MAC networks. EvoMAC iteratively adapts agents and their connections during the testing phase of each task. It achieves this with a novel textual back-propagation algorithm. EvoMAC can push coding capabilities beyond function-level tasks and into more complex, software-level development. Furthermore, we propose rSDE-Bench, a novel requirement-oriented software development benchmark. rSDE-Bench features both complex and diverse software requirements, as well as the automatic evaluation of requirement correctness. Comprehensive experiments validate that the automatic requirement-aware evaluation in rSDE-Bench aligns closely with human evaluation. EvoMAC outperforms previous SOTAs in both software-level rSDE-Bench and function-level HumanEval benchmarks. + +Future works. In the future, we plan to introduce a reward model to enhance the self-evolving paradigm's ability to learn from feedback and extend the rSDE-Bench to more software types. + +# REFERENCES + +Amazon. CodeWhisperer. In https://platform.qa.com/course/amazon-codewhisperer-generatingcode-ai-4679/introduction, 2022. URL https://platform.qa.com/course/amazon-codewhisperer-generating-code-ai-4679/introduction. +Akari Asai, Zeqiu Wu, Yizhong Wang, Avirup Sil, and Hannaneh Hajishirzi. Self-rag: Learning to retrieve, generate, and critique through self-reflection. ArXiv, abs/2310.11511, 2023. +Jacob Austin, Augustus Odena, Maxwell Nye, Maarten Bosma, Henryk Michalewski, David Dohan, Ellen Jiang, Carrie Cai, Michael Terry, Quoc Le, et al. Program synthesis with large language models. arXiv preprint arXiv:2108.07732, 2021. +Chi-Min Chan, Weize Chen, Yusheng Su, Jianxuan Yu, Wei Xue, Shanghang Zhang, Jie Fu, and Zhiyuan Liu. Chateval: Towards better llm-based evaluators through multi-agent debate. In The Twelfth International Conference on Learning Representations, 2024. +Mark Chen, Jerry Tworek, Heewoo Jun, Qiming Yuan, Henrique Ponde de Oliveira Pinto, Jared Kaplan, Harri Edwards, Yuri Burda, Nicholas Joseph, Greg Brockman, Alex Ray, Raul Puri, Gretchen Krueger, Michael Petrov, Heidy Khlaaf, Girish Sastry, Pamela Mishkin, Brooke Chan, Scott Gray, Nick Ryder, Mikhail Pavlov, Alethea Power, Lukasz Kaiser, Mohammad Bavarian, Clemens Winter, Philippe Tillet, Felipe Petroski Such, Dave Cummings, Matthias Plappert, Fotios Chantzis, Elizabeth Barnes, Ariel Herbert-Voss, William Hebgen Guss, Alex Nichol, Alex Paino, Nikolas Tezak, Jie Tang, Igor Babuschkin, Suchir Balaji, Shantanu Jain, William Saunders, Christopher Hesse, Andrew N. Carr, Jan Leike, Josh Achiam, Vedant Misra, Evan Morikawa, Alec Radford, Matthew Knight, Miles Brundage, Mira Murati, Katie Mayer, Peter Welinder, Bob McGrew, Dario Amodei, Sam McCandlish, Ilya Sutskever, and Wojciech Zaremba. Evaluating large language models trained on code. 2021. +Weize Chen, Yusheng Su, Jingwei Zuo, Cheng Yang, Chenfei Yuan, Chen Qian, Chi-Min Chan, Yujia Qin, Yaxi Lu, Ruobing Xie, et al. Agentverse: Facilitating multi-agent collaboration and exploring emergent behaviors in agents. arXiv preprint arXiv:2308.10848, 2(4):6, 2023. +Google. Codey. In https://console.cloud.google.com/vertex-ai/publishers/google/model-garden/codechat-bison, 2023. URL https://console.cloud.google.com/vertex-ai/publishers/google/ model-garden/codechat-bison. +Sirui Hong, Xiawu Zheng, Jonathan Chen, Yuheng Cheng, Jinlin Wang, Ceyao Zhang, Zili Wang, Steven Ka Shing Yau, Zijuan Lin, Liyang Zhou, et al. Metagpt: Meta programming for multi-agent collaborative framework. arXiv preprint arXiv:2308.00352, 2023. +Wenyue Hua, Lizhou Fan, Lingyao Li, Kai Mei, Jianchao Ji, Yingqiang Ge, Libby Hemphill, and Yongfeng Zhang. War and peace (waragent): Large language model-based multi-agent simulation of world wars. arXiv preprint arXiv:2311.17227, 2023. +Md. Ashraful Islam, Mohammed Eunus Ali, and Md Rizwan Parvez. Mapcoder: Multi-agent code generation for competitive problem solving, 2024. URL https://arxiv.org/abs/2405.11403. +Carlos E Jimenez, John Yang, Alexander Wettig, Shunyu Yao, Kexin Pei, Ofir Press, and Karthik R Narasimhan. Swe-bench: Can language models resolve real-world github issues? In The Twelfth International Conference on Learning Representations, 2023. +Mohammad Abdullah Matin Khan, M Saiful Bari, Xuan Long Do, Weishi Wang, Md Rizwan Parvez, and Shafiq Joty. xcodeeval: A large scale multilingual multitask benchmark for code understanding, generation, translation and retrieval, 2023. URL https://arxiv.org/abs/2303.03004. +Guohao Li, Hasan Abed Al Kader Hammoud, Hani Itani, Dmitrii Khizbullin, and Bernard Ghanem. Camel: Communicative agents for "mind" exploration of large language model society. In Thirty-seventh Conference on Neural Information Processing Systems, 2023. +Jiaqi Li, Mengmeng Wang, Zilong Zheng, and Muhan Zhang. Loogle: Can long-context language models understand long contexts?, 2024a. URL https://arxiv.org/abs/2311.04939. +Junkai Li, Siyu Wang, Meng Zhang, Weitao Li, Yunghwei Lai, Xinhui Kang, Weizhi Ma, and Yang Liu. Agent hospital: A simulacrum of hospital with evolvable medical agents, 2024b. URL https://arxiv.org/abs/2405.02957. + +Yujia Li, David Choi, Junyoung Chung, Nate Kushman, Julian Schrittwieser, Rémi Leblond, Tom, Eccles, James Keeling, Felix Gimeno, Agustin Dal Lago, Thomas Hubert, Peter Choy, Cyprien de, Masson d'Autume, Igor Babuschkin, Xinyun Chen, Po-Sen Huang, Johannes Welbl, Sven Gowal, Alexey, Cherepanov, James Molloy, Daniel Jaymin Mankowitz, Esme Sutherland Robson, Pushmeet Kohli, Nando de, Freitas, Koray Kavukcuoglu, and Oriol Vinyals. Competition-level code generation with alphabet. Science, 378:1092 - 1097, 2022a. +Yujia Li, David Choi, Junyoung Chung, Nate Kushman, Julian Schrittwieser, Rémi Leblond, Tom Eccles, James Keeling, Felix Gimeno, Agustin Dal Lago, Thomas Hubert, Peter Choy, Cyprien de Masson d'Autume, Igor Babuschkin, Xinyun Chen, Po-Sen Huang, Johannes Welbl, Sven Gowal, Alexey Cherepanov, James Molloy, Daniel J. Mankowitz, Esme Sutherland Robson, Pushmeet Kohli, Nando de Freitas, Koray Kavukcuoglu, and Oriol Vinyals. Competition-level code generation with alphabet. Science, 378(6624):1092-1097, December 2022b. ISSN 1095-9203. doi: 10.1126/science.abq1158. URL http://dx.doi.org/10.1126/science.abq1158. +Jiawei Liu, Chunqiu Steven Xia, Yuyao Wang, and LINGMING ZHANG. Is your code generated by chatGPT really correct? rigorous evaluation of large language models for code generation. In Thirty-seventh Conference on Neural Information Processing Systems, 2023. URL https://openreview.net/forum?id=1qvx610Cu7. +Zhao Mandi, Shreeya Jain, and Shuran Song. Roco: Dialectic multi-robot collaboration with large language models. In 2024 IEEE International Conference on Robotics and Automation (ICRA), pages 286-299. IEEE, 2024a. +Zhao Mandi, Shreeya Jain, and Shuran Song. Roco: Dialectic multi-robot collaboration with large language models. In 2024 IEEE International Conference on Robotics and Automation (ICRA), pages 286-299. IEEE, 2024b. +Microsoft. Copilot. In https://www.microsoft.com/en-us/microsoft-copilot/meet-copilot, 2023. URL https: //www.microsoft.com/en-us/microsoft-copilot/meet-copilot. +Anton Osika. GPT-Engineer. In https://github.com/AntonOsika/gpt-engineer, 2023. URL https://github.com/AntonOsika/gpt-engineer. +Xianghe Pang, Shuo Tang, Rui Ye, Yuxin Xiong, Bolun Zhang, Yanfeng Wang, and Siheng Chen. Self-alignment of large language models via monopolylogue-based social scene simulation. In *Forty-first International Conference on Machine Learning*, 2024. +Chen Qian, Wei Liu, Hongzhang Liu, Nuo Chen, Yufan Dang, Jiahao Li, Cheng Yang, Weize Chen, Yusheng Su, Xin Cong, Juyuan Xu, Dahai Li, Zhiyuan Liu, and Maosong Sun. Chatdev: Communicative agents for software development. arXiv preprint arXiv:2307.07924, 2023. URL https://arxiv.org/abs/2307.07924. +Karthik Valmeekam, Matthew Marquez, and Subbarao Kambhampati. Can large language models really improve by self-critiquing their own plans? ArXiv, abs/2310.08118, 2023. +Chonghua Wang, Haodong Duan, Songyang Zhang, Dahua Lin, and Kai Chen. Ada-level: Evaluating long-context lms with length-adaptable benchmarks, 2024a. +Xindi Wang, Mahsa Salmani, Parsa Omidi, Xiangyu Ren, Mehdi Rezagholizadeh, and Armaghan Eshaghi. Beyond the limits: A survey of techniques to extend the context length in large language models, 2024b. URL https://arxiv.org/abs/2402.02244. +Qingyun Wu, Gagan Bansal, Jieyu Zhang, Yiran Wu, Beibin Li, Erkang Zhu, Li Jiang, Xiaoyun Zhang, Shaokun Zhang, Jiale Liu, Ahmed Hassan Awadallah, Ryen W White, Doug Burger, and Chi Wang. Autogen: Enabling next-gen lmm applications via multi-agent conversation, 2023. URL https://arxiv.org/abs/2308.08155. +Yifan Xu, Xiao Liu, Xinghan Liu, Zhenyu Hou, Yueyan Li, Xiaohan Zhang, Zihan Wang, Aohan Zeng, Zhengxiao Du, Wenyi Zhao, Jie Tang, and Yuxiao Dong. Chatglm-math: Improving math problem-solving in large language models with a self-critique pipeline. ArXiv, 2024. +Yuzhuang Xu, Shuo Wang, Peng Li, Fuwen Luo, Xiaolong Wang, Weidong Liu, and Yang Liu. Exploring large language models for communication games: An empirical study on werewolf. arXiv preprint arXiv:2309.04658, 2023. +Guang Yang, Yu Zhou, Xiang Chen, and Xiangyu Zhang. Codescore-r: An automated robustness metric for assessing the functional correctness of code synthesis, 2024a. URL https://arxiv.org/abs/2406.06902. + +John Yang, Carlos E. Jimenez, Alexander Wettig, Kilian Lieret, Shunyu Yao, Karthik Narasimhan, and Ofir Press. Swe-agent: Agent-computer interfaces enable automated software engineering. ArXiv, abs/2405.15793, 2024b. +Zibin Zheng, Kai-Chun Ning, Jiachi Chen, Yanlin Wang, Wenqing Chen, Lianghong Guo, and Weicheng Wang. Towards an understanding of large language models in software engineering tasks. ArXiv, abs/2308.11396, 2023. +Wangchunshu Zhou, Yixin Ou, Shengwei Ding, Long Li, Jialong Wu, Tiannan Wang, Jiamin Chen, Shuai Wang, Xiaohua Xu, Ningyu Zhang, et al. Symbolic learning enables self-evolving agents. arXiv preprint arXiv:2406.18532, 2024. +Caleb Ziems, William Held, Omar Shaikh, Jiaao Chen, Zhehao Zhang, and Diyi Yang. Can large language models transform computational social science? Computational Linguistics, 50(1):237-291, 2024. + +# APPENDIX + +# 7 BENCHMARK DETAILS + +Table 3: Basic statistics for website and game domains, including the amount of samples, prompt length (mean/max), and number of test cases at both Basic and Advanced levels. + +
BenchmarkSoftwareTest Case
AmountLengthBasicAdvanced
Website451011/1553292247
Game8507/7884631
+ +![](images/b46de8760d88f6415c91cdf3021a0f33b24b3d40044e336a556d33e532a779bf.jpg) +Figure 9: Statistics of Game and Website tasks. + +# 7.1 FEATURES + +Challenging and diverse software requirements. rSDE-Bench features long-context software requirements (averaging 507/1011 words for game and website tasks, respectively), unlike instruction-oriented benchmarks Chen et al. (2021); Austin et al. (2021); Jimenez et al. (2023) that rely on brief prompts. These detailed requirements better reflect real-world lengthy and complex software development challenges. + +Requirement-aware precise and efficient evaluation. rSDE-Bench employs detailed software requirements and automated unit tests to precisely measure how well generated software meets its objectives. Generated codes are evaluated based on pass rates from running specific test cases, offering an accurate and efficient process. In contrast, instruction-oriented benchmarks rely on brief prompts, which lack constraints and make evaluation less reliable, often requiring labor-intensive or indirect evaluation. + +# 7.2 CONSTRUCTION PROCESS + +Step 1: Software requirement generation. Each task instance begins with the generation of clear, measurable software requirements. Given the inherent differences across various types of software, we adopt distinct approaches for their formulation. For game-related software, we focuses on common real-world games, capturing detailed task requirements such as GUI layout initialization, interaction methods, and game rules. To align more closely with actual game development practices, we also include game state logging as part of the software requirements. Due to the complexity of logic in game software, these requirements are manually crafted by human. In contrast, for website-related software, we begin with a concise website name, and then leverage the large language model (gpt-4o-mini) to enrich the requirements according to predefined patterns. This approach ensures both efficiency and scalability in the creation of benchmarks for websites. By tailoring the process to the distinct characteristics of each software domain, we maintain precision in requirement formulation while addressing the unique challenges posed by each context. + +# Step 2: Requirement-based test cases generation. + +As illustrated in Fig 10 and Fig 11, unit tests offer a precise evaluation of software completion. Each task instance includes black-box unit test cases that correspond directly to the software requirements, allowing for a quantitative assessment of requirement fulfillment. To further assess the model's code generation capabilities, we categorize test cases into two levels of difficulty—basic and advanced, as outlined in Tab. 3. We also provide an overview of all websites and games in Tab. 4 and Tab. 5 respectively. As shown in Fig. 9, test cases for website and game software exhibit structural differences, reflecting the distinct nature of each software type. They enable more targeted evaluation of code generation capabilities. Thus, similar to software requirements, the test cases are constructed differently based on the software type. For game-related tests, we manually create test cases, akin to the HumanEval Chen et al. (2021) benchmark, which tracks state changes in response to specific inputs. In the game environment, we assess how game states evolve in response to GUI interactions. For website-related tests, large language model (gpt-4o-mini) generates Selenium-based test cases aligned with the software requirements, followed by manual corrections to resolve any ambiguities. This structured approach ensures rigorous evaluation across diverse software domains. + +Table 4: Overview of Websites in rSDE-Bench. + +
Websites
CharitableGivingPlatformDailyHealthTipsDailyJournalApp
EcoFriendlyLivingTipsElderCareResourcesEventPlanner
FitnessEquipmentRentalFitnessTrackerFreelancerMarketplace
GreenLivingGuideHealthConsultationPlatformMotivationalQuotesApp
MusicFestivalDirectoryNoteTakingAppNutritionInformationHub
OnlineLibraryManagementSystemOnlineTherapeuticJournalingOnlineThriftStore
PeerTutoringNetworkPersonalBlogPersonalFinanceBlog
RecipeHubRemoteInternshipMarketplaceRemoteJobBoard
TravelDiaryVirtualBookPublishingVirtualWellnessRetreats
DigitalArtworkGalleryDigitalStorytellingPlatformExpenseTracker
FitnessChallengesGardeningForBeginnersGourmetFoodSubscription
MovieRecommendationSystemMusicCollaboratorOnlineCulturalExchange
OnlineCulturalFestivalsOnlineVintageMarketParentingAdviceForum
PetCareCommunityPortfolioSiteSkillShare
TaskManagerVolunteerMatchOnlineShoppingCenter
+ +Table 5: Overview of Games in rSDE-Bench. + +
Games
BallsTankRacingGhostly
MarioBombermanSokobanBrick
+ +Basic and advanced requirements definition. The basics reflect the fundamental and more achievable requirements, such as interaction, control, and logging. The advanced reflects more complex software functionalities, such as game logical rules, and dynamic web content management. For the games, basic requirements involve straightforward user interactions that do not require complex logic, such as character movement or interacting with simple GUI elements. Advanced requirements incorporate more intricate logic, such as managing game state transitions based on user actions or handling conditional game events. These cases focus on ensuring the correct execution of basic actions. In contrast, advanced cases incorporate more intricate logic, such as managing game state transitions based on user actions or handling conditional game events. These cases challenge the model's ability to generate code that integrates dynamic decision-making and interaction within the game environment. For websites, basic cases focus on ensuring that the necessary page elements—such as input fields, buttons, and layouts—are present correctly. These cases assess the completeness of the webpage's structure. On the other hand, advanced cases evaluate more complex functionality, such as handling user authentication, managing dynamic content, or executing specific operations within a content management system. These cases require the model to generate code that performs backend logic and manages user interactions at a deeper level. + +# 8 ALGORITHM + +In this section, we present the algorithm of EvoMAC in Alg. 1. For more details, please refer to Section 3. + +# 9 CASE STUDY + +# 9.1 COMPLETE EVOMAC PROCESS + +In this section, we show a complete process of EvoMAC on RSD-Bench. Please refer to Tab. 6. + +Software description +```txt +Task: Develop a simple Sokoban game. You must design a GUI. Requirements: +1. The game board should be divided into grid squares. +2. Players will control the game using the arrow keys on the keyboard. +3. As the game starts, a log file named 'game.log' should be created to record the game's progress. The content of the game.log file should be appended with a new entry after each player action.The content of the game.log file should be cleared (if any) at the start of each game session. +Each log entry should follow this format: +{ "timestamp": timestamp, "EVENT_TYPE": "MOVE_RIGHT" | "MOVE_LEFT" | "MOVE_UP" | "MOVE_DOWN" | "INVALID_MOVE", player_position": [x,y], "box_positions": [[x1,y1],[x2,y2],..], "game_status": "ONGOING" | "COMPLETE" } +4. The victory conditions for the game is: All boxes are pushed onto their corresponding coordinate point. +5. The initial positions of each element are required as follows: player_position $= [1,1]$ boxPositions $\equiv$ [(3,3],[4,2]] goalPositions $\equiv$ [(5,5],[6,3]] ([3, 3] is the initial position of the first box whose target position is [5, 5]. [4, 2] is the initial position of the second box whose target position is [6, 3].) wallPositions $= [0,4],[1,4],[2,4],[3,4],[4,4]$ (the first number in each pair is the x-coordinate and the second number is the y-coordinate) +``` + +Evaluation functions +```txt +check_Excutability check_log check_move_right check_move_left check_move_box check_move_WALL check_se胶囊 check_end check WRONG end +``` + +Figure 10: Test cases of Game in rSDE-Bench. + +Software description +```markdown +# Requirement Document for DailyHealthTips Web Application +## 1. Objective +Develop a web application named 'DailyHealthTips' that provides users with daily health tips, allowing them to receive advice and information about maintaining a healthy lifestyle, using Python as the development language. Note that the website should start from the login page. +## 2. Language +The required development language for the DailyHealthTips web application is Python. +## 3. Page Design +## Page 1: Login Page +- **Page Title**: User Login +- **Overview**: This page allows users to log in to their accounts. +- **Elements**: +- **Username Field**: +- **ID**: `username_field` +- **Password Field**: +- **ID**: `password_field` +- **Login Button**: +- **ID**: `login_button` +``` + +Evaluation functions +```txt +test_login_page_elements test_login_page_functionality test_dallytips_page_elements test_dallytips_page_functionality testtips_archive_page_elements testtips_archive_page_functionality +``` + +Figure 11: Test cases of Website in rSDE-Bench. + +# 9.2 UNIT TEST CASE + +In this section, we show more unit test cases written by coder on RSD-Bench, please refer to Tab. 13 and Tab. 16. + +# 9.3 UPDATING PROCESS + +In this section, we show additional examples of the updating process on RSD-Bench and HumanEval dataset. Please refer to Tab. 19 and Tab. 22 respectively. For RSD-Bench, due to the code length, we only show the texture updating process (codes are available at Sec. 9.1). We can see that the updating agent will adjust the job of each coder dynamically according to the result of test team. + +Algorithm 1 Self-Evolving Paradigm +Require: X $\triangleright$ Task input +Require: $\mathcal{A}_g^{(0)}$ Initialized MAC network: agent prompts and pipeline +Require: $\mathcal{A}_t$ Designed MAC network to generate target proxy +Require: G Agent-based gradient function +Require: U Agent-based update function +Require: $E$ Environment tool to generate loss 1: Define $K$ as the number of self-evolving iterations, $\Phi$ as MACN generation process +2: # Target Proxy +3: $\mathbf{T} = \Phi (\mathbf{X},\mathcal{A}_t)$ +4: # Self-Evolving Procedure +5: for $k = 0,1,\dots ,K - 1$ do +6: # Forward Pass +7: $\mathbf{G}^{(k)} = \Phi (\mathbf{X},\mathcal{A}_{g}^{(k)})$ +8: # Loss Computation +9: $\mathbf{L}^{(k)} = \langle \mathbf{G}^{(k)},\mathbf{T}\rangle_{E}$ Use environment feedback as textual loss +10: # Textual Backpropagation +11: $\nabla \mathbf{L}^{(k)} = \mathcal{G}(\mathbf{L}^{(k)},\mathcal{A}_{g}^{(k)})$ Summarize textual gradient +12: $\mathcal{A}_g^{(k + 1)} = \mathcal{U}(\mathcal{A}_g^{(k)},\nabla \mathbf{L}^{(k)})$ Update agent prompts and pipeline +13: end for +14: return $\mathcal{A}_g^{(K)},\mathbf{G}^{(K)}$ + +# 10 SOFTWARE PRESENTATION + +In this section, we show some games and websites written by EvoMAC. Fig. 12 and Fig. 13 present the games and websites respectively. We see that: i) EvoMAC outputs games with well-written GUI and game rules. It can handle different kinds of GUI and game rule requirements from diverse games. ii) EvoMAC outputs websites with beautified, user-friendly web pages and correct transition logic. It can handle the requirements of different websites. + +Table 6: A complete iteration process of EvoMAC on RSD-Bench + +
NotationMeaningExampleReal example
XTextual description of the task to be completed.A coding task such as: "Implementation a code that simulates keyboard input processing via Python."See Tab. 7
AgMAC network representing the team responsible for generating the code.The coding team consists of coding agents completing subtasks in sequence.See Tab. 8
G = Φ(X, Ag)Generated output produced by the coding team as a result of the feed-forward pass.The generated code: "...def process_input(keyboard_input): ..."See Tab. 9
AtMAC network representing the team responsible for generating the target proxy (unit tests).The testing team generates unit tests for the task.See Tab. 10
T = Φ(X, At)Target proxy (unit tests) generated by the testing team based on the task description.Unit tests like: "...def test_press_input(): assert process_input('Enter') == 'Processed Enter'See Tab. 11
< G, T >EEnvironmental feedback comparing the generated output G with the target proxy T using an objective environment (e.g., compiler or test results).The environment executes the generated code against the unit tests, providing feedback like: 'Failure: test_press_input'The execution outcome of the unit test from the terminal. If the execution is successful, the outcome is 'The software run successfully without errors.'
min < G, T >EThe optimization objective aiming to minimize the difference between the generated output and the target proxy using the environmental feedback.Based on feedback, the system iteratively refines the coding team to generate code that better meets the task.See Tab. 12
+ +Table 7: Textual description of the task to be completed. + +Task: Design a Single-Player Tank Battle Game + +Requirements: + +1. The interface should be divided into a $20 \times 20$ grid, though grid lines are not necessary. Each tank occupies one grid space, while obstacles may occupy multiple grid spaces. The background should be black, obstacles should be brown, enemy tanks should be silver, and the player's tank should be yellow. +2. The player can control the tank's movement using the arrow keys on the keyboard, allowing for movement one grid space at a time. The 'enter' key is used to fire bullets. +3. In the game, there are two enemies fixed at a certain position on the game interface, constantly firing bullets in four directions: up, down, left, and right. Two enemies and players cannot be initialized in the same row. +4. Both the player and the enemies have their own health points, which are initialized to 200. When hit by a bullet, the player's health decreases by 10 and the enemy's health decreases by 100. When health points drop to zero, the corresponding tank is destroyed. But the log still records information about the destroyed tank, with health points of 0. +5. Destroying an enemy tank earns the player 200 points. The game ends when the player's tank is destroyed or all enemy tanks are destroyed, at which point the player's score will be displayed on the screen. +6. As the game start, a new log file named 'game.log' should be created to record the game's progress. The first log entry should capture the initial state of the game. Each time a new event occurs to the player, a new log entry should be written in real-time. The logs should follow the format below. The EVENT_TYPE can only be one of the following: "INIT", "MOVE_LEFT", "MOVE_RIGHT", "MOVE_UP", "MOVE_DOWN", "FIRE" or "INJURED". The game_state should capture the current state of the game. In this setup, the position coordinates are defined with the top-left grid as $[0, 0]$ , where the x-coordinate increases by one unit for each grid space moved to the right, and the y-coordinate increases by one unit for each grid space moved downward. The player is initialized at position $[0, 0]$ . + +```json +{ + "timestamp": timestamp, + "EVENT_TYPE": "INIT" | "MOVE_LEFT" | "MOVE_RIGHT" | "MOVE_UP" + | "MOVE_DOWN" | "FIRE" | "INJURED", + "game_state": { + "player": { + "position": [xp, yp], + "health": health_player, + "score": score + }, + "enemies": [ + "position": [xel, yel], + "health": health_enemy1 + ], + "position": [xe2, ye2], + "health": health_enemy2 + ] + ], + "obstacle_position": [(xol, yol), ..., (xon, yon)] +} +``` + +Table 8: MAC network representing the team responsible for generating the code. +```json +{ "composition": { "Programmer 1": "Implement bullet firing logic that decreases health points for both the player and enemies when hit. This includes creating a function to handle bullet movement and collision detection, updating health points accordingly, and logging the events in the game.log file.", "Programmer 2": "Implement health management to check for health points dropping to zero and handle tank destruction. This includes creating a function to check health status after each hit, updating the game state, and logging the destruction event in the game.log file.", "Programmer 3": "Implement scoring logic to update the player's score when an enemy tank is destroyed and display the final score when the game ends. This includes creating a function to manage scoring and game-over conditions, and logging the final score in the game.log file." }, "workflow": { "Programmer 1": [], "Programmer 2": [ "Programmer 1"] ], "Programmer 3": [ "Programmer 2"] } } +``` + +Table 9: Generated output produced by the coding team as a result of the feed-forward pass. Due to the limit of page length, we only show partial of the codes. +```python +... +This is the main file for the Single-Player Tank Battle Game. +It initializes the game, sets up the GUI, and manages the game loop, including player movement, enemy behavior, and logging events. +... +import pygame +import json +import time +# Constants +GRID_SIZE = 20 +CELL_SIZE = 30 +WINDOW_SIZE = GRID_SIZE * CELL_SIZE +PLAYER_COLOR = (255, 255, 0) # Yellow +ENEMY_COLOR = (192, 192, 192) # Silver +OBSTACLE_COLOR = (139, 69, 19) # Brown +BACKGROUND_COLOR = (0, 0, 0) # Black +FPS = 60 +# Game state +player_position = [0, 0] +player_health = 200 +player_score = 0 +enemies = { + {"position": [5, 5], "health": 200}, + {"position": [10, 10], "health": 200} +} +obstacles = [(3, 3), (7, 7), (12, 12)] +# Log file +log_file = open('game.log', 'w') +initial_state = { + "timestamp": time.time(), + "EVENT_TYPE": "INIT", + "game_state": { + "player": { + "position": player_position, + "health": player_health, + "score": player_score, + }, + "enemies": enemies, + "obstacle_position": obstacles + } +} +log_file.write_json dumps(initial_state) + '\n') +# Initialize Pygame +pygame.init() +screen = pygame.display.set_mode((WINDOW_SIZE, WINDOW_SIZE)) +pygame.display.set_caption("Tank Battle Game") +clock = pygame.time.Clock() +class Bullet: + ... + This class represents a bullet fired by the player. +... +def __init__(self, position, direction): + self.position = position + self.position = direction +def move(self): + if self.position == 'UP': + self.position[1] -= 1 + elif self.position == 'DOWN': + self.position[1] += 1 + elif self.position == 'LEFT': + self.position[0] -= 1 + elif self.position == 'RIGHT': + self.position[0] += 1 +``` + +Table 10: MAC network representing the team responsible for generating the target proxy (unit tests). +```jsonl +{ "composition": { "Programmer 1": "Carefully test the logging mechanism according to the task requirements. Ensure that logs happen immediately after an action is taken, recording the most recent state. Verify the logging order, ensuring basic operations are recorded first, followed by subsequent events. Check that the data format, keys, and values are accurate, paying attention to the nested data types and carefully checking each element.", "Programmer 2": "Test the logging mechanism for special triggered conditions, such as when the player's health drops to zero or when an enemy tank is destroyed. Ensure that these events are logged correctly and that the game state reflects the changes accurately.", "Programmer 3": "Test the value initialization required by the task to ensure they are correctly achieved. Pay attention to the coordinates of the player and enemies, ensuring they are initialized in the correct positions and that no two tanks occupy the same row.", "Programmer 4": "Test the function inputs and the global variables imported in each function. Ensure that the input values and global variables used in the functions are valid and involved when the function is called.", "Programmer 5": "Test that each event in the task is implemented correctly and that the logic triggered matches the conditions described in the task. This includes movement, firing bullets, and health reduction for both the player and enemy tanks." }, "workflow": { "Programmer 1": [], "Programmer 2": [ "Programmer 1"] ], "Programmer 3": [ "Programmer 1", "Programmer 2"] ], "Programmer 4": [ "Programmer 1", "Programmer 2", "Programmer 3"] ], "Programmer 5": [ "Programmer 1", "Programmer 2", "Programmer 3", "Programmer 4"] } } +``` + +Table 11: Target proxy (unit tests) generated by the testing team based on the task description. Due to the limit of page length, we only show one test case written by one of the five test coders. +```python +import unittest +import json +import time +from main import player_position,player_health,player_score, enemies,log_file,log_event,fire_bullet,check_health class TestTankBattleGame(unittest.TestCase): def setUp(self): global player_position,player_health,player_score,enemies player_position $= [0,0]$ player_health $= 200$ player_score $= 0$ enemies $\equiv$ {"position":[5,5],"health":200},{"position":[10,10],"health":200} ] log_file $\equiv$ open('game.log','w') +def tearDown(self): log_file.close() +def test_move_left(self): global player_position player_position[O] $= 1$ #Move to the right first log_event("MOVE_LEFT") player_position[O] $- = 1$ self assertEqual(player_position,[O,O]) +def test_move_right(self): global player_position log_event("MOVE_RIGHT") player_position[O] $+ = 1$ self assertEqual(player_position,[1,O]) +def test_move_up(self): global player_position player_position[1] $= 1$ #Move down first log_event("MOVE_UP") player_position[1] $- = 1$ self assertEqual(player_position,[O,O]) +def test_move_down(self): global player_position log_event("MOVE_DOWN") player_position[1] $+ = 1$ self assertEqual(player_position,[O,1]) +def test-fire Bullet_hit Enemy (self): global player_score initial_health $\equiv$ enemies[O]["health"] fire_bullet() self assertEqual(enemies[O]["health"],initial_health-100) self assertEqual(player_score,200) +def test-fireBullet_miss Enemy (self): global player_position player_position $= [0,0]$ fire_bullet() self assertEqual(enemies[O]["health"],200) +def test_player_injury(self): global player_health player_health $- = 10$ log_event("INJURED") check_health() self assertEqual(player_health,190) +def test Enemy_destruction(self): global enemies enemies[O]["health"] $= 0$ check_health() self assertEqual(enemies[O]["health"],0) if_name $\equiv$ 'main': unittest.main() 23 +``` + +Table 12: The optimization objective aiming to minimize the difference between the generated output and the target proxy using the environmental feedback. According to the unit test results, Updating agent add more notes for the sub-task for Programmer 2 and Programmer 3. To see a complete updating process, please refer to Sec. 9.3 + +```jsonl +{ "composition": { "Programmer 1": "Implement bullet firing logic that decreases health points for both the player and enemies when hit. This includes creating a function to handle bullet movement and collision detection, updating health points accordingly, and logging the events in the game.log file.", "Programmer 2": "Implement health management to check for health points dropping to zero and handle tank destruction. This includes creating a function to check health status after each hit, updating the game state, and logging the destruction event in the game.log file. Additionally, ensure the game loop terminates properly when the player's tank is destroyed.", "Programmer 3": "Implement scoring logic to update the player's score when an enemy tank is destroyed and display the final score when the game ends. This includes creating a function to manage scoring and game-over conditions, and logging the final score in the game.log file. Ensure the final score is displayed correctly when the game ends." }, "workflow": { "Programmer 1": [], "Programmer 2": [ "Programmer 1"] ], "Programmer 3": [ "Programmer 2"] } } +``` + +Table 13: Unit test case: Game + +
Example 1Game Ghostly
Requirement(partial)3. If the ghost controlled by the player eats a superpellet (the big pellets), it gains the ability to eat other ghosts.
Subtask given by Test Organizer(partial)"Programmer 5": "Test that each event in the task is implemented and that the logic triggered matches the conditions in the task description."
Generated test case(partial)please see Tab. 14
Evaluation test case(partial)please see Tab. 15
+ +Table 14: The partial generated test case for Game Ghostly. +```python +def test_eat_other_ghost(self): + main(superpellet.active = True # Activate superpellet + main.move_ghost("up") # Move to [1, 0] + # more move_ghost function call omitted here + with open('game.log', 'r') as log_file: + logs = log_file.readlines() + last_log = json.dumps(logs[-1]) + self.assertEqual(last_log["event_type"], "eat_other_ghost") + self.assertEqual(last_log["ghost_position"], [6, 5]) + self.assertNotIn([0, 5], main.other_ghost_positions) +``` + +Table 15: The partial evaluation test case for Game Ghostly. +```python +def check_eat_other(self): # Check if Character can eat others with superpellet try: print("===Test eat other===") process $=$ self.start_game() time.sleep(0.1) pg.press('right',presses=1,interval=0) time.sleep(0.1) # more press omitted here processtermination() print("terminated") # Read the log logs $=$ self.read_log() print(logs) cnt $= 0$ for log in logs: if log["event_type"] $= =$ "eat_other_ghost": cnt $+ = 1$ if cnt $= = 2$ : print("Character can eat other with superpellet\n\nreturn 1 print("Character can eat other with superpellet\n\n") return 0 except: print("eat_other error") return 0 +``` + +Table 16: Unit test case: Website + +
Example 2Website DailyHealthTips
Requirement(partial)please see Fig. 11
Subtask given by Test Organizer(partial)"Programmer 2": "Test whether the first page of the website is the login page and whether it can log in correctly based on the example data provided in the Task."
Generated test case(partial)please see Tab. 17
Evaluation test case(partial)please see Tab. 18
+ +Table 17: The partial generated test case for Website DailyHealthTips. +```python +``` +Test whether the first page of the website is the login page and whether it can log in correctly based on the example data provided in the Task. +``` +import unittest +from selenium import webdriver +from selenium.webdriver.Common.by import By +from selenium.webdriver.common.keys import Keys +import time +class TestDailyHealthTipsLogin(unittest.TestCase): + def setUp(self): + self.driver = webdriverChrome() + self.driver.get("http://localhost:5000") + def test_login_page(self): + driver = self.driver + # Check if the current page is the login page + self.assertIn("User Login", driver.title) + print("Login page title is correct.") + # Locate username and password fields + username_field = driver.find_element(By.ID, "username_field") + password_field = driver.find_element(By.ID, "password_field") + login_button = driver.find_element(By.ID, "login_button") + #Input example data + username_field.send_keys("john_doe") + password_field.send_keys("securepassword") + login_button.click() + #Wait for the page to load + time.sleep(2) + #Check if redirected to Daily Health Tips page + self.assertIn("Daily Health Tips", driver.title) + print("Successfully logged in and redirected to Daily Health Tips page.") + def tearDown(self): + self.driver.quit() + if __name__ == __main__: + unittest.main() +``` + +Table 18: The partial evaluation test case for Website DailyHealthTips. +```python +class TestCase(unittest.TestCase): + def setUp(self): + """Set up the Selenium WebDriver before each test." + self.driver = webdriverchrome() + self.driver.get("http://localhost:5000") + def tearDown(self): + """Tear down the WebDriver after each test." + self.driver.quit() + def login(self): + self.driver.delete_all_cookie() + username = "john_doe" + password = "securepassword" + # Performing login + self.driver.get("http://localhost:5000") + self.driver.find_element(By.ID, "username_field") + .send_keys(keyname) + self.driver.find_element(By.ID, "password_field") + .send_keys(keyname) + self.driver.find_element(By.ID, "login_button").click() + #=== Login Page Tests === + def test_login_page_elements(self): + #Go back to the login page and check elements + self.assertTrue(self.driver.find_element(By.ID, 'username_field').is_displayed()) + self.assertTrue(self.driver.find_element(By.ID, 'password_field').is_displayed()) + self.assertTrue(self.driver.find_element(By.ID, 'login_button').is_displayed()) + def test_login_page_functionality(self): + #Assume user login is verified by the presence + of daily tips page elements + self.assertIn("User Login", self.driver.title) + username = "john_doe" + password = "securepassword" + self.driver.find_element(By.ID, 'username_field') + .send_keys(keyname) + self.driver.find_element(By.ID, 'password_field') + .send_keys(keyname) + self.driver.find_element(By.ID, 'login_button').click() + #Check if we are redirected to the daily tips page + self.assertIn("Daily Health Tips", self.driver.title) + #more test case omitted +``` + +Table 19: Updating process on RSD-Bench + +
RSD-Bench Game TankExample
Requirement(partial)please see Tab. 7
Initial Code Organizer(iteration 0)please see Tab. 8
Updating agent(iteration 1)please see Tab. 12
Updating agent(iteration 2)please see Tab. 20
Updating agent(iteration 3)please see Tab. 21
+ +Table 20: Updating process on RSD-Bench Game Tank, iteration 2 +```json +{ "composition": { "Programmer 1": "Fix the health management logic to ensure that when the player's health drops to zero, the destruction event is logged correctly, and the game loop terminates properly. This includes modifying the `check_health` function to accurately log destruction events for both the player and enemies.", "Programmer 2": "Implement the game-over conditions to ensure that the game ends when the player's tank is destroyed or all enemy tanks are destroyed. This includes creating a function to manage the game-over state and logging the final score in the game.log file." }, "workflow": { "Programmer 1": [], "Programmer 2": [ "Programmer 1"] } } +``` + +Table 21: Updating process on RSD-Bench Game Tank, iteration 3 +```txt +{ "composition": { "Programmer 1": "Implement constant firing behavior for enemy tanks in four directions. This includes creating a mechanism for enemies to fire bullets at the player and logging the corresponding events.", "Programmer 2": "Implement the display of the player's score at the end of the game when the game is over. This includes modifying the game-over logic to ensure the final score is logged and displayed correctly.", "Programmer 3": "Fix the logging mechanism to ensure that the log file remains open during gameplay and logs events in real-time without closing prematurely. This includes reviewing the log_event function and ensuring it is called correctly throughout the game loop." }, "workflow": { "Programmer 1": [], "Programmer 2": [ "Programmer 1"] ], "Programmer 3": [ "Programmer 1", "Programmer 2"] } } +``` + +Table 22: Updating process on HumanEval + +
HumanEvalExample
RequirementWrite a function that takes a message, and encodes in such a way that it swaps case of all letters, replaces all vowels in the message with the letter that appears 2 places ahead of that vowel in the english alphabet. Assume only letters.
Initial Code Organizer(iteration 0)"Programmer 1": "Identify and implement the logic to swap the case of all letters in the message"." , "Programmer 2": "Implement the logic to replace all vowels with the letter that appears 2 places ahead in the English alphabet."
Generated test case(iteration 0)please see Tab. 23
Main code(iteration 0)please see Tab. 24
Updating agent(iteration 1)"Programmer 1": AssertionError: encode('test') != 'TGST'. The actual output is: 'TgST', "Programmer 2": AssertionError: encode('This is a message') != 'tHKS KS C MGSSCGG'. The actual output is: 'tHkS kS c MgSScGg'.
Final code(iteration 1)please see Tab. 25
+ +Table 23: Updating process on HumanEval, Generated test case. iteration 0 + +```python +``` +Write a simple test case to verify the logic of the encode function. +``` +import unittest +from encode_function import encode +class TestEncodeFunction(unittest.TestCase): + def test_example(case_1(self): + self.assertEqual-encoded('test'), 'TGST') + def test_example(case_2(self): + self.assertEqual-encoded('This is a message'), + 'tHKS KS C MGSSCGG') +if __name__ == '__main__( )': + unitittest.main() +``` + +Table 24: Updating process on HumanEval, Main code, iteration 0 +```python +def encode(message): + vowels = 'aeiouAEIOU' + encoded_message = [] + for char in message: + if char.isalpha(): + # Swap case + if char in vowels: + # Replace vowel with the letter 2 places ahead + if char.islower(): + new_char = chr((ord(char) - ord('a') + 2) % 26) + + ord('a')) + else: + new_char = chr((ord(char) - ord('A') + 2) % 26) + + ord('A')) + encoded_message.append(new_char) + else: + # Just swap case for consonants + encoded_message.append(char.swapcase()) + else: + # If it's not a letter, we can just append it as is + encoded_message.append(char) + return False. join(encrypted_message) +``` + +Table 25: Updating process on HumanEval, Final code, iteration 1 +```python +def encode(message): + vowels = 'aeiouAEIOU' + encoded_message = [] + for char in message: + if char.isalpha(): + # Swap case + if char in vowels: + # Replace vowel with the letter 2 places ahead + and swap case + if char.islower(): + new_char = chr((ord(char) - ord('a') + 2) % 26) + + ord('a')).upper() + else: + new_char = chr((ord(char) - ord('A') + 2) % 26) + + ord('A')).lower() + encoded_message.append(new_char) + else: + # Just swap case for consonants + encoded_message.append(char.swapcase()) + else: + # Preserve spaces + encoded_message.append(char) + return False. join(encrypted_message) +``` + +![](images/e9c2a08fe1342bbdd3834e27f99256400652a4eeb951cfe37bba6860f3a44c7d.jpg) +(a) Balls + +![](images/1cefbeee3c82cf98156eeb21a49ed82b4f95cd3404c98b20ddceae7846a36014.jpg) +(b) Bomberman + +![](images/fcede5808ff3e6d102f80704a9990ac08695ad590a8f1f45be8eb150022630ff.jpg) +(c) Mario + +![](images/273fff76683e03fcff03af9e783d6a7ee272565bd0d9329472891c30a8ccad32.jpg) +(d) Tank + +![](images/ebb2e7ec20543004398dfd4e962006e9c89d49a623ce1325224a827d252592bd.jpg) +(e) Brick + +![](images/7cc39da90a751b578338c275d68b49dc3ad63b98a389fd6710db6975a788bd46.jpg) +(f) Ghostly + +![](images/63d9ffcb4a322cfa86e6e7fe7fa133125d6cc58fa2bda181ca3a4a895ab1dec0.jpg) +(g) Racing + +![](images/cc844afb36694c4362db0e4640811568c2c05203d2ae9941451846f9211f5b10.jpg) +(h) Sokoban + +![](images/14cf453fa6b2f5ba4c58a7de81b2078b220faf5b707efcb5ea3ee9752ee6d1ea.jpg) + +![](images/729d17bdde5e14c31c6c43918c22fbd8113ea421a265de0b5664510d3f06fc80.jpg) +Figure 12: Games generated by EvoMAC. + +![](images/cdee766ea8f4e82adb38c7d467a1de668430d269f65a6a78cea75fffea74085e.jpg) +(a) CharitableGivingPlatform +(b) GardeningForBeginners +(c) PersonalBlog + +![](images/2cf54a7ee402cc8f3fee75d08bb46593476a0dbc15d659965b8bbd2758f1566e.jpg) +(d) GourmetFoodSubscription +(f) MusicFestivalDirectory +Figure 13: Websites generated by EvoMAC. + +![](images/7cecbc3bfc29232396f0de9a45d856181beda2af21ba9897b990c2f6659dc4f4.jpg) +(e) OnlineTherapeuticJournaling + +# Festival List + +Coachella - California - 2023-04-14 + +Lollapalooza - Chicago - 2023-08-03 + +Add New Festival + +Logout \ No newline at end of file diff --git a/ICLR/2025/Self-Evolving Multi-Agent Collaboration Networks for Software Development/images.zip b/ICLR/2025/Self-Evolving Multi-Agent Collaboration Networks for Software Development/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..fd8c509e1a3e7858076bee44593465d1bc60519a --- /dev/null +++ b/ICLR/2025/Self-Evolving Multi-Agent Collaboration Networks for Software Development/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8ccf5e0b4f3c69dfb96b14ba9e2c7c33c2435f7e4282e3d81960027a8e73ac2a +size 1282802 diff --git a/ICLR/2025/Self-Evolving Multi-Agent Collaboration Networks for Software Development/layout.json b/ICLR/2025/Self-Evolving Multi-Agent Collaboration Networks for Software Development/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..151839bceb23c4d3a28f4789dbacece338aee2f9 --- /dev/null +++ b/ICLR/2025/Self-Evolving Multi-Agent Collaboration Networks for Software Development/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4c8c7765d05185284f47b55dcc40d8acb1c6738757ee0a6b9a28402d7168d40e +size 655947 diff --git a/ICLR/2025/Self-Improving Robust Preference Optimization/942fcf48-e571-4df9-a7f5-7bfdc7d03ede_content_list.json b/ICLR/2025/Self-Improving Robust Preference Optimization/942fcf48-e571-4df9-a7f5-7bfdc7d03ede_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..e4699a874969c127fe6073ccc53389e3a87a766e --- /dev/null +++ b/ICLR/2025/Self-Improving Robust Preference Optimization/942fcf48-e571-4df9-a7f5-7bfdc7d03ede_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7f2d896fe2e9149092df471c41ecb50c8007ad9d7ad39d6f70e507eba44a66ae +size 128567 diff --git a/ICLR/2025/Self-Improving Robust Preference Optimization/942fcf48-e571-4df9-a7f5-7bfdc7d03ede_model.json b/ICLR/2025/Self-Improving Robust Preference Optimization/942fcf48-e571-4df9-a7f5-7bfdc7d03ede_model.json new file mode 100644 index 0000000000000000000000000000000000000000..a2338a014a46c49ac51ca0938f23eeb2c03c918f --- /dev/null +++ b/ICLR/2025/Self-Improving Robust Preference Optimization/942fcf48-e571-4df9-a7f5-7bfdc7d03ede_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f7d7da6f37878f7cc1c794d0dd92ba05130a3f53976baa8b7a7221bdcf48fa3a +size 154642 diff --git a/ICLR/2025/Self-Improving Robust Preference Optimization/942fcf48-e571-4df9-a7f5-7bfdc7d03ede_origin.pdf b/ICLR/2025/Self-Improving Robust Preference Optimization/942fcf48-e571-4df9-a7f5-7bfdc7d03ede_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..b0038138ab8c50a70c151fc9564f091dcf505db4 --- /dev/null +++ b/ICLR/2025/Self-Improving Robust Preference Optimization/942fcf48-e571-4df9-a7f5-7bfdc7d03ede_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c8a91688d0dd77fe78996bff19913d22edeaa46b8c099078aa46d79f15dd6d58 +size 584741 diff --git a/ICLR/2025/Self-Improving Robust Preference Optimization/full.md b/ICLR/2025/Self-Improving Robust Preference Optimization/full.md new file mode 100644 index 0000000000000000000000000000000000000000..04034b27bb364a17931b7b4dcbce8e7cc788a07a --- /dev/null +++ b/ICLR/2025/Self-Improving Robust Preference Optimization/full.md @@ -0,0 +1,495 @@ +# SELF-IMPROVING ROBUST PREFERENCE OPTIMIZATION + +Eugene Choi * + +Cohere + +Arash Ahmadian + +Cohere for AI + +Matthieu Geist + +Cohere + +Olivier Pietquin + +Cohere + +Mohammad Gheshlaghi Azar + +Cohere + +# ABSTRACT + +Online and offline RLHF methods, such as PPO and DPO, have been highly successful in aligning AI with human preferences. Despite their success, however, these methods suffer from fundamental limitations: (a) Models trained with RLHF can learn from mistakes or negative examples through RL mechanism or contrastive loss during training. However, at inference time, they lack an innate self-improvement mechanism for error corrections. (b) The optimal solution of existing methods is highly task-dependent, making it difficult for them to generalize to new tasks. To address these challenges, we propose Self-Improving Robust Preference Optimization (SRPO), a practical and mathematically principled offline RLHF framework. The key idea behind SRPO is to cast the problem of learning from human preferences as a self-improvement process, mathematically formulated as a min-max objective that jointly optimizes a self-improvement policy and a generative policy in an adversarial fashion. Crucially, the solution for this optimization problem is independent of the training task, which makes it robust to its changes. We then show that this objective can be reformulated as a non-adversarial offline loss, which can be efficiently optimized using standard supervised learning techniques at scale. To demonstrate SRPO's effectiveness, we evaluate it using AI Win-Rate (WR) against human (GOLD) completions. When tested on the XSum dataset, SRPO outperforms DPO by a margin of $15\%$ after 5 self-revisions, achieving an impressive $90\%$ WR. Moreover, on the challenging Arena-Hard prompts, SRPO outperforms both DPO and IPO (by $4\%$ without revision and $6\%$ after a single revision), reaching a $56\%$ WR against against Llama-3.1-8B-Instruct. + +# 1 INTRODUCTION + +Reinforcement Learning from Human Feedback (RLHF) (Christiano et al., 2017) has quickly become a standard method to align large language models (LLMs). A key advantage of RLHF is that it allows the model to learn from its mistakes, allowing it to not only learn from good experiences but also from bad experiences and mistakes. Despite being able to learn from mistakes, the standard RLHF-tuned models are not equipped with an innate mechanism to self-improve and correct their mistakes at the time of inference (Kumar et al., 2024). If a model makes a critical mistake or omits crucial fact during inference, it struggles to recover. Another practical issue that all the prominent RLHF methods (offline or online) (Ouyang et al., 2022; Rafailov et al., 2023; Azar et al., 2023; Zhao et al., 2023b; Ahmadian et al., 2024) encounter is that their optimal solution heavily depends on the training task in terms of the distribution used to generate preference data (behavior policy) (Munos et al., 2023; Azar et al., 2023). This makes existing RLHF methods vulnerable to the cases in which the evaluation distribution of completions is significantly different from that of the behavior policy (Li et al., 2024b; Kirk et al., 2024). + +To address these challenges, we introduce an alternative approach for aligning LLMs from human preferences based on more principled and robust foundations. Our goal is to find a solution that is + +![](images/ebc9ca261166487b17579f24fb984dacfb2b5f1e3b69e097afe5d406818cd338.jpg) +Figure 1: Self-improvement by SRPO in terms of win rates against human (WR). We demonstrate robustness by training on TL;DR and evaluating on XSum. Gains on Direct Preference Optimization (DPO) are reported in text captions. + +robust to the changes in the preference dataset, meaning that changes in the distribution from which the completions are sampled do not affect the final outcome of learning significantly. To achieve this goal, we exploit the concept of self-improving (Huang et al., 2022; Bai et al., 2022) language models. By self-improving LLM we refer to a model capable of enhancing its outputs recursively with each inference iteration. Our Self-Improving Robust Preference Optimization (SRPO) consists of two back-to-back optimization processes: + +(Step 1) In-Context Self-Improving Preference Optimization: The core idea is to learn an in-context self-improving model $\pi_{\dagger}$ :1 given an in-context completion $y$ and a context $x$ , the self-improvement model, $\pi_{\dagger}$ , outputs an improved completion $y'$ with probability $\pi_{\dagger}(y'|y,x)$ from which sampled completions are most preferred to completion $y$ according to the human preference model $p$ . As explained later, it turns out that this problem, in its KL-regularized form, can be expressed as a well-defined preference optimization problem and solved analytically. Furthermore, the solution can be estimated through a supervised direct preference optimization scheme similar to the approach used by Rafailov et al. (2023) and Azar et al. (2023). + +(Step 2) Robust Preference Optimization of Generative Model: The next step is to exploit the self-improvement policy learned in the previous step to learn a generative LLM, $\pi$ . The key idea here is that the best generative policy can be identified as a policy that generates completions requiring minimal improvement using the optimal self-improvement policy $\pi_{\dagger}$ derived in step 1. This goal can be achieved by minimizing the objective of step 1 with respect to the generative policy for in-context completions, $y$ . Similarly to step 1, this problem, in its KL-regularized form, can also be solved analytically in terms of the optimal improvement policy $\pi_{\dagger}$ and the optimal generative policy $\pi$ . More significantly, we show that the solution for steps 1 and 2 can be estimated jointly through a single supervised direct preference optimization scheme using only a dataset of annotated pair-wise completions. Thus, one can solve both for the self-improvement policy $\pi_{\dagger}$ and $\pi$ by minimizing the supervised learning objective of SRPO. Unlike existing RLHF methods, this solution is independent of the behavior policy and is therefore robust to its changes. + +As using the self-improvement model in SRPO is a significant departure from the existing paradigm for RLHF, we provide a high-level motivation for it in Sec. 2. We then formalize our objective for SRPO in Sec. 3, allowing for the joint optimization of both $\pi_{\dagger}$ and $\pi$ by optimizing an adversarial min-max objective. In Sec. 4 we present our main algorithmic/mathematical contribution: we prove that the preference probability $p$ can be expressed in terms of the log-likelihoods of the optimal self-improvement policy $\pi_{\dagger}^{*}$ and the log-likelihoods of the optimal robust generative policy $\pi^{*}$ . This + +theoretical finding is the key result for SRPO: solving this system of equations through least-squares regression provides us with the practical supervised SRPO objective that solves for both policy and robust generative policy through a single supervised objective without any need for reward model or online inference. Our key theoretical finding is similar to the main result of DPO (Rafailov et al., 2023) in that both express preference probabilities in terms of the optimal policy. However, DPO result only holds when preference probabilities conform to Bradley-Terry model (Bradley & Terry, 1952), whereas our key result is general as it holds across all preference models. In Sec. 5 we further illustrate our argument on the robustness of SRPO by providing an in-depth analysis of the solution of SRPO and other direct preference optimization methods. We also showcase/analyze the robustness of SRPO on a simple synthetic example. Finally in Sec. 6 we conduct large-scale experiments on training LLMs with SRPO both on in-distribution and OOD summarization tasks and we compare the results with those of standard baselines. + +# 2 LEARNING SELF-IMPROVEMENT POLICY THROUGH PREFERENCE OPTIMIZATION + +The goal of this section is to motivate why learning self-improvement models through preference optimization can be useful for training a GPT-style language model. One of the main challenges that affect the performance of sequence-to-sequence GPT-style models is that they are hard to recover from failure at the time of inference. This problem, which is known as exposure bias in the literature on sequence-to-sequence prediction (Xu et al., 2020; Arora et al., 2023; Bengio et al., 2015), is because at the time of inference, GPT-style models generate tokens step by step based on their own previous outputs, not the ground truth. This can lead to error accumulation: if the model generates an incorrect token early in the sequence (or a misleading token that may lead to an error later down the line), it may propagate errors since its subsequent predictions are based on the earlier incorrect (or misleading) token (Arora et al., 2023). + +To address this shortcoming of GPT-style models, one may fine-tune the model such that it can revise its incorrect generations through a self-improvement/self-refinement process (Madaan et al., 2024; Hu et al., 2024; Huang et al., 2022; Bai et al., 2022). The simplest way to train such a self-improvement model is through supervised fine tuning (SFT) (Bai et al., 2022; Wei et al., 2023). To train a self-improvement model through SFT, one first need to build a supervised dataset of $(x,y,y^{*})$ in which $y$ is some initial completion than can be correct or incorrect and $y^{*}$ is the corrected version of $y$ . The improvement model can then be fine-tuned using SFT to predict $y^{*}$ from the pair $(x,y)$ . + +However, training a SFT self-improvement model is a challenging task for the following reasons. + +1. Creating a supervised dataset of $(x,y,y^{*})$ is resource intensive and hard to scale (Huang et al., 2022). Also, the existing standard SFT datasets are not created in this way. +2. Moreover, the SFT training pipeline for self-improvement can simply overfit to predict the correct answer $y^{*}$ only from the context $x$ and ignore the initial answer $y$ altogether or over-fit to specific refinement pattern (Li et al., 2024a). Thus it may not learn properly how to improve an incorrect $y$ to the correct $y^{*}$ . + +Alternatively, one might ask whether one can generalize the direct preference optimization methods (e.g., Rafailov et al., 2023; Azar et al., 2023) for learning self-improvement models using the standard human preference datasets. To answer this question we first try to answer a more fundamental question: + +# What is the best use of human preference data? + +To address this question, we observe that human preferences inherently encode valuable information about the relationship between more-preferred and less-preferred completions. This relational information can be leveraged to refine less-preferred completions, guiding them closer to those that better align with human preferences. In essence, this process involves learning a model of alignment mechanics—principles or "rules" that dictate how completions can be iteratively improved in terms of satisfying human preferences. This approach represents a more natural and intuitive learning task compared to directly predicting the highest-preferred completion, which is the focus of standard RLHF methods. Directly learning the optimal completion can be a challenging task, particularly when the completion space encompasses the full complexity of human language. Furthermore, the + +highest-preferred answer is unlikely to exist in the dataset, especially when completions are generated by large language models (LLMs) that inherently fall short of human-level quality. + +Instead, it is more effective to model the improvement process itself: given a query $x$ and an initial completion $y$ , the goal is to predict an improved completion $y'$ . This shift in perspective transforms the task into learning how to enhance subpar outputs from an LLM, rather than aiming to directly generate perfect responses. By capturing the underlying principles of human preference, the model can iteratively refine suboptimal completions $y$ , progressively steering them towards the ideal outcome $y^*$ . This framework not only aligns with the iterative nature of human reasoning but also facilitates continuous self-improvement, making it a robust and scalable approach for enhancing the performance of LLMs. In the following, we show how the self-improvement policy, $\pi_{\dagger}$ , is trained alongside the generative policy, $\pi$ , using pair-wise preferences. + +# 3 SRPO OBJECTIVE + +We start by introducing some notations required to establish our theoretical results. Let $x$ and $y$ denote a context and a completion drawn from the space of all possible contexts $\mathcal{X}$ and all possible completions $\mathcal{Y}$ , respectively. The large language model (LLM) is represented by the probability distribution (policy) $\pi$ where $\pi(y|x)$ denotes the probability of completion $y$ given the context $x$ . In the remainder of this article, we consider three variants of this base LLM, the trainable model $\pi_{\mathrm{train}}$ (for which we use the shorthand $\pi$ ), the reference model $\pi_{\mathrm{ref}}$ and the behavior model $\mu$ from which the completions in pairwise preference dataset is sampled. + +We also introduce self-improvement $\pi(y'|y, x)$ as a model that using a context $x$ and in-context completion (thought) $y$ aims at improving $y$ to better completion $y'$ . Similarly to the base LLM, we can define a reference model $\pi_{\mathrm{ref}}(y'|y, x)$ also for the self-improvement model. Let $\mathcal{D} = \{(x, y, y')\}$ be a dataset of contexts and completions where $y$ and $y'$ are drawn independently of $\mu(\cdot|x)$ . We then present every pair $y, y'$ to human annotators who express preferences for one of the completions, denoted as $y_w \succ y_l$ where $y_w$ and $y_l$ denote the preferred and dis-preferred actions amongst $\{y, y'\}$ respectively. We then write the true human preference $p(y' \succ y|x)$ the probability that $y'$ is preferred to $y$ knowing the context $x$ . The probability comes from the randomness of the choice of the human we ask for their preference. So $p(y' \succ y|x) = \mathbb{E}_h[1 \{h \text{ prefers } y' \text{ to } y \text{ given } x\}]$ , where the expectation is over humans $h$ . + +Consider a reference policy $\pi_{\mathrm{ref}}$ , and a real positive regularization parameter $\beta \in \mathbb{R}_{+}^{*}$ . Then, we define the Self-Improving Robust Preference Optimization objective (SRPO) for every context $x$ as + +$$ +J ^ {*} (x) = \min _ {\pi} \max _ {\pi_ {\dagger}} \underset { \begin{array}{c} y \sim \pi (\cdot | x) \\ y ^ {\prime} \sim \pi_ {\dagger} (\cdot | y, x) \end{array} } {\mathbb {E}} \left[ p \left(y ^ {\prime} \succ y | x\right) - \beta D _ {\mathrm {K L}} \left(\pi_ {\dagger} \mid \mid \pi_ {\text {r e f}} | y, x\right) + \beta D _ {\mathrm {K L}} \left(\pi \mid \mid \pi_ {\text {r e f}} | x\right) \right], \tag {1} +$$ + +with the KL-regularization terms are defined as: $D_{\mathrm{KL}}(\pi_{\dagger}||\pi_{\mathrm{ref}}|y,x) = \mathrm{KL}(\pi_{\dagger}(\cdot |y,x)||\pi_{\mathrm{ref}}(\cdot |y,x))$ and $D_{\mathrm{KL}}(\pi ||\pi_{\mathrm{ref}}|x) = \mathrm{KL}(\pi (\cdot |x)||\pi_{\mathrm{ref}}(\cdot |x))$ . + +In nutshell, this objective aims at (i) finding the best self-improvement policy $\pi_{\dagger}^{*}$ that improves every $y\sim \pi$ optimally w.r.t. the preference distribution $p$ , i.e., the improved policy is most preferred to $y$ , while keeping $\pi_{\dagger}^{*}$ close to the reference policy $\pi_{\mathrm{ref}}$ , (ii) minimizing the same objective to find the best (robust) policy $\pi^{*}$ for which the generated completions can be only minimally improved by the optimal self-improvement model $\pi_{\dagger}^{*}$ . The min-max nature of this objective makes self-improvement effective for all policies close to $\pi_{\mathrm{ref}}$ as we optimize $\pi_{\dagger}$ in the worst-case scenario. + +# 4 OFFLINE SOLUTION FOR OPTIMIZING SRPO OBJECTIVE + +In this section, we show that the min-max objective of Eq. (1) can be transformed to a non-adversarial offline supervised loss. Thus it can be optimized at scale using standard optimization techniques. + +# 4.1 MAIN RESULT + +The optimization problem of Eq. (1) is a non-trivial optimization problem that often requires solving a two-stage adversarial optimization problem through the game-theoretic approaches, which are often + +challenging and difficult to scale up, (see e.g., Munos et al., 2023; Rosset et al., 2024; Calandriello et al., 2024, for how we can use game-theoretic approaches/objectives to train LLMs). Here, inspired by Rafailov et al. (2023); Azar et al. (2023), we aim at casting this complex optimization objective as a standard supervised learning problem that can be solved at scale given an offline pairwise preference dataset. The main theoretical result of our work is then as follows + +Theorem 1. Given a context $x$ and the behavior policy $\mu(\cdot|x)$ let $\mu(y|x)$ and scalars $\alpha \in [0,1]$ , $\beta > 0$ we have that the solution of the min-max objective of Eq. (1) is obtained by minimizing the following loss + +$$ +L _ {\alpha} \left(\pi , \pi_ {\dagger}\right) = (1 - \alpha) L \left(\pi , \pi_ {\dagger}\right) + \alpha L _ {\dagger} \left(\pi_ {\dagger}\right), \tag {2} +$$ + +where $L(\pi, \pi_{\dagger})$ and $L_{\dagger}(\pi_{\dagger})$ are defined respectively as follows + +$$ +L _ {\dagger} \left(\pi_ {\dagger}\right) = \underset {y, y ^ {\prime} \sim \mu (\cdot | x)} {\mathbb {E}} \left[ p \left(y ^ {\prime} \succ y | x\right) - \frac {1}{2} - \beta \left[ \log \left(\frac {\pi_ {\dagger} \left(y ^ {\prime} | y , x\right)}{\pi_ {r e f} \left(y ^ {\prime} | y , x\right)}\right) - \log \left(\frac {\pi_ {\dagger} \left(y | y , x\right)}{\pi_ {r e f} \left(y | y , x\right)}\right) \right] \right] ^ {2}. \tag {3} +$$ + +and + +$$ +\begin{array}{l} L \left(\pi , \pi_ {\dagger}\right) = \underset { \begin{array}{c} y, y ^ {\prime} \sim \mu (\cdot | x) \\ x \sim \rho \end{array} } {\mathbb {E}} \left[ p \left(y ^ {\prime} \succ y | x\right) - \frac {1}{2} - \frac {\beta}{2} \left[ \log \left(\frac {\pi_ {\dagger} \left(y ^ {\prime} | y , x\right)}{\pi_ {r e f} \left(y ^ {\prime} | y , x\right)}\right) + \log \left(\frac {\pi (y | x)}{\pi_ {r e f} (y | x)}\right) \right. \right. \tag {4} \\ \left. \left. - \left(\log \left(\frac {\pi_ {\dagger} (y | y ^ {\prime} , x)}{\pi_ {r e f} (y | y ^ {\prime} , x)}\right) + \log \left(\frac {\pi (y ^ {\prime} | x)}{\pi_ {r e f} (y ^ {\prime} | x)}\right)\right) \right] \right] ^ {2}. \\ \end{array} +$$ + +# 4.2 PROOF OF MAIN RESULT + +To prove the main result we first notice that the inner-maximization in the objective function of Eq. (1) is an instantiation of KL-regularized RL (Todorov, 2006). Thus it can be solved in analytical form and its solution is given by + +$$ +\pi_ {\dagger} ^ {*} \left(y ^ {\prime} | y, x\right) = \frac {\exp \left(\frac {p \left(y ^ {\prime} \succ y \mid x\right)}{\beta}\right) \pi_ {\mathrm {r e f}} \left(y ^ {\prime} \mid y , x\right)}{Z ^ {*} (y , x)}, \tag {5} +$$ + +where $Z^{*}(y,x)$ is the normalization factor. One can easily show that by plugging $\pi_{\dagger}^{*}$ in the objective function of Eq. (1) we obtain: + +$$ +J ^ {*} (x) = \min _ {\pi} \mathbb {E} _ {y \sim \pi (., | x)} \left[ \beta \left(\log \left(Z ^ {*} (y, x)\right) + D _ {\mathrm {K L}} \left(\pi | | \pi_ {\mathrm {r e f}} | x\right)\right) \right]. \tag {6} +$$ + +Now by solving Eq. (5) with respect to $p(y' \succ y|x)$ we obtain + +$$ +p \left(y ^ {\prime} \succ y | x\right) = \beta \left(\log \left(\pi_ {\dagger} ^ {*} \left(y ^ {\prime} | y, x\right)\right) - \log \left(\pi_ {\text {r e f}} \left(y ^ {\prime} | y, x\right)\right) + \beta \log \left(Z ^ {*} (y, x)\right)\right). \tag {7} +$$ + +# 4.2.1 OPTIMIZING THE SELF-IMPROVEMENT POLICY $\pi_{\dagger}$ + +We now prove that minimizing the objective of Eq. (3) gives us the optimal self-improvement policy (solution to maximization in the objective of Eq. (1)). We first notice that using the convention $p(y \succ y|x) = \frac{1}{2}$ Eq. (7) implies + +$$ +\frac {1}{2} = \beta \left(\log \left(\pi_ {\dagger} ^ {*} (y | y, x)\right) - \log \left(\pi_ {\text {r e f}} (y | y, x)\right)\right) + \beta \log \left(Z ^ {*} (y, x)\right). \tag {8} +$$ + +Now by subtracting Eq. (7) from Eq. (8) we derive + +$$ +p \left(y ^ {\prime} \succ y \mid x\right) = \frac {1}{2} + \beta \left[ \log \left(\frac {\pi_ {\dagger} ^ {*} \left(y ^ {\prime} \mid y , x\right)}{\pi_ {\mathrm {r e f}} \left(y ^ {\prime} \mid y , x\right)}\right) - \log \left(\frac {\pi_ {\dagger} ^ {*} (y \mid y , x)}{\pi_ {\mathrm {r e f}} (y \mid y , x)}\right) \right]. \tag {9} +$$ + +This is our first key result that expresses preference $p(y' \succ y|x)$ in terms of the optimal self-improvement policy $\pi_{\dagger}^{*}$ . So we enforce this equation for all $y$ and $y'$ through minimizing $\ell_2$ loss of Eq. (3) which concludes the proof for the self-improvement policy. + +# 4.2.2 JOINT OPTIMIZATION OF THE ROBUST GENERATIVE POLICY $\pi$ AND THE IMPROVEMENT POLICY $\pi_{\dagger}$ + +In this section, we show that to optimize the min-max objective of Eq. (1) (i.e., solving for $\pi$ and $\pi_{\dagger}$ ) one can optimize the loss of Eq. (4). We start by collecting terms in Eq. (8) which implies $\beta \log (Z^{*}(y,x)) = \beta (\log (\pi_{\mathrm{ref}}(y|y,x)) - \log (\pi_{\dagger}^{*}(y|y,x))) - \frac{1}{2}$ . Thus, the objective of Eq. (6) can be expressed in terms of $\log (\pi_{\dagger}^{*}(y|y,x))$ (up to an additive and multiplicative constant) as follows: + +$$ +J ^ {*} (x) \propto \min _ {\pi} \mathbb {E} _ {y \sim \pi (.. | x)} \left[ \log \left(\frac {\pi_ {\mathrm {r e f}} (y | y , x)}{\pi_ {\dagger} ^ {*} (y | y , x)}\right) + D _ {\mathrm {K L}} (\pi | | \pi_ {\mathrm {r e f}} | x)\right). \tag {10} +$$ + +Solving this objective with respect to $\pi$ we obtain: + +$$ +\pi^ {*} (y | x) = \frac {\frac {\pi_ {\text {r e f}} (y | x)}{\pi_ {\text {r e f}} (y | y , x)} \pi_ {\dagger} ^ {*} (y | y , x)}{Z ^ {*} (x)} \tag {11} +$$ + +where $Z^{*}(x)$ is the normalization factor. Again by taking the logarithm from both side we obtain $\log (\pi^{*}(y|x)) = \log \left(\frac{\pi_{\mathrm{ref}}(y|x)}{\pi_{\mathrm{ref}}(y|y,x)}\pi_{\dagger}^{*}(y|y,x)\right) - \log (Z^{*}(x))$ . Now by collecting terms in Eq. (7) and solving for $\log (\pi_{\dagger}^{*}(y'|y,x))$ we obtain + +$$ +\log \left(\pi_ {\dagger} ^ {*} \left(y ^ {\prime} \mid y, x\right)\right) = \frac {p \left(y ^ {\prime} \succ y \mid x\right)}{\beta} - \log \left(Z ^ {*} (y, x)\right) - \log \left(\pi_ {\text {r e f}} \left(y ^ {\prime} \mid y, x\right)\right) \tag {12} +$$ + +Now by plugging Eq. (5) into Eq. (11) we deduce $\pi^{*}(y|x) = \frac{\exp(-\log(Z^{*}(y,x)))\pi_{\mathrm{ref}}(y|x)}{Z^{*}(x)}$ . Solving this equation with respect to $\log (Z^{*}(y,x))$ implies + +$$ +\log \left(Z ^ {*} (y, x)\right) = \log \left(\pi_ {\text {r e f}} (y | x)\right) - \log \left(\pi^ {*} (y | x)\right) - \log \left(Z ^ {*} (x)\right). \tag {13} +$$ + +Combining Eq. (12) and Eq. (13) for any $y$ and $y^\prime$ we have $\frac{p(y^{\prime}\succ y|x)}{\beta} -\log \left(\frac{\pi_{\dagger}^{*}(y^{\prime}|y,x)}{\pi_{\mathrm{ref}}(y^{\prime}|y,x)}\right) = \log \left(\frac{\pi_{\mathrm{ref}}(y|x)}{\pi^{*}(y|x)}\right) - \log (Z^{*}(x))$ , and also $\frac{p(y\succ y'|x)}{\beta} -\log \left(\frac{\pi_{\dagger}^{*}(y|y',x)}{\pi_{\mathrm{ref}}(y|y',x)}\right) = \log \left(\frac{\pi_{\mathrm{ref}}(y'|x)}{\pi^{*}(y'|x)}\right) - \log (Z^{*}(x))$ . Subtracting these two equations and collecting terms leads to our key result in which we express the preference $p$ in terms of the self-improvement policy $\pi_{\dagger}^{*}$ and the robust policy $\pi^{*}$ . + +$$ +\begin{array}{l} p \left(y ^ {\prime} \succ y \mid x\right) = \frac {1}{2} + \frac {\beta}{2} \left[ \log \left(\frac {\pi_ {\dagger} ^ {*} \left(y ^ {\prime} \mid y , x\right)}{\pi_ {\text {r e f}} \left(y ^ {\prime} \mid y , x\right)}\right) + \log \left(\frac {\pi^ {*} (y \mid x)}{\pi_ {\text {r e f}} (y \mid x)}\right) \right. \tag {14} \\ \left. - \left(\log \left(\frac {\pi_ {\dagger} ^ {*} (y | y ^ {\prime} , x)}{\pi_ {\mathrm {r e f}} (y | y ^ {\prime} , x)}\right) + \log \left(\frac {\pi^ {*} (y ^ {\prime} | x)}{\pi_ {\mathrm {r e f}} (y ^ {\prime} | x)}\right)\right) \right]. \\ \end{array} +$$ + +Remark 2. One may notice the similarity of this result and Eq. 6 of DPO paper (Rafailov et al., 2023). Both results express $p(y' \succ y|x)$ in terms of the optimal policy $\pi^*$ . However, the result of DPO only holds under the assumption that $p$ conforms to the Bradley-Terry model, whereas our result is general and holds for all $p$ . + +To optimize for $\pi$ and $\pi_{\dagger}$ using Eq. (14) we enforce this equation for all $y$ and $y^\prime$ through minimizing the expected $\ell_2$ loss of Eq. (4) which concludes the proof on joint optimization of the generative policy $\pi$ and the self-improvement policy through Eq. (4). + +# 4.2.3 PUTTING ALL TOGETHER IN A SINGLE COMBINATION LOSS + +We observe that the losses defined in Eq. (4) and Eq. (3) are inherently aligned, as both aim to optimize the same overall objective given in Eq. (1). This alignment allows us to construct a combined loss function for SRPO by using a convex combination of these two losses. Specifically, for any $\alpha \in [0,1]$ , minimizing the convex combination of the losses in Eq. (4) and Eq. (3) is equivalent to directly optimizing the objective in Eq. (1). Mathematically, the full loss of SRPO can be expressed as: + +$$ +\mathcal {L} _ {\mathrm {S R P O}} = \alpha \cdot \mathcal {L} _ {\mathrm {L 2}} + (1 - \alpha) \cdot \mathcal {L} _ {\text {s e l f - i m p r o v e}}, +$$ + +where $\mathcal{L}_{\mathrm{L2}}$ corresponds to the loss in Eq. (4) and $\mathcal{L}_{\mathrm{self-improve}}$ corresponds to the loss in Eq. (3). By minimizing this combined loss, we ensure that the optimization process aligns with the original objective in Eq. (1) regardless of the value of $\alpha$ . + +This formulation not only unifies the two loss functions within a single framework but also provides flexibility in adjusting their relative contributions during training. This completes the proof. + +# 4.3 DERIVING THE SAMPLE LOSS FOR SRPO + +Calculating/optimizing the expected loss of Eq. (17) is often not practical as we often have no direct access to the behavior policy $\mu$ . Moreover, the space of completions $y$ is often very large (even infinite). So calculating the full expectation is often impractical. Instead one can estimate the expected loss $L_{\alpha}$ of Eq. (17) using a preference dataset $\mathcal{D}$ with a sample loss $\widehat{L}_{\alpha}$ and optimize this loss instead. We now focus on deriving the sample loss $\widehat{L}_{\alpha}$ for SRPO. Using the standard properties of $\ell_2$ -norm to replace $p(y' \succ y|x)$ with $\mathbf{1}(y' \succ y|x)$ , as $p(y' \succ y|x) = \mathbb{E}[\mathbf{1}(y' \succ y|x)]$ , in the objective of Eq. (4) allows us to derive the following sample loss for the improvement model: + +$$ +\begin{array}{l} \widehat {L} _ {\dagger} \left(\pi_ {\dagger}\right) = \mathbb {E} _ {\left(y _ {l}, y _ {w}, x\right) \sim \mathcal {D}} \left[ \frac {1}{2} - \beta \left[ \log \left(\frac {\pi_ {\dagger} \left(y _ {w} \mid y _ {l} , x\right)}{\pi_ {\operatorname {r e f}} \left(y _ {w} \mid y _ {l} , x\right)}\right) - \log \left(\frac {\pi_ {\dagger} \left(y _ {l} \mid y _ {l} , x\right)}{\pi_ {\operatorname {r e f}} \left(y _ {l} \mid y _ {l} , x\right)}\right) \right] \right] ^ {2} \tag {15} \\ + \mathbb {E} _ {(y _ {l}, y _ {w}, x) \sim \mathcal {D}} \left[ \frac {1}{2} - \beta \left[ \log \left(\frac {\pi_ {\dagger} (y _ {w} | y _ {w} , x)}{\pi_ {\mathrm {r e f}} (y _ {w} | y _ {w} , x)}\right) - \log \left(\frac {\pi_ {\dagger} (y _ {l} | y _ {w} , x)}{\pi_ {\mathrm {r e f}} (y _ {l} | y _ {w} , x)}\right) \right] \right] ^ {2}. \\ \end{array} +$$ + +Using the standard properties of $\ell_2$ -norm to replace $p(y' \succ y|x)$ with $\mathbf{1}(y' \succ y|x)$ , as $p(y' \succ y|x) = \mathbb{E}[\mathbf{1}(y' \succ y|x)]$ , in the loss of Eq. (4) allows us to derive the following sample loss for both the generative policy and the improvement model: + +$$ +\begin{array}{l} \widehat {L} (\pi , \pi_ {\dagger}) = \mathbb {E} _ {(y _ {l}, y _ {w}, x) \sim \mathcal {D}} \left[ \beta \left[ \log \left(\frac {\pi_ {\dagger} (y _ {w} | y _ {l} , x)}{\pi_ {\text {r e f}} (y _ {w} | y _ {l} , x)}\right) + \log \left(\frac {\pi (y _ {w} | x)}{\pi_ {\text {r e f}} (y _ {w} | x)}\right) \right. \right. \tag {16} \\ \left. \left. - \left(\log \left(\frac {\pi_ {\dagger} \left(y _ {l} \mid y _ {w} , x\right)}{\pi_ {\text {r e f}} \left(y _ {l} \mid y _ {w} , x\right)}\right) + \log \left(\frac {\pi \left(y _ {l} \mid x\right)}{\pi_ {\text {r e f}} \left(y _ {l} \mid x\right)}\right)\right) \right] - 1 \right] ^ {2}. \\ \end{array} +$$ + +looseness $= -1$ Furthermore, one can use a single LLM (denoted by $\pi$ ) to represent both $\pi$ and $\pi_{\dagger}$ by exploiting the in-context learning power of LLMs (Brown et al., 2020) such that $\pi_{\dagger}(y'|y,x) = \pi(y'|y,x)$ . So for we define the full sample loss of SRPO as the convex combination of Eq. (16) and Eq. (15): + +$$ +\widehat {L} _ {\alpha} (\pi) = (1 - \alpha) \widehat {L} (\pi , \pi_ {\dagger} = \pi) + \alpha \widehat {L} _ {\dagger} (\pi_ {\dagger} = \pi). \tag {17} +$$ + +The following pseudo-code can be used to train the LLM policy using SRPO objective: + +# Algorithm 1 Sampled SRPO + +Require: Dataset $\mathcal{D}$ of prompts, preferred and dis-preferred generations $x$ , $y_{w}$ and $y_{l}$ , respectively. A reference policy $\pi_{\mathrm{ref}}$ and a training policy $\pi_{\theta}$ , regularization coefficient $\beta$ and combination coefficient $\alpha$ . + +1: Initialize $\pi_{\theta} = \pi_{\mathrm{ref}}$ +2: while true do +3: Sample a minibatch $B \in \mathcal{D}$ +4: Estimate $\nabla_{\theta}\widehat{L}_{\alpha}(\pi_{\theta})$ from Eq. (17) using minibatch $B$ as the dataset +5: Update $\pi_{\theta}$ using $\nabla_{\theta}\hat{L}_{\alpha}(\pi_{\theta})$ using a standard optimizer +6: end while +7: return $\pi_{\theta}$ + +# 5 ROBUSTNESS OF SRPO + +We provide a comparison between SRPO and prior work on direct preference optimization in terms of their robustness to the behavior policy $\mu$ . In particular, we consider as a point of reference DPO (PPO²) and IPO for which we have a good understanding of the underlying mathematical foundation. + +In the case of both IPO and DPO the analytical solution is already well-established and analyzed for both algorithms (Azar et al., 2023; Rafailov et al., 2023; Tang et al., 2024). In particular, the optimal + +solution for both IPO and DPO can be expressed explicitly in terms of the soft-max of the expected preference as follows (Azar et al., 2023): + +$$ +\pi^ {*} (y | x) = \frac {\exp \left(\beta^ {- 1} \mathbb {E} _ {y ^ {\prime} \sim \mu (\cdot | x)} [ \Psi (p (y \succ y ^ {\prime} | x)) ]\right) \pi_ {\text {r e f}} (y | x)}{Z ^ {*} (x)}, \tag {18} +$$ + +with the choice of $\Psi = I(\cdot)$ and $\Psi = \sigma^{-1}(\cdot)$ for IPO and DPO, respectively, where $\sigma^{-1}$ denotes the inverse-sigmoid (logit function). Thus, based on Eq. (18), we can see that the solution for both IPO and DPO has strong dependency on $\mu$ in the form of expected preference under the distribution $\mu$ . Thus it may not be robust to changes in $\mu$ . This dependency on $\mu$ can be especially problematic when we evaluate the model on out-of-distribution tasks where the desired behavior is very different from $\mu$ and the expected preference under the distribution $\mu$ is not a good measure of performance. SRPO solution on the other hand has no dependency on the behavior policy $\mu$ : from Eq. (5) we observe that the optimal self-improvement policy $\pi_{\dagger}^{*}$ is independent of $\mu$ and, unlike DPO and IPO cases, is expressed in terms of softmax of $p(y' \succ y|x)$ for any pair of completions $(y, y')$ . Also the 0-revision policy $\pi^{*}$ is also completely independent of $\mu$ as it is evident from Eq. (11) (i.e., it is proportional to $\pi^{*}(y|y, x)$ which itself is independent of $\mu$ ). Thus, from a mathematical point of view, SRPO provides a robust solution for the problem of direct preference optimization that does not depend on the behavior policy $\mu$ . To illustrate the differences between SRPO and DPO/IFO regarding + +robustness to $\mu$ , we consider a simple bandit example. For simplicity, we assume there is no context $x$ . Consider the simple case where we have 3 completions $y_0, y_1$ , and $y_2$ , for which the preference model is + +$$ +P = \left( \begin{array}{c c c} 0. 5 & 0. 9 9 & 0. 3 \\ 0. 0 1 & 0. 5 & 0. 2 5 \\ 0. 7 & 0. 7 5 & 0. 5 \end{array} \right). +$$ + +To test this hypothesis we consider two synthetic dataset of actions generated from distributions $\mu_0$ and $\mu_{1}$ : We set $\mu_0$ to be a uniform behavior policy ( $\mu_0(y_0) = \mu_0(y_1) = \mu_0(y_2) = 1/3$ ) and $\mu_{1}$ skewed towards $y_{1}$ ( $\mu_{1}(y_{1}) = 0.7, \mu_{1}(y_{0}) = \mu_{1}(y_{2}) = 0.15$ ). We then generate a dataset of 10,000 pairs from $\mu_0$ and $\mu_{1}$ and rate them according to the preference model $p$ (for any pair $(y, y')$ we assign the preference by sampling from $p(y \succ y')$ , that is $y$ is preferred to $y'$ with probability $p(y \succ y')$ ). This provides us with two datasets of rated completions $\mathcal{D}_0$ and $\mathcal{D}_1$ for $\mu_0$ and $\mu_{1}$ . We then use these two datasets to train the policy $\pi$ using SRPO, DPO and IPO using a simple Adam optimizer. In the case of IPO and DPO we optimize only the 0-revision policy $\pi(y)$ where as for SRPO we also optimize the self-improvement policy $\pi(y|y')$ as well. We set the regularization constant $\beta$ for all methods to 1. We consider a uniform distribution $\pi_{\mathrm{ref}}(y) = 1/3$ for all algorithms and all $y_s$ . In the case of SRPO we set the self-improvement reference policy $\pi_{\mathrm{ref}}(y|y') = 1/3$ for all $y$ and $y'$ . Also for SRPO we set the combination coefficient $\alpha = 0$ for simplicity. + +We observe that in the case of using uniform $\mu_0$ as a behavior policy, all methods perform as expected, converging to solutions where $y_{2}$ dominates $y_{1}$ and $y_{0}$ (Fig. 2a). However, when the behavior policy $\mu_{1}$ is skewed toward $y_{1}$ , both DPO and IPO converge to a solution where $y_{0}$ dominates $y_{1}$ and $y_{2}$ , while the policy of SRPO remains unchanged (Fig.2b). Notably, the SRPO policy differs slightly between the two cases, which is expected given the finite data setting, where the sampling distribution influences the empirical preference model." However, when we use the behavior policy $\mu_{1}$ , which is skewed towards $y_{1}$ , both DPO and IPO converge to a solution where $y_{0}$ dominates $y_{1}$ and $y_{2}$ , while the policy of SRPO remains unchanged (Fig.2b). Notably, the SRPO policy differs slightly between the two cases, which is expected given the finite data setting, where the sampling distribution influences the empirical preference model." + +to a solution in which $y_{0}$ dominates $y_{1}$ and $y_{2}$ , while the policy of SRPO remains intact (Fig. 2b). Notice that the SRPO policy is slightly different in both cases. This is to be expected, we are in a finite data setting, and the sampling distribution will have some influence on the empirical preference model. + +![](images/070d37888da756a42d9e53717447e62f6d7561e9daa69d4c4d224707e2226628.jpg) +(a) SRPO vs IPO and DPO for uniform $\mu_0$ + +![](images/005b4d68ac00418ef94d4175067b93b3688a2486e7f9b8a0cb2a167f6da3352e.jpg) +(b) SRPO vs. IPO and DPO for skewed $\mu_{1}$ . +Figure 2: Learned action probabilities for the synthetic example. SRPO always chooses the correct arm regardless of skew in $\mu$ , while both IPO and DPO are effected by the skew (Fig. (2b)). + +# 6 EXPERIMENTS + +Setup. In our experiments, we consider the offline direct preference optimization setup to learn from human preferences (Rafailov et al., 2023). In the offline setting, the goal is to train the LLM policy directly from a dataset $\mathcal{D}$ of pairwise completions $(y_{l},y_{w})$ sampled from a behavior policy $\mu$ and annotated by human raters without using a reward model or online inference/RL. We empirically test the effectiveness of SRPO against two prominent offline preference learning methods, DPO (Rafailov et al., 2023) and IPO (Azar et al., 2023) as baselines. We make this choice since both these baselines have been widely used in solving different language tasks (Tunstall et al., 2023; Wallace et al., 2023; Yuan et al., 2024a; Pang et al., 2024a; Lin et al., 2023). + +Implementation details. SRPO trains simultaneously both the standard generative policy $\pi$ and the self-improvement policy $\pi_{\dagger}$ used for revising the completions of models through a single optimization process. As explained earlier we only use a single LLM to represent both $\pi$ and $\pi_{\dagger}$ (denoted simply by $\pi$ ). To get the best completions from SRPO we first generate completions in the 0-revision (0-rev.) model and then we improve these completions with the self-improvement model. We call the revised outputs 1-revision (1-rev.) completions. We can iterate on the improvement process $N$ times to get $N$ -revision ( $N$ -rev.) completions. We report results from 0-rev. to 5-rev. cases. For IPO and DPO we also report results on 0-rev. and 1-rev. For revising the completions we use IPO and DPO in in-context learning mode with the 0-rev. completions used as contexts. In the case of DPO we use the same loss and hyper-parameters used by (Rafailov et al., 2023). For IPO since the original paper hasn't provided the hyper-parameters we used a set of hyper-parameters (i.e., learning rate and regularization constant $\beta$ ) from the range of hyper-parameters that was working. Furthermore we noticed that the performance of IPO was not affected significantly by the choice of these hyper-parameters. So no significant gain is expected by hyper-parameter tuning. + +Datasets. We use the Reddit TL;DR Summarization dataset (Stiennon et al., 2020) as the main dataset for our experiments3. For training, there are 116k human-written instruction following examples with reference completions (SFT split) while there are 93k human-annotated preference pairs (Preference split). We also use the XSum dataset test split4 (Narayan et al., 2018), which contains 11.5k total test examples to measure Out-of-Distribution (OOD) generalization. + +Model Setup. We use LLaMA-7B as base model (Touvron et al., 2023) and a single $8 \times$ NVIDIA H100 node to conduct all LLaMA-based experiments. We first SFT the model on the SFT split of the TL;DR dataset, before preference training and use the same $\pi_{\mathrm{ref}}$ for all preference training experiment. Below are details on the recipe for the SFT and preference training stages. + +Supervised-fine Tuning. In the SFT stage, we train for 2 epochs, using the AdamW optimizer (Loshchilov & Hutter, 2019), with $\beta_{1} = 0.9$ and $\beta_{2} = 0.999$ , and 0.1 weight-decay. We use a cosine decay learning rate (Loshchilov & Hutter, 2017) with a peak value of $2 \times 10^{-5}$ and $3\%$ of all steps being warm-up steps. We use an effective batch-size of 64. + +Preference Training. We use our SFT model as $\pi_{\mathrm{ref}}$ and we initialize $\pi$ with $\pi_{\mathrm{ref}}$ . All models were trained for 5 epochs on the TL; DR preference split using the same optimization setting of the AdamW optimizer as in the SFT stage with 150 warmup steps, and an effective batch-size of 128. To fine-tune the models, we use the default PEFT settings in the TRL library5, using LoRA (Hu et al., 2022) with a rank of 16 and an alpha of 32. For SRPO and IPO, we used $\beta = 0.01$ with a learning rate of $2 \times 10^{-6}$ . For DPO following Rafailov et al. (2023), we used the common $\beta = 0.1$ with a learning rate of $1 \times 10^{-6}$ and a constant learning rate schedule. + +Evaluation. We use win rates as computed by gpt-4-0613 (OpenAI, 2023) using the Alpacafarm framework (Dubois et al., 2024), as the main means for evaluation (See Sec. C.3 for more details). We measure performance on both in-distribution and OOD examples at test time in the following manner: For the former, we compute win rates against gold reference completions from the test set of the TL;DR SFT split. For the latter, we measure win rates against gold completions from the test set of the XSum dataset. In both settings, we use the first 1,024 samples from each of the test sets. To estimate the win rate more accurately with confidence intervals, we bootstrap 20 times with replacement from the 1,024 samples, each time using a sample size of 512. To sample from the + +self-improvement policy, we first sample $y$ from $\pi (\cdot |x)$ . Then, using the same policy, we condition on $y$ to sample from the self-improvement policy, that is $y^\prime \sim \pi (\cdot |y,x)$ . We refer to generations from $\pi (\cdot |x)$ as 0-rev. (0-rev.) and generations from $y^\prime \sim \pi (\cdot |y,x)$ as 1-rev. (1-rev.) (Bai et al., 2022). For $N$ -revision, we apply the same procedure, conditioning on the sample from the $N - 1^{\mathrm{th}}$ -rev. + +TL;DR Results. We test our models on the test set split of the TL;DR dataset in Fig 3 (left panel). For every model, we generate 0-rev. and then use these generations to revise our completions recursively from 1-rev. to 5-rev. using the self-improvement model, and measure the models' win rate against the human-written gold reference summaries. + +We observe that in the case of in-distribution TL;DR SRPO 4-rev. generates high-quality summaries with the highest win rate against the gold summaries, compared to the win-rates of the baseline methods, as well as other variants of SRPO 0-rev. Furthermore, we observe that SRPO self-improvement process manages to consistently improve upon SRPO 0-rev. However, DPO and IPO fail to generate an improved sample through the self-improvement step. + +Out-of-distribution (OOD) Results. To assess robustness in an OOD setting, we test SRPO models trained with TL;DR preference dataset on the XSum test split in Fig. 3 (right panel) (Narayan et al., 2018). As in the TL;DR case, we observe that self-improvement is effective in improving the performance of SRPO as SRPO 5-rev. generates the highest win rate against the gold summaries, compared to all revisions of the baseline methods, as well as prior revision of SRPO. We also observe that the gap in performance between SRPO and the baselines is significantly higher in OOD case. + +![](images/a94ac7c8fab1341a7cc1e80ffc806ae0fda8e3c85d00b68c1662ebdcd26e3557.jpg) +Figure 3: We present the win rates of SRPO, IPO, and DPO against human-written summaries (GOLD) as a function of $N$ -revisions for both in-distribution (TL;DR) and out-of-distribution (XSum) settings. The curves represent the mean win rates, with shaded areas indicating the st.dev. across 20 bootstrap evaluations. Notably, DPO and IPO show no improvements in their generations, whereas SRPO shows significant improvements with each iteration. + +![](images/e07cc96a7c325c09a2aa366c0d22ffbda3ebdfe2238dfbd11808a3f36894d38e.jpg) + +# 7 DISCUSSION AND LIMITATIONS + +In this paper we have developed Self-Improving Robust Preference Optimization (SRPO), a robust offline approach for learning from human preferences. We have proven mathematically and empirically, that unlike other offline methods like DPO and IPO, the solution of SRPO is completely independent of the behavior policy $\mu$ and thus SRPO is completely robust to changes in $\mu$ . + +Summary of results. We have tested SRPO on standard summarization tasks both on in-distribution and out-of-distribution (OOD) regimes. We have observed that in the OOD case SRPO outperforms both IPO and particularly the celebrated DPO by a clear margin in terms of win-rate against gold completions, while in the in-distribution case there is less difference between SRPO and the baselines. This is an expected behavior since in-distribution case the robustness aspect of the algorithm matters less. We have observed that although 0-revision generation of SRPO performs well, we have observed a boost across the board by revising the generation through the self-improvement model. + +Future work and Limitations. In our work we used standard and relatively simple language tasks. In the future we would like to apply SRPO to more challenging multi-task benchmarks in which the existing RLHF methods often specialize to a specific set of tasks more represented in the dataset, whereas SRPO should be more resilient due to its robustness to behavior policy $\mu$ . + +# REFERENCES + +Arash Ahmadian, Chris Cremer, Matthias Galle, Marzieh Fadaee, Julia Kreutzer, Olivier Pietquin, Ahmet Üstün, and Sara Hooker. Back to Basics: Revisiting REINFORCE Style Optimization for Learning from Human Feedback in LLMs, 2024. +Kushal Arora, Layla El Asri, Hareesh Bahuleyan, and Jackie Chi Kit Cheung. Why exposure bias matters: An imitation learning perspective of error accumulation in language generation, 2023. URL https://arxiv.org/abs/2204.01171. +Mohammad Gheshlaghi Azar, Mark Rowland, Bilal Piot, Daniel Guo, Daniele Calandriello, Michal Valko, and Rémi Munos. A general theoretical paradigm to understand learning from human preferences, 2023. +Yuntao Bai, Saurav Kadavath, Sandipan Kundu, Amanda Askell, Jackson Kernion, Andy Jones, Anna Chen, Anna Goldie, Azalia Mirhoseini, Cameron McKinnon, Carol Chen, Catherine Olsson, Christopher Olah, Danny Hernandez, Dawn Drain, Deep Ganguli, Dustin Li, Eli Tran-Johnson, Ethan Perez, Jamie Kerr, Jared Mueller, Jeffrey Ladish, Joshua Landau, Kamal Ndousse, Kamile Lukosuite, Liane Lovitt, Michael Sellitto, Nelson Elhage, Nicholas Schiefer, Noemi Mercado, Nova DasSarma, Robert Lasenby, Robin Larson, Sam Ringer, Scott Johnston, Shauna Kravec, Sheer El Showk, Stanislav Fort, Tamera Lanham, Timothy Telleen-Lawton, Tom Conerly, Tom Henighan, Tristan Hume, Samuel R. Bowman, Zac Hatfield-Dodds, Ben Mann, Dario Amodei, Nicholas Joseph, Sam McCandlish, Tom Brown, and Jared Kaplan. Constitutional ai: Harmlessness from ai feedback, 2022. +Samy Bengio, Oriol Vinyals, Navdeep Jaitly, and Noam Shazeer. Scheduled sampling for sequence prediction with recurrent neural networks. In Advances in Neural Information Processing Systems, volume 28, 2015. +Ralph Allan Bradley and Milton E Terry. Rank analysis of incomplete block designs: I. The method of paired comparisons. Biometrika, 39(3/4):324-345, 1952. +Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. Advances in neural information processing systems, 33:1877-1901, 2020. +Daniele Calandriello, Daniel Guo, Remi Munos, Mark Rowland, Yunhao Tang, Bernardo Avila Pires, Pierre Harvey Richemond, Charline Le Lan, Michal Valko, Tianqi Liu, Rishabh Joshi, Zeyu Zheng, and Bilal Piot. Human alignment of large language models through online preference optimisation, 2024. +Yiding Chen, Yihe Dong, and Tengyu Ma. Provably mitigating overoptimization in rlhf: Your sft loss is secretly regularizing. arXiv preprint arXiv:2405.16436, 2024. URL https://arxiv.org/abs/2405.16436. +Paul F. Christiano, Jan Leike, Tom Brown, Miljan Martic, Shane Legg, and Dario Amodei. Deep reinforcement learning from human preferences. In Advances in Neural Information Processing Systems, 2017. +Ganqu Cui, Lifan Yuan, Ning Ding, Guanming Yao, Wei Zhu, Yuan Ni, Guotong Xie, Zhiyuan Liu, and Maosong Sun. Ultrafeedback: Boosting language models with high-quality feedback. arXiv preprint arXiv:2310.01377, 2023. URL https://arxiv.org/abs/2310.01377. +Abhimanyu Dubey and 532 others. The llama 3 herd of models. arXiv preprint arXiv:2407.21783, 2024. URL https://arxiv.org/abs/2407.21783. +Yann Dubois, Xuechen Li, Rohan Taori, Tianyi Zhang, Ishaan Gulrajani, Jimmy Ba, Carlos Guestrin, Percy Liang, and Tatsunori B. Hashimoto. Alpacafarm: A simulation framework for methods that learn from human feedback, 2024. +Nathan Grinsztajn, Yannis Flet-Berliac, Mohammad Gheshlaghi Azar, Florian Strub, Bill Wu, Eugene Choi, Chris Cremer, Arash Ahmadian, Yash Chandak, Olivier Pietquin, and Matthieu Geist. Averaging log-likelihoods in direct alignment. arXiv preprint arXiv:2406.19188, 2024. URL https://arxiv.org/abs/2406.19188. + +Shangmin Guo, Biao Zhang, Tianlin Liu, Tianqi Liu, Misha Khalman, Felipe Llinares, Alexandre Rame, Thomas Mesnard, Yao Zhao, Bilal Piot, Johan Ferret, and Mathieu Blondel. Direct language model alignment from online ai feedback, 2024. URL https://arxiv.org/abs/2402.04792. +Chi Hu et al. Teaching language models to self-improve by learning from language feedback. arXiv preprint arXiv:2406.07168, 2024. +Edward J Hu, yelong shen, Phillip Wallis, Zeyuan Allen-Zhu, Yanzhi Li, Shean Wang, Lu Wang, and Weizhu Chen. LoRA: Low-rank adaptation of large language models. In International Conference on Learning Representations, 2022. URL https://openreview.net/forum?id=nZeVKeeFYf9. +Jiaxin Huang, Shixiang Shane Gu, Le Hou, Yuexin Wu, Xuezhi Wang, Hongkun Yu, and Jiawei Han. Large language models can self-improve, 2022. +Robert Kirk, Ishita Mediratta, Christoforos Nalmpantis, Jelena Luketina, Eric Hambro, Edward Grefenstette, and Roberta Raileanu. Understanding the effects of rlhf on llm generalisation and diversity, 2024. +Aviral Kumar, Vincent Zhuang, Rishabh Agarwal, Yi Su, John D Co-Reyes, Avi Singh, Kate Baumli, Shariq Iqbal, Colton Bishop, Rebecca Roelofs, Lei M Zhang, Kay McKinney, Disha Shrivastava, Cosmin Paduraru, George Tucker, Doina Precup, Feryal Behbahani, and Aleksandra Faust. Training language models to self-correct via reinforcement learning, 2024. URL https://arxiv.org/abs/2409.12917. +Zhuorong Li, Daiwei Yu, Lina Wei, Canghong Jin, Yun Zhang, and Sixian Chan. Soften to defend: Towards adversarial robustness via self-guided label refinement. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 24776-24785, 2024a. +Ziniu Li, Tian Xu, and Yang Yu. Policy optimization in rlhf: The impact of out-of-preference data, 2024b. +Yong Lin, Lu Tan, Hangyu Lin, Zeming Zheng, Renjie Pi, Jipeng Zhang, Shizhe Diao, Haoxiang Wang, Han Zhao, Yuan Yao, et al. Speciality vs generality: An empirical study on catastrophic forgetting in fine-tuning foundation models. arXiv preprint arXiv:2309.06256, 2023. +Hao Liu, Carmelo Sferrazza, and Pieter Abbeel. Chain of hindsight aligns language models with feedback, 2023. +Ilya Loshchilov and Frank Hutter. Sgdr: Stochastic gradient descent with warm restarts, 2017. +Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization, 2019. +Aman Madaan, Niket Tandon, Prakhar Gupta, Skyler Hallinan, Luyu Gao, Sarah Wiegrefe, Uri Alon, Nouha Dziri, Shrimai Prabhumoye, Yiming Yang, et al. Self-refine: Iterative refinement with self-feedback. Advances in Neural Information Processing Systems, 36, 2024. +Yu Meng, Mengzhou Xia, and Danqi Chen. SimPO: Simple preference optimization with a reference-free reward. arXiv preprint arXiv:2405.14734, 2024. URL https://arxiv.org/abs/2405.14734. +Rémi Munos, Michal Valko, Daniele Calandriello, Mohammad Gheshlaghi Azar, Mark Rowland, Zhaohan Daniel Guo, Yunhao Tang, Matthieu Geist, Thomas Mesnard, Andrea Michi, Marco Selvi, Sertan Girgin, Nikola Momchev, Olivier Bachem, Daniel J. Mankowitz, Doina Precup, and Bilal Piot. Nash learning from human feedback, 2023. +Shashi Narayan, Shay B. Cohen, and Mirella Lapata. Don't give me the details, just the summary! topic-aware convolutional neural networks for extreme summarization. In Ellen Riloff, David Chiang, Julia Hockenmaier, and Jun'ichi Tsujii (eds.), Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pp. 1797-1807, Brussels, Belgium, October-November 2018. Association for Computational Linguistics. doi: 10.18653/v1/D18-1206. URL https://aclanthology.org/D18-1206. + +OpenAI. Gpt-4 technical report, 2023. +Long Ouyang, Jeffrey Wu, Xu Jiang, Diogo Almeida, Carroll Wainwright, Pamela Mishkin, Chong Zhang, Sandhini Agarwal, Katarina Slama, Alex Ray, John Schulman, Jacob Hilton, Fraser Kelton, Luke Miller and Maddie Simens, Amanda Askell, Peter Welinder, Paul Christiano, Jan Leike, and Ryan Lowe. Training language models to follow instructions with human feedback. In Advances in Neural Information Processing Systems, 2022. +Richard Yuanzhe Pang, Weizhe Yuan, Kyunghyun Cho, He He, Sainbayar Sukhbaatar, and Jason Weston. Iterative reasoning preference optimization, 2024a. +Richard Yuanzhe Pang, Weizhe Yuan, Kyunghyun Cho, He He, Sainbayar Sukhbaatar, and Jason Weston. Iterative reasoning preference optimization, 2024b. URL https://arxiv.org/abs/2404.19733. +Rafael Rafailov, Archit Sharma, Eric Mitchell, Stefano Ermon, Christopher D. Manning, and Chelsea Finn. Direct preference optimization: Your language model is secretly a reward model. arXiv, 2023. +Paul Roit, Johan Ferret, Lior Shani, Roeaharoni, Geoffrey Cideron, Robert Dadashi, Matthieu Geist, Sertan Girgin, Leónard Hussenot, Orgad Keller, et al. Factually consistent summarization via reinforcement learning with textual entailment feedback. arXiv preprint arXiv:2306.00186, 2023. +Corby Rosset, Ching-An Cheng, Arindam Mitra, Michael Santacroce, Ahmed Awadallah, and Tengyang Xie. Direct nash optimization: Teaching language models to self-improve with general preferences, 2024. +John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms. arXiv, 2017. +Yuda Song, Gokul Swamy, Aarti Singh, J. Andrew Bagnell, and Wen Sun. The importance of online data: Understanding preference fine-tuning via coverage, 2024. URL https://arxiv.org/abs/2406.01462. +Nisan Stiennon, Long Ouyang, Jeffrey Wu, Daniel Ziegler, Ryan Lowe, Chelsea Voss, Alec Radford, Dario Amodei, and Paul F Christiano. Learning to summarize with human feedback. In H. Larochelle, M. Ranzato, R. Hadsell, M.F. Balcan, and H. Lin (eds.), Advances in Neural Information Processing Systems, volume 33, pp. 3008-3021. Curran Associates, Inc., 2020. URL https://proceedings.neurips.cc/paper_files/paper/2020/file/1f89885d556929e98d3ef9b86448f951-Paper.pdf. +Fahim Tajwar, Anikait Singh, Archit Sharma, Rafael Rafailov, Jeff Schneider, Tengyang Xie, Stefano Ermon, Chelsea Finn, and Aviral Kumar. Preference fine-tuning of llms should leverage suboptimal, on-policy data, 2024. URL https://arxiv.org/abs/2404.14367. +Yunhao Tang, Zhaohan Daniel Guo, Zeyu Zheng, Daniele Calandriello, Rémi Munos, Mark Rowland, Pierre Harvey Richemond, Michal Valko, Bernardo Ávila Pires, and Bilal Piot. Generalized preference optimization: A unified approach to offline alignment, 2024. +Emanuel Todorov. Linearly-solvable markov decision problems. Advances in neural information processing systems, 19, 2006. +Hugo Touvron, Thibaut Lavril, Gautier Izacard, Xavier Martinet, Marie-Anne Lachaux, Timothée Lacroix, Baptiste Roziere, Naman Goyal, Eric Hambro, Faisal Azhar, Aurelien Rodriguez, Armand Joulin, Edouard Grave, and Guillaume Lample. Llama: Open and efficient foundation language models, 2023. +Lewis Tunstall, Edward Beeching, Nathan Lambert, Nazneen Rajani, Kashif Rasul, Younes Belkada, Shengyi Huang, Leandro von Werra, Clémentine Fourrier, Nathan Habib, Nathan Sarrazin, Omar Sanseviero, Alexander M. Rush, and Thomas Wolf. Zephyr: Direct distillation of Im alignment, 2023. + +Bram Wallace, Meihua Dang, Rafael Rafailov, Linqi Zhou, Aaron Lou, Senthil Purushwalkam, Stefano Ermon, Caiming Xiong, Shafiq Joty, and Nikhil Naik. Diffusion model alignment using direct preference optimization. arXiv preprint arXiv:2311.12908, 2023. +Chaoqi Wang, Yibo Jiang, Chenghao Yang, Han Liu, and Yuxin Chen. Beyond reverse kl: Generalizing direct preference optimization with diverse divergence constraints. arXiv preprint arXiv:2309.16240, 2023. +Jason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma, Brian Ichter, Fei Xia, Ed Chi, Quoc Le, and Denny Zhou. Chain-of-thought prompting elicits reasoning in large language models, 2023. +Shusheng Xu, Wei Fu, Jiaxuan Gao, Wenjie Ye, Weilin Liu, Zhiyu Mei, Guangju Wang, Chao Yu, and Yi Wu. Is dpo superior to ppo for llm alignment? a comprehensive study, 2024. URL https://arxiv.org/abs/2404.10719. +Yifan Xu, Kening Zhang, Haoyu Dong, Yuezhou Sun, Wenlong Zhao, and Zhuowen Tu. Rethinking exposure bias in language modeling, 2020. URL https://arxiv.org/abs/1910.11235. +Shunyu Yao, Dian Yu, Jeffrey Zhao, Izhak Shafran, Tom Griffiths, Yuan Cao, and Karthik Narasimhan. Tree of thoughts: Deliberate problem solving with large language models. Advances in Neural Information Processing Systems, 36, 2024. +Weizhe Yuan, Richard Yuanzhe Pang, Kyunghyun Cho, Xian Li, Sainbayar Sukhbaatar, Jing Xu, and Jason Weston. Self-rewarding language models, 2024a. +Weizhe Yuan, Richard Yuanzhe Pang, Kyunghyun Cho, Xian Li, Sainbayar Sukhbaatar, Jing Xu, and Jason Weston. Self-rewarding language models, 2024b. URL https://arxiv.org/abs/2401.10020. +Zheng Yuan, Hongyi Yuan, Chuanqi Tan, Wei Wang, Songfang Huang, and Fei Huang. RRHF: Rank responses to align language models with human feedback without tears. arXiv preprint arXiv:2304.05302, 2023. URL https://arxiv.org/abs/2304.05302. +Yao Zhao, Rishabh Joshi, Tianqi Liu, Misha Khalman, Mohammad Saleh, and Peter J Liu. SLiC-HF: Sequence likelihood calibration with human feedback. arXiv, 2023a. +Yao Zhao, Rishabh Joshi, Tianqi Liu, Misha Khalman, Mohammad Saleh, and Peter J. Liu. SLC-HF: Sequence likelihood calibration with human feedback. arXiv, 2023b. + +# A RELATED WORKS + +Our work lies in offline preference optimization, a vivid area of research since the introduction of DPO (Rafailov et al., 2023). Some of the core concepts of this research topic was generalized and formalized by Azar et al. (2023). In particular they characterized the underlying optimal solution for a generic preference optimization objective and introduced IPO for addressing some of the related shortcomings of DPO. SLiC-HF (Zhao et al., 2023a) was introduced around the same time, from a less RL-centric point of view. All these approaches have been abstracted later by Tang et al. (2024), the general recipe being to build a contrastive loss function from a convex classification function and to make use of the analytical solution of the RL problem to learn directly the policy. A common underlying assumption is that the related RL problem is KL-regularized. This has been generalized to more general $f$ -divergences by Wang et al. (2023). These are just a few among many works on direct alignment (Tajwar et al., 2024; Xu et al., 2024; Guo et al., 2024; Yuan et al., 2024b; Song et al., 2024). However, they all share the fact of not considering self-improvement policies, contrary to SRPO. Concurrent to this work Kumar et al. (2024) use online RLHF for learning self-correcting model. However unlike our method which aims at maximizing the preference of improved completion with respect to the in-context completion their work focuses on maximizing the reward of final answer. The issue with this approach is that the model can simply ignore the in-context completion and try to optimize the final completion without paying attention to in-context completions. + +Offline preference optimization was introduced as an alternative to more classic RLHF approaches, such as PPO (Schulman et al., 2017; Ouyang et al., 2022) or more generally policy-gradient-based approaches (Roit et al., 2023; Ahmadian et al., 2024). These methods require training a reward model on a preference dataset, usually with a Bradley-Terry model (Bradley & Terry, 1952). The reward model is then used to fine-tune the LLM via online RL, requiring many generations from the model. This reward model shares the common issue of DPO and other direct preference alignment methods, it is dependent on the sampling distribution $\mu$ used for constructing the preference dataset, contrary to SRPO. Moreover, classic RLHF is online, while SRPO is offline and thus more easily scalable. + +Some similarities also exist between SRPO and Nash-MD (Munos et al., 2023). Indeed, if in 1 we replace the self-improvement policy $\pi_{\dagger}(\cdot |y,x)$ by a classic policy $\pi (\cdot |x)$ , then we obtain the saddle-point optimization problem that Nash-MD solves. However, considering a self-improvement policy is a core contribution of our work, and it is not anecdotal. From a technical viewpoint, this is critical for simplifying the minimax problem of Eq. (1) and obtaining a simple offline optimization problem. NashMD on the other hand adapts algorithms from the game-theory literature and can only be solved online with all the stability issues of online methods and large inference costs. From practical point of view self-improvement provides a boost in performance by refining the original generations of LLM. The feature that Nash-MD is missing. Finally, even though the Nash equilibrium of Nash-MD does not depend on the sampling distribution $\mu$ , it relies on a learned reward function, with the possible associated caveats mentioned earlier, which is not the case of SRPO. + +Our work is also obviously related to the concept of chain of thoughts (Wei et al., 2023; Yao et al., 2024), self-improvement (Huang et al., 2022) and self-refining LLMs (Madaan et al., 2024). However, it is very often used as a way of prompting a model to obtain better results, and less often as a component of a learning paradigm (Liu et al., 2023; Huang et al., 2022). A notable exception is the recent work of (Pang et al., 2024b) that generalizes DPO to incorporate chain of thoughts. However the main focus of this work is mostly on improving the chain of thoughts reasoning and not on self-improvement. To our best knowledge, we propose the first approach that combines training self-improvement LLMs and offline preference optimization through a single supervised objective, moreover in a theoretically grounded manner and showing the robustness to $\mu$ . + +# B ABLATION: THE EFFECT OF COMBINATION COEFFICIENT $\alpha$ ON SRPO PERFORMANCE + +SRPO loss of Eq. (17) is a convex combination of two losses $\widehat{L}$ and $\widehat{L}_{\dagger}$ via the combination coefficient $\alpha$ . To understand how both terms affects the loss we plot the win rates both in in-distribution case and OOD case as a function of $\alpha$ in Fig. 4. We observe that the term that contributes most to the performance of SRPO is $\widehat{L}_{\dagger}$ as in the case of $\alpha = 1$ when we only use the loss for improvement model $\widehat{L}_{\dagger}$ we almost match the best performance. On the other hand using only $\widehat{L}$ (i.e., $\alpha = 0$ ) is not + +enough to achieve top performance. We also observe combining both losses seems to provide some boost in performance especially in OOD case. + +![](images/44e2107fcd1b0a2384b79e2623b0dd5144b1aa35eb4f773d319dc029b7c88736.jpg) +Figure 4: We present the win rates of SRPO against human-written summaries (GOLD) as a function of $N$ -revision iterations at different $\alpha$ values. We report their mean (curve) $\pm$ st.dev. (shaded area), across 20 bootstrap evaluations, as described in the Evaluation section. We observe that SRPO achieves meaningful iterative improvements capability as the value of $\alpha$ increases. + +![](images/08a8048756e7b99142bcb65f391cd286128659e0fae32f15a22b8a0adbacac1f.jpg) + +# C EXPERIMENTAL DETAILS + +We provide the prompt templates used for training and evaluations in section 6. + +# C.1 PROMPTTEMPLATES + +# C.1.1 TL;DR + +# 0-revision: + +Below is a reddit POST and the corresponding SUBREDDIT and TITLE. Write a both precise and concise summary of the contents of the POST. + +```txt +SUBREDDIT: ${subreddit} +TITLE: ${title} +POST: ${post} +TL;DR: +``` + +# N-revision: + +Below is a reddit POST and the corresponding SUBREDDIT, TITLE, and an EXAMPLE SUMMARY. Write a both precise and concise summary of the contents of the POST. + +```txt +SUBREDDIT: ${subreddit} +TITLE: ${title} +POST: ${post} +EXAMPLE SUMMARY: ${(N-1)th_example_summary} +TL;DR: +``` + +# C.1.2 XSUM + +# 0-revision: + +Below is a news ARTICLE and the corresponding ID and TITLE. Write a both precise and concise summary of the contents of the ARTICLE. + +```makefile +ID: ${id} +TITLE: ${title} +ARTICLE: ${article} +TL;DR: +``` + +# N-revision: + +Below is a news ARTICLE and the corresponding ID, TITLE, and an EXAMPLE SUMMARY. Write a both precise and concise summary of the contents of the ARTICLE. + +```makefile +ID: ${id} +TITLE: ${title} +ARTICLE: ${article} +EXAMPLE SUMMARY: ${(N-1)th_example.summary} +TL;DR: +``` + +# C.2 EXAMPLE SUMMARIES + +# C.2.1 TL;DR + +
PostI have a horrible caffeine addiction, and I don't like sacrificing any of my daily calories for coffee. I used to drink 5-6 Diet Dr. Peppers a day, but I have switched to almost exclusively drinking only water most days. I do have a Diet Dr. Pepper occasionally, and I know that technically it's okay to probably have one a day, but I honestly just feel better all around when I drink only water. But if I don't have some caffeine in the morning, I will be writhing in the floor in pain with a skull-pounding headache by mid-day. I know. Ridiculous, right?
So, I went to the vitamin aisle the other day in search of a supplement with a little caffeine and the only thing I found was One A Day Adult Vitacraves Gummies with Energy Support. Here's the website with [nutritional info] One serving is 20 calories and has 90 mg of caffeine. There's also some vitamin B6, B12, and folic acid in there that supposedly helps turn food into energy. I have no idea if that's true. I've been taking them a couple days, and so far I do feel more energized and I haven't had any headaches. The issue is that one bottle is around $9 and there are only 60 in a bottle. You have to take 4 (4!) a day, which is very intriguing considering the brand name and all. So it'll cost me around $20 a month. Which is admittedly cheaper than what I used to spend on Diet Dr. Peppers, but still. I was just curious if anyone else had a better option for caffeine in a supplement or vitamin?
GOLDThe vitamin with caffeine I'm taking is on the expensive side, and I'm a self-proclaimed tightwad. Anyone have better options?
SRPO 1-rev.I have a caffeine addiction and need a little bit of caffeine in my day. I'm taking One A Day Adult Vitacraves Gummies with Energy Support, but it's expensive ($20/month). Any other suggestions for a caffeine supplement or vitamin?
SRPO 0-rev.I have a terrible caffeine addiction and need a little caffeine in my day. I found a vitamin with caffeine in it, but it's pretty expensive. Any other suggestions for a caffeine supplement or vitamin?
IPO 1-rev.I have a caffeine addiction and need some in my system every day to function, but I don't like sacrificing calories for coffee. I've found a supplement with caffeine, but it's expensive. Anyone have a better option?
IPO 0-rev.I have a caffeine addiction and need some in my system every day to function, but I don't like sacrificing calories for coffee. I've found a supplement with caffeine, but it's expensive. Anyone have a better option?
DPO 1-rev.I have a caffeine addiction and I need a supplement or vitamin that has caffeine in it to take a couple times a week so that I don't have a headache all day. Any recommendations?
DPO 0-rev.I have a caffeine addiction and I need a supplement or vitamin that has caffeine in it to take a couple times a week so that I don't have a headache all day. Any recommendations?
+ +# C.2.2 XSUM + +
ArticleA paper detailing its proposals focuses on the need to avoid a hard border. The government stresses there should be no physical infrastructure, such as customs posts, at the border, which has almost 300 crossing points. Critics say the proposals lack credible detail, with Labour deriding the plans for the border as "a fantasy frontier". The government's paper does not envisage CCTV cameras or number plate recognition technology at the border, or set back from it. Instead, the government is arguing for a wide-ranging exemption under which small and medium-sized businesses will not have to comply with any new customs tariffs. Northern Ireland is the only part of the UK that will share a land border with an EU state post-Brexit. The future management of that border is a highly sensitive issue and is one of three main priorities in UK-EU Brexit negotiations. ... What is the customs union? Countries in the customs union do not impose tariffs - taxes on imports - on each other's goods. Every country inside the union levies the same tariffs on imports from abroad. So, for example, a 10% tariff is imposed on some cars imported from outside the customs union, while 7.5% is imposed on roasted coffee. Other goods - such as soap or slate - have no tariffs. The UK has said it is leaving the EU's customs union because as a member it is unable to strike trade deals with other countries.
GOLDThe government has said there must be an "unprecedented solution" for the border between Northern Ireland and the Republic after Brexit.
SRPO 1-rev.The UK wants to avoid a hard border between Northern Ireland and the Republic of Ireland after Brexit by proposing two customs models to the EU. The UK also dismisses the idea of a customs border in the Irish Sea.
SRPO 0-rev.Brexit Secretary David Davis wants a limited transition period to implement new customs arrangements, including consideration of the "unique circumstances" of Northern Ireland and the Republic of Ireland. The UK is trying to prevent the need for physical customs posts along the Irish border.
IPO 1-rev.Theresa May wants a 'seamless' border between Northern Ireland and the Republic of Ireland after Brexit - but the EU may not accept that as viable. The UK government has published a position paper setting out its ideas on the issue.
IPO 0-rev.Theresa May wants a 'seamless' border between the Republic of Ireland and Northern Ireland after Brexit - but the EU may not accept that as viable. The UK government has published a position paper setting out its ideas on the issue.
DPO 1-rev.the UK is proposing a "new customs partnership" or a "highly streamlined customs arrangement" to prevent a hard border between Northern Ireland and the Republic of Ireland, in the event of no deal being reached over Brexit.
DPO 0-rev.the UK is proposing a "new customs partnership" or a "highly streamlined customs arrangement" to prevent a hard border between Northern Ireland and the Republic of Ireland, in the event of no deal being reached over Brexit.
ArticleIt follows a row over the removal of personal items from graves in Torfaen which were sent to rubbish tips. Nearly 2,000 people signed a petition calling for legislation on the issue. Public Services Minister Leighton Andrews said he was sympathetic but believed it was a matter for each local authority to "develop and justify their own approaches". Torfaen council said in June 2014 it had organised the clear-up because the over-personalisation of graves in some cemeteries had prompted complaints and made maintenance difficult. The authority apologised for any upset, but said it had made efforts to inform people about the clear-up and had allowed them two months to collect any items they wanted to keep.
GOLDCalls for a Wales-wide law stating what tributes can be placed on children's graves have been rejected by ministers.
SRPO {1,...,5}-rev.Public Services Minister Leighton Andrews has rejected a petition calling for legislation on the removal of personal items from graves, saying it was a matter for each local authority to "develop and justify their own approaches".
SRPO 0-rev.Public Services Minister Leighton Andrews has rejected a petition calling for legislation on the removal of personal items from graves.
IPO {0,...,5}- rev.Vicky Pryce wanted revenge on ex-MP Chris Huhne over him getting points on his licence, so she took the speeding points for him in 2003, a court heard.
DPO {0,...,5}- rev.Vicky Pryce told court she signed speeding points form for her husband Chris Huhne in revenge for him threatening their marriage over his speeding points.
+ +# C.3 EVALUATION DETAILS: CALCULATING WIN-RATE + +Calculating the win-rate of AI models, especially in the context of comparisons against human performance or other models, involves several parameters and methodologies. In particular to calculate the win-rate of AI model vs. human, we follow these steps: + +1. We run the trained model on the same input data as the test set of supervised dataset and we generate multiple completions. +2. We compare the completions using gpt-4 with the corresponding ground truth completions of supervised dataset by assigning a point system based on outcomes (e.g., 1 for win, 0.5 for draw, 0 for loss). +3. We aggregate scores across rounds for each model and calculate the win rate. + +In particular we use the following formula to calculate the win rate: + +$$ +\text {W i n R a t e} = \frac {\text {N u m b e r o f W i n s b y M o d e l}}{\text {T o t a l R o u n d s}} +$$ + +We also report confidence intervals to indicate statistical reliability. + +# D EXPERIMENTS ON ULTRA FEEDBACK + +Setup. In our experiments, we consider the offline direct preference optimization setup to learn from human preferences (Rafailov et al., 2023). We empirically test the effectiveness of SRPO against two prominent offline preference learning methods, DPO (Rafailov et al., 2023) and IPO (Azar et al., 2023) as baselines. We also consider two popular extensions of DPO, namely, SIMIPO (Meng et al., 2024) and RPO (Chen et al., 2024). + +Implementation details. In the case of SRPO and all baselines we optimize the regularization coefficient $\beta$ and the learning rate by hyper-parameter sweep over a range of possible parameters. (In the case of RPO we also sweep over the cross-entropy coefficient.) Also following on the recent line of work that shows using average log-likelihood is advantageous to using sum log-likelihood + +in domains with varying completion length we use the average log-likelihood variant of IPO, DPO, RPO and SRPO (Grinsztajn et al., 2024; Yuan et al., 2023). + +Datasets. We use the ShareGPT-Vicuna dataset for SFT, a filtered version of the original dataset containing 53k prompt and completion pairs. For our preference training, we use the binarized version of the UltraFeedback (Cui et al., 2023), which contains 64k pairwise preference data generated by various AI chatbots. For the win-rate evaluation, we use the Arena-Hard dataset, which contains 500 prompts, to test against LLaMA-3.1-8B Instruct(Dubey & others, 2024), an official post-trained version of LLaMA-3.1-8B Base model by the Meta LLaMA team. We generated completions using LLaMA-3.1-8B Instruct(Dubey & others, 2024) and Arena-Hard prompts, which we later used to compute win-rates against. + +Model Setup. We use LLaMA-3.1-8B Base as base model (Dubey & others, 2024) and a Google cloud v5litepod-256 TPUs to conduct all LLaMA-based training and evaluation. We first SFT the LLaMA-3.1-8B Base on the ShareGPT dataset. Then, we used the SFT checkpoint to initialize all preference training experiments. Below are details on the recipe for the SFT and preference training stages. + +Supervised-fine Tuning. In the SFT stage, we train for a single epoch, using the Adam optimizer (Loshchilov & Hutter, 2019), with $\beta_{1} = 0.9$ and $\beta_{2} = 0.999$ . We use a cosine decay learning rate scheduler(Loshchilov & Hutter, 2017) with a peak value of $2.5 \times 10^{-5}$ , and decay it down to $1.25 \times 10^{-5}$ . We use 10 warm-up steps and an effective batch-size of 64. + +Preference Training. For a fair comparison across different methods, we initialize all models using the same SFT checkpoint and train them for 1 epoch using the same Adam optimizer setting: we used a learning rate of $1.25 \times 10^{-6}$ , with a cosine learning rate scheduler to decay it down to $1.25 \times 10^{-7}$ with 128 warm-up steps, and an effective batch-size of 32. $\beta_{1}$ and $\beta_{2}$ values of the Adam optimizer are the same as the ones used for the SFT stage. We used the following values of $\beta$ : $\beta_{\mathrm{SRPO}} = 1.3$ , $\beta_{\mathrm{IPO}} = 1.0$ , $\beta_{\mathrm{DPO}} = 10.0$ , $\beta_{\mathrm{RPO}} = 10.0$ , and $\beta_{\mathrm{SIMIPO}} = 50.0$ . For RPO, we used $1.0 \times 10^{-5}$ as the weight of cross entropy loss on the preferred completions, which is then scaled by $\beta$ . + +To fine-tune the models, we use a training pipeline based on OPTAX and FLAX libraries of JAX. + +Evaluation. We use win rates as computed by gpt-40 (OpenAI, 2023), as the main means for evaluation (See Sec. C.3 for more details). + +Arena-Hard Results. We test our models using the prompts from the Arena-Hard dataset in Fig 5. For every model, we generate 0-rev. and then use these generations to revise our completions recursively from 1-rev. to 5-rev. using the self-improvement model, and measure the models' win rate against the generations of LLaMA-3.1-8B-Instruct model for the same prompt. + +We observe that srpo 1-rev. produces the highest-quality completions, outperforming both baseline methods and other revisions of SRPO in terms of win rates by a significant margin. Notably, we also observe a significant drop in the win rates for all models after just one revision. + +Additionally, we present SRPO's head-to-head win rate results against DPO, IPO, RPO, and SIMIPO at 0-rev. and 1-rev. We see that SRPO outperforms all other methods at both 0-rev. and 1-rev. + +Table 1: ArenaHard head2head results - SRPO's WR + +
vs.DPO 0-rev.IPO 0-rev.RPO 0-rev.SIMPO 0-rev.
SRPO 0-rev.53.67%51.10%51.30%63.1%
vs.DPO 1-rev.IPO 1-rev.RPO 1-rev.SIMPO 1-rev.
SRPO 1-rev.67.50%57.50%58.30%74.90%
+ +![](images/ea6dfb270e0b5dde2402dfda25679065a5e345d805c9cf33c8112e9e2ca09159.jpg) +Figure 5: We present the win rates of SRPO, IPO, DPO, SIMIPO and RPO against LLaMA-3.1-8B-Instruct as a function of $N$ -revisions for Arena-hard prompts setting. The curves represent the mean win rates, with shaded areas indicating the st.dev. across 20 bootstrap evaluations. Notably SRPO dominates the win-rates of all other methods across all revision steps. \ No newline at end of file diff --git a/ICLR/2025/Self-Improving Robust Preference Optimization/images.zip b/ICLR/2025/Self-Improving Robust Preference Optimization/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..40d0ef4a45036cf3e7f3a3140773e1f92905bd2a --- /dev/null +++ b/ICLR/2025/Self-Improving Robust Preference Optimization/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:78f2936c1873a77e87c426337d0d5e64be9beba2786294630f72d611e3b7e5bb +size 1285471 diff --git a/ICLR/2025/Self-Improving Robust Preference Optimization/layout.json b/ICLR/2025/Self-Improving Robust Preference Optimization/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..4f849915ceafe1e13ad7f21df31c83bb26df092f --- /dev/null +++ b/ICLR/2025/Self-Improving Robust Preference Optimization/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d0f564704eb3b8e98615c9157d1c0fde3a5c3ec1f6e25a3706a8e49b00299e09 +size 757074 diff --git a/ICLR/2025/Self-Introspective Decoding_ Alleviating Hallucinations for Large Vision-Language Models/92834eb4-610f-4183-ba34-377ff5a82cde_content_list.json b/ICLR/2025/Self-Introspective Decoding_ Alleviating Hallucinations for Large Vision-Language Models/92834eb4-610f-4183-ba34-377ff5a82cde_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..7fcb558459a8ca85dfc1c3ea26b38280fb82e13d --- /dev/null +++ b/ICLR/2025/Self-Introspective Decoding_ Alleviating Hallucinations for Large Vision-Language Models/92834eb4-610f-4183-ba34-377ff5a82cde_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:222aa5238558f0c915335f046f1f9a66a9175e143c740b85b3abc5ebe4236dc7 +size 165662 diff --git a/ICLR/2025/Self-Introspective Decoding_ Alleviating Hallucinations for Large Vision-Language Models/92834eb4-610f-4183-ba34-377ff5a82cde_model.json b/ICLR/2025/Self-Introspective Decoding_ Alleviating Hallucinations for Large Vision-Language Models/92834eb4-610f-4183-ba34-377ff5a82cde_model.json new file mode 100644 index 0000000000000000000000000000000000000000..ca3bb60a586bf41892155100c6731c4e4be626d6 --- /dev/null +++ b/ICLR/2025/Self-Introspective Decoding_ Alleviating Hallucinations for Large Vision-Language Models/92834eb4-610f-4183-ba34-377ff5a82cde_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:406ee8b7572b899f565909d26c19dcfd7632a00e9fdda76ff87ce01b01321665 +size 203863 diff --git a/ICLR/2025/Self-Introspective Decoding_ Alleviating Hallucinations for Large Vision-Language Models/92834eb4-610f-4183-ba34-377ff5a82cde_origin.pdf b/ICLR/2025/Self-Introspective Decoding_ Alleviating Hallucinations for Large Vision-Language Models/92834eb4-610f-4183-ba34-377ff5a82cde_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..61a14ef38ab76d33b8befd24c4e2ecf883bbbf3f --- /dev/null +++ b/ICLR/2025/Self-Introspective Decoding_ Alleviating Hallucinations for Large Vision-Language Models/92834eb4-610f-4183-ba34-377ff5a82cde_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:56df2045d2f52db7d929bcbdc5587872fe2d8f9d751e624760a11a6cec020e3c +size 8778614 diff --git a/ICLR/2025/Self-Introspective Decoding_ Alleviating Hallucinations for Large Vision-Language Models/full.md b/ICLR/2025/Self-Introspective Decoding_ Alleviating Hallucinations for Large Vision-Language Models/full.md new file mode 100644 index 0000000000000000000000000000000000000000..d74e8a41fc1d7f1c074bed95e340681afde44653 --- /dev/null +++ b/ICLR/2025/Self-Introspective Decoding_ Alleviating Hallucinations for Large Vision-Language Models/full.md @@ -0,0 +1,615 @@ +# SELF-INTROSPECTIVE DECODING: ALLEVIATING HALLUCINATIONS FOR LARGE VISION-LANGUAGE MODELS + +Fushuo Huo $^{1*}$ , Wenchao Xu $^{2\dagger}$ , Zhong Zhang $^{3}$ , Haozhao Wang $^{4}$ , Zhicheng Chen $^{5}$ , Peilin Zhao $^{3\dagger}$ + +$^{1}$ Department of Computing, The Hong Kong Polytechnic University + +$^{2}$ Division of Integrative Systems and Design, Hong Kong University of Science and Technology + +$^{3}$ Tencent AI Lab, $^{4}$ Huazhong University of Science and Technology, $^{5}$ Tsinghua University wenchaoxu.ru@gmail.com, masonzhao@tencent.com + +# ABSTRACT + +Hallucination remains a significant challenge in Large Vision-Language Models (LVLMs). To alleviate this issue, some methods, known as contrastive decoding, induce hallucinations by manually disturbing the raw vision or instruction inputs and then mitigate them by contrasting the outputs of the original and disturbed LVLMs. However, these holistic input disturbances sometimes induce potential noise and also double the inference cost. To tackle these issues, we propose a simple yet effective method named Self-Introspective Decoding (SID). Our empirical investigations reveal that pre-trained LVLMs can introspectively assess the importance of vision tokens based on preceding vision and text (both instruction and generated) tokens. Leveraging this insight, we develop the Context and Text-aware Token Selection $(\mathrm{CT}^2\mathrm{S})$ strategy, which preserves only the least important vision tokens after the early decoder layers, thereby adaptively amplify vision-and-text association hallucinations during auto-regressive decoding. This strategy ensures that multimodal knowledge absorbed in the early decoder layers induces multimodal contextual rather than aimless hallucinations, and significantly reduces computation burdens. Subsequently, the original token logits subtract the amplified fine-grained hallucinations, effectively alleviating hallucinations without compromising the LVLMs' general ability. Extensive experiments illustrate that SID generates less-hallucination and higher-quality texts across various metrics, without much additional computation cost. + +# 1 INTRODUCTION + +Recent advancements in Large Language Models (LLMs) (Touvron et al., 2023a; Bai et al., 2023a; Chiang & Li, 2023; Touvron et al., 2023b; Meta, 2024) have demonstrated great success over the past few years. Many efforts have been made to extend LLMs to Large Vision-Language Models (LVLMs) (Ye et al., 2023; Li et al., 2023a; Bai et al., 2023b; Li et al., 2023c; Dai & et al, 2023; Liu et al., 2024b; Bavishi et al., 2023; Young et al., 2024; Li et al., 2024), achieving impressive performance across various vision tasks (Li et al., 2023b; Zhang et al., 2023) as well as more complex tasks like content comprehension (Lai et al., 2024) and generation (Geng et al., 2024). + +Despite their extraordinary versatility, LVLMs face a significant challenge known as the 'hallucination'. Concretely, hallucinated texts are fluent and semantically coherent but contain incorrect statements about the given image, e.g., generating irrelevant or meaningless responses, identifying inaccurate colors, numbers, and locations of objects not present in the image (Huang et al., 2024). This flaw in LVLMs poses a significant risk for real-world applications to become trustworthy AI assistants. For instance, in model-assisted computer-aided diagnosis scenarios (Wang et al., 2023), such misinterpretation of medical images could lead to serious medical accidents. + +![](images/35f8fee9af834fa03993cb8a7189177f5ea103c963be1b61ba35ec1ca2b84fd7.jpg) +Figure 1: Contrastive Decoding strategies: (a) Visual Contrastive Decoding (VCD) (Leng et al., 2024) manually distort vision inputs. (b) Instruction Contrastive Decoding (ICD) (Wang et al., 2024a; Kim et al., 2024) also manually design noisy instruction (negative prompt). Detailed analyses are in Sec. 3.2. We ablate other modules like the vision encoder and tokenizer for clarity. $t$ : 'Please describe this image in detail.'; sys.: system prompt. $g$ : generated text tokens. $\alpha$ in Eq. 2 defaults to 1. + +![](images/8294f2f4ae3e3a09d18b800ca439c7a881c21c583a2df49d0dcbc9a57c7a22cf.jpg) + +One mainstream approach to alleviating hallucinations in LVLMs involves developing training-free decoding strategies known as Contrastive Decoding (CD) (Leng et al., 2024; Favero et al., 2024; Wang et al., 2024a; Kim et al., 2024), which adjusts the next-token logits in a contrastive manner. Concretely, Vision CD (VCD) manipulates vision inputs with Gaussian noise (Leng et al., 2024) or directly ablates visual inputs (Favero et al., 2024) to amplify language priors. Instruction CD (ICD) (Wang et al., 2024a; Kim et al., 2024) designs negative prompt.1 The rationale is that disturbed inputs significantly exacerbate hallucinations, and CD subtracts hallucinated concepts from the original distribution to mitigate hallucinations. However, input disturbances require elaborate designs for various downstream tasks, and the inference cost is inevitably doubled. Moreover, the contrastive distributions are vision-and-text agnostic, not necessarily amplify desired hallucinations but sometimes induce potential uncertainty noise for CD. Intuitive examples are illustrated in Fig. 1, and detailed analyses are in Sec. 3.2. In Fig. 1 (a) and (b), LVLMs directly infer the correct next token from multimodal inputs. For Vision CD, distorted vision input exacerbates hallucinated object logits such as football and basketball, while the holistic noise suppresses baseball to a low logit value. Consequently, VCD might compromise normal decoding. Similarly, for Instruction CD, LVLMs tend to refuse to answer negative prompts in open-end generation task (as seen in Fig. 5 and 10), and also suffer from potential uncertainty noise similar to VCD. + +To address the aforementioned issues, we propose a novel decoding strategy called Self-Introspective Decoding (SID). Our empirical investigations reveal that pre-trained LVLMs can introspectively assess the importance of vision tokens adaptively, based on preceding vision and text (both instruction and generated) tokens. SID leverages this capability to amplify and then subtract vision-and-text association hallucinations by proposing token-level disturbances named Context and Text-aware Token Selection $(\mathrm{CT}^2\mathrm{S})$ strategy. This strategy induces multimodal contextual hallucinations, rather than aimless ones, by conducting token selection in the early decoder layers. In summary, our main contributions are three-fold: + +- We re-think CD methods in LVLMs and attribute their failure cases to vision-and-text agnostic input distributions that induce potential uncertainty noise. +- To address this, we propose Self-Introspective Decoding (SID), where the $\mathrm{CT}^2\mathrm{S}$ strategy adaptively amplifies and then subtracts vision-and-text association hallucinations. This approach is grounded in our investigations that pre-trained LVLMs can introspectively assess visual importance informed by preceding tokens. +- Through comprehensive comparisons, we demonstrate that SID generates high-quality texts with fewer hallucinations. Additionally, SID significantly reduces inference cost of contrastive decoding. + +# 2 RELATED WORK + +We review recent advances in Hallucination in Foundation Models. More backgrounds about Large Vision-Language Models and Decoding Strategy in LLMs are in Appendix A.1. + +Hallucination in Foundation Models. Hallucination, defined as the generation of irrelevant, factually incorrect, or meaningless text in a given context (Rohrbach et al., 2018; Zhang et al., 2024; Guan et al., 2024; Wu et al., 2024b), is a significant bottleneck in current foundation models. This issue can stem from overfitting specific patterns in the training data, a lack of understanding world knowledge, or an inability to effectively contextualize a given input (Ji et al., 2023). In the context of LLMs, hallucinations often manifest as generated content that conflicts with world knowledge or common sense. For LVLMs, the primary concern is whether the generated answer conflicts with the provided images. To mitigate the hallucination issue, several solutions have been proposed, including robust instruction tuning with curated datasets (Lee et al., 2022; Gunjal et al., 2024; Liu et al., 2024a; Zhao et al., 2024; Jiang et al., 2024; Yu et al., 2024b;a; Ma et al., 2024; Yue et al., 2024b), post-hoc utilizing auxiliary analysis networks (Manakul et al., 2023; Zhou et al., 2024; Yin et al., 2023; Chen et al., 2024b; Wu et al., 2024a; Feng et al., 2024), and various decoding strategies (Li et al., 2022; Chuang et al., 2024; Liu et al., 2024c; Leng et al., 2024; Favero et al., 2024; Wang et al., 2024a; Kim et al., 2024; Zhu et al., 2024). However, robust instruction tuning requires massive high-quality datasets and advanced GPU clusters, making it resource-intensive; Post-hoc utilizing auxiliary networks heavily rely on the auxiliary network, leading to high inference costs. As for decoding strategies, representative LVLMs hallucination alleviation methods (Leng et al., 2024; Favero et al., 2024; Wang et al., 2024a) manually disturb raw inputs to induce hallucinations then contrast them to alleviate the issue. However, holistic disturbing raw inputs might bring additional noise during contrastive decoding, and double the inference cost. In this paper, we propose an efficient Self-Introspective Decoding (SID) that induces and then mitigates vision-and-text association hallucination by token-level disturbances, greatly reducing the inference cost. + +# 3 PRELIMINARY AND MOTIVATION + +In the following, we first illustrate the generation paradigm of LVLMs to facilitate the understanding of SID. We then re-think the contrastive decoding in LVLMs and propose our motivation for SID. + +# 3.1 PARADIGM OF LVLMS GENERATION + +Vision and Language Inputs. The inputs to LVLMs consist of both image $(v)$ and text $(t)$ . Generally, the raw images are commonly fed to the visual encoder, and then the cross-model projection module maps vision information into LLMs' input space, denoted as vision tokens $v = \{v_{1}, v_{2} \dots v_{n}\}$ ( $n$ is the length of vision tokens). Similarly, text is processed by tokenizer and embedding modules, which is denoted as text tokens $t = \{t_{1}, t_{2} \dots t_{m}\}$ ( $m$ is length of text tokens). Then, the image $(v)$ and text $(t)$ tokens are concatenated as the final input of LLMs. + +LVLMs Forward. The backbone networks of LVLMs are pre-trained LLMs like Vicuna (Chiang & Li, 2023) and LLaMA 2 (Touvron et al., 2023b), parameterized by $\theta$ . Given multimodal tokens $\{v, t\}$ , LVLMs predict the next token probability $(y_i)$ at $i$ time step in an auto-regressive manner following the methodology of LLMs, over the vocabulary set $\nu$ : + +$$ +p \left(y _ {i} \mid v, t, y _ {< i}\right) = \operatorname {s o f t m a x} \left(\operatorname {l o g i t} _ {\theta} \left(y _ {i} \mid v, t, y _ {< i}\right)\right), y _ {i} \in \nu \tag {1} +$$ + +Next Token Decoding. After obtaining the next token probability $p(y_{i}|v,t,y_{SettingMethodGreedySamplingAccuracy ↑F1 Score ↑Accuracy ↑F1 Score ↑RandomNormal88.8±0.0588.6±0.0884.9±0.0383.2±0.01VCD87.8±0.0287.9±0.0687.7383.28w/o Eq. 3--83.3±0.0482.2±0.02ICD87.9±0.0488.1±0.0286.9±0.0385.2±0.04w/o Eq. 3--82.7±0.0281.8±0.03Ours89.3±0.0889.5±0.0288.8±0.0388.7±0.02w/o Eq. 3--87.2±0.0188.0±0.02AdversarialNormal79.3±0.0580.9±0.0978.7±0.0378.9±0.02VCD80.9±0.0681.0±0.0480.8881.33w/o Eq. 3--76.2±0.0476.0±0.04ICD80.2±0.0381.3±0.0179.1±0.0280.4±0.04w/o Eq. 3--75.4±0.0276.4±0.04Ours83.3±0.0782.5±0.0682.6±0.0582.1±0.06w/o Eq. 3--82.2±0.0381.9±0.01 + +implausible outputs from the augmented distribution (Li et al., 2022; Chuang et al., 2024; Leng et al., 2024; Favero et al., 2024; Wang et al., 2024a; Kim et al., 2024; Zhu et al., 2024): + +$$ +\begin{array}{l} \nu_ {t o k e n} \left(y _ {< i}\right) = \left\{y _ {i} \in \nu : p _ {\theta} \left(y _ {i} \mid v, t, y _ {< i}\right) \geq \beta \max _ {\omega} p _ {\theta} \left(\omega \mid v, t, y _ {< i}\right) \right\}, \tag {3} \\ p _ {c d} \left(y _ {i} \mid v, v _ {d}, t, y _ {< i})\right) = 0, \text {i f} y _ {i} \notin \nu_ {\text {t o k e n}} \left(y _ {< i}\right) \\ \end{array} +$$ + +where $\nu$ and $\nu_{token}$ are the output vocabulary and selected tokens. $\beta$ controls the strength of truncation, with larger $\beta$ indicating more aggressive truncation that retains only high-probability tokens. + +However, we argue that manually disturbing raw inputs might not trigger the desired hallucinations, while holistic disturbances will bring uncertainty noise that compromises the normal decoding. To validate our claim, we analyze the performances of normal decoding, VCD, and ICD using the POPE (Li et al., 2023d) metric, under both sampling and greedy decoding settings. POPE quantitatively converts the hallucination evaluation into a binary classification problem by using the question format to prompt the model: 'Is there a in the image?', with expected answers being 'Yes' or 'No'. From Table 1, under the greedy decoding setting, CD methods improve performance in the adversarial setting, which are more challenging as they prioritize co-occurring confusing objects. CD methods achieve this by exacerbating and subtracting hallucinated concepts from the original distribution. However, in random settings, where objects absent from the image are chosen randomly and are easily recognized, CD methods slightly underperform normal greedy decoding, which indicates that the correct token logit is somewhat compromised during contrastive decoding. In the sampling decoding setting, CD methods clearly outperform the normal sampling decoding. However, CD methods rely on the adaptive plausibility constraint (Eq. 3) to filter out low-probability tokens. Without Eq. 3, CD methods are inferior to normal decoding in both random and adversarial settings, validating that vision-and-text agnostic input distributions induces potential uncertainty noise after Eq. 2 (More validations on other benchmarks are in Table 11.). To address these issues, we propose a decoding strategy named Self-Introspective Decoding (SID). SID adaptively amplifies vision-and-text association hallucinations informed by generated tokens to guide LVLMs in exploring factualness. Details are illustrated in the Sec. 4 and Fig. 2. + +# 4 METHODOLOGY + +# 4.1 UNDERSTANDING THE SELF-INTROSPECTIVE PRE-TRAINED LVLMS. + +LLMs (Bai et al., 2023a; Chiang & Li, 2023; Touvron et al., 2023b; Meta, 2024) have been scaled up to billions of parameters and pre-trained on trillions of tokens, endowing LLMs with encyclopedic ability like in-context learning (Wang et al., 2024b), zero (Kojima et al., 2022)/few-shot (Brown et al., 2020) ability. LVLMs extend LLMs to multimodal understanding capabilities by visual instruction tuning. Some works (Cao et al., 2023; Shang et al., 2024; Chen et al., 2024a) pointed out that vision information is redundant in LVLMs, and develop vision token reduction technologies + +![](images/ca7b6b6c8b4658f05f2a334ea8887f43433d50af001fa4a2900a7c3fa1384034.jpg) +Figure 2: Overview of Self-Introspective Decoding (SID). $\mathrm{CT}^2\mathrm{S}$ : Context and Text-aware Token Selection strategy. LLaVA-1.5 7B is utilized as an example to visualize visual tokens with low and high scores (Eq. 5). + +![](images/2b9963576306def0e52efb18f13cee0797336ca8b614a581547ffbc68380b9de.jpg) + +to prune (Rao et al., 2021) and merge (Bolya et al., 2023) tokens guided by importance metrics without further re-training. Regarding the hallucination issue, we argue that vision tokens with low attention scores induce vision-and-text association hallucination. Formally, for the transformer block (Vaswani et al., 2017) in the auto-regressive decoder $^{2}$ , vision $(v)$ , text instruction $(t)$ , and generated tokens $(g)$ are concatenated and projected into three distinct vectors: the query vector $\mathbf{Q}$ , the key vector $\mathbf{K}$ , and the value vector $\mathbf{V}$ , utilizing three linear transformations $W_{q}, W_{k}$ , and $W_{v}$ . The self-attention $(SA)$ mechanism computes the relevance of each item to other items as follows: + +$$ +\mathbf {R} = S A (\mathbf {Q}, \mathbf {K}, \mathbf {V}) = \mathbf {A} \cdot \mathbf {V}, +$$ + +$$ +\mathbf {A} = \operatorname {s o f t m a x} \left(\frac {\mathbf {Q} \cdot \mathbf {K} ^ {T}}{\sqrt {d _ {l}}} + M\right), \tag {4} +$$ + +where $d_{l}$ represents the dimension of $\mathbf{Q},\mathbf{K},\mathbf{V},M$ represents the casual mask. $\mathbf{A}\in R^{(b,h,n,n)}$ , where $b,h,$ and $n$ denote batch size, number of key-value heads, and total token number, respectively. We denote the $\mathbf{A}_i$ as the attention matrix after Layer $i$ of LVLMs. We then calculate vision token importance scores $(\mathrm{Score}_i(v))$ as shown in Fig. 2 (Selector) based on $\mathbf{A}_i$ : + +$$ +\operatorname {S c o r e} _ {i} (v) = \frac {1}{h} \sum_ {j = 1} ^ {h} \mathbf {A} _ {i} ^ {(\cdot , j, \cdot)} [ - 1 ], \tag {5} +$$ + +where $v$ means vision token indexes. Contrary to token pruning/merging (Rao et al., 2021; Bolya et al., 2023), we preserve a certain number of the least important vision tokens based on Eq. 5. + +Analyses. Fig. 3 and 4 preliminarily validate the efficacy of $\mathrm{Score}_i(v)$ qualitatively. In Fig. 3, the preserved least important tokens mainly reflect areas opposite to the query. For instance, when querying 'cup' in Fig. 3 (left), LVLMs focus on 'cup' in the foreground, thus preserving background tokens with low $\mathrm{Score}_i(v)$ . Conversely, LVLMs pay attention to background items when querying 'couch'. When querying existing items in Fig. 3 (right), vision tokens of unrelated regions are mainly preserved. For open-end generative tasks in Fig. 4, auto-regressive decoded tokens are generated based on preceding vision $(v)$ , instruction $(t)$ , and generated text $(g)$ tokens. The preserved vision tokens are adaptively adjusted according to preceding tokens at each decoding step, primarily focusing on spurious related regions. More quantitative analyses are provided in Appendix A.7, where Table 12 illustrates that vision tokens with high $\mathrm{Score}_i(v)$ greatly maintain original ability, while tokens with low $\mathrm{Score}_i(v)$ reach nearly $50\%$ accuracy in binary classification. Above evaluations suggest that Eq. 5 effectively assesses the importance of vision tokens. + +We further demonstrate the open-end generated hallucinations induced by ours, Vision Disturbance (VD) (Leng et al., 2024), and Instruction Disturbance (ID) (Wang et al., 2024a) in Fig. 5 and 10. The hallucinations we amplified are more vision-and-text association compared to VD, while LVLMs + +![](images/5c4ee01640842be67387e5d5cc089532b3c50ba43a7614b9e33f47331db9fa40.jpg) +original image + +![](images/fe7a8f4ccd488f667f0172736441e77698f4d62cd0de598d7ca1e2533944011b.jpg) +Q: Is there a cup in the image? + +![](images/c98c762d6279f416c2f201d90dabf21cafd03a16f7bc7a630cf0441d6b318d16.jpg) +Q: Is there a couch in the image? + +![](images/1a3e11804a81ed5fc5df536de66ab42363fd479f4d6d61f653399f51a3d4fe9f.jpg) +original image + +![](images/047ac123db0fbc91984418429e827736ad67efd31d2b75ad054824ffb594d786.jpg) +Q: Is there a knife in the image? + +![](images/90d2d4c1de8d0c3e9908156e05c545cac9b00866ad249d4f6f3232dd947e922b.jpg) +Q: Is there a cup in the image? + +![](images/47f3f77b480116d64d1bc7f37045567a9f3dc445b85665cf037761110d295e35.jpg) +Instruction: + +![](images/579d6e2db9ef1bae171ef7e44221c0b3e475c9ba7f85d8143445187a7f139e15.jpg) +Please describe... +Instruction: +Please describe... + +![](images/dc364dbc315568f0e58b586ea0af9e419087e30487ad99c27f0c409beb301f49.jpg) +Figure 3: Visualization Results of the least important vision tokens on discrimination tasks informed by preceding vision and text tokens. LLaVA-1.5 7B with Layer $i = 3$ is utilized. +...there is a dog + +![](images/8a93238c690e61d2376663e9445ee5fa57d2fab9291203f502781bf43523b294.jpg) +...standing on the beach +Figure 4: Visualization Results of Adaptively Selecting the least important vision tokens on open-end generative tasks informed by preceding vision and text tokens. LLaVA-1.5 7B with Layer $i = 3$ is utilized. + +![](images/436731e51f3dc123eb41dcfb10a3e2e276fa3d0f16095cecd235f1ece4833159.jpg) +additionally, two vases + +![](images/a9e3f1470563e4036689134ac2925aa46e6d05f2a25dde239e1bd88ae7132ac2.jpg) +...flying a kite + +![](images/97f6851fd9b71fd8018512f9418b95a9259f6e12d9d5ee28d86ab4b691233b55.jpg) +...placed on the cabinet + +![](images/eff3c768fa3e2ee15c3b4f16f117b5f27d7ec6f3bf4d1ddf62cede27ed3e1b24.jpg) +... foreground, there are trees + +usually refuse to response to ID. Additionally, we demonstrate the quantitative results for discrimination and generation tasks with $VD$ and $ID$ as inputs in Appendix Table 12. Interestingly, $VD$ and $ID$ do not degrades much especially in discrimination tasks. Experiments imply that disturbed target logits still have the highest probability in most cases, and therefore, contrastive decoded target logits are not enhanced much after Eq. 2, while CD methods are susceptible to potential uncertainty noise. + +# 4.2 CONTEXT AND TEXT-AWARETOKEN SELECTION $(\mathrm{CT}^2\mathrm{S})$ STRATEGY. + +Based on the above investigations, we argue that to induce context- and text-aware hallucinations for contrastive decoding, only a small percentage of vision tokens with low attention scores should be preserved after the early decoder layers. To validate our claims, we conduct the following experiments: 1) In Vision Encoder (VE), we preserve tokens with low attention values between the [CLS] token and vision tokens in the penultimate layer, calculated as: $\mathbf{A} = \mathrm{softmax}(\frac{[\mathrm{CLS}]\cdot\mathbf{K}^{\mathrm{T}}}{\sqrt{d_k}})$ . 2) In the LLM decoder, we preserve tokens with low importance score (Eq. 5) across varying layers + +![](images/10dd4adc58cc6aa536bedb5bac553004a29d1a694598368cafe79a7bd385184b.jpg) +Original +Figure 5: Instance Illustration of Different Disturbance Results. Examples are from MSCOCO inferred by LLaVA-1.5 7B with $i = 3$ and Top-k=50. Hallucinations are marked in red. + +![](images/109e73e029962a6f8ae22e1260ab8bec9499b880e4e5eaafecc3b3e78d59e0f2.jpg) +Ours +(dynamic pruning important vision token based on preceding tokens) + +![](images/054204a8211da2a4fe126fb06002583035159dd0c77d807a7b5c6548c9b3a7f7.jpg) +VD + +# ID + +'You are a confused image caption model.' + +Normal (Greedy): The image features a small white dog standing in front of a TV, which is mounted on a wooden cabinet. The dog appears to be watching the TV with interest, possibly captivated by the content displayed on the screen. The room also contains a dining table, a chair, and a few vases placed. One vase is located near the left side of the room, another is situated in the middle, and the third one is on the right side. These decorative items adds a touch of elegance to the living space. + +Ours: The image features a large, well-lit room with a yellow color scheme. The room is furnished with a couch and a chair, both placed against the wall. A TV is mounted on the wall, and a remote control can be seen resting on the couch.\nThere are two vases in the room, one located near the left side and the other near the right side. A potted plant is placed in the room, adding a touch of greenery to the space. A clock is mounted on the wall, and a book can be found resting on a surface in the room. + +VD: The image features a dark room with a television turned on, displaying a TV show. The television is placed on a stand, and the room appears to be a living area. There are several books scattered around the room, with some placed on the floor and others on surfaces. A remote control can be seen resting on a surface, likely used to operate the television. + +ID: What is this dog doing? I'm sorry, I'm not sure what you're asking for. Could you provide more context or clarify your question? + +(i). Additionally, we adjust the number of preserved vision tokens. As shown in Fig. 6, firstly, pruning vision tokens in VE based on [CLS] may not always yield positive gains, as the [CLS] token lacks information about instructions and generated texts, which are crucial for multimodal understanding. Specifically, pruning all vision tokens resembles VIG (Favero et al., 2024), which contrastively amplifies the vision importance over the language prior by ablating vision inputs. Secondly, aggressive pruning of vision tokens (i.e., $0\%$ ) after $L_{ayer_{i=1}}$ is not optimal. As the ideal induced hallucination distributions are target-co-occurring but suppress target logits, the loss of visual information for subsequent decoding results in visual context diminishing, which can lead to aimless hallucinations due to insufficient grounding in visual information. Thirdly, selecting tokens in the late decoder layers degrades contrastive decoding to normal decoding, as preceding layers of LVLMs already decode and understand multimodal information, which is consistent with LLMs' + +early-exiting mechanisms (Schuster et al., 2022; Elhoushi et al., 2024). In summary, the proposed $\mathrm{CT^2S}$ strategy selects Topk least important vision tokens after the early layers based on attention score (Eq. 5), where the induced hallucinations are aware of both visual contexts and text information. Finally, following CD methods (Sec. 3.2), we contrastively subtract amplified vision-and-text association hallucinations for the next token prediction. + +![](images/abc04aca04abf95746d4e71fdd5a7fd8c71e6822c47b1ffbd0c78eab85dba63d.jpg) +Figure 6: Analyses of varying $i$ and preserved ratios in $\mathrm{CT}^2\mathrm{S}$ VE: vision encoder; $i$ : $i$ -th decoder layer. + +Discussion. Based on analyses of the self-introspective pre-trained LVLMs, could we enhance vision information informed by the proceeding vision and text tokens rather than utilizing the contrastive decoding? To explore this, we rewrite Eq. 2 as follows: + +$$ +p _ {a d d} \left(y _ {i} \mid v, v \uparrow , t, y _ {< i}\right) = \operatorname {s o f t m a x} [ (1 - \alpha) \operatorname {l o g i t} _ {\theta} \left(y _ {i} \mid v, t, y _ {< i}\right) + \alpha \operatorname {l o g i t} _ {\theta} \left(y _ {i} \mid v \uparrow , t, y _ {< i}\right) ] \tag {6} +$$ + +where we preserve vision tokens with high importance scores (Eq. 5) denoted as $v \uparrow$ . From Table 2, + +we observe that enhancing vision information (i.e., Add) alleviates hallucinations to some extent, which also implicitly validates the efficacy of Eq. 5. However, in the adversarial setting, enhancing vision information does not bring much benefits compared to ours. Because our amplified hallucinations effectively associate co-occurring objects, reflected in high logit values of hallucination token, and then contrastively suppress them. In contrast, enhancing vision information primarily boosts the original prediction's target logits grounded in attention scores, which does not significantly improve discrimination, especially in the adversarial setting. + +Table 2: Analyses of Contrastive Decoding Mechanisms on the POPE metric. Hyperparameters are consistent with CD settings. + +
SettingRandomAdversarial
Sampling84.778.7
VCD87.780.9
Add88.979.4
Ours88.882.6
Greedy88.879.1
VCD87.880.9
Add89.180.1
Ours89.383.3
+ +# 5 EXPERIMENTS + +# 5.1 EXPERIMENTAL SETTINGS + +Models and Baselines. We utilize four representative LVLMs: InstructBLIP (Dai & et al, 2023), Shikra (Chen et al., 2023a), LLaVA-1.5 (Liu et al., 2024b) at the 7B scale, and LLaVA-NeXT (Li et al., 2024) at the 8B scale. For detailed model descriptions and results at larger scales, please refer to Appendix A.2 and Table 14 in Appendix A.7. Since our method aims to propose training-free LVLM decoding strategies without the aid of auxiliary networks, we compare six decoding methods: Sampling (Top-p=1), Greedy, Dola (Chuang et al., 2024), and LVLM decoding strategies (VCD (Leng et al., 2024), ICD (Wang et al., 2024a), and OPERA (Huang et al., 2024)). For comprehensive comparisons, we apply VCD and ICD in both sampling (Top-p=1) and greedy decoding settings. Additionally, we validate SID with different decoding strategies, as detailed in Appendix A.7. + +Implementation Details. As analyzed in Sec. 4.2, we set Layer $i = 3$ and preserve top $10\%$ least important vision tokens for Shikra, LLaVA-1.5, and LLaVA-NeXT and $i = 5$ and top $10\%$ least important vision tokens for Q-former based LVLMs (InstructBLIP) to induce fine-grained hallucinations. Hyperparameters in Eq. 2 and 3 follow VCD and ICD. More details are in Appendix A.2. + +# 5.2 EVALUATION RESULTS + +In this section, we follow previous methods (Leng et al., 2024; Wang et al., 2024a; Huang et al., 2024) to evaluate the SID on CHAIR (Rohrbach et al., 2018) and POPE (Li et al., 2023d) metrics. Besides manually designed metrics, we also leverage GPT-4 assisted benchmark (Zhao et al., 2024) to evaluate attribute, location, and relation hallucinations. MME (Fu et al., 2023) and MM-Bench (Liu et al., 2023b) benchmarks are employed to assess the LVLM's general ability. Moreover, GPT4-V assisted evaluation (Appendix A.4) on both hallucination alleviation and generated text quality, more general benchmarks evaluation (Appendix A.5) on MathVista (Lu et al., 2024), MMVet (Yu et al., 2024c), LLaVA-Bench (Liu et al., 2023a), MMMU (Yue et al., 2024a), and case studies (Appendix A.6) on LLaVA-Bench-in-the-Wild are in Appendix. + +CHAIR and POPE Evaluations. CHAIR (Rohrbach et al., 2018) and POPE (Li et al., 2023d) are quantitative metrics to assess objection hallucinations of VLMs. Please refer to the Appendix A.3 for detailed descriptions of CHAIR and POPE. As for CHAIR, Following (Wang et al., 2024a; Huang et al., 2024; Yue et al., 2024b), we randomly select 500 images from the validation set of + +Table 3: Results on the CHAIR metric. * and † denote adopting the same sampling and greedy decoding strategies, respectively. + +
SettingLLaVA-1.5InstructBLIPShikraLLaVA-NeXT
\( C_S\downarrow \)\( C_I\downarrow \)\( C_S\downarrow \)\( C_I\downarrow \)\( C_S\downarrow \)\( C_I\downarrow \)\( C_S\downarrow \)\( C_I\downarrow \)
Sampling51.316.851.024.248.914.742.614.1
ICD*48.713.948.316.747.814.542.713.6
VCD*48.014.347.917.248.113.841.312.9
Ours*45.011.743.613.146.012.938.411.4
Greedy-49.6-14.4-54.6-13.6-47.1-13.9-42.9-13.2
Dola*47.113.852.714.046.814.240.913.1
OPERA45.212.747.412.944.413.639.411.8
ICD*47.413.946.315.347.314.142.112.6
VCD*46.813.244.013.647.814.041.112.9
Ours*44.212.242.312.444.812.838.111.3
+ +the MSCOCO (Lin et al., 2014) dataset and query different LVLMs with the prompt: 'Please describe this image in detail.' We set the max new tokens to 512 to generate responses for fair comparisons. As shown in Table 3, our method outperforms other baselines in most cases, validating the effectiveness of SID in open-end generation tasks. Compared to CD methods, SID online adaptively prunes attention-important vision tokens informed by instruction and generated text to induce fine-grained hallucinations for contrastive decoding during open-end text generations. For the POPE metric, which comprises three datasets, we average the results in Table 4. Our method performs best overall in random, popular, and adversarial sampling settings. Specifically, in the sampling decoding setting, SID surpasses the normal sampling decoding by a large margin in a train-free manner. SID also clearly outperforms CD methods (Dola, ICD, and VCD) because the self-introspective decoding strategy amplifies vision-and-text association hallucinations then subtracts them, rather than coarsely disturbing raw inputs. Additionally, owing to the context and text-aware token selection strategy, SID is more computation-efficient than CD methods, as analyzed in Table 6. Note that beam-search based OPERA (Huang et al., 2024) shows almost no gain in the POPE metric, primarily because answering the binary classification only requires a few tokens and selecting the best beam score in a decoded sequence ( $N = 5$ ) brings little improvement. + +GPT-4 Assisted Benchmark. While CHAIR and POPE evaluate object-existence-level hallucinations, these metrics are unable to identify other types of hallucination, such as positional, relational, and attribute hallucinations. Therefore, the GPT-4 assisted benchmark (Zhao et al., 2024) utilizes the fine-grained object-level descriptions in the Visual Genome (VG) dataset (Krishna et al., 2017) as ground-truth and relies on the advanced GPT-4 to judge the fine-grained hallucinations and calculate Sentence-level Hallucination Ratio (SHR). Please refer to the Appendix A.3 for detailed implementations. Moreover, we employ n-gram fluency $(n = 1$ and 2) metrics to measure the smoothness of generated text, and the number of generated words/sentences per image (WPI/SPI) to compare the detailedness of generated texts. As shown in Fig. 7, SID achieves the best results in the SHR metric among the four LVLMs, outperforming others by a clear margin. Regarding the quality of the generated texts, Sampling decoding outperforms ours slightly in terms of 1-gram fluency and WPI. However, compared to other baselines, our approach alleviates hallucinations with minimal sacrifice in text generation quality regarding smoothness and detailiness. For instance, OPERA generates text with fewer words and sentences due to penalization of the over-trust mechanism, and VCD impairs text fluency, possibly arising from the holistic and fixed disturbance of contrastive inputs. + +MME and MMBench Evaluations. Besides, we test on two popular LVLMs' general ability benchmarks: MME and MMBench. MME comprises ten subtasks to evaluate models' perceptual + +Table 4: Average results on the POPE metric. * and * denote adopting the same sampling and greedy decoding strategies, respectively. Results are from the papers or re-implemented based on official codes. + +
SettingRandomPopularAdversarial
ModelDecodingAccuracy↑F1 Score↑Accuracy↑F1 Score↑Accuracy↑F1 Score↑
LLaVA-1.5Sampling84.7782.2879.9879.3476.0376.26
ICD*87.5183.2883.1583.9179.1380.41
VCD*86.8486.8382.6583.3777.3179.28
Ours*88.9188.8483.9785.4282.5481.98
Greedy88.8188.5282.7683.3679.1180.92
Dola*87.9487.9783.8784.6880.3581.21
OPERA88.8588.6782.7783.4079.1680.93
ICD*87.9787.8484.0384.2280.2180.97
VCD*87.0286.9683.5384.5678.1280.16
Ours*89.4689.6285.1385.9483.2482.21
InstructBLIPSampling80.4280.9476.0977.6572.3775.42
ICD*85.7885.7381.1282.2576.8278.99
VCD*84.1184.1379.9680.8076.3278.08
Ours*86.5685.9480.2681.7577.6480.41
Greedy84.5683.7578.2379.1674.5876.34
Dola*84.6783.3878.2179.1975.6977.98
OPERA84.5783.7478.2479.1574.5976.33
ICD*84.3683.8277.8878.7075.1777.23
VCD*84.5283.6378.0478.4575.9577.76
Ours*87.2386.9081.1682.5778.5181.26
ShikraSampling81.4282.4679.6080.7873.8576.39
ICD*82.3482.8278.1780.4374.9677.68
VCD*82.3182.7379.3480.9375.6177.96
Ours*83.8783.9480.2682.0777.8578.94
Greedy83.0083.1981.3981.9076.6978.31
Dola*82.8782.9882.4282.5076.8578.09
OPERA83.0583.2081.4081.8976.7378.31
ICD*82.6782.6480.7381.5875.9878.43
VCD*82.9682.6380.6881.2776.9478.32
Ours*84.4684.6282.3882.7378.6779.34
LLaVA-NeXTSampling86.3283.1182.2781.0377.3276.96
ICD*87.3284.0383.6283.5480.3180.41
VCD*86.9786.7183.0783.6579.4280.28
Ours*89.1688.9284.3885.7682.9581.98
Greedy89.3788.8283.6884.6280.0880.74
Dola*88.7388.6784.5684.9680.3280.68
OPERA89.3688.8083.6584.6080.1080.75
ICD*87.4087.9684.1183.7980.9480.67
VCD*87.8387.0982.6883.5579.6181.20
Ours*90.0589.9786.1385.6984.0682.95
+ +![](images/fa605e6f57682f707796364400ab1efb25e515b20c6350dfbc94372d10417efb.jpg) +Figure 7: GPT-4 assisted benchmark (Zhao et al., 2024). Hallucination (SHR), fluency (1&2-gram), and detailness (WPI and SPI) aspects are compared. Larger areas mean better performances. VCD and ours adopt the same sampling decoding. Please zoom in for details. + +capabilities and four subtasks for assessing cognitive abilities in the form of the yes/no question. MMBench systematically evaluates twenty ability dimensions of LVLMs. We present the results of LLaVA-1.5 7B as a representative in Table 5, SID can maintain and improve the multimodal ability on LVLMs benchmarks. In contrast, other CD methods tend to compromise the general multimodal ability. More general benchmark evaluations are in Appendix A.5. + +Table 5: LVLM benchmark evaluations. DoLa, ICD, VCD, and SID employ the same greedy decoding. + +
GreedySamplingDoLaICDVCDOPERASID
MME1510.8±1.21471.5±5.61480.7±1.31473.2±1.21488.5±0.81515.2±1.11520.4±0.9
MMbench64.4±.2263.9±.8163.7±.2263.0±.2463.8±.2264.4±.1365.0±.23
+ +# 6 ABLATION ANALYSES + +In this section, we conduct ablation analyses on the computation efficiency and hyperparameter sensitivity. More analyses about Token Selection Strategies Analyses, Larger-scale Backbone, Other Decoding Strategies, and Visual Enhancing Decoding Strategy are in Appendix A.7. + +
MethodsTime ↓Memory↓Accuracy↑
Normal4941567379.11
VCD9041675378.12
ICD9741684380.21
OPERA26432194379.16
Ours40%7041580983.11
Ours10%6681576783.24
+ +Table 6: Efficiency Comparisons on NVIDIA V100. ${10}\%$ and ${40}\%$ mean tokens preserved ratios. + +![](images/9305352128d192aa50ea7a65458656462555d54eee9672226ebcaea11b02bef8.jpg) +Figure 8: Hyperparameter Sensitivity of $\alpha$ and $\beta$ with POPE metric (under the sampling decoding). + +Computation Efficiency. One primary concern of hallucination alleviation decoding methods is the computational burden. We evaluate the whole dataset inference time (seconds) and peak GPU memory (MB) on the LLaVA-1.5 7B under the POPE adversarial setting, as shown in Table 6. Contrastive Decoding (CD) methods (Leng et al., 2024; Wang et al., 2024a) involve constructing distorted raw inputs, resulting in twice the inference complexity. OPERA (Huang et al., 2024) is based on beam-search decoding and maintains a set of beams to enlarge the candidate range. Additionally, roll back mechanism in the retrospection-reallocation strategy further exacerbates computational complexity. Our SID induces vision-and-text association hallucinations by pruning large-ratio attention-important tokens in the early layers, which greatly reduces the inference time of CD up to $\sim 30\%$ . + +Hyperparameter Sensitivity. Beyond the sensitivity analyses in Fig. 6, we validate the robustness of SID concerning $\alpha$ and $\beta$ of Eq. 2 and 3, compared to the contrastive decoding methods (i.e., VCD) on LLaVA-1.5 7B. From Fig. 8 (left), it is evident that as $\alpha$ decreases, the contrastive decoding mechanism diminishes. However, SID still achieves pleasant results, while VCD degrades close to Sampling when $\alpha = 0.1$ , as the $\mathrm{CT^2S}$ strategy induces informative vision-and-text association hallucinations. When $\alpha$ increases, VCD degrades to some extent because holistic input disturbance does not always trigger contextual-related hallucination and might exacerbate uncertainty noise. Regarding $\beta$ , a larger $\beta$ indicates more aggressive truncation of the output vocabulary. Fig. 8 (right) shows that VCD's performance heavily relies on large $\beta$ to retain only high-probability tokens. With mild or no adaptive plausibility constraint (Eq. 3), VCD performs worse than the sample decoding strategy due to output logits influenced by distorted visual inputs. Ours is robust to the $\beta$ setting as the $\mathrm{CT^2S}$ strategy induces discriminative contrastive logits to generate plausible tokens. + +# 7 CONCLUSION AND FUTURE WORK + +In this paper, we firstly re-think contrastive decoding in LVLMs and empirically find that vision-and-text-agnostic input disturbances in CD do not always amplify desired hallucinations rather than induce potential uncertainty noise. To mitigate these issues, we propose a training-free decoding strategy named Self-Introspective Decoding (SID). By developing Context and Text-aware Token Selection $(\mathrm{CT}^2\mathrm{S})$ strategy, SID amplifies vision-and-text association hallucinations to guide LVLMs in contrastive decoding, thereby improving faithfulness. Extensive experiments validate the effectiveness and robustness of SID. + +Future Work: 1) As the pruning ratios and layer are set manually, we consider training the external network to automatically determine optimal hyperparameters, inspired by (Chen et al., 2023b). In addition, to enhance the interpretability of hallucination alleviations, we consider resorting to pretrained analysis networks to intuitively locate spurious related vision regions. 2) Moreover, given that SID amplifies fine-grained hallucinations, we consider leveraging the $\mathrm{CT^2S}$ strategy to automatically construct high-quality negative instruction for robust visual instruction tuning rather than relying on expensive GPT-4 (Liu et al., 2024a; Zhao et al., 2024). Note that the self-generated hallucination dataset ensures style consistency, which is crucial for preference learning (Zhao et al., 2024). Codes are available at https://github.com/huofushuo/SID. + +# 8 ACKNOWLEDGEMENTS + +This work is supported by two grants from the Research Grants Council of the Hong Kong Special Administrative Region, China (Project No. PolyU15222621, PolyU15225023). We would like to thank Tencent AI Lab for supporting Fushuo Huo as a student researcher during his internship. + +# REFERENCES + +Jinze Bai, Shuai Bai, and et al. Qwen technical report. arXiv preprint arXiv:2309.16609, 2023a. +Jinze Bai, Shuai Bai, and et al. Qwen-vl: A frontier large vision-language model with versatile abilities. arXiv preprint arXiv:2308.12966, 2023b. +Rohan Bavishi, Erich Elsen, and et al. Introducing our multimodal models, 2023. URL https://www.adept.ai/blog/fuyu-8b. +Daniel Bolya, Cheng-Yang Fu, and et al. Token merging: Your ViT but faster. In ICLR, 2023. +Tom Brown, Benjamin Mann, and et al. Language models are few-shot learners. NeurIPS, 33: 1877-1901, 2020. +Qingqing Cao, Bhargavi Paranjape, and Hannaneh Hajishirzi. PuMer: Pruning and merging tokens for efficient vision language models. In ACL, pp. 12890-12903, July 2023. +Keqin Chen, Zhao Zhang, and et al. Shikra: Unleashing multimodal llm's referential dialogue magic. arXiv preprint arXiv:2306.15195, 2023a. +Liang Chen, Haozhe Zhao, and et al. An image is worth 1/2 tokens after layer 2: Plug-and-play inference acceleration for large vision-language models. arXiv preprint arXiv:2403.06764, 2024a. +Mengzhao Chen, Wenqi Shao, and et al. Diffrate: Differentiable compression rate for efficient vision transformers. In CVPR, pp. 17164-17174, 2023b. +Zhaorun Chen, Zhuokai Zhao, and et al. Halc: Object hallucination reduction via adaptive focal-contrast decoding. arXiv preprint arXiv:2403.00425, 2024b. +Zhe Chen, Weiyun Wang, and et al. How far are we to gpt-4v? closing the gap to commercial multimodal models with open-source suites. arXiv preprint arXiv:2404.16821, 2024c. +Wei-Lin Chiang and Zhuohan et al Li. Vicuna: An open-source chatbot impressing gpt-4 with $90\%$ chatgpt quality. See https://vicuna.lmsys.org (accessed 14 April 2023), 2023. +Yung-Sung Chuang, Yujia Xie, Hongyin Luo, Yoon Kim, James R. Glass, and Pengcheng He. Dola: Decoding by contrasting layers improves factuality in large language models. In ICLR, 2024. +Wenliang Dai and Junnan Li et al. Instructclip: Towards general-purpose vision-language models with instruction tuning, 2023. +Mostafa Elhoushi, Akshit Shrivastava, and et al. Layer skip: Enabling early exit inference and self-speculative decoding. arXiv preprint arXiv:2404.16710, 2024. +Angela Fan, Mike Lewis, and Yann Dauphin. Hierarchical neural story generation. arXiv preprint arXiv:1805.04833, 2018. +Alessandro Favero, Luca Zancato, and et al. Multi-modal hallucination control by visual information grounding. In CVPR, pp. 14303-14312, June 2024. +Shangbin Feng, Weijia Shi, and et al. Don't hallucinate, abstain: Identifying llm knowledge gaps via multi-llm collaboration. arXiv preprint arXiv:2402.00367, 2024. +Chaoyou Fu, Peixian Chen, and et al. Mme: A comprehensive evaluation benchmark for multimodal large language models. arXiv preprint arXiv:2306.13394, 2023. + +Zigang Geng, Binxin Yang, and et al. Instructdiffusion: A generalist modeling interface for vision tasks. In CVPR, pp. 12709-12720, June 2024. +Sreyan Ghosh, Chandra Kiran Reddy Evuru, and et al. Visual description grounding reduces hallucinations and boosts reasoning in lvlms, 2024. URL https://arxiv.org/abs/2405.15683. +Alex Graves. Sequence transduction with recurrent neural networks. arXiv preprint arXiv:1211.3711, 2012. +Tianrui Guan, Fuxiao Liu, and et al. Hallusionbench: an advanced diagnostic suite for entangled language hallucination and visual illusion in large vision-language models. In CVPR, 2024. +Anisha Gunjal, Jihan Yin, and Erhan Bas. Detecting and preventing hallucinations in large vision language models. AAAI, 2024. +Ari Holtzman, Jan Buys, Li Du, Maxwell Forbes, and Yejin Choi. The curious case of neural text degeneration. In ICLR, 2020. +Qidong Huang, Xiaoyi Dong, Pan Zhang, Bin Wang, Conghui He, Jiaqi Wang, Dahua Lin, Weiming Zhang, and Nenghai Yu. Opera: Alleviating hallucination in multi-modal large language models via over-trust penalty and retrospection-allocation. In CVPR, pp. 13418-13427, June 2024. +Drew A Hudson and Christopher D Manning. Gqa: A new dataset for real-world visual reasoning and compositional question answering. In CVPR, pp. 6700-6709, 2019. +Ziwei Ji, Nayeon Lee, and et al. Survey of hallucination in natural language generation. ACM Computing Surveys, 55(12):1-38, 2023. +Chaoya Jiang, Haiyang Xu, and et al. Hallucination augmented contrastive learning for multimodal large language model. In CVPR, pp. 27036-27046, 2024. +Taehyeon Kim, Joonkee Kim, Gihun Lee, and Se-Young Yun. Instructive decoding: Instruction-tuned large language models are self-refiner from noisy instructions. In ICLR, 2024. +Takeshi Kojima, Shixiang Shane Gu, and et al. Large language models are zero-shot reasoners. NeurIPS, 35:22199-22213, 2022. +Ranjay Krishna, Yuke Zhu, and et al. Visual genome: Connecting language and vision using crowdsourced dense image annotations. *IJCV*, 123:32–73, 2017. +Xin Lai, Zhuotao Tian, and et al. Lisa: Reasoning segmentation via large language model. In CVPR, pp. 9579-9589, June 2024. +Nayeon Lee, Wei Ping, and et al. Factuality enhanced language models for open-ended text generation. NeurIPS, 35:34586-34599, 2022. +Sicong Leng, Hang Zhang, and et al. Mitigating object hallucinations in large vision-language models through visual contrastive decoding. In CVPR, pp. 13872-13882, June 2024. +Bo Li, Yuanhan Zhang, and et al. Mimic-it: Multi-modal in-context instruction tuning. arXiv preprint arXiv:2306.05425, 2023a. +Bo Li, Kaichen Zhang, and et al. Llava-last: Stronger llms supercharge multimodal capabilities in the wild, May 2024. URL https://llava-v1.github.io/blog/2024-05-10-llava-last-stronger-llms/. +Chunyuan Li, Cliff Wong, and et al. Llava-med: Training a large language-and-vision assistant for biomedicine in one day. In NeurIPS, volume 36, pp. 28541-28564, 2023b. +Junnan Li, Dongxu Li, Silvio Savarese, and Steven Hoi. BLIP-2: Bootstrapping language-image pre-training with frozen image encoders and large language models. In ICML, 2023c. +Xiang Lisa Li, Ari Holtzman, and et al. Contrastive decoding: Open-ended text generation as optimization. arXiv preprint arXiv:2210.15097, 2022. + +Yifan Li, Yifan Du, Kun Zhou, Jinpeng Wang, Xin Zhao, and Ji-Rong Wen. Evaluating object hallucination in large vision-language models. In EMNLP, pp. 292-305, 2023d. +Tsung-Yi Lin, Michael Maire, and et al. Microsoft coco: Common objects in context. In ECCV, pp. 740-755, 2014. +Fuxiao Liu, Kevin Lin, Linjie Li, Jianfeng Wang, Yaser Yacoob, and Lijuan Wang. Mitigating hallucination in large multi-modal models via robust instruction tuning. In ICLR, 2024a. +Haotian Liu, Chunyuan Li, Qingyang Wu, and Yong Jae Lee. Visual instruction tuning. In NeurIPS, volume 36, pp. 34892-34916, 2023a. +Haotian Liu, Chunyuan Li, Yuheng Li, and Yong Jae Lee. Improved baselines with visual instruction tuning. In CVPR, pp. 26296-26306, June 2024b. +Shi Liu, Kecheng Zheng, and Wei Chen. Paying more attention to image: A training-free method for alleviating hallucination in lvlms. arXiv preprint arXiv:2407.21771, 2024c. +Shilong Liu, Zhaoyang Zeng, and et al. Grounding dino: Marrying dino with grounded pre-training for open-set object detection. ECCV, 2024d. +Xiaoze Liu, Ting Sun, Tianyang Xu, Feijie Wu, Cunxiang Wang, Xiaogian Wang, and Jing Gao. Shield: Evaluation and defense strategies for copyright compliance in lmm text generation. arXiv preprint arXiv:2406.12975, 2024e. +Xiaoze Liu, Feijie Wu, Tianyang Xu, Zhuo Chen, Yichi Zhang, Xiaogian Wang, and Jing Gao. Evaluating the factuality of large language models using large-scale knowledge graphs. arXiv preprint arXiv:2404.00942, 2024f. +Yuan Liu, Haodong Duan, and et al. Mmbench: Is your multi-modal model an all-around player? arXiv preprint arXiv:2307.06281, 2023b. +Pan Lu, Hritik Bansal, and et al. Mathvista: Evaluating mathematical reasoning of foundation models in visual contexts. In ICLR, 2024. +Fan Ma, Xiaojie Jin, Heng Wang, Yuchen Xian, Jiashi Feng, and Yi Yang. Vista-llama: Reducing hallucination in video language models via equal distance to visual tokens. In CVPR, 2024. +Potsawee Manakul, Adian Liusie, and Mark JF Gales. Selfcheckgpt: Zero-resource black-box hallucination detection for generative large language models. arXiv preprint arXiv:2303.08896, 2023. +AI Meta. Introducing meta llama 3: The most capable openly available llm to date. Meta AI, 2024. +Matthias Minderer, Alexey Gritsenko, and Neil Houlsby. Scaling open-vocabulary object detection. In NeurIPS, 2023. +Alec Radford, Jong Wook Kim, and et al. Learning transferable visual models from natural language supervision. In ICML, pp. 8748-8763, 2021. +Yongming Rao, Wenliang Zhao, and et al. Dynamicvit: Efficient vision transformers with dynamic token sparsification. NeurIPS, 34:13937-13949, 2021. +Anna Rohrbach, Lisa Anne Hendricks, Kaylee Burns, Trevor Darrell, and Kate Saenko. Object hallucination in image captioning. In EMNLP, pp. 4035-4045, 2018. +Tal Schuster, Adam Fisch, and et al. Confident adaptive language modeling. In NeurIPS, 2022. +Dustin Schwenk, Apoorv Khandelwal, and et al. A-okvqa: A benchmark for visual question answering using world knowledge. In ECCV, pp. 146-162, 2022. +Yuzhang Shang, Mu Cai, and et al. Llava-prumerge: Adaptive token reduction for efficient large multimodal models. arXiv preprint arXiv:2403.15388, 2024. +Rohan Taori, Ishaan Gulrajani, and et al. Stanford alpaca: an instruction-following llama model (2023). URL https://github.com/tatsu-lab/stanford_alpaca, 1(9), 2023. + +Hugo Touvron, Thibaut Lavril, and et al. Llama: Open and efficient foundation language models. arXiv preprint arXiv:2302.13971, 2023a. +Hugo Touvron, Louis Martin, and et al. Llama 2: Open foundation and fine-tuned chat models. arXiv preprint arXiv:2307.09288, 2023b. +Ashish Vaswani, Noam Shazeer, and et al. Attention is all you need. NeurIPS, 30, 2017. +Sheng Wang, Zihao Zhao, and et al. Chatcad: Interactive computer-aided diagnosis on medical image using large language models. arXiv preprint arXiv:2302.07257, 2023. +Xintong Wang, Jingheng Pan, and et al. Mitigating hallucinations in large vision-language models with instruction contrastive decoding. arXiv preprint arXiv:2403.18715, 2024a. +Xinyi Wang, Wanrong Zhu, and et al. Large language models are latent variable models: Explaining and finding good demonstrations for in-context learning. *NeurIPS*, 36, 2024b. +Sangmin Woo, Donguk Kim, and et al. Don't miss the forest for the trees: Attentional vision calibration for large vision language models. arXiv preprint arXiv:2405.17820, 2024. +Junfei Wu, Qiang Liu, and et al. Logical closed loop: Uncovering object hallucinations in large vision-language models. arXiv preprint arXiv:2402.11622, 2024a. +Mingrui Wu, Jiayi Ji, and et al. Evaluating and analyzing relationship hallucinations in lvlms. arXiv preprint arXiv:2406.16449, 2024b. +Qinghao Ye, Haiyang Xu, and et al. mplug-owl: Modularization empowers large language models with multimodality. arXiv preprint arXiv:2304.14178, 2023. +Shukang Yin, Chaoyou Fu, and et al. Woodpecker: Hallucination correction for multimodal large language models. arXiv preprint arXiv:2310.16045, 2023. +Alex Young, Bei Chen, and et al. Yi: Open foundation models by 01. ai. arXiv preprint arXiv:2403.04652, 2024. +Qifan Yu, Juncheng Li, and et al. Hallucidoctor: Mitigating hallucinatory toxicity in visual instruction data. In CVPR, pp. 12944-12953, June 2024a. +Tianyu Yu, Yuan Yao, and et al. Rlhf-v: Towards trustworthy mllms via behavior alignment from fine-grained correctional human feedback. In CVPR, pp. 13807-13816, June 2024b. +Weihao Yu, Zhengyuan Yang, and et al. Mm-vet: Evaluating large multimodal models for integrated capabilities. In ICML, 2024c. +Xiang Yue, Yuansheng Ni, and et al. Mmmu: A massive multi-discipline multimodal understanding and reasoning benchmark for expert agi. In CVPR, 2024a. +Zihao Yue, Liang Zhang, and Qin Jin. Less is more: Mitigating multimodal hallucination from an eos decision perspective. arXiv preprint arXiv:2402.14545, 2024b. +Muru Zhang, Ofir Press, William Merrill, Alisa Liu, and Noah A. Smith. How language model hallucinations can snowball. In ICML, 2024. +Shilong Zhang, Peize Sun, and et al. Gpt4roi: Instruction tuning large language model on region-of-interest. arXiv preprint arXiv:2307.03601, 2023. +Zhiyuan Zhao, Bin Wang, and et al. Beyond hallucinations: Enhancing lvlms through hallucination-aware direct preference optimization. arXiv preprint arXiv:2311.16839, 2024. +Yiyang Zhou, Chenhang Cui, and et al. Analyzing and mitigating object hallucination in large vision-language models. In ICLR, 2024. +Deyao Zhu, Jun Chen, Xiaoqian Shen, Xiang Li, and Mohamed Elhoseiny. Minigpt-4: Enhancing vision-language understanding with advanced large language models. arXiv preprint arXiv:2304.10592, 2023. +Lanyun Zhu, Deyi Ji, Tianrun Chen, Peng Xu, Jieping Ye, and Jun Liu. Ibid: Alleviating hallucinations in large vision-language models via image-biased decoding. arXiv preprint arXiv:2402.18476, 2024. + +# A APPENDIX + +Overview. More related work are described in Appendix A.1, including backgrounds about Large Vision-Language Models and Decoding Strategy in LLMs. The detailed experimental settings are in Appendix A.2 including Model Details and Implementation Details. Evaluation metric details, including CHAIR Evaluations, POPE Evaluations, and GPT-4 Assisted Evaluations are introduced in Appendix A.3. We demonstrate the GPT4-V Assisted Evaluation in Appendix A.4 for comprehensive evaluations. Moreover, we illustrate the results on More Benchmarks including MathVista (Lu et al., 2024), MM Vet (Yu et al., 2024c), LLaVA-Bench (Liu et al., 2023a), MMMU (Yue et al., 2024a) to evaluate the complex reasoning ability in Appendix A.5. We visualize some Case Study from the LLaVA-Bench-in-the-Wild dataset for qualitative analysis in Appendix A.6. More ablation experiments and analyses including More Analyses on Other Baselines, More Analyses on Adaptive Plausibility Constraint (Eq. 3), Quantitative Attention Scores Analyses, Token Selection Strategies Analyses, Larger-scale LVLM Backbone, Adopting Other Decoding Strategies, and Visual Enhancing Decoding Strategy are illustrated in Appendix A.7 + +# A.1 MORE BACKGROUNDS + +Large Vision-Language Models. Motivated by the success of Large Language Models (LLMs) (Touvron et al., 2023a; Bai et al., 2023a; Chiang & Li, 2023; Taori et al., 2023; Touvron et al., 2023b; Meta, 2024), recent studies have extended LLMs to multimodal regions and provided Large Vision-Language Models (LVLMs) (Liu et al., 2023a; Zhu et al., 2023; Chen et al., 2023a; Ye et al., 2023; Li et al., 2023a; Bai et al., 2023b; Li et al., 2023c; Dai & et al., 2023; Liu et al., 2024b; Bavishi et al., 2023; Chen et al., 2024c; Li et al., 2024) powered by pre-trained LLMs. LVLMs understand and generate diverse content in a more comprehensive way by integrating user instruction and vision inputs. LLaVA (Liu et al., 2023a) connects open-set vision encoder with LLMs (i.e., Vicuna (Chiang & Li, 2023)) by instruction tuning with elaborated language-image instruction-following data. Then, LLaVA-1.5 (Liu et al., 2024b) develops the vision-language connector that is data-efficient and powerful for better multimodal understanding. Shikra (Chen et al., 2023a) further incorporates grounding data and trains the model to understand the grounding knowledge in the given images. BLIP-2, InstructBLIP, and MiniGPT-4 (Li et al., 2023c; Dai & et al., 2023; Zhu et al., 2023) introduce a learnable querying transformer to fusion multimodal features and largely reduce image tokens. Fuyu (Bavishi et al., 2023) proposes a vanilla decoder-only architecture without the vision encoder and adapter that makes it easier to understand, scale, and deploy. InternVL (Chen et al., 2024c) proposes three simple but effective improvements, including a strong vision encoder, dynamic high-resolution, and high-quality bilingual dataset. Recently, built on SOTA open-source LLaMA 3 (Meta, 2024) and increasing the input vision resolution to $4 \times$ more pixels, LLaVA-NeXT (Li et al., 2024) exhibits excellent multimodal capabilities. Despite the impressive results, all of the above LVLMs suffer from serious trustworthy issues (Liu et al., 2024f;e), especially the hallucination problem, and we mainly conduct experiments on advanced LVLMs, including InstructBLIP, Shikra, LLaVA-1.5, and LLaVA-NeXT. + +Decoding Strategy in LLMs. Selecting decoding strategies in language models is crucial, as it determines how models generate text. Greedy decoding selects the highest probability next token at each step but might lead to less varied text. Beam search (Graves, 2012) is an accumulated-score-based decoding strategy. It maintains a set of beams to enlarge the candidate range and finally selects the best one in beams, which is more sophisticated than greedy decoding. Sampling decoding generates the next words by randomly selecting from the output distribution, where Top-k sampling (Fan et al., 2018) samples from Top-k likely tokens (Fan et al., 2018) and brings diversity but sometimes induces less coherent outputs. Top-p (Nucleus) sampling (Holtzman et al., 2020) improves Top-k sampling that considers the dynamic number of words that reach the probability p, achieving a balance between randomness and relevance. As demonstrated in Tables 1 and 3, while greedy decoding consistently surpasses sampling decoding in terms of hallucination metrics, most open-source and closed-source LVLMs default to using sampling decoding to promote diverse and coherent chat interactions. Therefore, it is practically meaningful to consider the constraints in Eq. 3 when analyzing sampling decoding. Recently, to alleviate the hallucination issue, DoLa (Chuang et al., 2024) decoding emphasizes the knowledge of mature layers and downplays that of pre-mature layers. OPERA (Huang et al., 2024) is established on beam-search decoding strategy and finds the interesting phenomenon of high-probability co-occurrence between the hallucination + +and the knowledge aggregation patterns. OPERA penalizes 'Over-Trust Logit' in the beam score to alleviate aggregation patterns. Self-Introspective Decoding (SID) can be seamlessly integrated into different decoding strategies to mitigate hallucinations without sacrificing text generation quality, such as diversity, coherence, and relevance. + +# A.2 DETAILED EXPERIMENTAL SETTINGS + +Models Details. To validate the effectiveness of our SID, we conduct experiments on four representative LVLMs: InstructBLIP (Dai & et al., 2023), Shikra (Chen et al., 2023a), LLaVA-1.5 (Liu et al., 2024b), and LLaVA-NeXT (Li et al., 2024). InstructBLIP employs Q-former (Li et al., 2023c) to condense image tokens to 32, as a result, we are unable to visualize the dynamic token pruning process of InstructBLIP like Fig. 3 and 4. Shikra, LLaVA-1.5, and LLaVA-NeXT directly leverage linear projection layers as vision-language connectors to align multimodal features. Shikra and LLaVA-1.5 encode 256 and 576 image tokens to LVLMs. LLaVA-NeXT increases the input vision resolution by $4\times$ to capture more visual details, resulting in $4\times$ more encoded vision tokens than LLaVA-1.5. All LVLMs utilize pre-trained vision encoders like CLIP (Radford et al., 2021) vision encoder, as well as pre-trained LLMs as language decoders, such as Vicuna v1.1 (Chiang & Li, 2023), LLaMA 2 (Touvron et al., 2023b), and recently released LLaMA 3 (Meta, 2024). We provide results at the 7 Billion (B) scale, and larger-scale results are in the Appendix A.7. + +Implementation Details. For sampling and greedy decoding, we adopt the default hyperparameter settings. As for Dola (Chuang et al., 2024), it is designed to alleviate hallucinations (i.e., improve factuality) of LLM by contrasting the differences in logits obtained from projecting the later layers versus premature layers. Dola is sensitive to the premature layer selection, we adapt Dola to LVLMs, following OPERA (Huang et al., 2024) to utilize “0,2,4,6,8,10,12,14” as the indexes of candidate premature layers and “32” as the index of the mature layer. The repetition penalty is set to 1.2, as Dola suggests. OPERA, VCD, and ICD are proposed for LVLMs and we adopt the default settings. For fair comparisons, SID's hyperparameters of Eq. 2 and 3 follow VCD and ICD. Moreover, we apply SID, VCD, and ICD in both sampling (Top-p=1) and greedy decoding settings for comprehensive comparisons. Note that due to amplified fine-grained hallucinations, SID is more robust to hyperparameters compared to other CD methods (Sec. 5). Experiments are performed on NVIDIA V100/A100 GPUs. + +# A.3 EVALUATION METRIC DETAILS + +CHAIR Evaluations. The Caption Hallucination Assessment with Image Relevance (CHAIR) (Rohrbach et al., 2018) metric is specially designed to assess objection hallucinations in the image caption tasks. Concretely, CHAIR quantifies the degree of hallucinations in a generated image caption by calculating the proportion of all objects mentioned in the caption that are not present in the ground truth label pool. There are two common variants of CHAIR: CHAIRi $(C_I)$ and CHAIRs $(C_S)$ , which evaluate the degree of object hallucination in the instance and sentence level, respectively. These two metrics are formulated as follows: + +$$ +C _ {I} = \frac {\left| \{\text {h a l l u c i n a t e d o b j e c t s} \} \right|}{\left| \{\text {a l l m e n t i o n e d o b j e c t s} \} \right|}, C _ {S} = \frac {\left| \{\text {c a p t i o n s w i t h h a l l u c i n a t e d o b j e c t s} \} \right|}{\left| \{\text {a l l c a p t i o n s} \} \right|} \tag {7} +$$ + +The smaller the value of $C_I$ and $C_S$ , the better the hallucination alleviation performance. + +POPE Evaluations. The Polling-based Object Probing Evaluation (POPE) (Li et al., 2023d) was recently developed to assess hallucination problems in LVLMs. POPE queries the LVLMs with the template: Is there a in the image? The ratio between queries about existing and no-existing objects is balanced (i.e., $50\% - 50\%$ ). This benchmark consists of three sampling settings: random, popular, and adversarial, each differing in the construction of negative samples. Specially, in the random setting, objects that are not present in the image are selected at random. The popular setting selects missing objects from the high-frequency pool, whereas in the adversarial setting, co-occurring objects that are not present in the image are prioritized. POPE consists of three different datasets, including MSCOCO (Lin et al., 2014), A-OKVQA (Schwenk et al., 2022), and GQA (Hudson & Manning, 2019). POPE involves 500 images from each dataset with six questions each, ultimately yielding 27,000 query-answer pairs. Accuracy and F1 score are chosen as evaluation metrics. The larger the value of Accuracy and F1 score, the better the hallucination alleviation performance. + +Table 7: GPT4-V assisted hallucination evaluations (Huang et al., 2024; Yin et al., 2023). VCD and ours adopt the same sampling decoding strategy. $C$ : correctness; $D$ : detailedness + +
SettingLLaVA-1.5InstructBLIPShikraLLaVA-NeXT
C↑D↑C↑D↑C↑D↑C↑D↑
Sampling5.185.794.735.105.035.175.345.67
Ours5.976.015.625.165.785.106.475.85
VCD5.465.634.985.215.315.245.925.47
Ours6.165.945.375.465.615.296.125.78
OPERA6.165.575.294.865.344.876.115.24
Ours6.155.945.765.425.975.886.636.23
+ +GPT-4 Assisted Evaluations. Besides object-existence-level hallucinations evaluated by CHAIR and POPE, GPT-4 assisted benchmark (Zhao et al., 2024) utilizes the fine-grained object-level description in the Visual Genome (VG) dataset (Krishna et al., 2017) as ground-truth and relies on the advanced GPT-4 to judge the detailed (such as positional, relational, and attribute) hallucinations and calculate Sentence-level Hallucination Ratio (SHR). With the generated sentences and manually annotated factual information, GPT-4 is prompted to evaluate whether existing hallucinations sentence by sentence. The prompt template is provided in Appendix Fig. 11. Following (Zhao et al., 2024), we utilize 200 images from the VG dataset and set max new tokens to 512, with the prompt of 'Please describe this image in detail.' We conduct experiments on sampling decoding strategies and representative LVLMs decoding strategies: VCD (Leng et al., 2024) and OPERA (Huang et al., 2024). + +# A.4 GPT4-V ASSISTED EVALUATION. + +To further analyze the hallucinations and text quality for open-end generation tasks, following (Huang et al., 2024; Yin et al., 2023), we utilize the strong multi-modal assistant GPT4-V, which simultaneously processes input from vision and text modalities. We strictly follow (Huang et al., 2024), which utilizes 500 images from the MSCOCO dataset and prompts LVLM: 'Please describe this image in detail.' with the maximum number of 512. To mitigate the impact of the sequential order fed to GPT4-V, we simultaneously compare the generated texts obtained from two decoding methods and instruct GPT4-V to judge the correctness and detailedness score on a scale of 0-10 based on the input image. The detailed GPT4-V prompt is in Appendix Fig. 12. We set up three representative pairs of comparison experiments: greedy decoding and ours, CD-based VCD (Leng et al., 2024) and ours, and OPERA (Huang et al., 2024) and ours. As shown in Table 7, our SID achieves the best results in terms of most metrics. Concretely, our method improves correctness by about $15 - 20\%$ compared to sampling decoding while not compromising the detailedness level. Compared to advanced hallucination mitigation methods VCD and OPERA, SID generates text with obvious more details and better mitigates the hallucination issue. Since the perceptual and reasoning capabilities of GPT4-V are very close to those of humans, the results of the GPT4-V evaluation reflect, to some extent, the strong performance of the compared methods in terms of mitigating hallucinations and generating text quality from a human perceptual perspective. + +# A.5 MORE GENERAL BENCHMARKS EVALUATION. + +To further validate the general ability of self-introspective decoding strategy, we conduct experiments on complex reasoning benchmarks, including MathVista (Lu et al., 2024), MMVet (Yu et al., 2024c), LLaVA-Bench (Liu et al., 2023a), MMMU (Yue et al., 2024a). MathVista is a robust mathematical reasoning evaluation benchmark that includes a series of challenging tasks requiring detailed deep visual recognition and compositional reasoning skills. MathVista is composed of 6,141 examples derived from 31 multimodal datasets involving mathematics. We utilize the 'test-mini' subset for testing. MMVet is a benchmark designed to evaluate large multimodal models on complex multimodal tasks. It outlines six fundamental vision-language capabilities: Recognition, Knowledge, OCR, Spatial Awareness, Language Generation, and Math, and assesses their integration across 16 emerging tasks. MMVet utilizes an LLM-based evaluator for open-ended outputs, providing consistent scoring across diverse question types and answer styles. This benchmark offers insights into the abilities of various large multimodal model paradigms and models, extending beyond mere performance ranking. LLaVA-Bench is a rigorous evaluation suite aimed at testing the visual-language alignment and instruction-following capabilities of LVLMs. Here, we utilize the LLaVA-Bench (In-the-Wild) subset, which includes 24 varied images from different domains, such + +Table 8: LVLM General Benchmark Evaluations. * denotes employing greedy decoding strategy. + +
GreedyVCD*OPERASID*
MathVista27.126.327.127.4
MM Vet31.130.231.131.2
LLaVA-Bench63.463.664.368.7
MMMU32.631.032.633.4
+ +Table 9: Object-level and Attribute-level Hallucination Evaluations. * and † denote adopting the same sampling and greedy decoding strategies. Experiments are conducted on LLaVA-1.5 7B. + +
Object-level ↑Attribute-level ↑Total
ExistenceCountPositionColor
Sampling171.7120.8112.6151.0556.1
Dola*173.2122.4115.2152.8563.6
VCD*174.4124.1119.4153.6571.5
Ours*180.5130.7123.8154.5589.5
Greedy182.3130.3126.8155.7594.1
Dola*180.1127.4119.3154.4581.2
VCD*179.5128.1123.8155.5586.9
Ours*183.9132.2127.8155.9599.8
+ +as memes, paintings, and sketches, with a total of 60 questions. MMMU serves as a benchmark for assessing multimodal models on tasks that span multiple disciplines, necessitating college-level subject knowledge, and deliberate reasoning. It includes 11,500 questions across 30 subjects and 183 sub-fields, focusing on advanced perception and reasoning in domain-specific knowledge areas. We compare SID with two representative decoding methods (i.e., VCD and OPERA) on LLaVA-1.5 7B. Table 8 indicates that our SID enhances reason abilities, particularly in the LLaVA-Bench benchmark. However, VCD slightly degrades LVLM's complex reasoning ability, as reflected in MathVista, MMVet, and MMMU benchmarks. OPERA has little gains in discrimination tasks. These results are consistent with Table 5 (MME and MMbench benchmarks), Table 3, and Table 4. We also illustrate experimental results of Existence, Count, Position, and Color subsets of the MME benchmark in Table 9, which evaluate the object-level and attribute-level hallucinations. Without the assistance of auxiliary analysis networks, our method achieves +33.4 and +18.0 compared to sampling and VCD on MME subsets, validating the effectiveness in alleviating object- and attribute-level hallucinations. + +# A.6 CASE STUDY. + +In addition to using crafted metrics (CHAIR and POPE), GPT-4/GPT4-V-aided evaluations, and MME (Fu et al., 2023) and MMBench (Liu et al., 2023b) benchmarks, we qualitatively present several case studies of SID's hallucination alleviation ability from LLaVA-Bench-in-the-Wild dataset (Liu et al., 2023a). As illustrated in Appendix Fig. 13, 14, and 15, SID effectively mitigates hallucination in these challenging scenes by dynamically amplifying vision-and-text association hallucinations. Meanwhile, it preserves the detailness of each image. As we propose a training-free decoding method that does not rely on auxiliary analysis networks, it inherently carries over the existing weaknesses of LVLMs. Intuitive case studies, as illustrated in Appendix Fig. 13, 14, and 15, reveal that SID still generates some hallucinations, particularly in finer details such as eye color and vehicle identification specifics. These failures may be attributed to the vision encoder's relatively limited visual perception ability. For future work, it is promising to integrate SID with InternVL (Chen et al., 2024c), which scales the vision encoder up to 6B, or consider leveraging auxiliary analysis networks like Grounding DINO (Liu et al., 2024d) or OWLv2 (Minderer et al., 2023) to mitigate LVLMs' internal weaknesses. + +# A.7 MORE ABLATION ANALYSES + +More Analyses on Other Baselines. + +Table 10: Comparisons with tuning-based and auxiliary networks-based baselines. All methods adopt the greedy decoding strategy. LURE and HA-DPO adopt MiniGPT-4 13B and LLaVA-1.5 7B, respectively. + +
POPE↑CHAIRs↓CHAIRi↓MME↑
Greedy78.655.414.2805.7
LURE78.755.114.0846.2
+VCD78.355.014.3813.4
+SID82.552.113.6854.9
SID82.251.913.2838.1
Greedy83.649.614.41510.8
HA-DPO85.444.713.61522.3
+VCD83.046.113.81500.6
+SID86.243.812.41532.7
SID85.944.212.21525.3
+ +As SID is a training-free plug-and-play decoding strategy that do not require robust instruction tuning with curated datasets (Lee et al., 2022; Gunjal et al., 2024; Liu et al., 2024a; Zhao et al., 2024; Jiang et al., 2024; Yu et al., 2024b;a; Ma et al., 2024; Yue et al., 2024b) and post-hoc utilizing auxiliary analysis networks (Manakul et al., 2023; Zhou et al., 2024; Yin et al., 2023; Chen et al., 2024b; Wu et al., 2024a; Feng et al., 2024), we do not compare with above two types of methods for fairness. To further validate the robustness of SID, we compare SID with the auxiliary analysis networks-based method (i.e., LURE (Zhou et al., 2024)) and the robust instruction tuning-based method (i.e., HA-DPO (Zhao et al., 2024)) and apply the plug-and-play SID to LURE and HA-DPO on POPE, CHAIR, and MME benchmarks, following their official implementations as shown in Table 10. Experimental results indicate that SID outperforms LURE and HA-DPO in most cases. Additionally, seamlessly integrating SID with LURE and LRV can significantly enhance performance. + +# More Analyses on Adaptive Plausibility Constraint. + +To further analyze the effectiveness of Eq. 3, we test contrastive decoding-based methods with and without adaptive plausibility constraint (Eq. 3) on open-end generation task (CHAIR (Rohrbach et al., 2018)) and more comprehensive MME benchmark (Fu et al., 2023). As shown in Table 11, the adaptive plausibility constraint (Eq. 3) greatly affects generated texts, and most metrics underperform vanilla sampling decoding without the adaptive plausibility constraint (Eq. 3). The proposed SID avoids potential uncertainty noise by inducing fine-grained hallucinations, greatly maintaining the performances when ablating Eq. 3. + +Table 11: Efficacy Analyses of Eq. 3 on LLaVA-1.5 7B. All methods adopt the sampling decoding strategy, and results are the average of three running times with three random seeds. + +
CHAIRs↓CHAIRi↓MME ↑
Sampling51.316.81471.5
ICD48.713.91479.7
w/o Eq. 352.216.61448.5
VCD48.014.31481.9
w/o Eq. 351.917.21457.1
SID45.011.71487.3
w/o Eq. 346.512.21484.6
+ +# Attention Scores and Token Selection Strategies Analyses. + +Quantitative Attention Scores Analyses. Here we quantitatively analyze vision attention score in terms of POPE (Li et al., 2023d) and CHAIR (Rohrbach et al., 2018) metrics. Concretely, we select the top-100 and least-100 important vision tokens out of a total of 576 vision tokens of LLaVA-1.5 7B based on attention score based on Eq. 5. Visual and Instruction Disturbance (VD and ID) are also employed as inputs for analyses. Quantitative results in Table 12 illustrate that 100 out of 576 vision tokens with high attention scores greatly maintain original ability, while low attention score tokens reach almost $50\%$ accuracy for the binary classification problem, which indicates attention scores are a good indicator for vision token importance. As for VD and ID, disturbance in raw input does not obviously harm the LVLMs' discrimination ability, as indicated by the POPE metric. However, VD and ID significantly compromise the open-end generation tasks reflected by the CHAIR metric (LVLMs tend to refuse to ID as shown in Fig. 5 and 10). + +Token Selection Strategies Analyses. To validate the effectiveness of SID in selecting low attention scores to induce vision-and-text association hallucination, we further conduct quantitative + +Table 12: Efficacy Analyses on Vision Token Attention Scores with POPE metric on MSCOCO dataset and CHAIR metric. We select the Top-100 and Least-100 important vision tokens out of a total of 576 vision tokens of LLaVA-1.5 7B, based on Eq. 5 (i=3). VD: Visual Disturbance; ID: Instruction Disturbance. + +
SettingRandomAdversarialCHAIRs ↓CHAIRi ↓
Accuracy ↑F1 Score ↑Accuracy ↑F1 Score ↑
Greedy88.888.679.380.949.614.4
+Top-10085.683.977.176.352.715.2
+Least-10055.366.154.065.363.238.7
+VD88.087.678.979.856.716.9
+ID88.287.779.180.1--
+ +Table 13: Analyses of Different Token Selection Strategies with POPE on MSCOCO dataset and CHAIR metrics. We select the high importance scores (Eq. 5) of vision tokens (-Top) and random vision tokens (-Random) for contrastive decoding. Experiments are conducted on LLaVA-1.5 7B. + +
SettingRandomAdversarialCHAIRs ↓CHAIRi ↓
Accuracy ↑F1 Score ↑Accuracy ↑F1 Score ↑
Greedy88.888.679.380.949.614.4
Ours89.389.583.382.544.212.2
-High87.087.376.579.457.925.6
-Random88.487.280.981.548.613.5
AVISC88.488.179.880.545.314.7
Sampling84.983.278.778.951.316.8
Ours88.888.782.682.145.011.7
AVISC87.987.977.579.646.612.5
+ +experiments under different vision token selection strategies with the same preserved vision token number and Layer $i = 3$ as ours. Table 13 shows that vision tokens with high attention scores degrade obviously, as it does not amplify contextual hallucinations rather than retain original important information. Contrastive decoding does not benefit from subtracting hallucinations amplified by the disturbed inputs rather than suffers from the potential disturbance noise. Selecting random vision tokens brings improvements in the adversarial setting because randomly selected vision tokens amplify the over-reliance on statistical bias and language priors, similar to Vision CD (Leng et al., 2024) and Instruction CD (Wang et al., 2024a). However, token-level random disturbance also induces uncertainty noise, resulting in the inferior performance in the random setting to greedy decoding. Moreover, AVISC (Woo et al., 2024), in contrast to ours, preserves outlier high attention tokens (named 'blind token') and subtracts output logits to counteract the overemphasis of 'blind token.' In this way, AVISC promotes balanced consideration of all tokens to alleviate hallucinations. However, Table 13 illustrates that Top-100 vision tokens with high attention scores can largely maintain the original performance. 'blind token' tends to have a high probability of target class logits, and contrastive decoding does not improve the target class's probability while might bring extra noise. Table 13 indicates AVISC still degrades the greedy decoding to some extent, which indicates the attentional vision re-calibration strategy of AVISC induces some annoying noise. Overall, these experiments further validate the rationality of our token selection strategy based on attention sores. + +Table 14: Results on Larger-scale Backbones. Sampling decoding is adopted and results average of three running times. + +
POPECHAIR
MethodsAccuracyF1 ScoreCSCI
LLaVA-1.581.6080.3149.616.1
+VCD82.6781.4646.716.4
+OPERA82.3281.1043.313.6
+Ours84.7583.1743.512.7
InstructBLIP77.2679.2350.819.7
+VCD79.7780.2747.917.6
+OPERA80.3180.9142.514.3
+Ours81.9782.2141.713.3
+ +# Larger-scale LVLM Backbones. + +We validate the effectiveness of SID in terms of 13B scale backbones on LLaVA-1.5 and Instruct-BLIP architectures. We choose POPE (Li et al., 2023d) and CHAIR (Rohrbach et al., 2018) to + +validate the hallucination issues in both discrimination and open-end generation tasks. Table 14 shows that SID remains effective as backbone networks scale up. + +![](images/3082c2c4a34117efa218312546829b8983172a4b55531d9066c14824c97384cf.jpg) +Figure 9: Results of different decoding strategies. + +# Adopting Other Decoding Strategies. + +Meanwhile, besides direct sampling and greedy decoding, we conduct experiments on LLaVA-1.5 7B using the MSCOCO dataset with various decoding strategies, including Top-p sampling $(p = 0.9)$ , Top-k sampling $(k = 50)$ , Top-k sampling with varying temperature $(k = 50, t = 1.5$ and 0.8). Figure 9 shows that, regardless of the sampling strategy adopted, the application of SID consistently helps to alleviate hallucinations and improve the overall performance of LVLMs. This consistency highlights the versatility and effectiveness of SID across different sampling strategies. + +# Visual Enhancing Decoding Strategy. + +Although LVLMs can accurately recognize visual elements, LVLMs have difficulty fully interpreting those elements in the context of the input cue and effectively linking that recognition to their internal knowledge. We follow Visual Description Grounded Decoding (VDGD) (Ghosh et al., 2024) by first generating a detailed description of the image and appending it as a prefix to the instruction. The prompt template is adopted from (Ghosh et al., 2024): I have been given this image to complete the task described as: inst. To help me complete the task, describe the given image in detail. In the case of real-world scenes, please include all foreground and background objects in the description, their properties (like color, shape, etc.), their relations with other objects, their count, and all other components in the image. In case of non-real-world scenes, like charts, graphs, tables, etc., please describe the table, mention all numbers (if any), mention the written text, and all other details. Experiments are performed on hallucination evaluation benchmarks (i.e., POPE and CHAIR) and the general ability benchmark (i.e., MMbench). We re-implement VDGD based on official codes on LLaVA-1.5 7B. Table 15 demonstrates the effectiveness of VDGD (Ghosh et al., 2024) in LVLM's hallucination alleviation and general reasoning ability. However, the grounding visual descriptions, generated by LVLMs themselves, enhance the visual perception reasoning capabilities while might inevitably contain hallucinations. Therefore, VDGD is inferior in the POPE (adversial) subset, which prioritizes co-occurring objects which are not present in the image. Meanwhile, VDGD shares somewhat similar motivations in enhancing vision information via Eq. 6 as we analyzed. The experiments in Table 2 are consistent with the above results, indicating that boosting the vision information is effective in mitigating hallucinations but is less effective in complex (i.e., adversarial) environments. + +Table 15: Comparisons with Visual Enhancing Strategy (VDGD). $\star$ denotes employing greedy decoding strategy. + +
POPE↑ (random)POPE↑ (adversarial)CHAIRs↓CHAIRi↓MMbench↑
Greedy88.879.149.614.464.4
OPERA88.979.245.212.764.4
VDGD*89.079.446.713.765.2
SID*89.383.344.212.265.0
+ +![](images/703c7b1439bafa067fb543ed32497a3bdc093ab297c33f39c57f280837a71832.jpg) +Original + +![](images/57301b731925e4e6720f77c2db81c953ccf3bd11969c58c28dd40cab9d53c806.jpg) +Ours +Figure 10: Instance Illustration of different disturbance results. Examples are from MSCOCO (Lin et al., 2014) inferred by LLaVA-1.5 7B with $i = 3$ and Top-k=50. Hallucinations are marked in red. +Figure 11: Prompts of GPT-4 for evaluations. + +![](images/c4715a17dfc4a75b6be45c637ae883e1db4b96d2200007c2c27e66e10be8703f.jpg) +VD +ID + +'You are a confused image caption model.' + +Normal (Greedy): The image captures a beautiful beach scene with a man standing on the sand, flying a colorful kite. The kite is soaring high in the sky, adding a vibrant touch to the scene. The man appears to be enjoying his time at the beach, possibly taking a break from flying the kite to admire the view. The beach is surrounded by a lush green forest, creating a serene and picturesque environment. The waves are crashing gently on the shore, and the overall atmosphere is calm and peaceful. +Ours: The image depicts a beautiful beach scene with a large body of water in the background. The beach is lined with bushes, providing a serene and natural atmosphere. There are several people scattered across the beach, enjoying the sun and the view. nln the water, a boat can be seen floating near the shore, adding to the picturesque scene. The combination of the beach, bushes, and water creates a perfect setting for relaxation and leisure activities. +VD: The image features a beautiful beach scene with a large body of water in the background. The water appears to be a mix of blue and white, creating a serene atmosphere. A kite can be seen flying in the sky, adding a touch of playfulness to the scene.\nThere are several people scattered across the beach, enjoying the view and the outdoors. Some of them are closer to the water, while others are further back on the sand. The combination of the kite, the people, and the water creates a lively and picturesque beach scene. +ID: What is this thing? I'm sorry, I'm not sure what you are asking. The image shows several persons on the beach. + +# GPT-4 Prompt + +Please help me judge if the comment of this image is hallucination or correct. + +I will give you a list of region description of a image. The format is [x1, y1, x2, y2]: region description, where [x1, y1, x2, y2] is the bounding box of the region. Highly overlapping bounding boxes may refer to the same object. This is the ground truth information of the image. Besides, I give you some factual information about the content of the image (which is $100\%$ accurate). Your judgement should base on this information. However, this information only describes the objects in the region of image, so it cannot describe the subjective part of the image, e.g., atmosphere, style, emotion. In that case, you can return "Cannot judge". + +Also, I will give you a list of comments of the image for you to judge if it is hallucination. Please give a judgement one by one along with the reason. + +Your output should be: + +Judgement: + +1. hallucination or correct or cannot judge: + +2... + +Here are the region descriptions of the image: + +{} + +Factual Information: + +1 + +Here is the comment for you to judge (hallucination, correct, or cannot judge): + +{} + +# GPT4-V Prompt + +You are required to score the performance of two AI assistants in describing a given image. You should pay extra attention to the hallucination, which refers to the part of descriptions that are inconsistent with the image content, such as claiming the existence of something not present in the image or describing incorrectly in terms of the counts, positions, or colors of objects in the image. Please rate the responses of the assistants on a scale of 1 to 10, where a higher score indicates better performance, according to the following criteria: + +1: Accuracy: whether the response is accurate with respect to the image content. Responses with fewer hallucinations should be given higher scores. +2: Detailedness: whether the response is rich in necessary details. Note that hallucinated descriptions should not count necessary details. + +Please output the scores for each criterion, containing only two values indicating the scores for Assistant 1 and 2, respectively. The two scores + +are separated by a space. Following the scores, please provide an explanation of your evaluation, avoiding any potential bias and ensuring that the order in which the responses were presented does not affect your judgment. + +[Assistant 1] + +{} + +[End of Assistant 1] + +[Assistant 2] + +{} + +[End of Assistant 2] + +Output format: + +Accuracy: + +Reason: + +Detailedness: + +Reason: + +![](images/e0f58d227ac6befd9b90ba61312d26d6f51d99d8d4aaada9efe321b33e42a047.jpg) +Figure 12: Prompts of GPT4-V for evaluations. +Figure 13: Case Study from LLaVA-Bench-in-the-Wild on LLaVA-1.5 7B. Hallucinations are marked in red. + +# Instruction + +(max new tokens=512) + +Please describe this + +image in detail. + +Greedy: The image features a dog wearing a gown, possibly painted as a mona lisa painting. The dog is looking at the camera with a curious expression, displaying its unique attire. The gown appears to be burgundy color and complements the dog's outfit.\n\nThe setting of the painting includes a pond and a rock formation in the background, adding a sense of depth and atmosphere to the artwork. Additionally, there is another small figure, possibly a dog or a human, in the upper-left corner of the picture.\n\n + +OPER: The image features a painting of a dog wearing a Renaissance-style dress, with a hood over its head. The dog appears to be a poodle, and it is sitting in a chair, giving the impression of a human-like figure. The painting is quite detailed, capturing the dog's facial expression and the intricate design of the Renaissance dress. The dog's attire and the overall composition of the painting create a unique and interesting visual experience. + +VCD: The image is a painting of a woman wearing a Renaissance-style dress and a hood, resembling a dog. The woman has a dog's face painted on her forehead, and she is wearing a hat. The painting captures the unique and whimsical blend of human and canine features. In the background, there is a boat visible, adding a sense of depth and context to the scene. The woman's attire and the dog's face on her forehead create a playful and imaginative atmosphere. + +Ours: The painting features a dog wearing Renaissance paint makeup and a veil, posing as a Mona Lisa-style figure. The dog's face is adorned with a mustache and hat, giving it a unique and artistic appearance. The dog's sitting position is also painted to resemble a human's, adding to the creative and humorous nature of the painting. In the background, there is a river visible, which complements the overall composition of the painting. The dog's position and the artistic elements create a captivating and amusing scene. + +![](images/a96b2eccb38594771fab3f3c336eae9ecb647c08408678eea0738f1fa48000b4.jpg) + +# Instruction + +(max new tokens=512) + +Please describe this + +image in detail. + +Greedy: The image features a group of three animals sitting around a dining table, enjoying a meal together. The animals include a large brown bear, a cat, and a rabbit. They are all seated on the grass, with the bear on the left side, the cat in the middle, and the rabbit on the right side of the table. The table has two tables, one with food items, including a cake, a bowl, and a cup. The cake is placed in the center of the table, while the bowl and cup are positioned closer to the edge. The scene appears to be a whimsical and playful depiction of the animals sharing a meal. + +OPER: The image depicts a whimsical scene of a bear, a cat, and a rabbit sitting around a dining table, enjoying a meal together. The bear is on the left side of the table, the cat is in the middle, and the rabbit is on the right side. Each animal has a plate of food in front of them. The table is set with various utensils such as forks, knives, and spoons, as well as cups and bowls. There are also a couple of cakes placed on the table, adding to the delightful atmosphere of the gathering. In the background, a potted plant can be seen, adding a touch of greenery to the scene. + +VCD: The image features a whimsical scene of three animals sitting around a dining table, enjoying a meal together. A brown bear is sitting on one side of the table, while a cat is seated on the opposite side, and a rabbit is sitting on the far right side of the table. n\ nVarious food items are placed on the table, including a cup, a bowl, and several cakes. The cakes are spread across the table, with one near the center, another closer to the rabbit, and the third one near the cat. The table is set in a lush green field, giving the scene a peaceful and inviting atmosphere. + +Ours: The watercolor illustration features three animals sitting around a dining table, enjoying cookies and doughnuts. A large brown bear is on one side of the table, while a gray cat and a yellowish rabbit are on the other side. The cat has blue eyes and is drinking from a blue cup, while the rabbit holds a pink cup as well. The table is topped with a plate of various desserts, including multiple cookies and doughnuts. The scene is set in a field surrounded by green grass and trees, giving the whole watercolor a natural and whimsical atmosphere. + +![](images/121e5d05a811338af4a063478f8bde9ac3227530924e968329494d28200b76f1.jpg) +Figure 14: Case Study from LLaVA-Bench-in-the-Wild on LLaVA-1.5 7B. Hallucinations are marked in red. +Figure 15: Case Study from LLaVA-Bench-in-the-Wild on LLaVA-1.5 7B. Hallucinations are marked in red. + +# Instruction + +(max new tokens=512) + +Please describe this + +image in detail. + +Greedy: The image features a man standing on the back of a yellow taxi cab, holding a blue shirt. He appears to be ironing the shirt while the taxi is in motion. The taxi is driving down a busy street, with other vehicles such as a truck and a car visible in the scene. n\ nThere are also a few potted plants scattered around the area, adding some greenery to the urban environment. Additionally, a traffic light can be seen in the background, indicating that the taxi is driving through an intersection. + +OPERA: In the image, a man wearing a yellow shirt is standing on the back of a yellow taxi, ironing clothes. The taxi is driving down a busy city street, surrounded by other vehicles such as cars and trucks. One car is positioned behind the taxi on the left side, while another car can be seen further down the street on the right side. A truck is also visible on the right side of the street.\nThere are several potted plants placed along the street, adding a touch of greenery to the urban environment. One potted plant is located near the center of the scene, while two others are positioned closer to the right side of the street. + +VCD: The image features a man ironing clothes on the back of a yellow SUV taxi. He is standing on a clothes iron, which is placed on top of a metal frame mounted on the back of the vehicle. The man is focused on his task, and the scene is quite unusual as it takes place on a busy city street. \nThere are several other vehicles in the scene, including a truck and a car on the left side of the image, and another car on the right side. Additionally, there are two potted plants visible in the scene, one near the center and the other on the left side. + +Ours: In the image, a man is ironing clothes while riding on the back of a yellow SUV taxi. He is standing on a portable desk, which is strapped to the back of the vehicle. The taxi is driving down a busy city street, surrounded by various vehicles, including a yellow taxi and a truck.\n\n \ No newline at end of file diff --git a/ICLR/2025/Self-Introspective Decoding_ Alleviating Hallucinations for Large Vision-Language Models/images.zip b/ICLR/2025/Self-Introspective Decoding_ Alleviating Hallucinations for Large Vision-Language Models/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..08f50d45ccf0fe6700930febf70d8a2f60874200 --- /dev/null +++ b/ICLR/2025/Self-Introspective Decoding_ Alleviating Hallucinations for Large Vision-Language Models/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f670d10d1b3217c2e97bd74103106d1561635c88f8adc2c7b7e8dfac9eb1a493 +size 1073519 diff --git a/ICLR/2025/Self-Introspective Decoding_ Alleviating Hallucinations for Large Vision-Language Models/layout.json b/ICLR/2025/Self-Introspective Decoding_ Alleviating Hallucinations for Large Vision-Language Models/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..960dd365c1a70d28b547d92219ca507fe3315700 --- /dev/null +++ b/ICLR/2025/Self-Introspective Decoding_ Alleviating Hallucinations for Large Vision-Language Models/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6d41d5487cb4369722e09748c7531cb86a9a55df81d75045c6e0605aa661284a +size 770049 diff --git a/ICLR/2025/Self-MoE_ Towards Compositional Large Language Models with Self-Specialized Experts/ab4deabf-104a-45d6-a792-9aa6ea64e92c_content_list.json b/ICLR/2025/Self-MoE_ Towards Compositional Large Language Models with Self-Specialized Experts/ab4deabf-104a-45d6-a792-9aa6ea64e92c_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..d6d22dfb5184349b0f86b73f224207df30b02f43 --- /dev/null +++ b/ICLR/2025/Self-MoE_ Towards Compositional Large Language Models with Self-Specialized Experts/ab4deabf-104a-45d6-a792-9aa6ea64e92c_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cfa0acc8c9ee09d32bfe4d4f8f9fd0ba30d9921b255d6d5485ea2522486d00db +size 146038 diff --git a/ICLR/2025/Self-MoE_ Towards Compositional Large Language Models with Self-Specialized Experts/ab4deabf-104a-45d6-a792-9aa6ea64e92c_model.json b/ICLR/2025/Self-MoE_ Towards Compositional Large Language Models with Self-Specialized Experts/ab4deabf-104a-45d6-a792-9aa6ea64e92c_model.json new file mode 100644 index 0000000000000000000000000000000000000000..5e19229922eb441cde0620191319d26153a7e14a --- /dev/null +++ b/ICLR/2025/Self-MoE_ Towards Compositional Large Language Models with Self-Specialized Experts/ab4deabf-104a-45d6-a792-9aa6ea64e92c_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a9a43f8c6b1fd9bd43ef94769ddf7d6e74fcba4300af1ae8c9bf13b83570255f +size 179009 diff --git a/ICLR/2025/Self-MoE_ Towards Compositional Large Language Models with Self-Specialized Experts/ab4deabf-104a-45d6-a792-9aa6ea64e92c_origin.pdf b/ICLR/2025/Self-MoE_ Towards Compositional Large Language Models with Self-Specialized Experts/ab4deabf-104a-45d6-a792-9aa6ea64e92c_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..985028e2b1e7218fa4f692e87f2f0c36e83a3c60 --- /dev/null +++ b/ICLR/2025/Self-MoE_ Towards Compositional Large Language Models with Self-Specialized Experts/ab4deabf-104a-45d6-a792-9aa6ea64e92c_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7488bb3904f76d853addd20dd20786ee2d690067c8ca353d2f1d597f93071a81 +size 1050545 diff --git a/ICLR/2025/Self-MoE_ Towards Compositional Large Language Models with Self-Specialized Experts/full.md b/ICLR/2025/Self-MoE_ Towards Compositional Large Language Models with Self-Specialized Experts/full.md new file mode 100644 index 0000000000000000000000000000000000000000..352f8360b952aa1f91f32b8d34dc1dc66899459f --- /dev/null +++ b/ICLR/2025/Self-MoE_ Towards Compositional Large Language Models with Self-Specialized Experts/full.md @@ -0,0 +1,555 @@ +# SELF-MOE: TOWARDS COMPOSITIONAL LARGE LANGUAGE MODELS WITH SELF-SPECIALIZED EXPERTS + +Junmo Kang* + +Georgia Tech + +Leonid Karlinsky + +MIT-IBM Watson AI Lab + +Hongyin Luo + +MIT + +Zhen Wang + +UCSD + +Jacob Hansen + +MIT + +James Glass + +MIT + +David Cox + +MIT-IBM Watson AI Lab + +Rameswar Panda + +MIT-IBM Watson AI Lab + +Rogerio Feris + +MIT-IBM Watson AI Lab + +Alan Ritter + +Georgia Tech + +# ABSTRACT + +We present Self-MoE, an approach that transforms a monolithic LLM into a compositional, modular system of self-specialized experts, named MiXSE (MiXture of Self-specialized Experts). Our approach leverages self-specialization, which constructs expert modules using self-generated synthetic data, each equipping a shared base LLM with distinct domain-specific capabilities, activated via self-optimized routing. This allows for dynamic and capability-specific handling of various target tasks, enhancing overall capabilities, without extensive human-labeled data and added parameters. Our empirical results reveal that specializing LLMs may exhibit potential trade-offs in performances on non-specialized tasks. On the other hand, our Self-MoE demonstrates substantial improvements (6.5%p on average) over the base LLM across diverse benchmarks such as knowledge, reasoning, math, and coding. It also consistently outperforms other methods, including instance merging and weight merging, while offering better flexibility and interpretability by design with semantic experts and routing. Our findings highlight the critical role of modularity, the applicability of Self-MoE to multiple base LLMs, and the potential of self-improvement in achieving efficient, scalable, and adaptable systems. + +# 1 INTRODUCTION + +The remarkable success of Large Language Models (LLMs) has been largely attributed to their generalist nature, allowing them to perform a wide variety of tasks (Brown et al., 2020; Touvron et al., 2023; Jiang et al., 2023; Team et al., 2024). Predominantly designed as monolithic architectures, these models rely extensively on large-scale data to embed generalized language capabilities across vast parameter spaces. While effective, this monolithic architecture, as illustrated in Figure 1, inherently suffers from significant drawbacks such as inefficiency in scaling (Zhang et al., 2024; Wan et al., 2024), susceptibility to forgetting previously learned information when adapted to specialized tasks (Kotha et al., 2024; Huang et al., 2024), and a lack of transparency which leads to the black-box nature (Zhao et al., 2023). + +Meanwhile, the increasing demand to handle domain-specific or expert-level tasks has highlighted the need for specialization of LLMs (Cheng et al., 2024; Ling et al., 2023; Feng et al., 2024). However, effective tuning often relies on high-quality, human-annotated data, which is costly and challenging to scale (Kang et al., 2023), especially in specialized domains where expertise is scarce and valuable (Wu et al., 2023). Self-specialization (Kang et al., 2024) offers a promising alternative, aligning models with self-generated synthetic data. While this technique has proven effective in cross-task generalization within a target expert domain, we posit that it may compromise performance in areas outside the target domain. + +![](images/6be0010334755efe48ec64d7973cc7f94f24b713ec3e41e2f3262b94dc1746eb.jpg) +Figure 1: Concept of Self-MoE, illustrating the transformation from a monolithic LLM to a compositional system, MiXSE, without extensive resources and addition of significant parameters. MiXSE distinguishes itself from traditional MoEs and other models in post-training, lightweight semantic experts, and/or self-generated synthetic data. The results showcase MiXSE's improved capabilities over the base LLM (e.g., Gemma-7B) across all domains, unlike the knowledge-specialized LLM that compromises other capabilities. + +![](images/af7c2624257836f00fb26e3ca2469f843c0d127faa5c52a7090065dabdd798cd.jpg) + +In this paper, we explore the following question: How can we build compositional LLMs that enjoy versatile expertise, while using minimal resources? We introduce Self-MoE (Figure 1), an approach that transforms a monolithic model into a compositional (Zaharia et al., 2024) system, called MiXSE (MiXture of Self-specialized Experts). This approach differs from prior MoE work using LoRA (Hu et al., 2022), which either relies on human-labeled data (Wu et al., 2024) or assumes the existence of trained modules (Huang et al., 2023; Muqeeth et al., 2024). Instead, our Self-MoE constructs individual lightweight expert modules from scratch using synthetic data, inspired by the concept of self-specialization. Each module is integrated with a shared base LLM, and the entire system is enhanced by a self-optimized routing mechanism. In contrast to monolithic models, which often suffer from forgetting issues when adapted or merged under fixed, static parameters, our modular design preserves the integrity and semantics of each expert. This allows for dynamic, precise handling of various target domain tasks, boosting the model's overall capability, adaptability, and interpretability. + +Through extensive empirical studies conducted across a variety of popular domains, including knowledge, reasoning, math, and coding, we find that specialization often comes with trade-offs, typically degrading performance in non-targeted domains. However, our Self-MoE demonstrates substantial overall improvements over a base LLM across all target domains without compromising performance on other tasks. Notably, the compositional nature of our MiXSE appears to exploit synergies among experts, even outperforming all individual specialized experts. + +Moreover, MiXSE clearly surpasses other strong baselines such as instance merging and weight merging, under similar settings, while offering better flexibility and interpretability. Detailed analyses highlight the critical role of the routing mechanism and the contribution of semantic experts in achieving these results. Our interpretable visualizations of routing distributions further elucidate how tasks are dynamically allocated to the most relevant experts. Lastly, we further validate that there are no issues related to forgetting unlike monolithic baselines, and that our approach can be applied to various model families and sizes. In summary, our key contributions are as follows: + +- We highlight the inherent limitations of monolithic model specialization, where focusing on a specific capability often comes at the cost of degrading performance in other domains. +- We propose Self-MoE, which allows a base, monolithic LLM to upgrade into a modular system of lightweight, self-specialized experts, without requiring extensive human supervision, compute resources, or overhead in active parameters. +- We provide comprehensive experiments and analyses across a range of benchmarks, where Self-MoE demonstrates consistent improvements with an average of $6.5\%$ across domains over a base LLM, outperforming various baselines. Our ablation studies validate the impact of modularity, routing strategies, and the use of self-generated synthetic data. Moreover, our analyses explore routing distributions, forgetting issues, and the applicability to five different base LLMs. + +# 2 PROBLEM STATEMENT + +The primary focus of this work is on self-improving LLMs' target capabilities on the fly, specifically under settings constrained by minimal resources and without the addition of significant parameters. + +![](images/1708facd5032a96e5df4e876067b7f158c672b086b612733a6b5656d3f1bdd7c.jpg) +Figure 2: Overview of the Self-MoE approach to building a compound system of specialized experts and a router in a self-improving manner. In the Self-Specialization phase (left side), the base LLM is aligned with self-generated synthetic data for each target specialization, producing lightweight expert modules. The right side shows MiXSE where each self-specialized expert is dynamically engaged based on the decisions of the self-optimized router. + +![](images/a8bafc3346127d8a767a4d20b14d3f66d323e605d4361c8d8fc31e52afbe1316.jpg) + +Traditional LLMs, which are generally monolithic, require expensive human-labeled data to be better specialized, thereby limiting their adaptability and scalability when resources are constrained. We hypothesize that a modular, compositional model utilizing self-generated synthetic data for self-improvement can dramatically improve specific target capability, adaptability, and interpretability while reducing dependency on expensive human-annotated datasets. + +Specifically, given a base LLM $\Theta_0$ and a minimal set of seed data (e.g., 100) for each of the target capabilities $\{T_i\}_{i=1}^n$ (e.g., knowledge, math), our goal is to transform $\Theta_0$ into an enhanced compositional model $\Theta_{comp}$ where $n$ target expert modules $\{\Delta \Theta_i\}_{i=1}^n$ are effectively integrated. Formally, the Self-MoE transformation function is defined as: + +$$ +f _ {t r a n s}: \left(\Theta_ {0}, \{T _ {i} \} _ {i = 1} ^ {n}\right)\rightarrow \Theta_ {c o m p} = \Theta_ {0} \cup \{\Delta \Theta_ {i} \} _ {i = 1} ^ {n} +$$ + +Here, under our problem setting, the number of parameters of $\Theta_0$ and $\Theta_{comp}$ should not be significantly different, necessitating that the expert modules $\Delta \Theta_{i}$ be lightweight (i.e., LoRA (Hu et al., 2022)). The available seed data are limited but can be reasonably collected (e.g., 100). Importantly, we do not assume the availability of larger/teacher models at one's hand; instead, we aim to develop a method that enables self-improvement and is designed to be universally applicable. + +# 3 METHOD:SELF-MOE + +In this section, we describe Self-MoE, our proposed framework designed to build a compositional model in which specialized expert modules and a routing component are learned in a self-training manner to cooperate effectively. At a high level, Self-MoE decomposes the monolithic structure of a base LLM into a dynamic mixture of self-specialized units, each equipped with distinct target capabilities. This section outlines the overall pipeline and architecture of Self-MoE, illustrated in Figure 2, which details both the self-specialization of individual target expert modules and their integration to form a compositional system, MiXSE (MiXture of Self-specialized Experts). + +# 3.1 BUILDING EXPERT MODULES THROUGH SELF-SPECIALIZATION + +The first step of Self-MoE is creating specialized modules $\{\Delta \Theta_i\}_{i=1}^n$ for each target expertise, while adhering to the desiderata discussed in Section 2. That is, the modules should be lightweight and self-improving. We employ self-specialization (Kang et al., 2024) where a base LLM is aligned with self-generated data for target specialization, resulting in lightweight LoRA (Hu et al., 2022) experts. + +Targeted Generation. Self-specialization involves generating synthetic instruction-response data $D_{i} = \{(inst_{i}^{(1)},resp_{i}^{(1)}),(inst_{i}^{(2)},resp_{i}^{(2)}),\ldots \}$ tailored to each target domain $T_{i}$ . We ensure the data + +is both diverse and highly relevant to the specialized tasks/domains each module will address. The generation includes the following steps: + +(1) Seed Construction: First, given a target $T_{i}$ identified, we prepare a small number of seed examples (e.g., 100) that capture essential characteristics and scenarios relevant to each target domain $T_{i}$ . While we exploit existing datasets for the purpose of demonstration, we posit manual annotation for such a small number should be reasonable in real-world applications. These seeds serve as the foundational dataset from which synthetic variations are generated. +(2) Instruction Brainstorming: Once the seed examples are established, the next step is to diversify the range of instructions (and corresponding input contexts) through a brainstorming process. Specifically, we prompt1 a base LLM $\Theta_0$ to create new instructions following sequences of seed instructions given in-context. +(3) Response Generation: The final step involves generating corresponding responses for the newly created instructions. We use seed instruction-response pairs as in-context demonstrations to extract latent relevant knowledge from $\Theta_0$ . + +Self-Align with LoRA With each specialized synthetic data $D_{i}$ in place, we now proceed with the self-alignment of $\Theta_0$ to induce specialization, separately producing lightweight expert components $\Delta \Theta_{i}$ . Note that $D_{i}$ are self-generated by $\Theta_0$ and used to specialize the same $\Theta_0$ using an adapter module $\Delta \Theta_{i}$ , resulting in an specialized model $\Theta_{spec} = \Theta_0 + \Delta \Theta_i$ . Specifically, we utilize Low-Rank Adaptation (LoRA) (Hu et al., 2022), which integrates additional trainable parameters that are specific to each domain $T_{i}$ while keeping $\Theta_0$ intact. Within the corresponding $\Theta$ , we define $\theta$ as the weights at a certain layer where LoRA is attached. Let $\theta_{spec} \in \mathbb{R}^{d \times k}$ be updated weights at a specific LoRA layer which can be decomposed as: + +$$ +\begin{array}{l} \theta_ {s p e c} = \theta_ {0} + \Delta \theta_ {i} \\ = \theta_ {0} + \theta_ {B _ {i}} \theta_ {A _ {i}} \\ \end{array} +$$ + +where $\theta_{B_i} \in \mathbb{R}^{d \times rank}$ and $\theta_{A_i} \in \mathbb{R}^{rank \times k}$ , with $rank \ll \min(d, k)$ . The forward pass becomes: + +$$ +h = \theta_ {s p e c} x = \theta_ {0} x + \theta_ {B _ {i}} \theta_ {A _ {i}} x +$$ + +This applies to all LoRA layers, and only $\Delta \Theta_{i} = \{\Delta \theta_{i}^{(1)},\Delta \theta_{i}^{(2)},\ldots \}$ is updated during training using $D_{i}$ . As a whole, this process of self-specialization can be defined as producing an expert module $\Delta \Theta_{i}$ for the $i$ -th target along with the corresponding synthetic data $D_{i}$ (Left in Figure 2): + +$$ +f _ {s s}: (\Theta_ {0}, T _ {i}) \to (\Delta \Theta_ {i}, D _ {i}) +$$ + +We iterate this process for each target domain, focusing on knowledge, reasoning, math, and coding. + +# 3.2 MIXTURE OF SELF-SPECIALIZED EXPERTS + +After each expert module is individually specialized through the self-specialization process, they are integrated into a compound system $\Theta_{comp}$ , MiXSE (MiXture of Self-specialized Experts). MiXSE is designed to leverage the distinct capabilities of each module, orchestrating their cooperation to handle diverse tasks dynamically and efficiently. To achieve this benefit, a router module $\theta_r$ is also incorporated, which analyzes each input token to dynamically route to the most appropriate expert module based on the task at hand. + +Specifically, within each layer, the output $h$ for each input $x$ is calculated by combining the contributions of the selected expert modules $\Delta \theta_{i}$ , weighted by their relevance determined by the router: + +$$ +\begin{array}{l} h = \theta_ {0} x + \sum_ {i = 1} ^ {n} \alpha_ {i} \Delta \theta_ {i} x \\ = \theta_ {0} x + \sum_ {i = 1} ^ {n} \alpha_ {i} \Delta \theta_ {B _ {i}} \theta_ {A _ {i}} x \\ \end{array} +$$ + +where $\alpha$ represents a set of weights computed by the router (i.e., a linear layer) $\theta_r \in \mathbb{R}^{n \times k}$ . + +$$ +\alpha = \operatorname {t o p - k} (\operatorname {s o f t m a x} (\theta_ {r} \cdot x)) +$$ + +Note that we only take top-k probabilities and mask out the others to efficiently reduce computation. In essence, this also allows the pre-trained base weights $\theta_0$ to be sufficiently able to contribute, mitigating potential issues of over-specialization such as forgetting or diminished generalizability. The router $\theta_r$ is a linear layer, shared across all LoRA layers, and is trained using the aggregated self-generated data $D = \{D_i\}_{i=1}^n$ to learn how to optimally select modules for a given task: + +$$ +L (\theta_ {r}) = - \mathbb {E} _ {(i n s t, r e s p) \sim D} [ l o g P _ {\Theta_ {0}} (r e s p | i n s t; \theta_ {r}, \{\Delta \Theta_ {i} \} _ {i = 1} ^ {n}) ] +$$ + +It can be noted that the router is not provided with explicit supervision about which expert should be selected for each token, as there is no fixed label for each token indicating the correct single expert. Instead, it learns the optimal expert selection indirectly through training on self-generated instructions and responses. The supervision comes from the responses, where the routing decisions are determined dynamically based on the token-level features to allow the model to produce better responses. Importantly, the router is optimized separately after the expert modules are trained and frozen, ensuring the explicit semantic distinction of the expert modules is preserved. + +# 4 EXPERIMENTS AND RESULTS + +Datasets. We evaluate Self-MoE across diverse domains categorized into knowledge, reasoning, math, and coding: MMLU (0- & 5-shot) (Hendrycks et al., 2021a), BBH (3-shot) (Suzgun et al., 2022), GSM8K (8-shot) (Cobbe et al., 2021), and HumanEval (0-shot) (Chen et al., 2021), respectively. For MMLU, we primarily employ the 0-shot setting unless otherwise specified, based on established observations (Dettmers et al., 2023; Lin et al., 2024) that tuning yields only marginal effects in the 5-shot setting for this task. To test generalization (Section 4.4), we additionally evaluate on MATH (4-shot) (Hendrycks et al., 2021b), MBPP (3-shot) (Austin et al., 2021), NaturalQuestions (5-shot) (Kwiatkowski et al., 2019), TriviaQA (5-shot) (Joshi et al., 2017), Hellaswag (0-shot) (Zellers et al., 2019), PIQA (0-shot) (Bisk et al., 2020), and TruthfulQA (0-shot) (Lin et al., 2022). + +Baselines. To assess the effectiveness of Self-MoE, we compare performance against several baselines that are similarly trained using LoRA and that use the same number of active parameters during inference for fair comparisons: + +- Four Self-Specialized Models (Kang et al., 2024): Trained on self-generated synthetic data for individual domains: knowledge, reasoning, math, and coding. +- Instance Merging (Multi-Task Tuning) (Chung et al., 2024): Leverages the aggregated synthetic data generated by self-specialization to train a model capable of handling multiple tasks. +- TIES (Yadav et al., 2023), DARE (Yu et al., 2024): Advanced weight merging methods integrating multiple expert strengths into a unified model. + +Note that Self-MoE does not require the base models to be implemented using specific architectures. Rather, Self-MoE builds upon purely any base LLMs using LoRA-based fine-tuning like other baselines, which ensures fair and consistent comparisons. We also contextualize these results with computationally intensive methods reported in the literature, despite indirect comparisons: BTM (Li et al., 2022), Sparse Upcycling (Komatsuzaki et al., 2023), BTX (Sukhbaatar et al., 2024), GLAN (Li et al., 2024a), Orca (Mitra et al., 2023), and Merlinite (Sudalairaj et al., 2024) in Appendix D.1. + +Implementation Details. We adopt Gemma-7B (Team et al., 2024) as a base LLM for our main experiments, and additionally apply Self-MoE to various models, such as LLaMA-2 7B & 13B (Touvron et al., 2023), Mistral 7B (Jiang et al., 2023), and LLaMA-3 8B (AI@Meta, 2024) in Section 4.5. We use 100 seeds to generate 5K synthetic data for each domain, resulting in 20K data. Each LoRA module contributes less than $0.3\%$ to the parameters of the base model, and the router's parameters are negligible, resulting in the added parameters of MiXSE amounting to only about $1\%$ . + +# 4.1 MAIN RESULTS + +In Table 1, we showcase comparative benchmark results of various approaches across four specialized domains: knowledge, reasoning, math, and coding. All baselines use self-generated synthetic data based on the same Base LLM, Gemma-7B, and LoRA for tuning to ensure fair comparisons. + +Table 1: Main results. All models are built upon the same base LLM, Gemma-7B, taking self-improving approaches and having the same active parameters during inference. Corresponding aligned performances of self-specialization are underscored. Each column's best performance is highlighted in bold, while the gains achieved by our MiXSE over the base LLM are indicated. + +
MethodActive ParamsKnowledge (MMLU)Reasoning (BBH)Math (GSM8K)Coding (HumanEval)Avg.
Base LLM7B58.456.142.534.147.8
Specialized LLM for Each Capability
Knowledge Self-Spec.7B + 0.3%64.041.740.528.043.6
Reasoning Self-Spec.7B + 0.3%60.160.241.028.747.5
Math Self-Spec.7B + 0.3%59.358.950.036.051.1
Coding Self-Spec.7B + 0.3%57.257.246.037.249.4
Merging Methods
Instance Merging7B + 0.3%62.657.653.536.052.4
TIES Merging7B + 0.3%63.756.338.532.947.9
DARE Merging7B + 0.3%37.759.645.034.844.3
MiXSE (Ours)7B + 0.3%65.6 ↑7.261.1 ↑5.052.5 ↑10.037.8 ↑3.754.3 ↑6.5
+ +First, we confirm self-specialization markedly enhances target-specific expertise, compared to the base LLM. For instance, we can see substantial gains from corresponding specialized models (e.g., Knowledge Self-Spec. in the knowledge domain): 58.4 to 64.0 in knowledge, 56.1 to 60.2 in reasoning, and so on. However, this focused improvement sometimes comes at the cost of reduced performance in non-targeted areas, as evidenced by the drop in scores for the Knowledge Self-Spec. model in reasoning, math, and coding. This trade-off highlights the inherent limitation of overspecialization. In contrast, our MiXSE, demonstrates consistent improvements across all domains, due to its modular, compositional architecture that makes use of dynamic routing to leverage optimal experts. Surprisingly, it even outperforms all corresponding specialized models, indicating that it effectively synergizes the strengths of each specialization. + +In comparison with other static merging methods like Instance Merging, TIES, and DARE, MiXSE stands out for its superior adaptability. While they attempt to combine the strengths of different specialization areas into a single model, they lack the dynamic flexibility that MiXSE offers. Notably, simple instance merging (i.e., multi-task tuning), though effective in enhancing the base LLM across domains, still falls short of achieving the superior average performance of 54.3 seen with MiXSE. This validates the advantages of dynamic expert integration in a compositional system. + +# 4.2 ABLATION STUDY + +Now that we have verified the effectiveness of MiXSE as a whole, we evaluate the impact of different configurations and components of the system, presented in Table 2. The configurations vary in terms of routing strategies and integration of experts, offering insights into the contributions of each element to the system's overall effectiveness. + +We start by examining the Top-k routing strategy, which plays a crucial role in our model. Our findings show that both the Top-1 and Top-2 expert configurations deliver the best performance. This suggests that identifying and leveraging the most relevant expert for a given task is typically sufficient and most effective. On a side note, the similar performances of the different configurations may highlight the robustness of our method. Given the similar performances, we prefer the Top-1 expert setup for better efficiency. + +Interestingly, the results also indicate a drop in performance when using All Experts. This can be attributed to that involving all experts regardless of their relevance can introduce noise and dilute the specific contributions of the most pertinent experts. Additionally, involving more experts than necessary can increase computational overhead. + +We observe that the performance significantly decreases with random routing (i.e., w/o Self-Optimized Router), highlighting the router's role in dynamically tailoring the selection of experts according to the specific requirements of each task. The router's ability to discern and activate the + +Table 2: Analysis and ablation of the router in our MiXSE. Configurations vary to investigate the optimal number of experts used, to verify the possibility of self-learning for the router, and to see the importance of semantic distinctions among experts within the compositional system. + +
ConfigurationKnowledge (MMLU)Reasoning (BBH)Math (GSM8K)Coding (HumanEval)Avg.
Base LLM58.456.142.534.147.8
Top-k Routing
w/ Top-1 Expert65.661.152.537.854.3
w/ Top-2 Experts65.560.952.538.454.3
w/ All Experts65.458.954.033.553.0
Routing Strategy
w/o Self-Optimized Router59.958.548.036.650.8
w/o SharedRouter59.559.150.532.950.5
Experts & Router Joint Training
w/o Semantic Experts (Top-1)64.558.146.033.550.5
w/o Semantic Experts (Top-2)64.253.348.536.550.6
+ +most suitable experts based on the context is critical for optimizing performance. Notably, this ability is learned by relying on a very small amount of seed data. When employing layer-specific routers instead of the shared router, we found that the performance substantially drops, despite having about $200\mathrm{x}$ more parameters, justifying our choice. This might be attributed to the fact that the layer-specific ones may introduce conflicting routing decisions, possibly requiring more data or hyperparameter tuning to become effective. + +Another interesting finding comes from the configuration where experts and the router are jointly trained, which means that the semantic distinctions among experts may be diluted. This setup (w/ either Top-1 or Top-2) substantially decreases performance relative to scenarios where the router and experts are optimized independently. This decline validates that semantic experts play a crucial role in enhancing the system's capability to handle tasks requiring specific expertise, while offering better interpretability (Section 4.3). + +# 4.3 ROUTING ANALYSIS + +Understanding how MiXSE allocates tasks to its various experts is crucial for gauging its interpretability. By analyzing the routing distributions across four distinct domains, we aim to see whether the system matches queries to the most suitable experts. Figure 3 presents the routing distributions used to solve each benchmark, where the weights are averaged across tokens and layers within individual tasks. + +We first observe that the MiXSE's router effectively selects the correct expert for each corresponding target. This is evident from the impressive alignment between tasks and the experts chosen by the router; for example, the knowledge expert predominantly handles knowledge tasks, while the coding expert + +![](images/37e505b393237035aaa15eefa5f6741a205cc8067e9dd1f1d909b5f51010506e.jpg) +Figure 3: Routing analysis that shows routing distributions over four domains for each benchmark, averaging the weights across tokens within individual tasks. + +![](images/010db4360b9b2ff14af2e7e750bae06fd26836397217cfbed81bdb5ca88a2ed2.jpg) + +is routed coding tasks. This highlights the router's ability to learn and apply this routing automatically and consistently, making the system's decisions interpretable and trustworthy. + +Beyond the direct matching of tasks to domain-specific experts, the router also demonstrates its ability to exploit synergies between different areas of expertise. For instance, the reasoning expert is frequently involved in tasks across the knowledge, math, and coding, reflecting the system's compositional use of expertise. This explains the reason for MiXSE's superior performances across all domains even beyond all specialized modules in Table 1. + +Table 3: Investigation on generalization and a forgetting issue of Self-MoE. Non-Target (In-Expertise) indicates where MiXSE does not directly specialize using seed data directly while relevant to targets. Non-Target (Out-of-Expertise) refers to irrelevant cases. + +
CategoryBenchmarkBase LLMInstance MergingMiXSE
Target
Academic KnowledgeMMLU58.462.665.6
ReasoningBBH56.157.661.1
MathGSM8K42.553.552.5
CodingHumanEval34.136.037.8
Target Average47.852.454.3
Non-Target (In-Expertise)
MathMATH20.715.321.4
CodingMBPP37.837.639.6
Non-Target (Out-of-Expertise)
World KnowledgeNatural Questions24.222.324.5
TriviaQA63.958.662.5
CommonsenseHellaswag80.678.080.7
PIQA81.180.181.2
SafetyTruthfulQA44.742.244.3
Non-Target Average50.447.750.6
+ +# 4.4 GENERALIZABILITY TEST + +While Self-MoE has shown clear benefits in target benchmarks such as MMLU, BBH, GSM8K, and HumanEval, one may be curious about its generalizability to non-targets, or concerned with the potential issues of specialization such as forgetting. In Table 3, we conduct an investigation using non-targeted benchmarks that were not utilized in building MiXSE. + +On MATH and MBPP benchmarks, which can be considered highly relevant to target benchmarks, GSM8K and HumanEval, we find our Self-MoE can still improve over the base LLM even though they were not directly targeted in our training regime, indicating generalizability. + +Concerning the potential side effect of forgetting, we extend our testing to include domains such as world knowledge, common sense, and safety, which are rarely associated with the targets directly. Our experiments show that overall, there are rarely meaningful performance drops when applying our Self-MoE. Only a minor drop is observed with MiXSE in TriviaQA, but this is substantially less than in the case of instance merging. This suggests our approach almost maintains existing knowledge for non-targets while significantly boosting target performances, unlike monolithic baselines. + +# 4.5 APPLICABILITY TO OTHER BASE LLMS + +Following the successful demonstration of our Self-MoE approach based on Gemma-7B, we now present Figure 4 where we apply Self-MoE to other base LLMs beyond Gemma-7B. We use diverse model variants including LLaMA-2 7B & 13B, Mistral 7B, and LLaMA-3 8B. Our findings suggest that our approach improves all models on average regardless of the model fam + +ily, size, and level of base performance, outperforming the strong instance merging baseline. + +![](images/561d8f13f0d92f1d4b475966022e626d4586c0c5002c10f2792c113878b8c522.jpg) +Figure 4: Results of Self-MoE w/ other LLMs. + +# 4.6 IMPACT OF THE NUMBER OF SYNTHETIC DATA + +Figure 5 illustrates the impact of scaling self-generated synthetic data for Self-MoE. As the data scales from 0 to $20\mathrm{K}$ , our MiXSE model demonstrates substantial and consistent improvements over the base one in average performance across domains, suggesting the scalable potential of Self-MoE. Instance Merging, serving as a strong baseline, also benefits from increased data, but the gains progress at a slower rate, as evidenced by linear trendlines. This reflects the inefficiency of the static merging scheme, which, being monolithic, suffers from trade-offs in knowledge gains and forgetting. + +![](images/e9798d73c28a554d377956849de16bc4251ffaf1d52c2a919dca8c7bf556cc03.jpg) +Figure 5: Analysis with the varied sizes of self-generated synthetic data. + +# 4.7 SCALING THE NUMBER OF EXPERTS + +In Table 4, we present the results of MiXSE composed of varying numbers of experts, with experts added progressively one at a time in the order of knowledge, reasoning, math, and coding. The results indicate that starting with the knowledge expert, which initially exhibits a performance trade-off, subsequent additions of reasoning, math, and coding experts consistently enhance overall performance. + +This highlights the compositional MiXSE's advantage of adaptability and modularity. + +Table 4: Scaling the number of experts. K: Knowledge expert. R: Reasoning expert. M: Math expert. C: Coding expert. + +
# ExpertsKnowledge (MMLU)Reasoning (BBH)Math (GSM8K)Coding (HumanEval)Avg.
0 (Base LLM)58.456.142.534.147.8
1 (K)64.041.740.528.043.6
2 (K+R)65.858.043.032.349.8
3 (K+R+M)62.761.554.532.952.9
4 (K+R+M+C)65.661.152.537.854.3
+ +# 4.8 ANALYSES ON SELF-GENERATED SYNTHETIC DATA + +We conduct analyses of the self-synthesized datasets in Table 5. For diversity measurement, we first analyze the linguistic diversity using Type-to-Token Ratio (TTR), and the semantic similarity of the pairwise instructions' embeddings using SBERT (Reimers & Gurevych, 2019). Synthetic data demonstrates comparable linguistic diversity to human-labeled data, with a slightly higher TTR for BBH, suggesting that the syn + +Table 5: Analyses of self-generated synthetic data in terms of diversity, complexity, and naturalness. + +
MetricKnowledge (MMLU)Reasoning (BBH)Math (GSM8K)Coding (HumanEval)Avg.
Type-to-Token Ratio (TTR) (↑)
Human-Labeled Data0.26710.16720.16830.11210.1787
Synthetic Data0.26390.18890.14840.09610.1743
Semantic Similarity (↓)
Human-Labeled Data0.26250.17570.41250.46080.3279
Synthetic Data0.31290.19480.33600.47910.3307
Classification Accuracy (↓)
LLM as-a-judge (GPT-4o)55.068.060.050.058.3
Model Performance using Different Data (↑)
w/ Human-labeled data (Seed)57.457.045.034.148.4
w/ Synthetic data (1x)57.755.945.532.948.0
w/ More Synthetic data (5x)61.358.448.436.651.2
w/ More Synthetic data (50x)65.661.152.537.854.3
+ +Theoretic data includes richer lexical variation, especially in reasoning tasks. For semantic similarity, synthetic data achieves generally low similarity within each dataset, similar to human-labeled data (0.3307 vs. 0.3279) on average. This suggests a high semantic diversity overall, reflecting the natural diversity found in human-labeled data. + +Next, we leverage a strong instruction-following model, GPT-4o, as a judge to classify which instruction was synthetic. Given 100 pairs of human-labeled and synthetic instructions, the classification accuracy ranged from $50\%$ (random guessing) to $68\%$ , with the lowest accuracy for HumanEval and MMLU, suggesting that synthetic data closely mimics human complexity and naturalness in these domains. Conversely, the higher accuracy for BBH and GSM8K indicates that synthetic data in these domains has room to improve. + +Finally, we compare the performance of Self-MoE fine-tuned with synthetic data against human-labeled seed data. We observe that with the same quantity (400) as the seed, synthetic data achieves performance similar to human-labeled data on average. When scaling up the size (5x and 50x), synthetic data demonstrates effectiveness and scalability. + +# 4.9 DISCUSSION ON THE OVERHEAD OF SELF-MOE + +One possible concern in adapting LLMs into compositional systems using Self-MoE is the potential introduction of overhead. Here, we discuss this aspect in detail, emphasizing that the additional overhead of Self-MoE is minimal while yielding significant performance gains. Essentially, the expert modules in Self-MoE are lightweight LoRA modules, contributing only about $1\%$ additional parameters (total) for four experts, as detailed in Table 7 (Total Params). These experts are sparsely activated, which maintains low active parameters $(7\mathrm{B} + 0.3\%)$ during inference, thus efficiently minimizing inference overhead. In contrast, traditional MoE models like Mixtral (Jiang et al., 2024) and BTX (Sukhbaatar et al., 2024) typically employ a feedforward network (FFN) layer for each expert, resulting in a significant proportional increase in total parameters as the number of experts grows, as indicated in Table 7, which demands much more memory for model loading. The design + +choice in Self-MoE leads to better scalability and resource efficiency, especially when the number of experts is scaled to incorporate numerous domains of expertise. + +# 5 RELATED WORK + +Combination of Experts. There have been numerous efforts to combine the strengths of multiple models or modules. The Mixture of Experts (MoE) models such as Switch Transformer (Fedus et al., 2022), GLAM (Du et al., 2022), and Mixtral (Jiang et al., 2024) exemplify this, dynamically allocating tasks based on the expertise of each component for better efficiency and scalability. These models contrast with ours by not prioritizing lightweight experts, resulting in a larger model with more parameters. Unlike their experts implicitly learned during pre-training, Self-MoE explicitly creates semantic experts for targeted improvements. + +Another relevant area is merging, involving the weighted averaging of multiple models to form a single, aggregated model (Wortsman et al., 2022; Matena & Raffel, 2022; Ilharco et al., 2023; Jin et al., 2023). One of the leading methods, TIES (Yadav et al., 2023) tackles conflicts and parameter inconsistencies among models. DARE (Yu et al., 2024) further reduces the redundancy of parameters. However, these methods are fundamentally static in that they operate with fixed parameters once merged, which may lead to interference, lacking the dynamic flexibility that MiXSE offers. + +There exist notable recent MoE models that similarly explore the utilization of semantic experts, albeit in distinct contexts (Gururangan et al., 2022; Wu et al., 2024; Muqeeth et al., 2024; Sukhbaatar et al., 2024). MOLE relies on human-labeled data, and PHATGOOSE assumes the availability of existing expert models trained by external creators and necessitates additional training for a router on the creators' side. DEMix and BTX rely on extensive pre-training, demanding significant resources, yet it as a pre-trained model holds the potential to complement our self-training approach. Unlike MOLE and PHATGOOSE, our Self-MoE framework creates experts and a router from scratch through self-improvement, while using minimal resources, as contrasted to DEMix and BTX. To offer a broader perspective, Table 7 in Appendix presents a comprehensive summary of various models that, while relevant, are not directly comparable. For further discussions and a more detailed comparison, please refer to Appendix D.1. + +Self-Improvement and Specialization of LLMs. The pursuit of enhancing the capabilities of LLMs often revolves around an instruction-tuning scheme, which can significantly boost cross-task generalizability (Ouyang et al., 2022; Su et al., 2022; Mishra et al., 2022; Wei et al., 2022). Due to the bottlenecks of expensive annotation costs which lead to limited scalability, the self-training concept (Luo, 2022) has gained attention from the community, where LLMs are aligned with automatically self-generated synthetic instructions (Wang et al., 2023; Sun et al., 2023; Li et al., 2024b). These are distinguished from distillation techniques (Hinton et al., 2015; Kang et al., 2023), which assume a stronger teacher model (Mitra et al., 2023; Li et al., 2024a; Sudalairaj et al., 2024), limiting their applicability. + +With the growing need to adapt generalist models to specific domains, Kang et al. (2024) adopts the self-training for specialization, tackling that general instruction tuning is rarely effective in expert domains. While this work lays a foundation for enhancing specialized expertise with minimal resources, we recognize inherent trade-offs in a monolithic structure, such as performance compromises outside specialized domains. Conversely, our Self-MoE achieves uncompromising multiple expertise with a modular approach without extensive resources and adding many parameters. + +# 6 CONCLUSION + +In this study, we proposed Self-MoE to build compositional LLMs with self-specialized experts, MiXSE, to enhance targeted capabilities, adaptability, and interpretability without the reliance on extensive human-labeled data. Empirical evaluations across diverse domains with multiple base models demonstrated that MiXSE significantly enhances base LLM performance and overcomes specialization trade-offs. We believe this work offers a step towards modular, self-improving paradigms which can address the inherent limitations of monolithic models, providing a promising direction for future LLM research. + +# ACKNOWLEDGMENTS + +This research is supported in part by the NSF under grant number IIS-2052498. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation. + +# REFERENCES + +AI@Meta. Llama 3 model card. 2024. URL https://github.com/meta-llama/llama3/blob/main/MODEL_CARD.md. +Jacob Austin, Augustus Odena, Maxwell Nye, Maarten Bosma, Henryk Michalewski, David Dohan, Ellen Jiang, Carrie Cai, Michael Terry, Quoc Le, and Charles Sutton. Program synthesis with large language models, 2021. +Loubna Ben Allal, Niklas Muennighoff, Logesh Kumar Umapathi, Ben Lipkin, and Leandro von Werra. A framework for the evaluation of code generation models. https://github.com/bigcode-project/bigcode-evaluation-harness, 2022. +Yonatan Bisk, Rowan Zellers, Ronan Lebras, Jianfeng Gao, and Yejin Choi. Piqa: Reasoning about physical commonsense in natural language. Proceedings of the AAAI Conference on Artificial Intelligence, 34(05):7432-7439, April 2020. ISSN 2159-5399. doi: 10.1609/aaai.v34i05.6239. URL http://dx.doi.org/10.1609/AAAI.V34I05.6239. +Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel Ziegler, Jeffrey Wu, Clemens Winter, Chris Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, and Dario Amodei. Language models are few-shot learners. In H. Larochelle, M. Ranzato, R. Hadsell, M.F. Balcan, and H. Lin (eds.), Advances in Neural Information Processing Systems, volume 33, pp. 1877-1901. Curran Associates, Inc., 2020. URL https://proceedings.neurips.cc/paper_files/paper/2020/file/1457c0d6bcbd4967418bf8ac142f64a-Paper.pdf. +Eric L. Buehler and Markus J. Buehler. X-lora: Mixture of low-rank adapter experts, a flexible framework for large language models with applications in protein mechanics and molecular design, 2024. +Mark Chen, Jerry Tworek, Heewoo Jun, Qiming Yuan, Henrique Ponde de Oliveira Pinto, Jared Kaplan, Harri Edwards, Yuri Burda, Nicholas Joseph, Greg Brockman, Alex Ray, Raul Puri, Gretchen Krueger, Michael Petrov, Heidy Khlaaf, Girish Sastry, Pamela Mishkin, Brooke Chan, Scott Gray, Nick Ryder, Mikhail Pavlov, Alethea Power, Lukasz Kaiser, Mohammad Bavarian, Clemens Winter, Philippe Tillet, Felipe Petroski Such, Dave Cummings, Matthias Plappert, Fiotios Chantzis, Elizabeth Barnes, Ariel Herbert-Voss, William Hebgen Guss, Alex Nichol, Alex Paino, Nikolas Tezak, Jie Tang, Igor Babuschkin, Suchir Balaji, Shantanu Jain, William Saunders, Christopher Hesse, Andrew N. Carr, Jan Leike, Josh Achiam, Vedant Misra, Evan Morikawa, Alec Radford, Matthew Knight, Miles Brundage, Mira Murati, Katie Mayer, Peter Welinder, Bob McGrew, Dario Amodei, Sam McCandlish, Ilya Sutskever, and Wojciech Zaremba. Evaluating large language models trained on code, 2021. +Daixuan Cheng, Shaohan Huang, and Furu Wei. Adapting large language models via reading comprehension. In The Twelfth International Conference on Learning Representations, 2024. URL https://openreview.net/forum?id=y886UXPEZ0. +Hyung Won Chung, Le Hou, Shayne Longpre, Barret Zoph, Yi Tay, William Fedus, Yunxuan Li, Xuezhi Wang, Mostafa Dehghani, Siddhartha Brahma, Albert Webson, Shixiang Shane Gu, Zhuyun Dai, Mirac Suzgun, Xinyun Chen, Aakanksha Chowdhery, Alex Castro-Ros, Marie Pellat, Kevin Robinson, Dasha Valter, Sharan Narang, Gaurav Mishra, Adams Yu, Vincent + +Zhao, Yanping Huang, Andrew Dai, Hongkun Yu, Slav Petrov, Ed H. Chi, Jeff Dean, Jacob Devlin, Adam Roberts, Denny Zhou, Quoc V. Le, and Jason Wei. Scaling instructionfinetuned language models. Journal of Machine Learning Research, 25(70):1-53, 2024. URL http://jmlr.org/papers/v25/23-0870.html. +Karl Cobbe, Vineet Kosaraju, Mohammad Bavarian, Mark Chen, Heewoo Jun, Lukasz Kaiser, Matthias Plappert, Jerry Tworek, Jacob Hilton, Reiichiro Nakano, Christopher Hesse, and John Schulman. Training verifiers to solve math word problems, 2021. +Tim Dettmers, Artidoro Pagnoni, Ari Holtzman, and Luke Zettlemoyer. QLoRA: Efficient finetuning of quantized LLMs. In Thirty-seventh Conference on Neural Information Processing Systems, 2023. URL https://openreview.net/forum?id=OUIFPHEGJU. +Nan Du, Yanping Huang, Andrew M Dai, Simon Tong, Dmitry Lepikhin, Yuanzhong Xu, Maxim Krikun, Yanqi Zhou, Adams Wei Yu, Orhan First, Barret Zoph, Liam Fedus, Maarten P Bosma, Zongwei Zhou, Tao Wang, Emma Wang, Kellie Webster, Marie Pellat, Kevin Robinson, Kathleen Meier-Hellstern, Toju Duke, Lucas Dixon, Kun Zhang, Quoc Le, Yonghui Wu, Zhifeng Chen, and Claire Cui. GLaM: Efficient scaling of language models with mixture-of-experts. In Kamalika Chaudhuri, Stefanie Jegelka, Le Song, Csaba Szepesvari, Gang Niu, and Sivan Sabato (eds.), Proceedings of the 39th International Conference on Machine Learning, volume 162 of Proceedings of Machine Learning Research, pp. 5547-5569. PMLR, 17-23 Jul 2022. URL https://proceedings.mlr.press/v162/du22c.html. +William Fedus, Barret Zoph, and Noam Shazeer. Switch transformers: Scaling to trillion parameter models with simple and efficient sparsity. Journal of Machine Learning Research, 23(120):1-39, 2022. URL http://jmlr.org/papers/v23/21-0998.html. +Shangbin Feng, Weijia Shi, Yuyang Bai, Vidhisha Balachandran, Tianxing He, and Yulia Tsvetkov. Knowledge card: Filling LLMs' knowledge gaps with plug-in specialized language models. In The Twelfth International Conference on Learning Representations, 2024. URL https://openreview.net/forum?id=WbWtOYIzIK. +Leo Gao, Jonathan Tow, Baber Abbasi, Stella Biderman, Sid Black, Anthony DiPofi, Charles Foster, Laurence Golding, Jeffrey Hsu, Alain Le Noac'h, Haonan Li, Kyle McDonell, Niklas Muenighoff, Chris Ociepa, Jason Phang, Laria Reynolds, Hailey Schoelkopf, Aviya Skowron, Lintang Sutawika, Eric Tang, Anish Thite, Ben Wang, Kevin Wang, and Andy Zou. A framework for few-shot language model evaluation, 12 2023. URL https://zenodo.org/records/10256836. +Suchin Gururangan, Mike Lewis, Ari Holtzman, Noah A. Smith, and Luke Zettlemoyer. DEMix layers: Disentangling domains for modular language modeling. In Marine Carpuat, Marie-Catherine de Marneffe, and Ivan Vladimir Meza Ruiz (eds.), Proceedings of the 2022 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pp. 5557-5576, Seattle, United States, July 2022. Association for Computational Linguistics. doi: 10.18653/v1/2022.naacl-main.407. URL https://aclanthology.org/2022.naacl-main.407. +Dan Hendrycks, Collin Burns, Steven Basart, Andy Zou, Mantas Mazeika, Dawn Song, and Jacob Steinhardt. Measuring massive multitask language understanding. In International Conference on Learning Representations, 2021a. URL https://openreview.net/forum?id=d7KBjmI3GmQ. +Dan Hendrycks, Collin Burns, Saurav Kadavath, Akul Arora, Steven Basart, Eric Tang, Dawn Song, and Jacob Steinhardt. Measuring mathematical problem solving with the math dataset. NeurIPS, 2021b. +Geoffrey Hinton, Oriol Vinyals, and Jeffrey Dean. Distilling the knowledge in a neural network. In NIPS Deep Learning and Representation Learning Workshop, 2015. URL http://arxiv.org/abs/1503.02531. + +Edward J Hu, Yelong Shen, Phillip Wallis, Zeyuan Allen-Zhu, Yanzhi Li, Shean Wang, Lu Wang, and Weizhu Chen. LoRA: Low-rank adaptation of large language models. In International Conference on Learning Representations, 2022. URL https://openreview.net/forum?id=nZeVKeeFYf9. +Chengsong Huang, Qian Liu, Bill Yuchen Lin, Tianyu Pang, Chao Du, and Min Lin. Lorahub: Efficient cross-task generalization via dynamic lora composition, 2023. +Jianheng Huang, Leyang Cui, Ante Wang, Chengyi Yang, Xinting Liao, Linfeng Song, Junfeng Yao, and Jinsong Su. Mitigating catastrophic forgetting in large language models with self-synthesized rehearsal, 2024. +Gabriel Ilharco, Marco Tulio Ribeiro, Mitchell Wortsman, Ludwig Schmidt, Hannaneh Hajishirzi, and Ali Farhadi. Editing models with task arithmetic. In The Eleventh International Conference on Learning Representations, 2023. URL https://openreview.net/forum?id=6t0Kwf8-jrj. +Albert Q. Jiang, Alexandre Sablayrolles, Arthur Mensch, Chris Bamford, Devendra Singh Chaplot, Diego de las Casas, Florian Bressand, Gianna Lengyel, Guillaume Lample, Lucile Saulnier, Lélio Renard Lavaud, Marie-Anne Lachaux, Pierre Stock, Teven Le Scao, Thibaut Lavril, Thomas Wang, Timothee Lacroix, and William El Sayed. Mistral 7b, 2023. +Albert Q. Jiang, Alexandre Sablayrolles, Antoine Roux, Arthur Mensch, Blanche Savary, Chris Bamford, Devendra Singh Chaplot, Diego de las Casas, Emma Bou Hanna, Florian Bressand, Gianna Lengyel, Guillaume Bour, Guillaume Lample, Lélio Renard Lavaud, Lucile Saulnier, Marie-Anne Lachaux, Pierre Stock, Sandeep Subramanian, Sophia Yang, Szymon Antoniak, Teven Le Scao, Théophile Gervet, Thibaut Lavril, Thomas Wang, Timothée Lacroix, and William El Sayed. Mixtral of experts, 2024. +Xisen Jin, Xiang Ren, Daniel Preotiuc-Pietro, and Pengxiang Cheng. Dataless knowledge fusion by merging weights of language models. In The Eleventh International Conference on Learning Representations, 2023. URL https://openreview.net/forum?id=FCnohuR6AnM. +Mandar Joshi, Eunsol Choi, Daniel Weld, and Luke Zettlemoyer. TriviaQA: A large scale distantly supervised challenge dataset for reading comprehension. In Regina Barzilay and Min-Yen Kan (eds.), Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 1601-1611, Vancouver, Canada, July 2017. Association for Computational Linguistics. doi: 10.18653/v1/P17-1147. URL https://aclanthology.org/P17-1147. +Junmo Kang, Wei Xu, and Alan Ritter. Distill or annotate? cost-efficient fine-tuning of compact models. In Anna Rogers, Jordan Boyd-Graber, and Naoaki Okazaki (eds.), Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 11100-11119, Toronto, Canada, July 2023. Association for Computational Linguistics. doi: 10.18653/v1/2023.acl-long.622. URL https://aclanthology.org/2023.acl-long.622. +Junmo Kang, Hongyin Luo, Yada Zhu, Jacob Hansen, James Glass, David Cox, Alan Ritter, Rogerio Feris, and Leonid Karlinsky. Self-specialization: Uncovering latent expertise within large language models. In Lun-Wei Ku, Andre Martins, and Vivek Srikumar (eds.), Findings of the Association for Computational Linguistics ACL 2024, pp. 2681-2706, Bangkok, Thailand and virtual meeting, August 2024. Association for Computational Linguistics. URL https://aclanthology.org/2024-findings-acl.157. +Aran Komatsuzaki, Joan Puigcerver, James Lee-Thorp, Carlos Riquelme Ruiz, Basil Mustafa, Joshua Ainslie, Yi Tay, Mostafa Dehghani, and Neil Houlsby. Sparse upcycling: Training mixture-of-experts from dense checkpoints. In The Eleventh International Conference on Learning Representations, 2023. URL https://openreview.net/forum?id=T5nUQDrM4u. +Suhas Kotha, Jacob Mitchell Springer, and Aditi Raghunathan. Understanding catastrophic forgetting in language models via implicit inference. In *The Twelfth International Conference on Learning Representations*, 2024. URL https://openreview.net/forum?id=VrHiF2hsrm. + +Tom Kwiatkowski, Jennimaria Palomaki, Olivia Redfield, Michael Collins, Ankur Parikh, Chris Alberti, Danielle Epstein, Illia Polosukhin, Jacob Devlin, Kenton Lee, Kristina Toutanova, Llion Jones, Matthew Kelcey, Ming-Wei Chang, Andrew M. Dai, Jakob Uszkoreit, Quoc Le, and Slav Petrov. Natural questions: A benchmark for question answering research. Transactions of the Association for Computational Linguistics, 7:452–466, 2019. doi: 10.1162/tacl_a_00276. URL https://aclanthology.org/Q19-1026. +Haoran Li, Qingxiu Dong, Zhengyang Tang, Chaojun Wang, Xingxing Zhang, Haoyang Huang, Shaohan Huang, Xiaolong Huang, Zeqiang Huang, Dongdong Zhang, Yuxian Gu, Xin Cheng, Xun Wang, Si-Qing Chen, Li Dong, Wei Lu, Zhifang Sui, Benyou Wang, Wai Lam, and Furu Wei. Synthetic data (almost) from scratch: Generalized instruction tuning for language models, 2024a. +Margaret Li, Suchin Gururangan, Tim Dettmers, Mike Lewis, Tim Althoff, Noah A. Smith, and Luke Zettlemoyer. Branch-train-merge: Embarrassingly parallel training of expert language models, 2022. +Xian Li, Ping Yu, Chunting Zhou, Timo Schick, Omer Levy, Luke Zettlemoyer, Jason E Weston, and Mike Lewis. Self-alignment with instruction backtranslation. In The Twelfth International Conference on Learning Representations, 2024b. URL https://openreview.net/forum?id=1oijHJBRsT. +Percy Liang, Rishi Bommasani, Tony Lee, Dimitris Tsipras, Dilara Soylu, Michihiro Yasunaga, Yian Zhang, Deepak Narayanan, Yuhuai Wu, Ananya Kumar, Benjamin Newman, Binhang Yuan, Bobby Yan, Ce Zhang, Christian Alexander Cosgrove, Christopher D Manning, Christopher Re, Diana Acosta-Navas, Drew Arad Hudson, Eric Zelikman, Esin Durmus, Faisal Ladhak, Frieda Rong, Hongyu Ren, Huaxiu Yao, Jue WANG, Keshav Santhanam, Laurel Orr, Lucia Zheng, Mert Yuksekgonul, Mirac Suzgun, Nathan Kim, Neel Guha, Niladri S. Chatterji, Omar Khattab, Peter Henderson, Qian Huang, Ryan Andrew Chi, Sang Michael Xie, Shibani Santurkar, Surya Ganguli, Tatsunori Hashimoto, Thomas Icard, Tianyi Zhang, Vishrav Chaudhary, William Wang, Xuechen Li, Yifan Mai, Yuhui Zhang, and Yuta Koreeda. Holistic evaluation of language models. Transactions on Machine Learning Research, 2023. ISSN 2835-8856. URL https://openreview.net/forum?id=iO4LZibEqW. Featured Certification, Expert Certification. +Stephanie Lin, Jacob Hilton, and Owain Evans. TruthfulQA: Measuring how models mimic human falsehoods. In Smaranda Muresan, Preslav Nakov, and Aline Villavicencio (eds.), Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 3214-3252, Dublin, Ireland, May 2022. Association for Computational Linguistics. doi: 10.18653/v1/2022.acl-long.229. URL https://aclanthology.org/2022.acl-long.229. +Xi Victoria Lin, Xilun Chen, Mingda Chen, Weijia Shi, Maria Lomeli, Richard James, Pedro Rodriguez, Jacob Kahn, Gergely Szilvasy, Mike Lewis, Luke Zettlemoyer, and Wen tau Yih. RA-DIT: Retrieval-augmented dual instruction tuning. In The Twelfth International Conference on Learning Representations, 2024. URL https://openreview.net/forum?id=220Tbutug9. +Chen Ling, Xujiang Zhao, Jiaying Lu, Chengyuan Deng, Can Zheng, Junxiang Wang, Tanmoy Chowdhury, Yun Li, Hejie Cui, Xuchao Zhang, Tianjiao Zhao, Amit Panalkar, Dhagash Mehta, Stefano Pasquali, Wei Cheng, Haoyu Wang, Yanchi Liu, Zhengzhang Chen, Haifeng Chen, Chris White, Quanquan Gu, Jian Pei, Carl Yang, and Liang Zhao. Domain specialization as the key to make large language models disruptive: A comprehensive survey, 2023. +Hongyin Luo. Self-training for natural language processing. Ph.D. thesis, Massachusetts Institute of Technology, 2022. +Sourab Mangrulkar, Sylvain Gugger, Lysandre Debut, Younes Belkada, Sayak Paul, and Benjamin Bossan. Peft: State-of-the-art parameter-efficient fine-tuning methods. https://github.com/huggingface/peft, 2022. + +Michael S Matena and Colin A Raffel. Merging models with fisher-weighted averaging. In S. Koyejo, S. Mohamed, A. Agarwal, D. Belgrave, K. Cho, and A. Oh (eds.), Advances in Neural Information Processing Systems, volume 35, pp. 17703-17716. Curran Associates, Inc., 2022. URL https://proceedings.neurips.cc/paper_files/paper/2022/file/70c26937fbf3d4600b69a129031b66ec-Paper-Conference.pdf. +Sewon Min, Mike Lewis, Luke Zettlemoyer, and Hannaneh Hajishirzi. MetaICL: Learning to learn in context. In Marine Carpuat, Marie-Catherine de Marneffe, and Ivan Vladimir Meza Ruiz (eds.), Proceedings of the 2022 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pp. 2791-2809, Seattle, United States, July 2022. Association for Computational Linguistics. doi: 10.18653/v1/2022.naacl-main.201. URL https://aclanthology.org/2022.naacl-main.201. +Swaroop Mishra, Daniel Khashabi, Chitta Baral, and Hannaneh Hajishirzi. Cross-task generalization via natural language crowdsourcing instructions. In ACL, 2022. +Arindam Mitra, Luciano Del Corro, Shweti Mahajan, Andres Codas, Clarisse Simoes, Sahaj Agarwal, Xuxi Chen, Anastasia Razdaibiedina, Erik Jones, Kriti Aggarwal, Hamid Palangi, Guoqing Zheng, Corby Rosset, Hamed Khanpour, and Ahmed Awadallah. Orca 2: Teaching small language models how to reason, 2023. +Mohammed Muqeeth, Haokun Liu, Yufan Liu, and Colin Raffel. Learning to route among specialized experts for zero-shot generalization, 2024. +Long Ouyang, Jeffrey Wu, Xu Jiang, Diogo Almeida, Carroll Wainwright, Pamela Mishkin, Chong Zhang, Sandhini Agarwal, Katarina Slama, Alex Ray, et al. Training language models to follow instructions with human feedback. Advances in Neural Information Processing Systems, 35: 27730-27744, 2022. +Nils Reimers and Iryna Gurevych. Sentence-BERT: Sentence embeddings using Siamese BERT-networks. In Kentaro Inui, Jing Jiang, Vincent Ng, and Xiaojun Wan (eds.), 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. 3982-3992, Hong Kong, China, November 2019. Association for Computational Linguistics. doi: 10.18653/v1/D19-1410. URL https://aclanthology.org/D19-1410. +Hongjin Su, Jungo Kasai, Yizhong Wang, Yushi Hu, Mari Ostendorf, Wen-tau Yih, Noah A Smith, Luke Zettlemoyer, Tao Yu, et al. One embedder, any task: Instruction-finetuned text embeddings. arXiv preprint arXiv:2212.09741, 2022. +Shivchander Sudalairaj, Abhishek Bhandwaldar, Aldo Pareja, Kai Xu, David D. Cox, and Akash Srivastava. Lab: Large-scale alignment for chatbots, 2024. +Sainbayar Sukhbaatar, Olga Golovneva, Vasu Sharma, Hu Xu, Xi Victoria Lin, Baptiste Rozière, Jacob Kahn, Daniel Li, Wen tau Yih, Jason Weston, and Xian Li. Branch-train-mix: Mixing expert llms into a mixture-of-experts llm, 2024. +Zhiqing Sun, Yikang Shen, Qinhong Zhou, Hongxin Zhang, Zhenfang Chen, David Cox, Yiming Yang, and Chuang Gan. Principle-driven self-alignment of language models from scratch with minimal human supervision. In Advances in Neural Information Processing Systems, 2023. +Mirac Suzgun, Nathan Scales, Nathanael Schärli, Sebastian Gehrmann, Yi Tay, Hyung Won Chung, Aakanksha Chowdhery, Quoc V Le, Ed H Chi, Denny Zhou, , and Jason Wei. Challenging big-bench tasks and whether chain-of-thought can solve them. arXiv preprint arXiv:2210.09261, 2022. +Rohan Taori, Ishaan Gulrajani, Tianyi Zhang, Yann Dubois, Xuechen Li, Carlos Guestrin, Percy Liang, and Tatsunori B. Hashimoto. Stanford alpaca: An instruction-following llama model. https://github.com/tatsu-lab/stanford_alpaca, 2023. +Gemma Team, Thomas Mesnard, Cassidy Hardin, Robert Dadashi, Surya Bhupatiraju, Shreya Pathak, Laurent Sifre, Morgane Riviere, Mihir Sanjay Kale, Juliette Love, Pouya Tafti, Léonard Hussenot, Pier Giuseppe Sessa, Aakanksha Chowdhery, Adam Roberts, Aditya Barua, Alex + +Botev, Alex Castro-Ros, Ambrose Slone, Amélie Héliou, Andrea Tacchetti, Anna Bulanova, Antonia Paterson, Beth Tsai, Bobak Shahriari, Charline Le Lan, Christopher A. Choquette-Choo, Clément Crepy, Daniel Cer, Daphne Ippolito, David Reid, Elena Buchatskaya, Eric Ni, Eric Noland, Geng Yan, George Tucker, George-Christian Muraru, Grigory Rozhdestvenskiy, Henryk Michalewski, Ian Tenney, Ivan Grishchenko, Jacob Austin, James Keeling, Jane Labanowski, Jean-Baptiste Lespiau, Jeff Stanway, Jenny Brennan, Jeremy Chen, Johan Ferret, Justin Chiu, Justin Mao-Jones, Katherine Lee, Kathy Yu, Katie Millican, Lars Lowe Sjoesund, Lisa Lee, Lucas Dixon, Machel Reid, Maciej Mikula, Mateo Wirth, Michael Sharman, Nikolai Chinaev, Nithum Thain, Olivier Bachem, Oscar Chang, Oscar Wahltinez, Paige Bailey, Paul Michel, Petko Yotov, Rahma Chaabouni, Ramona Comanescu, Reena Jana, Rohan Anil, Ross McIlroy, Ruibo Liu, Ryan Mullins, Samuel L Smith, Sebastian Borgeaud, Sertan Girgin, Sholto Douglas, Shree Pandya, Siamak Shakeri, Soham De, Ted Klimenko, Tom Hennigan, Vlad Feinberg, Wojciech Stokowiec, Yu hui Chen, Zafarali Ahmed, Zhitao Gong, Tris Warkentin, Ludovic Peran, Minh Giang, Clément Farabet, Oriol Vinyals, Jeff Dean, Koray Kavukcuoglu, Demis Hassabis, Zoubin Ghahramani, Douglas Eck, Joelle Barral, Fernando Pereira, Eli Collins, Armand Joulin, Noah Fiedel, Evan Senter, Alek Andreev, and Kathleen Kenealy. Gemma: Open models based on gemini research and technology, 2024. + +Hugo Touvron, Louis Martin, Kevin Stone, Peter Albert, Amjad Almahairi, Yasmine Babaei, Nikolay Bashlykov, Soumya Batra, Prajjwal Bhargava, Shruti Bhosale, Dan Bikel, Lukas Blecher, Cristian Canton Ferrer, Moya Chen, Guillem Cucurull, David Esiobu, Jude Fernandes, Jeremy Fu, Wenyin Fu, Brian Fuller, Cynthia Gao, Vedanuj Goswami, Naman Goyal, Anthony Hartshorn, Saghar Hosseini, Rui Hou, Hakan Inan, Marcin Kardas, Viktor Kerkez, Madian Khabsa, Isabel Kloumann, Artem Korenev, Punit Singh Koura, Marie-Anne Lachaux, Thibaut Lavril, Jenya Lee, Diana Liskovich, Yinghai Lu, Yuning Mao, Xavier Martinet, Todor Mihaylov, Pushkar Mishra, Igor Molybog, Yixin Nie, Andrew Poulton, Jeremy Reizenstein, Rashi Rungta, Kalyan Saladi, Alan Schelten, Ruan Silva, Eric Michael Smith, Ranjan Subramanian, Xiaqing Ellen Tan, Binh Tang, Ross Taylor, Adina Williams, Jian Xiang Kuan, Puxin Xu, Zheng Yan, Iliyan Zarov, Yuchen Zhang, Angela Fan, Melanie Kambadur, Sharan Narang, Aurelien Rodriguez, Robert Stojnic, Sergey Edunov, and Thomas Scialom. Llama 2: Open foundation and fine-tuned chat models, 2023. + +Zhongwei Wan, Xin Wang, Che Liu, Samiul Alam, Yu Zheng, Jiachen Liu, Zhongnan Qu, Shen Yan, Yi Zhu, Quanlu Zhang, Mosharaf Chowdhury, and Mi Zhang. Efficient large language models: A survey. Transactions on Machine Learning Research, 2024. ISSN 2835-8856. URL https://openreview.net/forum?id=bsCCJHbO8A. Survey Certification. + +Yizhong Wang, Yeganeh Kordi, Swaroop Mishra, Alisa Liu, Noah A. Smith, Daniel Khashabi, and Hannaneh Hajishirzi. Self-instruct: Aligning language models with self-generated instructions. In Anna Rogers, Jordan Boyd-Graber, and Naoaki Okazaki (eds.), Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 13484-13508, Toronto, Canada, July 2023. Association for Computational Linguistics. doi: 10.18653/v1/2023.acl-long.754. URL https://aclanthology.org/2023.acl-long.754. + +Jason Wei, Maarten Bosma, Vincent Zhao, Kelvin Guu, Adams Wei Yu, Brian Lester, Nan Du, Andrew M. Dai, and Quoc V Le. Finetuned language models are zero-shot learners. In International Conference on Learning Representations, 2022. URL https://openreview.net/forum?id=gEZrGCozdqR. + +Mitchell Wortsman, Gabriel Ilharco, Samir Ya Gadre, Rebecca Roelofs, Raphael Gontijo-Lopes, Ari S Morcos, Hongseok Namkoong, Ali Farhadi, Yair Carmon, Simon Kornblith, and Ludwig Schmidt. Model soups: averaging weights of multiple fine-tuned models improves accuracy without increasing inference time. In Kamalika Chaudhuri, Stefanie Jegelka, Le Song, Csaba Szepesvari, Gang Niu, and Sivan Sabato (eds.), Proceedings of the 39th International Conference on Machine Learning, volume 162 of Proceedings of Machine Learning Research, pp. 23965-23998. PMLR, 17-23 Jul 2022. URL https://proceedings.mlr.press/v162/wortsman22a.html. + +Hongqiu Wu, Linfeng Liu, Hai Zhao, and Min Zhang. Empower nested Boolean logic via self-supervised curriculum learning. In Houda Bouamor, Juan Pino, and Kalika Bali (eds.), Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing, pp. 13731- + +13742, Singapore, December 2023. Association for Computational Linguistics. doi: 10.18653/v1/2023.emnlp-main.847. URL https://aclanthology.org/2023.emnlp-main.847. +Xun Wu, Shaohan Huang, and Furu Wei. Mixture of IoRA experts. In The Twelfth International Conference on Learning Representations, 2024. URL https://openreview.net/forum?id=uWvKBCYh4S. +Prateek Yadav, Derek Tam, Leshem Choshen, Colin Raffel, and Mohit Bansal. TIES-merging: Resolving interference when merging models. In Thirty-seventh Conference on Neural Information Processing Systems, 2023. URL https://openreview.net/forum?id=xtaX3WyCj1. +Le Yu, Bowen Yu, Haiyang Yu, Fei Huang, and Yongbin Li. Language models are super mario: Absorbing abilities from homologous models as a free lunch. In International Conference on Machine Learning. PMLR, 2024. +Matei Zaharia, Omar Khattab, Lingjiao Chen, Jared Quincy Davis, Heather Miller, Chris Potts, James Zou, Michael Carbin, Jonathan Frankle, Naveen Rao, and Ali Ghodsi. The shift from models to compound ai systems. https://bair.berkeley.edu/blog/2024/02/18/compound-ai-systems/, 2024. +Rowan Zellers, Ari Holtzman, Yonatan Bisk, Ali Farhadi, and Yejin Choi. HellaSwag: Can a machine really finish your sentence? In Anna Korhonen, David Traum, and Lluis Márquez (eds.), Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pp. 4791-4800, Florence, Italy, July 2019. Association for Computational Linguistics. doi: 10. 18653/v1/P19-1472. URL https://aclanthology.org/P19-1472. +Biao Zhang, Zhongtao Liu, Colin Cherry, and Orhan First. When scaling meets LLM finetuning: The effect of data, model and finetuning method. In *The Twelfth International Conference on Learning Representations*, 2024. URL https://openreview.net/forum?id=5HCnKDeTws. +Haiyan Zhao, Hanjie Chen, Fan Yang, Ninghao Liu, Huiqi Deng, Hengyi Cai, Shuaiqiang Wang, Dawei Yin, and Mengnan Du. Explainability for large language models: A survey. arXiv preprint arXiv:2309.01029, 2023. + +# A EXPERIMENT DETAILS + +We provide each of our self-specialization prompts for knowledge, reasoning, math, and coding experts in Tables 11, 12, 13, and 14. We largely follow Kang et al. (2024)'s prompt structure to ensure quality, with additional domain-specific instructions that inform task-related information. + +For our evaluation, we employ popular and widely accepted evaluation frameworks to pursue standard evaluation setups and protocols: HELM (Liang et al., 2023), LM Evaluation Harness (Gao et al., 2023), and BigCode Evaluation Harness (Ben Allal et al., 2022). We use Huggingface PEFT (Mangrulkar et al., 2022) and XLoRA (Buehler & Buehler, 2024) for the implementation of MoE compatible with LoRA. + +Regarding seed instructions, we sampled 100 training instances from each of the MMLU, BBH, and GSM8K datasets, for knowledge, reasoning, and math domains, respectively. For coding, since the size of the HumanEval dataset is very small and thus the training set is not available, we took 100 samples from the MBPP training set and converted the task format to make them suit the HumanEval. + +During instruction generation, we use three seed data, which are randomly sampled, as in-context examples, using a temperature of 1 and top-p of 0.98, whereas we use five seed data in-context for response generation with greedy decoding. For specialization, we use LoRA applied to all modules with a rank of 8 and alpha of 16, and train it using a learning rate of 3e-4, epochs of 3, and batch size of 32. We train each module and MiXSE using a standard Alpaca (Taori et al., 2023) prompt template on a single A100-80GB, which takes only a few hours. + +# B LIMITATIONS + +While our study demonstrates promising results for the Self-MoE, we recognize areas requiring further investigation in future work. Employing self-specialization Kang et al. (2024) to generate synthetic data within our framework may raise concerns about potential data contamination and noise. Nonetheless, findings from Kang et al. (2024), which conducted an n-gram overlap analysis between the self-specialization data and test data, confirmed no significant overlap, thus alleviating the concerns about contamination. Despite this, the need for continuous monitoring of potential biases from pre-training and the development of enhanced data validation and noise filtering strategies remain important, and may present interesting direction for future work. Moreover, due to computational constraints, we did not scale our model and data to their full potential. We also did not work on the optimization of the XLoRA, the MoE module we used, to focus purely on the research problem defined in this study. Future work should therefore concentrate on overcoming these limitations, which will enable better data quality and more extensive training to unveil the full potential of the Self-MoE framework. + +Table 6: Dataset statistics. Non-Target (In-Expertise) indicates where MiXSE does not directly specialize using seed data directly while relevant to targets. Non-Target (Out-of-Expertise) refers to irrelevant cases. + +
CategoryBenchmark# Examples
Target
Academic KnowledgeMMLU (57 Tasks)14,079
ReasoningBBH (27 Tasks)6,511
MathGSM8K8,790
CodingHumanEval164
Non-Target (In-Expertise)
MathMATH12,500
CodingMBPP257
Non-Target (Out-of-Expertise)
World KnowledgeNatural Questions3,610
TriviaQA17,200
CommonsenseHellaswag10,000
PIQA3,000
SafetyTruthfulQA817
+ +Table 7: Additional comparisons with other models for references. Results are extracted from each corresponding paper, except for pre-training methods where the numbers are all from BTX (Sukhbaatar et al., 2024). + +
MethodTotal +ParamsActive +ParamsCompos- +tionalSemantic +ExpertsLight- +weightData & Resrc +-Efficientw/o Teacher +& LabelsKnowledge +(MMLU 5-shot)Reasoning +(BBH)Math +(GSM8K)Coding +(HumanEval)
Base LLM
Gemma 7B (Team et al., 2024)7B7BX----65.756.142.534.1
LLaMA 2 70B (Touvron et al., 2023)70B70BX----68.951.235.229.9
Mixtral 8x7B (Jiang et al., 2024)47B13B✓XX--70.667.165.732.3
Pre-training Methods
Branch-Train-Merge (4x7B) (Li et al., 2022)<24B11.1B✓✓XX✓44.3-27.730.6
Sparse Upcycling (4x7B) (Komatsuzaki et al., 2023)<24B11.1B✓✓XX✓52.1-40.126.2
Branch-Train-Mix (4x7B) (Sukhbaatar et al., 2024)<24B11.1B✓✓XX✓52.5-37.128.7
MoE w/ LoRA
PHATGOOSE (Mueqeth et al., 2024)<4B>3B✓✓✓XX-35.6--
MOLE (Wu et al., 2024)--✓✓✓XX-42.2--
Distillation/Synthetic Data from Larger Models
GLAN 7B (w/ GPT-4) (Li et al., 2024a)7B7BX--XX62.960.780.848.8
Orca-2 7B (w/ GPT-4) (Mitra et al., 2023)7B7BX--XX53.942.855.717.1
Merlinite 7B (w/ Mixtral 8x7B) (Sudalairaj et al., 2024)7B7BX--XX64.9-44.6-
Self-Improving
Ours7B + 1%7B + 0.3%✓✓✓✓66.261.152.537.8
+ +# C DATASET DESCRIPTIONS + +The statistics for each dataset are provided in Table 6. The target datasets used are as follows: + +- MMLU (Massive Multitask Language Understanding) (Hendrycks et al., 2021a): A collection of 57 academic knowledge tasks. +- BBH (BIG-Bench Hard (Suzgun et al., 2022): A set of 27 challenging reasoning tasks. +- GSM8K (Grade School Math 8K) (Cobbe et al., 2021): A diverse set of grade school math word problems. +- HumanEval (Chen et al., 2021): A hand-written evaluation set for python programming problems. + +# D ADDITIONAL RESULTS + +# D.1 ADDITIONAL COMPARISON AND DISCUSSION + +In Table 7, we present additional comparisons with various other models and methods to provide a broader perspective, though comparisons may not appear to be direct, due to factors involved such as parameters, resources, etc. We discuss some noteworthy points. + +Notably, although MiXSE significantly improves upon its base model, Gemma 7B, it does not yet reach the performance levels of the more powerful Mixtral 8x7B. It is important to understand that Mixtral also utilizes an MoE (Mixture of Experts) architecture, but unlike MiXSE, it does not prioritize lightweight experts, leading to a much larger model with significantly more parameters. Moreover, while Mixtral's experts are implicitly built during pre-training, MiXSE explicitly creates semantic experts, allowing for targeted improvements and clearer interpretability. Importantly, our self-improving method can be potentially applied on top of any pre-trained model including Mixtral in principle. + +Similarly, BTX (Branch-Train-MiX) uses a pre-training MoE strategy where parameter-heavy semantic experts are employed, yielding substantial enhancements over the base LLM. This approach highlights the effectiveness of using semantically rich experts to refine the model's capabilities. To make comparisons in terms of efficiency, our model uses fewer parameters (7B), compared to BTX (12B active with much more whole parameters) and requires only about 1 GPU day for training, compared to 900 GPU days for BTX. In essence, since BTX is also a pre-training method while specialized, we expect it to be complementary to our Self-MoE, as evidenced in previous work (Kang et al., 2024). + +With a shared spirit, MOLE and PHATGOOSE build a MoE (Mixture of Experts) using LoRA, which is semantic and lightweight. However, there are significant differences in foundational assumptions: MOLE depends on human-labeled data, while PHATGOOSE requires access to pre + +Table 8: Detailed results of Self-MoEs w/ other LLMs, comparing with each corresponding LLM and instance merging on top of it. For MMLU, we employ the 0-shot setting, based on established observations (Dettmers et al., 2023; Lin et al., 2024) that tuning yields only marginal effects in the 5-shot setting for this task. Notably, we see that any tunings improve MMLU yet still, our MiXSE demonstrates noticeable average gains over instance merging for most base models. + +
MethodKnowledge (MMLU)Reasoning (BBH)Math (GSM8K)Coding (HumanEval)Avg.
LLaMA-3 8B
Base LLM31.660.849.026.241.9
Instance Merging62.546.947.524.445.3
MiXSE61.761.552.029.351.1
Gemma 7B
Base LLM58.456.142.534.147.8
Instance Merging62.657.653.536.052.4
MiXSE65.661.152.537.854.3
LLaMA-2 7B
Base LLM17.838.513.012.820.5
Instance Merging45.236.813.013.427.1
MiXSE44.038.313.514.027.5
LLaMA-2 13B
Base LLM20.445.622.516.526.2
Instance Merging51.243.025.517.134.2
MiXSE52.145.625.017.135.0
Mistral 7B
Base LLM29.854.938.027.437.5
Instance Merging61.751.530.529.243.2
MiXSE62.058.138.028.046.5
+ +trained expert models developed externally. In contrast, our Self-MoE framework independently constructs both experts and a router entirely from scratch, focusing on self-improvement without such dependencies. While their scenarios are considered reasonable in a certain context, we aim for broader applicability by minimizing assumptions on conditions. + +Lastly, GLAN demonstrates outstanding performance across various domains. This is attributed to their reliance on distilling from the larger and stronger model, GPT-4, using a huge amount of data (e.g., 10 million). As outlined in our problem statement (Section 2), we deliberately avoid assuming the availability of such advanced models to ensure the broader applicability of our method which self-improves from scratch. Consequently, while acknowledging each of their own value, it is crucial to recognize that direct comparisons may not be entirely appropriate, given the fundamental differences in resource assumptions and initial conditions. + +# D.2 DETAILED RESULTS OF SELF-MOE WITH OTHER BASE LLMS + +Table 8 presents the detailed results of our Self-MoE applied to a diverse set of base LLMs including LLaMA-3 8B, Gemma 7B, LLaMA-2 7B and 13B, Mistral 7B. As discussed in 4.5, overall, our approach can improve base models, outperforming the strong instance merging baseline, particularly with newer/stronger models like Gemma 7B, Mistral 7B, and LLaMA-3 8B. In specific cases like LLaMA-2 for reasoning, however, we see no improvement, while improving on average. This can be attributed to the weaker baseline performance, which hinders the generation of high-quality specialized synthetic data for specific capabilities. Through manual inspection of small sample sets, we identified instances where the generated instructions exhibited poor quality, including issues such as repeated tokens, off-topic content, and other inconsistencies, not following given instructions. This highlights an opportunity for further refinement in synthetic data generation techniques, which we view as a complementary area of ongoing research. As methods for synthetic data genera + +Table 9: Results of MiXSE using only seed data. Seed Only training shows only marginal improvements over the Base LLM in some benchmarks, validating that the effect of Self-MoE is not merely due to the use of seed data. + +
BenchmarkBase LLMSeed OnlyMiXSE
Knowledge (MMLU)58.357.465.6
Reasoning (BBH)56.157.061.1
Math (GSM8K)42.545.052.5
Coding (HumanEval)34.134.137.8
Avg.47.848.454.3
+ +Table 10: Visualized examples of the token-level routing, where each token is highlighted according to assigned experts (knowledge, reasoning, math, coding). Different experts can be dynamically activated within an instance, as the routing operates at token-level, while the most relevant expert is primarily selected. + +# GSM8K + +![](images/0853395924f404c6c7fbaa47c46628ee477e286fa5825fa8aafd20afc6c769ac.jpg) + +# HumanEval + +![](images/e40c425c5f6cc100a840b8067e2a0a72600b4ef30bf611814b762f39e8be2667.jpg) + +tion advance, they can directly enhance Self-MoE's performance with better self-specialized expert modules. + +# D.3 MIXSE USING ONLY SEED DATA + +Table 9 shows the results of the MiXSE when exploiting only seed data for training, clarifying the benefits derived from our methodological enhancements beyond the mere inclusion of seed data in training. While the Seed Only shows slight improvements over the Base LLM in some benchmarks, the significant enhancements of our MiXSE across all benchmarks confirm that the enhanced capabilities of Self-MoE are not merely due to the use of seed data. This further highlights the achievement of self-improvement with our method. + +# D.4 VAILDITY OF COMPARATIVE RESULTS + +In an effort to address the concern related to the sensitivity of in-context learning (Min et al., 2022), we perform three runs with the different lists of few-shot samples where applicable. As a result, we see that the mean of the base LLM (Gemma-7B)'s average performance across domains is 47.9 with a standard deviation (SD) of 0.56, that of our MiXSE is 53.6 with an SD of 0.60, and that of instance merging is 51.6 with an SD of 0.87. A statistical analysis between MiXSE and instance merging yields a p-value of 0.03, confirming the significant difference. + +# D.5 VISUALIZED EXAMPLES OF ROUTING DECISION + +Table 10 provides a detailed visualization of token-level routing decisions based on the Top-1 selection configuration. This table highlights how the routing module dynamically activates different experts within a single instance, reflecting the flexibility of token-level operation. As illustrated, the most relevant expert is predominantly selected for each token; however, the system occasionally activates other experts dynamically, depending on the specific token context within the instance. This behavior contrasts with self-specialization, which consistently relies on a single expert to handle all tokens uniformly, lacking the token-level granularity observed in the routing mechanism. + +Table 11: Prompts for knowledge-related instruction and response generation. + +# Instruction Brainstorming Prompt + +You are asked to come up with a set of task instructions about diverse domains across STEM, humanities, social sciences, and others. These task instructions will be given to a language model and we will evaluate the model for completing the instructions. + +Here are the requirements: +1. The type of task should be multiple-choice question answering. That is, a question along with multiple options (A, B, C, D) should be provided. +2. The language used for the instruction/question also should be diverse. +3. A language model should be able to complete the instruction. For example, do not ask the assistant to create any visual or audio output. For another example, do not ask the assistant to wake you up at 5pm or set a reminder because it cannot perform any action. +4. The instructions should be in English. +5. The instructions should be 1 to 2 sentences long. Either an imperative sentence or a question is permitted. +6. You should generate an appropriate input to the instruction. The input field should contain a specific example provided for the instruction. It should involve realistic data and should not contain simple placeholders. The input should provide substantial content to make the instruction challenging. +7. Ensure diverse domains are covered for extensive expert-level knowledge. The subjects may include Abstract Algebra, Anatomy, Astronomy, Business Ethics, Clinical Knowledge, College-level Biology, Chemistry, Computer Science, Mathematics, Medicine, Physics, Computer Security, Conceptual Physics, Econometrics, Electrical Engineering, Elementary Mathematics, Formal Logic, Global Facts, High School-level Biology, Chemistry, Computer Science, European History, Geography, Gov't and Politics, Macroeconomics, Mathematics, Microeconomics, Physics, Psychology, Statistics, US History, World History, Human Aging, Human Sexuality, International Law, Jurisprudence, Logical Fallacies, Machine Learning, Management, Marketing, Medical Genetics, Miscellaneous, Moral Disputes, Moral Scenarios, Nutrition, Philosophy, Prehistory, Professional-level (Accounting, Law, Medicine, Psychology), Public Relations, Security Studies, Sociology, US Foreign Policy, Virology, World Religions, etc. + +List of tasks: + +# Response Generation + +You are a knowledgeable domain expert. Given an instruction and a question, generate the best answer to solve the given task about STEM, humanities, social sciences, and others. + +Table 12: Prompts for reasoning-related instruction and response generation. + +# Instruction Brainstorming Prompt + +You are asked to come up with a set of task instructions focusing on challenging tasks that require multi-step reasoning. These task instructions will be given to a language model and we will evaluate the model for completing the instructions. + +Here are the requirements: + +1. The type of task should be question answering, requiring multi-step reasoning. +2. The language used for the instruction/question also should be diverse. +3. The generated problem should have a single correct answer. +4. The instructions should be in English. +5. The instructions should be 1 to 2 sentences long. Either an imperative sentence or a question is permitted. +6. You should generate an appropriate input question to the instruction. It should involve realistic data and should not contain simple placeholders. The input should provide substantial content to make the instruction challenging. +7. Ensure diverse topics and levels are covered for extensive expert-level reasoning. The tasks may be about boolean expression, causal judgement, date understanding, disambiguation of question, closing Dyck-n words, formal fallacies, geometric shapes, hyperbaton, logical deduction of objects, movie recommendation, multi-step arithmetic problem, navigation, object counting, table reasoning, reasoning about colored objects, selecting one that ruins the name in an input, salient translation error detection, sarcastic sentence classification, sports understanding, temporal sequences, tracking shuffled objects, web of lies, word sorting, etc. + +List of tasks: + +# Response Generation + +You are a multi-step reasoning expert. Given an instruction and a challenging question, generate step-by-step reasoning and the answer. + +Table 13: Prompts for math-related instruction and response generation. + +# Instruction Brainstorming Prompt + +You are asked to come up with a set of task instructions focusing on mathematical problems. These task instructions will be given to a language model and we will evaluate the model for completing the instructions. + +Here are the requirements: + +1. The type of task should be question answering, requiring multi-step reasoning. +2. The language used for the instruction/question also should be diverse. +3. The generated mathematical problem should have a solution. +4. The instructions should be in English. +5. The instructions should be 1 to 2 sentences long. Either an imperative sentence or a question is permitted. + +6. You should generate an appropriate input question to the instruction. It should involve realistic data and should not contain simple placeholders. The input should provide substantial content to make the instruction challenging. + +7. Ensure diverse topics and levels are covered for extensive expert-level reasoning. The subjects may include Algebra, Counting, Probability, Calculus, Statistics, Geometry, Linear Algebra, Number Theory and grade school math, etc. + +List of tasks: + +# Response Generation + +You are a math expert. Given an instruction and a mathematical question, generate step-by-step reasoning and the answer. + +Table 14: Prompts for coding-related instruction and response generation. + +# Instruction Brainstorming Prompt + +You are asked to come up with a set of task instructions focusing on coding problems. These task instructions will be given to a language model and we will evaluate the model for completing the instructions. + +Here are the requirements: + +1. The type of task should be about coding problems, such as writing a python function given a specific instruction and test examples. + +2. The language used for the instruction should be diverse, but the programming language should be python. + +3. The generated problem should have a solution. + +4. The instructions should be in English. + +5. You should generate appropriate and correct test examples for the given problem. + +6. Ensure diverse functions and levels are covered for extensive expert-level coding. + +List of tasks: + +# Response Generation + +You are a coding expert. Given an instruction and test cases, write a python function that passes the test cases. \ No newline at end of file diff --git a/ICLR/2025/Self-MoE_ Towards Compositional Large Language Models with Self-Specialized Experts/images.zip b/ICLR/2025/Self-MoE_ Towards Compositional Large Language Models with Self-Specialized Experts/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..315e5540dad276ded311198f435cfced3564ae2e --- /dev/null +++ b/ICLR/2025/Self-MoE_ Towards Compositional Large Language Models with Self-Specialized Experts/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:84c088793a1e2e92f03df8dc6bf6fb8b40582a32c0bd6fce21ef79a06df30f82 +size 655997 diff --git a/ICLR/2025/Self-MoE_ Towards Compositional Large Language Models with Self-Specialized Experts/layout.json b/ICLR/2025/Self-MoE_ Towards Compositional Large Language Models with Self-Specialized Experts/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..d0d04b33e21ddaae3830c0e44c78492ca9db1d22 --- /dev/null +++ b/ICLR/2025/Self-MoE_ Towards Compositional Large Language Models with Self-Specialized Experts/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7250ab78e13efd19a2ebe1deb86afe527cc5776aaf7ad9daf3618362776d676e +size 604287 diff --git a/ICLR/2025/Self-Normalized Resets for Plasticity in Continual Learning/4617a446-59d4-4730-80af-da586b6392f8_content_list.json b/ICLR/2025/Self-Normalized Resets for Plasticity in Continual Learning/4617a446-59d4-4730-80af-da586b6392f8_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..28fa7e6822837b2498f74311d02d70ceccb333c3 --- /dev/null +++ b/ICLR/2025/Self-Normalized Resets for Plasticity in Continual Learning/4617a446-59d4-4730-80af-da586b6392f8_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:07a8032f1d5b9770ab630922655ad22657c3427280d40fd49fad07729b5cf992 +size 236903 diff --git a/ICLR/2025/Self-Normalized Resets for Plasticity in Continual Learning/4617a446-59d4-4730-80af-da586b6392f8_model.json b/ICLR/2025/Self-Normalized Resets for Plasticity in Continual Learning/4617a446-59d4-4730-80af-da586b6392f8_model.json new file mode 100644 index 0000000000000000000000000000000000000000..a76c185e537fafb071fe332d3a9c328b7355505a --- /dev/null +++ b/ICLR/2025/Self-Normalized Resets for Plasticity in Continual Learning/4617a446-59d4-4730-80af-da586b6392f8_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e6475b11eb8de9bd1b71985d47a20ee554fa4f185ebab8db82466af74ac4c0c9 +size 264081 diff --git a/ICLR/2025/Self-Normalized Resets for Plasticity in Continual Learning/4617a446-59d4-4730-80af-da586b6392f8_origin.pdf b/ICLR/2025/Self-Normalized Resets for Plasticity in Continual Learning/4617a446-59d4-4730-80af-da586b6392f8_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..fd3dab806f8f840b80042b7a1d0088036d633e06 --- /dev/null +++ b/ICLR/2025/Self-Normalized Resets for Plasticity in Continual Learning/4617a446-59d4-4730-80af-da586b6392f8_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:01fa135d3491eda2484dd97b92fd145ca764c080f8a43c3eafabe7fe6635f4b7 +size 3283497 diff --git a/ICLR/2025/Self-Normalized Resets for Plasticity in Continual Learning/full.md b/ICLR/2025/Self-Normalized Resets for Plasticity in Continual Learning/full.md new file mode 100644 index 0000000000000000000000000000000000000000..366489d095584b1afba1151d839fb8ba9af92ed6 --- /dev/null +++ b/ICLR/2025/Self-Normalized Resets for Plasticity in Continual Learning/full.md @@ -0,0 +1,1165 @@ +# SELF-NORMALIZED RESETS FOR PLASTICITY IN CONTINUAL LEARNING + +Vivek F. Farias + +Sloan School of Management +Massachusetts Institute of Technology +Cambridge, MA 02139, USA +vivekf@mit.edu + +Adam D. Jozefiak* + +Operations Research Center +Massachusetts Institute of Technology +Cambridge, MA 02139, USA +jozefiak@mit.edu + +# ABSTRACT + +Plasticity Loss is an increasingly important phenomenon that refers to the empirical observation that as a neural network is continually trained on a sequence of changing tasks, its ability to adapt to a new task diminishes over time. We introduce Self-Normalized Resets (SNR), a simple adaptive algorithm that mitigates plasticity loss by resetting a neuron's weights when evidence suggests its firing rate has effectively dropped to zero. Across a battery of continual learning problems and network architectures, we demonstrate that SNR consistently attains superior performance compared to its competitor algorithms. We also demonstrate that SNR is robust to its sole hyperparameter, its rejection percentile threshold, while competitor algorithms show significant sensitivity. SNR's threshold-based reset mechanism is motivated by a simple hypothesis test that we derive. Seen through the lens of this hypothesis test, competing reset proposals yield suboptimal error rates in correctly detecting inactive neurons, potentially explaining our experimental observations. We also conduct a theoretical investigation of the optimization landscape for the problem of learning a single ReLU. We show that even when initialized adversarially, an idealized version of SNR learns the target ReLU, while regularization based approaches can fail to learn. + +# 1 INTRODUCTION + +Plasticity Loss is an increasingly important phenomenon studied broadly under the rubric of continual learning (Dohare et al., 2024). This phenomenon refers to the empirical observation that as a network is continually trained on a sequence of changing tasks, its ability to adapt to a new task diminishes over time. While this is distinct from the problem of catastrophic forgetting (also studied under the rubric of continual learning (Goodfellow et al., 2013; Kirkpatrick et al., 2017)), it is of significant practical importance. In the context of pre-training language models, an approach that continually trains models with newly collected data is preferable to training from scratch (Ibrahim et al., 2024; Wu et al., 2024). On the other hand, the plasticity loss phenomenon demonstrates that such an approach will likely lead to models that are increasingly unable to adapt to new data. Similarly, in the context of reinforcement learning using algorithms like TD, where the learning tasks are inherently non-stationary, the plasticity loss phenomenon results in actor or critic networks that are increasingly unable to adapt to new data (Lyle et al., 2022). Figure 1 illustrates plasticity loss in the 'Permuted MNIST' problem introduced by Goodfellow et al. (2013). + +One formal definition of plasticity measures the ability of a network initialized at a specific set of parameters to fit a random target function using some pre-specified optimization procedure. In this sense, random parameter initializations (eg. Lyle et al. (2024)) are known to enjoy high plasticity. This has motivated two related classes of algorithms that attempt to mitigate plasticity loss. The first explicitly 'retsets' neurons that are deemed to have low 'utility' (Dohare et al., 2023; Sokar et al., 2023). A reset re-initializes the neurons input weights and bias according to some suitable random initialization rule, and sets the output weights to zero; algorithms vary in how the utility of a neuron is defined and estimated from online data. A second class of algorithms perform this reset procedure + +implicitly via regularization (Ash & Adams, 2020; Kumar et al., 2023b). These latter algorithms differ in their choice of what to regularize towards, with choices including the original network initialization; a new randomly drawn initialization; or even zero. The aforementioned approaches to mitigating plasticity loss attempt to adjust the training process; other research has studied the role of architectural and optimizer hyperparameter choices. Across all of the approaches to mitigating plasticity loss described above, no single approach is yet to emerge as both robust to hyperparameter choices, and simultaneously performant across benchmark problems. + +Given some point process consider the task of distinguishing between the hypotheses that this point process has a positive rate (the null hypothesis), or a rate that is identically zero with a penalty for late rejection or acceptance. An optimal test here takes the following simple form: we reject the null hypothesis as soon as the time elapsed without an event exceeds some percentile of the interarrival time under the null hypothesis and otherwise accept immediately upon an event. Viewing the firing of a neuron as such a point process, we propose to reset a neuron based on a rejection of the hypothesis that the neuron is firing at a positive rate. We use the histogram of past inter-firing times as a proxy of the inter-arrival time distribution under the null hypothesis. This exceedingly simple algorithm is specified by a single hyperparameter: the rejection percentile threshold. We refer to this procedure as self-normalized resets (SNR) and argue this is a promising approach to mitigating plasticity loss: + +1. We demonstrate superior performance on four benchmark problems classes studied in (Dohare et al., 2023; Kumar et al., 2023b). Interestingly, there is no single closest competitor to SNR across these problems. Many competing approaches also show significant sensitivity to the choice of hyperparameters; SNR does not. We introduce a new problem to elucidate similar plasticity loss phenomena in the context of language models, and show similar relative merits for SNR. +2. We conduct a theoretical investigation of the optimization landscape for the problem of learning a single ReLU. We show that while (an idealized version of) SNR learns the target ReLU, regularization based approaches can fail to learn in this simple setting. + +# 1.1 RELATED LITERATURE + +The phenomenon of plasticity loss was discovered in the context of transfer learning (Ash & Adams, 2020; Zilly et al., 2021; Achille et al., 2017). Achille et al. (2017) showed that pre-training a network on blurred CIFAR images reduces its ability to learn on the original images. In a similar vein, Ash & Adams (2020) showed that pre-training a network on $50\%$ of a training set followed by training on the complete training set reduces accuracy relative to a network that forgoes the pre-training step. More recent literature has focused on problems that induce plasticity loss while training on a sequence of hundreds of changing tasks, such as Permuted MNIST and Continual ImageNet in Dohare et al. (2021), capturing the necessity to learn indefinitely. + +Correlates of Plasticity Loss. The persistence of plasticity loss across a swathe of benchmark problems has elucidated a search for its cause. Several correlates of plasticity loss have been well observed, namely neuron inactivity, feature or weight rank collapse, increasing weight norms, and loss of curvature in the loss surface (Dohare et al., 2021; Lyle et al., 2023; Sokar et al., 2023; Lewandowski et al., 2023; Kumar et al., 2020). The exact cause of plasticity loss remains unclear and Lyle et al. (2023) have shown that for any correlate an experiment can be constructed in which its correlation with plasticity loss is negative. Nonetheless, these correlates have inspired a series of algorithms and interventions with varying degrees of success in alleviating the problem. However, none is consistently performant across architectures and benchmark problems. + +Reset Methods. Algorithms that periodically reset inactive or low-utility neurons have emerged as a promising approach (Dohare et al., 2023; Sokar et al., 2023; Nikishin et al., 2022). Continual Backprop (CBP) (Dohare et al., 2023) is one such method which tracks a utility for each neuron, and according to some reset frequency $r$ , it resets the neuron with minimum utility in each layer. CBP's utility is a discounted average product of a neuron's associated weights and activation, a heuristic inspired by the literature on network pruning. Another algorithm is ReDO (Sokar et al., 2023), where on every $1 / r^{\mathrm{th}}$ mini-batch, ReDO computes the average activity of each neuron and resets those neurons whose average activities are small relative to other neurons in the corresponding layer, according to a threshold hyperparameter. Two defining characteristics of CBP and ReDO are + +a fixed reset rate and that neurons are reset relative to the utility of other neurons in their layer. As we will see, these proposals result in sub-optimal error rates, in a sense we make precise later. + +Regularization Methods. L2 regularization has been shown to reduce plasticity loss, but is insufficient in completely alleviating the phenomenon (Dohare et al., 2021; Lyle et al., 2023). While L2 regularization limits weight norm growth during continual learning, it can exacerbate weight rank collapse due to regularization towards the origin. One successful regularization technique is Shrink and Perturb (S&P) (Ash & Adams, 2020), which periodically scales the network's weights by a shrinkage factor $p$ followed by adding random noise to each weight with scale $\sigma$ . Another approach is to perform L2 regularization towards the initial weights referred to as L2 Init (Kumar et al., 2023b). These methods can be viewed as variants of L2 regularization that regularize towards a random initialization and the original initialization, respectively. These methods limit the growth of weight norms while maintaining weight rank and neuron activity by regularizing towards a high-plasticity parameterization. + +Architectural and Optimizer Modifications. Architectural modifications such as layer normalization (Ba et al., 2016) and the use of concatenated ReLU activations have been shown to improve plasticity to varying degrees across network architectures and problem settings (Lyle et al., 2023; Kumar et al., 2023b). Additionally, tuning Adam hyperparameters to improve the rate at which second moment estimates are updated has been explored with some success in Lyle et al. (2023). + +# 2 ALGORITHM + +To make ideas precise, consider a sequence of training examples $(X_{t},Y_{t})\in \mathcal{X}\times \mathcal{Y}$ , drawn from some distribution $\mu_t$ . Denote the network by $f:\mathcal{X}\times \Theta \to \mathcal{Y}$ , and let $l:\mathcal{Y}\times \mathcal{Y}\to \mathbb{R}$ be our loss function. Denote by $H_{t}\in \mathcal{H}_{t}$ , the history of network weights and training examples up to time $t$ , and assume access to an optimization oracle $O_{t}:\mathcal{H}_{t - 1}\to \Theta$ that maps the history of weights and training examples to a new set of network weights. As a concrete example, $O_{t}$ might correspond to stochastic gradient descent. + +Let $\theta_t^*$ minimize $\mathbb{E}_{\mu_t}[l(f(X_t; \theta), Y_t)]$ , denote $\Theta_t = O_t(H_{t-1})$ , and consider average expected regret + +$$ +\frac {1}{T} \sum_ {t} \mathbb {E} _ {\mu_ {t}} [ l (f (X _ {t}; \Theta_ {t}), Y _ {t}) ] - \mathbb {E} _ {\mu_ {t}} [ l (f (X _ {t}; \theta_ {t} ^ {*}), Y _ {t}) ] +$$ + +Plasticity loss describes the phenomenon where, for certain continual learning processes $\Theta_t$ , such as those corresponding to SGD or Adam, average expected regret increases over time, even for benign choices of $\mu_t$ . To make these ideas concrete, it is worth considering an example of the above phenomenon reported first by Dohare et al. (2021). + +Example 2.1 (The Permuted MNIST problem). Consider a sequence of 'tasks' presented sequentially to SGD, wherein each task consists of 10000 images from the MNIST dataset with the pixels permuted. SGD trains over a single epoch on each task before the subsequent task is presented. Figure 1 measures average accuracy on each task; we see that average accuracy decreases over tasks. The figure also shows a potential correlate of this phenomenon: the number of 'dead' or inactive neurons $^2$ in the network increases as training proceeds, diminishing the network's effective capacity. + +One hypothesis that seeks to explain plasticity loss is that the network weights obtained from minimizing loss over some task yield poor initializations for a subsequent task, leading to the inactive neurons we observe in the above experiment. On the other hand random weight initializations are known to work well (Glorot & Bengio, 2010), suggesting a natural class of heuristics: re-initialize inactive neurons. Of course, the crux of any such algorithm is determining whether a neuron is inactive in the first place, and doing so as quickly as possible. + +To motivate our algorithm, SNR, consider applying the network $f(\cdot ;\theta_t^*)$ to a hypothetical sequence of training examples drawn i.i.d. from $\mu_{t}$ indexed by $s$ . Let $Z_{s,i}^{\mu_t}$ indicate the sequence of activa + +![](images/11eaa9094b6ca3d9ff270e4eafa149f07ea380863050a3b1c78d669d66437c80.jpg) +Figure 1: Illustration of plasticity loss and its mitigation by SNR during training of a multilayer perceptron on the Permuted MNIST problem for a single random seed. For this figure, a neuron is declared dead if it has not fired for the last 1000 consecutive training examples. + +![](images/94205096b1367adb745d46089a8f86a66c619d123c0eee84ddfb056f26b1d9c9.jpg) + +# Algorithm 1: SNR: Self-Normalized Resets + +Input: Reset percentile threshold $\eta$ + +Initialize: Initialize weights $\theta_0$ randomly. Set inter-firing time $a_i = 0$ for each neuron $i$ + +for each training example $x_{t}$ do + +Forward Pass: Evaluate $f(x_{t};\theta_{t})$ . Get neuron activations $z_{t,i}$ for each neuron $i$ + +Update inter-firing times: For each neuron $i$ , $a_i \gets a_i + 1$ if $z_{t,i} = 0$ . Otherwise, $a_i \gets 0$ + +Optimize: $\theta_{t + 1}\gets O_t(H_t)$ + +Resets: For each neuron $i$ , reset if $\mathbb{P}(A_i^{\mu_t} \geq a_i) \leq \eta$ . + +end + +tions of neuron $i$ , and let $A_{i}^{\mu_{t}}$ be a random variable distributed as the random time between any two consecutive activations over this hypothetical sequence of examples. Now turning to the actual sequence of training examples, let $a_{i}^{t}$ count the time since the last firing of neuron $i$ prior to time $t$ . Our (idealized) proposal is then exceedingly simple: reset neuron $i$ at time $t$ iff $\mathbb{P}(A_{i}^{\mu_{t}} \geq a_{i}^{t}) \leq \eta$ for some suitably small threshold $\eta$ . We dub this algorithm Self-Normalized Resets and present it as Algorithm 1. The algorithm requires a single hyper parameter, $\eta$ . Of course in practice, the distribution of $A_{i}^{\mu_{t}}$ is unknown to us, and so an implementable version of Algorithm 1 simply approximates this distribution with the histogram of inter-firing times of neuron $i$ prior to time $t$ .3 + +# 2.1 MOTIVATING SNR AND COMPARISON TO OTHER RESET SCHEMES + +Here we motivate the SNR heuristic and compare it to other proposed reset schemes. Consider the following simple hypothesis test: we observe a discrete time process $Z_{s} \in \{0,1\}$ which under the null hypothesis $H_{0}$ is a Bernoulli process with mean $p > 0$ . The alternative hypothesis $H_{1}$ is that the mean of the process is identically zero. A hypothesis test must, at some stopping time $\tau$ , either reject $(X_{\tau} = 1)$ or accept $(X_{\tau} = 0)$ the null; an optimal such test would choose to minimize the sum of type-1 and type-2 errors (the 'error rate') and a penalty for delays: + +$$ +\mathbb {P} \left(X _ {\tau} = 1 \mid H _ {0}\right) + \mathbb {P} \left(X _ {\tau} = 0 \mid H _ {1}\right) + \lambda \left(\mathbb {E} [ \tau \mid H _ {0} ] + \mathbb {E} [ \tau \mid H _ {1} ]\right) +$$ + +Here the multiplier $\lambda > 0$ penalizes the delay in a decision. If $\lambda < p / 2$ , the optimal test takes a simple form: for some suitable threshold $\bar{T}$ , reject the null iff $Z_{s} = 0$ for all times $s$ up to $\bar{T}$ : + +Proposition 2.1. Let $\bar{T}$ be the $1 - \lambda (p - \lambda)^{-1}$ percentile of a Geometric $(p)$ distribution. Then the optimal hypothesis test takes the form $X_{\tau} = \mathbf{1}\{Z_{\tau} = 0\}$ where $\tau = \min (s:Z_s = 1)\wedge \bar{T}$ . + +Notice that if $\lambda \propto p$ , the percentile threshold above is independent of $p$ . Applying this setup to the setting where under the null, we observe the firing of neuron $i$ under i.i.d. training examples from $\mu_t$ and a neuron is considered 'dead' or inactive if the alternate hypothesis is true, imagine that $p = \mathbb{P}(Z_{s,i}^{\mu_t} = 1)$ . Further, we assume $\lambda = \alpha p (\alpha < 1/2)$ ; a reasonable assumption which models a larger penalty for late detection of neurons that are highly active. It is then optimal to declare neuron $i$ 'inactive' if the length of time it has not fired exceeds the $1 - \alpha (1 - \alpha)^{-1}$ percentile of the distribution of $A_i^{\mu_t}$ . This is the underlying motivation for the SNR heuristic. + +Comparison with Reset Schemes: Neuron reset heuristics such as Sokar et al. (2023) define (sometimes complex) notions of neuron 'utility' to determine whether or not to re-initialize a neuron. The utility of every neuron is computed over every consecutive (say) $r$ minibatches, and neurons with utility below a threshold are reset. To facilitate a comparison, consider the setting where neurons that do not fire at all over the course of the $r$ mini batches are estimated to have zero utility, and that only neurons with zero utility are re-initialized. + +This reveals an interesting comparison with SNR. The schemes above will re-initialize a neuron after inactivity over a period of time that is uniform across all neurons. On the other hand, SNR will reset a neuron after it is inactive for a period that corresponds to a fixed percentile of the inter-firing time distribution of that neuron. Whereas this percentile is fixed across neurons, the corresponding period of inactivity after which a neuron is reset will vary across neurons: shorter for neurons that tend to fire frequently, and longer for neurons that fire less frequently. + +We can make this comparison precise in the context of the hypothesis testing setup above: specifically, consider two neurons with null firing rates $p_1$ and $p_2$ respectively ( $p_1 < p_2$ ), and delay multipliers, $\lambda$ , of $\alpha p_1$ and $\alpha p_2$ respectively. By Proposition 2.1, under SNR, the first is reset if it is inactive for time at least $\log(\alpha (1 - \alpha)^{-1}) / \log (1 - p_1)$ and the second if it is inactive for time at least $\log(\alpha (1 - \alpha)^{-1}) / \log (1 - p_2)$ . In contrast, for a fixed threshold scheme such as Sokar et al. (2023), either neuron would be reset after being inactive for some fixed threshold, say $r^*$ . Assume $r^*$ is set to minimize the sum of the error rates of the two neurons while keeping the total delay identical to that for SNR. The proposition below compares the error rate between the two schemes: + +Proposition 2.2. The ratio of total error rate with a fixed threshold $r^*$ to that under SNR scales like + +$$ +\Omega \left(\exp \left(\log (\alpha (1 - \alpha) ^ {- 1}) \left(- \frac {1}{2} + \frac {1}{2} \frac {\log (1 - p _ {1})}{\log (1 - p _ {2})}\right)\right)\right) +$$ + +Now recall that $\alpha < 1/2$ and $p_1 < p_2$ . The result above then shows that: (a) the error rate under an (optimal) fixed threshold can grow arbitrarily larger than the error rate under SNR as the penalty for delay shrinks to zero and (b) the rate at which this gap grows itself scales with the difference in the nominal firing rates of the neurons under consideration. This provides insight into the relative merits of using a scheme like SNR in lieu of existing reset proposals: resets under SNR detect changes in the firing rate of a neuron faster and more accurately; this matters particularly in situations where there is wide disparity in the nominal firing rates of neurons across the network. + +# 3 EXPERIMENTS + +We evaluate the efficacy and robustness of SNR on a series of benchmark problems from the continual learning literature, measuring regret with respect to prediction accuracy $l(y, y') = \mathbf{1}\{y \neq y'\}$ . As an overview, we will seek to make the following points: + +Inactive neurons are an important correlate of plasticity loss: This is true across several architectures: vanilla MLPs, CNNs and transformers. + +Lower average loss: Across a broad set of problems/ architectures from the literature, SNR consistently achieves lower average loss than competing algorithms. + +No consistent second-best competitor: Among competing algorithms, none emerge as consistently second best to SNR. + +Robustness to hyper-parameters: The performance of SNR is robust to the choice of its single hyper parameter (the rejection percentile threshold). This is less so for competing algorithms. + +# 3.1 EXPERIMENTAL SETUP + +Each problem consists of tasks $\mathcal{T}_1, \mathcal{T}_2, \ldots, \mathcal{T}_N$ , each of which contains training examples in $\mathcal{X} \times \mathcal{Y}$ . A network is trained for a fixed number of epochs per task to minimize cross-entropy loss. We perform an initial hyperparameter sweep over 5 seeds to determine the optimal choice of hyperparameters (see Appendix C). For each algorithm and problem, we select the hyperparameters that attain the lowest average loss and repeat the experiment on 5 new random seeds. A random seed determines the network's parameter initialization, the generation of tasks, and any randomness in the algorithms evaluated. We evaluate both SGD and Adam as the base optimization algorithm, as earlier literature has argued that Adam can be less performant than SGD in some continual learning settings (Dohare et al., 2023; Ashley et al., 2021). We evaluate on the following problems: + +Permuted MNIST (PM) (Goodfellow et al., 2013; Dohare et al., 2021; Kumar et al., 2023b): A subset of 10000 image-label pairs from the MNIST dataset are sampled for an experiment. A task consists of a random permutation applied to each of the 10000 images. The network is presented with 2400 tasks appearing in consecutive order. Each task consists of a single epoch and the network receives data in batches of size 16. + +Random Label MNIST (RM) (Kumar et al., 2023b; Lyle et al., 2023): A subset of 1200 images from the MNIST dataset are sampled for an experiment. An experiment consists of 100 tasks, where each task is a random assignment of labels, consisting of 10 classes, to the 1200 images. A network is trained for 400 epochs on each task with a batch size 16. + +Random Label CIFAR (RC) (Kumar et al., 2023b; Lyle et al., 2023): A subset of 128 images from the CIFAR-10 dataset are sampled for an experiment. An experiment consists of 50 tasks, where each task is a random assignment of labels, consisting of 10 classes, to the 128 images. An agent is trained for 400 epochs on each task with a batch size 16. + +Continual Imagenet (CI) (Dohare et al., 2023; Kumar et al., 2023b): An experiment consists of all 1000 classes of images from the ImageNet-32 dataset (Chrabaszcz et al., 2017) containing 600 images from each class. Each task is a binary classification problem between two of the 1000 classes, selected at random. The experiment consists of 500 tasks and each class occurs in exactly one task. Each task consists of 1200 images, 600 from each class, and the network is trained for 10 epochs with a batch size of 100. + +Permuted Shakespeare (PS): We propose this problem to facilitate studying the transformer architecture in analogy to the MNIST experiments. An experiment consists of 32768 tokens of text from Shakespeare's Tempest. For any task, we take a random permutation of the vocabulary of the Tempest and apply it to the text. The network is presented with 500 tasks. Each task consists of 100 epochs and the network receives data in batches of size 8 with a context widow of width 128. We evaluate over 9 seeds. + +This experimental setup, for all but Permuted Shakespeare, follows that of (Kumar et al., 2023b), with the exceptions of Permuted MNIST which has its task count increased from 500 to 2400, Random Label MNIST which has its task count increased from 50 to 100, and Random Label CIFAR which has its dataset reduced from 1200 to 128 images. Lyle et al. (2023) consider variants of the Random Label MNIST and CIFAR problems by framing them as MDP environments for DQN agents. During training, the DQN agents are periodically paused to assess their plasticity by training them on separate, randomly generated regression tasks using the same image datasets. + +# 3.1.1 ALGORITHMS AND ARCHITECTCURES + +Our baseline in all problems consist simply of using SGD or Adam as the optimizer with no further intervention. We then consider several interventions to mitigate plasticity loss. First, we consider algorithms that employ an explicit reset of neurons: these include SNR, Continual Backprop (CBP) (Dohare et al., 2021), and ReDO (Sokar et al., 2023). Among algorithms that attempt to use regularization, we consider vanilla L2 regularization, L2 Init (Kumar et al., 2023b), and Shrink and Perturb (Ash & Adams, 2020). Finally, as a potential architectural modification we consider the use of Layer Normalization (Ba et al., 2016). + +We utilize the following network architectures: + +MLP: For Permuted MNIST and Random Label MNIST we use an MLP identical to that in Kumar et al. (2023b) which in turn is a slight modification to that in Dohare et al. (2023). + +CNN: For Random Label CIFAR and Continual ImageNet we use a CNN architectures identical to + +that in Kumar et al. (2023b) which in turn is a slight modification to that in Dohare et al. (2023). Transformer: We use a decoder model with a single layer consisting of 2 heads, dimension 16 for each head, and with 256 neurons in the feed forward layer with ReLU activations. We deploy this architecture on the Permuted Shakespeare problem using the GPT-2 BPE tokenizer (limited to the set of unique tokens present in the sampled text). + +# 3.2 RESULTS AND DISCUSSION + +We separately discuss the results for the first four problems (PM, RM, RC, CI) followed by Permuted Shakespeare; we observe additional phenomena in the latter experiment which merit separate discussion. + +
OptimizerSGDAdam
AlgorithmPMRMRCCIPMRMRCCI
No Intv.0.710.110.180.780.640.110.150.58
SNR0.850.970.990.890.880.980.980.85
CBP0.840.950.960.840.880.950.330.82
ReDO0.830.720.980.870.850.670.740.80
L2 Reg.0.820.800.950.830.880.950.970.80
L2 Init0.830.910.970.830.880.960.980.83
S&P0.830.920.970.850.880.960.970.81
Layer Norm.0.690.140.960.820.660.110.960.58
+ +Table 1: Average accuracy on the last ${10}\%$ of tasks on the benchmark continual learning problems over 5 seeds. Standard deviations are provided in the extended Table 6. + +Table 1 shows that across all four problems (PM, RM, RC, CI) and both SGD and Adam, SNR consistently attains the largest average accuracy on the final $10\%$ of tasks. For each competitor algorithm there is at least one problem on which SNR attains superior accuracy by at least 5 percentage points with SGD and at least 2 percentage points with Adam. We also see that there is no consistent second-best algorithm with the SGD optimizer while L2 Init is consistently the second-best with the Adam optimizer. + +Another notable property of SNR is its robustness to the choice of rejection percentile threshold. In contrast, its competitors are not robust to the choice of their hyperparameter(s). On all but RM with SGD, SNR experiences a decrease of at most 2 percentage points in average accuracy when varying its rejection percentile threshold across the range of optimal thresholds found across experiments. On the other hand, increasing the hyperparameter strength by a single order of magnitude, as is common in a hyperparameter sweep, from the optimal value for L2 Init, S&P, and CBP results in a decrease in average accuracy by at least 72 percentage points. See Appendix C for detailed tables. + +Next, we turn our attention to the Permuted Shakespeare problem. For the no intervention network with Adam, we see dramatic plasticity loss, as the average loss increases from about 0.15 on the first few tasks to 3.0242 on the last 50 tasks; see Figure 2. In Figure 4 and Figure 3 we see that this plasticity loss is correlated with increasing weight norms in the self-attention and feedforward layers, persistent neuron inactivity, and a collapse in the entropy of the self-attention probabilities. + +![](images/7678ce13ffbe40c10c1089cdec825a6f867ddc8dfe694670a13ab28f38748fd0.jpg) +Figure 2: Cumulative average of the loss measured on the final epoch of each task on the Permuted Shakespeare problem. Right panel zooms in to L2 and $\mathrm{SNR} + \mathrm{L2}$ + +![](images/ec01857b2fc5be9bae39f0aa9b6c9d399159d5485eac2106e7e58175600a87d9.jpg) + +
AlgorithmAll TasksFirst 50 TasksLast 50 Tasks
L20.2762(0.0309)0.1560(0.0236)0.3101(0.0425)
SNR+L20.2177(0.0196)0.1370(0.0169)0.2551(0.0454)
No Intv.2.7397(0.0140)1.8164(0.0295)3.0147(0.0250)
L2 Init1.5052(0.0437)1.2931(0.0486)1.5262(0.0420)
SNR2.6872(0.0222)1.7338(0.0295)3.0242(0.0408)
CBP2.4922(0.0171)1.3732(0.0234)2.9410(0.0188)
L2*0.1506(0.0279)0.1874(0.0348)0.1092(0.0429)
SNR+L2*0.1402(0.0246)0.1549(0.0107)0.0909(0.0177)
ReDO2.3258(0.0356)1.3689(0.0686)2.8119(0.0373)
+ +Table 2: Average loss measured on the final epoch of each task with standard deviations over 9 seeds on the Permuted Shakespeare problem. Note, L2* denotes L2 regularization applied only to the attention weights. + +We see that resets are by themselves insufficient in mitigating plasticity loss, providing at most a marginal improvement over no intervention. This is unsurprising since neurons are only present in the feedforward layers, unlike the MLP and CNN architectures in the earlier experiments. As such, regularization appears necessary and we see that, over the last 50 tasks, L2 regularization attains an average loss of 0.3101 in contrast to 3.0147 and 3.0242 for no intervention and SNR. This improvement in performance coincides with stable weight norms and non-vanishing average entropy of self-attention probabilities for L2 regularization. In contrast to the earlier problems, L2 Init fares worse than L2 regularization and experiences substantial loss of plasticity, although to a lesser extent than the no intervention network. + +While L2 regularization addresses weight blowup, neuron death remains present; see Figure 3. The average loss with L2 increases from 0.1560, over the first 50 tasks, to 0.3101, over the final 50 tasks. This prompts us to consider using SNR in addition to L2 regularization. This largely eliminates neuron death (see the right panel of Figure 3), while stabilizing weight norms and maintaining entropy of self-attention probabilities, providing the lowest loss (0.2551) over the final 50 tasks. As an ablation, we evaluate performance when applying L2 regularization only to the attention weights, which we denote by $\mathrm{L2^{*}}$ and $\mathrm{SNR + L2^{*}}$ in Table 2. + +![](images/f7dc59d404fd7edfab0c7668d628b071cf89d3344b2f84e4be3e051bc224b7d1.jpg) +Figure 3: Number of inactive neurons for 5 consecutive training steps on the PS experiment. + +![](images/5b36cd265ddce428fb2b86b2c613f26d9150164e1cd9f894e7e90df01de274b1.jpg) + +![](images/4ab910ffe736ccbd8441ed4e4b62a3094d9add9cbd2c40aa1b08ec76e0b25fd3.jpg) +Figure 4: Parameter norms and attention-score entropy on the Permuted Shakespeare experiment. + +![](images/1df8835930e2bea7d7a7a1b48e23e8b20a5fca9ae31346639a9d11701a22c77f.jpg) + +![](images/0cbbf45f713fbcbb2020e6963e66b29730cfbfda110d7b82fe8dcc8921e525cf.jpg) + +![](images/d0132ac93d9b130328f22dd0a4a72ac7569649a422a5cf82b4cb31454d91cf6e.jpg) + +# 3.2.1 SCALED PERMUTED SHAKESPEARE + +While the scale of our Permuted Shakespeare problem serves as a simple benchmark problem for evaluating a series of continual learning algorithms and hyperparameter choices for language models, it is also of interest to investigate the effect of model and dataset scale on plasticity. To this end, we scale the number of non-embedding weights in our transformer network by a factor of $N = 16$ , increasing the number of heads to 8 and number of neurons to 1024. In line with scaling laws (Kaplan et al., 2020), we increase the size of our dataset by a factor of $16^{0.74}$ , specifically to 254'976 tokens per task. The rest of the problem setup remains unchanged; we train the network for 100 epochs on 500 tasks in sequence. To facilitate the larger token count, we train on a sample of 254'976 tokens worth of text from the complete set of plays by William Shakespeare. + +We limit our experiment to 4 random seeds, scales 1 and 16, evaluating only $\mathrm{SNR + L2}$ and L2 with hyperparameters $\eta = 0.05$ and $\lambda = 10^{-4}$ , presenting our results in Table 3. We first note that as model and dataset size grow, the gap in average loss between L2-regularization and $\mathrm{SNR + L2}$ -regularization grows substantially. Simultaneously, we see a dramatic increase in the proportion of inactive neurons with L2-regularization. At any time step, on average $0.06\%$ of neurons are inactive at scale $N = 1$ while $32.9\%$ are inactive at scale $N = 16$ . These results suggest that resets can play a critical role in maintaining plasticity in large-scale language models. See Appendix A which shows a scale 256 experiment, but run only up to 50 tasks, showing similar merits. + +
AlgorithmLoss (All Tasks)Loss (Last 50 Tasks)Dead Neuron Rate
L2 - Scale 10.159(0.025)0.152(0.016)0.06%
SNR+L2 - Scale 10.154(0.008)0.141(0.031)0.00%
L2 - Scale 160.377(0.016)0.410(0.052)32.9%
SNR+L2 - Scale 160.324(0.028)0.332(0.073)1.41 · 10-6%
+ +Table 3: Average loss on the final epoch of each task for the scaled Permuted Shakespeare experiments, with means and standard deviations reported over 4 seeds. + +# 3.2.2 GENERALIZATION + +Lee et al. (2024) recently propose separating training loss from test loss in studying plasticity; the extant literature and the present work focuses largely on measuring training loss on each task. As a complement, we briefly consider measuring test loss on a holdout set for each task. We consider three setups: first, we consider the PM problem, and measure test loss on a set of 10000 image label-pairs for each task; we annotate this setup PM-G1. Our second setup is a modification of PM-G1: in each task we add noise to the labels by randomly re-labeling a fraction of the training images. We decrease the fraction of images with noisy labels from $50\%$ on the first task to 0 on the last; we annotate this task PM-G2. Finally in analogy to PM-G2, we consider a variant of the RC problem (RC-G1) where we decay the fraction of random labels from $50\%$ to 0 linearly across tasks. PM-G2 and RC-G1 are analogous to the setup in Lee et al. (2024). + +Detailed results of these experiments are presented in Appendix A.2; we draw the following conclusions: first, SNR displays similar relative merits to competing algorithms as in our main body of experiments on training loss. Second, through a careful study of variants of the setup in PM-G2 where we alter the number of passes through the dataset relevant to each task, we point out an important issue that requires careful attention if one is to study test loss: specifically, confounding the effects of overfitting with plasticity loss. + +# 4 THEORETICAL ANALYSIS OF LEARNING A SINGLE RELU + +One common hypothesis that seeks to explain plasticity loss is that the network weights obtained from minimizing loss over some task yield poor initializations for a subsequent task; these initializations effectively lead to poor local minima. This section attempts to make this effect transparent through the analysis of the simplest non-trivial task: learning a single ReLU. Vardi et al. (2021) have already established that for random initializations a ReLU can be efficiently learned. Here we ask what happens when the initialization is picked adversarially; one can think of this adversarial initialization as corresponding to optimal weights for an earlier ReLU learning task. + +Theorem 4.1. [Informal restatement of Theorems E.2 and E.1] There exists a general class of target ReLUs, a distribution over example inputs, and a distribution over initial weights for which: + +- Gradient descent with L2 Init or L2 regularization fail to learn the target ReLU with positive probability with respect to the distribution over initial weights. Specifically the average expected MSE exceeds a positive constant as the number of training examples $T$ grows with a probability bounded from below by a positive constant. +- Gradient descent with oracle resets achieves an average expected MSE of $O(1 / T)$ with probability one. + +The oracle resets in the second result above effectively know precisely whether or not a neuron will or will not fire over the input distribution and are in this sense oracular. Reset methods must come as close as possible to mimicking such an oracle; Propositions 2.1 and 2.2 make the case for why SNR might be a good such candidate and why competing reset proposals may fall short. See Appendix E for a formal setup, statement of results, and proofs. + +# 5 DISCUSSION AND LIMITATIONS + +A common explanation for plasticity loss is that the network weights obtained from minimizing loss over some task yield poor initializations for a subsequent task – this explanation continues to motivate the vast majority of algorithms that attempt to combat plasticity loss. Specifically, regularization based algorithms can be viewed as regularizing towards a 'good' initial set of weights, whereas reset based algorithms can be viewed as explicitly reinitializing weights to good random initializations. + +Theoretical Motivation: Our theoretical development showed that regularization methods themselves are insufficient at combatting the plasticity loss problem, at least in the case of learning RLUs (Theorem 4.1). Further we showed that existing proposals to detect whether it was appropriate to reset a ReLU (based on ad hoc notions of a neuron's utility) could have high type 1 error rates relative to an optimal resetting mechanism (Proposition 2.2). SNR was designed to minimize the error rate in solving this detection problem (Proposition 2.1). + +SOTA Performance: Across a range of experiments we see that neuron inactivity is an important correlate of plasticity loss, and that SNR consistently outperforms other reset based methods as well as regularization methods (Table 1, Figure 2). We also observed that SNR was robust to its hyperparameters while the adhoc utility schemes employed by other reset methods tended to make them somewhat brittle (Appendix C). Finally, the extant literature has focused on measuring plasticity loss through the lens of training loss, but it is also natural to ask about test loss. We see that SNR enjoys similar relative merits in this context as well (Table 5), but one has to be careful to not confound issues of overfitting with plasticity loss (Figure 6). + +Attention Mechanisms: Whereas neuron death is an important correlate of plasticity loss, in the case of language models, a crucial component of the architecture – the attention mechanism – does not involve neurons so that the notion of resetting is irrelevant to that component. We have shown that plasticity loss occurs nonetheless and that it is associated with a collapse in the entropy of the attention layer along with neuron death in the feedforward layers (Figures 3 and 4). As such, we see that combining our resets along with L2 regularization of the attention mechanism is important to preserve plasticity (Table 2). Language models also give us a natural substrate to consider the plasticity loss phenomenon vis-a-vis scaling laws, and we see similar relative merits across several orders of magnitude of model scales (Table 3, Appendix 4). + +Limitations: We recognize a few limitations in the present work. First, whereas we have shown the plasticity loss phenomenon over several orders of model scale our largest models have up to 5M parameters. This is large in the context of the literature on plasticity loss but small in a practical sense. We believe that overcoming this requires understanding ways of exploring this phenomenon without the brute force effort of feeding a model a large sequence of tasks (which is fundamentally serial and hard to accelerate). A second limitation is the theoretical characterization of the phenomenon itself; the approach in the literature has been largely phenomenological – fixing conjectured root causes for what is really an increase in dynamic regret over time. While Section 4 took a first step, future work ought to connect the plasticity loss phenomenon tightly with the optimization landscape. + +# REFERENCES + +Alessandro Achille, Matteo Rovere, and Stefano Soatto. Critical learning periods in deep neural networks. arXiv preprint arXiv:1711.08856, 2017. +Jordan Ash and Ryan P Adams. On warm-starting neural network training. Advances in neural information processing systems, 33:3884-3894, 2020. +Dylan R Ashley, Sina Ghiassian, and Richard S Sutton. Does the adam optimizer exacerbate catastrophic forgetting? arXiv preprint arXiv:2102.07686, 2021. +Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E Hinton. Layer normalization. arXiv preprint arXiv:1607.06450, 2016. +Omar Besbes and Assaf Zeevi. On the minimax complexity of pricing in a changing environment. Operations research, 59(1):66-79, 2011. +Patryk Chrabaszcz, Ilya Loshchilov, and Frank Hutter. A downsampled variant of imagenet as an alternative to the CIFar datasets. arXiv preprint arXiv:1707.08819, 2017. +Shibhansh Dohare, Richard S Sutton, and A Rupam Mahmood. Continual backprop: Stochastic gradient descent with persistent randomness. arXiv preprint arXiv:2108.06325, 2021. +Shibhansh Dohare, J Fernando Hernandez-Garcia, Parash Rahman, Richard S Sutton, and A Rupam Mahmood. Maintaining plasticity in deep continual learning. arXiv preprint arXiv:2306.13812, 2023. +Shibhansh Dohare, J Fernando Hernandez-Garcia, Qingfeng Lan, Parash Rahman, A Rupam Mahmood, and Richard S Sutton. Loss of plasticity in deep continual learning. Nature, 632(8026): 768-774, 2024. +Xavier Glorot and Yoshua Bengio. Understanding the difficulty of training deep feedforward neural networks. In Proceedings of the thirteenth international conference on artificial intelligence and statistics, pp. 249-256. JMLR Workshop and Conference Proceedings, 2010. +Ian J Goodfellow, Mehdi Mirza, Da Xiao, Aaron Courville, and Yoshua Bengio. An empirical investigation of catastrophic forgetting in gradient-based neural networks. arXiv preprint arXiv:1312.6211, 2013. +Adam Ibrahim, Benjamin Thérien, Kshitij Gupta, Mats L Richter, Quentin Anthony, Timothee Lesort, Eugene Belilovsky, and Irina Rish. Simple and scalable strategies to continually pre-train large language models. arXiv preprint arXiv:2403.08763, 2024. +Jared Kaplan, Sam McCandlish, Tom Henighan, Tom B Brown, Benjamin Chess, Rewon Child, Scott Gray, Alec Radford, Jeffrey Wu, and Dario Amodei. Scaling laws for neural language models. arXiv preprint arXiv:2001.08361, 2020. +James Kirkpatrick, Razvan Pascanu, Neil Rabinowitz, Joel Veness, Guillaume Desjardins, Andrei A Rusu, Kieran Milan, John Quan, Tiago Ramalho, Agnieszka Grabska-Barwinska, et al. Overcoming catastrophic forgetting in neural networks. Proceedings of the national academy of sciences, 114(13):3521-3526, 2017. +Aviral Kumar, Rishabh Agarwal, Dibya Ghosh, and Sergey Levine. Implicit under-parameterization inhibits data-efficient deep reinforcement learning. arXiv preprint arXiv:2010.14498, 2020. +Saurabh Kumar, Henrik Marklund, Ashish Rao, Yifan Zhu, Hong Jun Jeon, Yueyang Liu, and Benjamin Van Roy. Continual learning as computationally constrained reinforcement learning. arXiv preprint arXiv:2307.04345, 2023a. +Saurabh Kumar, Henrik Marklund, and Benjamin Van Roy. Maintaining plasticity via regenerative regularization. arXiv preprint arXiv:2308.11958, 2023b. +Hojoon Lee, Hyeonseo Cho, Hyunseung Kim, Donghu Kim, Dugki Min, Jaegul Choo, and Clare Lyle. Slow and steady wins the race: Maintaining plasticity with hare and tortoise networks. In *Forty-first International Conference on Machine Learning*, 2024. + +Alex Lewandowski, Haruto Tanaka, Dale Schuurmans, and Marlos C Machado. Curvature explains loss of plasticity. arXiv preprint arXiv:2312.00246, 2023. +Clare Lyle, Mark Rowland, and Will Dabney. Understanding and preventing capacity loss in reinforcement learning. arXiv preprint arXiv:2204.09560, 2022. +Clare Lyle, Zeyu Zheng, Evgenii Nikishin, Bernardo Avila Pires, Razvan Pascanu, and Will Dabney. Understanding plasticity in neural networks. In International Conference on Machine Learning, pp. 23190-23211. PMLR, 2023. +Clare Lyle, Zeyu Zheng, Khimya Khetarpal, Hado van Hasselt, Razvan Pascanu, James Martens, and Will Dabney. Disentangling the causes of plasticity loss in neural networks. arXiv preprint arXiv:2402.18762, 2024. +Evgenii Nikishin, Max Schwarzer, Pierluca D'Oro, Pierre-Luc Bacon, and Aaron Courville. The primacy bias in deep reinforcement learning. In International conference on machine learning, pp. 16828-16847. PMLR, 2022. +Ghada Sokar, Rishabh Agarwal, Pablo Samuel Castro, and Utku Evci. The dormant neuron phenomenon in deep reinforcement learning. In International Conference on Machine Learning, pp. 32145-32168. PMLR, 2023. +Gal Vardi, Gilad Yehudai, and Ohad Shamir. Learning a single neuron with bias using gradient descent. Advances in Neural Information Processing Systems, 34:28690-28700, 2021. +Tongtong Wu, Linhao Luo, Yuan-Fang Li, Shirui Pan, Thuy-Trang Vu, and Gholamreza Haffari. Continual learning for large language models: A survey. arXiv preprint arXiv:2402.01364, 2024. +Julian Zilly, Alessandro Achille, Andrea Censi, and Emilio Frazzoli. On plasticity, invariance, and mutually frozen weights in sequential task learning. Advances in Neural Information Processing Systems, 34:12386-12399, 2021. + +# A ADDITIONAL EXPERIMENTAL RESULTS + +# A.1 EVEN LARGER SCALE EXPERIMENT FOR PERMUTED SHAKESPEARE + +We increase the scale further for the Permuted Shakespeare experiment from our original model by a factor of 256, resulting in a model with 5.1 million non-embedding parameters; results are in Table 4. In accordance with scaling laws, we simultaneously increase the number of tokens or examples per task by a factors of $256^{0.74}$ , resulting in 1.9 million tokens or 15'500 training examples, with a context window of 128, for the 256-scale model. Due to computational constraints, we reduce the number of tasks from 500 to 50, but keep a training regime of 100 epochs per task. At the largest scale, over the 50 tasks, our model is trained for 100 epochs over 99 million tokens or 775'000 distinct 128-token-long training examples. + +The scale of our largest model is comparable to the scale of the largest transformers considered in recent literature on plasticity loss, namely ViT Tiny (5 million parameters) in Lee et al. (2024). The largest dataset on which Lee et al. (2024) train on is the Tiny Imagenet dataset consisting of 100'000 training examples, on which models are trained for 100 epochs; our largest experiment consists of 775'000 training examples. It is important to consider the scale of datasets used in continual learning experiments as the phenomenon of plasticity loss has been shown to be correlated with the amount of data on which a network trains (Kumar et al., 2023a; Dohare et al., 2021). + +
AlgorithmTrain Loss at Scale 256
SNR+L20.4576(0.0017)
L20.4681(0.0025)
+ +Table 4: Average training loss on the final epoch over all 50 tasks of the 256-scale Permuted Shakespeare problem with standard deviations reported for 5 random seeds. + +![](images/9e1bbdf052303df559f739edb55a87e5d330e4fa6e57f10332317960bb1f476b.jpg) +Figure 5: Cumulative average test accuracy for PM-G1 and PM-G2 experiments. + +![](images/fc94a69f7dc8f1515d222c09edfb41f5ad7b3c7c6512a9f6ec30643ddd488de3.jpg) + +It is important to note that relative to Table 3 where we show plasticity loss for 500 tasks, the above experiment has only been run to 50 tasks (due to computational budget constraints) and already shows a gap between $\mathrm{SNR + L2}$ and L2. + +# A.2 GENERALIZATION RESULTS + +Table 5 shows test loss on the last $10\%$ of tasks for PM-G1, PM-G2 and RC-G1. Figure 5 shows the test accuracy for PM-G1 and PM-G2. We see that SNR enjoys similar relative merits to its competitors in PM-G1 and PM-G2. For RC-G1, it appears that there is no plasticity loss and as such all of the different algorithms perform similarly. Notice that this is not contrary to our observations in RC - there the labels across tasks were entirely unrelated. + +We consider next a slight tweak on RC-G1. Specifically, each task in RC-G1 consists of 16 epochs; what happens if we do more? The bottom three curves of Figure 6 show the results of doing 100 epochs for each task. We see here that test loss for no intervention and SNR begin to suffer. As it turns out this is misleading - specifically, we see that the test accuracy for all three algorithms is significantly below test accuracy when one does only 16 epochs (as reported in Table 5). That is, the decay in test performance is likely attributable to overfitting in each task, and while L2 overfits as well, it is unsurprisingly more resilient. Put a different way, this overfitting can be controlled by the usual tools to combat overfitting. The top three curves of Figure 6 show that SNR performs equivalently to L2 showing that early stopping would accomplish this comfortably in this context. + +
AlgorithmPM-G1PM-G2RC-G1
No Intv.0.8999(0.0041)0.8931(0.0013)0.5526(0.0034)
L2 Init0.9320(0.0037)0.9284(0.0032)N/A
L20.9297(0.0034)0.9258(0.0032)0.5651(0.0023)
S&P0.9313(0.0033)0.9281(0.0027)N/A
ReDO0.9086(0.0028)0.9083(0.0021)N/A
SNR0.9318(0.0001)0.9325(0.0029)0.5650(0.0013)
+ +Table 5: Test accuracy over the last $10\%$ of tasks (mean and standard deviation) for PM-G1, PM-G2, and RC-G1. + +# B COMPLETE RESULTS FOR BENCHMARK PROBLEMS + +To maintain brevity in the main body of the paper, we include here the complete results for the benchmark problems PM, RC, RM, and CI which include both the mean and standard deviation of terminal task accuracies over random seeds. + +![](images/6b24ee939fde902f1a46c92a620106b9a7d8b146f57c033cbcbeed11e53a8ac0.jpg) +Figure 6: Test accuracy for the RC-G1 experiments evaluated with 16 and 100 epochs per task. + +
OptimizerSGD
AlgorithmPMRMRCCI
No Intv.0.710 (0.007)0.113(0.004)0.180 (0.011)0.784 (0.019)
SNR0.851(0.002)0.975 (0.001)0.987 (0.002)0.888 (0.010)
CBP0.844(0.002)0.951 (0.007)0.961 (0.011)0.840 (0.015)
ReDO0.831 (0.013)0.716 (0.024)0.981 (0.003)0.869 (0.038)
L2 Reg.0.818 (0.001)0.803 (0.011)0.952 (0.006)0.833 (0.011)
L2 Init0.829 (0.001)0.913 (0.001)0.966 (0.002)0.832 (0.010)
S&P0.826 (0.002)0.920 (0.009)0.971 (0.004)0.853 (0.006)
Layer Norm.0.687 (0.009)0.143 (0.015)0.959 (0.005)0.819 (0.009)
OptimizerAdam
AlgorithmPMRMRCCI
No Intv.0.641 (0.007)0.114 (0.005)0.151 (0.005)0.581 (0.081)
SNR0.889(0.001)0.982(0.001)0.976 (0.002)0.847 (0.005)
CBP0.876 (0.001)0.948 (0.003)0.331 (0.312)0.818 (0.005)
ReDO0.846 (0.002)0.671 (0.021)0.744 (0.131)0.803 (0.063)
L2 Reg.0.876(0.002)0.948 (0.002)0.967 (0.011)0.803 (0.009)
L2 Init0.883 (0.002)0.961 (0.003)0.976 (0.002)0.827 (0.008)
S&P0.876 (0.002)0.955 (0.006)0.971 (0.005)0.814 (0.005)
Layer Norm.0.662 (0.001)0.113 (0.005)0.955 (0.005)0.651 (0.053)
+ +Table 6: Average accuracy on the last $10\%$ of tasks on the benchmark continual learning problems with standard deviations over 5 seeds. + +# C ADDITIONAL EXPERIMENTAL DETAILS AND HYPERPARAMETER SWEEP + +With SGD we train with learning rate $10^{-2}$ on all problems except Random Label MNIST, for which we train with learning rate $10^{-1}$ . With Adam we train with learning rate $10^{-3}$ on all problems, including Permuted Shakespeare and we use the standard parameters of $\beta_{1} = 0.9$ , $\beta_{2} = 0.999$ , and $\epsilon = 10^{-7}$ . For Permuted Shakespeare we train our networks solely with Adam. The learning rates were selected after an initial hyperparameter sweep. + +For each algorithm we vary its hyperparameter(s) by an appropriate constant over 7 choices, effectively varying the hyperparameters over a log scale. With the exception of the Permuted Shakespeare experiment, we limit over hyperparameter search to 5 choices. In Table 7 we provide the hyperparameter sweep for the 4 benchmark problems. CBP's replacement rate $r$ is to be interpreted as one replacement per layer every $r^{-1}$ training examples, as presented in Dohare et al. (2024). ReDO's reset frequency $r$ determines the frequency of resets in units of tasks, as implemented and evaluated in Kumar et al. (2023b). + +Hyperparameter Strength + +
Algorithm0123456
L2 Reg. (λ)10-610-510-410-310-210-1100
L2 Init (λ)10-610-510-410-310-210-1100
S&P (1-p)10-810-710-610-510-410-310-2
S&P (σ)10-610-510-410-310-210-1100
CBP (r)10-710-610-510-410-310-210-1
ReDO (τ)00.010.020.040.080.160.32
ReDO (r)6432168421
SNR (η)0.080.040.020.010.0050.00250.00125
+ +Table 7: Hyperparameter sweep for the Permuted MNIST (PM), Random Label MNIST (RM), Random Label CIFAR (RC), and Continual ImageNet (CI) problems. +Hyperparameter Strength + +
Algorithm01234
L2 Reg. (λ)10-610-510-410-310-2
L2 Init (λ)10-610-510-410-310-2
SNR (η)0.10.050.030.010.001
SNR + L2 Reg (η)0.10.050.030.010.001
+ +Table 8: Hyperparameter sweep for the Permuted Shakespeare problem. For the combination of SNR and L2 regularization we use the regularization strength of $10^{-4}$ , the best performing regularization strength for L2 regularization, and vary the rejection percentile threshold $\eta$ +Hyperparameter Strength + +
Algorithm01234
L2 Reg. (λ)1.2840.8830.3480.8534.269
(0.037)(0.059)(0.093)(0.061)(0.013)
L2 Init (λ)1.7911.4811.6412.4295.598
(0.056)(0.050)(0.067)(0.124)(0.030)
SNR (η)3.0343.0243.0123.0273.025
(0.022)(0.041)(0.025)(0.029)(0.045)
SNR + L2 Reg (η)0.3150.2760.3250.2930.269
(0.084)(0.078)(0.068)(0.065)(0.025)
+ +Table 9: Average loss of the final epoch of each task in Permuted Shakespeare, averaged over the final 50 tasks, reported as mean (standard deviation) over 5 random seeds. + +![](images/f63cb4b11909e1722288fb47f75c80d620aca77e0dbfc0cd95b18d7d25ba4199.jpg) +Figure 7: Permuted MNIST hyperparameter sweep results over 5 seeds. + +![](images/0c64a2936533f4919fa6c89ca0965839ae6ac2055bdfd1fb26a0ca3e6efc2560.jpg) + +![](images/ca80d836ffe21d8c77a9a40f148b1626443fd8f22a4cf17781a026b6bbc45dbf.jpg) +Figure 8: Random Label MNIST hyperparameter sweep result over 5 seeds. + +![](images/b1b9eced2c65620d7244ba6f01d19c0fc9f9e9b1f9ffe920818f5d678c774d16.jpg) + +![](images/13fc764f7f406531f40912c438a7c3268d9e494dd2f02e058bfb9ebc34451946.jpg) +Figure 9: Random Label CIFAR hyperparameter sweep results over 5 seeds. + +![](images/d1d39b8bab56f121f375e3f4ed1dc3de488c7ab373be4952228252db7176ae54.jpg) + +![](images/95f9c3cb2f057f2cbf9243d9745f99c6d3883bb56cb7ea00e7cb18411a9f22f4.jpg) +Figure 10: Continual ImageNet hyperparameter sweep results over 5 seeds. + +![](images/797c91c22fc8a7fbf8b95f44e949d09ea1845821e48bd32f18da535450230e67.jpg) + +
Hyperparameter Strength Log Scale
Algorithm0123456
SNR (η)0.8490.8490.8480.8470.8500.8480.847
(0.002)(0.003)(0.003)(0.004)(0.002)(0.002)(0.002)
L2 Init (λ)0.7160.7310.7900.8270.8240.7580.288
(0.001)(0.001)(0.001)(0.002)(0.001)(0.001)(0.017)
L2 Reg. (λ)0.7130.7290.7870.8160.7900.1100.104
(0.002)(0.002)(0.001)(0.002)(0.003)(0.003)(0.002)
S&P (1-p)0.7090.7160.7700.8260.8040.6150.106
(0.001)(0.002)(0.001)(0.002)(0.004)(0.001)(0.003)
S&P (σ)0.8230.8230.8250.8260.7840.1100.110
(0.001)(0.002)(0.002)(0.002)(0.002)(0.002)(0.002)
ReDO (τ)0.7100.8320.8170.7420.7430.7430.743
(0.007)(0.001)(0.011)(0.018)(0.018)(0.018)(0.018)
ReDO (r)0.8150.8240.8300.8320.8190.8080.778
(0.004)(0.002)(0.001)(0.001)(0.005)(0.006)(0.013)
CBP (r)0.7260.7630.8230.8430.8440.6480.655
(0.006)(0.002)(0.002)(0.001)(0.002)(0.000)(0.000)
Layer Norm0.6890.6890.6890.6890.6890.6890.689
(0.003)(0.003)(0.003)(0.003)(0.003)(0.003)(0.003)
SGD0.7100.7100.7100.7100.7100.7100.710
(0.007)(0.007)(0.007)(0.007)(0.007)(0.007)(0.007)
+ +Table 10: Performance on Permuted MNIST with different hyperparameters reported as mean (standard deviation). + +
Hyperparameter Strength Log Scale
Algorithm0123456
SNR (η)0.8870.8850.8800.8760.8720.8670.872
(0.002)(0.001)(0.002)(0.002)(0.001)(0.002)(0.012)
L2 Init (λ)0.7900.8370.8640.8840.8700.7840.276
(0.001)(0.002)(0.002)(0.002)(0.002)(0.001)(0.008)
L2 Reg. (λ)0.7920.8370.8580.8780.8590.3650.103
(0.002)(0.002)(0.002)(0.002)(0.004)(0.008)(0.002)
S&P (1-p)0.6380.8580.8770.8760.7680.1050.102
(0.005)(0.002)(0.002)(0.002)(0.001)(0.003)(0.001)
S&P (σ)0.8740.8750.8750.8770.8770.5830.115
(0.002)(0.002)(0.002)(0.002)(0.002)(0.003)(0.001)
ReDO (τ)0.6360.8460.8470.8470.8470.8470.847
(0.009)(0.002)(0.001)(0.001)(0.001)(0.001)(0.001)
ReDO (r)0.8300.8370.8420.8450.8470.8410.825
(0.004)(0.002)(0.002)(0.002)(0.001)(0.001)(0.001)
CBP (r)0.7230.7730.8170.8570.8760.7330.720
(0.012)(0.004)(0.002)(0.002)(0.002)(0.001)(0.008)
Layer Norm0.6610.6610.6610.6610.6610.6610.661
(0.001)(0.001)(0.001)(0.001)(0.001)(0.001)(0.001)
Adam0.6360.6360.6360.6360.6360.6360.636
(0.009)(0.009)(0.009)(0.009)(0.009)(0.009)(0.009)
+ +Table 11: Performance on Permuted MNIST with different hyperparameters reported as mean (standard deviation). + +
Hyperparameter Strength Log Scale
Algorithm0123456
SNR (η)0.9750.9750.9740.9740.9740.9730.973
(0.001)(0.001)(0.000)(0.000)(0.001)(0.001)(0.001)
L2 Init (λ)0.1150.1140.1810.8810.9120.1910.101
(0.006)(0.009)(0.027)(0.017)(0.006)(0.008)(0.010)
L2 Reg. (λ)0.1150.1150.1150.1260.8010.1130.108
(0.006)(0.006)(0.006)(0.013)(0.010)(0.007)(0.009)
S&P (1-p)0.1120.1610.1380.5500.9240.1140.109
(0.008)(0.009)(0.008)(0.023)(0.003)(0.006)(0.009)
S&P (σ)0.9170.9130.9100.9190.9240.1810.116
(0.005)(0.004)(0.007)(0.004)(0.003)(0.005)(0.006)
ReDO (τ)0.1150.6000.6420.7190.7050.7050.705
(0.006)(0.023)(0.030)(0.021)(0.021)(0.021)(0.021)
ReDO (r)0.1110.1110.1090.1160.1170.2330.719
(0.008)(0.008)(0.008)(0.019)(0.019)(0.022)(0.021)
CBP (r)0.3890.9310.9450.9530.9290.1150.115
(0.031)(0.051)(0.012)(0.005)(0.002)(0.006)(0.006)
Layer Norm0.1450.1450.1450.1450.1450.1450.145
(0.013)(0.013)(0.013)(0.013)(0.013)(0.013)(0.013)
SGD0.1150.1150.1150.1150.1150.1150.115
(0.006)(0.006)(0.006)(0.006)(0.006)(0.006)(0.006)
+ +Table 12: Performance on Random Label MNIST with different hyperparameters reported as mean (standard deviation). + +
Hyperparameter Strength Log Scale
Algorithm0123456
SNR (η)0.9790.9810.9790.9780.9760.9690.966
(0.001)(0.001)(0.002)(0.001)(0.002)(0.001)(0.003)
L2 Init (λ)0.3120.9290.9580.9600.9050.1140.098
(0.050)(0.011)(0.007)(0.001)(0.003)(0.004)(0.009)
L2 Reg. (λ)0.2430.9180.9460.9440.5060.1130.107
(0.038)(0.008)(0.009)(0.004)(0.043)(0.007)(0.009)
S&P (1-p)0.1150.9550.9460.9310.1140.1090.102
(0.006)(0.004)(0.008)(0.005)(0.006)(0.009)(0.004)
S&P (σ)0.9450.9410.9420.9430.9550.2430.121
(0.009)(0.009)(0.007)(0.013)(0.004)(0.015)(0.006)
ReDO (τ)0.1150.3060.3810.5530.6700.5880.588
(0.006)(0.017)(0.023)(0.028)(0.019)(0.031)(0.031)
ReDO (r)0.1150.1150.1200.1090.1120.1220.670
(0.006)(0.006)(0.009)(0.008)(0.008)(0.028)(0.019)
CBP (r)0.1240.1990.4820.9220.9490.1150.115
(0.030)(0.055)(0.077)(0.007)(0.004)(0.006)(0.006)
Layer Norm0.1150.1150.1150.1150.1150.1150.115
(0.006)(0.006)(0.006)(0.006)(0.006)(0.006)(0.006)
Adam0.1150.1150.1150.1150.1150.1150.115
(0.006)(0.006)(0.006)(0.006)(0.006)(0.006)(0.005)
+ +Table 13: Performance on Random Label MNIST with different hyperparameters reported as mean (standard deviation). + +
Hyperparameter Strength Log Scale
Algorithm0123456
SNR (η)0.8870.8880.8930.8860.8860.8860.886
(0.009)(0.007)(0.006)(0.004)(0.004)(0.004)(0.004)
L2 Init (λ)0.7810.7800.8270.8310.7220.6460.573
(0.028)(0.016)(0.011)(0.008)(0.014)(0.014)(0.018)
L2 Reg. (λ)0.7750.8000.8330.8190.4880.4880.491
(0.010)(0.013)(0.012)(0.007)(0.000)(0.000)(0.001)
S&P (1-p)0.7780.7840.7520.8150.8530.4880.488
(0.023)(0.024)(0.073)(0.010)(0.008)(0.000)(0.000)
S&P (σ)0.8480.8390.8490.8530.8440.4970.500
(0.002)(0.010)(0.008)(0.008)(0.010)(0.005)(0.000)
ReDO (τ)0.7850.8560.8700.8430.7210.7270.726
(0.024)(0.012)(0.010)(0.015)(0.041)(0.043)(0.040)
ReDO (r)0.8270.8240.8440.8700.8670.8640.836
(0.027)(0.038)(0.029)(0.010)(0.016)(0.011)(0.009)
CBP (r)0.7770.7910.7920.8370.8400.4880.488
(0.022)(0.016)(0.013)(0.012)(0.008)(0.000)(0.000)
Layer Norm0.8180.8180.8180.8180.8180.8180.818
(0.011)(0.011)(0.011)(0.011)(0.011)(0.011)(0.011)
SGD0.7850.7850.7850.7850.7850.7850.785
(0.024)(0.024)(0.024)(0.024)(0.024)(0.024)(0.024)
+ +Table 14: Performance on Continual ImageNet with different hyperparameters reported as mean (standard deviation). + +
Hyperparameter Strength Log Scale
Algorithm0123456
SNR (η)0.8400.8400.8390.8390.8400.8400.840
(0.002)(0.005)(0.006)(0.006)(0.006)(0.006)(0.006)
L2 Init (λ)0.7030.7670.8140.8260.8190.7570.640
(0.052)(0.025)(0.005)(0.009)(0.005)(0.011)(0.014)
L2 Reg. (λ)0.7670.7910.8020.7970.7490.4920.492
(0.018)(0.013)(0.012)(0.009)(0.021)(0.001)(0.000)
S&P (1-p)0.5060.8130.8110.7870.4920.4920.492
(0.025)(0.010)(0.008)(0.008)(0.001)(0.000)(0.000)
S&P (σ)0.8060.8070.8040.8030.8130.4940.500
(0.012)(0.004)(0.011)(0.007)(0.010)(0.000)(0.001)
ReDO (τ)0.5820.8020.6100.7300.7250.7320.730
(0.075)(0.018)(0.120)(0.012)(0.016)(0.016)(0.013)
ReDO (r)0.7630.7750.7880.7960.8010.8020.790
(0.033)(0.018)(0.013)(0.007)(0.008)(0.018)(0.006)
CBP (r)0.5620.7470.7700.8020.8190.6770.712
(0.087)(0.032)(0.014)(0.004)(0.003)(0.092)(0.039)
Layer Norm0.7090.7090.7090.7090.7090.7090.709
(0.014)(0.014)(0.014)(0.014)(0.014)(0.014)(0.014)
Adam0.5820.5820.5820.5820.5820.5820.582
(0.075)(0.075)(0.075)(0.075)(0.075)(0.075)(0.075)
+ +Table 15: Performance on Continual ImageNet with different hyperparameters reported as mean (standard deviation). + +
Hyperparameter Strength Log Scale
Algorithm0123456
SNR (η)0.9750.9740.9690.9730.9700.9710.973
(0.003)(0.001)(0.006)(0.004)(0.004)(0.004)(0.002)
L2 Init (λ)0.3130.3660.8180.9770.9790.9660.141
(0.076)(0.096)(0.165)(0.005)(0.003)(0.004)(0.006)
L2 Reg. (λ)0.2210.2370.3420.9570.9680.1480.149
(0.049)(0.029)(0.035)(0.012)(0.002)(0.004)(0.004)
S&P (1-p)0.1480.3910.8370.9720.1470.1490.147
(0.004)(0.228)(0.170)(0.002)(0.005)(0.004)(0.005)
S&P (σ)0.9710.9720.9710.9670.9660.5700.148
(0.004)(0.002)(0.002)(0.009)(0.004)(0.039)(0.008)
ReDO (τ)0.1480.2070.3140.2090.6870.5940.741
(0.004)(0.115)(0.330)(0.079)(0.125)(0.089)(0.128)
ReDO (r)0.1480.1700.1690.2050.4070.6370.741
(0.004)(0.044)(0.045)(0.077)(0.165)(0.155)(0.128)
CBP (r)0.1480.1470.3300.1680.3260.1460.148
(0.004)(0.007)(0.302)(0.026)(0.074)(0.006)(0.004)
Layer Norm0.9580.9580.9580.9580.9580.9580.958
(0.006)(0.006)(0.006)(0.006)(0.006)(0.006)(0.006)
Adam0.1480.1480.1480.1480.1480.1480.148
(0.004)(0.004)(0.004)(0.004)(0.004)(0.004)(0.004)
+ +Table 16: Performance on Random Label CIFAR with different hyperparameters reported as mean (standard deviation). + +
Hyperparameter Strength Log Scale
Algorithm0123456
SNR (η)0.9870.8360.8980.8080.8480.9410.829
(0.002)(0.242)(0.112)(0.124)(0.183)(0.064)(0.173)
L2 Init (λ)0.2070.1820.2680.5940.9680.9430.156
(0.040)(0.012)(0.068)(0.135)(0.004)(0.007)(0.005)
L2 Reg. (λ)0.1820.1870.2610.3930.9510.1460.148
(0.012)(0.024)(0.097)(0.265)(0.005)(0.004)(0.004)
S&P (1-p)0.1550.1580.1650.3410.9730.1450.148
(0.005)(0.007)(0.009)(0.081)(0.003)(0.005)(0.004)
S&P (σ)0.9510.9600.9630.9650.9730.1850.100
(0.007)(0.006)(0.004)(0.003)(0.003)(0.068)(0.014)
ReDO (τ)0.1840.9420.9840.9750.9620.8410.840
(0.013)(0.054)(0.004)(0.020)(0.038)(0.039)(0.057)
ReDO (r)0.2070.1990.1600.3770.8900.9840.980
(0.057)(0.067)(0.025)(0.220)(0.121)(0.004)(0.001)
CBP (r)0.1900.1990.2320.5280.9640.1420.142
(0.021)(0.024)(0.058)(0.266)(0.012)(0.006)(0.006)
Layer Norm0.9580.9580.9580.9580.9580.9580.958
(0.008)(0.008)(0.008)(0.008)(0.008)(0.008)(0.008)
SGD0.1840.1840.1840.1840.1840.1840.184
(0.013)(0.013)(0.013)(0.013)(0.013)(0.013)(0.013)
+ +Table 17: Performance on Random Label CIFAR with different hyperparameters reported as mean (standard deviation). + +# D PROOFS OF PROPOSITION OF 2.1 AND 2.2 + +Proposition D.1 (Restatement of Proposition 2.1). Let $T$ be the $1 - \frac{\lambda}{p - \lambda}$ percentile of a Geometric( $p$ ) distribution. Then the optimal hypothesis test takes the form $X_{\tau} = \mathbf{1}\{Z_{\tau} = 0\}$ where $\tau = \min(s: Z_s = 1) \wedge T$ . + +Proof. We begin by assuming equal priors $\mathbb{P}(H_0) = \mathbb{P}(H_1) = \frac{1}{2}$ . We note that for any time $s$ , if $Z_s = 1$ then any optimal hypothesis test must declare $X_s = 0$ as $Z_s = 1$ is impossible under $H_1$ and waiting to make a future declaration will incur additional cost of at least $\lambda$ . Therefore, it remains for us to derive an optimal stopping time for the collection of states $\{Z_1 = \ldots = Z_s = 0 : s \in \mathbb{Z}_+\}$ . + +Let $V(s)$ be the expected total future cost at time $s$ given that we have observed $Z_{1} = \ldots = Z_{s} = 0$ . We define + +$$ +\begin{array}{l} \pi_ {s} = \mathbb {P} \left(H _ {0} \mid Z _ {1} = \dots = Z _ {s} = 0\right) \\ = \frac {\mathbb {P} (H _ {0} , Z _ {1} = \ldots = Z _ {s} = 0)}{\mathbb {P} (Z _ {1} = \ldots = Z _ {s} = 0)} \\ = \frac {(1 - p) ^ {s} \mathbb {P} (H _ {0})}{(1 - p) ^ {s} \mathbb {P} (H _ {0}) + \mathbb {P} (H _ {1})} \\ = \frac {(1 - p) ^ {s}}{(1 - p) ^ {s} + 1} \quad \text {b y} \mathbb {P} (H _ {0}) = \mathbb {P} (H _ {1}) \\ \end{array} +$$ + +If we stop at time $s$ and make a declaration, we choose the hypothesis with higher positive probability in order to minimize the error probability + +$$ +\mathbb {P} \left(X _ {s} = 1 \mid H _ {0}\right) + \mathbb {P} \left(X _ {s} = 0 \mid H _ {1}\right) +$$ + +Thus, the expected cost of stopping is + +$$ +C ^ {\text {s t o p}} (s) = \min \left\{\pi_ {s}, 1 - \pi_ {s} \right\} +$$ + +We can simplify this further by noting that $\pi_s \leq 1 - \pi_s$ . We note that + +$$ +\frac {1}{2} (1 - p) ^ {s} \leq \frac {1}{2} +$$ + +by $1 - p\in [0,1]$ . This is equivalent to + +$$ +(1 - p) ^ {s} \leq \frac {1}{2} ((1 - p) ^ {s} + 1) +$$ + +by adding $\frac{1}{2} (1 - p)^s$ , which in turn, is equivalent to + +$$ +\pi_ {s} = \frac {(1 - p) ^ {s}}{(1 - p) ^ {s} + 1} \leq \frac {1}{2} +$$ + +Therefore, $\pi_s \leq \frac{1}{2} \leq 1 - \pi_s$ and so we have that + +$$ +C ^ {\mathrm {s t o p}} (s) = \min \left\{\pi_ {s}, 1 - \pi_ {s} \right\} = \pi_ {s} +$$ + +This also implies that if we are to stop at some state $\{Z_1 = \ldots = Z_s = 0\}$ , it is optimal to declare $X_{s} = 1$ . + +If we continue at time $s$ to $s + 1$ , we incur an additional delay cost of $\lambda$ , and the expected future cost depending on whether we see a $Z_{s + 1} = 1$ or $Z_{s + 1} = 0$ . + +- With probability $p\pi_s$ we observe $Z_{s+1}$ , under $H_0$ , and we stop the process with $X_{s+1} = 0$ , incurring zero error cost since $Z_{s+1} = 1$ cannot occur under $H_1$ . +- With probability $(1 - p)\pi_{s} + (1 - \pi) = 1 - p\pi_{s}$ we observe $Z_{s+1} = 0$ and the process continues. + +Therefore, the expected cost of continuing at time $s$ is + +$$ +C ^ {\text {c o n t}} (s) = \lambda + (1 - p \pi_ {s}) V (s + 1) +$$ + +Then the Bellman equation for the optimal cost-to-go function is + +$$ +V (s) = \min \{C ^ {\text {s t o p}} (s), C ^ {\text {c o n t}} (s) \} +$$ + +To determine an optimal stopping time, our goal is to find smallest $T$ for which + +$$ +C ^ {\text {s t o p}} (T) \leq C ^ {\text {c o n t}} (T) \tag {1} +$$ + +Assuming we stop at time $T$ + +$$ +V (T + 1) = C ^ {\text {s t o p}} (T + 1) = \pi_ {T + 1} +$$ + +Therefore, + +$$ +C ^ {\text {c o n t}} (T) = \lambda + \left(1 - p \pi_ {s}\right) V (T + 1) = \lambda + \left(1 - p \pi_ {s}\right) \pi_ {T + 1} +$$ + +and to establish (1) it suffices to show that + +$$ +\pi_ {T} \leq \lambda + (1 - p \pi_ {T}) \pi_ {T + 1} \tag {2} +$$ + +First, we write $\pi_{T + 1}$ in terms of $\pi_T$ . Under the updating rule for the posterior probability, we have that + +$$ +\begin{array}{l} \pi_ {T + 1} - \mathbb {P} (H _ {0} | Z _ {1} = \dots = Z _ {T + 1} = 0) \\ = \frac {\mathbb {P} (Z _ {T + 1} = 0 | H _ {0}) \mathbb {P} (H _ {0} | Z _ {1} = \dots = Z _ {T} = 0)}{\mathbb {P} (Z _ {T + 1} = 0 | Z _ {1} = \dots = Z _ {T} = 0)} \\ = \frac {(1 - p) \pi_ {T}}{\mathbb {P} (Z _ {T + 1} = 0 | H _ {0}) \pi_ {T} + \mathbb {P} (Z _ {T + 1} = 0 | H _ {1}) (1 - \pi_ {T})} \\ = \frac {(1 - p) \pi_ {T}}{(1 - p) \pi_ {T} + (1 - \pi_ {T})} \\ = \frac {(1 - p) \pi_ {T}}{1 - p \pi_ {T}} \\ \end{array} +$$ + +Returning to (2), we need to show that + +$$ +\pi_ {T} \leq \lambda + (1 - p \pi_ {T}) \frac {(1 - p) \pi_ {T}}{1 - p \pi_ {T}} = \lambda + (1 - p) \pi_ {T} +$$ + +Simplifying the above inequality, we have that + +$$ +\pi_ {T} \leq \frac {\lambda}{p} +$$ + +Substituting in our formula for $\pi_T$ , the above is equivalent to + +$$ +\frac {(1 - p) ^ {\top}}{(1 - p) ^ {\top} + 1} \leq \frac {\lambda}{p} +$$ + +which after simplification is equivalent to + +$$ +(1 - p) ^ {\top} \leq \frac {\frac {\lambda}{p}}{1 - \frac {\lambda}{p}} = \frac {\lambda}{p - \lambda} +$$ + +Let $F$ be the CDF of the Geometric $(p)$ distribution. Let $T^{*}$ be the $1 - \frac{\lambda}{p - \lambda}$ percentile of the Geometric $(p)$ distribution. Note, since $\lambda < \frac{p}{2}$ then $1 - \frac{\lambda}{p - \lambda} \in (0, 1)$ and is a valid percentile. Then for any $T \geq T^{*}$ we have that + +$$ +\begin{array}{l} 1 - (1 - p) ^ {\top} = F (T) \\ \geq F \left(T ^ {*}\right) \quad \text {b y} T \geq T ^ {*} \\ \geq 1 - \frac {\lambda}{p - \lambda} \quad \text {b y} \\ \end{array} +$$ + +which is equivalent to + +$$ +(1 - p) ^ {\top} \leq \frac {\lambda}{p - \lambda} +$$ + +and therefore, the optimal hypothesis test is to declare $X_{T} = 1$ for any $T \geq T^{*}$ if $Z_{1} = \ldots = Z_{T} = 0$ . Hence, the optimal hypothesis takes the form of + +$$ +X _ {\tau} = \mathbf {1} \left\{Z _ {\tau} = 0 \right\} \text {w h e r e} \tau = \min (s: Z _ {s} = 1) \wedge T ^ {*} +$$ + +![](images/8a42362ba4c229400b354038052af97df9f57fb133fb9c7a7211ce166d7007f4.jpg) + +Proposition D.2. Restatement of Proposition 2.2] The ratio of total error rate with a fixed threshold $r^*$ to that under SNR scales like + +$$ +\Omega \left(\exp \left(\log (\alpha (1 - \alpha) ^ {- 1}) \left(- \frac {1}{2} + \frac {1}{2} \frac {\log (1 - p _ {1})}{\log (1 - p _ {2})}\right)\right)\right) +$$ + +Proof. For notational convenience, define $\bar{\alpha} = \alpha (1 - \alpha)^{-1}$ . Notice that by Proposition 2.1, under SNR, neuron $i$ , $(I = 1,2)$ , is reset if it inactive for any longer that time $\bar{T} = \log (\bar{\alpha})) / \log (1 - p_i)$ . Consequently, the expected delay penalty, $\mathbb{E}[\tau |H_0] + \mathbb{E}[\tau |H_1]$ for neuron $i$ , is simply + +$$ +\frac {\log (\bar {\alpha})}{\log (1 - p _ {i})} + \frac {1}{p _ {i}} (1 - \bar {\alpha}) +$$ + +Letting the optimal fixed threshold be $r^*$ , we must have that the expected total delay across both neurons under this fixed threshold is at least $2r^*$ . This total expected delay can be no larger than that under SNR. Thus, + +$$ +2 r ^ {*} \leq \log (\bar {\alpha}) \left(\frac {1}{\log (1 - p _ {1})} + \frac {1}{\log (1 - p _ {2})}\right) + (1 - \bar {\alpha}) \left(\frac {1}{p _ {1}} + \frac {1}{p _ {2}}\right) +$$ + +But the sum of the error rates across the two neurons with the fixed threshold $r^*$ is at least $(1 - p_1)^{r^*} + \bar{\alpha}$ , while the total error rate under SNR is precisely $\bar{\alpha}$ . Dividing these two quantities and employing the upper bound derived on $r^*$ then yields the result. + +# E LEARNING A SINGLE RELU + +In this section we prove Theorem 4.1. + +# E.1 PRELIMINARIES + +We aim to learn a single ReLU-activated neuron with bias, or equivalently, the mapping $f_{v}:\mathbb{R}^{2}\to \mathbb{R}_{+}$ which we define as + +$$ +f _ {v} (x) = \sigma (v ^ {\top} x) = \left\{ \begin{array}{l l} v ^ {\top} x & \text {i f} v ^ {\top} x \geq 0 \\ 0 & \text {i f} v ^ {\top} x < 0 \end{array} \right. +$$ + +We refer to $v = (\tilde{v}, b_v)$ as the target parameters where $\tilde{v}$ is the slope and $b_v$ is the bias of the linear map $x \mapsto v^\top x$ . Likewise, we denote our model's parameters as $w = (\tilde{w}, b_w)$ where $\tilde{w}$ is the slope and $b_w$ is the bias. + +We sample data $x = (\tilde{x}, 1) \sim \mathrm{Uniform}(-L, L) \times \{1\}$ such that the first coordinate $\tilde{x}$ is sampled uniformly from the domain $[-L, L]$ and the second coordinate is a constant 1 so as to model the bias term in a ReLU-activated neuron. We learn the target neuron with respect to the squared loss and we thus define the loss to be + +$$ +F (w) = \mathbb {E} _ {x} \left[ \frac {1}{2} \left(\sigma \left(w ^ {\top} x\right) - \sigma \left(v ^ {\top} x\right)\right) ^ {2} \right] \tag {3} +$$ + +Then the gradient of $F$ is simply + +$$ +\nabla F (w) = \mathbb {E} _ {x} [ (\sigma (w ^ {\top} x) - \sigma (v ^ {\top} x)) \mathbb {I} (w ^ {\top} x \geq 0) x ] \tag {4} +$$ + +where the above expectations are taken with respect to $x \sim \mathrm{Uniform}(-L, L) \times \{1\}$ . We minimize $F$ using gradient descent with a constant learning rate $\eta$ + +$$ +w _ {t + 1} = w _ {t} - \eta \nabla F (w _ {t}) \tag {5} +$$ + +We define the regret of learning a single ReLU with an iterative algorithm as + +$$ +\mathbb {E} [ R _ {T} ] = \mathbb {E} _ {w _ {0}} [ \sum_ {t = 0} ^ {T - 1} F (w _ {t}) ] +$$ + +where the randomness is over the initialization of $w_{0}$ and the potential reinitialization of $w_{t}$ due to resets. Then the average regret is simply + +$$ +\frac {1}{T} \mathbb {E} [ R _ {T} ] = \frac {1}{T} \mathbb {E} _ {w _ {0}} [ \sum_ {t = 0} ^ {T - 1} F (w _ {t}) ] +$$ + +For some constant $\tilde{v}_{\mathrm{max}} > 1$ we suppose that $\tilde{v} \in [1, \tilde{v}_{\mathrm{max}}]$ and $b_v \in [-\frac{L}{6}, 0]$ . While for some constant $\tilde{w}_{\mathrm{min}} < 1$ we sample $\tilde{w}_0$ uniformly from $[-1, -\tilde{w}_0) \cup (\tilde{w}_0, 1]$ and set $b_{w_0} = 0$ , as is customary to initialize neurons with zero bias. + +# E.1.1 L2 INIT AND L2 REGULARIZATION + +Given a regularization strength $\lambda \geq 0$ , we consider the loss with L2 Init regularization as + +$$ +\bar {F} (w) = \mathbb {E} _ {x} [ \frac {1}{2} (\sigma (w ^ {\top} x) - \sigma (v ^ {\top} x)) ^ {2} ] + \frac {\lambda}{2} | | w - w _ {0} | | ^ {2} = F (w) + \frac {\lambda}{2} | | w - w _ {0} | | ^ {2} +$$ + +Then the gradient of $\bar{F}$ is simply + +$$ +\nabla F (w) = \mathbb {E} _ {x} [ (\sigma (w ^ {\top} x) - \sigma (v ^ {\top} x)) \mathbb {I} (w ^ {\top} x \geq 0) x ] + \lambda (w - w _ {0}) = \nabla F (w) + \lambda (w - w _ {0}) +$$ + +Then the L2 Init gradient descent update is simply + +$$ +w _ {t + 1} = w _ {t} - \eta \nabla \bar {F} (w _ {t}) = w _ {t} - \eta \nabla F (w _ {t}) - \eta \lambda (w _ {t} - w _ {0}) \tag {6} +$$ + +Similarly, we can consider vanilla L2 regularization whose update is simply + +$$ +w _ {t + 1} = w _ {t} - \eta \nabla F (w _ {t}) - \eta \lambda w _ {t} \tag {7} +$$ + +Note, if $\lambda = 0$ then we simply retain the update of unregularized gradient descent (5). Then for any sufficiently small learning rate $\eta$ we attain non-vanishing average regret. + +Theorem E.1. Suppose that $x$ is sampled according to $x \sim \mathrm{Uniform}(-L, L) \times \{1\} \subseteq \mathbb{R}^2$ and that the target parameters $v = (\tilde{v}, b_v)$ satisfy $\tilde{v} > 0$ and $b_v \leq 0$ . Then applying gradient descent with L2 Init (6) or L2 regularization (7), with regularization strength $\lambda \geq 0$ and learning rate $\eta > 0$ such that + +$$ +\eta \leq \frac {1}{L ^ {2} + 1} +$$ + +$$ +\eta \lambda < 1 +$$ + +and with $w_0$ sampled uniformly from $\left([-1, -\tilde{w}_{\min}\right) \cup \left(\tilde{w}_{\min}, 1\right) \times \{0\}$ , for any $\tilde{w}_{\min} > 0$ , then with probability $\frac{1}{2}$ over random initializations of $w_0$ , the average regret is non-vanishing + +$$ +\frac {1}{T} R _ {T} \geq F (0) +$$ + +Proof. The proof follows immediately by Lemma E.4 for L2 Init. A trivial modification of Lemma E.4 yields an identical result for L2 regularization, which we omit for brevity. $\square$ + +# E.1.2 GRADIENT DESCENT WITH RESETS + +For any reset threshold $\epsilon > 0$ we define a reset oracle $\mathcal{O}_{\epsilon}$ such that for any $w \in \mathbb{R}^2$ + +$$ +\mathcal {O} _ {\epsilon} (w) = \left\{ \begin{array}{l l} \text {T r u e} & \text {i f} \sup _ {x \in [ - L, L ] \times \{1 \}} w ^ {\top} x \leq \epsilon \\ \text {F a l s e} & \text {i f} \sup _ {x \in [ - L, L ] \times \{1 \}} w ^ {\top} x > \epsilon \end{array} \right. +$$ + +We consider the following gradient descent updates with resets + +$$ +u _ {t + 1} = w _ {t} - \eta \nabla F (w _ {t}) \tag {8} +$$ + +$$ +w _ {t + 1} = \left\{ \begin{array}{l l} u _ {t + 1} & \text {i f} \mathcal {O} _ {\epsilon} \left(u _ {t + 1}\right) = \text {F a l s e} \\ \text {s a m p l e f r o m U n i f o r m} ([ - 1, - \tilde {w} _ {\min }) \cup (\tilde {w} _ {\min }, 1 ]) \times \{0 \} & \text {i f} \mathcal {O} _ {\epsilon} \left(u _ {t + 1}\right) = \text {T r u e} \end{array} \right. \tag {9} +$$ + +Theorem E.2. Suppose that $x$ is sampled according to $x \sim \mathrm{Uniform}(-L, L) \times \{1\} \subseteq \mathbb{R}^2$ and the target parameters $v = (\tilde{v}, b_v)$ satisfy $\tilde{v} \in [1, \tilde{v}_{\max}]$ and $-\frac{L}{6} \leq b_v \leq 0$ and we denote $v_{\max} = (\tilde{v}_{\max}, -\frac{L}{6})$ . Let $\epsilon > 0$ be a reset threshold and suppose that the initial parameters $w_0$ are sampled uniformly from $\tilde{w}_0 \sim [-1, -\tilde{w}_{\min}) \cup (\tilde{w}_{\min}, 1]$ and $b_{w_0} = 0$ such that + +$$ +\tilde {w} _ {\mathrm {m i n}} > \frac {1 2 \tilde {v} _ {\mathrm {m a x}} \epsilon}{L} +$$ + +and + +$$ +\frac {5}{2} L \geq \epsilon . +$$ + +Then gradient descent with a constant learning rate of + +$$ +\eta \leq \frac {\tilde {w} _ {\mathrm {m i n}} ^ {3} L ^ {6}}{3 \cdot 1 2 ^ {2} \cdot 2 4 ^ {3} (2 + | | v _ {\mathrm {m a x}} | |) ^ {5} (L ^ {2} + 1) ^ {6}} +$$ + +and with resets, i.e. (8) and (9), attains an average regret of + +$$ +\frac {1}{T} \mathbb {E} [ R _ {T} ] \leq \frac {C}{T} +$$ + +where + +$$ +C = \lceil \frac {3 2 L ^ {2} F ((- 1 , 0))}{\eta \epsilon^ {4}} \rceil F ((- 1, 0)) + \frac {3}{2 \eta^ {2}} \left((\tilde {v} _ {\mathrm {m a x}} - \tilde {w} _ {\mathrm {m i n}}) ^ {2}) + (\frac {L}{6}) ^ {2}\right) +$$ + +Proof. The theorem is restated and proven as Theorem E.3. + +![](images/b9e75d8adffb2c3a6e3a834a631473b3cfb826ac832f6f3a107b455ced724cb2.jpg) + +# E.2 PROOFS + +# E.2.1 PROPERTIES OF THE LOSS FUNCTION + +Lemma E.1. The ReLU activation function $\sigma (x) = \max \{0,x\}$ is 1-Lipschitz continuous. + +Proof. Let $x, y \in \mathbb{R}$ be arbitrary. Without loss of generality we suppose that $x \geq y$ . We consider two cases. Firstly, if $x \geq 0$ then we have that + +$$ +\begin{array}{l} | \sigma (x) - \sigma (y) | = \sigma (x) - \sigma (y) \quad \text {b y} x \geq y \\ = x - \sigma (y) \quad \text {b y} x \geq 0 \\ \leq x - y \quad \text {b y} \sigma (y) \geq y \\ \leq | x - y | \\ \end{array} +$$ + +As for the case of $x < 0$ then we likewise have that $y < 0$ and so + +$$ +| \sigma (x) - \sigma (y) | = 0 \leq | x - y | +$$ + +Thus, it follows that $\sigma (\cdot)$ is 1-Lipschitz continuous. + +Lemma E.2. Suppose that $x$ is sampled according to $x \sim \mathrm{Uniform}(-L, L) \times \{1\} \subseteq \mathbb{R}^2$ and that the target parameters $v = (\tilde{v}, b_v)$ satisfy $\tilde{v} > 0$ and $b_v \leq 0$ . Then for $w \leq 0$ , $\nabla F(w) = \mathbb{E}_x[\sigma (w^\top x)x]$ . + +Proof. For almost every $\tilde{x} > 0$ , $w^\top x = \tilde{w}\tilde{x} + b_w < 0$ and so + +$$ +\begin{array}{l} (\sigma (w ^ {\top} x) - \sigma (v ^ {\top} x)) \mathbb {I} (w ^ {\top} x \geq 0) x = 0 \quad \text {b y} \mathbb {I} (w ^ {\top} x \geq 0) = 0 \\ = \sigma (w ^ {\top} x) x \quad \text {b y} \sigma (w ^ {\top} x) = 0 \text {s i n c e} w ^ {\top} x < 0 \\ \end{array} +$$ + +As for $\tilde{x} < 0$ , we have that $v^{\top}x < 0$ since $\tilde{v} > 0$ and $b_v \leq 0$ , and so $\sigma(v^{\top}x) = 0$ . Hence, + +$$ +(\sigma (w ^ {\top} x) - \sigma (v ^ {\top} x)) \mathbb {I} (w ^ {\top} x \geq 0) x = \sigma (w ^ {\top} x) \mathbb {I} (w ^ {\top} x \geq 0) x = \sigma (w ^ {\top} x) x +$$ + +where the last equality follows by the fact that $\mathbb{I}(w^{\top}x\geq 0)$ is redundant given that $\sigma (w^{\top}x) = 0$ if $w^{\top}x < 0$ . Therefore, for almost every $x\in \mathrm{Uniform}(-L,L)\times \{1\}$ , we have that + +$$ +(\sigma (w ^ {\top} x) - \sigma (v ^ {\top} x)) \mathbb {I} (w ^ {\top} x \geq 0) x = \sigma (w ^ {\top} x) x \tag {10} +$$ + +We recall that + +$$ +\nabla F (w) = \mathbb {E} _ {x} [ (\sigma (w ^ {\top} x) - \sigma (v ^ {\top} x)) \mathbb {I} (w ^ {\top} x \geq 0) x ] +$$ + +and hence by (10) + +$$ +\nabla F (w) = \mathbb {E} _ {x} [ \sigma (w ^ {\top} x) x ] +$$ + +![](images/14303f3e422ef33813903e27204db4d4acfbfdaa445444949c0f6e4a4fb5295e.jpg) + +Lemma E.3. Suppose that $x$ is sampled according to $x \sim \mathrm{Uniform}(-L, L) \times \{1\} \subseteq \mathbb{R}^2$ and that the target parameters $v = (\tilde{v}, b_v)$ satisfy $\tilde{v} > 0$ and $b_v \leq 0$ . Then $\nabla F(\cdot)$ is $(L^2 + 1)$ -Lipschitz continuous on $w \leq 0$ . That is, for any $w, u \leq 0$ , $||\nabla F(w) - \nabla F(u)|| \leq (L^2 + 1)||w - u||$ . + +Proof. By $w, u \leq 0$ and Lemma E.2 we have that $\nabla F(w) = \mathbb{E}_x[\sigma (w^\top x)x]$ and $\nabla F(u) = \mathbb{E}_x[\sigma (u^\top x)x]$ . Then we establish the desired result as follows, + +$$ +\begin{array}{l} | | \nabla F (w) - \nabla F (u) | | = | | \mathbb {E} _ {x} [ \sigma (w ^ {\top} x) x - \sigma (u ^ {\top} x) x ] | | \\ \leq \mathbb {E} _ {x} [ | | \sigma (w ^ {\top} x) x - \sigma (u ^ {\top} x) x | | ] \\ = \mathbb {E} _ {x} \left[ \left| \sigma \left(w ^ {\top} x\right) - \sigma \left(u ^ {\top} x\right) \right| \cdot | | x | | \right] \\ \leq \mathbb {E} _ {x} [ | w ^ {\top} x - u ^ {\top} x | \cdot | | x | | ] \\ \leq | | w - u | | \mathbb {E} _ {x} [ | | x | | ^ {2} ] \\ \leq (L ^ {2} + 1) | | w - u | | \\ \end{array} +$$ + +by Jensen's inequality + +by Lemma E.1 + +by Cauchy-Schwarz inequality + +$$ +\text {b y} x \in [ - L, L ] \times \{1 \} +$$ + +![](images/cae2ec5f4295f3483bcf2ce3e4690c891e5bd909a4428f72eef6fdb490a983c4.jpg) + +# E.2.2 CONVERGENCE AFTER A NEGATIVE INITIALIZATION + +Lemma E.4. Suppose that $x$ is sampled according to $x \sim \mathrm{Uniform}(-L, L) \times \{1\} \subseteq \mathbb{R}^2$ and that the target parameters $v = (\tilde{v}, b_v)$ satisfy $\tilde{v} > 0$ and $b_v \leq 0$ . Then applying gradient descent with L2 Init regularization with strength $\lambda \geq 0$ according to equation (6) with $w_0$ satisfying $\tilde{w}_0 \in [-1, 0)$ and $b_{w_0} = 0$ and learning rate $\eta = \frac{\alpha}{L^2 + 1}$ where $\alpha \in (0, 1]$ such that $\eta \lambda < 1$ , then for any $t \geq 0$ + +$$ +\tilde {w} _ {0} \leq \tilde {w} _ {t} \leq 0, \tag {11} +$$ + +$$ +b _ {w _ {t}} \leq 0, \tag {12} +$$ + +$$ +F \left(w _ {t}\right) \geq F (0) \tag {13} +$$ + +Proof. We additionally prove the following invariant + +$$ +\forall t \geq 0, w _ {t} ^ {\top} (- L, 1) \geq 0 \tag {14} +$$ + +For $t = 0$ we have that $\tilde{w}_0 \leq \tilde{w}_0 \leq 0$ and $b_{w_0} \leq 0$ hold trivially by assumption. As for (14), we observe that + +$$ +\begin{array}{l} w _ {0} ^ {\top} (- L, 1) = - L \tilde {w} _ {0} + b _ {w _ {0}} \\ = - L \tilde {w} _ {0} \\ \geq 0 \\ \end{array} +$$ + +$$ +\begin{array}{l} \text {s i n c e} b _ {w _ {0}} = 0 \\ \text {s i n c e} \tilde {w} _ {0} \in [ - L, 0) \\ \end{array} +$$ + +Therefore, we suppose that (11), (12), and (14) hold for some arbitrary $t$ and proceed to show that they hold for $t + 1$ . We begin with establishing, (12). + +$$ +\begin{array}{l} b _ {w _ {t + 1}} = b _ {w _ {t}} - \eta \nabla \bar {F} (w _ {t}) _ {2} \\ = b _ {w _ {t}} - \eta \nabla F (w _ {t}) _ {2} - \eta \lambda \left(b _ {w _ {t}} - b _ {w _ {0}}\right) \\ = (1 - \eta \lambda) b _ {w _ {t}} - \eta \nabla F (w _ {t}) _ {2} \\ = (1 - \eta \lambda) b _ {w _ {t}} - \eta \mathbb {E} _ {x} [ \sigma (w _ {t} ^ {\top} x) ] \\ \leq (1 - \eta \lambda) b _ {w _ {t}} \\ \leq 0 \\ \end{array} +$$ + +$$ +\text {b y} b _ {w _ {0}} = 0 +$$ + +by Lemma E.2 given that $w_{t}\leq 0,\tilde{v} >0,b_{v}\leq 0$ + +$$ +\text {s i n c e} \sigma \left(w _ {t} ^ {\top} x\right) \geq 0, \forall x +$$ + +$$ +\text {s i n c e} b _ {w _ {t}} \leq 0 \text {a n d} \eta \lambda < 1 +$$ + +Next, for (11) we have that $\tilde{w}_{t + 1}\leq 0$ if $-L\tilde{w}_{t + 1} + b_{w_{t + 1}} = w_{t + 1}^{\top}(-L,1)\geq 0$ since $b_{w_{t + 1}}\leq 0$ . This is equivalent to showing that + +$$ +\left(w _ {t} - \eta \nabla F \left(w _ {t}\right) - \eta \lambda \left(w _ {t} - w _ {0}\right)\right) ^ {\top} (- L, 1) \geq 0 \tag {15} +$$ + +We proceed by bounding $\eta \nabla F(w_t)^\top (-L,1)$ . Again invoking Lemma E.2, we have that + +$$ +\begin{array}{l} \eta \nabla F (w _ {t}) ^ {\top} (- L, 1) = \eta \mathbb {E} _ {x} [ \sigma (w _ {t} ^ {\top} x) x ] ^ {\top} (- L, 1) \\ = \eta \mathbb {E} _ {x} [ \sigma (w _ {t} ^ {\top} x) (- L \tilde {x} + 1) ] \\ \leq \eta \sigma \left(w _ {t} ^ {\top} (- L, 1)\right) \left(L ^ {2} + 1\right) \\ = \alpha \sigma \left(w _ {t} ^ {\top} (- L, 1)\right) \\ = \alpha w _ {t} ^ {\top} (- L, 1) \quad \text {b y} \tag {14} \\ \leq w _ {t} ^ {\top} (- L, 1) \quad \text {s i n c e} \alpha \leq 1 \\ \end{array} +$$ + +Then, we have that + +$$ +\begin{array}{l} \left(w _ {t} - \eta \nabla F \left(w _ {t}\right) - \eta \lambda \left(w _ {t} - w _ {0}\right)\right) ^ {\top} (- L, 1) \geq (1 - \eta \lambda) w _ {t} ^ {\top} (- L, 1) + \eta \lambda w _ {0} ^ {\top} (- L, 1) - w _ {t} ^ {\top} (- L, 1) \\ \geq (1 - \eta \lambda) w _ {t} ^ {\top} (- L, 1) + \eta \lambda w _ {t} ^ {\top} (- L, 1) - w _ {t} ^ {\top} (- L, 1) \\ = 0 \\ \end{array} +$$ + +where the second inequality above follows by $\tilde{w}_0 \leq \tilde{w}_t \leq 0$ and $b_{w_t} \leq 0 = b_{w_0}$ . Therefore, it follows that $\tilde{w}_{t+1} \leq 0$ . Moreover, this also establishes (14) for $t + 1$ . As for showing that $\tilde{w}_{t+1} \geq \tilde{w}_0$ , in order to complete (11), we argue as follows. + +$$ +\begin{array}{l} \tilde {w} _ {t + 1} = \tilde {w} _ {t} - \eta \nabla \bar {F} (w _ {t}) _ {1} \\ = \tilde {w} _ {t} - \eta \nabla F (w _ {t}) _ {1} - \eta \lambda (\tilde {w} _ {t} - \tilde {w} _ {0}) \\ = (1 - \eta \lambda) \tilde {w} _ {t} + \eta \lambda \tilde {w} _ {0} - \eta \mathbb {E} _ {x} [ \sigma (w _ {t} ^ {\top} x) \tilde {x} ] \quad \text {b y L e m m a E . 2 g i v e n t h a t} w _ {t} \leq 0, \tilde {v} > 0, b _ {v} \leq 0 \\ \geq (1 - \eta \lambda) \tilde {w} _ {t} + \eta \lambda \tilde {w} _ {0} \quad \text {s i n c e} \tilde {x} > 0 \Rightarrow \sigma \left(w _ {t} ^ {\top} x\right) = 0 \text {b y} w _ {t} \leq 0 \\ \geq (1 - \eta \lambda) \tilde {w} _ {0} + \eta \lambda \tilde {w} _ {0} \quad \text {b y} \tilde {w} _ {t} \geq \tilde {w} _ {0} \text {a n d} \eta \lambda < 1 \\ = \tilde {w} _ {0} \\ \end{array} +$$ + +Therefore, (11) holds for $t + 1$ . As for (13), given that we have established (11) and (12) it follows that for any $t \geq 0$ + +$$ +\begin{array}{l} F (w _ {t}) = \mathbb {E} _ {x} [ \frac {1}{2} (\sigma (w _ {t} ^ {\top} x) - \sigma (v ^ {\top} x)) ^ {2} ] \\ \geq \mathbb {E} _ {x} \left[ \frac {1}{2} \left(\sigma \left(w _ {t} ^ {\top} x\right) - \sigma \left(v ^ {\top} x\right)\right) ^ {2} \mathbb {I} _ {\{\tilde {x} \geq 0 \}} \right] \\ = \mathbb {E} _ {x} \left[ \frac {1}{2} \left(\sigma \left(v ^ {\top} x\right)\right) ^ {2} \mathbb {I} _ {\{\tilde {x} \geq 0 \}} \right] \quad \text {s i n c e} w _ {t} \leq 0 \text {a n d h e n c e} \sigma \left(w _ {t} ^ {\top} x\right) \mathbb {I} _ {\{\tilde {x} \geq 0 \}} = 0 \\ = \mathbb {E} _ {x} \left[ \frac {1}{2} \left(\sigma \left(v ^ {\top} x\right)\right) ^ {2} \right] \quad \text {s i n c e} v _ {t} ^ {\top} x \leq 0 \text {f o r} \tilde {x} < 0 \text {b y} \tilde {v} > 0, b _ {v} \leq 0 \\ = F (0) \\ \end{array} +$$ + +# E.2.3 RESETS AFTER A NEGATIVE INITIALIZATION + +Lemma E.5. Suppose that $x$ is sampled according to $x \sim \mathrm{Uniform}(-L, L) \times \{1\} \subseteq \mathbb{R}^2$ and that the target parameters $v = (\tilde{v}, b_v)$ satisfy $\tilde{v} > 0$ and $b_v \leq 0$ . Then applying gradient descent according to equation (5) with $w_0$ satisfying $\tilde{w}_0 \in [-1, 0]$ and $b_{w_0} = 0$ and learning rate $\eta < \frac{1}{L^2 + 1}$ , we have that for any threshold $\epsilon > 0$ , there exists some $t \in \{0, 1, \ldots, T = \lceil \frac{16L^2C_\eta}{\epsilon^4} \rceil \}$ , where $C_\eta = \frac{2}{\eta} F((-1, 0))$ , such that $\sup_{x \in [-L, L] \times \{1\}} \sigma(w_t^\top x) \leq \epsilon$ . + +Proof. If $\tilde{w}_0\in [-\frac{\epsilon}{L},0]$ then + +$$ +\sup _ {x \in [ - L, L ] \times \{1 \}} \sigma \left(w _ {t} ^ {\top} x\right) = - L \tilde {w} _ {0} \leq \epsilon +$$ + +and so at $t = 0$ we immediately have that $\sup_{x \in [-L, L] \times \{1\}} \sigma(w_t^\top x) \leq \epsilon$ . Therefore, we consider the case of $\tilde{w}_0 \in [-L, -\frac{\epsilon}{L})$ and proceed as follows. According to Lemma E.4 and by the choice of learning rate $\eta$ , we have that $\forall t \in \{0, 1, \dots, T\}$ , $w_t \leq 0$ . Therefore by Lemma E.2, $\nabla F(\cdot)$ is $(L^2 + 1)$ -Lipschitz continuous on the span of $\{w_0, w_1, \dots, w_T\}$ . Consequently, following the canonical analysis of gradient descent, we have that for any $t \geq 0$ + +$$ +\begin{array}{l} F (w _ {t + 1}) \leq F (w _ {t}) + \nabla F (w _ {t}) ^ {\top} (w _ {t + 1} - w _ {t}) + \frac {L ^ {2} + 1}{2} | | w _ {t + 1} - w _ {t} | | ^ {2} \\ = F (w _ {t}) - (\eta - \frac {(L ^ {2} + 1) \eta^ {2}}{2}) | | \nabla F (w _ {t}) | | ^ {2} \\ \leq F (w _ {t}) - \frac {\eta}{2} | | \nabla F (w _ {t}) | | ^ {2} \\ \end{array} +$$ + +where the second line above follows by $w_{t + 1} = w_t - \eta \nabla F(w_t)$ and the last line above follows by the fact that + +$$ +\begin{array}{l} \left(\eta - \frac {L ^ {2} + 1}{2} \eta^ {2}\right) - \frac {\eta}{2} = \frac {1}{2} \left(\eta - \left(L ^ {2} + 1\right) \eta^ {2}\right) \\ \geq \frac {1}{2} (\eta - \eta) \quad \text {b y} \eta \leq \frac {1}{L ^ {2} + 1} \\ = 0 \\ \end{array} +$$ + +Then by a telescoping sum, + +$$ +\begin{array}{l} \sum_ {t = 0} ^ {\top} \left| \left| \nabla F (w _ {t}) \right| \right| ^ {2} \leq \frac {2}{\eta} \left(F (w _ {0}) - F \left(w _ {T + 1}\right)\right) \\ \leq \frac {2}{\eta} F ((- 1, 0)) \\ \end{array} +$$ + +where the second line follows by the fact that the loss $F(w_0)$ is maximized at $w_0 = (-1, 0)$ (over the space of initializations of $w_0$ ) and by the fact that the loss $F(w_{T+1})$ is nonnegative. Then defining $C_\eta = \frac{2}{\eta} F((-1, 0))$ , we have that for some $t \in \{0, 1, \dots, T\}$ , $||\nabla F(w_t)||^2 \leq \frac{C_\eta}{T}$ . More precisely, we have that + +$$ +| | \mathbb {E} _ {x} [ (\sigma (w ^ {\top} x) - \sigma (v ^ {\top} x)) \mathbb {I} (w ^ {\top} x \geq 0) x ] | | ^ {2} \leq \frac {C _ {\eta}}{T} +$$ + +Given that $x \sim \mathrm{Uniform}(-L, L) \times \{1\}$ , by considering the second element of the gradient, which corresponds to the constant component of $x$ , this implies that + +$$ +\mathbb {E} _ {x} \left[ \left(\sigma \left(w _ {t} ^ {\top} x\right) - \sigma \left(v ^ {\top} x\right)\right) \mathbb {I} \left(w ^ {\top} x \geq 0\right) \right] ^ {2} \leq \frac {C _ {\eta}}{T} +$$ + +Additionally, by Lemma E.4 we have that $\tilde{w}_0 \leq \tilde{w}_t \leq 0$ and $b_{w_t} \leq 0$ , and thus by Lemma E.2, we have that + +$$ +\mathbb {E} _ {x} [ \sigma (w ^ {\top} x) ] ^ {2} = \mathbb {E} _ {x} [ (\sigma (w ^ {\top} x) - \sigma (v ^ {\top} x)) \mathbb {I} (w _ {t} ^ {\top} x \geq 0) ] ^ {2} \leq \frac {C _ {\eta}}{T} +$$ + +Hence, + +$$ +\mathbb {E} _ {x} [ \sigma (w _ {t} ^ {\top} x) ] \leq \sqrt {\frac {C _ {\eta}}{T}} +$$ + +Then, noting that $\tilde{w}_0\leq \tilde{w}_t\leq 0$ and $b_{w_t}\leq 0$ , we have that $2L\mathbb{E}_x[\sigma (w_t^\top x)]$ is the area of the triangle formed by the line $w_{t}^{\top}x$ over the $x$ -axis with its base ranging from its $x$ -intercept to $-L$ . We denote the length of its base by $b$ and its height by $h$ . Given that $\tilde{w}_t\leq 0$ it follows that $h = \sigma (w_t^\top (-L,1)) = \sup_{x\in [-L,L]\times \{1\}}\sigma (w_t^\top x)$ . Additionally, we have that $h = |\tilde{w}_t|b\leq |\tilde{w}_0|b\leq b$ given that $-1\leq \tilde{w}_0\leq \tilde{w}_t\leq 0$ . Hence we have that + +$$ +\frac {h ^ {2}}{4 L} \leq \frac {b h}{4 L} = \mathbb {E} _ {x} [ \sigma (w _ {t} ^ {\top} x) ] \leq \sqrt {\frac {C _ {\eta}}{T}} +$$ + +By the choice of $T$ we have that $4L\sqrt{\frac{C_{\eta}}{T}} \leq \epsilon^2$ . Hence, we obtain + +$$ +\sup _ {x \in [ - L, L ] \times \{1 \}} \sigma \left(w _ {t} ^ {\top} x\right) = h \leq \sqrt {4 L \sqrt {\frac {C _ {\eta}}{T}}} \leq \epsilon +$$ + +![](images/f29383ad77b6293e833817e3e0b0b3ae9328c47f2924ccaf9d8f2c0ee5480f64.jpg) + +# E.2.4 CONVERGENCE AFTER A POSITIVE INITIALIZATION + +Lemma E.6. Suppose that $x$ is sampled according to $x \sim \mathrm{Uniform}(-L, L) \times \{1\} \subseteq \mathbb{R}^2$ , the target parameters $v = (\tilde{v}, b_v)$ satisfy $\tilde{v} \in [1, \tilde{v}_{\max}]$ and $-\frac{L}{6} \leq b_v \leq 0$ , and initial parameters $w_0$ satisfy $\tilde{w}_0 \in (0, 1]$ and $b_{w_0} = 0$ . Then there exists some $\delta \geq \frac{\tilde{w}_0 L^2}{24}$ such that $F(w_0) \leq F(0) - \delta$ . + +Proof. + +$$ +\begin{array}{l} F (w _ {0}) = \mathbb {E} _ {x} [ \frac {1}{2} (\sigma (w _ {0} ^ {\top} x) - \sigma (v ^ {\top} x)) ^ {2} ] \\ = F (0) + \frac {1}{2} \mathbb {E} _ {x} [ \sigma (w _ {0} ^ {\top} x) ^ {2} ] - \mathbb {E} _ {x} [ \sigma (w _ {0} ^ {\top} x) \sigma (v ^ {\top} x) ] \\ = F (0) + \frac {\tilde {w} _ {0} ^ {2}}{4 L} \int_ {0} ^ {L} x ^ {2} d x - \mathbb {E} _ {x} [ \sigma (w _ {0} ^ {\top} x) \sigma (v ^ {\top} x) ] \quad \text {b y} \tilde {w} _ {0} \geq 0 \text {a n d} b _ {w _ {0}} = 0 \\ = F (0) + \frac {\tilde {w} _ {0} ^ {2} L ^ {2}}{1 2} - \mathbb {E} _ {x} [ \sigma (w _ {0} ^ {\top} x) \sigma (v ^ {\top} x) ] \\ \end{array} +$$ + +Therefore, we define $\delta = -\frac{\tilde{w}_0^2L^2}{12} +\mathbb{E}_x[\sigma (w_0^\top x)\sigma (v^\top x)]$ and we proceed to show that $\delta \geq \frac{\tilde{w}_0L^2}{24}$ . We let $z = -\frac{b_v}{\tilde{v}}$ so that $(z,1)$ is the $x$ -intercept of the line $v^{\top}x$ . Then, $v^{\top}x = \tilde{v} (\tilde{x} -z)$ . Moreover, $z\in [0,\frac{L}{6} ]$ since $b_{v}\in [-\frac{L}{6},0]$ and $\tilde{v}\geq 1$ . Therefore, $\forall \tilde{x}\geq z,v^{\top}x\geq 0$ and $\forall \tilde{x} < z,v^{\top}x < 0$ . Since $b_{w_0} = 0$ and $\tilde{w}_0\geq 0$ , then $\forall \tilde{x}\geq 0,w_0^\top x\geq 0$ and $\forall \tilde{x} < 0,w_0^\top x < 0$ . Thus, + +$$ +\sigma \left(w _ {0} ^ {\top} x\right) \sigma \left(v ^ {\top} x\right) = \left\{ \begin{array}{l l} \tilde {w} _ {0} \tilde {x} \tilde {v} (\tilde {x} - z) & \text {i f} \tilde {x} \geq z \\ 0 & \text {i f} \tilde {x} < z \end{array} \right. \tag {16} +$$ + +From here, we can bound the second term of $\delta$ as follows, + +$$ +\begin{array}{l} \mathbb {E} _ {x} \left[ \sigma \left(w _ {0} ^ {\top} x\right) \sigma \left(v ^ {\top} x\right) \right] = \frac {1}{2 L} \tilde {w} _ {0} \tilde {v} \int_ {z} ^ {L} y ^ {2} - y z d y \tag {16} \\ = \frac {1}{2 L} \tilde {w} _ {0} \tilde {v} \left(\frac {L ^ {3}}{3} - \frac {L ^ {2} z}{2} + \frac {z ^ {3}}{6}\right) \\ \end{array} +$$ + +Then, + +$$ +\begin{array}{l} \delta = - \frac {\tilde {w} _ {0} ^ {2} L ^ {2}}{1 2} + \mathbb {E} _ {x} [ \sigma (w _ {0} ^ {\top} x) \sigma (v ^ {\top} x) ] \\ = - \frac {\tilde {w} _ {0} ^ {2} L ^ {2}}{1 2} + \frac {1}{2 L} \tilde {w} _ {0} \tilde {v} \left(\frac {L ^ {3}}{3} - \frac {L ^ {2} z}{2} + \frac {z ^ {3}}{6}\right) \\ \geq - \frac {\tilde {w} _ {0} L ^ {2}}{1 2} + \frac {1}{2 L} \tilde {w} _ {0} \tilde {v} \left(\frac {L ^ {3}}{3} - \frac {L ^ {3}}{1 2}\right) \quad \text {b y} \frac {\tilde {w} _ {0} \tilde {v}}{2 L} \geq 0, z \in [ 0, \frac {L}{6} ] \\ = - \frac {\tilde {w} _ {0} ^ {2} L ^ {2}}{1 2} + \frac {\tilde {w} _ {0} \tilde {v} _ {0} L ^ {2}}{8} \\ = \frac {\tilde {w} _ {0} L ^ {2}}{4} \left(- \frac {\tilde {w} _ {0}}{3} + \frac {\tilde {v}}{2}\right) \\ \geq \frac {\tilde {w} _ {0} L ^ {2}}{2 4} \quad \text {b y} \tilde {v} \geq 1, \tilde {w} _ {0} \leq 1 \\ \end{array} +$$ + +Thus, + +$$ +F (w _ {0}) = F (0) - \delta = \leq F (0) - \frac {\tilde {w} _ {0} L ^ {2}}{2 4} +$$ + +![](images/63154daabe55b802ff0cdfa4e44bc384881b6ff45aea89a54f7ac81ce33cce94.jpg) + +Lemma E.7. Suppose that $x$ is sampled according to $x \sim \mathrm{Uniform}(-L, L) \times \{1\} \subseteq \mathbb{R}^2$ , the target parameters $v = (\tilde{v}, b_v)$ satisfy $\tilde{v} \in [1, \tilde{v}_{\max}]$ and $-\frac{L}{6} \leq b_v \leq 0$ , and initial parameters $w_0$ satisfy $\tilde{w}_0 \in (0, 1]$ and $b_{w_0} = 0$ . Then there exists some $\delta \geq \frac{\tilde{w}_0 L^2}{24}$ such that $F(w_0) \leq F(0) - \delta$ . Then + +defining $\gamma = \frac{\delta^3}{3\cdot 12^2(||w_0|| + ||v|| + 1)^5(L^2 + 1)^4}$ and applying gradient descent according to equation (5) with learning rate $\eta \leq \frac{\gamma}{(L^2 + 1)^2}$ we have that $\forall t\geq 0$ + +$$ +\left| \left| w _ {t} - v \right| \right| ^ {2} \leq (1 - \eta \gamma) ^ {t} \left| \left| w _ {0} - v \right| \right| ^ {2} \tag {17} +$$ + +$$ +F \left(w _ {t}\right) \leq \frac {1}{2} \left(L ^ {2} + 1\right) \left(1 - \eta \gamma\right) ^ {t} \left| \left| w _ {0} - v \right| \right| ^ {2} \tag {18} +$$ + +Proof. By Lemma E.6, there exists some $\delta \geq \frac{\tilde{w}_0L^2}{24}$ such that $F(w_0)\leq F(0) - \delta$ . Then (17) follows by the latter inequality and a slight modification of the proof of Theorem 5.2 (along with Lemma D.2, Lemma D.4, and Lemma D.6) of Vardi et al. (2021), to extend the result to target parameters $v$ with arbitrary magnitudes. Specifically, a simple modification of the aforementioned proofs implies that setting $\gamma = \frac{\delta^3}{3\cdot 12^2(||w_0|| + ||v|| + 1)^5c^8c'^2}$ where we take $c = \max_x||x|| = \sqrt{L^2 + 1}$ and $c' = 1$ due to $x\sim$ Uniform $(-L,L)\times \{1\}$ guarantees (17). Finally, (18) follows by + +$$ +\begin{array}{l} F (w _ {t}) = \mathbb {E} _ {x} [ \frac {1}{2} (\sigma (w _ {t} ^ {\top} x) - \sigma (v ^ {\top} x)) ^ {2} ] \\ \leq \mathbb {E} _ {x} \left[ \frac {1}{2} \left(w _ {t} ^ {\top} x - v ^ {\top} x\right) ^ {2} \right] \quad \text {b y} \sigma (\cdot) 1 \text {- L i p s c h i t z c o n t i n u o u s , L e m m a E . 1} \\ \leq \frac {1}{2} | | w _ {t} - v | | ^ {2} \mathbb {E} _ {x} [ | | x | | ^ {2} ] \quad \text {b y} \\ \leq \frac {1}{2} (L ^ {2} + 1) | | w _ {t} - v | | ^ {2} \quad \text {b y} x \in [ - L, L ] \times \{1 \} \\ \leq \frac {1}{2} \left(L ^ {2} + 1\right) \left(1 - \eta \lambda\right) ^ {t} | | w _ {0} - v | | ^ {2} \tag {17} \\ \end{array} +$$ + +![](images/e9f352a6c9359adf2e0de758bb199818b333978f22e34e79c250c290229365a2.jpg) + +# E.2.5 NO RESETS AFTER A POSITIVE INITIALIZATION + +Lemma E.8. Suppose that $x$ is sampled according to $x \sim \mathrm{Uniform}(-L, L) \times \{1\} \subseteq \mathbb{R}^2$ , the target parameters $v = (\tilde{v}, b_v)$ satisfy $\tilde{v} \in [1, \tilde{v}_{\max}]$ and $-\frac{L}{6} \leq b_v \leq 0$ . Let $\epsilon > 0$ such that $3(L - z) \geq \frac{\epsilon}{\tilde{v}}$ , then for any $w \in \mathbb{R}^2$ such that + +$$ +\sup _ {x \in [ - L, L ] \times \{1 \}} w ^ {\top} x \leq \epsilon \Rightarrow F (w) \geq F (0) - \frac {\tilde {v} L}{2} \epsilon +$$ + +Proof. + +$$ +\begin{array}{l} F (w _ {t}) = \mathbb {E} _ {x} [ (\sigma (w ^ {\top} x) - \sigma (v ^ {\top} x)) ^ {2} ] \\ \geq \mathbb {E} _ {x} \left[ \left(\sigma \left(w ^ {\top} x\right) - \sigma \left(v ^ {\top} x\right)\right) ^ {2} \mathbb {I} _ {\{v ^ {\top} x \geq \epsilon \}} \right] \\ \geq \mathbb {E} _ {x} [ (\sigma (v ^ {\top} x) - \epsilon) ^ {2} \mathbb {I} _ {\{v ^ {\top} x \geq \epsilon \}} ] \quad \text {b y} \sup _ {x \in [ - L, L ] \times \{1 \}} w ^ {\top} x \leq \epsilon \\ \end{array} +$$ + +Let $z = -\frac{b_v}{\tilde{v}}$ such that $v^{\top}(z,1) = 0$ . Then $v^{\top}(z + \frac{\epsilon}{\tilde{v}},1) = \epsilon$ and since $\tilde{v} > 0$ then $\forall \tilde{x} \geq z + \frac{\epsilon}{\tilde{v}}$ we have that $v^{\top}(x,1) \geq \epsilon$ . Therefore, + +$$ +\begin{array}{l} \mathbb {E} _ {x} [ (\sigma (v ^ {\top} x) - \epsilon) ^ {2} \mathbb {I} _ {\{v ^ {\top} x \geq \epsilon \}} ] = \mathbb {E} _ {x} [ (v ^ {\top} x - \epsilon) ^ {2} \mathbb {I} _ {\{v ^ {\top} x \geq \epsilon \}} ] \\ = \frac {1}{2 L} \int_ {z + \frac {\epsilon}{v}} ^ {L} (\tilde {v} y + b _ {v} - \epsilon) ^ {2} d y \\ = \frac {1}{2 L} \int_ {0} ^ {L - (z + \frac {\epsilon}{\tilde {v}})} (\tilde {v} y) ^ {2} d y \quad \text {s i n c e} \tilde {v} \geq 0 \\ = \frac {\tilde {v} ^ {2}}{6 L} (L - z - \frac {\epsilon}{\tilde {v}}) ^ {3} \\ \end{array} +$$ + +By a similar argument, we have that + +$$ +\begin{array}{l} F (0) = \mathbb {E} _ {x} [ \sigma (v ^ {\top} x) ^ {2} ] \\ = \frac {1}{2 L} \int_ {z} ^ {L} \left(\tilde {v} y + b _ {v}\right) ^ {2} d y \\ = \frac {1}{2 L} \int_ {0} ^ {L - z} (\tilde {v} y) ^ {2} d y \\ = \frac {\tilde {v} ^ {2}}{6 L} (L - z) ^ {3} \\ \end{array} +$$ + +Then, + +$$ +\begin{array}{l} F (w) - F (0) \geq \frac {\tilde {v} ^ {2}}{6 L} \left(\left(L - z - \frac {\epsilon}{\tilde {v}}\right) ^ {3} - (L - z) ^ {3}\right) \\ = \frac {\tilde {v} ^ {2}}{6 L} (- 3 (L - z) ^ {2} \frac {\epsilon}{\tilde {v}} + 3 (L - z) \frac {\epsilon^ {2}}{\tilde {v} ^ {2}} - \frac {\epsilon^ {3}}{\tilde {v} ^ {3}}) \\ \geq - \frac {\tilde {v}}{2 L} (L - z) ^ {2} \epsilon \quad \text {s i n c e} 3 (L - z) \geq \frac {\epsilon}{\tilde {v}} \\ \geq - \frac {\tilde {v} L}{2} \epsilon \\ \end{array} +$$ + +Hence, we have that + +$$ +F (w) \geq F (0) - \frac {\tilde {v} L}{2} \epsilon +$$ + +![](images/347afc93113d769895db20005f2c4bd6cfbdb0703a9b515115d7b9e959f5323a.jpg) + +Lemma E.9. Suppose that $x$ is sampled according to $x \sim \mathrm{Uniform}(-L, L) \times \{1\} \subseteq \mathbb{R}^2$ and the target parameters $v = (\tilde{v}, b_v)$ satisfy $\tilde{v} \in [1, \tilde{v}_{\max}]$ and $-\frac{L}{6} \leq b_v \leq 0$ . Let $\epsilon > 0$ be a reset threshold and suppose that the initial parameters $w_0$ satisfy $\tilde{w}_0 \in (w_{\min}, 1]$ and $b_{w_0} = 0$ such that + +$$ +\tilde {w} _ {\min } > \frac {1 2 \tilde {v} \epsilon}{L} \tag {19} +$$ + +and + +$$ +3 (L - z) \geq \frac {\epsilon}{\bar {v}}. +$$ + +Then there exists a $\delta \geq \frac{\tilde{w}_0L^2}{24}$ such that defining $\gamma = \frac{\delta^3}{3\cdot 12^2(||w_0|| + ||v|| + 1)^5(L^2 + 1)^4}$ and applying gradient descent with resets, according to (8) and (9), with learning rate $\eta \leq \frac{\gamma}{(L^2 + 1)^2}$ we have that $\mathcal{O}_{\epsilon}(u_{t + 1}) = \mathrm{False} \forall t \geq 0$ . + +Proof. According to Lemma E.7, there exists some $\delta \geq \frac{\tilde{w}_0 L^2}{24}$ such that + +$$ +F (w _ {0}) \leq F (0) - \delta +$$ + +Additionally, Lemma E.7, which utilizes a modified proof of Theorem 5.2 of Vardi et al. (2021), ensures that + +$$ +F (u _ {t + 1}) \leq F (0) - \delta , \forall t \geq 0 +$$ + +For the sake of contradiction, we suppose that for some $t \geq 0$ , $\mathcal{O}_{\epsilon}(u_{t+1}) = \text{True}$ , or equivalently, that + +$$ +\sup_{x\in [-L,L]\times \{1\}}u_{t + 1}^{\top}x\leq \epsilon +$$ + +Then according to Lemma E.8, + +$$ +F (u _ {t + 1}) \geq F (0) - \frac {\tilde {v} L \epsilon}{2} +$$ + +However, we note that + +$$ +\begin{array}{l} \frac {\tilde {w} _ {0} L ^ {2}}{2 4} \geq \frac {\tilde {w} _ {\min } L ^ {2}}{2 4} \\ > \frac {\tilde {v} L}{2} \epsilon \quad \text {b y} \tag {19} \\ \end{array} +$$ + +Then we have that + +$$ +\begin{array}{l} - \frac {\tilde {w} _ {0} L ^ {2}}{2 4} \geq F (u _ {t + 1}) - F (0) \\ \geq - \frac {\tilde {v} L}{2} \epsilon \\ > - \frac {\tilde {w} _ {0} L ^ {2}}{2 4} \\ \end{array} +$$ + +which is a contradiction. Therefore, it must follow that $\forall t\geq 0,\mathcal{O}_{\epsilon}(u_{t + 1}) = \mathrm{False}$ + +![](images/f2fc3ee4c461a19a68409bd2489c42c9ad8875b2fec9e1d5ef0b9cb77520cf0e.jpg) + +# E.2.6 PROOF OF THEOREM E.2 + +Theorem E.3 (Restatement of Theorem E.2). Suppose that $x$ is sampled according to $x \sim \mathrm{Uniform}(-L, L) \times \{1\} \subseteq \mathbb{R}^2$ and the target parameters $v = (\tilde{v}, b_v)$ satisfy $\tilde{v} \in [1, \tilde{v}_{\max}]$ and $-\frac{L}{6} \leq b_v \leq 0$ , where we denote $v_{\max} = (\tilde{v}_{\max}, -\frac{L}{6})$ . Let $\epsilon > 0$ be a reset threshold and suppose that the initial parameters $w_0$ are sampled uniformly from $\tilde{w}_0 \sim [-1, -\tilde{w}_{\min}) \cup (\tilde{w}_{\min}, 1]$ and $b_{w_0} = 0$ such that + +$$ +\tilde {w} _ {\mathrm {m i n}} > \frac {1 2 \tilde {v} \epsilon}{L} +$$ + +and + +$$ +3 (L - z) \geq \frac {\epsilon}{\bar {v}}. +$$ + +Then gradient descent with a constant learning rate of + +$$ +\eta \leq \frac {\tilde {w} _ {\mathrm {m i n}} ^ {3} L ^ {6}}{3 \cdot 1 2 ^ {2} \cdot 2 4 ^ {3} (2 + | | v _ {\mathrm {m a x}} | |) ^ {5} (L ^ {2} + 1) ^ {6}} +$$ + +and with resets, i.e. (8) and (9), attains an average regret of + +$$ +\frac {1}{T} \mathbb {E} [ R _ {T} ] \leq \frac {C}{T} +$$ + +where + +$$ +C = \lceil \frac {3 2 L ^ {2} F ((- 1 , 0))}{\eta \epsilon^ {4}} \rceil F ((- 1, 0)) + \frac {3}{2 \eta^ {2}} \left((\tilde {v} _ {\mathrm {m a x}} - \tilde {w} _ {\mathrm {m i n}}) ^ {2}) + (\frac {L}{6}) ^ {2}\right) +$$ + +Proof. In order to apply Lemmas E.5, E.7, and E.9 we verify that + +$$ +\eta \leq \frac {1}{L ^ {2} + 1} \tag {20} +$$ + +and + +$$ +\eta \leq \frac {\gamma}{\left(L ^ {2} + 1\right) ^ {2}} \tag {21} +$$ + +where $\gamma = \frac{\delta^3}{3\cdot 12^2(||w_0|| + ||v|| + 1)^5(L^2 + 1)^4}$ and $\delta \geq \frac{\tilde{w}_0L^2}{24}$ and where $w_{0}$ is an arbitrary (re)initialization of $w$ given the prior distribution. For (20) we note that $\tilde{w}_{\mathrm{min}}\leq 1\leq 3\cdot 12^{2}\cdot 24^{3},(2 + ||v_{\mathrm{max}}||)$ and so + +$$ +\begin{array}{l} \eta = \frac {\tilde {w} _ {\mathrm {m i n}} ^ {3} L ^ {6}}{3 \cdot 1 2 ^ {2} \cdot 2 4 ^ {3} (2 + | | v _ {\mathrm {m a x}} | |) ^ {5} (L ^ {2} + 1) ^ {6}} \\ \leq \frac {L ^ {6}}{(L ^ {2} + 1) ^ {6}} \\ \leq \frac {(L ^ {2} + 1) ^ {3}}{(L ^ {2} + 1) ^ {6}} \\ = \frac {1}{(L ^ {2} + 1) ^ {3}} \\ \leq \frac {1}{L ^ {2} + 1} \\ \end{array} +$$ + +As for (21) we proceed as follows + +$$ +\begin{array}{l} \eta = \frac {\tilde {w} _ {\mathrm {m i n}} ^ {3} L ^ {6}}{3 \cdot 1 2 ^ {2} \cdot 2 4 ^ {3} (2 + | | v _ {\mathrm {m a x}} | |) ^ {5} (L ^ {2} + 1) ^ {6}} \\ \leq \frac {\tilde {w} _ {0} ^ {3} L ^ {6}}{3 \cdot 1 2 ^ {2} \cdot 2 4 ^ {3} (| | w _ {0} | | + | | v | | + 1) ^ {5} (L ^ {2} + 1) ^ {6}} \\ \leq \frac {\delta^ {3}}{3 \cdot 1 2 ^ {2} \left(\left| \left| w _ {0} \right| \right| + \left| \left| v \right| \right| + 1\right) ^ {5} \left(L ^ {2} + 1\right) ^ {6}} \quad \text {b y} \delta \geq \frac {\tilde {w} _ {0} L ^ {2}}{2 4} \\ = \frac {\gamma}{(L ^ {2} + 1) ^ {2}} \\ \end{array} +$$ + +We continue by upper bounding the regret as follows + +$$ +\mathbb {E} [ R _ {T} ] \leq \sum_ {r = 0} ^ {\infty} \mathbb {E} [ R _ {T} | r \text {r e s e t s o c c u r} ] +$$ + +By Lemma E.5 and Lemma E.9 and the choice of learning rate $\eta$ , we only ever reset if $\tilde{w}_t$ is (re)initialized such that $\tilde{w}_t < 0$ . Conversely, if we (re)initialize the parameters such that $\tilde{w}_t > 0$ then we never reset for subsequent gradient descent updates. Additionally, since $w_t$ is reinitialized by an independent draw from its initial distribution, then for any particular reset count $r$ we have that + +$$ +\mathbb {P} (r \text {r e s e t s o c c u r}) = \mathbb {P} (\tilde {w} _ {0} < 0) ^ {r} \cdot \mathbb {P} (\tilde {w} _ {0} > 0) = \frac {1}{2 ^ {r + 1}} +$$ + +Where $\mathbb{P}(\tilde{w}_0 < 0) = \mathbb{P}(\tilde{w}_0 > 0) = \frac{1}{2}$ by the fact $\tilde{w}_0$ is sampled uniformly from $[-1, -\tilde{w}_{\min}) \cup (\tilde{w}_{\min}, 1]$ . Hence, we have that + +$$ +\mathbb {E} \left[ R _ {T} | r \text {r e s e t s o c c u r} \right] \leq \mathbb {P} (r \text {r e s e t s o c c u r}) \left(r M _ {-} + M _ {+}\right) = \frac {1}{2 ^ {r + 1}} \left(r M _ {-} + M _ {+}\right) \tag {22} +$$ + +Where $M_{-}$ is an upper bound on the total loss during any period of consecutive time steps $t$ to $t'$ such that $w_{t}$ is a (re)initialization of $w$ such that $\tilde{w}_{t} < 0$ and $t'$ is the earliest reset after $t$ . While $M_{+}$ is an upper bound on the total loss for time periods after and including $t$ where $w_{t}$ is a (re)initialization of $w$ such that $\tilde{w}_{t} > 0$ . + +By the choice of learning rate $\eta$ and Lemma E.5, if $w$ is (re)initialized such that $\tilde{w}_t < 0$ then within $T_{\mathrm{reset}} \leq \lceil \frac{32L^2F((-1,0))}{\eta\epsilon^4} \rceil$ gradient descent updates $w$ is reset. Moreover, the loss $F(w_{t'})$ is at most $F((-1,0))$ for time steps $t'$ preceding a reset of $w$ as loss is maximized at $w_t = (-1,0)$ over initializations and choosing learning rate $\eta$ at most $\frac{1}{L^2 + 1}$ , the Lipschitz constant of $\nabla F$ (Lemma E.3), guarantees that loss never exceeds $F((-1,0))$ . Thus, + +$$ +M _ {-} \leq T _ {\text {r e s e t}} F ((- 1, 0)) \tag {23} +$$ + +As for $M_{+}$ we can construct the following upper bound + +$$ +\begin{array}{l} M _ {+} \leq \mathbb {E} _ {w _ {0}} [ \sum_ {t = 0} ^ {\infty} F (w _ {t}) | \tilde {w} _ {0} > 0 ] \\ \leq \sum_ {t = 0} ^ {\infty} \left(L ^ {2} + 1\right) \left(1 - \eta \gamma\right) ^ {t} \mathbb {E} _ {w _ {0}} \left[ \left| \left| w _ {0} - v \right| \right| ^ {2} \mid \tilde {w} _ {0} > 0 \right] \quad \text {b y} \\ = \frac {L ^ {2} + 1}{\eta \gamma} \mathbb {E} _ {w _ {0}} [ | | w _ {0} - v | | ^ {2} | \tilde {w} _ {0} > 0 ] \quad \text {b y} \\ \leq \frac {1}{\eta \gamma} \left(L ^ {2} + 1\right) \left(\left(\tilde {v} _ {\max } - \tilde {w} _ {\min }\right) ^ {2} + \left(\frac {L}{6}\right) ^ {2}\right) \quad \text {b y} \\ \leq \frac {1}{\eta^ {2}} \left(\left(\tilde {v} _ {\max } - \tilde {w} _ {\min }\right) ^ {2} + \left(\frac {L}{6}\right) ^ {2}\right) \quad \text {b y} \eta \leq \frac {\gamma}{L ^ {2} + 1} \\ \end{array} +$$ + +Where the use of the geometric series in the third line above is valid by + +$$ +\eta \gamma < 1 +$$ + +by the assumptions on $\eta$ and $\gamma$ . Then returning to our goal of bounding the average regret, we observe that + +$$ +\begin{array}{l} \mathbb {E} \left[ R _ {T} \right] \leq \sum_ {r = 0} ^ {\infty} \mathbb {E} \left[ R _ {T} | r \text {r e s e t s o c c u r} \right] \\ \leq \sum_ {r = 0} ^ {\infty} \frac {1}{2 ^ {r + 1}} \left(r M _ {-} + M _ {+}\right) \tag {22} \\ = \frac {1}{2} M _ {+} + \left(M _ {-} + M _ {+}\right) \sum_ {r = 0} ^ {\infty} \frac {r}{2 ^ {r + 1}} \\ = \frac {1}{2} M _ {+} + \left(M _ {-} + M _ {+}\right) \quad \text {b y} \\ = M _ {-} + \frac {3}{2} M _ {+} \\ \end{array} +$$ + +Then defining $C = M_{-} + \frac{3}{2} M_{+}$ , we have the desired result of + +$$ +\frac {1}{T} \mathbb {E} [ R _ {T} ] \leq \frac {C}{T} +$$ \ No newline at end of file diff --git a/ICLR/2025/Self-Normalized Resets for Plasticity in Continual Learning/images.zip b/ICLR/2025/Self-Normalized Resets for Plasticity in Continual Learning/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..2d009ea4309c7b498192c69e66349d1668fa315a --- /dev/null +++ b/ICLR/2025/Self-Normalized Resets for Plasticity in Continual Learning/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7d11b68ca540236afea3ed73408268302c5aa75336c05dd36a188b2b4356c22c +size 3196635 diff --git a/ICLR/2025/Self-Normalized Resets for Plasticity in Continual Learning/layout.json b/ICLR/2025/Self-Normalized Resets for Plasticity in Continual Learning/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..05fe90a298da5817bf5f744007455eb2bfdd9ab3 --- /dev/null +++ b/ICLR/2025/Self-Normalized Resets for Plasticity in Continual Learning/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c05db57f8e0639ca09b8068d4bc7d3fbb760f2b99579b758d30e74db8b5fa6c5 +size 1278015 diff --git a/ICLR/2025/Self-Play Preference Optimization for Language Model Alignment/6e0d8cc4-5346-46fc-98b3-fbeb5f411d87_content_list.json b/ICLR/2025/Self-Play Preference Optimization for Language Model Alignment/6e0d8cc4-5346-46fc-98b3-fbeb5f411d87_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..41725531b93db4ac7203741f71cd6d77dae7fcd3 --- /dev/null +++ b/ICLR/2025/Self-Play Preference Optimization for Language Model Alignment/6e0d8cc4-5346-46fc-98b3-fbeb5f411d87_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f4f167384ddf2e9c6e0b1d7c4fb1952da97ee989c07c3325544ec12a270fe4d1 +size 175155 diff --git a/ICLR/2025/Self-Play Preference Optimization for Language Model Alignment/6e0d8cc4-5346-46fc-98b3-fbeb5f411d87_model.json b/ICLR/2025/Self-Play Preference Optimization for Language Model Alignment/6e0d8cc4-5346-46fc-98b3-fbeb5f411d87_model.json new file mode 100644 index 0000000000000000000000000000000000000000..82ce8cd5f5e8a769724a12f19ace831e6d2b9479 --- /dev/null +++ b/ICLR/2025/Self-Play Preference Optimization for Language Model Alignment/6e0d8cc4-5346-46fc-98b3-fbeb5f411d87_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ebfbacca731d8095ae56ebb410e62d0f44d65a3a04e55ad4ae1ff633a93d689a +size 207177 diff --git a/ICLR/2025/Self-Play Preference Optimization for Language Model Alignment/6e0d8cc4-5346-46fc-98b3-fbeb5f411d87_origin.pdf b/ICLR/2025/Self-Play Preference Optimization for Language Model Alignment/6e0d8cc4-5346-46fc-98b3-fbeb5f411d87_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..5c1c4b4542ed4b5857f0255248e99648e592bb62 --- /dev/null +++ b/ICLR/2025/Self-Play Preference Optimization for Language Model Alignment/6e0d8cc4-5346-46fc-98b3-fbeb5f411d87_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:31ff25400b157b17356f8de15118806119ee93f810281e1594c7b3556936efbd +size 704792 diff --git a/ICLR/2025/Self-Play Preference Optimization for Language Model Alignment/full.md b/ICLR/2025/Self-Play Preference Optimization for Language Model Alignment/full.md new file mode 100644 index 0000000000000000000000000000000000000000..b900d049a7515ab5f0cf83cba8f4eab30c164d9f --- /dev/null +++ b/ICLR/2025/Self-Play Preference Optimization for Language Model Alignment/full.md @@ -0,0 +1,701 @@ +# SELF-PLAY PREFERENCE OPTIMIZATION FOR LANGUAGE MODEL ALIGNMENT + +Yue $\mathbf{W}\mathbf{u}^{1*}$ , Zhiqing Sun $^{2*}$ , Huizhuo Yuan $^{1*}$ , Kaixuan Ji $^{1}$ , Yiming Yang $^{2}$ , Quanquan Gu $^{1\dagger}$ + +1Department of Computer Science, University of California, Los Angeles + +$^{2}$ Language Technologies Institute, Carnegie Mellon University + +{ywu,hzyuan, qgu}@cs.ucla.edu,{zhiqings,yiming}@cs.cmu.edu + +# ABSTRACT + +Standard reinforcement learning from human feedback (RLHF) approaches relying on parametric models like the Bradley-Terry model fall short in capturing the intransitivity and irrationality in human preferences. Recent advancements suggest that directly working with preference probabilities can yield a more accurate reflection of human preferences, enabling more flexible and accurate language model alignment. In this paper, we propose a self-play-based method for language model alignment, which treats the problem as a constant-sum two-player game aimed at identifying the Nash equilibrium policy. Our approach, dubbed Self-Play Preference Optimization (SPPO), utilizes iterative policy updates to provably approximate the Nash equilibrium. Additionally, we propose a new SPPO objective which is both strongly motivated by theory and is simple and effective in practice. In our experiments, using only 60k prompts (without responses) from the UltraFeedback dataset and without any prompt augmentation, by leveraging a pre-trained preference model PairRM with only 0.4B parameters, SPPO can obtain a model from fine-tuning Mistral-7B-Instruct-v0.2 that achieves the state-of-the-art length-controlled win-rate of $28.53\%$ against GPT-4-Turbo on AlpacaEval 2.0. It also outperforms the (iterative) DPO and IPO on MT-Bench, Arena-Hard, and the Open LLM Leaderboard. Starting from a stronger base model Llama-3-8B-Instruct, we are able to achieve a length-controlled win rate of $38.77\%$ . Notably, the strong performance of SPPO is achieved without additional external supervision (e.g., responses, preferences, etc.) from GPT-4 or other stronger language models. + +# 1 INTRODUCTION + +Large Language Models (LLMs) (e.g., Ouyang et al., 2022; OpenAI et al., 2023), have shown remarkable capabilities in producing human-like text, fielding questions, and coding. Despite their advancements, these models encounter challenges in tasks requiring high levels of reliability, safety, and ethical alignment. To address these challenges, Reinforcement Learning from Human Feedback (RLHF), also known as Preference-based Reinforcement Learning (PbRL), presents a promising solution. This framework for policy optimization, highlighted in works by Christiano et al. (2017) and recently in Ouyang et al. (2022), has led to significant empirical success in fine-tuning instruction-following LLMs, making them more aligned with human preferences and thus more helpful. + +Most existing approaches to RLHF rely on either explicit or implicit reward models. Taking InstructGPT (Ouyang et al., 2022) as an example, a reference policy $\pi_{\mathrm{ref}}$ is first established, typically from supervised pre-training or instruction-based (supervised) fine-tuning. An explicit reward function is obtained by training a reward model based on human preference feedback data, employing the Bradley-Terry (BT) model (Bradley & Terry, 1952). Subsequently, reinforcement learning algorithms such as Proximal Policy Optimization (Schulman et al., 2017, PPO) are used to fine-tune the reference LLM $\pi_{\mathrm{ref}}$ by maximizing the reward function. The reward model provides a "reward score" $r(\mathbf{y};\mathbf{x})$ for the given response $\mathbf{y}$ and prompt $\mathbf{x}$ , approximately reflecting how humans value these responses. More recently, methods like Direct Preference Optimization (Rafailov et al., 2024b, DPO) have been introduced. These methods forgo the training of a separate reward model but still + +fundamentally adhere to the reward maximization objective and are determined by parametric models such as the BT model. + +These models presuppose a monotonous and transitive relationship among preferences for different choices. However, empirical evidence suggests otherwise. For instance, Tversky (1969) observed human decisions can be influenced by different factors and exhibit inconsistency. Such observations indicate that human preferences do not always adhere to a single, value-based hierarchy and can even appear irrational, such as exhibiting loops in preference relations. For LLMs, another motivating evidence is that Munos et al. (2023) has empirically shown that directly predicting the pairwise preference can achieve higher accuracy than predicting the preference via a BT-based reward model. To address the inconsistency in human preference, researchers have proposed to work directly with the preference probability and design algorithms that can more flexibly represent human preferences (Lou et al., 2022; Wu et al., 2023) in the ranking or bandit setting. Recently, an emerging line of work (Wang et al., 2024; Munos et al., 2023; Swamy et al., 2024) also proposed to study RLHF for LLMs under such general preference $\mathbb{P}(\mathbf{y}\succ \mathbf{y}'|\mathbf{x})$ , where $\mathbf{y}$ and $\mathbf{y}'$ are two different responses and $\mathbf{x}$ is prompt. The goal is to identify the Nash equilibrium or von Neumann winner of the two-player constant-sum game + +$$ +(\pi^ {*}, \pi^ {*}) = \arg \max _ {\pi} \min _ {\pi^ {\prime}} \mathbb {E} _ {\mathbf {x} \sim \mathcal {X}} \left[ \mathbb {E} _ {\mathbf {y} \sim \pi (\cdot | \mathbf {x}), \mathbf {y} ^ {\prime} \sim \pi^ {\prime} (\cdot | \mathbf {x})} \left[ \mathbb {P} (\mathbf {y} \succ \mathbf {y} ^ {\prime} | \mathbf {x}) \right] \right], +$$ + +where each player is an LLM that outputs responses and aims to maximize its probability of being preferred over its opponent. + +Independent from our work, Swamy et al. (2024) proposed Self-play Preference Optimization $(\mathrm{SPO})^{1}$ for the same (unregularized) two-player constant-sum game. They provide a general reduction of preference optimization to no-regret online learning for the multi-step Markov Decision Process. When constrained to the bandit setting for LLMs, their proposed algorithmic framework reduces to the famous Hedge algorithm (Freund & Schapire, 1997), which admits the exponential update rule as described in (3.1). To approximately solve the exponential update, Swamy et al. (2024) then proposed to employ typical policy optimization algorithms such as Proximal Policy Optimization (PPO) (Schulman et al., 2017) or Soft Actor-Critic (SAC) (Haarnoja et al., 2018) to maximize the win rate against the reference policy and evaluated the performance of their self-play algorithms in robotic and game tasks. However, it typically requires more effort to apply PPO or SAC to large-scale fine-tuning of LLM and make them work stably. Therefore, it remains unclear how their self-play framework can be applied to large-scale language model alignment efficiently. In this paper, motivated by these developments mentioned above, we propose a new self-play algorithm that (1) enjoys provable guarantees to solve the two-player constant-sum game; and (2) can scale up to large-scale efficient fine-tuning of large language models. In detail, we formulate the RLHF problem as a constant-sum two-player game. Our objective is to identify the Nash equilibrium policy, which consistently provides preferred responses over any other policy on average. To identify the Nash equilibrium policy approximately, we adopt the classic online adaptive algorithm with multiplicative weights (Freund & Schapire, 1999) as a high-level framework that solves the two-player game. Further, each step of the high-level framework can be approximated by a self-play mechanism, where in each iteration the policy is playing against itself in the previous iteration by fine-tuning it on synthetic data that are generated by the policy and annotated by the preference model. + +Our contributions are highlighted as follows: + +- Starting from the exponential weight update algorithm which provably converges to the Nash equilibrium of the two-player constant-sum game, we propose the Self-Play Preference Optimization (SPPO) algorithm for large language model alignment. The algorithm converges to an approximate Nash equilibrium provably and admits a simple form of loss function for easy optimization. +- Unlike the symmetric pairwise loss such as DPO and Identity Preference Optimization (IPO) (Azar et al., 2023), we propose a new optimization objective that does not rely on pairwise comparisons. The new loss objective (3.4), initially driven by game-theoretical concepts, turns out strongly motivated by the policy gradient theory and implicitly encourages the LLM to learn a token-level optimal value function. + +- Empirically, SPPO significantly enhances the well-aligned Mistral-7B-Instruct-v0.2 and Llama-3-8B-Instruct model, achieving an increase of over $11\%$ on the length-controlled win rate against GPT-4-Turbo on the AlpacaEval 2.0 (Dubois et al., 2024a) test set. Additionally, SPPO exhibits strong generalist abilities across different tasks, including MT-Bench, the Open LLM Leaderboard, and the more recent, more challenging benchmark, Arena-Hard. Unlike iterative DPO/IPO, which tends to show performance decay on other benchmarks when optimized towards the PairRM score, SPPO's performance gain is consistent. Notably, all the strong performances are achieved without external supervision (e.g., responses, preferences, etc.) from GPT-4 or other stronger language models. + +Concurrent to our work, several studies, including Direct Nash Optimization (Rosset et al., 2024) and REBEL (Gao et al., 2024) have also explored using either cross-entropy loss or square loss minimization to approximate the exponential update. Specifically, they used the same trick proposed in DPO (Rafailov et al., 2024b) to cancel out the log-partition factor and directly regress on the win-rate difference. However, it is shown theoretically and empirically by Pal et al. (2024) that the pairwise loss may only drive the relative likelihood gap to be large, but may not necessarily drive up the likelihood of the preferred responses. Our method instead has a deeper connection to the policy gradient theory and can effectively match the likelihood of the response to its win rate. We postpone the detailed discussion of related works to Appendix A. + +# 2 PRELIMINARIES + +We consider the preference learning scenario as follows. Given a text sequence (commonly referred to as prompt) $\mathbf{x} = [x_1, x_2, \ldots]$ , two text sequences $\mathbf{y} = [y_1, y_2, \ldots]$ and $\mathbf{y}'$ are generated as responses to the prompt $\mathbf{x}$ . An autoregressive language model $\pi$ given the prompt $\mathbf{x}$ can generate responses $\mathbf{y}$ following the probability decomposition + +$$ +\pi (\mathbf {y} | \mathbf {x}) = \prod_ {i = 1} ^ {N} \pi (y _ {i} | \mathbf {x}, \mathbf {y} _ {< i}). +$$ + +Given the prompt $\mathbf{x}$ and two responses $\mathbf{y}$ and $\mathbf{y}'$ , a preference oracle (either a human annotator or a language model) will provide preference feedback $o(\mathbf{y} \succ \mathbf{y}'|\mathbf{x}) \in \{0,1\}$ indicating whether $\mathbf{y}$ is preferred over $\mathbf{y}'$ . We denote $\mathbb{P}(\mathbf{y} \succ \mathbf{y}'|\mathbf{x}) = \mathbb{E}[o(\mathbf{y} \succ \mathbf{y}'|\mathbf{x})]$ as the probability of $\mathbf{y}$ "winning the duel" over $\mathbf{y}'$ . The KL divergence of two probability distributions of density $p$ and $q$ is defined as $\mathrm{KL}(p\| q) = \mathbb{E}_{\mathbf{y} \sim p(\mathbf{y})}\left[\log \frac{p(\mathbf{y})}{q(\mathbf{y})}\right]$ . + +# 2.1 RLHF WITH REWARD MODELS + +Christiano et al. (2017) first learn a reward function $r(\mathbf{y};\mathbf{x})$ following the Bradley-Terry model (Bradley & Terry, 1952). For a prompt-response-response triplet $(\mathbf{x},\mathbf{y},\mathbf{y}^{\prime})$ , the Bradley-Terry model specifies the probability of $\mathbf{y}$ being chosen over $\mathbf{y}$ as + +$$ +\mathbb {P} (\mathbf {y} \succ \mathbf {y} ^ {\prime} | \mathbf {x}) = \frac {\exp (r (\mathbf {y} ; \mathbf {x}))}{\exp (r (\mathbf {y} ; \mathbf {x})) + \exp (r (\mathbf {y} ^ {\prime} ; \mathbf {x}))} = \sigma \left(r (\mathbf {y}; \mathbf {x}) - r (\mathbf {y} ^ {\prime}; \mathbf {x})\right), \tag {2.1} +$$ + +where $\sigma(x) = e^x / (e^x + 1)$ is the logistic function. The reward function associated with the Bradley-Terry model can be estimated by maximizing the log-likelihood $\log \mathbb{P}(\mathbf{y} \succ \mathbf{y}'|\mathbf{x})$ . Suppose the true reward function $r(\mathbf{y}; \mathbf{x})$ is available, Christiano et al. (2017) proposed to solve the following optimization problem with policy optimization algorithms in RL such as PPO (Schulman et al., 2017): + +$$ +\max _ {\boldsymbol {\theta}} \mathbb {E} _ {\mathbf {x} \sim \mathcal {X}, \mathbf {y} \sim \pi_ {\boldsymbol {\theta}} (\cdot | \mathbf {x})} [ r (\mathbf {y}; \mathbf {x}) ] - \eta^ {- 1} \mathbb {E} _ {\mathbf {x} \sim \mathcal {X}} [ \mathrm {K L} \left(\pi_ {\boldsymbol {\theta}} (\cdot | \mathbf {x}) \| \pi_ {\operatorname {r e f}} (\cdot | \mathbf {x})\right) ], \tag {2.2} +$$ + +where $\mathcal{X}$ is the prompt distribution. + +Rafailov et al. (2024b) identified that the optimization problem above has a closed-form solution such that for any $\mathbf{y}$ , + +$$ +\pi^ {*} (\mathbf {y} | \mathbf {x}) \propto \pi_ {\mathrm {r e f}} (\mathbf {y} | \mathbf {x}) \exp (\eta r (\mathbf {y}; \mathbf {x})), +$$ + +which can be further converted to the DPO loss for any triplet $(\mathbf{x},\mathbf{y}_w,\mathbf{y}_l)$ where the winner $\mathbf{y}_w$ is chosen over the loser $\mathbf{y}_l$ : + +$$ +\ell_ {\mathrm {D P O}} (\mathbf {x}, \mathbf {y} _ {w}, \mathbf {y} _ {l}; \boldsymbol {\theta}; \pi_ {\mathrm {r e f}}) := - \log \sigma \left(\eta^ {- 1} \left[ \log \left(\frac {\pi_ {\boldsymbol {\theta}} (\mathbf {y} _ {w} | \mathbf {x})}{\pi_ {\mathrm {r e f}} (\mathbf {y} _ {w} | \mathbf {x})}\right) - \log \left(\frac {\pi_ {\boldsymbol {\theta}} (\mathbf {y} _ {l} | \mathbf {x})}{\pi_ {\mathrm {r e f}} (\mathbf {y} _ {l} | \mathbf {x})}\right) \right]\right). +$$ + +# 2.2 RLHF WITH GENERAL PREFERENCE + +Following Wang et al. (2024); Munos et al. (2023), we aim to establish RLHF methods without a reward model, as the human preference can be non-transitive (Tversky, 1969). Under a general preference oracle $\mathbb{P}(\mathbf{y}\succ \mathbf{y}'|\mathbf{x})$ , we follow Dudík et al. (2015) and aim to identify the von Neumann winner. More specifically, the von Neumann winner $\pi^{*}$ is the (symmetric) Nash equilibrium of the following two-player constant-sum game: + +$$ +\left(\pi^ {*}, \pi^ {*}\right) = \arg \max _ {\pi} \min _ {\pi^ {\prime}} \mathbb {E} _ {\mathbf {x} \sim \mathcal {X}} \left[ \mathbb {E} _ {\mathbf {y} \sim \pi (\cdot | \mathbf {x}), \mathbf {y} ^ {\prime} \sim \pi^ {\prime} (\cdot | \mathbf {x})} \left[ \mathbb {P} (\mathbf {y} \succ \mathbf {y} ^ {\prime} | \mathbf {x}) \right] \right]. \tag {2.3} +$$ + +In addition, we define the winning probability of one response $\mathbf{y}$ against a distribution of responses $\pi$ as + +$$ +\mathbb {P} (\mathbf {y} \succ \pi | \mathbf {x}) = \mathbb {E} _ {\mathbf {y} ^ {\prime} \sim \pi (\cdot | \mathbf {x})} [ \mathbb {P} (\mathbf {y} \succ \mathbf {y} ^ {\prime} | \mathbf {x}) ], +$$ + +and the winning probability of one policy $\pi$ against another policy $\pi'$ as + +$$ +\mathbb {P} (\pi \succ \pi^ {\prime} | \mathbf {x}) = \mathbb {E} _ {\mathbf {y} \sim \pi (\cdot | \mathbf {x})} \mathbb {E} _ {\mathbf {y} ^ {\prime} \sim \pi^ {\prime} (\cdot | \mathbf {x})} [ \mathbb {P} (\mathbf {y} \succ \mathbf {y} ^ {\prime} | \mathbf {x}) ]. +$$ + +Furthermore, we define $\mathbb{P}(\pi \succ \pi') = \mathbb{E}_{\mathbf{x} \sim \mathcal{X}}[\mathbb{P}(\pi \succ \pi'|\mathbf{x})]$ , where $\mathbf{x}$ is a prompt drawn from the prompt distribution $\mathcal{X}$ . The two-player constant-sum game (2.3) can be simplified as + +$$ +(\pi^ {*}, \pi^ {*}) = \arg \max _ {\pi} \min _ {\pi^ {\prime}} \mathbb {P} (\pi \succ \pi^ {\prime}). +$$ + +# 3 SELF-PLAY PREFERENCE OPTIMIZATION (SPPO) + +In this section, we introduce the Self-Play Preference Optimization (SPPO) algorithm, derived from the following theoretical framework. + +# 3.1 THEORETICAL FRAMEWORK + +There are well-known algorithms to approximately solve the Nash equilibrium in a constant-sum two-player game. In this work, we follow Freund & Schapire (1999) to establish an iterative framework that can asymptotically converge to the optimal policy on average. We start with a theoretical framework that conceptually solves the two-player game as follows: + +$$ +\pi_ {t + 1} (\mathbf {y} | \mathbf {x}) \propto \pi_ {t} (\mathbf {y} | \mathbf {x}) \exp \left(\eta \mathbb {P} (\mathbf {y} \succ \pi_ {t} | \mathbf {x})\right), \text {f o r} t = 1, 2, \dots . \tag {3.1} +$$ + +(3.1) is an iterative framework that relies on the multiplicative weight update in each iteration $t$ and enjoys a clear structure. Initially, we have a base policy $\pi_1$ usually from some supervised fine-tuned model. In each iteration, the updated policy $\pi_{t+1}$ is obtained from the reference policy $\pi_t$ following the multiplicative weight update. More specifically, a response $y$ should have a higher probability weight if it has a higher average advantage over the current policy $\pi_t$ . + +Equivalently, (3.1) can be written as + +$$ +\pi_ {t + 1} (\mathbf {y} | \mathbf {x}) = \frac {\pi_ {t} (\mathbf {y} | \mathbf {x}) \exp \left(\eta \mathbb {P} (\mathbf {y} \succ \pi_ {t} | \mathbf {x})\right)}{Z _ {\pi_ {t}} (\mathbf {x})}, \tag {3.2} +$$ + +where $Z_{\pi_t}(\mathbf{x}) = \sum_{\mathbf{y}}\pi_t(\mathbf{y}|\mathbf{x})\exp \left(\eta \mathbb{P}(\mathbf{y}\succ \pi_t|\mathbf{x})\right)$ is the normalizing factor (a.k.a., the partition function). For any fixed $\mathbf{x}$ and $\mathbf{y}$ , the ideal update policy $\pi_{t + 1}$ should satisfy the following equation: + +$$ +\log \left(\frac {\pi_ {t + 1} (\mathbf {y} | \mathbf {x})}{\pi_ {t} (\mathbf {y} | \mathbf {x})}\right) = \eta \cdot \mathbb {P} (\mathbf {y} \succ \pi_ {t} | \mathbf {x}) - \log Z _ {\pi_ {t}} (\mathbf {x}). \tag {3.3} +$$ + +Unlike the pair-wise design in DPO or IPO that cancels the log normalizing factor $\log Z_{\pi_t}(\mathbf{x})$ by differentiating (3.3) between $\mathbf{y}$ and $\mathbf{y}'$ , we choose to approximate (3.3) directly in terms of $L_2$ distance: + +$$ +\pi_ {t + 1} = \underset {\pi} {\operatorname {a r g m i n}} \mathbb {E} _ {\mathbf {x} \sim \mathcal {X}, \mathbf {y} \sim \pi_ {t} (\cdot | \mathbf {x})} \left(\log \left(\frac {\pi (\mathbf {y} | \mathbf {x})}{\pi_ {t} (\mathbf {y} | \mathbf {x})}\right) - \left(\eta \mathbb {P} (\mathbf {y} \succ \pi_ {t} | \mathbf {x}) - \log Z _ {\pi_ {t}} (\mathbf {x})\right)\right) ^ {2}. \tag {3.4} +$$ + +Estimation of the Probability The optimization objective (3.4) can be approximated with finite samples. We choose to sample $K$ responses $\mathbf{y}_1, \mathbf{y}_2, \ldots, \mathbf{y}_K \sim \pi_t(\cdot|\mathbf{x})$ for each prompt $\mathbf{x}$ , and denote the empirical distribution by $\widehat{\pi}_t^K$ . The finite-sample optimization problem can be approximated as + +$$ +\pi_ {t + 1} = \underset {\pi} {\operatorname {a r g m i n}} \mathbb {E} _ {\mathbf {x} \sim \mathcal {X}, \mathbf {y} \sim \pi_ {t} (\cdot | \mathbf {x})} \left(\log \left(\frac {\pi (\mathbf {y} | \mathbf {x})}{\pi_ {t} (\mathbf {y} | \mathbf {x})}\right) - \left(\eta \mathbb {P} (\mathbf {y} \succ \widehat {\pi} _ {t} ^ {K} | \mathbf {x}) - \log Z _ {\widehat {\pi} _ {t} ^ {K}} (\mathbf {x})\right)\right) ^ {2}. \tag {3.5} +$$ + +Specifically, $\mathbb{P}(\mathbf{y} \succ \widehat{\pi}_t^K | \mathbf{x}) = \sum_{k=1}^K \mathbb{P}(\mathbf{y} \succ \mathbf{y}_k | \mathbf{x}) / K$ and $Z_{\widehat{\pi}_t^K}(\mathbf{x}) = \mathbb{E}_{\mathbf{y} \sim \pi_t(\cdot | \mathbf{x})}[\exp(\eta \mathbb{P}(\mathbf{y} \succ \widehat{\pi}_t^K | \mathbf{x}))]$ . $Z_{\widehat{\pi}_t^K}(\mathbf{x})$ , treated as an expectation, can be further estimated by $B$ new samples with in total $O(KB)$ queries of the preference oracle $\mathbb{P}$ . (3.5) is an efficiently tractable optimization problem. Informally speaking, when $K \to \infty$ , (3.5) will recover (3.4). We have the following guarantee on the convergence of (3.4): + +Theorem 3.1. Assume the optimization problem (3.4) is realizable. Denote $\pi_t$ as the policy obtained via (3.4) and the mixture policy $\bar{\pi}_T = \frac{1}{T}\sum_{t=1}^T\pi_t$ . By setting $\eta = \Theta(1/\sqrt{T})$ , we have that + +$$ +\max _ {\pi} \left[ \mathbb {P} (\pi \succ \bar {\pi} _ {T}) \right] - \min _ {\pi} \left[ \mathbb {P} (\pi \prec \bar {\pi} _ {T}) \right] = O (1 / \sqrt {T}). +$$ + +Theorem 3.1 characterizes the convergence rate of the average policy across the time horizon $T$ towards the Nash equilibrium, in terms of the duality gap. The proof is based on Theorem 1 in Freund & Schapire (1999) with slight modification. For completeness, we include the proof in Appendix F. + +Alternatively, we can avoid estimating $\log Z_{\widehat{\pi}_t^K}(\mathbf{x})$ by replacing it with a constant based on the human preference model. The choice of the constant is discussed in detail in Appendix E. Here, we replace $\log Z_{\widehat{\pi}_t^K}(\mathbf{x})$ with $\eta /2^2$ in (3.5) to obtain a more clear objective: + +$$ +\pi_ {t + 1} = \underset {\pi} {\operatorname {a r g m i n}} \mathbb {E} _ {\mathbf {x} \sim \mathcal {X}, \mathbf {y} \sim \pi_ {t (\cdot | \mathbf {x})}} \left(\log \left(\frac {\pi (\mathbf {y} | \mathbf {x})}{\pi_ {t} (\mathbf {y} | \mathbf {x})}\right) - \eta \left(\mathbb {P} (\mathbf {y} \succ \widehat {\pi} _ {t} ^ {K} | \mathbf {x}) - \frac {1}{2}\right)\right) ^ {2}. \tag {3.6} +$$ + +Intuitively, if a tie occurs (i.e., $\mathbb{P}(\mathbf{y}\succ \widehat{\pi}_t^K |\mathbf{x}) = 1 / 2$ ), we prefer the model does not update weight at $\mathbf{y}$ . If $\mathbf{y}$ wins over $\widehat{\pi}_t^K$ on average (i.e., $\mathbb{P}(\mathbf{y}\succ \widehat{\pi}_t^K |\mathbf{x}) > 1 / 2$ ), then we increase the probability density at $\mathbf{y}$ to employ the advantage of $\mathbf{y}$ over $\widehat{\pi}_t^K$ . In our experiments, we choose to minimize the objective (3.6). In Appendix B, we provide a detailed comparison between (3.6) and other loss functions such as DPO and IPO. + +# 3.2 THE SPPO ALGORITHM + +Based on the aforementioned theoretical framework, we propose the Self-Play Preference Optimization algorithm in Algorithm 1. + +# Algorithm 1 Self-Play Preference Optimization (SPPO) + +1: input: base policy $\pi_{\theta_1}$ , preference oracle $\mathbb{P}$ , learning rate $\eta$ , number of generated samples $K$ . +2: for $t = 1,2,\ldots$ do +3: Generate synthetic responses by sampling $\mathbf{x} \sim \mathcal{X}$ and $\mathbf{y}_{1:K} \sim \pi_t(\cdot|\mathbf{x})$ . +4: Annotate the win-rate $\mathbb{P}(\mathbf{y}_k\succ \mathbf{y}_{k'}|\mathbf{x}),\forall k,k'\in [K]$ +5: Select responses from $\mathbf{y}_{1:K}$ to form dataset $\mathcal{D}_t = \{(\mathbf{x}_i,\mathbf{y}_i,\widehat{P} (\mathbf{y}_i\succ \pi_t|\mathbf{x}_i))\}_{i\in [N]}$ . +6: Optimize $\pi_{\pmb{\theta}_{t + 1}}$ according to (3.6): + +$$ +\boldsymbol {\theta} _ {t + 1} \leftarrow \underset {\boldsymbol {\theta}} {\operatorname {a r g m i n}} \mathbb {E} _ {(\mathbf {x}, \mathbf {y}, \hat {P} (\mathbf {y} \succ \pi_ {t} | \mathbf {x})) \sim \mathcal {D} _ {t}} \left(\log \left(\frac {\pi_ {\boldsymbol {\theta}} (\mathbf {y} | \mathbf {x})}{\pi_ {t} (\mathbf {y} | \mathbf {x})}\right) - \eta \left(\hat {P} (\mathbf {y} \succ \pi_ {t} | \mathbf {x}) - \frac {1}{2}\right)\right) ^ {2}. \tag {3.7} +$$ + +# 7: end for + +In each iteration $t$ , Algorithm 1 will first generate $K$ responses $\mathbf{y}_1, \mathbf{y}_2, \dots, \mathbf{y}_K$ according to $\pi_t(\cdot|\mathbf{x})$ for each prompt $\mathbf{x}$ (Line 3). Then, the preference oracle $\mathbb{P}$ will be queried to calculate the win rate + +among the $K$ responses (Line 4). At Line 5, certain criteria can be applied to determine which response should be kept in the constructed dataset $\mathcal{D}_t$ and construct the prompt-response-probability triplet $(\mathbf{x},\mathbf{y},\widehat{P} (\mathbf{y}\succ \pi_t|\mathbf{x}))$ . We will discuss the design choices later in Section 4. One straightforward design choice is to include all $K$ responses into $\mathcal{D}_t$ and each $\widehat{P} (\mathbf{y}_i\succ \pi_t|\mathbf{x})$ is estimated by comparing $\mathbf{y}_i$ to all $K$ responses. In total, $O(K^2)$ queries will be made. Then the algorithm will optimize (3.6) on the dataset $\mathcal{D}_t$ (Line 6). + +# 3.3 CONNECTION TO POLICY GRADIENT + +While SPPO is derived from the iterative framework (Freund & Schapire, 1999) for two-player games, the square loss in the SPPO objective (3.4) provides an alternative interpretation for SPPO as a semi-online variant of policy gradient method due to its special loss form. The difference from standard policy gradient is that it collects samples from $\pi_{\theta_t}$ at the start of iteration $t$ , rather than perform on-policy sampling at each gradient step. + +Consider a general reward function $r(\mathbf{y};\mathbf{x})$ , the RLHF problem (2.2) can be written as: + +$$ +\max _ {\boldsymbol {\theta}} J (\boldsymbol {\theta}) := \mathbb {E} _ {\mathbf {x} \sim \mathcal {X}, \mathbf {y} \sim \pi_ {\boldsymbol {\theta}} (\cdot | \mathbf {x})} \left[ r (\mathbf {y}; \mathbf {x}) - \eta^ {- 1} \log \frac {\pi_ {\boldsymbol {\theta}} (\mathbf {y} | \mathbf {x})}{\pi_ {\mathrm {r e f}} (\mathbf {y} | \mathbf {x})} \right]. \tag {3.8} +$$ + +The policy gradient of the objective $J(\pmb{\theta})$ is: + +$$ +\begin{array}{l} \nabla J (\boldsymbol {\theta}) = \mathbb {E} _ {\mathbf {x} \sim \mathcal {X}, \mathbf {y} \sim \pi_ {\boldsymbol {\theta}} (\cdot | \mathbf {x})} \left[ \left(r (\mathbf {y}; \mathbf {x}) - \eta^ {- 1} \log \frac {\pi_ {\boldsymbol {\theta}} (\mathbf {y} | \mathbf {x})}{\pi_ {\mathrm {r e f}} (\mathbf {y} | \mathbf {x})} - b (\mathbf {x})\right) \nabla \log \pi_ {\boldsymbol {\theta}} (\mathbf {y} | \mathbf {x}) \right] (3.9) \\ = \frac {\eta}{2} \mathbb {E} _ {\mathbf {x} \sim \mathcal {X}, \mathbf {y} \sim \pi_ {\theta} (\cdot | \mathbf {x})} \left[ - \nabla \left(r (\mathbf {y}; \mathbf {x}) - \eta^ {- 1} \log \frac {\pi_ {\theta} (\mathbf {y} | \mathbf {x})}{\pi_ {\mathrm {r e f}} (\mathbf {y} | \mathbf {x})} - b (\mathbf {x})\right) ^ {2} \right], (3.10) \\ \end{array} +$$ + +where the first line follows the policy gradient theorem (Sutton et al., 1999) and the baseline $b(\mathbf{x})$ is an arbitrary constant relying only on $\mathbf{x}$ used for variance reduction3. Comparing the square loss (3.10) with the SPPO objective (3.4) (rewritten below): + +$$ +\pmb {\theta} _ {t + 1} = \underset {\pmb {\theta}} {\mathrm {a r g m i n}} \mathbb {E} _ {\mathbf {x} \sim \mathcal {X}, \mathbf {y} \sim \pi_ {\pmb {\theta} _ {t}} (\cdot | \mathbf {x})} \left[ \left(\mathbb {P} (\mathbf {y} \succ \pi_ {\pmb {\theta} _ {t}} | \mathbf {x}) - \eta^ {- 1} \log \left(\frac {\pi_ {\pmb {\theta}} (\mathbf {y} | \mathbf {x})}{\pi_ {\pmb {\theta} _ {t}} (\mathbf {y} | \mathbf {x})}\right) - \eta^ {- 1} \log Z _ {\pi_ {\pmb {\theta} _ {t}}} (\mathbf {x})\right) ^ {2} \right], +$$ + +one can see that the win rate $\mathbb{P}(\mathbf{y}\succ \pi_{\theta_t}|\mathbf{x})$ is exactly the reward SPPO aims to maximize, and $\eta^{-1}\log Z_{\pi_{\theta_t}}(\mathbf{x})$ is in fact the best possible baseline—the (soft) value function. When the value function is not available in practice, it can be replaced by any constant baseline to reduce the variance of the policy gradient. We choose $1 / 2$ as a good approximation to $\eta^{-1}\log Z_{\pi_{\theta_t}}(\mathbf{x})$ but the constant can vary depending on the human preference model (see Appendix E). + +Comparing with the general framework proposed by Swamy et al. (2024), SPPO can be seen as a new, straightforward variant of policy gradient method without the need of extra modifications such as gradient clipping in PPO, Hessian calculation in TRPO, or maintaining multiple components (Q-critic, V-critic, actor, etc.) in many policy optimization algorithms. + +# 3.4TOKEN-LEVEL $Q^{*}$ LEARNING + +Rafailov et al. (2024a) showed that under the Max-Entropy RL formulation, the token-level log-ratio $\log \frac{\pi_{\theta}(\mathbf{y}|\mathbf{x})}{\pi_{\mathrm{ref}}(\mathbf{y}|\mathbf{x})}$ can be seen as an implicit token-level reward or advantage function (invariant under reward shaping). Below we show the square loss in SPPO can also lead to the optimal Max-Entropy policy $\pi^{*}$ , with token-level optimal value/advantage function. + +We first briefly restate the setting and results in Rafailov et al. (2024b). The token-level MDP defines the state $\mathbf{s}_h = (\mathbf{x},y_1,y_2,\dots ,y_{h - 1})$ as the prefix tokens, and the action $\mathbf{a}_h = y_h$ as the next token. An auto-regressive language model $\pi (\mathbf{y}|\mathbf{x})$ can be viewed as a token-level policy $\pi (\mathbf{a}_h|\mathbf{s}_h)$ and the transition kernel is known and deterministic because it only concatenates the next token to the prefix to form a new token sequence $\mathbf{s}_{h + 1} = (\mathbf{x},y_1,y_2,\dots ,y_h)$ . + +The Max-Entropy RL setting again considers the reverse-KL regularized reward maximization problem (2.2): + +$$ +\max _ {\boldsymbol {\theta}} \mathbb {E} _ {\mathbf {x} \sim \mathcal {X}, \mathbf {y} \sim \pi_ {\boldsymbol {\theta}} (\cdot | \mathbf {x})} [ r (\mathbf {y}; \mathbf {x}) ] - \eta^ {- 1} \mathbb {E} _ {\mathbf {x} \sim \mathcal {X}} [ \mathrm {K L} (\pi_ {\boldsymbol {\theta}} (\cdot | \mathbf {x}) \| \pi_ {\mathrm {r e f}} (\cdot | \mathbf {x})) ] +$$ + +$$ += \mathbb {E} _ {\mathbf {x} \sim \mathcal {X}, \mathbf {y} \sim \pi_ {\boldsymbol {\theta}} (\cdot | \mathbf {x})} [ r (\mathbf {y}; \mathbf {x}) + \eta^ {- 1} \log \pi_ {\mathrm {r e f}} (\mathbf {y} | \mathbf {x}) ] + \eta^ {- 1} \mathbb {E} _ {\mathbf {x} \sim \mathcal {X}} [ \mathcal {H} (\pi_ {\boldsymbol {\theta}} (\cdot | \mathbf {x})) ]. +$$ + +We denote the optimal solution for the problem above as $\pi^{*}$ . Rafailov et al. (2024a) showed that the Bradley-Terry preference model (B.2) can be rewritten as: + +$$ +\mathbb {P} (\mathbf {y} _ {w} \succ \mathbf {y} _ {l} | \mathbf {x}) = \sigma \left(\eta^ {- 1} \sum_ {h = 1} ^ {| \mathbf {y} _ {w} |} \log \frac {\pi^ {*} (\mathbf {a} _ {h} ^ {w} | \mathbf {s} _ {h} ^ {w})}{\pi_ {\mathrm {r e f}} (\mathbf {a} _ {h} ^ {w} | \mathbf {s} _ {h} ^ {w})} - \eta^ {- 1} \sum_ {h = 1} ^ {| \mathbf {y} _ {l} |} \log \frac {\pi^ {*} (\mathbf {a} _ {h} ^ {l} | \mathbf {s} _ {h} ^ {l})}{\pi_ {\mathrm {r e f}} (\mathbf {a} _ {h} ^ {l} | \mathbf {s} _ {h} ^ {l})}\right), +$$ + +where the state and action is defined as in the token-level MDP introduced above, with superscription $(\cdot)^{w}$ and $(\cdot)^{l}$ denoting if it is for the winner $\mathbf{y}_w$ or the loser $\mathbf{y}_l$ . And maximizing the log likelihood with $\pi^{*}$ replaced by $\pi_{\theta}$ gives the DPO loss. + +From now on we assume the horizon is fixed at $H$ for simplicity. The derivation of the Max-Entropy RL formulation relies on the (soft) optimal value function $Q^{*}$ and $V^{*}$ as: + +$$ +V ^ {*} (\mathbf {s} _ {H + 1}) = r (\mathbf {s} _ {H + 1}) := r (\mathbf {y}; \mathbf {x}), (\text {r e w a r d a t E O S}) +$$ + +$$ +Q ^ {*} (\mathbf {s} _ {h}, \mathbf {a} _ {h}) = \eta^ {- 1} \log \pi_ {\mathrm {r e f}} (\mathbf {a} _ {h} | \mathbf {s} _ {h}) + V ^ {*} (\mathbf {s} _ {h + 1}), +$$ + +$$ +V ^ {*} (\mathbf {s} _ {h}) = \eta^ {- 1} \log \sum_ {\mathbf {a}} \exp \left(\eta Q ^ {*} (\mathbf {s} _ {h}, \mathbf {a})\right), \text {w h e n} h \leq H. +$$ + +Rafailov et al. (2024a) showed that the optimal policy $\pi^{*}$ satisfies: + +$$ +\begin{array}{l} \eta^ {- 1} \log \pi^ {*} (\mathbf {a} _ {h} | \mathbf {s} _ {h}) = Q ^ {*} (\mathbf {s} _ {h}, \mathbf {a} _ {h}) - V ^ {*} (\mathbf {s} _ {h}) \\ = \eta^ {- 1} \log \pi_ {\mathrm {r e f}} (\mathbf {a} _ {h} | \mathbf {s} _ {h}) + V ^ {*} (\mathbf {s} _ {h + 1}) - V ^ {*} (\mathbf {s} _ {h}). \\ \end{array} +$$ + +It can be verified that for $\mathbf{s}_1 = (\mathbf{x})$ , we have $\eta V^{*}(\mathbf{s}_{1}) = \log \sum_{\mathbf{y}}\pi_{\mathrm{ref}}(\mathbf{y}|\mathbf{x})\exp \left(\eta r(\mathbf{y};\mathbf{x})\right)$ . Going back to the SPPO objective (3.4) at $t$ -th iteration, if we set $\pi_{\mathrm{ref}} = \pi_t$ and $r(\mathbf{y};\mathbf{x}) = \mathbb{P}(\mathbf{y}\succ \pi_t|\mathbf{x})$ , we have $V^{*}(\mathbf{s}_{1}) = \eta^{-1}\log Z_{\pi_{t}}(\mathbf{x})$ , and the learning objective at $t$ -th iteration becomes: + +$$ +\begin{array}{l} \pi_ {t + 1} = \underset {\pi} {\operatorname {a r g m i n}} \mathbb {E} _ {\mathbf {x} \sim \mathcal {X}, \mathbf {y} \sim \pi_ {t} (\cdot | \mathbf {x})} \left(\log \left(\frac {\pi (\mathbf {y} | \mathbf {x})}{\pi_ {t} (\mathbf {y} | \mathbf {x})}\right) - \left(\eta \mathbb {P} (\mathbf {y} \succ \pi_ {t} | \mathbf {x}) - \log Z _ {\pi_ {t}} (\mathbf {x})\right)\right) ^ {2} \\ = \underset {\pi} {\operatorname {a r g m i n}} \mathbb {E} _ {\mathbf {s} _ {1} \sim \mathcal {X}, \mathbf {a} _ {h} \sim \pi_ {t} (\cdot | \mathbf {s} _ {h})} \left(\sum_ {h = 1} ^ {H} \log \frac {\pi \left(\mathbf {a} _ {h} \mid \mathbf {s} _ {h}\right)}{\pi^ {*} \left(\mathbf {a} _ {h} \mid \mathbf {s} _ {h}\right)}\right) ^ {2}. \tag {3.11} \\ \end{array} +$$ + +Similar to DPO, SPPO "secretly" encourages the policy $\pi_{\theta}$ to converge to the optimal policy $\pi^{*}$ at token level via the square loss form (3.11). Additionally, one may realize that minimizing the square-loss form is related to minimizing the KL divergence $\mathrm{KL}(\pi_{\theta}||\pi^{*})$ via policy gradient: + +$$ +\begin{array}{l} \nabla_ {\pmb {\theta}} \mathrm {K L} (\pi_ {\pmb {\theta}} \| \pi^ {*}) = \mathbb {E} _ {\mathbf {s} _ {1} \sim \mathcal {X}, \mathbf {a} _ {h} \sim \pi_ {\pmb {\theta}} (\cdot | \mathbf {s} _ {h})} \bigg [ \bigg (\sum_ {h = 1} ^ {H} \log \frac {\pi_ {\pmb {\theta}} (\mathbf {a} _ {h} | \mathbf {s} _ {h})}{\pi^ {*} (\mathbf {a} _ {h} | \mathbf {s} _ {h})} \bigg) \sum_ {h = 1} ^ {H} \nabla_ {\pmb {\theta}} \log \pi_ {\pmb {\theta}} (\mathbf {a} _ {h} | \mathbf {s} _ {h}) \bigg ] \\ = \mathbb {E} _ {\mathbf {s} _ {1} \sim \mathcal {X}, \mathbf {a} _ {h} \sim \pi_ {\boldsymbol {\theta}} (\cdot | \mathbf {s} _ {h})} \left[ \nabla_ {\boldsymbol {\theta}} \left(\sum_ {h = 1} ^ {H} \log \frac {\pi_ {\boldsymbol {\theta}} (\mathbf {a} _ {h} | \mathbf {s} _ {h})}{\pi^ {*} (\mathbf {a} _ {h} | \mathbf {s} _ {h})}\right) ^ {2} \right]. \\ \end{array} +$$ + +# 4 EXPERIMENTS + +# 4.1 EXPERIMENT SETUP + +We briefly summarize our experiment setup as below. For a full description of our experiment setup, see Section C. + +Base Model and Datasets: We follow Snorkel's experimental setup, using Mistral-7B-Instruct-v0.2 and Llama-3-8B-Instruct as our base models and Ultrafeedback for prompts. We split the dataset into three portions to avoid overfitting and ensure fair comparison with Snorkel. + +Preference Model: We use PairRM, a 0.4B pair-wise preference model based on DeBERTA-V3, trained on high-quality human-preference datasets. PairRM outputs a "relative reward" between any given pair. + +Table 1: AlpacaEval 2.0 evaluation of various models (detailed in Baselines) in terms of both normal and length-controlled (LC) win rates in percentage $(\%)$ . Mistral-7B-SPPO Iter3 model achieves the highest LC win rate of $28.53\%$ and a normal win rate of $31.02\%$ . SPPO demonstrates steady performance gains across iterations and outperforms other baselines which show a tendency to produce longer responses. Additionally, re-ranking with the PairRM reward model (best-of-16) at test time consistently enhances the performance across all models and SPPO (best-of-16) achieves high win rate without strong external supervision like GPT-4. We additionally include the results obtained from fine-tuning Llama-3-8B-Instruct, which also show steady performance improvement. + +
ModelAlpacaEval 2.0
LC Win RateWin RateAvg. Len
Mistral-7B-Instruct-v0.217.1114.721676
Mistral-7B-Instruct-v0.2 (best-of-16)22.4517.941529
Snorkel (Mistral-PairRM-DPO)26.3930.222736
Snorkel (Mistral-PairRM-DPO best-of-16)29.9734.862616
Self-Rewarding 70B Iter1-9.941092
Self-Rewarding 70B Iter2-15.381552
Self-Rewarding 70B Iter3-20.442552
Mistral-7B-DPO Iter123.8120.441723
Mistral-7B-DPO Iter224.2324.462028
Mistral-7B-DPO Iter322.3023.392189
Mistral-7B-IPO Iter123.7820.771693
Mistral-7B-IPO Iter221.0823.382660
Mistral-7B-IPO Iter320.0622.472760
Mistral-7B-SPPO Iter124.79(+7.69)23.51(+8.79)1855
Mistral-7B-SPPO Iter226.89(+2.10)27.62(+4.11)2019
Mistral-7B-SPPO Iter328.53(+1.64)31.02(+3.40)2163
Mistral-7B-SPPO Iter1 (best-of-16)28.71(+6.26)27.77(+9.83)1901
Mistral-7B-SPPO Iter2 (best-of-16)31.23(+2.52)32.12(+4.35)2035
Mistral-7B-SPPO Iter3 (best-of-16)32.13(+0.9)34.94(+2.82)2174
Llama-3-8B-Instruct22.9222.571899
Llama-3-8B-SPPO Iter131.73(+8.81)31.74(+9.17)1962
Llama-3-8B-SPPO Iter235.15(+3.42)35.98(+4.24)2021
Llama-3-8B-SPPO Iter338.77(+3.62)39.85(+3.87)2066
+ +Response Generation and Selection: We sample $K = 5$ responses per prompt with top $p = 1.0$ and temperature 1.0. We select the responses with the highest and lowest PairRM scores as the winning and losing responses respectively. + +Baselines and Benchmarks: We evaluate Mistral-7B-Instruct-v0.2, Snorkel, iterative DPO and IPO for Mistral, and Self-rewarding LM. Benchmarks include AlpacaEval 2.0, MT-Bench, Arena-Hard, and the Open LLM Leaderboard. We also evaluate Llama-3-8B-Instruct on AlpacaEval 2.0. + +# 4.2 EXPERIMENTAL RESULTS + +Evaluation using GPT-4 as a judge Human evaluation remains the benchmark for quality and accuracy (Askell et al., 2021; Ouyang et al., 2022). However, due to its limitations in scalability and reproducibility, we explore the alternative approach of using the advanced capabilities of GPT-4 (OpenAI et al., 2023) as an automatic evaluation tool. We conduct GPT-4-based automatic evaluation on AlpacaEval 2.0 (Li et al., 2023b), MT-Bench (Zheng et al., 2023), and Arena-Hard (Li et al., 2024) to measure the chatbot capability of our model. The results can be found in Table 1 for AlpacaEval 2.0, Figure 3 (left) for MT-Bench, and Figure 3 (right) for Arena-Hard. We found that the performance of SPPO models consistently improves throughout all iterations (iterations). + +Table 1 (AlpacaEval 2.0) shows the win rate over the GPT-4-Turbo baseline of different models on 805 prompts. We also include one column indicating the length-controlled win rate, and one column on the average length of each model, to account for the tendency of the LLM-based judge to favor longer sequence outputs — an issue colloquially termed the "reward hacking" phenomenon. According to the table, Mistral-7B-SPPO Iter3 has the highest win rate, $28.52\%$ for the length-controlled version, and $31.02\%$ for the overall win rate. The performance gains over previous iterations are $7.69\%$ (Mistral-7B-Instruct $\rightarrow$ Iter1), $2.10\%$ (Iter1 $\rightarrow$ Iter2), and $1.64\%$ (Iter2 $\rightarrow$ + +Table 2: AlpacaEval 2.0 leaderboard results of both normal and length-controlled (LC) win rates in percentage (\%). Mistral-7B-SPPO can outperform larger models and Mistral-7B-SPPO (best-of-16) can outperform proprietary models such as GPT-4(6/13). Llama-3-8B-SPPO exhibits even better performance. + +
ModelAlpacaEval 2.0
LC. Win RateWin Rate
GPT-4 Turbo50.050.0
Claude 3 Opus40.529.1
Llama-3-8B-SPPO Iter338.839.9
GPT-4 031435.322.1
Llama 3 70B Instruct34.433.2
Mistral-7B-SPPO Iter3 (best-of-16)32.134.9
GPT-4 061330.215.8
Snorkel (Mistral-PairRM-DPO best-of-16)30.034.9
Mistral Medium28.621.9
Mistral-7B-SPPO Iter328.531.0
Claude 228.217.2
Snorkel (Mistral-PairRM-DPO)26.430.2
Gemini Pro24.418.2
Mistral 8×7B v0.123.718.1
Llama 3 8B Instruct22.922.6
+ +
ModelMT-Bench
1st Turn2nd TurnAverage
Mistral-7B-Instruct-v0.27.787.257.51
Snorkel (Mistral-PairRM-DPO)7.837.337.58
Mistral-7B-DPO Iter17.456.587.02
Mistral-7B-DPO Iter27.576.567.06
Mistral-7B-DPO Iter37.496.697.09
Mistral-7B-SPPPO Iter17.636.797.21
Mistral-7B-SPPPO Iter27.907.087.49
Mistral-7B-SPPPO Iter37.847.347.59
+ +
ModelArena-Hard-Auto-v0.1
Mistral-7B-Instruct12.6
Snorkel (Mistral-PairRM-DPO)20.7
Mistral-7B-SPPO Iter118.7
Mistral-7B-SPPO Iter220.4
Mistral-7B-SPPO Iter323.3
+ +Table 3: MT-Bench & Arena-Hard Evaluation. Left: Mistral-7B-SPPO Iter3 outperforms all baseline models by achieving an average score of 7.59 in MT-Bench. Despite initial drops in performance in the first two iterations, SPPO Iter3 improves upon the base model by the final iteration. Right: Mistral-7B-SPPO Iter3 outperforms the baseline model Snorkel(Mistral-PairRM-DPO) in Arena-Hard. The improvement across different iterations is consistent. + +Iter3), respectively, indicating steady improvements across iterations, as illustrated in Figure 1. We also apply SPPO to a stronger baseline model, i.e., Llama-3-8B-Instruct, and the fine-tuned model Llama-3-8B-SPPO has a higher length-controlled win rate $38.77\%$ and overall win rate $39.85\%$ . The performance gains are more significant: $8.81\%$ (Llama-3-8B-Instruct $\rightarrow$ Iter1), $3.42\%$ (Iter1 $\rightarrow$ Iter2), and $3.62\%$ (Iter2 $\rightarrow$ Iter3), summing up to a total gain of $15.85\%$ . + +Additionally, the result indicates that SPPO achieves superior performance compared to the iterative variants of DPO and IPO. The length-controlled win rate for SPPO reaches $28.53\%$ , outperforming the DPO's best rate of $26.39\%$ (by Snorkel) and IPO's rate of $25.45\%$ . Notably, while DPO and IPO training tend to significantly increase the average output length—2736 and 2654, respectively—SPPO shows a more moderate length increase, moving from 1676 in the base model to 2163 at the third iteration. Finally, we present the best-of-16 results for each model, selected using the PairRM reward model. We find that re-ranking with the preference model at test time can consistently improve the performance of base model (Mistral-7B-Instruct-v0.2), DPO (Snorkel), and SPPO (Iter3) by $5.34\%$ , $3.57\%$ , and $3.6\%$ , respectively. Notably, this shows that while SPPO significantly enhances model alignment using PairRM-0.4B as the sole external supervision, it has not resulted in over-optimization against the preference model (Gao et al., 2023). + +In Table 2, we compare SPPO on the AlpacaEval 2.0 leaderboard with other state-of-the-art AI chatbots. Our SPPO model outperforms many competing models trained on proprietary alignment data (e.g., Claude 2, Gemini Pro, & Llama 3 8B Instruct). When applied to Llama 3 8B Instruct, our Llama-3-8B-SPPO exhibits an even higher win rate. With test-time reranking, Mistral-7B-SPPO Iter3 (best-of-16) is even competitive to GPT-4 0613 and Llama 3 70B Instruct. + +In Table 3 (left), we evaluate the performance of SPPO on MT-Bench. We can see that Mistral-7B-SPPO Iter3 outperforms all baseline models, achieving an average score of 7.59. While we are not certain why the MT-Bench performance drops at the first two iterations, the performance of SPPO at the final iteration still improves over the base model. + +Table 4: Open LLM Leaderboard Evaluation. SPPO fine-tuning improves the base model's performance on different tasks, reaching a state-of-the-art average score of 66.75 for Mistral-7B and 70.29 for Llama-3-8B. For Mistral-7B, subsequent iterations of DPO, IPO, and SPPO see a decline in performance. It is possible that aligning with human preferences (simulated by the PairRM preference model in our study) may not always enhance, and can even detract from, overall performance. + +
ModelsArcTruthfulQAWinoGrandeGSM8kHellaSwagMMLUAverage
Mistral-7B-Instruct-v0.263.6566.8577.9841.9384.8959.1565.74
Snorkel66.0470.8677.7436.7785.6460.8366.31
Mistral-7B-DPO Iter163.1468.3977.1940.3385.2559.4165.62
Mistral-7B-DPO Iter264.1667.8476.0939.9585.2359.0365.38
Mistral-7B-DPO Iter365.1967.8977.2732.3085.4959.0064.52
Mistral-7B-IPO Iter164.6868.6077.9843.7585.0859.0466.52
Mistral-7B-IPO Iter262.1266.3077.5139.2083.1559.7064.66
Mistral-7B-IPO Iter362.9767.1277.5137.4583.6959.5764.72
Mistral-7B-SPPO Iter165.0269.4077.8243.8285.1158.8466.67
Mistral-7B-SPPO Iter265.5369.5577.0344.3585.2958.7266.75
Mistral-7B-SPPO Iter365.3669.9776.8042.6885.1658.4566.40
Llama-3-8B-Instruct62.2951.6576.0975.8978.7365.5968.37
Llama-3-8B-SPPO Iter163.8254.9676.4075.4479.8065.6569.35
Llama-3-8B-SPPO Iter264.9356.4876.8775.1380.3965.6769.91
Llama-3-8B-SPPO Iter365.1958.0477.1174.9180.8665.6070.29
+ +Arena-Hard (Li et al., 2024) contains 500 challenging user queries and follows the same evaluation method as AlpacaEval 2.0. In Table 3 (right), we evaluate the performance of SPPO on Arena-Hard. We can see that Mistral-7B-SPPO exhibits a steady performance gain across iterations. Mistral-7B-SPPO Iter 3 outperforms the baseline models, achieving an average score of 23.3. + +Open LLM Leaderboard We further evaluate the capabilities of SPPO models using Huggingface Open LLM Leaderboard (Beeching et al., 2023a). This leaderboard encompasses 6 different datasets, each focusing on a specific capability of LLMs: Arc (Clark et al., 2018), HellaSwag (Zellers et al., 2019), Winogrande (Sakaguchi et al., 2021), MMLU (Hendrycks et al., 2020), TruthfulQA (Lin et al., 2021), and GSM8k (Cobbe et al., 2021). The models are prompted with zero or few-shot exemplars. The results, presented in Table 4, demonstrate that SPPO can enhance the performance of the base model on Arc, TruthfulQA, and GSM8k, and achieve the state-of-the-art performance with an average score of 66.75. However, these improvements do not hold in subsequent alignment iterations: DPO, IPO, and SPPO's performance declines after the first or second iterations. This limitation may be attributed to the "alignment tax" phenomenon (Askell et al., 2021), which suggests that aligning with human preferences (simulated by PairRM preference in our study) might not improve or even hurt the general performance. Improving language model capabilities through alignment iterations remains a topic for future research, and we posit that incorporating high-quality SFT annotations (Chen et al., 2024) could play a significant role in this endeavor. + +# 5 CONCLUSIONS + +This paper introduced Self-Play Preference Optimization (SPPO), an approach to fine-tuning Large Language Models (LLMs) from Human/AI Feedback. SPPO has demonstrated significant improvements over existing methods such as DPO and IPO across multiple benchmarks, including AlpacaEval 2.0, MT-Bench, Arena-Hard, and the Open LLM Leaderboard. By integrating a preference model and employing a new optimization objective, SPPO can align LLMs more closely with human preferences. + +Limitations Theoretically, approximating the optimal policy update via regression relies on the assumption that the model class is expressive enough and the generated data well cover the input space. Approximating the log-partition factor with a constant can help reduce variance only when it is close to the soft value function. The experiments are run on one dataset UltraFeedback and the models are tested on a few benchmarks due to limited computational resources, but the proposed methods can be further validated on more models, datasets, and benchmarks to have a holistic evaluation given more resources. + +# ACKNOWLEDGMENTS + +We thank the anonymous reviewers and area chair for their helpful comments. YW, KJ and QG are supported in part by the NSF grants IIS-2008981, DMS-2323113, CPS-2312094, IIS-2403400 and Sloan Research Fellowship. YW is also supported by UCLA Dissertation Year Fellowship. The views and conclusions contained in this paper are those of the authors and should not be interpreted as representing any funding agencies. + +# REFERENCES + +Arash Ahmadian, Chris Cremer, Matthias Galle, Marzieh Fadaee, Julia Kreutzer, Olivier Pietquin, Ahmet Üstün, and Sara Hooker. Back to basics: Revisiting REINFORCE-style optimization for learning from human feedback in LLMs. In Lun-Wei Ku, Andre Martins, and Vivek Srikumar (eds.), Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 12248-12267, Bangkok, Thailand, August 2024. Association for Computational Linguistics. doi: 10.18653/v1/2024.acl-long.662. URL https://aclanthology.org/2024.acl-long.662. +Amanda Askell, Yuntao Bai, Anna Chen, Dawn Drain, Deep Ganguli, Tom Henighan, Andy Jones, Nicholas Joseph, Ben Mann, Nova DasSarma, et al. A general language assistant as a laboratory for alignment. arXiv preprint arXiv:2112.00861, 2021. +Mohammad Gheshlaghi Azar, Mark Rowland, Bilal Piot, Daniel Guo, Daniele Calandriello, Michal Valko, and Rémi Munos. A general theoretical paradigm to understand learning from human preferences. arXiv preprint arXiv:2310.12036, 2023. +Edward Beeching, Clémentine Fourrier, Nathan Habib, Sheon Han, Nathan Lambert, Nazneen Rajani, Omar Sanseviero, Lewis Tunstall, and Thomas Wolf. Open llm leaderboard. Hugging Face, 2023a. +Edward Beeching, Clémentine Fourrier, Nathan Habib, Sheon Han, Nathan Lambert, Nazneen Rajani, Omar Sanseviero, Lewis Tunstall, and Thomas Wolf. Open llm leaderboard. https://huggingface.co/spaces/HuggingFaceH4/open_11m_leaderboard, 2023b. +Ralph Allan Bradley and Milton E. Terry. Rank Analysis of Incomplete Block Designs: I. The Method of Paired Comparisons. Biometrika, 39(3/4):324-345, 1952. ISSN 0006-3444. doi: 10.2307/2334029. +Daniele Calandriello, Daniel Guo, Remi Munos, Mark Rowland, Yunhao Tang, Bernardo Avila Pires, Pierre Harvey Richemond, Charline Le Lan, Michal Valko, Tianqi Liu, et al. Human alignment of large language models through online preference optimisation. arXiv preprint arXiv:2403.08635, 2024. +Zixiang Chen, Yihe Deng, Huizhuo Yuan, Kaixuan Ji, and Quanquan Gu. Self-play fine-tuning converts weak language models to strong language models. arXiv preprint arXiv:2401.01335, 2024. +Paul F Christiano, Jan Leike, Tom Brown, Miljan Martic, Shane Legg, and Dario Amodei. Deep reinforcement learning from human preferences. Advances in neural information processing systems, 30, 2017. +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, 2018. +Karl Cobbe, Vineet Kosaraju, Mohammad Bavarian, Mark Chen, Heewoo Jun, Lukasz Kaiser, Matthias Plappert, Jerry Tworek, Jacob Hilton, Reiichiro Nakano, et al. Training verifiers to solve math word problems. arXiv preprint arXiv:2110.14168, 2021. +Ganqu Cui, Lifan Yuan, Ning Ding, Guanming Yao, Wei Zhu, Yuan Ni, Guotong Xie, Zhiyuan Liu, and Maosong Sun. Ultrafeedback: Boosting language models with high-quality feedback. arXiv preprint arXiv:2310.01377, 2023. + +Yann Dubois, Balázs Galambosi, Percy Liang, and Tatsunori B Hashimoto. Length-controlled alpacaeval: A simple way to debias automatic evaluators. arXiv preprint arXiv:2404.04475, 2024a. +Yann Dubois, Chen Xuechen Li, Rohan Taori, Tianyi Zhang, Ishaan Gulrajani, Jimmy Ba, Carlos Guestrin, Percy S Liang, and Tatsunori B Hashimoto. Alpacafarm: A simulation framework for methods that learn from human feedback. Advances in Neural Information Processing Systems, 36, 2024b. +Miroslav Dudík, Katja Hofmann, Robert E Schapire, Aleksandrs Slivkins, and Masrour Zoghi. Contextual dueling bandits. In Conference on Learning Theory, pp. 563-587. PMLR, 2015. +Kawin Ethayarajh, Winnie Xu, Niklas Muennighoff, Dan Jurafsky, and Douwe Kiela. Kto: Model alignment as prospect theoretic optimization. arXiv preprint arXiv:2402.01306, 2024. +Yoav Freund and Robert E Schapire. A decision-theoretic generalization of on-line learning and an application to boosting. Journal of computer and system sciences, 55(1):119-139, 1997. +Yoav Freund and Robert E Schapire. Adaptive game playing using multiplicative weights. Games and Economic Behavior, 29(1-2):79-103, 1999. +Leo Gao, John Schulman, and Jacob Hilton. Scaling laws for reward model overoptimization. In International Conference on Machine Learning, pp. 10835-10866. PMLR, 2023. +Zhaolin Gao, Jonathan D Chang, Wenhao Zhan, Owen Oertell, Gokul Swamy, Kianté Brantley, Thorsten Joachims, J Andrew Bagnell, Jason D Lee, and Wen Sun. Rebel: Reinforcement learning via regressing relative rewards. arXiv preprint arXiv:2404.16767, 2024. +Tuomas Haarnoja, Aurick Zhou, Pieter Abbeel, and Sergey Levine. Soft actor-critic: Off-policy maximum entropy deep reinforcement learning with a stochastic actor. In International conference on machine learning, pp. 1861-1870. PMLR, 2018. +Pengcheng He, Jianfeng Gao, and Weizhu Chen. Debertav3: Improving deberta using electra-style pre-training with gradient-disentangled embedding sharing, 2021. +Dan Hendrycks, Collin Burns, Steven Basart, Andy Zou, Mantas Mazeika, Dawn Song, and Jacob Steinhardt. Measuring massive multitask language understanding. arXiv preprint arXiv:2009.03300, 2020. +Jiwoo Hong, Noah Lee, and James Thorne. Reference-free monolithic preference optimization with odds ratio. arXiv preprint arXiv:2403.07691, 2024. +Kaixuan Ji, Jiafan He, and Quanquan Gu. Reinforcement learning from human feedback with active queries. arXiv preprint arXiv:2402.09401, 2024. +Albert Q Jiang, Alexandre Sablayrolles, Arthur Mensch, Chris Bamford, Devendra Singh Chaplot, Diego de las Casas, Florian Bressand, Gianna Lengyel, Guillaume Lample, Lucile Saulnier, et al. Mistral 7b. arXiv preprint arXiv:2310.06825, 2023a. +Dongfu Jiang, Xiang Ren, and Bill Yuchen Lin. Llm-blender: Ensembling large language models with pairwise ranking and generative fusion. arXiv preprint arXiv:2306.02561, 2023b. +Junlong Li, Shichao Sun, Weizhe Yuan, Run-Ze Fan, Hai Zhao, and Pengfei Liu. Generative judge for evaluating alignment. arXiv preprint arXiv:2310.05470, 2023a. +Tianle Li, Wei-Lin Chiang, Evan Frick, Lisa Dunlap, Tianhao Wu, Banghua Zhu, Joseph E Gonzalez, and Ion Stoica. From crowdsourced data to high-quality benchmarks: Arena-hard and benchbuilder pipeline. arXiv preprint arXiv:2406.11939, 2024. +Xuechen Li, Tianyi Zhang, Yann Dubois, Rohan Taori, Ishaan Gulrajani, Carlos Guestrin, Percy Liang, and Tatsunori B. Hashimoto. Alpacaeval: An automatic evaluator of instruction-following models. https://github.com/tatsu-lab/alpaca_eval, 2023b. +Stephanie Lin, Jacob Hilton, and Owain Evans. Truthfulqa: Measuring how models mimic human falsehoods. arXiv preprint arXiv:2109.07958, 2021. + +Tianqi Liu, Yao Zhao, Rishabh Joshi, Misha Khalman, Mohammad Saleh, Peter J Liu, and Jialu Liu. Statistical rejection sampling improves preference optimization. arXiv preprint arXiv:2309.06657, 2023. +Hao Lou, Tao Jin, Yue Wu, Pan Xu, Quanquan Gu, and Farzad Farnoud. Active ranking without strong stochastic transitivity. Advances in neural information processing systems, 2022. +Yu Meng, Mengzhou Xia, and Danqi Chen. Simpo: Simple preference optimization with a reference-free reward. In Advances in Neural Information Processing Systems (NeurIPS), 2024. +Rémi Munos, Michal Valko, Daniele Calandriello, Mohammad Gheshlaghi Azar, Mark Rowland, Zhaohan Daniel Guo, Yunhao Tang, Matthieu Geist, Thomas Mesnard, Andrea Michi, et al. Nash learning from human feedback. arXiv preprint arXiv:2312.00886, 2023. +Andrew Y Ng, Daishi Harada, and Stuart Russell. Policy invariance under reward transformations: Theory and application to reward shaping. In Icml, volume 99, pp. 278-287, 1999. +Josh OpenAI, Achiam, Steven Adler, Sandhini Agarwal, Lama Ahmad, Ilge Akkaya, Florencia Leoni Aleman, Diogo Almeida, Janko Altenschmidt, Sam Altman, Shyamal Anadkat, et al. Gpt-4 technical report. arXiv preprint arXiv:2303.08774, 2023. +Long Ouyang, Jeffrey Wu, Xu Jiang, Diogo Almeida, Carroll Wainwright, Pamela Mishkin, Chong Zhang, Sandhini Agarwal, Katarina Slama, Alex Ray, et al. Training language models to follow instructions with human feedback. Advances in Neural Information Processing Systems, 35: 27730-27744, 2022. +Arka Pal, Deep Karkhanis, Samuel Dooley, Manley Roberts, Siddartha Naidu, and Colin White. Smaug: Fixing failure modes of preference optimisation with dpo-positive. arXiv preprint arXiv:2402.13228, 2024. +Rafael Rafailov, Joey Hejna, Ryan Park, and Chelsea Finn. From r to q*: Your language model is secretly a q-function. arXiv preprint arXiv:2404.12358, 2024a. +Rafael Rafailov, Archit Sharma, Eric Mitchell, Christopher D Manning, Stefano Ermon, and Chelsea Finn. Direct preference optimization: Your language model is secretly a reward model. Advances in Neural Information Processing Systems, 36, 2024b. +Corby Rosset, Ching-An Cheng, Arindam Mitra, Michael Santacroce, Ahmed Awadallah, and Tengyang Xie. Direct nash optimization: Teaching language models to self-improve with general preferences. arXiv preprint arXiv:2404.03715, 2024. +Keisuke Sakaguchi, Ronan Le Bras, Chandra Bhagavatula, and Yejin Choi. Winogrande: An adversarial winograd schema challenge at scale. Communications of the ACM, 64(9):99-106, 2021. +John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms. arXiv preprint arXiv:1707.06347, 2017. +Avi Singh, John D Co-Reyes, Rishabh Agarwal, Ankesh Anand, Piyush Patil, Peter J Liu, James Harrison, Jaehoon Lee, Kelvin Xu, Aaron Parisi, et al. Beyond human data: Scaling self-training for problem-solving with language models. arXiv preprint arXiv:2312.06585, 2023. +Richard S Sutton, David McAllester, Satinder Singh, and Yishay Mansour. Policy gradient methods for reinforcement learning with function approximation. Advances in neural information processing systems, 12, 1999. +Gokul Swamy, Christoph Dann, Rahul Kidambi, Zhiwei Steven Wu, and Alekh Agarwal. A minimaximalist approach to reinforcement learning from human feedback. arXiv preprint arXiv:2401.04056, 2024. +Xiaohang Tang, Sangwoong Yoon, Seongho Son, Huizhuo Yuan, Quanquan Gu, and Ilija Bogunovic. Game-theoretic regularized self-play alignment of large language models, 2025. URL https://arxiv.org/abs/2503.00030. +Amos Tversky. Intransitivity of preferences. Psychological review, 76(1):31, 1969. + +Yuanhao Wang, Qinghua Liu, and Chi Jin. Is rlhf more difficult than standard r1? a theoretical perspective. Advances in Neural Information Processing Systems, 36, 2024. +Yue Wu, Tao Jin, Qiwei Di, Hao Lou, Farzad Farnoud, and Quanquan Gu. Borda regret minimization for generalized linear dueling bandits. In ICML 2023 Workshop The Many Facets of Preference-Based Learning, 2023. +Wei Xiong, Hanze Dong, Chenlu Ye, Han Zhong, Nan Jiang, and Tong Zhang. Gibbs sampling from human feedback: A provable kl-constrained framework for rlhf. arXiv preprint arXiv:2312.11456, 2023. +Jing Xu, Andrew Lee, Sainbayar Sukhbaatar, and Jason Weston. Some things are more cringe than others: Preference optimization with the pairwise cringe loss. arXiv preprint arXiv:2312.16682, 2023. +Chenlu Ye, Wei Xiong, Yuheng Zhang, Nan Jiang, and Tong Zhang. A theoretical analysis of nash learning from human feedback under general kl-regularized preference. arXiv preprint arXiv:2402.07314, 2024. +Weizhe Yuan, Richard Yuanzhe Pang, Kyunghyun Cho, Sainbayar Sukhbaatar, Jing Xu, and Jason Weston. Self-rewarding language models. arXiv preprint arXiv:2401.10020, 2024. +Rowan Zellers, Ari Holtzman, Yonatan Bisk, Ali Farhadi, and Yejin Choi. Hellaswag: Can a machine really finish your sentence? arXiv preprint arXiv:1905.07830, 2019. +Yao Zhao, Rishabh Joshi, Tianqi Liu, Misha Khalman, Mohammad Saleh, and Peter J Liu. Slic-hf: Sequence likelihood calibration with human feedback. arXiv preprint arXiv:2305.10425, 2023. +Lianmin Zheng, Wei-Lin Chiang, Ying Sheng, Siyuan Zhuang, Zhanghao Wu, Yonghao Zhuang, Zi Lin, Zhuohan Li, Dacheng Li, Eric Xing, et al. Judging llm-as-a-judge with mt-bench and chatbot arena. Advances in Neural Information Processing Systems, 36, 2023. +Lianmin Zheng, Wei-Lin Chiang, Ying Sheng, Siyuan Zhuang, Zhanghao Wu, Yonghao Zhuang, Zi Lin, Zhuohan Li, Dacheng Li, Eric Xing, et al. Judging llm-as-a-judge with mt-bench and chatbot arena. Advances in Neural Information Processing Systems, 36, 2024. +Banghua Zhu, Jiantao Jiao, and Michael I Jordan. Principled reinforcement learning with human feedback from pairwise or $k$ -wise comparisons. arXiv preprint arXiv:2301.11270, 2023. + +# A RELATED WORK + +RLHF with Explicit/Implicit Reward Model Originally, reinforcement learning from human feedback (RLHF) was proposed by Christiano et al. (2017) as a methodology that first learns a reward model reflecting human preferences and then uses reinforcement learning algorithms to maximize the reward. This methodology is applied by Ouyang et al. (2022) to fine-tune instruction-following large language models and leads to the popular ChatGPT. + +The reward model in the works mentioned above assumes a parametric model such as the Bradley-Terry model (Bradley & Terry, 1952), which assigns a "score" representing how preferred a given response is. More recently, Rafailov et al. (2024b) proposed to instead directly solve the closed-form solution of such a score implied by the Bradley-Terry model. The Direct Policy Optimization (DPO) method is claimed to be more efficient and stable, yet, still implicitly assumes such a reward model that specifies the "score". In a similar spirit, Zhao et al. (2023) proposed to calibrate the score so that the score of the winner in comparison has a margin over the score of the loser, and induces a different SLic loss. Similarly, Ethayarajh et al. (2024) derived a different loss function (called KTO) from the Kahneman-Tversky human utility function, which implicitly denotes a score of the given response. Liu et al. (2023) proposed Rejection Sampling Optimization (RSO) which utilizes a preference model to generate preference pairs with candidates sampled from the optimal policy; then preference optimization is applied on the sampled preference pairs. Hong et al. (2024) proposed Odds Ratio Preference Optimization (ORPO) algorithm that can perform supervised fine-tuning and preference alignment in one training session without maintaining an intermediate reference policy. Motivated by the length bias in the preference dataset, Meng et al. (2024) model human preference + +based on the average-reward Bradley-Terry model, and propose Simple Preference Optimization (SimPO) which maximizes the gap between the average log-likelihood of the winner and loser. + +As discussed in Section 3.3, SPPO can be seen as a semi-online REINFORCE-style algorithm. The effectiveness of REINFORCE, rather than PPO with value function and gradient clipping, has been shown by Ahmadian et al. (2024), where they argue that REINFORCE should suffice for RLHF tasks. Our work also corroborates this observation. + +RLHF with General Preference Model Often, the human preference is not strictly transitive, and cannot be sufficiently represented by a single numerical score. Azar et al. (2023) proposed a general preference optimization objective based on the preference probability between a pair of responses instead of a score of a single response. They further propose a learning objective based on identity mapping of the preference probability called IPO (Preference Optimization with Identity mapping), which aims to maximize the current policy's expected winning probability over a given reference policy. Munos et al. (2023) formulated the RLHF problem with general preference as a two-player, constant-sum game, where each player is one policy that aims to maximize the probability of its response being preferred against its opponent. They aim to identify the Nash equilibrium policy of this game and propose a mirror-descent algorithm that guarantees the last-iterate convergence of a policy with tabular representations5. Wang et al. (2024) proposed to identify the Nash equilibrium policy for multi-step MDPs when a general preference model is present and shows that the problem can be reduced to a two-player zero-sum Markov game. + +Theory of RLHF There is also a line of research to analyze RLHF and provide its theoretical guarantees. Zhu et al. (2023) studied the standard RLHF with separate reward-learning and model-tuning and proposed a pessimistic reward-learning process that provably learns a linear reward model. Wang et al. (2024) proposed a framework to reduce any RLHF problem with a reward model to a reward-based standard RL problem. Additionally, they proposed to identify the Nash equilibrium policy when a general preference model is present and show that the problem can be reduced to a two-player zero-sum Markov game. Xiong et al. (2023) studied the reverse-KL regularized contextual bandit for RLHF in different settings and proposed efficient algorithms with finite-sample theoretical guarantees. Ye et al. (2024) studied the theoretical learnability of the KL-regularized Nash-Learning from Human Feedback (NLHF) by considering both offline and online settings and proposed provably efficient algorithms. Ji et al. (2024) proposed an active-query-based proximal policy optimization algorithm with regret bounds and query complexity based on the problem dimension and the sub-optimality gap. + +Self-Play Fine-Tuning Most works mentioned above (Rafailov et al., 2024b; Zhao et al., 2023; Azar et al., 2023; Ethayarajh et al., 2024) consider one single optimization procedure starting from some reference policy. The same procedure may be applied repeatedly for multiple iterations in a self-play manner. In each iteration, new data are generated by the policy obtained in the last iteration; these new data are then used for training a new policy that can outperform the old policy. + +The self-play fine-tuning can be applied to both scenarios with or without human preference data. For example, Singh et al. (2023) proposed an Expectation-Maximization (EM) framework where in each iteration, new data are generated and annotated with a reward score; the new policy is obtained by fine-tuning the policy on the data with a high reward. Chen et al. (2024) proposed a self-play framework to fine-tune the model in a supervised way. In each iteration, new preference pairs are synthesized by labeling the policy-generated responses as losers and the human-generated responses as winners. Then DPO is applied in each iteration to fine-tune another policy based on these synthesized preference data. Yuan et al. (2024) proposed Self-Rewarding Language Models, where the language model itself is used to annotate preference on its own responses. Iterative DPO is applied to fine-tune language models on these annotated data. These works show iterative fine-tuning can significantly improve the performance. + +Munos et al. (2023) are among the first to introduce self-play algorithms for aligning large language models with human preferences by computing Nash equilibria of a preference model rather than optimizing a reward model. Their proposed method, Nash-MD, based on mirror descent, provides a sequence of policies with the final iteration converging to the regularized Nash equilibrium. However, Nash-MD requires exact sampling from the mixture distribution that is only feasible in the + +bandit setting, while sequential generation necessitates an approximation that may impact theoretical guarantees. + +Swamy et al. (2024) considered a more general multi-step Markov Decision Process (MDP) setting and proposed Self-play Preference Optimization (SPO), an RLHF framework that can utilize any no-regret online learning algorithm for preference-based policy optimization. They then instantiated their framework with Soft Policy Iteration as an idealized variant of their algorithm, which reduces to the exponential weight update rule (3.1) when constrained to the bandit setting. The main difference is that they focus on the multi-round Markov decision process (MDP) in robotic and game tasks rather than on fine-tuning large language models and approximating the update using policy optimization methods such as PPO. + +Concurrent to our work, Rosset et al. (2024) proposed the Direct Nash Optimization (DNO) algorithm based on the cross-entropy between the true and predicted win rate gaps, and provided theoretical guarantees on the error of finite-sample approximation. However, their practical version still utilizes the iterative-DPO framework as in Xu et al. (2023) with the DPO loss instead of their derived DNO loss. Notably, in their experiments, they added the GPT-4 generated responses as their "gold sample" into their fine-tuning data, and used GPT-4 as a judge to assign a numerical score to each response for preference pair construction. In sharp contrast, our work does not require the use of any strong external supervision besides a small-sized reward model. Another concurrent work (Gao et al., 2024) proposed REBEL, an iterative fine-tuning framework via regressing the relative reward. When applied to the preference setting, it results in a similar algorithm to our algorithm SPPO, except that SPPO approximates the log-partition factor $\log Z_{\pi_t}(\mathbf{x})$ with a constant $\eta /2$ while REBEL regresses on the win rate difference (so that $\log Z_{\pi_t}(\mathbf{x})$ is canceled). Additionally, Calandriello et al. (2024) pointed out that optimizing the IPO loss (Azar et al., 2023) iteratively with self-play generated data is equivalent to finding the Nash equilibrium of the two-player game, and they proposed the IPO-MD algorithm based on this observation, which generates data with a mixture policy similar to the Nash-MD algorithm. + +# B COMPARISON WITH DPO, IPO, AND KTO + +In practice, we utilize mini-batches of more than 2 responses to estimate the win rate of a given response, while the DPO and IPO loss focus on a single pair of responses. When only a pair of responses $\mathbf{y}_w$ and $\mathbf{y}_l$ is available, we have the pair-wise symmetric loss based on the preference triplet $(\mathbf{x},\mathbf{y}_w,\mathbf{y}_l)$ defined as: + +$$ +\begin{array}{l} \ell_ {\mathrm {S P P O}} (\mathbf {x}, \mathbf {y} _ {w}, \mathbf {y} _ {l}; \boldsymbol {\theta}; \pi_ {\mathrm {r e f}}) := \left(\log \left(\frac {\pi_ {\boldsymbol {\theta}} (\mathbf {y} _ {w} | \mathbf {x})}{\pi_ {\mathrm {r e f}} (\mathbf {y} _ {w} | \mathbf {x})}\right) - \eta \left(\mathbb {P} (\mathbf {y} _ {w} \succ \mathbf {y} _ {l} | \mathbf {x}) - \frac {1}{2}\right)\right) ^ {2} \\ + \left(\log \left(\frac {\pi_ {\boldsymbol {\theta}} (\mathbf {y} _ {l} | \mathbf {x})}{\pi_ {\mathrm {r e f}} (\mathbf {y} _ {l} | \mathbf {x})}\right) - \eta \left(\mathbb {P} \left(\mathbf {y} _ {w} \prec \mathbf {y} _ {l} | \mathbf {x}\right) - \frac {1}{2}\right)\right) ^ {2}, \tag {B.1} \\ \end{array} +$$ + +where $\mathbb{P}(\mathbf{y}_w\succ \mathbf{y}_l|\mathbf{x})$ can be either a soft probability within [0, 1] or a hard label 1 indicating $\mathbf{y}_w\succ \mathbf{y}_l$ . + +We now compare the SPPO loss to other baselines assuming a hard label $\mathbf{y}_w\succ \mathbf{y}_l$ is given. For the ease of comparison, let $(\beta = \eta^{-1})$ : + +$$ +a = \beta \log \left(\frac {\pi_ {\boldsymbol {\theta}} (\mathbf {y} _ {w} | \mathbf {x})}{\pi_ {\mathrm {r e f}} (\mathbf {y} _ {w} | \mathbf {x})}\right), b = \beta \log \left(\frac {\pi_ {\boldsymbol {\theta}} (\mathbf {y} _ {l} | \mathbf {x})}{\pi_ {\mathrm {r e f}} (\mathbf {y} _ {l} | \mathbf {x})}\right), c = \beta \mathrm {K L} (\pi_ {\boldsymbol {\theta}} \| \pi_ {\mathrm {r e f}}), +$$ + +then we have + +$$ +\ell_ {\mathrm {D P O}} \left(\mathbf {y} _ {w}, \mathbf {y} _ {l}, \mathbf {x}\right) = - \log \sigma (a - b), \tag {B.2} +$$ + +$$ +\ell_ {\mathrm {I P O}} \left(\mathbf {y} _ {w}, \mathbf {y} _ {l}, \mathbf {x}\right) = \left[ (a - b) - 1 \right] ^ {2}, \tag {B.3} +$$ + +$$ +\ell_ {\mathrm {K T O}} \left(\mathbf {y} _ {w}, \mathbf {y} _ {l}, \mathbf {x}\right) = \sigma (- a + c) + \sigma (b - c) (\text {s i m p l i f i e d}), \tag {B.4} +$$ + +where $\sigma (x) = e^{x} / (e^{x} + 1)$ and the SPPO loss can be written as + +$$ +\ell_ {\mathrm {S P P O}} (\mathbf {y} _ {w}, \mathbf {y} _ {l}, \mathbf {x}) = (a - 1 / 2) ^ {2} + (b + 1 / 2) ^ {2}. +$$ + +It can be seen that SPPO not only pushes the gap between $a$ and $b$ to be 1, but also attempts to push value of $a$ to be close to $1 / 2$ and the value of $b$ to be close to $-1 / 2$ such that $\pi_{\pmb{\theta}}(\mathbf{y}_w|\mathbf{x}) > \pi_{\mathrm{ref}}(\mathbf{y}_w|\mathbf{x})$ and $\pi_{\pmb{\theta}}(\mathbf{y}_l|\mathbf{x}) < \pi_{\mathrm{ref}}(\mathbf{y}_l|\mathbf{x})$ . We believe this is particularly important: when there are plenty of + +preference pairs, DPO and IPO can ensure the policy will converge to the target policy, but when the preference pairs are scarce (e.g., one pair for each prompt), there is no guarantee that the estimated reward of the winner $a$ will increase and the estimated reward of the loser $b$ will decrease. Instead, only the reward gap between the winner and the loser (i.e., $a - b$ ) will increase. This phenomenon is observed by Pal et al. (2024) that DPO only drives the loser's likelihood to be small, but the winner's likelihood barely changes. We believe that fitting $\beta \log \left( \frac{\pi_{t+1}(\mathbf{y}|\mathbf{x})}{\pi_t(\mathbf{y}|\mathbf{x})} \right)$ directly to $\mathbb{P}(\mathbf{y} \succ \pi_t|\mathbf{x}) - 1/2$ is more effective than IPO which attempts to fit $\beta \log \left( \frac{\pi_{t+1}(\mathbf{y}_w|\mathbf{x})}{\pi_t(\mathbf{y}_w|\mathbf{x})} \right) - \beta \log \left( \frac{\pi_{t+1}(\mathbf{y}_l|\mathbf{x})}{\pi_t(\mathbf{y}_l|\mathbf{x})} \right)$ to $\mathbb{P}(\mathbf{y}_w \succ \pi_t|\mathbf{x}) - \mathbb{P}(\mathbf{y}_l \succ \pi_t|\mathbf{x})$ . In addition, SPPO shares a similar spirit as KTO. The KTO loss pushes $a$ to be large by minimizing $\sigma(-a + c)$ and pushes $b$ to be small by minimizing $\sigma(b - c)$ . In contrast, SPPO pushes $a$ to be as large as $1/2$ and $b$ to be as small as $-1/2$ . + +On the other hand, we would like to comment that although DPO and KTO can be extended to their iterative variants, they are not by nature iterative algorithms and do not have provable guarantees that they can reach the Nash equilibrium. In contrast, SPPO and IPO are by design capable to solve the Nash equilibrium iteratively. SPPO is superior to IPO because its design explicitly alleviates the data sparsity issue, as discussed above and detailed in Pal et al. (2024). + +# C FULL EXPERIMENT SETUP + +Base Model and Datasets We follow the experimental setup of Snorkel6, a model that utilizes iterative DPO to achieve state-of-the-art performance on AlpacaEval benchmarks. Specifically, we use Mistral-7B-Instruct-v0.2 as our base model7. Mistral-7B-Instruct-v0.2 is an instruction finetuned version of Mistral-7B-v0.2 model (Jiang et al., 2023a). We also adopt Ultrafeedback (Cui et al., 2023) as our source of prompts which includes around 60k prompts from diverse resources. During generation, we follow the standard chat template of Mistral-7B. To avoid overfitting during the fine-tuning, we split the dataset into three portions and used only one portion per iteration. These settings were also adopted by training the model Snorkel-Mistral-PairRM-DPO8 (Snorkel). We follow the splitting in Snorkel for a fair comparison. Additionally, we use Llama-3-8B-Instruct9 as a stronger base model along with the same preference dataset and data splitting. + +Preference Model We employ PairRM (Jiang et al., 2023b), an efficient pair-wise preference model of size 0.4B. PairRM is based on DeBERTA-V3 (He et al., 2021) and trained on high-quality human-preference datasets. Results on benchmarks like Auto-J Pairwise dataset (Li et al., 2023a) show that it outperforms most of the language-model-based reward models and performs comparably with larger reward models like UltraRM-13B (Cui et al., 2023). We refer the readers to the homepage on Huggingface $^{10}$ for detailed benchmark results. We therefore keep PairRM as our ranking model following Snorkel for a balance between accuracy and efficiency. + +Specifically, PairRM will output a "relative reward" $s(\mathbf{y}, \mathbf{y}'; \mathbf{x})$ that reflects the strength difference between $\mathbf{y}$ and $\mathbf{y}'$ , i.e., + +$$ +\mathbb {P} (\mathbf {y} \succ \mathbf {y} ^ {\prime} | \mathbf {x}) = \frac {\exp (s (\mathbf {y} , \mathbf {y} ^ {\prime} ; \mathbf {x}))}{1 + \exp (s (\mathbf {y} , \mathbf {y} ^ {\prime} ; \mathbf {x}))}. +$$ + +Unlike the Bradley-Terry-based reward model, PairRM only assigns the relative reward which is not guaranteed to be transitive (i.e., $s(\mathbf{y}_1, \mathbf{y}_2; \mathbf{x}) + s(\mathbf{y}_2, \mathbf{y}_3; \mathbf{x}) \neq s(\mathbf{y}_1, \mathbf{y}_3; \mathbf{x})$ ). So it indeed models the general preference. + +Response Generation and Selection During the generation phase in each iteration, we use top $p = 1.0$ and temperature 1.0 to sample from the current policy. We sample with different random seeds to get $K = 5$ different responses for each prompt. Previous works utilizing Iterative DPO choose 2 responses to form a pair for each prompt. For a fair comparison, we do not include all $K = 5$ responses in the preference data but choose two responses among them. Following Snorkel, we choose the winner $\mathbf{y}_w$ and loser $\mathbf{y}_l$ to be the response with the highest and lowest PairRM score, + +$^{6}$ https://huggingface.co/snorkelai/Snorkel-Mistral-PairRM-DPO +7https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.2 +8https://huggingface.co/snorkelai/Snorkel-Mistral-PairRM-DPO +9https://huggingface.co/meta-llama/Meta-Llama-3-8B-Instruct +$^{10}$ https://huggingface.co/llm-blender/PairRM + +which is defined for each response $\mathbf{y}_i$ as: + +$$ +s _ {\text {P a i r R M}} \left(\mathbf {y} _ {i}; \mathbf {x}\right) := \frac {1}{K} \sum_ {k = 1} ^ {K} s \left(\mathbf {y} _ {i}, \mathbf {y} _ {k}; \mathbf {x}\right). +$$ + +Probability Estimation We then estimate the win rate over the distribution by the average win rate over all the sampled responses as explained in (3.5): + +$$ +\widehat {P} (\mathbf {y} _ {i} \succ \pi_ {t} | \mathbf {x}) = \frac {1}{K} \sum_ {k = 1} ^ {K} \mathbb {P} (\mathbf {y} _ {i} \succ \mathbf {y} _ {k} | \mathbf {x}), \forall i \in [ K ]. +$$ + +Hyperparameter Tuning The experiments are conducted on $8 \times$ Nvidia A100 GPUs. For SPPO, we trained three iterations in total. In each iteration, we selected the model trained on the first epoch of the 20k prompts from UltraFeedback to proceed to the next iteration. For both Mistral-7B-Instruct-v0.2 and Llama-3-8B-Instruct, the global training batch size is set to 64, and $\eta$ is set to 1e3. The learning rate schedule is determined by the following hyperparameters: learning rate=5.0e-7, number of total training epochs=18, warmup ratio=0.1, linear schedule. In practice, early stopping after the first epoch yields the best test performance. The best hyper-parameters for each model are selected by the average win rate (judged by PairRM-0.4B) on a hold-out subset of Ultrafeedback as the metric. For more details on the win-rate comparison using PairRM as a judge, please refer to Section 4.2 and Figure 2. + +Baselines We evaluate the following base models as well as baseline methods for fine-tuning LLMs: + +- Mistral-7B-Instruct-v0.2: Mistral-7B-Instruct-v0.2 is an instruction fine-tuned version of Mistral-7B-v0.2 model (Jiang et al., 2023a). It is the starting point of our algorithm. +- Snorkel (Mistral-PairRM-DPO): We directly evaluate the uploaded checkpoint on HuggingFace $^{11}$ . This model is obtained by three iterations of iterative DPO from Mistral-7B-Instruct-v0.2. +- (Iterative) DPO: We also implement the iterative DPO algorithm by ourselves. The experimental settings and model selection schemes align with those used for SPPO, except for the adoption of the DPO loss function as defined in (B.2). Hyperparameters are optimized to maximize the average win-rate assessed by PairRM at each iteration. Note that the practical algorithm in Rosset et al. (2024) is essentially the same as iterative DPO. +- (Iterative) IPO: We implement the iterative IPO algorithm by ourselves. The experimental setting and the model selection scheme is the same as iterative DPO, except that the loss function is the IPO loss (B.3). For fair comparison, hyperparameters for IPO is also selected by evaluation using the average PairRM win-rate on the hold-out subset of Ultrafeedback. +- Self-rewarding LM: Yuan et al. (2024) proposed to prompt the LLM itself as a preference judge to construct new preference pairs and iteratively fine-tune the LLM with the DPO algorithm. We use the AlpacaEval 2.0 win rate reported by Yuan et al. (2024) for comparison. Note that Self-rewarding LM is a trained from Llama 2 70B. +- Llama-3-8B-Instruct: Llama-3-8B-Instruct is an instruction-tuned model optimized for dialogue use cases and outperforms many of the available open-source chat models on common industry benchmarks. + +Benchmarks Following previous works, we use AlpacaEval 2.0 (Dubois et al., 2024a), Arena-Hard(Li et al., 2024), MT-Bench (Zheng et al., 2024), and Open LLM Leaderboard (Beeching et al., 2023b) as our evaluation benchmarks. + +- AlpacaEval 2.0 is an LLM-based automatic evaluation benchmark. It employs AlpacaFarm (Dubois et al., 2024b) as its prompts set composed of general human instructions. The model responses and the reference response generated by GPT-4-Turbo are fed into a GPT-4-Turbobased annotator to be judged. We follow the standard approach and report the win rate over the reference responses. +- Arena-Hard (Li et al., 2024) is a high-quality benchmark that claims to be harder and has the highest correlation and separability to Chatbot Arena among popular open-ended LLM benchmarks including AlpacaEval 2.0. We evaluate our models Mistral-PairRM-SPPO and the baseline models. + +![](images/20ee6b80d0b9787d630fc170fbb1eb9da6bcc797d85f3ed5083fdc1950db7304.jpg) +Figure 1: Win Rate against GPT-4-Turbo with (a) and without (b) Length Controlling (LC) on AlpacaEval 2.0. SPPO demonstrates steady improvements on both LC and raw win rates. + +![](images/95f89fc4c675c52325e73303cfd4b9b98dfea6a73c7363d44de8a2de79db3e6d.jpg) + +- MT-Bench (Zheng et al., 2024) is a collection of 80 high-quality multi-turn open-ended questions. The questions cover topics like writing, role-playing, math, coding, etc.. The generated answer is judged by GPT-4 and given a score directly without pairwise comparison. +- Open LLM Leaderboard (Beeching et al., 2023b) consists of six datasets, each of which focuses on a facet of language model evaluation. In detail, the evaluation rubric includes math problem-solving, language understanding, human falsehood mimicking, and reasoning. We follow the standard evaluation process and use in-context learning to prompt the language model and compute the average score over six datasets to measure the performance. + +# D ADDITIONAL EXPERIMENT RESULTS + +# D.1 ADDITIONAL TABLES AND PLOTS + +In Figure 1, we plot the win rate against GPT-4-Turbo on AlpacaEval 2.0 of different RLHF algorithms. We can see that the performance gains of SPPO over previous iterations are $7.69\%$ (Mistral-7B-Instruct $\rightarrow$ Iter1), $2.10\%$ (Iter1 $\rightarrow$ Iter2), and $1.64\%$ (Iter2 $\rightarrow$ Iter3), respectively, indicating steady improvements across iterations. + +# D.2 EVALUATION USING PAIRRM AS A JUDGE + +As SPPO identifies the von Neumann winner (see (2.3)) in a two-player constant-sum game, we examine the pairwise preferences among SPPO models and other baselines. The pairwise win rates, measured by PairRM, are depicted in Figure 2. We observe that in all algorithms—namely DPO, IPO, and SPPO—the newer model iterations surpass the previous ones. For example, SPPO iteration 3 outperforms SPPO iteration 2. Both SPPO and IPO consistently outperform DPO across all iterations. While SPPO is superior to IPO in the first two iterations, IPO exceeds SPPO in performance during the final iteration. Considering the superior performance of SPPO in standard benchmarks evaluated by GPT-4 or against ground-truth answers (e.g., AlpacaEval 2.0, MT-Bench, and Open LLM Leaderboard), along with IPO's tendency to produce longer sequence outputs (see Avg. Len in Table 1), we believe this is due to IPO exploiting the length bias in PairRM that favors longer sequences. Conversely, SPPO models benefit from a more robust regularization within a multiplicative weight update framework. + +![](images/64cb747867b210f9ee23c7c8bd01760fd9e28aa5e8fd77e3029e6a541f6b6ce6.jpg) +Figure 2: Pairwise win rates among base model (Mistral-7B-Instruct-v0.2), DPO models, IPO models, and SPPO models using **PairRM-0.4B** as a judge, which may favor models with longer outputs. On benchmarks with more powerful judge models (e.g., GPT-4), such as AlpacaEval 2.0 and MT-Bench, SPPO outperforms other baseline algorithms by a large margin. + +# D.3 ABLATION STUDY + +
Mini-Batch SizeIterationAlpacaEval 2.0
Win RateAvg. Len (chars)
LC.Raw
K=2Iter123.8523.531948
Iter226.9127.241999
Iter328.2628.221961
K=5Iter124.7923.511855
Iter226.8927.622019
Iter328.5331.022163
+ +![](images/b9faffa02fed1c4cd0b826f0f7566e6c930c4d9eb2356b6bb642db41d2f03887.jpg) +Figure 3: AlpacaEval 2.0 evaluation on SPPO of different mini-batch size in terms of both normal and length-controlled (LC) win rates in percentage (\%). $K = 2,5$ denote different mini-batch sizes when estimating the win rate $\mathbb{P}(\mathbf{y}\succ \pi_t|\mathbf{x})$ . + +We study the effect of mini-batch size when estimating the win rate $\mathbb{P}(\mathbf{y}\succ \pi_t|\mathbf{x})$ . Specifically, for each prompt, we still generate 5 responses and choose the winner $\mathbf{y}_w$ and loser $\mathbf{y}_l$ according to the PairRM score. When estimating the probability, we vary the batch size to be $K = 2,3,5$ . For $K = 2$ , we estimate $\mathbb{P}(\mathbf{y}\succ \pi_t|\mathbf{x})$ with only 2 samples $\mathbf{y}_w$ and $\mathbf{y}_l$ : + +$$ +\widehat {P} (\mathbf {y} _ {w} \succ \pi_ {t} | \mathbf {x}) = \frac {\mathbb {P} (\mathbf {y} _ {w} \succ \mathbf {y} _ {w} | \mathbf {x}) + \mathbb {P} (\mathbf {y} _ {w} \succ \mathbf {y} _ {l} | \mathbf {x})}{2} = \frac {1 / 2 + \mathbb {P} (\mathbf {y} _ {w} \succ \mathbf {y} _ {l} | \mathbf {x})}{2}, +$$ + +and $\widehat{P} (\mathbf{y}_l\succ \pi_l|\mathbf{x})$ similarly. $K = 5$ indicates the original setting we use. + +We compare the results on AlpacaEval 2.0, as shown in Figure 3. We find that the performance of SPPO is robust to the noise in estimating $\mathbb{P}(\mathbf{y}\succ \pi_t|\mathbf{x})$ . While $K = 5$ initially outperforms + +$K = 2$ in the first iteration, the difference in their performance diminishes in subsequent iterations. Additionally, we observe that $K = 2$ exhibits a reduced tendency to increase output length. + +# D.4 TRADE-OFF BETWEEN KL DIVERGENCE AND ALIGNMENT + +![](images/7cd179fa81ae577c8fc3e7794b6b6bc45c74732f45cf0aad5ab64c22f16a3c8d.jpg) +Figure 4: Win rate on AlpacaEval 2.0 length-controlled win rate against KL divergence to the Mistral-7B-Instruct-v0.2 base model for various model checkpoints. Each method (DPO, IPO, SPPO) is plotted across three iterations (left to right, as KL divergence increases). + +We estimated the KL divergence on the 1000 prompts from the UltraFeedback test set. The KL divergence estimate is obtained from the average log-ratio of the responses generated from these prompts. + +As shown in Figure 4, the steady improvement in win rate for SPPO demonstrates its efficiency in leveraging the KL budget. Notably, $\mathrm{SPPO}(\beta = 1\mathrm{e} - 3)$ achieves a higher alignment metric compared to iterative DPO by the Snorkel team (the purple point) while maintaining lower KL divergence for the final iteration. We also find that $\beta = 1\mathrm{e} - 2$ gives a better trade-off between KL and win rate, with significantly smaller KL divergence and a similar final win rate. + +# E APPROXIMATING THE NORMALIZING FACTOR + +As discussed before, we replace the log-partition factor with a constant to avoid either estimating or predicting the log-partition factor. In hindsight, the approximation of the normalizing factor serves as a baseline for variance reduction, and does not need to be exact. Here we discuss the implicit assumptions and how we obtained an approximation based on different assumptions on human preference behaviour. + +We first consider the case where we have $K$ responses and then calculate the limit of $Z_{\hat{\pi}_t^K}(\mathbf{x})$ when $K \to \infty$ . We have two extreme cases: + +1. The most "disordered" case: any preference is a fair coin flip +2. The most "ordered" case: there is a strict ordering among all responses. + +The most "disordered" case Specifically, we have $K$ different responses $\mathbf{y}_1,\mathbf{y}_2,\ldots ,\mathbf{y}_K$ for the given prompt $\mathbf{x}$ . Since we consider the general preference setting, we assume that the preference probability between $\mathbf{y}_i$ and $\mathbf{y}_j$ $(i < j)$ we observe is a fair coin toss: + +$$ +\mathbb {P} (\mathbf {y} _ {i} \succ \mathbf {y} _ {j} | \mathbf {x}) = \left\{ \begin{array}{l} 1, \text {w . p .} 1 / 2, \\ 0, \text {w . p .} 1 / 2. \end{array} \right. +$$ + +Note that for simplicity, we assumed that the preference probability follows the Bernoulli distribution, not the preference feedback. The preference feedback is deterministic since the preference probability is either 0 or 1. Assuming $\mathbb{P}(\mathbf{y}_i\succ \mathbf{y}_j|\mathbf{x})$ follows any other $1 / 2$ -mean distribution will yield the same constant. + +We define the random variable $p_{i,j} \coloneqq 2\mathbb{P}(\mathbf{y}_i \succ \mathbf{y}_j|\mathbf{x}) - 1$ for convenience. In total, we have $K(K - 1)/2$ independent Rademacher random variable for all $i < j$ , and then we have $p_{j,i} = -p_{i,j}$ for all $i > j$ . For $i = j$ , $p_{i,j} = 0$ . We also define $X_i = \sum_{j=1}^{K} p_{i,j} / K$ . + +Given the setting and notations above, we have + +$$ +\mathbb {P} \left(\mathbf {y} _ {i} \succ \widehat {\pi} _ {t} ^ {K} | \mathbf {x}\right) = \sum_ {j = 1} ^ {K} \mathbb {P} \left(\mathbf {y} _ {i} \succ \mathbf {y} _ {j} | \mathbf {x}\right) / K = 1 / 2 + X _ {i}. +$$ + +Further, + +$$ +Z _ {\widehat {\pi} _ {t} ^ {K}} (\mathbf {x}) = \sum_ {i = 1} ^ {K} \exp (\eta \mathbb {P} (\mathbf {y} _ {i} \succ \widehat {\pi} _ {t} ^ {K} | \mathbf {x})) / K = e ^ {\eta / 2} \cdot \sum_ {i = 1} ^ {K} e ^ {\eta X _ {i}} / K. +$$ + +For any fixed $i$ , we have the expectation as follows: + +$$ +\mathbb {E} [ e ^ {\eta X _ {i}} ] = \mathbb {E} \left[ \prod_ {j = 1} ^ {K} e ^ {\eta p _ {i, j} / K} \right] = \prod_ {j = 1} ^ {K} \mathbb {E} \left[ e ^ {\eta p _ {i, j} / K} \right] = \left(\frac {e ^ {\eta / K} + e ^ {- \eta / K}}{2}\right) ^ {K - 1}, +$$ + +where the last equation comes from the definition of $p_{i,j}$ (note that $p_{i,i} = 0$ ). The variance is: + +$$ +\operatorname {V a r} \left[ e ^ {\eta X _ {i}} \right] = \mathbb {E} \left[ e ^ {2 \eta X _ {i}} \right] - \mathbb {E} \left[ e ^ {\eta X _ {i}} \right] ^ {2} = \left(\frac {e ^ {2 \eta / K} + e ^ {- 2 \eta / K}}{2}\right) ^ {K - 1} - \left(\frac {e ^ {\eta / K} + e ^ {- \eta / K}}{2}\right) ^ {2 K - 2}. +$$ + +Additionally, the covariance between $e^{\eta X_i}$ and $e^{\eta X_j}$ $(i\neq j)$ is: + +$$ +\begin{array}{l} \operatorname {C o v} \left(e ^ {\eta X _ {i}}, e ^ {\eta X _ {j}}\right) = \mathbb {E} \left[ e ^ {\eta X _ {i} + \eta X _ {j}} \right] - \mathbb {E} \left[ e ^ {\eta X _ {i}} \right] \mathbb {E} \left[ e ^ {\eta X _ {j}} \right] \\ = \mathbb {E} \left[ \exp \left(\eta \sum_ {k = 1} ^ {K} p _ {i, k} / K + \eta \sum_ {l = 1} ^ {K} p _ {j, l} / K\right) \right] - \mathbb {E} \left[ e ^ {\eta X _ {i}} \right] \mathbb {E} \left[ e ^ {\eta X _ {j}} \right] \\ = \left(\frac {e ^ {\eta / K} + e ^ {- \eta / K}}{2}\right) ^ {2 K - 4} - \mathbb {E} [ e ^ {\eta X _ {i}} ] \mathbb {E} [ e ^ {\eta X _ {j}} ] \\ = \left(\frac {e ^ {\eta / K} + e ^ {- \eta / K}}{2}\right) ^ {2 K - 4} - \left(\frac {e ^ {\eta / K} + e ^ {- \eta / K}}{2}\right) ^ {2 K - 2}, \\ \end{array} +$$ + +where the third line holds because $p_{i,i} = p_{j,j} = 0$ , $p_{i,j} + p_{j,i} = 0$ , and the rest terms are i.i.d.. + +One can check that when $K \to \infty$ , we have $\mathbb{E}[e^{\eta X_i}] \to 1$ , $\operatorname{Var}[e^{\eta X_i}] \to 0$ , and $\operatorname{Cov}(e^{\eta X_i}, e^{\eta X_j}) \to 0$ . By Chebyshev's inequality, $\sum_{i=1}^{K} e^{\eta X_i} / K$ will converge to 1 in probability. So we have + +$$ +Z _ {\widehat {\pi} _ {t} ^ {K}} (\mathbf {x}) = e ^ {\eta / 2} \cdot \sum_ {i = 1} ^ {K} e ^ {\eta X _ {i}} / K \rightarrow e ^ {\eta / 2}, +$$ + +and we can approximate $\log Z_{\hat{\pi}_k^c}(\mathbf{x})$ with $\eta /2$ + +The most "ordered" case We assume there is an ordering $\sigma(\cdot)$ among the $K$ different responses $\mathbf{y}_1, \mathbf{y}_2, \ldots, \mathbf{y}_K$ for the given prompt $\mathbf{x}$ . The preference probability between $\mathbf{y}_i$ and $\mathbf{y}_j$ ( $i < j$ ) is: + +$$ +\mathbb {P} (\mathbf {y} _ {i} \succ \mathbf {y} _ {j} | \mathbf {x}) = \left\{ \begin{array}{l} 1, \text {i f} \sigma (i) < \sigma (j), \\ 0, \text {i f} \sigma (i) > \sigma (j). \end{array} \right. +$$ + +Again, the preference feedback is deterministic: as long as $\mathbf{y}_i$ is ranked higher than $\mathbf{y}_j$ , $\mathbf{y}_i$ will always be preferred over $\mathbf{y}_j$ . The same responses still tie: $\mathbb{P}(\mathbf{y}_i\succ \mathbf{y}_i|\mathbf{x}) = 1 / 2$ . + +Without loss of generality, we can assume $\mathbf{y}_1\prec \mathbf{y}_2\prec \mathbf{y}_3\prec \dots \prec \mathbf{y}_K$ . Given the setting and notations above, we have + +$$ +\mathbb {P} (\mathbf {y} _ {i} \succ \widehat {\pi} _ {t} ^ {K} | \mathbf {x}) = \sum_ {j = 1} ^ {K} \mathbb {P} (\mathbf {y} _ {i} \succ \mathbf {y} _ {j} | \mathbf {x}) / K = \frac {i - 1 + 1 / 2}{K}, +$$ + +because for $\mathbf{y}_i$ , there are $i - 1$ responses that are strictly worse, and $\mathbf{y}_i$ ties with itself. + +For the normalizing factor, we have + +$$ +\begin{array}{l} \log Z _ {\widehat {\pi} _ {t} ^ {K}} (\mathbf {x}) = \log \left(\sum_ {i = 1} ^ {K} \exp (\eta \mathbb {P} (\mathbf {y} \succ \widehat {\pi} _ {t} ^ {K} | \mathbf {x})) / K\right) \\ = \log \left(\sum_ {i = 1} ^ {K} \exp \left(\eta \frac {i - 1 / 2}{K}\right) / K\right) \\ \rightarrow \log \left(\int_ {0} ^ {1} \exp (\eta x) d x\right) \\ = \log {\frac {e ^ {\eta} - 1}{\eta}}. \\ \end{array} +$$ + +where the third line (limiting) can be obtained by the squeeze theorem. + +For $\eta = 1$ , $\log \frac{e^{\eta} - 1}{\eta} \approx 0.54\eta$ . For large $\eta \approx 1$ we used in the experiments, we have $\log \frac{e^{\eta} - 1}{\eta} \approx \eta$ . + +Choice of $\eta$ Depending on how "disordered" the preference is, $\eta$ can vary between $\eta /2$ and $\eta$ . As this paper is partially motivated by human intransitive and irrational preference behavior, we chose to use $\eta /2$ to approximate $\log Z_{\widehat{\pi}_t^K}(\mathbf{x})$ . Fine-tuning the coefficient of this constant as a hyperparameter is also an option and can help improve performance on given dataset. + +# F PROOF OF THEOREM 3.1 + +Proof of Theorem 3.1. Suppose the optimization problem is realizable, we have exactly that + +$$ +\pi_ {t + 1} (\mathbf {y} | \mathbf {x}) \propto \pi_ {t} (\mathbf {y} | \mathbf {x}) \exp \left(\eta \mathbb {P} (\mathbf {y} \succ \pi_ {t} | \mathbf {x})\right), \text {f o r} t = 1, 2, \dots . \tag {F.1} +$$ + +To prove that the exponential weight update can induce the optimal policy, we directly invoke a restated version of Theorem 1 in Freund & Schapire (1999): + +Lemma F.1 (Theorem 1 in Freund & Schapire (1999), restated). For any oracle $\mathbb{P}$ and for any sequence of mixed policies $\mu_1, \mu_2, \ldots, \mu_T$ , the sequence of policies $\pi_1, \pi_2, \ldots, \pi_T$ produced by (F.1) satisfies: + +$$ +\sum_ {t = 1} ^ {T} \mathbb {P} (\pi_ {t} \prec \mu_ {t}) \leq \min _ {\pi} \left[ \frac {\eta}{1 - e ^ {- \eta}} \sum_ {t = 1} ^ {T} \mathbb {P} (\pi \prec \mu_ {t}) + \frac {\mathrm {K L} (\pi \| \pi_ {0})}{1 - e ^ {- \eta}} \right]. +$$ + +By setting $\mu_t = \pi_t$ , we have that + +$$ +\frac {T}{2} \leq \min _ {\pi} \left[ \frac {\eta T}{1 - e ^ {- \eta}} \mathbb {P} (\pi \prec \bar {\pi} _ {T}) + \frac {\mathrm {K L} (\pi \| \pi_ {0})}{1 - e ^ {- \eta}} \right], +$$ + +where the LHS comes from that $\mathbb{P}(\pi_t\prec \pi_t) = 1 / 2$ and the RHS comes from that $\frac{1}{T}\sum_{t = 1}^{T}\mathbb{P}(\pi \prec \pi_t) = \mathbb{P}(\pi \prec \bar{\pi}_t)$ . Now rearranging terms gives + +$$ +\frac {1 - e ^ {- \eta}}{2 \eta} \leq \min _ {\pi} \left[ \mathbb {P} (\pi \prec \bar {\pi} _ {T}) + \frac {\mathrm {K L} (\pi \| \pi_ {0})}{\eta T} \right]. +$$ + +Note that $\pi_0$ is an autoregressive model that is fully supported on a finite vocabulary ( $\pi_0(y_{k+1}|\mathbf{x},\mathbf{y}_{1:k})$ has non-zero probability for every token). Because its support is a large but finite set, $|\log \pi_0(\cdot)|$ is bounded from above. So we can naively bound the KL-divergence $\mathrm{KL}(\pi \| \pi_0) \leq \|\log \pi_0(\cdot)\|_{\infty}$ , which can be seen as a (large) constant. + +By choosing $\eta = \frac{\|\log\pi_0(\cdot)\|_{\infty}}{\sqrt{T}}$ we have + +$$ +\frac {1}{2} - \frac {\| \log \pi_ {0} (\cdot) \| _ {\infty}}{4 \sqrt {T}} + O (T ^ {- 1}) \leq \min _ {\pi} \left[ \mathbb {P} (\pi \prec \bar {\pi} _ {T}) \right] + \sqrt {\frac {\| \log \pi_ {0} (\cdot) \| _ {\infty}}{T}}, +$$ + +where the LHS comes from Taylor's expansion $\frac{1 - e^{-\eta}}{2\eta} = \frac{1}{2} - \frac{\eta}{4} + O(\eta^2)$ . Notice that $1/2$ at the LHS is already the value of the symmetric two-player constant-sum game. This shows that for appropriately chosen $\eta$ and $T$ , the mixture policy $\bar{\pi}_T$ is close to the minimax optimal policy (Nash equilibrium). + +The optimality gap is thus bounded by + +$$ +\begin{array}{l} \max _ {\pi} \left[ \mathbb {P} (\pi \succ \bar {\pi} _ {T}) \right] - \min _ {\pi} \left[ \mathbb {P} (\pi \prec \bar {\pi} _ {T}) \right] \\ = \max _ {\pi} \left[ 1 - \mathbb {P} (\pi \prec \bar {\pi} _ {T}) \right] - \min _ {\pi} \left[ \mathbb {P} (\pi \prec \bar {\pi} _ {T}) \right] \\ = 2 \left(\frac {1}{2} - \min _ {\pi} \left[ \mathbb {P} (\pi \prec \bar {\pi} _ {T}) \right]\right) \\ = O \left(\frac {1}{\sqrt {T}}\right). \\ \end{array} +$$ + +![](images/e76e4dc40e55ca7d19fbc88c003f8ae4b56333a9d2b1f85ce54cfe8486ed5118.jpg) + +# G RESPONSE EXAMPLES IN DIFFERENT ITERATIONS + +Table 5: Generation example of our fine-tuned model by SPPO at different iterations. + +
PromptYou will be given a definition of a task first, then some input of the task. You are given a dialog between 2 or more individuals. The dialog will include information as to the relationship between 2 of the participants. At the end, you will be asked to provide an answer as to the relationship of those 2 participants. In this scenario, '0' will represent a spousal relationship, '1' will represent siblings, and '2' will represent a child/parent relationship. Speaker 1: I'll be right with you. Okay? Thanks, Wendy. Speaker 2: Oh my God! How cute is the on-call doctor? Speaker 3: Ooh, so cute, that I'm thinking about jamming this pen in my eye. Speaker 4: Dr. Burke will see you know. Speaker 2: Oh no-no-no, not Dr. Burke. Dr. Burke is out of town. The-the on-call doctor will see me now. Speaker 4: Dr. Richard Burke is out of town. Dr. Timothy Burke, his son, will see you now. Speaker 5: Ready? What is the relationship between Speaker 5 and Richard Burke? Output:
Mistral-7BThe relationship between Speaker 5 and Richard Burke is that of a parent and child, as Richard Burke is identified as the son of another character in the dialog.
Iteration 1The relationship between Speaker 5 and Richard Burke is that of a father and child. Based on the dialogue, it was revealed that Dr. Timothy Burke is the on-call doctor and the son of Dr. Richard Burke.
Iteration 2The relationship between Speaker 5 and Richard Burke is that of a father and child. The conversation reveals that Dr. Timothy Burke is the on-call doctor and he is identified as the son of Dr. Richard Burke.
Iteration 3Speaker 5 is the individual asking about the relationship, so they are not directly related to Dr. Richard Burke. The information provided in the dialog reveals that Dr. Timothy Burke is the on-call doctor and the son of Dr. Richard Burke. Therefore, the answer is: The relationship between Speaker 5 and Dr. Richard Burke is that of a child (Dr. Timothy Burke) and parent. Speaker 5 is inquiring about the relationship, but they are not themselves a part of it. The specified relationship codes (0 for spousal, 1 for sibling, 2 for child/parent) align with this description: Speaker 5 (0, 1, or 2) and Dr. Richard Burke (2) connect as a parent-child duo. Output: 2 (child/parent relationship) In this scenario, Speaker 5's role is to determine the relationship between herself and Dr. Richard Burke, but since they are not related (she is an outside inquirer), the correct answer pertains only to the relationship identified within the dialog: Dr. Richard Burke (father) and Dr. Timothy Burke (son).
+ +Table 6: Another generation example of our fine-tuned model by SPPO at different iterations. + +
PromptQ: Context: Roman Brady is a fictional character from the long running NBC soap opera, Days of Our Lives. The role was originated in 1981 by Wayne Northrop who played the role until 1984, was filled by Drake Hogestyn from 1986 – 1991, again by Northrop from 1991 – 1994, and is currently being portrayed by series veteran Josh Taylor, who stepped into the role in 1997. Question: who is roman brady on days of our lives? Let's give stream of consciousness below
Mistral-7BRoman Brady is a fictional character on the NBC soap opera "Days of Our Lives." He was first portrayed by Wayne Northrop from 1981 to 1984. Later, Drake Hogestyn took over the role from 1986 to 1991. Northrop returned to the role from 1991 to 1994. Since 1997, the character is being portrayed by Josh Taylor. Roman Brady is a significant character in the show's long-running storylines.
Iteration 1Roman Brady is a fictional character on the NBC soap opera "Days of Our Lives." He was first portrayed by Wayne Northrop from 1981 to 1984. Drake Hogestyn took over the role from 1986 to 1991. Northrop returned to play Roman again from 1991 to 1994. Since 1997, the character has been portrayed by Josh Taylor. So, in summary, Roman Brady is a long-standing character on "Days of Our Lives" who has been played by three different actors over the years: Wayne Northrop (1981-1984, 1991-1994), Drake Hogestyn (1986-1991), and currently by Josh Taylor (1997-present).
Iteration 2Roman Brady is a fictional character on the NBC soap opera "Days of Our Lives." He was first portrayed by Wayne Northrop from 1981 to 1984. Drake Hogestyn took over the role from 1986 to 1991. Northrop returned to play Roman again from 1991 to 1994. Since 1997, the character has been portrayed by Josh Taylor. Overall, Roman Brady is a long-standing and complex figure in the show's history, with multiple actors bringing their unique interpretations to the role.
Iteration 3Roman Brady is a fictional character on the NBC soap opera "Days of Our Lives." He was originally played by Wayne Northrop from 1981 to 1984. Drake Hogestyn took over the role from 1986 to 1991. Northrop returned to portray Roman once more from 1991 to 1994. Since 1997, the character has been portrayed by Josh Taylor. Roman Brady is a complex and prominent figure in the long-running daytime drama. Initially played by Northrop in the early 1980s, his tenure included involvement in various storylines, such as romantic relationships and business dealings. Hogestyn's portrayal during the late 1980s and early 1990s introduced new dimensions to the character. Northrop's second stint, from 1991 to 1994, further developed Roman's narrative. Since 1997, Josh Taylor has assumed the role, continuing to contribute to the evolving story of Roman Brady on "Days of Our Lives." Throughout these different portrayals, Roman has remained a central character, known for his intricate relationships, business ventures, and personal struggles.
\ No newline at end of file diff --git a/ICLR/2025/Self-Play Preference Optimization for Language Model Alignment/images.zip b/ICLR/2025/Self-Play Preference Optimization for Language Model Alignment/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..5297c5e393bd9af709b0a4a4c95415312d23cd79 --- /dev/null +++ b/ICLR/2025/Self-Play Preference Optimization for Language Model Alignment/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:479e9d6e0634ca6749b6206e184a0ead01714aed9e23e7b8b9186f430af1e329 +size 1677189 diff --git a/ICLR/2025/Self-Play Preference Optimization for Language Model Alignment/layout.json b/ICLR/2025/Self-Play Preference Optimization for Language Model Alignment/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..97d97ebeeaa40cdf558733c972b15b4c3f72b498 --- /dev/null +++ b/ICLR/2025/Self-Play Preference Optimization for Language Model Alignment/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d972fb99b3dd5fa00b10129c974f5326e586209408952fe1f50abf315c868c1c +size 913802 diff --git a/ICLR/2025/Self-Supervised Diffusion MRI Denoising via Iterative and Stable Refinement/539b94d2-8196-40c1-a631-598aa40dedaf_content_list.json b/ICLR/2025/Self-Supervised Diffusion MRI Denoising via Iterative and Stable Refinement/539b94d2-8196-40c1-a631-598aa40dedaf_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..f617ce4224205b236b4993f3d5ad3e9d8b478e8b --- /dev/null +++ b/ICLR/2025/Self-Supervised Diffusion MRI Denoising via Iterative and Stable Refinement/539b94d2-8196-40c1-a631-598aa40dedaf_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ae56965a4a5387615fd8ee624cb9c156db6e7abc47c9875e1d9994ccdd3cb67f +size 213856 diff --git a/ICLR/2025/Self-Supervised Diffusion MRI Denoising via Iterative and Stable Refinement/539b94d2-8196-40c1-a631-598aa40dedaf_model.json b/ICLR/2025/Self-Supervised Diffusion MRI Denoising via Iterative and Stable Refinement/539b94d2-8196-40c1-a631-598aa40dedaf_model.json new file mode 100644 index 0000000000000000000000000000000000000000..75b538276a710451e7320a8fb3b53442bc70859a --- /dev/null +++ b/ICLR/2025/Self-Supervised Diffusion MRI Denoising via Iterative and Stable Refinement/539b94d2-8196-40c1-a631-598aa40dedaf_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6b87e0bb02aaa1e26a609e6dd00f72420c54204d1ffcbf6d80589780c0e923f8 +size 256213 diff --git a/ICLR/2025/Self-Supervised Diffusion MRI Denoising via Iterative and Stable Refinement/539b94d2-8196-40c1-a631-598aa40dedaf_origin.pdf b/ICLR/2025/Self-Supervised Diffusion MRI Denoising via Iterative and Stable Refinement/539b94d2-8196-40c1-a631-598aa40dedaf_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..b30e1c05f9cca48df149ed91588d12059aa44f3b --- /dev/null +++ b/ICLR/2025/Self-Supervised Diffusion MRI Denoising via Iterative and Stable Refinement/539b94d2-8196-40c1-a631-598aa40dedaf_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4d03aad051223ccf510ec61524bc941de56b66adb86211425d93d42914480190 +size 8925211 diff --git a/ICLR/2025/Self-Supervised Diffusion MRI Denoising via Iterative and Stable Refinement/full.md b/ICLR/2025/Self-Supervised Diffusion MRI Denoising via Iterative and Stable Refinement/full.md new file mode 100644 index 0000000000000000000000000000000000000000..6d26bf73c2a77736cf9a6a5acfb196ce071c230c --- /dev/null +++ b/ICLR/2025/Self-Supervised Diffusion MRI Denoising via Iterative and Stable Refinement/full.md @@ -0,0 +1,896 @@ +# SELF-SUPERVISED DIFFUSION MRI DENOISING VIA ITERATIVE AND STABLE REFINEMENT + +Chenxu Wu $^{1,2}$ , Qingpeng Kong $^{1,2}$ , Zihang Jiang $^{1,2,*}$ & S. Kevin Zhou $^{1,2,3,4,*}$ + +$^{1}$ School of Biomedical Engineering, Division of Life Sciences and Medicine, USTC +$^{2}$ MIRACLE Center, Suzhou Institute for Advance Research, USTC +$^{3}$ State Key Laboratory of Precision and Intelligent Chemistry, USTC +4Key Laboratory of Intelligent Information Processing of CAS, Institute of Computing Technology, CAS {wuchenxu, qpkong27}@mail.ustc.edu.cn, {jzh0103,s.kevin.zhou}@gmail.com + +# ABSTRACT + +Magnetic Resonance Imaging (MRI), including diffusion MRI (dMRI), serves as a "microscope" for anatomical structures and routinely mitigates the influence of low signal-to-noise ratio scans by compromising temporal or spatial resolution. However, these compromises fail to meet clinical demands for both efficiency and precision. Consequently, denoising is a vital preprocessing step, particularly for dMRI, where clean data is unavailable. In this paper, we introduce Di-Fusion, a fully self-supervised denoising method that leverages the latter diffusion steps and an adaptive sampling process. Unlike previous approaches, our single-stage framework achieves efficient and stable training without extra noise model training and offers adaptive and controllable results in the sampling process. Our thorough experiments on real and simulated data demonstrate that Di-Fusion achieves state-of-the-art performance in microstructure modeling, tractography tracking, and other downstream tasks. Code is available at https://github.com/FouierL/Di-Fusion. + +# 1 INTRODUCTION + +Characterizing real-world noise using data distributions is difficult (Huang et al., 2021), particularly in non-invasive imaging modalities such as Magnetic Resonance Imaging (MRI), where the noise predominantly originates from numerous factors including thermal fluctuations (Fadnavis et al., 2020a). MRI, including its subtype Diffusion-weighted Magnetic Resonance Imaging (dMRI) (Basser et al., 1994), serves as a vital tool for observing inferred structures (Le Bihan, 2003; Le Bihan et al., 2006; Schilling et al., 2019) and necessitates a high Signal-to-Noise Ratio (SNR) for better clinical decision making. While it is possible to improve the SNR by increasing the acquisition time or reducing the image resolution, either way hinders the clinical application of MRI. Therefore, much research has focused on processing techniques like denoising for dMRI to improve its SNR and reduce acquisition time, which holds a great significance for clinical efficiency and accuracy. + +The dMRI typically consists of 4D data $(X \in \mathbb{R}^{w \times h \times d \times l})$ , including 3D spatial coordinates $(w, h$ and $d)$ and 1D diffusion vectors $(l)$ , in which diffusion is measured along different gradient directions (Westin et al., 2016). Different clinical applications require varying numbers of diffusion vectors and acquisition strategies, leading to diverse noise sources and distributions, which complicates noise modeling and denoising implementation. For supervised methods (Gibbons et al., 2019; Kaye et al., 2020), not only is it non-practical to obtain paired data with high SNR and low SNR, but the diversity of dMRI also leads to distributional shifts among different datasets, resulting in a fundamental drop in their performances (Darestani et al., 2021). Different from these approaches, our method offers a self-supervised solution for dMRI denoising through a single-stage construction and an efficient adaptive sampling process. Without the need for paired training data or clean data, our method is capable of removing the noise from dMRI with a denoising diffusion model. To mitigate the drift problem, a Fusion process is proposed to align the forward process. Moreover, as real-world noise is difficult to characterize, a "Di-" process is introduced to represent the noise distribution in a more + +effective manner. Consequently, our method Di-Fusion is able to achieve better denoising results while preserving the desired anatomical structures. + +The main contributions of our work are three-fold: (i) We propose Di-Fusion, a stable and self-supervised dMRI denoising method leveraging the latter diffusion steps (Section 3.2). Di-Fusion integrates the statistical self-supervised denoising techniques (Batson & Royer, 2019) into the diffusion models through the Fusion process and "Di-" process (Section 3.1). (ii) Di-Fusion enables iterative refinement through an adaptive sampling process (Section 3.3). (iii) With thorough comparisons on real and simulated data, Di-Fusion demonstrates state-of-the-art denoising performance in microstructure modeling, tractography, and other downstream tasks (Section 4). + +# 2 BACKGROUND AND RELATED WORKS + +# 2.1 STATISTICAL SELF-SUPERVISED IMAGE DENOISING + +Built upon the assumption that additive noise is pixel-wise independent, Noise2Noise (Lehtinen et al., 2018) learns the process of image restoration solely by observing corrupted measurements: + +$$ +\underset {\theta} {\arg \min } \left\{\mathbb {E} \| f _ {\theta} \left(x ^ {\prime}\right) - x \| ^ {2} \right\} \approx \underset {\theta} {\arg \min } \left\{\mathbb {E} \| f _ {\theta} \left(x ^ {\prime}\right) - y \| ^ {2} + \mathbb {E} \| x - y \| ^ {2} \right\}, \tag {1} +$$ + +where $x$ and $x'$ are independent corrupted measurements of the clean ground truth $y$ and $f_{\theta}$ is a denoising function which is parameterized by $\theta$ . Due to the assumption of independent noise, $\mathbb{E}\|x - y\|^2$ is usually a constant. Furthermore, Noise2Self (Batson & Royer, 2019) proposes the $\mathcal{J}$ -invariant theory, using only the same corrupted measurement to perform denoising. Following this theory, Noise2Void (Krull et al., 2019), Laine et al. (Laine et al., 2019) and Noise2Same (Xie et al., 2020) focus on how to construct unorganized collections of corrupted images by masked-based blind spot networks. Noisier2Noise (Moran et al., 2020) and Noisy-As-Clean (Xu et al., 2020) add additional noise to the original noisy image to generate training image pairs. Nevertheless, these methods exhibit a significant drop in performance when confronted with real-world noisy images, particularly when the explicit noise model is unknown (Huang et al., 2021; Mansour & Heckel, 2023). + +# 2.2 DIFFUSION MODELS + +Denoising Diffusion Probabilistic Model (DDPM) (Ho et al., 2020; Sohl-Dickstein et al., 2015) emerges as a powerful generative model, which is composed of a parameterized Markov chain with $T$ diffusion steps to fit a given data distribution. The forward process $q(x_{t}|x_{t - 1})$ serves to perturb the data by gradually adding Gaussian noise based on a pre-defined noise schedule $\beta_{1,\dots ,T}$ (Following (Ho et al., 2020), $\sigma_t^2\coloneqq \beta_t$ $\alpha_{t}\coloneqq 1 - \beta_{t}$ and $\bar{\alpha}_t\coloneqq \prod_{s = 1}^t\alpha_s$ are sets of predetermined constants in this paper) until the data distribution approaches a standard Gaussian distribution: + +$$ +q \left(x _ {1: T} \mid x _ {0}\right) := \prod_ {t = 1} ^ {T} q \left(x _ {t} \mid x _ {t - 1}\right), \quad q \left(x _ {t} \mid x _ {t - 1}\right) := \mathcal {N} \left(x _ {t}; \sqrt {1 - \beta_ {t}} x _ {t - 1}, \beta_ {t} \mathbf {I}\right). \tag {2} +$$ + +The reverse process starts from a Gaussian distribution $z \sim \mathcal{N}(\mathbf{0},\mathbf{I})$ and uses a parameterized Gaussian transformation kernel $F_{\theta}$ to learn the step-by-step restoration of the original data distribution: + +$$ +p _ {F} \left(x _ {0: T}\right) := p \left(x _ {T}\right) \prod_ {t = 1} ^ {T} p _ {F} \left(x _ {t - 1} \mid x _ {t}\right), \quad p _ {F} \left(x _ {t - 1} \mid x _ {t}\right) := \mathcal {N} \left(x _ {t - 1}; F _ {\theta} \left(x _ {t}, t\right), \sigma_ {t} ^ {2} \mathbf {I}\right). \tag {3} +$$ + +Recently, there has been a large interest in exploring ways to enhance the extensibility and sampling efficiency of DDPM. For enhancing extensibility, (Song & Ermon, 2019) uses gradient of the log density as a force to pull a random sample across the data space towards regions with a high data density characterized by $p(x)$ (Croitoru et al., 2023) by adopting Langevin dynamics algorithm (Hyvärinen & Dayan, 2005). (Song et al., 2020b) further extend the score function as solutions to reverse-time Stochastic Differential Equation (SDE) and extends DDPM to continuous states. Cold diffusion (Bansal et al., 2024) investigates the necessity of Gaussian noise or any form of randomness for diffusion models to work effectively in practical scenarios. (Zhou et al., 2024) introduces a family of processes that interpolate between two paired distributions given as endpoints. For accelerating sampling speed, (Song et al., 2020a) and (Watson et al., 2021) generalize DDPM by introducing a class of non-Markovian diffusion processes that achieves the same sampling objective. + +Previous works have demonstrated that diffusion models can be effectively applied to image restoration tasks (Kawar et al., 2022; Xia et al., 2023; Ozdenizci & Legenstein, 2023; Chung et al., 2022b; Sahara et al., 2022a; Fei et al., 2023). Conditioned on a low-resolution input image, (Saharia et al., 2022b) performs image super-resolution via repeated refinement. (Chung et al., 2022a), (Song et al., 2021), (Song et al., 2024) and (Gao et al., 2023) extend diffusion models to inverse problems in medical imaging. However, these models require clean data (e.g., normal-dose CT) to capture their prior data distribution, which makes direct application of these methods to dMRI data impractical because no clean data is available in dMRI itself. Our method does not require extra noise model training or clean ground truth $y$ and can be applied to the aforementioned scenarios. + +# 2.3 RELATED WORKS + +The initial denoising methods employed for dMRI are adaptations of techniques developed for natural images, like non-local means (NL-means (Coupé et al., 2008) and its variants (Chen et al., 2016; Coupé et al., 2012)). Under the assumption that small spatial structures exhibit relative consistency across varied dMRI measurements, Local Principal Component Analysis (LPCA) (Manjón et al., 2013) and its Marchenko-Pastur extension (MPPCA) (Veraart et al., 2016) project dMRI to a local low-rank approximation. Training the Noise2Noise (Lehtinen et al., 2018) model directly using the same slices from different volumes can result in excessively smooth outcomes (Shown in the experiments of (Xiang et al., 2023)). So, utilizing the entire volumes, Patch2Self (Fadnavis et al., 2020a) trains a full-rank locally linear denoiser to perform volume-wise denoising. Patch2Self2 (Fadnavis et al., 2024) further enhances the computational efficiency of Patch2Self. Recently, Corruption2Self (Tu et al., 2025) extends denoising score matching to accommodate noisy observations and provides a framework for denoising MRI. A state-of-the-art self-supervised method DDM2 (Xiang et al., 2023) is proposed for denoising dMRI, which incorporates statistical image denoising into the diffusion model in a three-stage framework. However, the results obtained by DDM2 are prone to over-denoising as its performances in downstream tasks are not satisfactory (Section 4.2). + +# 3 METHODS + +4D dMRI consists of independent noisy samples acquired at different gradient directions. Considering $x = X_{*,*,i,j}$ ( $i$ : slice index, $j$ : volume index) as the target slice to denoise, $x' = X_{*,*,i,j-1}$ and $x$ are independent corrupted measurements of the clean ground truth $y$ . In this section, we demonstrate how to decompose the single-step mapping from $x'$ to $x$ into $T$ steps using a parameterized Markov chain (We denote $\mathcal{F}_{\theta}$ as the parameterized transformation kernel in our method). We provide a complete definition of the entire Di-Fusion in Appendix B. + +There are five questions to be answered in our method. Q1: Since $x'$ and $x$ are still different, how can we obtain the forward process to construct the multi-step mapping between two endpoints? Q2: How can we represent the noise distribution without extra noise model training? Q3: How can training be conducted with only noisy data? Q4: Why does Di-Fusion only leverage the latter diffusion steps? Q5: How does the reverse process enable iterative refinement? + +# 3.1 MODIFICATIONS OF FORWARD PROCESS + +Q1 We use $\mathcal{F}_{\theta}$ to map from $x^{\prime}$ to $x$ , considering $x^{\prime}$ as $x_{T}$ and $x$ as $x_0$ $\mathcal{F}_{\theta}$ should take $x_{t}$ and $t$ as input and output $x_{out}$ close to $x$ .. + +$$ +x + \epsilon_ {t} = x _ {o u t} = \mathcal {F} _ {\theta} (x _ {t}, t), \| x - x _ {o u t} \| ^ {2} < \varepsilon , \tag {4} +$$ + +where $\varepsilon$ represents a small positive value, $\epsilon_{t}$ is a perturbation term that depends on $t$ , and $\epsilon_{t}$ decays as $t \to 0$ . Performing the reverse process of DDPM, we find that $x_{t-1}$ should be a linear interpolation between $x_{out}$ and $x_{t}$ plus a noise instead of $\bar{x}_{t-1}$ , the major difference is introduced by $x_{out}$ (See Appendix C.1 for detailed derivations): + +$$ +x _ {t - 1} = \underbrace {\frac {\sqrt {\bar {\alpha} _ {t - 1}} \beta_ {t}}{1 - \bar {\alpha} _ {t}} \left(x + \epsilon_ {t}\right)} _ {\text {m a j o r d i f f e r e n c e}} + \frac {\sqrt {\alpha_ {t}} \left(1 - \bar {\alpha} _ {t - 1}\right)}{1 - \bar {\alpha} _ {t}} x _ {t} + \sigma_ {t} z \neq \bar {x} _ {t - 1} = \sqrt {\bar {\alpha} _ {t - 1}} x ^ {\prime} + \sqrt {1 - \bar {\alpha} _ {t - 1}} z, \tag {5} +$$ + +where $z \sim \mathcal{N}(\mathbf{0},\mathbf{I})$ , $\{\bar{x}_t\}_{1}^{T}$ are obtained by directly performing the forward process in DDPM and $\{x_{t}\}_{1}^{T}$ are obtained from the reverse process of DDPM. Since the component $\epsilon_t \to 0$ as $t \to 0$ , a + +![](images/e667fb9b3033eff5a9e467f04e4de9df3c7782b4054084ec82d4e4ae10a6d211.jpg) +Figure 1: (a) Fusion process (Section 3.1) aligns $\{\bar{x}_t\}_{1}^{T}$ to $\{x_{t}\}_{1}^{T}$ and avoids drift ("Drift" means drifted results, "Final" means the denoised version of "Target"); (b) Training the latter diffusion steps (Section 3.2) imposes restrictions on the generation ability of diffusion models and decreases uncertainty; (c) Run-Walk accelerated sampling (Section 3.3) accelerates the entire sampling process. + +larger proportion of $x_{t-1}$ aligns closer to $x$ , rather than merely being a noisy version of $x'$ . If we still feed $x_{t-1}$ and $t-1$ into $\mathcal{F}_{\theta}$ , it will cause output deviations, which accumulate in the sampling chain and ultimately lead to the drift problem (Fig. 1 (a)). + +Fusion process (Q1) Since $\mathcal{F}_{\theta}$ learns the mapping from $x^{\prime}$ to $x$ , $\{x_{t}\}_{1}^{T}$ should be combinations of $x$ and $x^{\prime}$ , augmented with a sampled noise $z\sim \mathcal{N}(\mathbf{0},\mathbf{I})$ . These combinations can be approximated by utilizing the reverse process in DDPM to compute the linear interpolation between $x^{\prime}$ to $x$ : + +$$ +x _ {t} ^ {*} = \lambda_ {1} ^ {t} x + \lambda_ {2} ^ {t} x ^ {\prime}, \tag {6} +$$ + +$$ +q \left(x _ {t} \mid x _ {t} ^ {*}\right) := \mathcal {N} \left(x _ {t}; \sqrt {\bar {\alpha} _ {t}} x _ {t} ^ {*}, (1 - \bar {\alpha} _ {t}) \mathbf {I}\right), \tag {7} +$$ + +where we rewrite $\lambda_1^t = \frac{\sqrt{\overline{\alpha}_{t - 1}}\beta_t}{1 - \overline{\alpha}_t}$ and $\lambda_2^t = \frac{\sqrt{\alpha_t(1 - \overline{\alpha}_{t - 1})}}{1 - \overline{\alpha}_t}$ for simplification. As $t$ decreases, $x_{t}^{*}$ becomes closer to $x$ since $\lambda_1^t$ has a higher value. By substituting $x_{t}^{*}$ for $x^{\prime}$ in Eq. (5), the Fusion process can be achieved, which obtain $x_{t}^{*}$ with different $t$ as shown in Fig. S19. Intuitively, the Fusion process gradually introduces the target denoising slice $x$ to the model, guiding the model to optimize in a fixed direction, thereby mitigating the drift. We thereby address Q1 by defining the forward process $q(x_{t}|x_{t}^{*})$ . + +Q2 Approximating noise as $z$ is definitely a feasible approach. However, the noise distribution in the real world often exhibits complex statistical properties, and thus cannot be easily captured mathematically (Section 2.1). Similar challenges also exist in dMRI. + +"Di-" process (Q2) To better characterize real-world noise, we represent the noise distribution involving the input noisy data. Since $x$ and $x'$ are independent corrupted measurements of the redundant part $y$ and have independent noise, directly calculating $x - x'$ leaves some linear combinations of noise ( $x = y + n_1$ , $x' = y + n_2$ , $x - x' = n_1 - n_2$ , here $n_1$ and $n_2$ represent the noise in $x$ and $x'$ , respectively), we perform a zero-mean operation on these linear combinations of noise to comply with the zero-mean constraint of $z$ : + +$$ +\xi_ {x - x ^ {\prime}} = \operatorname {m e s s} \left(\left(x - x ^ {\prime}\right) - \mu_ {x - x ^ {\prime}}\right), \quad \mu_ {x - x ^ {\prime}} = \frac {\sum_ {m = 1} ^ {w} \sum_ {n = 1} ^ {h} \left(x _ {m n} - x ^ {\prime} _ {m n}\right)}{w \cdot h}, \tag {8} +$$ + +where $mess(\cdot)$ means spatial shuffling operation originated from DDM2 (Xiang et al., 2023), $\mu_{x - x'}$ is the mean of $x - x'$ . $\xi_{x - x'}$ theoretically preserves the variance information of the noise (See Appendix C.2 for proof) and will serve as the noise distribution employed in both $q(x_t|x_t^*)$ and $p_{\mathcal{F}}(x_{t-1}|x_t)$ . In this case, the forward process and reverse process no longer follow a Gaussian distribution, but they can be represented as Eq. (18) and Eq. (10), respectively. In Fig. S20, we demonstrate through experiments that $\xi_{x - x'}$ has different statistical properties from $z$ . In Fig. S27, we show the impact of $\xi_{x - x'}$ and $z$ on the reverse process. + +![](images/3e8754a46bf7b345699cb09dd71f38910b78a5783d546ac3b67c05798865e4a6.jpg) +Figure 2: Overview of our single-stage Di-Fusion. The training process does not involve any extra model training apart from $\mathcal{F}_{\theta}$ , and the sampling process offers adaptive and controllable results. + +# 3.2 TRAINING PROCESS + +$\mathcal{I}$ -Invariance optimization (Q3) When training $\mathcal{F}_{\theta}$ , we first consider $x$ and $x'$ as $\mathcal{J} = \{x, x'\}$ . Assuming that the noise distributions of $x$ and $x'$ are mutually independent, the model with $x'$ as input and $x$ as the optimization target satisfies the property of input-output independence. According to the Proposition 1 declared in Noise2Self (Batson & Royer, 2019), the loss between $\mathcal{F}_{\theta}(x')$ and $x$ will in expectation equal to the loss between $\mathcal{F}_{\theta}(x')$ and clean ground truth $y$ , plus a constant $\mathbb{E}\|x - y\|^2$ (Eq. (1)). Therefore, minimizing $\mathbb{E}\|\mathcal{F}_{\theta}(x') - x\|^2$ is equivalent to minimizing $\mathbb{E}\|\mathcal{F}_{\theta}(x') - y\|^2$ with respect to the clean ground truth $y$ and our simplified training objective is: + +$$ +L _ {\text {s i m p l e}} (\theta) := \mathbb {E} _ {t, x _ {t} ^ {*}, \xi_ {x - x ^ {\prime}}} \left[ \left\| x - \mathcal {F} _ {\theta} \left(\sqrt {\bar {\alpha} _ {t}} x _ {t} ^ {*} + \sqrt {1 - \bar {\alpha} _ {t}} \xi_ {x - x ^ {\prime}}, t\right) \right\| ^ {2} \right] \tag {9} +$$ + +Intuition of training the latter diffusion steps (Q4) In DDPM, it is shown that when conditioned on the same latent, the samples share high-level attributes (when conditioned on say $x_{250}$ , the samples are close to each other) (Ho et al., 2020). It is because of the thorough training in the former diffusion steps $(x_{T} \rightarrow x_{T_{c}})$ that DDPM possesses diverse generative capabilities. Since we perform an image denoising task with such a strong prior (from one noisy volume to another noisy volume), training only the latter diffusion steps is possible to reduce the diverse generative capabilities of $\mathcal{F}_{\theta}$ . More precisely, only the last $T_{c}$ steps in the Markov chain $(x_{T_{c}} \rightarrow x_{0})$ are trained. In this way, a generative training task is simplified into a conditional generation task $(x_{T_{c}} \rightarrow x_{0}, T_{c} \leq T)$ , with more $x_{0}$ information provided in $\{x_{t}\}_{1}^{T_{c}}$ (Fig. 1 (b)). + +There are two main reasons for adopting this strategy. Firstly, training the latter diffusion steps weakens the generation capacity of the diffusion model, reducing its diversity. This, in turn, lowers the uncertainty in denoising results for our task. Secondly, with the same training time, obtaining a more stable $\mathcal{F}_{\theta}$ is possible. By training only the latter diffusion steps, each step receives more training iterations, resulting in improved stability for the model performance. Algorithm 1 outlines the training process, and Fig. 2 (left) provides an overview of the entire training process. + +Algorithm 1 Training process +Initialize $\mathcal{F}_{\theta}$ randomly; input 4D data: $X\in \mathbb{R}^{w\times h\times d\times l}$ +repeat + $t\sim$ Uniform $(\{1,\dots ,T_c\})$ training the latter diffusion steps in Section 3.2 + $x = X_{*,*,i,j},x' = X_{*,*,i,j - 1}$ i: slice index, $j$ : volume index + $\xi_{x - x'} = mess((x - x') - \mu_{x - x'})$ Eq. (8) + $x_{t}^{*} = \lambda_{1}^{t}x + \lambda_{2}^{t}x^{\prime}$ Eq. (6) take gradient descent step on: $\nabla_{\theta}\| x - \mathcal{F}_{\theta}\left(\sqrt{\bar{\alpha}_t} x_t^* +\sqrt{1 - \bar{\alpha}_t}\xi_{x - x'},t\right)\| ^2$ Eq. (9) resample $i$ and $j$ +until converged + +# 3.3 SAMPLING PROCESS + +We make two specific modifications on $p_{\mathcal{F}}(x_{t - 1}|x_t)$ to achieve an adaptive sampling process and directly begin the sampling process at $x_{T_c}$ . See Fig. 2 (right) for an overview of the entire sampling process and Algorithm 2 for a detailed description of the complete sampling process. + +Run-Walk accelerated sampling After substituting the standard normal distribution in Eq. (3) with $\xi_{x - x'}$ , a typical reverse process $p_{\mathcal{F}}(x_{t - 1}|x_t)$ could be formulated as: + +$$ +p _ {\mathcal {F}} \left(x _ {t - 1} \mid x _ {t}\right)\rightarrow x _ {t - 1} = \lambda_ {1} ^ {t} \mathcal {F} _ {\theta} \left(x _ {t}, t\right) + \lambda_ {2} ^ {t} x _ {t} + (\sigma_ {t} \cdot \eta) \xi_ {x - x ^ {\prime}}, \tag {10} +$$ + +where $\eta$ is a constant. DDIM (Song et al., 2020a) notes a special case when $\sigma_t = 0$ for all $t^1$ ; the forward process is deterministic given $x_{t - 1}$ and $x_{t}^{*}$ except for $t = 1$ ; in the sampling process, the coefficient before the noise $\xi_{x - x'}$ becomes zero, resulting in an implicit probabilistic model (Mohamed & Lakshminarayanan, 2016). However, we do not follow the uniform step strategy of DDIM in the sampling process; instead, we use Run-Walk accelerated sampling. Consider a DDPM sampling process from $x_{T_c}$ to $x_0$ , when $t$ is large ( $t > T_r, 1 \leq T_r \leq T_c$ ), the speed during each reverse process is slow; thus, acceleration can be applied (Run). Conversely, when $t$ is small ( $t < T_r$ ), the speed is fast, and deceleration is required (Walk). In equation form, the difference between $x_{t - 1}$ and $x_{t}$ can be represented as (See Appendix C.3 for additional derivations): + +$$ +x _ {t - 1} - x _ {t} = \underbrace {\lambda_ {1} ^ {t} \left(x - x _ {t}\right)} _ {\text {s p e e d}} + \underbrace {\lambda_ {1} ^ {t} \epsilon_ {t}} _ {\text {p e r t u r b a t i o n}}. \tag {11} +$$ + +When $t$ is large (e.g. $t > T_r$ ), $\lambda_1^t$ approaches zero and the speed $(\lambda_1^t(x - x_t))$ towards $x_0$ is relatively slow. This is when we perform accelerated sampling. When reaching the latter sampling process, $\lambda_1^t$ progressively increases and the speed towards $x_0$ is quite fast. This is when we stop accelerating. When $T_r = 1$ , Run-Walk accelerated sampling degenerates into DDIM sampling. When $T_r = T_c$ , Run-Walk accelerated sampling degenerates into DDPM sampling. + +Now let us consider the forward process as defined not on all $\{x_{t}\}_{1}^{T_{c}}$ , but on a subset $\{x_{\tau_1},\ldots ,x_{\tau_S}\}$ where $\tau$ is an increasing sub-sequence of $[1,\dots,T_c]$ of length $S$ . In particular, we define the sequential forward process over $x_{\tau_1},\ldots ,x_{\tau_S}$ ( $x_{\tau_k} = \sqrt{\bar{\alpha}_{\tau_k}} (\lambda_1^{\tau_k}x + \lambda_2^{\tau_k}x') + \sqrt{1 - \bar{\alpha}_{\tau_k}}\xi_{x - x'}$ , $1\leq k\leq S$ ). The sampling process now samples according to reversed $(\tau)$ (In practice, $\tau = \{1,2,\dots,T_r - 1,T_r,T_r + p,\dots ,T_c - p,T_c\}$ , where $p$ is an integer representing the acceleration factor). This can be more intuitively understood in Fig. 1 (c). + +# Algorithm 2 Sampling process + +Load pre-trained $\mathcal{F}_{\theta}$ ; input: $X \in \mathbb{R}^{w \times h \times d \times l}$ , $i, j$ and $\mathcal{CSN}\mathcal{R}$ + +$$ +x = X _ {*, *, i, j}, x ^ {\prime} = X _ {*, *, i, j - 1} +$$ + +$\triangleright i$ : slice index, $j$ : volume index + +$$ +\xi_ {x - x ^ {\prime}} = \operatorname {m e s s} \left(\left(x - x ^ {\prime}\right) - \mu_ {x - x ^ {\prime}}\right) +$$ + +$$ +\triangleright \text {E q .} (8) +$$ + +$$ +x _ {T _ {c}} = \sqrt {\bar {\alpha} T _ {c}} \left(\lambda_ {1} ^ {T _ {c}} x + \lambda_ {2} ^ {T _ {c}} x ^ {\prime}\right) + \sqrt {1 - \bar {\alpha} T _ {c}} \xi_ {x - x ^ {\prime}} +$$ + +$$ +\triangleright \operatorname {E q}. (7) +$$ + +$$ +b _ {x} = \frac {\sum_ {m = 1} ^ {w} \sum_ {n = 1} ^ {h} 1}{2 \cdot \sum_ {m = 1} ^ {w} \sum_ {n = 1} ^ {h} \mathbb {I} _ {(x _ {m n} > \rho_ {1})}} + \frac {\sum_ {m = 1} ^ {w} \sum_ {n = 1} ^ {h} 1}{2 \cdot \sum_ {m = 1} ^ {w} \sum_ {n = 1} ^ {h} \mathbb {I} _ {(x _ {m n} > \rho_ {2})}} +$$ + +$$ +\triangleright \text {E q .} (1 2) +$$ + +for $\tau_{k} =$ reversed $\{1,2,\dots ,\mathrm{T_r - 1},\mathrm{T_r},\mathrm{T_r + p},\dots ,\mathrm{T_c - p},\mathrm{T_c}\}$ do + +$$ +\xi_ {x - x ^ {\prime}} = \operatorname {m e s s} \left(\xi_ {x - x ^ {\prime}}\right) +$$ + +$\triangleright$ Shuffle $\xi_{x - x'}$ again + +$$ +x _ {o u t} = \mathcal {F} _ {\theta} \left(x _ {\tau_ {k}}, \tau_ {k}\right) +$$ + +$$ +\triangleright \operatorname {E q}. (4) +$$ + +$$ +d _ {x} = \left\| x - x _ {o u t} \right\| ^ {2} \times b _ {x} +$$ + +$$ +\triangleright \text {E q .} (1 3) +$$ + +if $d_x > \mathcal{CSNR}$ then + +In Section 3.3 + +$x_0 = x_{out}$ ; break + +Eq. (10) + +else + +$$ +x _ {\tau_ {k - 1}} = \lambda_ {1} ^ {\tau_ {k}} x _ {\text {o u t}} + \lambda_ {2} ^ {\tau_ {k}} x _ {\tau_ {k}} + (\sigma_ {\tau_ {k}} \cdot \eta) \xi_ {x - x ^ {\prime}} \quad \triangleright \text {E q .} \tag {10} +$$ + +end if + +end for + +return $x_0$ + +Towards iterative and controllable refinement (Q5) During our experiments, we observe that the intermediate outputs, $x_{out}$ , obtained during the sampling process demonstrate a substantial success in denoising. Therefore, we explore the feasibility of adaptive termination to stop sampling prematurely. More specifically, the degree of denoising in $x_{out}$ can be characterized by its distance from $x$ . Nevertheless, directly computing this distance $\| x - x_{out} \|^2$ presents a problem. When the slice index $i$ is located at the edges, the resulting distance tends to be smaller due to the reduced + +![](images/657f07f977a119f3919b35a37d54416e0a057f5cf7a53b946ea161e8fe9ed436.jpg) +Figure 3: Density map of FBC projected on the streamlines of the OR bundles. The numbers in parentheses represent the number of streamlines. Di-Fusion generates the minimal number of streamlines while maintaining high FBCs (consider "Noisy/filtering" as references for high FBCs). + +amount of brain tissue in these edge slices. Hence, it would be preferable to calculate a coefficient $b_{x}$ that accounts for the ratio of brain tissue to the entire image. Here, we adopt a simple definition: + +$$ +b _ {x} = \frac {\sum_ {m = 1} ^ {w} \sum_ {n = 1} ^ {h} 1}{2 \cdot \sum_ {m = 1} ^ {w} \sum_ {n = 1} ^ {h} \mathbb {I} _ {\left(x _ {m n} > \rho_ {1}\right)}} + \frac {\sum_ {m = 1} ^ {w} \sum_ {n = 1} ^ {h} 1}{2 \cdot \sum_ {m = 1} ^ {w} \sum_ {n = 1} ^ {h} \mathbb {I} _ {\left(x _ {m n} > \rho_ {2}\right)}}, \tag {12} +$$ + +where $\rho_{1}$ and $\rho_{2}$ are constants depending on the data normalization methods employed $^{2}$ and $\mathbb{I}(\cdot)$ is an indicator function. $b_{x}$ can be used to correct $d_{x}$ : + +$$ +d _ {x} = \left\| x - x _ {\text {o u t}} \right\| ^ {2} \times b _ {x}. \tag {13} +$$ + +Since $d_x$ has been corrected, we can pre-define a universal value $\mathcal{CSNR}$ to perform the iterative and controllable refinement on each slice. During $p_{\mathcal{F}}(x_{t - 1}|x_t)$ , we first get $x_{out} = \mathcal{F}_{\theta}(x_t,t)$ and compute $d_x$ (Eq. (13)). Then if $d_x$ is greater than $\mathcal{CSNR}$ , $x_0 = x_{out}$ and the refinement iteration breaks. In contrast, the refinement iteration continues if $d_x$ is smaller than $\mathcal{CSNR}$ . In extreme cases, when $\mathcal{CSNR} = 0$ , the reverse process will immediately terminate and output $x_0$ . When $\mathcal{CSNR} = 1$ , the complete reversed $(\tau)$ will be executed until completion. + +# 4 EXPERIMENTS + +# 4.1 DATASETS AND COMPETING METHODS + +Datasets To thoroughly evaluate Di-Fusion, we perform experiments on three publicly available brain dMRI datasets acquired using different, commonly-used acquisition schemes: (i) High-Angular Resolution Diffusion Imaging (Stanford HARDI, $X \in \mathbb{R}^{106 \times 81 \times 76 \times 150}$ (Rokem, 2016)); (ii) Multi-Shell (Sherbrooke 3-Shell dataset, $X \in \mathbb{R}^{128 \times 128 \times 64 \times 193}$ (Garyfallidis et al., 2014)); (iii) Single-Shell (Parkinson's Progression Markers Initiative (PPMI) dataset, $X \in \mathbb{R}^{116 \times 116 \times 72 \times 64}$ (Marek et al., 2011)). Simulated experiments are carried out on the fastMRI datasets (Tibrewala et al., 2023; Zbontar et al., 2018). We simulate noisy data with five different noise intensities. + +Competing methods We compare Di-Fusion with five competing methods in the main paper (all experimental details are provided in Appendix D.1): (i) Adaptive Soft Coefficient Matching (ASCM), an improved extension of non-local means denoising (Coupé et al., 2012). (ii) Deep Image Prior (DIP), a self-supervised denoising method (Ulyanov et al., 2018). (iii) Noisier2Noise (Nr2N), a statistic-based denoising method (Moran et al., 2020). (iv) Patch2Self (P2S), a multi-volume denoising method (Fadnavis et al., 2020a). (v) DDM2, state-of-the-art denoising method (Xiang et al., 2023). More comparisons with other denoising methods, including MPPCA (Veraart et al., 2016), Noise2Score (Kim & Ye, 2021), Recorrupted2Recorrupted (Pang et al., 2021), and Patch2Self2 (Fadnavis et al., 2024), can be found in Appendix E. + +# 4.2 IMPACTS ON DOWNSSTREAM CLINICAL TASKS + +Effect on tractography The noise in dMRI can impact tractography results, potentially causing the generation of spurious streamlines by the tracking algorithm (Fadnavis et al., 2020a; Garyfallidis et al., 2014; Schilling et al., 2019). We explore the effect of denoising on probabilistic tracking (Girard et al., 2014) by employing the Fiber Bundle Coherency (FBC) metric (Portegies et al., 2015) and reconstruct the optic radiation (OR) bundles (See Appendix D.2 for details). Since low FBCs indicate which fibers are poorly aligned with their neighbors, we further clean the tractography results of noisy data (captioned by "Noisy Filtering") using a stopping criterion (Meesters et al., 2016). In Fig. 3, we + +![](images/3770247541bd7391a5d08ec0c0b75d9d01fa989a91d36cc3a48f0a18e91ea5c5.jpg) +Figure 4: Scatter plots of the microstructure model predictions against input data. The top-left of each plot shows the quantitative $R^2$ metric computed from each model fit on the corresponding data. Our data points are more concentrated (higher $R^2$ ). + +![](images/d4c5d5c495095fe61865350d3bdb0e49afa5938e28b3cebbfc1026d86f528964.jpg) + +![](images/428ed0f5615471def5609d15106f192cb89153f89ccc063cecdcfef03d7f0fd1.jpg) + +![](images/8c4d8712831c9cfcd6231d61302eb04c17f42d2a2870d6152c34dc92d9e970af.jpg) + +show the effect on the tractography of OR. Although DDM2 yields the fewest streamlines, noticeably, it misses the high FBCs indicated by the white arrow in Fig. 3. Di-Fusion generates the minimal number of streamlines while maintaining high FBCs, which indicates that our method maximizes the denoising performance while preserving fiber bundle information. + +Effect on microstructure model fitting Denoising methods can be compared based on their accuracy in fitting the diffusion signal (Ades-Aron et al., 2018). We apply two commonly used microstructure fitting models, namely diffusion tensor model (DTI) (Basser et al., 1994) and Constrained Spherical Deconvolution (CSD) (Tournier et al., 2007), on noisy and denoised data (Appendix D.2 for details). We show the quantitative $R^2$ metric of microstructure predictions against the original data for Corpus Callosum (CC) and Centrum SemiOvale (CSO) in Table S2 and the corresponding scatter plots are in Fig. 4. As measured by $R^2$ , Di-Fusion achieves the best results across all four different settings. This means that Di-Fusion aids in the characterization of the microstructure. + +Effect on diffusion signal estimates We further examine how the denoising quality translates to creating quantitative and clinically-relevant DTI (Basser et al., 1994) diffusion signal estimates (Details are in Appendix D.2). In Fig. S9, we show fractional anisotropy, axial diffusivity, mean diffusivity, and radial diffusivity comparisons. Our method effectively suppresses noise and reconstructs fiber tracts. + +# 4.3 QUANTITATIVE AND QUALITATIVE RESULTS ON in-vivo DATA + +Quantitative results on SNR/CNR metrics Considering the infeasibility of using metrics that need clean ground truth and their limited correlation with clinical utility (Mason et al., 2019), computing metrics in downstream clinical regions of interest is more reasonable (Adamson et al., 2021). To quantify the denoising performance, we employ Signal-to-Noise Ratio (SNR) and Contrast-to-Noise Ratio (CNR) metrics (Details are in Appendix D.3). The quantitative denoising results are reported as mean and standard deviation scores for the complete 4D volumes in Fig S12. Di-Fusion indicates better performance in terms of SNR/CNR metrics. + +Qualitative results In Fig. 5, we visualize the denoising results and residuals on axial slices for Stanford HARDI (Fig. S13, S14 and Fig. S15 for more qualitative results). From the residuals of Fig. 5, the area indicated by the red arrow does not appear in "OURS", indicating that Di-Fusion does not remove any anatomical structure during denoising. All pictures are best viewed when zoomed in. + +![](images/9b41c082a3b11d3fba130b53c1405c4964f944a56324e6bd5eba46a71dbc3904.jpg) +Figure 5: Qualitative results. "OURS" results are obtained when $\mathcal{CSN}\mathcal{R} = 0.040$ . The area indicated by the red arrow does not appear in "OURS", indicating that Di-Fusion does not remove structural information during denoising. + +# 4.4 QUANTITATIVE RESULTS ON SIMULATED DATA + +We show the PSNR and SSIM metrics ${}^{3}$ in Table 1 (Implementation details are in Appendix D.4, see Fig. S16 for qualitative results). For Nr2N, DDM2, and Di-Fusion, three rounds of experiments are conducted to provide error bars. As P2S utilizes linear regressors, each round's results are consistently similar. Hence, P2S's error bars are not provided. When the noise intensity is high, our method performs the best and shows stable performance. Di-Fusion holds a tremendous potential for generalization and applicability for its stable performance and better performance under high noise intensity. Moreover, these results provide evidence that Di-Fusion could be extended to self-supervised MRI denoising without relying on any clean data. + +Table 1: Quantitative results on simulated data (Noisy means simulated data). PSNR (dB) and SSIM $(\%)$ are reported. Numbers are presented as mean value with standard deviation. Di-Fusion exhibits more stable performance with a smaller standard deviation. + +
MethodSimulation 1Simulation 2Simulation 3Simulation 4Simulation 5
SSIMPSNRSSIMPSNRSSIMPSNRSSIMPSNRSSIMPSNR
Noisy11.3813.7220.6516.0937.4120.3852.0223.7664.6226.63
P2S24.5311.2043.9417.6365.3424.9178.6130.2686.1333.87
Nr2N23.7216.7850.8322.1371.7726.8070.3226.4087.3132.82
DDM226.0217.9249.5721.7659.6423.2577.9629.1481.4331.35
OURS39.0519.9162.0223.6077.3626.9683.4328.6989.5230.63
+ +# 4.5 ABLATION STUDIES + +Without the Fusion process, the results in the early sampling phase do not deviate significantly (Fig. S24), but when we do not perform an adaptive termination, the results show areas that are absent in the noisy data (Fig. S25), indicating that they have indeed drifted; Without the "Di-" process, the results lack some high-frequency information, and the overall gray value of the denoised images has also changed (Case 1 in Fig. S24). In Fig. S20, we demonstrate through experiments that the noise computed by "Di-" process has different statistical properties from $z$ ; Without training the latter diffusion steps, the denoising results are noticeably smoother and have more hallucinations (Fig. S24 and Fig. S25). The details of the above ablation studies can be found in Appendix G.1. + +Furthermore, we balance the training epochs for different $T_{c}^{4}$ and show $R^2$ of microstructure model fitting results in Fig. 6. The results show that choosing any $T_{c}$ within a reasonable range $(T_{c} < 500)$ will not have a significant influence on the denoising results and the training difficulty of every step is relatively consistent. + +During the reverse process, Run-Walk accelerated sampling not only enables accelerated sampling, but also ensures that the sampling quality remains + +mainly unchanged (Fig. S26). In Table S6, the sampling time indicates that the adaptive termination and Run-Walk accelerated sampling (Section 3.3) together greatly reduce the sampling time. The details of the above ablation studies can be found in Appendix G.2. + +![](images/b5851be1812d7fab801f409681875dd18ea920e004b28492c5e0a3595c758186.jpg) +Figure 6: $R^2$ of microstructure model fitting on CSD & DTI obtained when $T_{c}$ is different. When $T_{c} < 500$ , the performance is consistent. + +# 5 DISCUSSIONS + +On comparisons with related work In Appendix A, we discuss the differences between Di-Fusion and Patch2Self, as well as DDM2. In essence, Di-Fusion surpasses Patch2Self by significantly + +reducing the dependence on the number of input volumes, thereby expanding its scope of application. In comparison to DDM2, Di-Fusion not only simplifies the method to a single-stage framework but also implements iterative and controllable refinement through methods mentioned in Section 3. Moreover, in Section 4, Appendix E and H, Di-Fusion achieves state-of-the-art performance in the conducted experiments, showcasing its superior and stable results. + +On limitations (i) Possible longer inference duration. The inference time of diffusion models is already relatively long, and there are concerns that the additional computation introduced by the adaptive termination in Section 3.3 may further increase the inference duration. In Appendix G.2, we discuss the sampling burden associated with Di-Fusion. (ii) Possible hallucinations. As a class of generative models, diffusion models inevitably raise concerns regarding generating fake anatomical details (hallucinations). However, we find that with the methods introduced in Section 3, particularly the training the latter diffusion steps mentioned in Section 3.2, the generative capacity of diffusion models can be restricted (Appendix G.1), which helps reduce hallucinations. (iii) Noise-artifact conflation and additive noise assumptions. Our method explicitly targets thermal noise modeled as additive Gaussian processes, consistent with common denoising frameworks (Chen et al., 2019; Ramos-Llordén et al., 2021; Cordero-Grande et al., 2019). However, this intentionally excludes spatially varying distortions (e.g., cardiac pulsation) often classified as "physiological noise" (Chang et al., 2005; 2012; Walker et al., 2011) but better characterized as artifacts. While our assumption enables tractable solutions, it may limit effectiveness for signal-dependent noise. + +# 6 CONCLUSION + +This paper proposes Di-Fusion, an end-to-end self-supervised MRI denoising method that achieves iterative and stable refinement without relying on extra noise model training or clean data. The Fusion process aligns the trajectory of the forward process and avoids drifted results. The "Di-" process characterizes real-world noise, enabling the model to capture statistical properties of the real-world noise. By training the latter diffusion steps, our model achieves enhanced stability and performance. During the inference stage, Di-Fusion offers controllable results through an adaptive sampling process. Comprehensive experiments on real and simulated data demonstrate that Di-Fusion achieves state-of-the-art performance in microstructure modeling, tractography tracking, and other downstream tasks. + +# ACKNOWLEDGMENTS + +This research was supported by Natural Science Foundation of China under Grant 62271465, Suzhou Basic Research Program under Grant SYG202338, and Open Fund Project of Guangdong Academy of Medical Sciences, China (No. YKY-KF202206). + +# REFERENCES + +Philip M Adamson, Belize Gunel, Jeffrey Dominic, Arjun D Desai, Daniel Spielman, Shreyas Vasanawala, John M Pauly, and Akshay Chaudhari. Ssfd: Self-supervised feature distance as an mr image reconstruction quality metric. In NeurIPS 2021 Workshop on Deep Learning and Inverse Problems, 2021. +Benjamin Ades-Aron, Jelle Veraart, Peter Kochunov, Stephen McGuire, Paul Sherman, Elias Kellner, Dmitry S Novikov, and Els Fieremans. Evaluation of the accuracy and precision of the diffusion parameter estimation with gibbs and noise removal pipeline. Neuroimage, 183:532-543, 2018. +Arpit Bansal, Eitan Borgnia, Hong-Min Chu, Jie Li, Hamid Kazemi, Furong Huang, Micah Goldblum, Jonas Geiping, and Tom Goldstein. Cold diffusion: Inverting arbitrary image transforms without noise. Advances in Neural Information Processing Systems, 36, 2024. +Peter J Basser, James Mattiello, and Denis LeBihan. Mr diffusion tensor spectroscopy and imaging. Biophysical journal, 66(1):259-267, 1994. +Joshua Batson and Loic Royer. Noise2self: Blind denoising by self-supervision. In International Conference on Machine Learning, pp. 524-533. PMLR, 2019. + +Timothy EJ Behrens, Stamatios N Sotiropoulos, and Saad Jbabdi. Mr diffusion tractography. In Diffusion MRI, pp. 429-451. Elsevier, 2014. +Lin-Ching Chang, Derek K Jones, and Carlo Pierpaoli. Restore: robust estimation of tensors by outlier rejection. Magnetic Resonance in Medicine: An Official Journal of the International Society for Magnetic Resonance in Medicine, 53(5):1088-1095, 2005. +Lin-Ching Chang, Lindsay Walker, and Carlo Pierpaoli. Informed restore: a method for robust estimation of diffusion tensor from low redundancy datasets in the presence of physiological noise artifacts. Magnetic resonance in medicine, 68(5):1654-1663, 2012. +Akshay S Chaudhari, Kathryn J Stevens, Jeff P Wood, Amit K Chakraborty, Eric K Gibbons, Zhongnan Fang, Arjun D Desai, Jin Hyung Lee, Garry E Gold, and Brian A Hargreaves. Utility of deep learning super-resolution in the context of osteoarthritis mri biomarkers. Journal of Magnetic Resonance Imaging, 51(3):768-779, 2020. +Geng Chen, Yafeng Wu, Dinggang Shen, and Pew-Thian Yap. Xq-nlm: denoising diffusion mri data via x-q space non-local patch matching. In Medical Image Computing and Computer-Assisted Intervention-MICCAI 2016: 19th International Conference, Athens, Greece, October 17-21, 2016, Proceedings, Part III 19, pp. 587-595. Springer, 2016. +Geng Chen, Yafeng Wu, Dinggang Shen, and Pew-Thian Yap. Noise reduction in diffusion mri using non-local self-similar information in joint x- q space. Medical image analysis, 53:79-94, 2019. +Nanxin Chen, Yu Zhang, Heiga Zen, Ron J Weiss, Mohammad Norouzi, and William Chan. Wavegrad: Estimating gradients for waveform generation. arXiv preprint arXiv:2009.00713, 2020. +Hyungjin Chung, Eun Sun Lee, and Jong Chul Ye. Mr image denoising and super-resolution using regularized reverse diffusion. IEEE Transactions on Medical Imaging, 42(4):922-934, 2022a. +Hyungjin Chung, Byeongsu Sim, Dohoon Ryu, and Jong Chul Ye. Improving diffusion models for inverse problems using manifold constraints. Advances in Neural Information Processing Systems, 35:25683-25696, 2022b. +Lucilio Cordero-Grande, Daan Christiaens, Jana Hutter, Anthony N Price, and Jo V Hajnal. Complex diffusion-weighted image estimation via matrix recovery under general noise models. Neuroimage, 200:391-404, 2019. +Pierrick Coupé, Pierre Yger, Sylvain Prima, Pierre Hellier, Charles Kervrann, and Christian Barillot. An optimized blockwise nonlocal means denoising filter for 3-d magnetic resonance images. IEEE transactions on medical imaging, 27(4):425-441, 2008. +Pierrick Coupé, José V Manjón, Montserrat Robles, and D Louis Collins. Adaptive multiresolution non-local means filter for three-dimensional magnetic resonance image denoising. IET image Processing, 6(5):558-568, 2012. +Florinel-Alin Croitoru, Vlad Hondru, Radu Tudor Ionescu, and Mubarak Shah. Diffusion models in vision: A survey. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2023. +Mohammad Zalbagi Darestani, Akshay S Chaudhari, and Reinhard Heckel. Measuring robustness in deep learning based compressive sensing. In Marina Meila and Tong Zhang (eds.), Proceedings of the 38th International Conference on Machine Learning, volume 139 of Proceedings of Machine Learning Research, pp. 2433-2444. PMLR, 18-24 Jul 2021. URL https://proceedings.mlr.press/v139/darestani21a.html. +Arjun D Desai, Beliz Gunel, Batu Ozturkler, Harris Beg, Shreyas Vasanawala, Brian Hargreaves, Christopher Ré, John M Pauly, and Akshay Chaudhari. Vortex: Physics-driven data augmentations for consistency training for robust accelerated mri reconstruction. Medical Imaging with Deep Learning, 2022, 2021a. +Arjun D Desai, Batu M Ozturkler, Christopher M Sandino, Robert Boutin, Marc Willis, Shreyas Vasanawala, Brian A Hargreaves, Christopher M Ré, John M Pauly, and Akshay S Chaudhari. Noise2recon: Enabling joint mri reconstruction and denoising with semi-supervised and self-supervised learning. arXiv preprint arXiv:2110.00075, 2021b. + +Remco Duits and Erik Franken. Left-invariant diffusions on the space of positions and orientations and their application to crossing-preserving smoothing of hard images. International Journal of Computer Vision, 92:231-264, 2011. +Shreyas Fadnavis, Joshua Batson, and Eleftherios Garyfallidis. Patch2self: Denoising diffusion mri with self-supervised learning. Advances in Neural Information Processing Systems, 33: 16293-16303, 2020a. +Shreyas Fadnavis, Joshua Batson, and Eleftherios Garyfallidis. Patch2self: Denoising diffusion mri with self-supervised learning. Advances in Neural Information Processing Systems, 33: 16293-16303, 2020b. +Shreyas Fadnavis, Agniva Chowdhury, Joshua Batson, Petros Drineas, and Eleftherios Garyfallidis. Patch2self2: Self-supervised denoising on coresets via matrix sketching. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 27641-27651, 2024. +Ben Fei, Zhaoyang Lyu, Liang Pan, Junzhe Zhang, Weidong Yang, Tianyue Luo, Bo Zhang, and Bo Dai. Generative diffusion prior for unified image restoration and enhancement. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 9935-9946, 2023. +Qi Gao, Zilong Li, Junping Zhang, Yi Zhang, and Hongming Shan. Corediff: Contextual error-modulated generalized diffusion model for low-dose ct denoising and generalization. IEEE Transactions on Medical Imaging, 2023. +Eleftherios Garyfallidis, Matthew Brett, Bagrat Amirbekian, Ariel Rokem, Stefan Van Der Walt, Maxime Descoteaux, Ian Nimmo-Smith, and Dipy Contributors. Dipy, a library for the analysis of diffusion mri data. Frontiers in neuroinformatics, 8:8, 2014. +Eric K Gibbons, Kyler K Hodgson, Akshay S Chaudhari, Lorie G Richards, Jennifer J Majersik, Ganesh Adluru, and Edward VR DiBella. Simultaneous noddi and gfa parameter map generation from subsampled q-space imaging using deep learning. Magnetic resonance in medicine, 81(4): 2399-2411, 2019. +Gabriel Girard, Kevin Whittingstall, Rachid Deriche, and Maxime Descoteaux. Towards quantitative connectivity analysis: reducing tractography biases. Neuroimage, 98:266-278, 2014. +Trevor Hastie, Robert Tibshirani, Jerome H Friedman, and Jerome H Friedman. The elements of statistical learning: data mining, inference, and prediction, volume 2. Springer, 2009. +Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. Advances in neural information processing systems, 33:6840-6851, 2020. +Tao Huang, Songjiang Li, Xu Jia, Hutchuan Lu, and Jianzhuang Liu. Neighbor2neighbor: Self-supervised denoising from single noisy images. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 14781-14790, 2021. +Aapo Hyvarinen and Peter Dayan. Estimation of non-normalized statistical models by score matching. Journal of Machine Learning Research, 6(4), 2005. +Suheyla Cetin Karayumak, Sylvain Bouix, Lipeng Ning, Anthony James, Tim Crow, Martha Shenton, Marek Kubicki, and Yogesh Rathi. Retrospective harmonization of multi-site diffusion mri data acquired with different acquisition parameters. Neuroimage, 184:180-200, 2019. +Bahjat Kawar, Michael Elad, Stefano Ermon, and Jiaming Song. Denoising diffusion restoration models. Advances in Neural Information Processing Systems, 35:23593-23606, 2022. +Elena A Kaye, Emily A Aherne, Cihan Duzgol, Ida Haggström, Erich Kobler, Yousef Mazaheri, Maggie M Fung, Zhigang Zhang, Ricardo Otazo, Hebert A Vargas, et al. Accelerating prostate diffusion-weighted mri using a guided denoising convolutional neural network: retrospective feasibility study. Radiology: Artificial Intelligence, 2(5):e200007, 2020. +Kwanyoung Kim and Jong Chul Ye. Noise2score: tweedie's approach to self-supervised image denoising without clean images. Advances in Neural Information Processing Systems, 34:864-874, 2021. + +Alexander Krull, Tim-Oliver Buchholz, and Florian Jug. Noise2void-learning denoising from single noisy images. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 2129-2137, 2019. +Samuli Laine, Tero Karras, Jaakko Lehtinen, and Timo Aila. High-quality self-supervised deep image denoising. Advances in Neural Information Processing Systems, 32, 2019. +Denis Le Bihan. Looking into the functional architecture of the brain with diffusion migraine. Nature reviews neuroscience, 4(6):469-480, 2003. +Denis Le Bihan, Cyril Poupon, Alexis Amadon, and Franck Lethimonnier. Artifacts and pitfalls in diffusion mri. Journal of Magnetic Resonance Imaging: An Official Journal of the International Society for Magnetic Resonance in Medicine, 24(3):478-488, 2006. +Jaakko Lehtinen, Jacob Munkberg, Jon Hasselgren, Samuli Laine, Tero Karras, Miika Aittala, and Timo Aila. Noise2noise: Learning image restoration without clean data. arXiv preprint arXiv:1803.04189, 2018. +Jose V Manjon, Pierrick Coupe, Luis Concha, Antonio Buades, D Louis Collins, and Montserrat Robles. Diffusion weighted image denoising using overcomplete local pca. PloS one, 8(9):e73021, 2013. +Youssef Mansour and Reinhard Heckel. Zero-shot noise2noise: Efficient image denoising without any data. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 14018-14027, 2023. +Kenneth Marek, Danna Jennings, Shirley Lasch, Andrew Siderowf, Caroline Tanner, Tanya Simuni, Chris Coffey, Karl Kieburtz, Emily Flagg, Sohini Chowdhury, et al. The parkinson progression marker initiative (ppmi). Progress in neurobiology, 95(4):629-635, 2011. +Allister Mason, James Rioux, Sharon E Clarke, Andreu Costa, Matthias Schmidt, Valerie Keough, Thien Huynh, and Steven Beyea. Comparison of objective image quality metrics to expert radiologists' scoring of diagnostic quality of mr images. IEEE transactions on medical imaging, 39(4):1064-1072, 2019. +SPL Meesters, GR Sanguinetti, Eleftherios Garyfallidis, JM Portegies, PPW Ossenblok, and Remco Duits. Cleaning output of tractography via fiber to bundle coherence, a new open source implementation. a new open source implementation, 2016. +Anish Mittal, Anush K Moorthy, and Alan C Bovik. Blind/referenceless image spatial quality evaluator. In 2011 conference record of the forty fifth asilomar conference on signals, systems and computers (ASILOMAR), pp. 723-727. IEEE, 2011. +Shakir Mohamed and Balaji Lakshminarayanan. Learning in implicit generative models. arXiv preprint arXiv:1610.03483, 2016. +Nick Moran, Dan Schmidt, Yu Zhong, and Patrick Coady. Noisier2noise: Learning to denoise from unpaired noisy data. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 12064-12072, 2020. +Dmitry S Novikov, Valerij G Kiselev, and Sune N Jespersen. On modeling. Magnetic resonance in medicine, 79(6):3172-3193, 2018. +Nobuyuki Ostu. A threshold selection method from gray-level histograms. IEEE Trans SMC, 9:62, 1979. +Ozan Özdenizci and Robert Legenstein. Restoring vision in adverse weather conditions with patch-based denoising diffusion models. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2023. +Tongyao Pang, Huan Zheng, Yuhui Quan, and Hui Ji. Recorrupted-to-recorrupted: Unsupervised deep learning for image denoising. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 2043-2052, 2021. + +Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, et al. Pytorch: An imperative style, high-performance deep learning library. Advances in neural information processing systems, 32, 2019. +Jorg M Portegies, Rutger Henri Jacques Fick, Gonzalo R Sanguinetti, Stephan PL Meesters, Gabriel Girard, and Remco Duits. Improving fiber alignment in hardi by combining contextual pde flow with constrained spherical deconvolution. *PloS one*, 10(10):e0138122, 2015. +Gabriel Ramos-Llordén, Gonzalo Vegas-Sánchez-Ferrero, Congyu Liao, Carl-Fredrik Westin, Kawin Setsompop, and Yogesh Rathi. Snr-enhanced diffusion mri with structure-preserving low-rank denoising in reproducing kernel hilbert spaces. Magnetic resonance in medicine, 86(3):1614-1632, 2021. +Ariel Rokem. Stanford hardi surfaces, 2016. +Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In Medical image computing and computer-assisted intervention-MICCAI 2015: 18th international conference, Munich, Germany, October 5-9, 2015, proceedings, part III 18, pp. 234-241. Springer, 2015. +Chitwan Sahara, William Chan, Huiwen Chang, Chris Lee, Jonathan Ho, Tim Salimans, David Fleet, and Mohammad Norouzi. Palette: Image-to-image diffusion models. In ACM SIGGRAPH 2022 conference proceedings, pp. 1-10, 2022a. +Chitwan Sahara, Jonathan Ho, William Chan, Tim Salimans, David J Fleet, and Mohammad Norouzi. Image super-resolution via iterative refinement. IEEE transactions on pattern analysis and machine intelligence, 45(4):4713-4726, 2022b. +Kurt G Schilling, Vishwesh Nath, Colin Hansen, Prasanna Parvathaneni, Justin Blaber, Yurui Gao, Peter Neher, Dogu Baran Aydogan, Yonggang Shi, Mario Ocampo-Pineda, et al. Limits to anatomical accuracy of diffusion tractography using modern approaches. Neuroimage, 185:1-11, 2019. +Jascha Sohl-Dickstein, Eric Weiss, Niru Maheswaranathan, and Surya Ganguli. Deep unsupervised learning using nonequilibrium thermodynamics. In International conference on machine learning, pp. 2256-2265. PMLR, 2015. +Bowen Song, Jason Hu, Zhaoxu Luo, Jeffrey A Fessler, and Liyue Shen. Diffusionblend: Learning 3d image prior through position-aware diffusion score blending for 3d computed tomography reconstruction. arXiv preprint arXiv:2406.10211, 2024. +Jiaming Song, Chenlin Meng, and Stefano Ermon. Denoising diffusion implicit models. arXiv preprint arXiv:2010.02502, 2020a. +Yang Song and Stefano Ermon. Generative modeling by estimating gradients of the data distribution. Advances in neural information processing systems, 32, 2019. +Yang Song, Jascha Sohl-Dickstein, Diederik P Kingma, Abhishek Kumar, Stefano Ermon, and Ben Poole. Score-based generative modeling through stochastic differential equations. arXiv preprint arXiv:2011.13456, 2020b. +Yang Song, Liyue Shen, Lei Xing, and Stefano Ermon. Solving inverse problems in medical imaging with score-based generative models. arXiv preprint arXiv:2111.08005, 2021. +Radhika Tibrewala, Tarun Dutt, Angela Tong, Luke Ginocchio, Mahesh B Keerthivasan, Steven H Baete, Sumit Chopra, Yvonne W Lui, Daniel K Sodickson, Hersh Chandarana, and Patricia M Johnson. FastMRI Prostate: A publicly available, biparametric MRI dataset to advance machine learning for prostate cancer imaging, 2023. +J-Donald Tournier, Fernando Calamante, and Alan Connelly. Robust determination of the fibre orientation distribution in diffusion mri: non-negativity constrained super-resolved spherical deconvolution. Neuroimage, 35(4):1459-1472, 2007. + +Jiachen Tu, Yaokun Shi, and Fan Lam. Score-based self-supervised mri denoising. In International Conference on Learning Representations, 2025. +Dmitry Ulyanov, Andrea Vedaldi, and Victor Lempitsky. Deep image prior. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 9446-9454, 2018. +Jelle Veraart, Dmitry S Novikov, Daan Christiaens, Benjamin Ades-Aron, Jan Sijbers, and Els Fieremans. Denoising of diffusion mri using random matrix theory. Neuroimage, 142:394-406, 2016. +Lindsay Walker, Lin-Ching Chang, Cheng Guan Koay, Nik Sharma, Leonardo Cohen, Ragini Verma, and Carlo Pierpaoli. Effects of physiological noise in population analysis of diffusion tensor mri data. Neuroimage, 54(2):1168-1177, 2011. +Daniel Watson, William Chan, Jonathan Ho, and Mohammad Norouzi. Learning fast samplers for diffusion models by differentiating through sample quality. In International Conference on Learning Representations, 2021. +Carl-Fredrik Westin, Hans Knutsson, Ofer Pasternak, Filip Szczepankiewicz, Evren Ozarslan, Danielle van Westen, Cecilia Mattisson, Mats Bogren, Lauren J O'Donnell, Marek Kubicki, et al. Q-space trajectory imaging for multidimensional diffusion mri of the human brain. Neuroimage, 135:345-362, 2016. +Jeffrey P Woodard and Monica P Carley-Spencer. No-reference image quality metrics for structural migraine. Neuroinformatics, 4:243-262, 2006. +Bin Xia, Yulun Zhang, Shiyin Wang, Yitong Wang, Xinglong Wu, Yapeng Tian, Wenming Yang, and Luc Van Gool. Diffir: Efficient diffusion model for image restoration. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 13095-13105, 2023. +Tiange Xiang, Mahmut Yurt, Ali B Syed, Kawin Setsompop, and Akshay Chaudhari. Ddm 2: Self-supervised diffusion mri denoising with generative diffusion models. arXiv preprint arXiv:2302.03018, 2023. +Yaochen Xie, Zhengyang Wang, and Shuiwang Ji. Noise2same: Optimizing a self-supervised bound for image denoising. Advances in neural information processing systems, 33:20320-20330, 2020. +Jun Xu, Yuan Huang, Ming-Ming Cheng, Li Liu, Fan Zhu, Zhou Xu, and Ling Shao. Noisy-as-clean: Learning self-supervised denoising from corrupted image. IEEE Transactions on Image Processing, 29:9316-9329, 2020. +Jure Zbontar, Florian Knoll, Anuroop Sriram, Tullie Murrell, Zhengnan Huang, Matthew J. Muckley, Aaron Defazio, Ruben Stern, Patricia Johnson, Mary Bruno, Marc Parente, Krzysztof J. Geras, Joe Katsnelson, Hersh Chandarana, Zizhao Zhang, Michal Drozdal, Adriana Romero, Michael Rabbat, Pascal Vincent, Nafissa Yakubova, James Pinkerton, Duo Wang, Erich Owens, C. Lawrence Zitnick, Michael P. Recht, Daniel K. Sodickson, and Yvonne W. Lui. fastMRI: An open dataset and benchmarks for accelerated MRI, 2018. +Linqi Zhou, Aaron Lou, Samar Khanna, and Stefano Ermon. Denoising diffusion bridge models. In The Twelfth International Conference on Learning Representations, 2024. + +# A COMPARISONS WITH RELATED WORKS + +Comparison with Patch2Self Patch2Self (Fadnavis et al., 2020a) requires a minimum of ten additional diffusion vector volumes to denoise a single diffusion vector volume. Instead, our work only needs one additional volume, which is clinically meaningful as common clinical dMRI often scans fewer than ten diffusion vector volumes (Karayumak et al., 2019; Xiang et al., 2023). Moreover, our model does not require repetitive training, whereas Patch2Self necessitates training multiple regressors to perform voxel-by-voxel denoising. However, despite achieving better results, Di-Fusion takes relatively longer time than Patch2Self, which is due to the training time of the diffusion models. + +Comparison with DDM2 Our work only requires a single stage for denoising, whereas DDM2 typically involves three stages. Furthermore, it's worth noting that the noise model in the first stage of DDM2 critically influences the ultimate denoising results, and finding an optimal solution that simultaneously maximizes evaluation metrics scores and minimizes training time can be challenging (See Fig. S32 for details). + +# B DI-FUSION + +# B.1 FORWARD PROCESS + +Consider $x = X_{*,*,i,j}$ ( $i$ : slice index, $j$ : volume index) as the target slice to denoise, $x' = X_{*,*,i,j-1}$ . $\beta_{1,\dots,T}$ is a pre-defined noise schedule, $\sigma_t^2 \coloneqq \beta_t$ , $\alpha_t \coloneqq 1 - \beta_t$ and $\bar{\alpha}_t \coloneqq \prod_{s=1}^t \alpha_s$ . We rewrite $\lambda_1^t = \frac{\sqrt{\overline{\alpha}_{t-1} \beta_t}}{1 - \overline{\alpha}_t}$ and $\lambda_2^t = \frac{\sqrt{\alpha_t (1 - \overline{\alpha}_{t-1})}}{1 - \overline{\alpha}_t}$ for simplification. + +Perform the Fusion process: + +$$ +x _ {t} ^ {*} = \lambda_ {1} ^ {t} x + \lambda_ {2} ^ {t} x ^ {\prime}. \tag {14} +$$ + +Then we get a linear interpolation between $x$ and $x'$ , we compute $x_{t}$ based on $q(x_{t}|x_{t}^{*})$ : + +$$ +x _ {t} = \sqrt {\bar {\alpha} _ {t}} x _ {t} ^ {*} + \sqrt {1 - \bar {\alpha} _ {t}} z. \tag {15} +$$ + +The forward process can be defined if using $z\sim \mathcal{N}(\mathbf{0},\mathbf{I})$ for perturbing data distribution: + +$$ +q \left(x _ {t} \mid x _ {t} ^ {*}\right) := \mathcal {N} \left(x _ {t}; \sqrt {\bar {\alpha} _ {t}} x _ {t} ^ {*}, \left(1 - \bar {\alpha} _ {t}\right) \mathbf {I}\right). \tag {16} +$$ + +However, we use "Di-" process to compute a noise $\xi_{x - x'}$ to substitute for $z$ : + +$$ +\xi_ {x - x ^ {\prime}} = \operatorname {m e s s} \left(\left(x - x ^ {\prime}\right) - \mu_ {x - x ^ {\prime}}\right), \quad \mu_ {x - x ^ {\prime}} = \frac {\sum_ {m = 1} ^ {w} \sum_ {n = 1} ^ {h} \left(x _ {m n} - x ^ {\prime} _ {m n}\right)}{w \cdot h}. \tag {17} +$$ + +So the forward process can't be represented as $\mathcal{N}(x_t; \sqrt{\bar{\alpha}_t} x_t^*, (1 - \bar{\alpha}_t) \mathbf{I})$ , but could be computed using the following formula: + +$$ +q \left(x _ {t} \mid x _ {t} ^ {*}\right)\rightarrow x _ {t} = \sqrt {\bar {\alpha} _ {t}} x _ {t} ^ {*} + \sqrt {1 - \bar {\alpha} _ {t}} \xi_ {x - x ^ {\prime}}. \tag {18} +$$ + +We leverage a dynamic combination (the Fusion process) and continuously varying noise (the "Di-" process) to provide the model with more augmented training data, thereby enhancing its robustness. This idea is similar to those in Noise2Void (Krull et al., 2019), Noisier2Noise (Moran et al., 2020), and Noisy-as-Clean (Xu et al., 2020), which also utilize data augmentation to construct training data. + +# B.2 TRAINING PROCESS + +Our simplified training objective is: + +$$ +L _ {\text {s i m p l e}} (\theta) := \mathbb {E} _ {t, x _ {t} ^ {*}, \xi_ {x - x ^ {\prime}}} \left[ \left\| x - \mathcal {F} _ {\theta} \left(\sqrt {\bar {\alpha} _ {t}} x _ {t} ^ {*} + \sqrt {1 - \bar {\alpha} _ {t}} \xi_ {x - x ^ {\prime}}, t\right) \right\| ^ {2} \right]. \tag {19} +$$ + +We perform training the latter diffusion steps by sample $t\sim \mathrm{Uniform}\left(\{1,\dots ,T_c\}\right)$ + +# B.3 REVERSE PROCESS + +The details of how to perform the reverse process in DDPM if a data predictor is used are in Appendix C.1. If it is a data predictor $\mathcal{F}_{\theta}$ that directly predict $x_0$ , the reverse process for DDPM becomes: + +$$ +x _ {t - 1} = \lambda_ {1} ^ {t} \mathcal {F} _ {\theta} (x _ {t}, t) + \lambda_ {2} ^ {t} x _ {t} + (\sigma_ {t} \cdot \eta) \xi_ {x - x ^ {\prime}}. \tag {20} +$$ + +And $p_{\mathcal{F}}(x_{t - 1}|x_t)$ can be defined as: + +$$ +p _ {\mathcal {F}} \left(x _ {t - 1} \mid x _ {t}\right)\rightarrow x _ {t - 1} = \lambda_ {1} ^ {t} \mathcal {F} _ {\theta} \left(x _ {t}, t\right) + \lambda_ {2} ^ {t} x _ {t} + \left(\sigma_ {t} \cdot \eta\right) \xi_ {x - x ^ {\prime}}. \tag {21} +$$ + +Now let us consider the forward process as defined not on all $\{x_{t}\}_{1}^{T_{c}}$ , but on a subset $\{x_{\tau_1},\ldots ,x_{\tau_S}\}$ where $\tau$ is an increasing sub-sequence of $[1,\dots,T_c]$ of length $S$ . In particular, we define the sequential forward process over $x_{\tau_1},\ldots ,x_{\tau_S}$ ( $x_{\tau_k} = \sqrt{\bar{\alpha}_{\tau_k}}\left(\lambda_1^{\tau_k}x + \lambda_2^{\tau_k}x'\right) + \sqrt{1 - \bar{\alpha}_{\tau_k}}\xi_{x - x'}, 1\leq k\leq S$ ). + +The Run-Walk accelerated sampling now sample according to reversed $(\tau)$ (In practice, $\tau = \{1,2,\dots ,T_r - 1,T_r,T_r + p,\dots ,T_c - p,T_c\}$ ), then the reverse process becomes: + +$$ +p _ {\mathcal {F} _ {\theta}} \left(x _ {\tau_ {k - 1}} \mid x _ {\tau_ {k}}\right)\rightarrow x _ {\tau_ {k - 1}} = \lambda_ {1} ^ {\tau_ {k}} \mathcal {F} _ {\theta} \left(x _ {\tau_ {k}}, \tau_ {k}\right) + \lambda_ {2} ^ {\tau_ {k}} x _ {\tau_ {k}} + \left(\sigma_ {\tau_ {k}} \cdot \eta\right) \xi_ {x - x ^ {\prime}}. \tag {22} +$$ + +Before sampling, we define an universal value $\mathcal{CSN}\mathcal{R}$ and compute $b_{x}$ : + +$$ +b _ {x} = \frac {\sum_ {m = 1} ^ {w} \sum_ {n = 1} ^ {h} 1}{2 \cdot \sum_ {m = 1} ^ {w} \sum_ {n = 1} ^ {h} \mathbb {I} _ {\left(x _ {m n} > \beta_ {1}\right)}} + \frac {\sum_ {m = 1} ^ {w} \sum_ {n = 1} ^ {h} 1}{2 \cdot \sum_ {m = 1} ^ {w} \sum_ {n = 1} ^ {h} \mathbb {I} _ {\left(x _ {m n} > \beta_ {2}\right)}}, \tag {23} +$$ + +During every $p_{\mathcal{F}_{\theta}}(x_{\tau_{k - 1}}|x_{\tau_k})$ , we first get $x_{out} = \mathcal{F}_{\theta}(x_{\tau_k},\tau_k)$ , and $d_{x} = \| x - x_{out}\|^{2}\times b_{x}$ + +Then if $d_x$ is greater than $\mathcal{CSN}\mathcal{R}$ , the output $x_0 = x_{out}$ and the refinement iteration breaks. In contrast, the refinement iteration continues if $d_x$ is smaller than $\mathcal{CSN}\mathcal{R}$ . + +# C ADDITIONAL DERIVATIONS + +# C.1 THE DIFFERENCE BETWEEN THE TWO TRAJECTORIES + +The original sampling process in the Algorithm 2 of DDPM (Ho et al., 2020) is: + +$$ +x _ {t - 1} = \frac {1}{\sqrt {\alpha_ {t}}} \left(x _ {t} - \frac {1 - \alpha_ {t}}{\sqrt {1 - \bar {\alpha} _ {t}}} \epsilon_ {\theta} \left(x _ {t}, t\right)\right) + \sigma_ {t} z, \tag {24} +$$ + +where $\epsilon_{\theta}$ is a noise predictor. However, we use a data predictor $\mathcal{F}_{\theta}$ to directly predict $x_0$ in our paper. We will demonstrate how to perform the reverse process in DDPM if a data predictor is used. + +Given a data point sampled from a real data distribution $x_0 \sim q(x)$ , let us define a forward diffusion process in which we add small amount of Gaussian noise to the sample in $T$ steps, producing a sequence of noisy samples $x_1, \ldots, x_T$ . The step sizes are governed by a variance schedule $\{\beta_t \in (0, 1)\}_{t=1}^T$ : + +$$ +q \left(x _ {t} \mid x _ {t - 1}\right) = \mathcal {N} \left(x _ {t}; \sqrt {1 - \beta_ {t}} x _ {t - 1}, \beta_ {t} \mathbf {I}\right), \quad q \left(x _ {1: T} \mid x _ {0}\right) = \prod_ {t = 1} ^ {T} q \left(x _ {t} \mid x _ {t - 1}\right). \tag {25} +$$ + +As the step $t$ increases, the data sample $x_0$ gradually loses its distinguishable features. Ultimately, when $T \to \infty$ , $x_T$ converges to an isotropic Gaussian distribution. + +Let $\alpha_{t} = 1 - \beta_{t}$ and $\bar{\alpha}_{t} = \prod_{i = 1}^{t}\alpha_{i}$ . A nice property of the aforementioned process is that we can sample $x_{t}$ at any arbitrary time step $t$ in closed form using the reparameterization trick: + +$$ +\begin{array}{l} x _ {t} = \sqrt {\alpha_ {t}} x _ {t - 1} + \sqrt {1 - \alpha_ {t}} z _ {t - 1} \quad ; \text {w h e r e} z _ {t - 1}, z _ {t - 2}, \dots \sim \mathcal {N} (\mathbf {0}, \mathbf {I}). \\ = \sqrt {\alpha_ {t} \alpha_ {t - 1}} x _ {t - 2} + \sqrt {1 - \alpha_ {t} \alpha_ {t - 1}} \bar {z} _ {t - 2} \quad ; \text {w h e r e} \bar {z} _ {t - 2} \text {m e r g e s t w o G a u s s i a n s}. \tag {26} \\ = \ldots \\ = \sqrt {\bar {\alpha} _ {t}} x _ {0} + \sqrt {1 - \bar {\alpha} _ {t}} z, \\ \end{array} +$$ + +where we merge two Gaussians with different variances, $\mathcal{N}(\mathbf{0},\sigma_1^2\mathbf{I})$ and $\mathcal{N}(\mathbf{0},\sigma_2^2\mathbf{I})$ , resulting in a new distribution $\mathcal{N}(\mathbf{0},(\sigma_1^2 +\sigma_2^2)\mathbf{I})$ . Here, the merged standard deviation is given by $\sqrt{(1 - \alpha_t) + \alpha_t(1 - \alpha_{t - 1})} = \sqrt{1 - \alpha_t\alpha_{t - 1}}$ . We can then derive: + +$$ +q \left(x _ {t} \mid x _ {0}\right) = \mathcal {N} \left(x _ {t}; \sqrt {\bar {\alpha} _ {t}} x _ {0}, (1 - \bar {\alpha} _ {t}) \mathbf {I}\right). \tag {27} +$$ + +Consider a reverse process, it is noteworthy that the reverse conditional probability is tractable when conditioned on $x_0$ : + +$$ +q \left(x _ {t - 1} \mid x _ {t}, x _ {0}\right) = \mathcal {N} \left(x _ {t - 1}; \tilde {\boldsymbol {\mu}} \left(x _ {t}, x _ {0}\right), \sigma_ {t} ^ {2} \mathbf {I}\right). \tag {28} +$$ + +Using Bayes' rule, we then have (Ho et al., 2020): + +$$ +\begin{array}{l} q (x _ {t - 1} | x _ {t}, x _ {0}) \\ = q \left(x _ {t} \mid x _ {t - 1}, x _ {0}\right) \frac {q \left(x _ {t - 1} \mid x _ {0}\right)}{q \left(x _ {t} \mid x _ {0}\right)} \\ \end{array} +$$ + +$$ +\begin{array}{l} \propto \exp \Big (- \frac {1}{2} \big (\frac {\left(x _ {t} - \sqrt {\bar {\alpha} _ {t}} x _ {t - 1}\right) ^ {2}}{\beta_ {t}} + \frac {\left(x _ {t - 1} - \sqrt {\bar {\alpha} _ {t - 1}} x _ {0}\right) ^ {2}}{1 - \bar {\alpha} _ {t - 1}} - \frac {\left(x _ {t} - \sqrt {\bar {\alpha} _ {t}} x _ {0}\right) ^ {2}}{1 - \bar {\alpha} _ {t}} \big) \Big) \\ = \exp \Big (- \frac {1}{2} \big (\frac {x _ {t} ^ {2} - 2 \sqrt {\alpha_ {t}} x _ {t} x _ {t - 1} + \alpha_ {t} x _ {t - 1} ^ {2}}{\beta_ {t}} + \frac {x _ {t - 1} ^ {2} - 2 \sqrt {\bar {\alpha} _ {t - 1}} x _ {0} x _ {t - 1} + \bar {\alpha} _ {t - 1} x _ {0} ^ {2}}{1 - \bar {\alpha} _ {t - 1}} - \frac {(x _ {t} - \sqrt {\bar {\alpha} _ {t}} x _ {0}) ^ {2}}{1 - \bar {\alpha} _ {t}}) \Big) \\ = \exp \left(- \frac {1}{2} \left(\left(\frac {\alpha_ {t}}{\beta_ {t}} + \frac {1}{1 - \bar {\alpha} _ {t - 1}}\right) x _ {t - 1} ^ {2} - \left(\frac {2 \sqrt {\alpha_ {t}}}{\beta_ {t}} x _ {t} + \frac {2 \sqrt {\bar {\alpha} _ {t - 1}}}{1 - \bar {\alpha} _ {t - 1}} x _ {0}\right) x _ {t - 1} + C (x _ {t}, x _ {0})\right)\right), \tag {29} \\ \end{array} +$$ + +where $C(x_{t},x_{0})$ is some function that does not involve $x_{t - 1}$ , and the details are omitted. Following the standard Gaussian density function, the mean and variance can be parameterized as follows (recall that $\alpha_{t} = 1 - \beta_{t}$ and $\bar{\alpha}_{t} = \prod_{i = 1}^{T}\alpha_{i})$ ): + +$$ +\sigma_ {t} ^ {2} = 1 / \left(\frac {\alpha_ {t}}{\beta_ {t}} + \frac {1}{1 - \bar {\alpha} _ {t - 1}}\right) = 1 / \left(\frac {\alpha_ {t} - \bar {\alpha} _ {t} + \beta_ {t}}{\beta_ {t} \left(1 - \bar {\alpha} _ {t - 1}\right)}\right) = \frac {1 - \bar {\alpha} _ {t - 1}}{1 - \bar {\alpha} _ {t}} \cdot \beta_ {t}. \tag {30} +$$ + +$$ +\begin{array}{l} \tilde {\boldsymbol {\mu}} _ {t} (x _ {t}, x _ {0}) = (\frac {\sqrt {\alpha_ {t}}}{\beta_ {t}} x _ {t} + \frac {\sqrt {\bar {\alpha} _ {t - 1}}}{1 - \bar {\alpha} _ {t - 1}} x _ {0}) / (\frac {\alpha_ {t}}{\beta_ {t}} + \frac {1}{1 - \bar {\alpha} _ {t - 1}}) \\ = \left(\frac {\sqrt {\alpha_ {t}}}{\beta_ {t}} x _ {t} + \frac {\sqrt {\bar {\alpha} _ {t - 1}}}{1 - \bar {\alpha} _ {t - 1}} x _ {0}\right) \frac {1 - \bar {\alpha} _ {t - 1}}{1 - \bar {\alpha} _ {t}} \cdot \beta_ {t} \tag {31} \\ = \frac {\sqrt {\alpha_ {t}} (1 - \bar {\alpha} _ {t - 1})}{1 - \bar {\alpha} _ {t}} x _ {t} + \frac {\sqrt {\bar {\alpha} _ {t - 1}} \beta_ {t}}{1 - \bar {\alpha} _ {t}} x _ {0}. \\ \end{array} +$$ + +Thus, if it is a data predictor $\mathcal{F}_{\theta}$ that directly predict $x_0$ , based on $q(x_{t - 1}|x_t,x_0)$ , the reverse process for DDPM becomes: + +$$ +\begin{array}{l} x _ {t - 1} = \tilde {\mu} _ {t} \left(x _ {t}, x _ {0}\right) + \sigma_ {t} ^ {2} z \\ = \frac {\sqrt {\alpha_ {t}} (1 - \bar {\alpha} _ {t - 1})}{1 - \bar {\alpha} _ {t}} x _ {t} + \frac {\sqrt {\bar {\alpha} _ {t - 1}} \beta_ {t}}{1 - \bar {\alpha} _ {t}} \mathcal {F} _ {\theta} (x _ {t}, t) + \sigma_ {t} ^ {2} z. \tag {32} \\ \end{array} +$$ + +DDPM (Ho et al., 2020) found that both $\sigma_t^2 = \beta_t$ and $\sigma_t^2 = \frac{1 - \bar{\alpha}_{t-1}}{1 - \bar{\alpha}_t} \beta_t$ had similar results through experiments. We set $\sigma_t^2 = \beta_{1,\dots,T}$ and hold $\beta_{1,\dots,T}$ as hyperparameters. + +Now we know how to perform the reverse process if a data predictor is used. According to Eq. (4), we know $x + \epsilon_{t} = x_{out} = \mathcal{F}_{\theta}(x_{t}, t)$ , then we can get: + +$$ +x _ {t - 1} = \frac {\sqrt {\alpha_ {t}} (1 - \bar {\alpha} _ {t - 1})}{1 - \bar {\alpha} _ {t}} x _ {t} + \frac {\sqrt {\bar {\alpha} _ {t - 1}} \beta_ {t}}{1 - \bar {\alpha} _ {t}} (x + \epsilon_ {t}) + \sigma_ {t} ^ {2} z, \tag {33} +$$ + +Now let us consider directly performing the forward process $(q(x_{t}|x_{0}))$ on $x^{\prime}(x = X_{*,*,i,j},x^{\prime} = X_{*,*,i,j - 1})$ without the Fusion process (Eq. (6)): + +$$ +\bar {x} _ {t - 1} = \sqrt {\bar {\alpha} _ {t - 1}} x ^ {\prime} + \sqrt {1 - \bar {\alpha} _ {t - 1}} z, \tag {34} +$$ + +thus the trajectory $\{\bar{x}_t\}_{1}^T$ obtained by directly performing the forward process in DDPM and the trajectory $\{x_{t}\}_{1}^{T}$ obtained from the reverse process of DDPM are different, and the major difference is brought by $(x + \epsilon_{t})$ : + +$$ +x _ {t - 1} = \underbrace {\frac {\sqrt {\bar {\alpha} _ {t - 1}} \beta_ {t}}{1 - \bar {\alpha} _ {t}} (x + \epsilon_ {t})} _ {\mathrm {m a j o r d i f f e r e n c e}} + \frac {\sqrt {\alpha_ {t}} (1 - \bar {\alpha} _ {t - 1})}{1 - \bar {\alpha} _ {t}} x _ {t} + \sigma_ {t} z \neq \bar {x} _ {t - 1} = \sqrt {\bar {\alpha} _ {t - 1}} x ^ {\prime} + \sqrt {1 - \bar {\alpha} _ {t - 1}} z. (3 5) +$$ + +This is because component $\epsilon_t$ decays as $t \to 0$ , then a larger proportion of components in $x_{t-1}$ becomes closer to $x$ . + +If we directly feed $x_{t-1}$ and $t-1$ into $\mathcal{F}_{\theta}$ , the output would deviate slightly further from $x$ . This occurs because during training, $\mathcal{F}_{\theta}$ is optimized only with the objective: $\| x - \mathcal{F}_{\theta}(\sqrt{\bar{\alpha}_{t-1}} x' + \sqrt{1 - \bar{\alpha}_{t-1}} z, t-1) \|^2$ (the training objective without the Fusion process). Importantly, $x_{t-1}$ is one step closer to $x$ . $(x_{t-1} = \frac{\sqrt{\bar{\alpha}_{t-1}} \beta_t}{1 - \bar{\alpha}_t} (x + \epsilon_t) + \frac{\sqrt{\alpha_t} (1 - \bar{\alpha}_{t-1})}{1 - \bar{\alpha}_t} x_t + \sigma_t z)$ , rather than simply being a noisy version of $x'$ . This drift accumulates over the sampling chain, ultimately leading the result to drift toward another slice. + +# C.2 VARIANCE INFORMATION OF NOISE IN "DI-" PROCESS + +$\xi_{x - x'}$ theoretically preserves the variance information of the noise: + +$$ +\begin{array}{l} \operatorname {V a r} \left(x - x ^ {\prime}\right) = \operatorname {V a r} \left(y + n _ {1} - \left(y + n _ {2}\right)\right) \\ = \operatorname {V a r} \left(n _ {1} - n _ {2}\right) \\ \begin{array}{l} = \operatorname {V a r} \left(n _ {1} - n _ {2}\right) \\ = \operatorname {V a r} \left(n _ {1}\right) + \operatorname {V a r} \left(n _ {2}\right) - 2 \operatorname {C o v} \left(n _ {1}, n _ {2}\right) \end{array} \tag {36} \\ = \operatorname {V a r} \left(n _ {1}\right) + \operatorname {V a r} \left(n _ {2}\right), \\ \end{array} +$$ + +where $\operatorname{Cov}(\cdot)$ is the covariance, $\operatorname{Var}(\cdot)$ is the variance, $\operatorname{Cov}(n_1, n_2) = 0$ since $n_1$ and $n_2$ are independent. Assuming that $n_1$ and $n_2$ follow the same distribution, the variance information of this distribution is retained. + +In Fig. S20, we show that the noise in "Di-" process has different statistical properties compared to Gaussian noise. + +# C.3 SPEED TOWARDS THE TARGET + +The difference between $x_{t-1}$ and $x_t$ can be formulated as: + +$$ +\begin{array}{l} x _ {t - 1} - x _ {t} = \lambda_ {1} ^ {t} \mathcal {F} _ {\theta} (x _ {t}, t) + \lambda_ {2} ^ {t} x _ {t} + (\sigma_ {t} \cdot \eta) \xi_ {x - x ^ {\prime}} - x _ {t} \tag {37} \\ = \lambda_ {1} ^ {t} x _ {o u t} + \left(1 - \lambda_ {1} ^ {t}\right) x _ {t} + \left(\sigma_ {t} \cdot \eta\right) \xi_ {x - x ^ {\prime}} - x _ {t}. \\ \end{array} +$$ + +According to Eq. (4), we know $x + \epsilon_{t} = x_{out}$ , then we can substitute $x_{out}$ into the Eq. (37) and get: + +$$ +\begin{array}{l} x _ {t - 1} - x _ {t} = \lambda_ {1} ^ {t} x _ {\text {o u t}} + \left(1 - \lambda_ {1} ^ {t}\right) x _ {t} + \left(\sigma_ {t} \cdot \eta\right) \xi_ {x - x ^ {\prime}} - x _ {t} \\ = \lambda_ {1} ^ {t} (x + t) + \left(1 - \lambda_ {1} ^ {t}\right) x _ {t} + (\sigma_ {t} \cdot \eta) \xi_ {x - x ^ {\prime}} - x _ {t} \\ = \underbrace {\lambda_ {1} ^ {t} (x - x _ {t})} _ {\text {s p e e d}} + \underbrace {(\sigma_ {t} \cdot \eta) \xi_ {x - x ^ {\prime}}} _ {\text {n o i s e}} + \underbrace {\lambda_ {1} ^ {t} \epsilon_ {t}} _ {\text {p e r t u r b a t i o n}}. \tag {38} \\ \end{array} +$$ + +In DDIM (Song et al., 2020a), $\eta = 0$ , so typically, the term "noise" disappears, leading to the following expression: + +$$ +x _ {t - 1} - x _ {t} = \underbrace {\lambda_ {1} ^ {t} \left(x - x _ {t}\right)} _ {\text {s p e e d}} + \underbrace {\lambda_ {1} ^ {t} \epsilon_ {t}} _ {\text {p e r t u r b a t i o n}}. \tag {39} +$$ + +We know that $\epsilon_{t}$ is a perturbation term that depends on $t$ , as $t \to 0$ , $\epsilon_{t} \to 0$ , $\lambda_1^t \to 1$ at the same time. So the value of "perturbation" item does not change significantly when $t$ decreases; thus difference between $x_{t-1}$ and $x_{t}$ are mainly caused by the "speed" item. + +# D EXPERIMENTAL DETAILS + +# D.1 EXPERIMENT AND REPRODUCIBILITY DETAILS + +Noise schedule A typical noise schedule (Ho et al., 2020; Sahara et al., 2022b) follows a "warm-up" scheduling strategy. Inspired by DDM2, we implement a reverse "warm-up" strategy where $\beta_{t}$ remains at $5e^{-5}$ for the first 300 iterations and then linearly increases to $1e^{2}$ between (300, 1000] iterations (Xiang et al., 2023). + +**Training details** Following DDPM (Ho et al., 2020), we set $\sigma_t^2 = \beta_{1,\dots,T}$ and hold $\beta_{1,\dots,T}$ as hyperparameters. Since we are performing a deterministic sampling process, $\eta$ in Eq. (10) is set to 0 (we talk about how $\eta$ influences the final results in Appendix F.2). We implement denoising functions $\mathcal{F}_{\theta}$ via U-Net (Ronneberger et al., 2015) with modifications suggested in (Saharia et al., 2022b; Song et al., 2020b). Inspired by (Chen et al., 2020; Song & Ermon, 2019), we train $\mathcal{F}_{\theta}$ to condition on $\overline{\alpha}_t$ , $t \sim \mathrm{Uniform}(\{1,\dots,T_c\})$ , $T_c = 300$ . Adam optimizer was used to optimize $\theta$ with a fixed learning rate of $1e^{-4}$ and a batch size of 32, and $\mathcal{F}_{\theta}$ was trained $1e^5$ steps from scratch. All experiments were performed on RTX GeForce 3090 GPUs in PyTorch (Paszke et al., 2019). The training duration for one $\mathcal{F}_{\theta}$ is approximately five hours on a single RTX GeForce 3090 GPU with 5578MB of VRAM. + +Sampling details During sampling, $T_r = 50$ . $\beta_1 = -0.93$ and $\beta_2 = -0.95$ and changing their values has little impact on the results (We set these two factors as a simple way to extract the brain mask). $\eta = 0$ and $p = 10$ if no special instructions are provided. $\mathcal{CSN}\mathcal{R}$ are provided in the figure caption. + +Competing methods details In the main paper, Di-Fusion is compared against four state-of-the-art self-supervised deep learning-based denoising methods (ASCM isn't deep learning-based). For fair comparisons DIP, $\mathrm{Nr2N}$ , and DDM2 adopt the architecture used in Di-Fusion. We follow the official repository5 and use the parameters that should give the optimal denoising performance for P2S (Fadnavis et al., 2020a). (i) Deep Image Prior (Ulyanov et al., 2018) trains a network on a random input to target a noisy image. Thus, network parameter optimization must be performed for each image. In our experiments, we use their official repository6 to identify the optimal training iterations on a single image and then apply the same number of iterations for denoising the entire volume. (ii) Noisier2Noise (Moran et al., 2020) trains a network on a noisier input to target a noisy image. In our experiments, we add additional randomly sampled noise to $x'$ , and the training is performed to reconstruct the noisy image $x$ (Noise2Noise wasn't used due to its pronounced over-smoothing denoising effect in the DDM2 experiments (Xiang et al., 2023). We want to evaluate our method further by using an advanced version, Noisier2Noise). (iii) Patch2Self (Fadnavis et al., 2020a) generalizes Noise2Noise (Lehtinen et al., 2018) and Noise2Self (Batson & Royer, 2019) for voxel-by-voxel dMRI denoising. In our experiments, we followed their official implementation without adjusting their hyperparameters. (iv) DDM2 (Xiang et al., 2023) proposes a three-stage framework that integrates statistic-based denoising theory into diffusion models and performs denoising through conditional generation. In our experiments, we follow their official repository7 without adjusting their hyperparameters. + +Additionally, more comparisons with other denoising methods, including MPPCA (Veraart et al., 2016), Noise2Score (Kim & Ye, 2021), Recorrupted2Recorrupted (Pang et al., 2021), and Patch2Self2 (Fadnavis et al., 2024), are provided in Appendix E. We implemented MPPCA using the code from DIPY (Garyfallidis et al., 2014). For Noise2Score (N2S), we utilized their official repository8. Recorrupted2Recorrupted (R2R) was implemented using its repository9. For Patch2Self2 (P2S2), we directly used the denoised data provided in their supplementary material10 (Fadnavis et al., 2024). + +$^{5}$ https://github.com/ShreyasFadnavis/patch2self +6https://github.com/DmitryUlyanov/deep-image-prior +7https://github.com/StanfordMIMI/DDM2 +8https://github.com/cubeyoung/Noise2Score +$^{9}$ https://github.com/PangTongyao/ReCORRUPTed-to-RecORRUPTed-Unsupervised-Deep-Learning-for-Image-Denoising +10The denoised data is shared at https://figshare.com/s/87f6ffe972510bfda76 + +# D.2 DOWNSSTREAM CLINICAL TASKS IMPLEMENTATION DETAILS + +On tractography To reconstruct white-matter pathways in the brain, one integrates orientation information of the underlying axonal bundles (streamlines) obtained by decomposing the signal in each voxel using a microstructure model (Behrens et al., 2014; Fadnavis et al., 2020a; Garyfallidis et al., 2014). Noise that corrupts the acquired DWI may impact the tractography results, leading to spurious streamlines generated by the tracking algorithm. We explore the effect of denoising on probabilistic tracking (Girard et al., 2014) by employing the Fiber Bundle Coherency (FBC) metric (Portegies et al., 2015). We first fit the data to the Constrained Spherical Deconvolution (CSD) model (Tournier et al., 2007). The fiber orientation distribution information required to perform the tracking is obtained from the Constrained Spherical Deconvolution (CSD) model fitted to the same data. The Optic Radiation (OR) is reconstructed by tracking fibers (3x3x3 voxels ROI cube, and the seed density is 6) from the calcarine sulcus (visual cortex V1) to the lateral geniculate nucleus (LGN). After the streamlines are generated, their coherency is measured with the local FBC algorithm (Portegies et al., 2015; Duits & Franken, 2011), with yellow-orange representing -spurious/incoherent fibers and red-blue representing valid/coherent fibers. Since low FBCs indicate which fibers are isolated and poorly aligned with their neighbors, we further clean the results of tractography algorithms by using the stopping criterion outlined in (Meesters et al., 2016) (the stopping criterion was only performed on noisy data's density map of FBC; thus, its results are captioned by "Noisy/filtering" and can be considered as the reference for high FBCs). + +On microstructure model fitting Microstructure modeling poses a complicated inverse problem and often leads to degraded parameter estimates due to the low SNR of dMRI (Novikov et al., 2018). Different denoising methods can be compared based on their accuracy in fitting the diffusion signal. We apply two commonly used diffusion microstructure models, the diffusion tensor model (DTI) (Basser et al., 1994) and Constrained Spherical Deconvolution (CSD) (Tournier et al., 2007) (DIPY (Garyfallidis et al., 2014) has made available of these two models), on raw and denoised data. DTI is a simple model that captures the local diffusion information within each voxel by modeling it in the form of a 6-parameter tensor. CSD is a more complex model using a spherical harmonic representation of the underlying fiber orientation distributions. In order to quantify the results, we perform a 3-fold cross-validation (Hastie et al., 2009) at two exemplary voxel locations, corpus callosum (CC), a single-fiber structure, and centrum semiovale (CSO), a crossing-fiber structure. The data is divided into three different subsets for the selected voxels, and data from two folds are used to fit the model, which predicts the data on the held-out fold. We quantify the goodness of fit of the models by calculating the $R^2$ score ( $R^2$ metric is computed from each model fit on the corresponding data) (Fadnavis et al., 2020a). + +On diffusion signal estimates We examine how the denoising quality translates to downstream clinical tasks such as creating DTI (Basser et al., 1994) diffusion signal estimates using the various denoising methods. To do the comparisons, we use the volumes acquired by the first ten diffusion directions and the ten b-value=0 volumes. Before fitting the data, we perform data pre-processing. We first use the method in (Ostu, 1979) to compute a brain mask to avoid unnecessary calculations on the background of the image. Now that we have loaded and pre-processed the data we can go forward with DTI (Basser et al., 1994) fitting. We can extract the fractional anisotropy (FA), the mean diffusivity (MD), the axial diffusivity (AD) and the radial diffusivity (RD) from the DTI model. + +# D.3 SNR AND CNR IMPLEMENTATION DETAILS + +To quantify the denoising performance, we employ Signal-to-Noise Ratio (SNR) and Contrast-to-Noise Ratio (CNR) metrics, which are also used in DDM2 (Xiang et al., 2023). We differentiate foreground and background signals following Patch2Self (Fadnavis et al., 2020a): 1. Perform uniform normalization on all the data; 2. Use the method in (Ostu, 1979) to compute a brain mask; 3. fit DTI (Basser et al., 1994) model to perform corpus callosum segmentation; 4. signal is corpus callosum signal, background is the signal out of the brain mask. 5. Compute SNR and CNR using: + +$$ +\mathrm {S N R} = \frac {\text {M e a n (s i g n a l)}}{\text {V a r (b a c k g r o u n d)}}, \quad \mathrm {C N R} = \frac {\text {M e a n (s i g n a l) - M e a n (b a c k g r o u n d)}}{\text {V a r (b a c k g r o u n d)}}, \tag {40} +$$ + +Table S2: $\uparrow R^2$ of microstructure model fitting on CSD & DTI. Bold and Underline fonts denote the best and the second-best performance, respectively. As measured by $R^2$ , Di-Fusion achieves the best results across all four different settings. + +
MethodCSDDTI
CCCSOCCCSO
Noisy0.7970.6140.7890.484
ASCM0.9340.8440.9420.789
DIP0.8680.4770.8750.381
Nr2N0.9590.9080.9610.872
P2S0.9270.7540.7250.675
DDM20.8630.8100.8450.790
OURS0.9670.9390.9760.876
+ +where Mean $(\cdot)$ is the mean, Var $(\cdot)$ is the variance; 6. Statistics are performed on all computed SNR and CNR values, and a box plot like Fig. S12 is created. + +# D.4 SIMULATED DATA IMPLEMENTATION DETAILS + +Details on making simulated data Apart from the experiments on in-vivo datasets, we further simulate noisy k-space data to demonstrate that Di-Fusion can still be used for denoising tasks on simulated noisy MRI data, which is done on fastMRI datasets (fastMRI provides raw, complex, multi-echo, and multi-coil k-space MRI data) (Tibrewala et al., 2023; Zbontar et al., 2018). To simulate the effects of adding additional complex noise to the k-space data, we employ k-space noise addition strategies that have been previously validated in prior work (Desai et al., 2021a;b; Xiang et al., 2023). Specifically, we start by sampling Gaussian noise with different standard deviations (to simulate different noise intensities) and add it to the real and imaginary parts of each coil's k-space data. Next, we utilize the inverse transformation function implemented in fastMRI (Tibrewala et al., 2023; Zbontar et al., 2018) to convert the k-space data into simulated noisy datasets with varying degrees of noise. We simulate five datasets with different noise intensities. + +Declaration DIP is not considered as a comparison method due to its long computational time (the need for retraining on each image) and the mild blurring shown in Fig. 5, Fig. S13, S14 and Fig. S15. The original Patch2Self is not included as a comparison method because it typically requires at least ten 3D volumes to achieve good results (Fadnavis et al., 2020b;a; Garyfallidis et al., 2014). In contrast, the input 3D volumes in the simulated experiments are limited to a maximum of two (two for DDM2, one for Di-Fusion and Noisier2Noise). Directly comparing it with other methods on simulated data would be unfair. However, we still develop a reimplementation of Patch2Self, with modifications to the volume extraction part to limit the input volumes (two in our modified Patch2Self). It should be noted that our modified Patch2Self is solely utilized in the simulated experiments, where the limited input of two volumes does not yield optimal results. The original Patch2Self is still used in the remaining experiments carried out in this paper. Nevertheless, Patch2Self remains a useful approach when applied to a larger number of volumes (e.g., ten). + +# E SUPPLEMENTARY EXPERIMENTAL RESULTS + +In this section, we include comparisons with additional denoising methods, including MPPCA (Veraart et al., 2016), Noise2Score (N2S) (Kim & Ye, 2021), Recorrupted2Recorrupted (R2R) (Pang et al., 2021), and Patch2Self2 (P2S2) (Fadnavis et al., 2024) (reproduction details are provided in Appendix D.1). + +# E.1 MICROSTRUCTURE MODEL FITTING AND DATA DISTRIBUTION PLOTS + +In Table S2, as measured by $R^2$ , our Di-Fusion achieves the best results across all four different settings. An intriguing observation is that the denoised data from DDM2 exhibits a relatively higher + +![](images/455e6a8720e94b05c88788172a43801f3c268360f3a51c6766cc3d222aeb2a81.jpg) +Figure S7: Data distribution plots on raw and denoised data. Note that DDM2 denoised data distribution has shifted from the noisy data. + +Table S3: $\uparrow R^2$ of microstructure model fitting on CSD & DTI. Bold and Underline fonts denote the best and the second-best performance, respectively. As measured by $R^2$ , Di-Fusion achieves the best results across all four different settings. + +
MethodNoisyASCMMPPCADIPNr2NN2SR2RP2SDDM2P2S2OURS
CSD-CC0.7970.9340.8840.8680.9590.8230.8790.9270.8630.9570.967
CSD-CSO0.6140.8440.7500.4770.9080.4680.7310.7540.8100.9340.939
DTI-CC0.7890.9420.8810.8750.9610.8310.8720.7250.8450.9730.976
DTI-CSO0.4840.7890.6140.3810.8720.3480.6770.6750.7900.8670.876
+ +distribution (higher mean value) than other methods in Fig. S7. An observation is that the data from DDM2 exhibits a higher distribution than other methods. This may explain the improvement of DDM2 in CNR/SNR metrics in Fig. S12, as the foreground signals have higher values. Our experiments on downstream clinical tasks in Section 4.2 have shown no correlation between high or low scores on CNR/SNR metrics and the performance of the downstream clinical tasks. + +In Table S3, we summarize the quantitative $R^2$ metrics of all comparison methods. As measured by $R^2$ , our Di-Fusion still achieves the best results across all four different settings. + +# E.2 ADDITIONAL COMPARISONS ON TRACTOGRAPHY + +In Fig. E.2, we illustrate the effect on the tractography of OR using additional denoising methods. Diffusion effectively performs denoising while maintaining high FBCs, with "Noisy Filtering" serving as the reference for high FBCs. + +# E.3 DTI DIFFUSION SIGNAL ESTIMATES COMPARISONS + +We further examine how the denoising quality translates to downstream clinical tasks such as creating DTI (Basser et al., 1994) diffusion signal estimates using the various denoising methods. Details are in Appendix D.2. In Fig. S9, we show fractional anisotropy, axial diffusivity, mean diffusivity, and radial diffusivity comparisons. Apart from the poor performance of ASCM, we observe that other methods performed well on diffusion signal estimates. + +![](images/c1c0d38651dcd494a52bd7aa4724d871057bd4780fd66250ed2153d5de24d59a.jpg) +Figure S8: Density map of FBC projected on the streamlines of the OR bundles. The numbers in parentheses represent the number of streamlines. Di-Fusion maintains high FBCs (consider "Noisy/filtering" as references for high FBCs). + +![](images/d093fe919371be9530636da9c6a228b61ebd4f88994bd7cb356eec1299d6774d.jpg) +Figure S9: Fractional anisotropy, axial diffusivity, mean diffusivity, and radial diffusivity comparisons. The main differences are highlighted within the red dashed box. Our method effectively suppresses noise and reconstructs fiber tracts while maintaining a grayscale consistency with the original data (No overall brightening of diffusion signal estimates, especially on axial diffusivity) + +![](images/94f0990b97111c24b952a115e8476e9f1edfad01a4170888e1840efee40d9f07.jpg) +Figure S10: Fractional anisotropy, axial diffusivity, mean diffusivity, and radial diffusivity comparisons. The main differences are highlighted within the red dashed box. Our method effectively suppresses noise and reconstructs fiber tracts while maintaining a grayscale consistency with the original data (No overall brightening of diffusion signal estimates, especially on axial diffusivity) + +![](images/31a7ef8a7281f1dc511c2574b237ddc25e533f33964f8e41017c0bda059c853c.jpg) +Figure S11: Fractional anisotropy, axial diffusivity, mean diffusivity and radial diffusivity comparisons of previous version results and all volumes used results. + +On radial diffusivity, all methods exhibited an improved and less noisy representation of the diffusion directions of fiber tracts. However, on fractional anisotropy, and axial diffusivity, DDM2 shows inconsistencies with the noisy image at specific locations (highlighted by the red dashed box), indicating excessive denoising. Our method effectively suppresses noise and reconstructs fiber tracts while maintaining a grayscale consistency with the original data (no overall brightening of diffusion signal estimates, especially on axial diffusivity). + +In Fig. E.3, we further compare DTI diffusion signal estimates with those obtained using additional denoising methods. We follow the same steps in Appendix D.2 to estimate fractional anisotropy (FA), axial diffusivity (AD), mean diffusivity (MD), and radial diffusivity (RD). Additionally, we computed the reference for FA, AD, MD, and RD using all available dMRI data. Based on this, we performed the calculation of PSNR and SSIM for all slices. The quantitative results are summarized in Table E.3 + +Questions on ASCM diffusion signal estimates. In Fig. S9, minimal signals are observed in the ASCM axial and mean diffusivity. We further utilize all volumes to perform diffusion signal estimates and show results in Fig. S11. A noticeable signal should be revealed if all volumes are used in the diffusion signal estimates. This finding demonstrates that the denoising results of ASCM could significantly hinder the DTI diffusion signal estimates. + +# E.4 QUANTITATIVE RESULTS ON in-vivo DATA + +Given the absence of a consensus on image quality metrics, particularly in unsupervised reference-free settings (Chaudhari et al., 2020; Woodard & Carley-Spencer, 2006), the task of assessing perceptual MRI quality becomes a challenging research problem (Mittal et al., 2011). Considering the infeasibility of using PSNR and SSIM metrics (no ground truth reference images) and their limited correlation with clinical utility (Mason et al., 2019), computing metrics in downstream clinical regions of interest is more reasonable (Adamson et al., 2021). We follow the procedure outlined in (Xiang et al., 2023) to calculate SNR/CNR metrics (Details are in D.3). The quantitative denoising results were reported as mean and standard deviation scores for the complete 4D volumes in Fig. S12. Di-Fusion indicates better performance against competing methods. Our experiments in Section 4.2 have shown no correlation between high or low scores on CNR/SNR metrics and the performance of the downstream clinical tasks. + +
MethodMetricFAMDRDAD
NoisyPSNR23.4731.7933.5626.39
SSIM0.87600.96350.96370.9247
ASCMPSNR22.6321.8124.7020.89
SSIM0.88970.81880.89210.8102
DIPPSNR24.7633.0132.4230.21
SSIM0.88940.96750.96300.9453
MPPCAPSNR26.3735.2836.3529.63
SSIM0.90480.97510.97800.9534
Nr2NPSNR29.4738.4238.4834.87
SSIM0.93540.98510.98650.9712
N2SPSNR23.1329.7131.0825.84
SSIM0.86910.94690.94910.8973
R2RPSNR25.9334.5433.8230.21
SSIM0.88090.97080.96780.9394
P2SPSNR24.1832.1630.6233.27
SSIM0.90900.97080.96320.9677
DDM2PSNR26.7737.5337.3933.21
SSIM0.90410.98720.98480.9610
P2S2PSNR30.0839.2840.2334.06
SSIM0.94320.98940.99210.9701
OURSPSNR30.7940.2640.3535.30
SSIM0.94500.99310.99230.9763
+ +Table S4: PSNR and SSIM comparisons for DTI diffusion signal estimates. Here "AD" represents axial diffusivity, "RD" represents radial diffusivity, "MD" represents mean diffusivity and "FA" represents fractional anisotropy. + +![](images/85d03d370ae8c24aeaed1759b3bbebf241f10bd2d279adc3a93b66698d291049.jpg) +Figure S12: Box plots of Quantitative SNR/CNR metrics scores. The numbers within parentheses under OURs represent the value of $\mathcal{CSN}\mathcal{R}$ (Section 3.3). Di-Fusion indicates better performance in terms of SNR/CNR metrics. + +We summarize the CNR and SNR metrics of all comparison methods in Table S5, where our method achieves better results in both CNR and SNR metrics. + +Table S5: Comparison of SNR and CNR. Bold and Underline fonts denote the best and the second-best performance, respectively. + +
MethodASCMMPPCADIPR2RN2SNr2NP2SP2S2DDM2OURS
SNR-0.72510.23720.1035-0.00990.2266-0.1598-0.16160.15261.30401.5735
CNR-1.05130.21910.0567-0.1161-0.0304-0.2004-0.36940.11771.27251.5687
+ +![](images/3a805c9334738473ac097885e2429a5214c33fa74d54f8db3adad9f5c3933062.jpg) +Figure S13: More qualitative results on Stanford-Hardi. "OURS" results are obtained when $\mathcal{CSN}\mathcal{R} = 0.040$ (Section 3.3). Notice that Di-Fusion suppresses noise and does not show any anatomical structure in the residual plots. + +![](images/05cbbd5e1ac55c62cf0ce9c1cc86c76dc84ce8229121a10f83119c54acfe5ce3.jpg) +Figure S14: More qualitative results on Sherbrooke 3-Shell. "OURS" results are obtained when $\mathcal{CSN}\mathcal{R} = 0.040$ (Section 3.3). Notice that Di-Fusion suppresses noise and does not show any anatomical structure in the residual plots. + +![](images/8f595fa3fea1145394d729d4168c09f6dd1b635830bf8cebafc95a7a836b0aca.jpg) +Figure S15: More qualitative results on PPMI. "OURS" results are obtained when $\mathcal{CSN}\mathcal{R} = 0.040$ (Section 3.3). Notice that Di-Fusion suppresses noise and does not show any anatomical structure in the residual plots. + +# E.5 MORE QUALITATIVE RESULTS + +In Fig. S13, Fig. S14 and Fig. S15, we show more qualitative results. For each of the datasets, we show the axial slice of a randomly chosen 3D volume and the corresponding residuals (squared differences between the noisy data and the denoised output). We can observe that the results are generally consistent with those presented in Section 4.3. From the residuals of "DDM2", it can be observed that particular regions are suppressed (especially in Fig. S13, the DDM2 results for the second slice show that the residuals contain a significant amount of anatomical information). Notice that Di-Fusion suppresses noise and does not show any anatomical structure in the residual plots. + +# E.6 QUANTITATIVE AND QUALITATIVE RESULTS ON SIMULATED DATA + +We show the quantitative and qualitative results in Fig. S16. When the noise intensity is high (left three columns), our method performs the best. When the noise intensity is low (right two columns), denoising results are comparable to other methods. Considering the high PSNR and SSIM in the right two columns, it suggests that in real-world scenarios, such data may not require denoising and can still enable effective clinical use. Di-Fusion has more potential for generalization and applicability as it performs better under high noise intensity. + +# E.7 COMPARE UNDER MIXED B-VALUE IMAGES + +In Fig. S17, we show additional qualitative results when training on mixed b-value images (Sherbrooke 3-Shell has 1000, 2000, and 3500 b-values). Nr2N, P2S, DDM2, and our method both show minimal sensitivity to mixed b-values training data. Minor brightness variations in DDM2 and P2S for multiple b-values have a negligible impact on the overall results. Our method primarily learns the mapping from one volume to another, making it less affected by varying b-values in different volumes (P2S uses all the other different volumes, DDM2 uses two different input volumes at Stage 1, and Di-Fusion only uses one different volume). This suggests that the performance of Di-Fusion is relatively robust and not reliant on specific b-value configurations. + +# E.8 QUALITATIVE RESULTS WHEN USING FEWER DMRI VOLUMES + +As shown in Fig. E.8, when using fewer dMRI volumes (20% of original dMRI volumes), Di-Fusion still demonstrates effective denoising capabilities. Please pay special attention that the 30 dMRI volumes here refer to the total training data. Additionally, using a portion of dMRI data from different individuals for model training is a more clinically feasible approach. + +# F VISUALIZATION OF DI-FUSION + +# F.1 FUSION PROCESS: LINEAR INTERPOLATION BETWEEN THE TWO ENDPOINTS + +The noise schedule can be found in Appendix D.1. In Fig. S19, we provide a visual demonstration of $x_{t}^{*}$ (Eq. (6)). Without the Fusion process, the model output would deviate from $x_{out}$ , resulting in drifted results. By incorporating the Fusion process, where each linear interpolation $x_{t}^{*}$ from $x'$ to $x$ has $x$ as the target, the inference process avoids drifted results (Fig. 1 (a)). We further conducted ablation studies to demonstrate the significance of the Fusion process in Appendix G.1. + +# F.2 "DI- PROCESS: DIFFERENT NOISE DISTRIBUTION + +Experiment details: We computed all the $\xi_{x - x'}$ in Stanford HARDI dataset (meaning a total of $76*150 = 11400$ noisy images), calculated the grayscale histogram, mean and variance of these noisy images, and presented the calculated mean and variance in the form of a histogram. At the same time, we randomly sampled 11400 Gaussian noisy images and performed the same statistical operation. + +Statistical properties of $\xi_{x - x'}$ : From Fig. S20, the noise calculated by the "Di-" process has significantly different statistical properties from Gaussian noise. This is reflected in the fact that: 1. the variance of the calculated noise is relatively small and does not follow a normal distribution 2. + +![](images/68eb22a8fc4c91fd8a5a69c2be00b0a1915089ad474cdd1252b7e98bfeec55c6.jpg) +Figure S16: Quantitative and qualitative results on simulated data. In our experiments, $\mathcal{CSN}\mathcal{R} = 0.040$ . The red color represents the highest value for the metric, while the blue color represents the second-highest value. Please note that these are the results of a single round of simulated experiments and their corresponding PSNR and SSIM metrics scores. + +![](images/0e92de9acf029e8739baf045313b15ecd748eaa54c3f37e1849cef124ad70b82.jpg) +Figure S17: Additional results when training on mixed b-value images (All our results are obtained when $\mathcal{CSN}\mathcal{R} = 0.040$ ). "(2000)" indicates using data with only a b-value of 2000. "(multi-shell)" represents using data with mixed b-values, including 1000, 2000, and 3500. The performance of Di-Fusion is relatively robust and not reliant on specific b-value configurations + +![](images/29a2be6c25145f6859aaa631c5f10228c6266e5d4a132a8c0782bbc310d82ca1.jpg) +Figure S18: Qualitative results when using fewer dMRI volumes. Ours-30 indicates using 30 dMRI volumes, while Ours-150 represents using 150 dMRI volumes. + +![](images/c0833834d64b6b548ef2a5406ca8075f42f99d69974ef614924dc99d27f513c7.jpg) +Figure S19: Visual demonstration of $x_{t}^{*}$ obtained by different $t$ . + +![](images/ec01d0124e6550addb6e1eeb0b5ed2392e9ba4cd7b0104c8fec8d9c0ba237266.jpg) + +![](images/15f5ab1e5afa6da1daea53f2e83fb5f85bf88a86c83438d99d6be89cd8a7cc49.jpg) +Figure S20: Grayscale histogram, mean and variance of these noisy images. We computed all the $\xi_{x - x'}$ in Stanford HARDI dataset (meaning a total of $76*150 = 11400$ noisy images), calculated the grayscale histogram, mean and variance of these noisy images, and presented the calculated mean and variance in the form of a histogram. At the same time, we randomly sampled 11400 Gaussian noisy images and performed the same statistical operation. The noise calculated by the "Di-" process has significantly different statistical properties from Gaussian noise. This is reflected in the fact that: 1. the variance of the calculated noise is relatively small and does not follow a normal distribution 2. the counts of each pixel value on the grayscale histogram of $\xi_{x - x'}$ are similar, rather than a normal distribution in Gaussian noise. +Figure S21: Slices and their corresponding $b_{x}$ . The $b_{x}$ values of the edge slices are relatively larger. + +the counts of each pixel value on the grayscale histogram of $\xi_{x - x'}$ are similar, rather than a normal distribution in Gaussian noise. Different noise distribution makes $\mathcal{F}_{\theta}$ more capable of modeling real-world noise. + +# F.3 SAMPLING PROCESS: ITERATIVE AND STABLE REFINEMENT + +Value of $b_{x}$ In Section 3.3, we adopt a simple definition (Eq. (12)) to calculate a coefficient $b_{x}$ that accounts for the ratio of brain tissue to the entire image. Fig. S21 displays the slices accompanied by their corresponding $b_{x}$ . It can be observed that Eq. (12) is a simple method for evaluating the proportion of the brain tissue and $b_{x}$ can be used to correct $d_{x}$ in Eq. (13). + +Iterative and controllable refinement In Section 3.3, we propose an adaptive termination during the sampling process. This allows us to control the sampling process by setting the value of $\mathcal{CSN}\mathcal{R}$ . In general, setting a lower $\mathcal{CSN}\mathcal{R}$ will preserve more anatomical details. On the other hand, setting a higher $\mathcal{CSN}\mathcal{R}$ will remove more noise at the cost of losing some anatomical details (see Fig. S22 for visual demonstrations). + +$d_{x}$ plots In Section 3.3, we calculate $d_{x}$ (Eq. (13)) to represent the degree of denoising in $x_{out}$ . In Fig. S23, we illustrate the variation of $d_{x}$ during the reverse sampling process and present the results when implementing an adaptive termination. It can be observed that with such an adaptive termination, it is possible to quickly obtain denoised results (low $\mathcal{CSN}\mathcal{R}$ results) or further remove noise effectively (high $\mathcal{CSN}\mathcal{R}$ results). + +![](images/49b227e3f0ab81efe492a89c0c7988a6340ca041e330c8f6391ea9b390f386a7.jpg) +Figure S22: The results of sampling process obtained by different $CSNR$ . + +![](images/d80af668f9aba6bfb9892c6ef37f251186b167359434b6a912817e24acb71e46.jpg) +Figure S23: Variation of $d_{x}$ during the sampling process. The numbers within parentheses below OUR represent the value of CSNR (Section 3.3). + +![](images/ce24c2276b65765a3b5ead15df9f7aa8b251a2340cb491d1b61c4cdbcf282d11.jpg) +Figure S24: Qualitative results of ablation studies (Implement an adaptive termination mentioned in Section 3.3 during the sampling process and all the experiments $\mathcal{CSN}\mathcal{R} = 0.040$ ). Headings distinguish results obtained using different ablation settings. + +# G ABLATION STUDIES + +# G.1 ON TRAINING IN DI-FUSION + +On Fusion process In Section 3.1, we utilize Eq. (6) to compute linear interpolation from $x'$ to $x$ , aiming to reduce drift in final results. We disable the Fusion process by substituting $x'$ for $x_{t}^{*}$ . In Fig. S24, when going through several reverse steps (low SCNR), the results without the Fusion process do not exhibit significant deviations. However, when the adaptive termination is not implemented (which means completing all the sampling steps), noticeable slice misalignment occurs in Fig. S25 (highlighted by the red box). + +On "Di-" process In Section 3.1, we utilize Eq. (8) to compute a noise distribution $\xi_{x - x'}$ and use it in $q(x_t|x_t^*)$ and $p_{\mathcal{F}}(x_{t-1}|x_t)$ . We directly replace $\xi_{x-x'}$ calculated in the "Di-" process with Gaussian noise. Without the "Di-" process, results lack some high-frequency information, and the overall gray value of the denoised images has also changed (Case 1 in Fig. S24). Some may consider using $\xi_{x-x'}$ only during the diffusion process $q(x_t|x_t^*)$ and Gaussian noise during the sampling process $p_{\mathcal{F}}(x_{t-1}|x_t)$ . We present the results of this setting in Fig. S27, where it can be observed that artifacts occur along the edge slices. + +On training the latter diffusion steps In Section 3.2, we preform training the latter diffusion steps by optimizing $\mathcal{F}_{\theta}$ to condition on $\overline{\alpha}_t$ , $t \sim$ Uniform $(\{1, \dots, T_c\})$ , $T_c = 300$ . We disable training the latter diffusion steps by optimizing $\mathcal{F}_{\theta}$ to condition on $\overline{\alpha}_t$ , $t \sim$ Uniform $(\{1, \dots, 1000\})$ and balance the training iterations (training the latter diffusion steps iterations: $1e^5$ , training all diffusion steps: $3.5e^5$ ). Without training the latter diffusion steps, the denoising results are noticeably smoother and have more hallucinations (Fig. S24 and Fig. S25). We recommend training the latter diffusion steps based on its potential advantages, which include (i) mitigating hallucinations and (ii) reducing training time with improved stability. + +# G.2 ON SAMPLING IN DI-FUSION + +On adaptive termination In Section 3.3, we introduce an adaptive termination to enable iterative and adjustable refinement. In Fig. S21, we show slices and their corresponding $b_{x}$ , the $b_{x}$ values of the edge slices are relatively larger. In Fig. S22, we illustrate the impact of $\mathcal{CSN}\mathcal{R}$ on the sampling results. In Fig. S23, we show variation of $d_{x}$ during the sampling process. + +![](images/597db5c7533b093ded92bc57191f7b586614dc6d14e89f0f90b9c6519520c2a1.jpg) +Figure S25: Qualitative results of ablation studies (Didn't implement an adaptive termination mentioned in Section 3.3 during the sampling process). Headings distinguish results obtained using different ablation settings. The red box highlights the main differences. + +![](images/a0f777fbe0fe6bc88b28ff96b3db7d10cd7e34b2eb12349962318cfbf1a81f13.jpg) +Figure S26: DDPM sampling v.s. Run-Walk accelerated sampling (didn't implement an adaptive termination in Section 3.3) v.s. DDIM sampling. For all results, $\eta = 0$ . PSNR, SSIM are calculated using DDPM sampling results as references. This indicates that the sampling results from Run-Walk sampling are closer to the sampling results when accelerated sampling is not used. + +Run-Walk accelerated sampling maintains the sampling quality In Fig. S26, we show results obtained by different sampling strategies and metrics (averaged PSNR and SSIM on all volumes) calculated using DDPM sampling results as references. Directly performing DDIM sampling on a pre-trained model may lead to biased results (use DDPM sampling results as references). Run-Walk accelerated sampling significantly improves sampling speed and reduces inference time while maintaining the sampling quality relatively unchanged. + +About sampling time We do experiments to demonstrate that the additional computations in Section 3.3 do not impact the sampling speed. Firstly, we set $\mathcal{CSNR}$ to 1, which means that all + +![](images/86de93e82fffcbd8ac76a2540081e6ebd0e66a01a2277ba92ce3bc85a0879beb.jpg) +Figure S27: Using $z$ during $p_{\mathcal{F}}(x_{t-1}|x_t)$ v.s. Using $1 \cdot \xi_{x-x'}$ during $p_{\mathcal{F}}(x_{t-1}|x_t)$ v.s. Using $0 \cdot \xi_{x-x'}$ during $p_{\mathcal{F}}(x_{t-1}|x_t)$ (all results didn't implement an adaptive termination mentioned in Section 3.3) during the sampling process). + +slices undergo the extra computations and the whole sampling process since $\mathcal{CSNR}$ is sufficiently large. Subsequently, we remove the extra computational operations and perform sampling again. The sampling time in the first experiment was 1.19 seconds per slice. In contrast, in the second experiment, it was 1.18 seconds per slice, which indicates that the additional operations have minimal impact on the sampling speed. In Table S6, the sampling time per individual slice is presented for different $\mathcal{CSNR}$ . We find that When $\mathcal{CSNR}$ is low ( $\mathcal{CSNR} = 0.040$ ), the sampling time is 0.0395 seconds per slice. This indicates that our adaptive termination and Run-Walk accelerated sampling greatly reduce the sampling time. + +Using $\xi_{x - x'}$ in reverse process In Fig. S27, we demonstrate the importance of using $\xi_{x - x'}$ and setting $\eta = 0$ in the sampling process. It can be observed from the final results that in the central slices (with more brain tissue), using $z \sim \mathcal{N}(\mathbf{0},\mathbf{I})$ during the sampling process $p_{\mathcal{F}}(x_{t - 1}|x_t)$ only leads to subtle differences in the denoised results. However, in the edge slices (with less brain tissue), using $z$ significantly impacts the sampling results, resulting in additional regions that appear inexplicably (highlighted by the red box, and these additional regions don't appear in noisy data). During the sampling process, DDM2 uses $z$ . Because our sampling process is deterministic, according to the experiments in DDIM (Song et al., 2020b), we set $\eta = 0$ . We further demonstrated the sampling results in the figure with $\eta = 1$ and $\eta = 0$ . When $\eta = 1$ , although the presence of unexpected regions is reduced, some still remain. However, when $\eta = 0$ , such issues don't arise. + +Table S6: Sampling time per slice for different $\mathcal{CSN}\mathcal{R}$ (Stanford HARDI). We set different $\mathcal{CSN}\mathcal{R}$ parameters for Run-Walk accelerated sampling and DDPM sampling to perform adaptive termination. + +
CSNRTime (s) for Run-walkTime (s) for DDPM
0.040.03950.327
0.0450.1150.739
0.050.6262.01
0.0551.085.48
0.061.116.97
11.1811.5
+ +Table S7: $\uparrow R^2$ of microstructure model fitting on CSD & DTI. Bold and Underline fonts denote the best and the second-best performance, respectively. + +
MethodCSDDTI
CCCSOCCCSO
Noisy0.7970.6140.7890.484
ASCM0.9340.8440.9420.789
DIP0.8680.4770.8750.381
Nr2N0.9590.9080.9610.872
P2S (OLS)0.9270.7540.7250.675
P2S (Ridge)0.9270.7570.9270.673
P2S (Lasso)0.8240.4710.8160.429
P2S (OLS, r=1)0.9340.8320.9500.735
DDM20.8630.8100.8450.790
OURS0.9670.9390.9760.876
+ +![](images/4c99a18286dea98f74fa1b37eeb578d09947656457da66b01da2d36b4c38f19e.jpg) +Noisy Image + +![](images/c3bebeb8f973d52d4283faf6ac56ac050ddc96a6b72adf1dc4909bfbc35a14f1.jpg) +P2S (OLS) + +![](images/22d62c4b40a24a6a29be5af5e780d3b1768c462d0ab3169de798ff39711388ea.jpg) +P2S (Lasso) +Figure S28: Comparisons with different Patch2Self experimental settings. "OURS" results are obtained when $\mathcal{CSN}\mathcal{R} = 0.040$ . + +![](images/5276bbbcf2cbfe936b1aad3e8fabe0e717a8e13348220b49c1fbf1f5f5bf6e14.jpg) +P2S (Ridge) + +![](images/cc2f683b990b9d245b6e1526079857f1c93d3b3ef5f26ac21ea1e57ac660293b.jpg) +P2S (OLS, $r = 1$ ) + +![](images/96a2c074bbf81bbf4c4857e43c9e5dfd16c6d7a6d1fda56913501b6fc80803db.jpg) +OURS + +# H MORE COMPARISONS WITH COMPETING METHODS + +# H.1 COMPARE WITH DIFFERENT PATCH2SELF SETTINGS + +In Fig. S28, we show additional results on comparisons with different Patch2Self experimental settings. Our modifications are limited to the denoiser type (OLS, Lasso, Ridge) and patch radius, following the official repository of Patch2Self (Fadnavis et al., 2020b;a; Garyfallidis et al., 2014). The term “ $(r = 1)$ ” indicates changing the patch radius to 1, while the patch radius is assumed to be 0 if not specified. Modifying the denoiser type and patch radius in Patch2Self does not yield substantial improvements in the results. Altering the denoiser type does not impact the overall denoising time, whereas changing the patch radius significantly increases the overall denoising time. In our experiments, employing the OLS denoiser required 4 hours, while utilizing OLS with a patch radius of 1 took 26 hours. + +In Fig. S29, we show additional tractography results on comparisons with different Patch2Self experimental settings. Although the number of streamlines is the lowest in the “(OLS, r=1)” experimental setting, it still misses the high FBCs indicated by the white arrows. There are no significant differences in the results in the remaining experimental settings. Considering the computational burden when setting the patch radius to 1, we suggest setting the patch radius of Patch2Self to 0 to improve efficiency. + +In Table S7, we show quantitative results (on microstructure model fitting) on comparisons with different Patch2Self experimental settings. Varied experimental settings can influence the performance of microstructure model fitting. Nonetheless, these modifications do not change the rankings of the best and second-best results. + +![](images/d8401c9c03e75f3b6ebd1a628bee0c262e6b13fe044248758efb4bf9b3279d23.jpg) +Figure S29: Density map of FBC projected on the streamlines of the OR bundles. The numbers in parentheses represent the number of streamlines. + +![](images/83fe08497b23790811fb5ae0cecf4ee2641cc964c623914439f6c94c11a7438a.jpg) +Figure S30: Qualitative comparisons with Neighbor2Neighbor. "OURS" results are obtained when $\mathcal{CSN}\mathcal{R} = 0.040$ . + +# H.2 COMPARE WITH NEIGHBOR2NEIGHBOR + +In Section 2.1, the mentioned methods exhibit a significant drop in performance when confronted with real-world noisy images, particularly when the explicit noise model is unknown. To make up for this, Neighbor2Neighbor (Nei2Nei) (Huang et al., 2021) and Zero-shot Noise2Noise (Mansour & Heckel, 2023) sub-sample individual noisy images to create training pairs and are more robust against + +![](images/e5c1196a9adff037ea506aaa251d64489f50a792e2d0a70918b0bbc78a1508b8.jpg) +Figure S31: Density map of FBC projected on the streamlines of the OR bundles. The numbers in parentheses represent the number of streamlines. + +real-world noise. We compare our method with Nei2Nei using the same model in Di-Fusion. We implement Nei2Nei with parameters set to the default values specified in their official repository11. + +The qualitative results are in Fig. S30. It can be observed that Nei2Nei does not perform well in denoising, as there are partial jagged artifacts in the image and significant changes in grayscale. This may be the reason that Nei2Nei denoising relies on the structural similarity of the neighboring regions in the image. This can also be seen in the qualitative results of Nei2Nei, where the images maintain structural similarity in sub-sampled noisy images, leading to better denoising results. In Fig. S31, it can be observed that the density map of FBC projected on the streamlines of the OR bundles is missing a significant number of FBCs; thus the denoising results of Nei2Nei are unsuitable for modeling tasks. + +# I DDM2: STAGE 1 HAS A HUGE IMPACT ON FINAL RESULTS + +In Fig. S32, we present the results of DDM2's first stage and corresponding third stage on the Stanford HARDI dataset. By utilizing the hyperparameters from the DDM2 official repository and conducting experiments (only the training iteration in stage 1 was modified, the official training iteration is set to $10e^4$ ), we have observed that coarser outcomes in the first stage yield more striking yet less stable denoising results in the final stage. Conversely, deterministic outcomes in the first stage result in more stable but uninteresting denoising results in the final stage. Different first stage results lead to drastically distinct outcomes in the third stage. The CNR and SNR scores show significant differences between different first stage results (Fig. S32 (right below)). Please note that the subsequent experiments we conduct on DDM2 are using their best results. + +![](images/fd94afee775d03a7538ee57d8d25e0ba8d4e17c704dc8822ef619cc9430e039e.jpg) +Figure S32: DDM2 unstable model outcomes. (right below) Show the CNR metric of different experiment settings; CNR/SNR metrics show the same trend. The red box highlights the best results obtained using the parameters from the official code repository. Having a stable Stage 1 often leads to poor performance in CNR/SNR metrics, the red color within the parentheses represents the settings corresponding to each experiment. \ No newline at end of file diff --git a/ICLR/2025/Self-Supervised Diffusion MRI Denoising via Iterative and Stable Refinement/images.zip b/ICLR/2025/Self-Supervised Diffusion MRI Denoising via Iterative and Stable Refinement/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..32601303125e6958655e070dca610d531032f6f8 --- /dev/null +++ b/ICLR/2025/Self-Supervised Diffusion MRI Denoising via Iterative and Stable Refinement/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c05cd7d26ad5de6d2b5f8673877e912be0f699d0d7d8d154833c155373d53b80 +size 2750985 diff --git a/ICLR/2025/Self-Supervised Diffusion MRI Denoising via Iterative and Stable Refinement/layout.json b/ICLR/2025/Self-Supervised Diffusion MRI Denoising via Iterative and Stable Refinement/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..7a98d04fa0d16cbaa0b59ff953bd7c9c628a58af --- /dev/null +++ b/ICLR/2025/Self-Supervised Diffusion MRI Denoising via Iterative and Stable Refinement/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:13a5da0e3510ec26b86a60486d47896b4e3d3df925cc60b68bcbc46a1fbafd81 +size 1278056 diff --git a/ICLR/2025/Self-Supervised Diffusion Models for Electron-Aware Molecular Representation Learning/91bfbba7-f6ed-4fba-8f2b-26780b09616b_content_list.json b/ICLR/2025/Self-Supervised Diffusion Models for Electron-Aware Molecular Representation Learning/91bfbba7-f6ed-4fba-8f2b-26780b09616b_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..677f234c2e3e1913d56760909c7b053be4a686a6 --- /dev/null +++ b/ICLR/2025/Self-Supervised Diffusion Models for Electron-Aware Molecular Representation Learning/91bfbba7-f6ed-4fba-8f2b-26780b09616b_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6f353ee004b568f7c9bda76838e40d7b110474e838845ad1eb58657eacdf5bc3 +size 156538 diff --git a/ICLR/2025/Self-Supervised Diffusion Models for Electron-Aware Molecular Representation Learning/91bfbba7-f6ed-4fba-8f2b-26780b09616b_model.json b/ICLR/2025/Self-Supervised Diffusion Models for Electron-Aware Molecular Representation Learning/91bfbba7-f6ed-4fba-8f2b-26780b09616b_model.json new file mode 100644 index 0000000000000000000000000000000000000000..c70e29db7dc8d5008f267b3e767f6dfb03944d21 --- /dev/null +++ b/ICLR/2025/Self-Supervised Diffusion Models for Electron-Aware Molecular Representation Learning/91bfbba7-f6ed-4fba-8f2b-26780b09616b_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5f309d9c63d0a4c723410e2ecb4651ebc087fc8dd56e78e6a00eed0592f4326c +size 191969 diff --git a/ICLR/2025/Self-Supervised Diffusion Models for Electron-Aware Molecular Representation Learning/91bfbba7-f6ed-4fba-8f2b-26780b09616b_origin.pdf b/ICLR/2025/Self-Supervised Diffusion Models for Electron-Aware Molecular Representation Learning/91bfbba7-f6ed-4fba-8f2b-26780b09616b_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..725f28eb18e2743244be2947421edfd63b523871 --- /dev/null +++ b/ICLR/2025/Self-Supervised Diffusion Models for Electron-Aware Molecular Representation Learning/91bfbba7-f6ed-4fba-8f2b-26780b09616b_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2cc97d6422a3b401ae545ad7f7d1777952b7a76212b25bf281158b9a5a8427e5 +size 1249704 diff --git a/ICLR/2025/Self-Supervised Diffusion Models for Electron-Aware Molecular Representation Learning/full.md b/ICLR/2025/Self-Supervised Diffusion Models for Electron-Aware Molecular Representation Learning/full.md new file mode 100644 index 0000000000000000000000000000000000000000..be275e44b6d62061562e114d8f365ad70ebdafdc --- /dev/null +++ b/ICLR/2025/Self-Supervised Diffusion Models for Electron-Aware Molecular Representation Learning/full.md @@ -0,0 +1,534 @@ +# SELF-SUPERVISED DIFFUSION MODELS FOR ELECTRON-AWARE MOLECULAR REPRESENTATION LEARNING + +Gyoung S. Na + +KRICT, Republic of Korea + +ngs0@krict.re.kr + +Chanyoung Park + +KAIST, Republic of Korea + +cy PARK@kaist.ac.kr + +# ABSTRACT + +Physical properties derived from electronic distributions are essential information that determines molecular properties. However, the electron-level information is not accessible in most real-world complex molecules due to the extensive computational costs of determining uncertain electronic distributions. For this reason, existing methods for molecular property prediction have remained in regression models on simplified atom-level molecular descriptors, such as atomic structures and fingerprints. This paper proposes an efficient knowledge transfer method for electron-aware molecular representation learning. To this end, we devised a self-supervised diffusion method that estimates the electron-level information of real-world complex molecules without expensive quantum mechanical calculations. The proposed method achieved state-of-the-art prediction accuracy in the tasks of predicting molecular properties on extensive real-world molecular datasets. + +# 1 INTRODUCTION + +Machine learning has been widely studied as an efficient data-driven method for predicting the physical and chemical properties of molecules (Wigh et al., 2022). In particular, graph neural networks (GNNs) (Kipf & Welling, 2017) achieved numerous successes in various molecular representation learning tasks (Bilodeau et al., 2022; Duval et al., 2023). In GNNs, an atom-level molecular structure is defined as a graph $G = (\mathcal{V}, \mathcal{U}, \mathbf{A}, \mathbf{X}, \mathbf{R})$ , where $\mathcal{V}$ is a set of nodes (i.e., atoms), $\mathcal{U}$ is a set of edges (i.e., chemical bonds), $\mathbf{A} \in \{0,1\}^{|\mathcal{V}| \times |\mathcal{V}|}$ is an adjacency matrix, $\mathbf{X} \in \mathbb{R}^{|\mathcal{V}| \times d}$ is a $d$ -dimensional node-feature matrix, and $\mathbf{R} \in \mathbb{R}^{|\mathcal{U}| \times r}$ is an $r$ -dimensional edge-feature matrix (Wieder et al., 2020). + +In addition to traditional GNNs, various methods have been proposed to learn informative molecular representations from different approaches, such as fragmentation-based learning (Zhang et al., 2021; Kim et al., 2023), domain knowledge integration (Wang et al., 2022), and hierarchical representation learning (Zang et al., 2023). However, existing methods aimed to learn molecular representations from atom-level molecular descriptors, while overlooking a physical principle that molecular properties are essentially derived from electron-level information, such as electronic distributions and related electronic energies, beyond the atom-level information (Parr & Yang, 1995; Engel & Dreizler, 2011). Therefore, the representation capabilities of the existing methods for molecular representation learning are inherently limited, even though they were sophisticatedly designed to capture latent information from the atom-level molecular descriptors. + +In physical science, quantum mechanical calculations have been used as a de facto standard to calculate the electron-level molecular information (Parr & Yang, 1995), such as molecular orbital and atomization energy. However, as these methods suffer from cubic or greater time complexities with respect to the number of electrons in a molecule (Engel & Dreizler, 2011; Dawson et al., 2022), electron-level information about real-world complex and large molecules are usually not accessible in chemical applications. Although there is an efficient solution that uses sophisticatedly designed 3D-GNNs with electron-level information generated by forcefield-based and semi-empirical calculations (FFSECs) (Riniker & Landrum, 2015), the effectiveness of this straightforward solution is questionable due to the low calculation accuracy of the FFSEC methods. To corroborate our argument, we empirically evaluated the effectiveness of 3D-GNNs with FFSEC on well-known real-world molecular datasets: Lipop (Wu et al., 2018), ESOL (Delaney, 2004), and IGC50 (Wu & Wei, 2018) datasets. Fig. 1 shows + +that the experimental evaluations did not demonstrate significant improvement by the 3D-GNNs with FFSEC, denoted by PhysChem (Yang et al., 2021), M3GNet (Chen & Ong, 2022), and FAENet (Duval et al., 2023), while a simple 2D-GNN called AttFP (Xiong et al., 2019) rather showed better prediction accuracy. We conjecture two major reasons for such results: 1) The calculation errors of FFSEC can be propagated to the 3D + +![](images/bb8e1738916c3f3e986b056f2e4fe32917c9a36dc98c36ba8231d2b5859135db.jpg) +Figure 1: $R^2$ -scores (Nagelkerke et al., 1991) of 3D-GNNs with FFSEC on real-world molecular datasets. + +![](images/b332bef5eeec9854adffa6f4f6218bf4e2ecae292db0237c0bd660dc64095484.jpg) + +![](images/b243bc640af4a77945005e4c00bb835f46caf2b11453be0d2f43a5219faf523a.jpg) + +GNN models, which in turn degrades the prediction accuracy. 2) Complex 3D-GNNs are not effective in representation learning on large molecules due to the overfitting problem (Li et al., 2023a). + +In this paper, we propose decomposition-supervised electron-level information diffusion (DELID) for an electron-aware molecular representation learning. The main challenge is that the electron-level information $\mathbf{s}_0$ is usually unknown for a real-world molecule $G$ . To this end, we propose a self-supervised diffusion model for estimating the unknown latent representation $\mathbf{s}_0$ without its ground truth being accessible in the training process. As shown in Fig. 2a, DELID consists of two diffusion models. The diffusion model on $G$ aims to estimate the original molecule $G$ from the noise $G_{T}$ , while the diffusion model on $\mathbf{s}$ aims to estimate the unknown complete electron-level information $\mathbf{s}_0$ of $G$ from the noise $\mathbf{s}_T$ . The main idea of DELID is to consider $G_{T}$ as decomposed substructures of $G$ , and $\mathbf{s}_T$ as their electron-level information, where $G_{T}$ and $\mathbf{s}_T$ can be easily obtained from molecular decomposition algorithms (Liu et al., 2017), and public chemical databases (Ramakrishnan et al., 2014), respectively, without expensive quantum mechanical calculations. As illustrated in Fig. 2b, DELID employs the transition probability $p(G_{t-1}|G_t; G_0)$ of the diffusion process on $G$ as a self-supervision to learn the diffusion process from readily accessible $\mathbf{s}_T$ to unknown $\mathbf{s}_0$ . In Section 3.2, we will mathematically show that the diffusion model on $\mathbf{s}$ can be optimized by minimizing the KL divergence between $p(G_{t-1}|\mathbf{s}_t; G_0)$ and $p(G_{t-1}|G_t; G_0)$ . + +In our experiments, we focus on evaluating the prediction capabilities of the machine learning methods on biased and relatively small experimental datasets rather than simulated datasets (e.g., QM9 dataset (Ramakrishnan et al., 2014)). Although the simulated datasets are useful for analyzing rough statistics on small molecules, they are not appropriate to evaluate the prediction capabilities of the machine learning methods on real-world molecular physics due to the following two reasons: 1) The simulated datasets do not contain complex and large molecules due to the large time complexity of the quantum mechanical calculations. 2) The simulated datasets do not sufficiently reflect the quantum mechanical uncertainty in real-world molecules (Sim et al., 2018). For these reasons, we used experimentally collected molecular datasets from physicochemistry, toxicity, pharmacokinetics, and optical applications to evaluate the practical potential of DELID. For all benchmark molecular datasets, DELID achieved state-of-the-art performance in predicting experimentally observed properties of real-world complex molecules. The contributions can be summarized as: + +- A novel method called DELID for learning electron-aware molecular representations beyond atom-level molecular representations without expensive quantum mechanical calculations. +- A self-supervised diffusion mechanism to estimate the unknown electron-level information. +- The state-of-the-art prediction accuracy of DELID on extensive real-world molecular datasets containing experimentally collected complex molecules and their properties. + +# 2 RELATED WORK + +# 2.1 GRAPH NEURAL NETWORKS ON MOLECULES + +2D-GNNs for molecular representation learning on the 2D molecular structures have been widely studied in chemical science due to their practicality and efficiency. SchNet (Schütt et al., 2017) and MEGNet (Chen et al., 2019) are graph convolutional neural networks for molecular representation learning on quantum mechanical principles in chemical bonds and local atomic substructures. They employed an atom-wise representation to learn geometric information of the molecules. MPNN (Gilmer et al., 2017) is a message-padding neural network that captures the quantum mechanics + +![](images/12b0630ce07bf73bd21e7d23d85317c701e4a9ed201efd1e2fc323ef23b1ec83.jpg) +Figure 2: a. The overall architecture of DELID, and b. the self-supervised diffusion process to estimate the complete electron-level information $\mathbf{s}_0$ that represents the ground truth $\mathbf{s}$ of $G$ . In the self-supervised diffusion process, $G_{T}$ , $G_{0}$ , and $\mathbf{s}_T$ are given data, whereas $\mathbf{s}_0$ is unknown data. + +between the atoms. Directed MPNN (D-MPNN) is an extension of MPNN for molecular representation learning based on a directed message passing scheme (Yang et al., 2019). In addition to the general-purpose GNNs, AttFP (Xiong et al., 2019) was proposed to predict the physical and chemical properties of the molecules for drug discovery. + +3D-GNNs that utilize the 3D molecular structures in representation learning have been devised for more accurate molecular representation learning. DimeNet++ (Gasteiger et al., 2020), PhysChem (Yang et al., 2021), and M3GNet (Chen & Ong, 2022), and FAENet (Duval et al., 2023) were proposed to learn local and global 3D geometry of the molecules. ConAN (Nguyen et al., 2024) used the 3D molecular structures of possible conformers of the input molecule in molecular representation learning. In addition to these methods, PaiNN (Schütt et al., 2021), GemNet (Gasteiger et al., 2021), Equiformer (Liao & Smidt, 2022), MolKGNN (Liu et al., 2023), and ViSNet (Wang et al., 2024) were proposed for molecular property prediction on the 3D structures. However, despite their state-of-the-art performances on several benchmark datasets on calculated molecular structures, their applicability is significantly limited in real-world molecular science because calculating an accurate 3D molecular geometry is not feasible in most real-world complex molecules due to the uncertainty of the electronic structures and the large computational costs to calculate them (Krivanek et al., 2010; Suenaga & Koshino, 2010; Schuch & Verstraete, 2009). Although ConAN showed state-of-the-art prediction accuracy with an efficient geometry calculation, its practicality also limited because we should generate all conformers of the input molecules for each inference process. + +# 2.2 KNOWLEDGE TRANSFER METHODS FOR MOLECULAR REPRESENTATION LEARNING + +Machine learning methods usually suffer from the lack of training data and informative features in chemical applications because time-consuming and labor-intensive chemical experiments are required to collect experimentally generated data (Gromski et al., 2019; Shen et al., 2021). To overcome the lack of experimental data, transfer learning to exploit simulated molecular data has been widely studied in physics and chemistry (Jha et al., 2019; Cai et al., 2020; Zaverkin et al., 2023; Dou et al., 2023b). However, the practicality of the transfer learning methods on simulated molecular data is still limited because the source calculation databases are not able to cover the majority of large molecules in real-world chemical experiments due to the cubic or greater time complexities of the calculation methods with respect to the number of electrons in the molecules (Engel & Dreizler, 2011; Schuch & Verstraete, 2009). In addition to transfer learning, various molecular representation learning methods have been proposed to exploit fragmented information on molecular representation learning (Zhang et al., 2021; Wang et al., 2022; Yu & Gao, 2022; Chen et al., 2022; Kim et al., 2023; Feng et al., 2023). However, the representation capabilities of the existing molecular representation learning methods are essentially limited to the atom-level molecular representations because they did not consider how to estimate the electron-level information and how to utilize it. + +# 2.3 DIFFUSION MODELS + +Diffusion models aim to learn a stochastic process that approximates the probability distribution of a given dataset (Kingma et al., 2021; Song et al., 2020). The diffusion models have achieved remarkable successes in learning physical systems consisting of complex and long-step stochastic processes over conventional generative models (Zeni et al., 2023; Yuan et al., 2023; Wu & Li, 2023). The reverse process of the diffusion models, which restore the data from noise, can be used as a generative model to generate new data (Ho et al., 2022; Vignac et al., 2022). In addition to the conventional diffusion models, conditional diffusion models were devised to generate new data of desired properties (Tashiro et al., 2021; Zhang et al., 2023; Zbinden et al., 2023). Since the electron-level information is + +usually derived by complex and long-step physical processes (Parr & Yang, 1995; Hollingsworth & Dror, 2018), DELID employs the variational diffusion models (Huang et al., 2021) rather than shallow generative models, such as variational autoencoder (Kingma, 2013). However, as the existing diffusion models essentially require the ground truth data to learn the forward and reverse processes, they are not applicable to our problem where the electron-level information is not available. + +# 3 PROPOSED METHOD + +Vanilla Diffusion Models. The diffusion models essentially aim to learn the reverse process $p(\mathbf{s}_{t - 1}|\mathbf{s}_t)$ to restore the original data $\mathbf{s}_0$ from noise $\mathbf{s}_T$ (Ho et al., 2022). The diffusion models are usually optimized by maximizing the following probability (Kingma et al., 2021): + +$$ +\log p (\mathbf {s}) = \log E _ {q \left(\mathbf {s} _ {1: T} \mid \mathbf {s} _ {0}\right)} \left[ \frac {p \left(\mathbf {s} _ {T}\right) \prod_ {t = 1} ^ {T} p \left(\mathbf {s} _ {t - 1} \mid \mathbf {s} _ {t}\right)}{\prod_ {t = 1} ^ {T} q \left(\mathbf {s} _ {t} \mid \mathbf {s} _ {t - 1}\right)} \right]. \tag {1} +$$ + +A fundamental assumption of the diffusion models is that $\mathbf{s}_0$ to learn the diffusion processes is given in the training dataset (Kingma et al., 2021; Graham et al., 2023). However, since $\mathbf{s}_0$ represents the electron-level information of a real-world molecule, it is assumed to be unavailable in our task. + +Challenges in the Diffusion Processes of DELID. In our regression setting, the objective function of the prediction models is given by: + +$$ +\log p (y, \mathbf {s}, G) = \underbrace {\log p (y | \mathbf {s} , G)} _ {\text {S e c t i o n 3 . 1}} + \underbrace {\log p (\mathbf {s} | G)} _ {\text {S e c t i o n 3 . 2 . 2}} + \underbrace {\log p (G)} _ {\text {S e c t i o n 3 . 2 . 1}}. \tag {2} +$$ + +where $y$ is the target molecular property corresponding to the atom-level molecular descriptor $G$ , and $\mathbf{s}$ is hidden electron-level representation about $G$ . However, calculating $p(\mathbf{s}|G)$ based on the vanilla diffusion models is not feasible because the ground truth $\mathbf{s}$ is unknown in our task. Hence, our proposed DELID adopts a self-supervised diffusion process for learning the distribution of $\mathbf{s}_0$ , even though $\mathbf{s}_0$ is not given in the training process, which will be described in the following subsections. We will also mathematically show how we can approximate $p(\mathbf{s}|G)$ based on the diffusion process on $p(G)$ under some mild conditions on a set of substructures $G_T$ of the original molecule $G$ . + +# 3.1 DELID: DECOMPOSITION-SUPERVISED ELECTRON-LEVEL INFORMATION DIFFUSION + +Experimental observations on the atomic systems contain measurement noise originated from the uncertainty of the electronic distributions (Robertson, 1929; Najm et al., 2009). In physical science, quantum mechanical calculations have been widely used to quantify the uncertainty of the electronic distributions (Engel & Dreizler, 2011; Parr & Yang, 1995). Following the convention in physical science, DELID employs the electron-level information calculated by the quantum mechanical calculations as supplementary information to correct the measurement noise as: + +$$ +y = f (G) + \psi (\mathbf {s}; G), \tag {3} +$$ + +where $y$ is the target property of a molecule $G$ , $f$ is a structure encoder for the atom-level molecular descriptor $G$ , and $\psi$ is a function to estimate quantum mechanical noise from the electron-level information $\mathbf{s}$ , which is calculated by the quantum mechanical calculations. + +To predict the target molecular property $y$ based on Eq. (3), DELID implements $f$ as a deterministic function based on 2D-GNNs and $\psi$ as a stochastic function derived from parameterized normal distribution $\mathcal{N}(\mu_y,\sigma_y^2)$ , where $\mu_y = f_{y,\mu}(\mathbf{s};G)$ and $\sigma_y = f_{y,\sigma}(\mathbf{s};G)$ are parameterized mean and standard deviation, respectively. However, since $\mathbf{s}$ is not accessible in real-world complex and large molecules, we devised the self-supervised diffusion process to estimate unknown $\mathbf{s}$ from a given atom-level molecular descriptor $G$ . In the following sections, we will formally define the self-supervised diffusion process to estimate unknown $\mathbf{s}$ for $\psi (\mathbf{s};G)$ . + +# 3.2 SELF-SUPERVISED DIFFUSION PROCESSES + +# 3.2.1 DIFFUSION PROCESS ON MOLECULAR GRAPHS + +The purpose of the self-supervised diffusion of DELID is to learn the electron-aware representation $\mathbf{s}$ without labeled data for training $\mathbf{s}$ . To this end, we define a diffusion process of the molecule $G$ that will be used to guide the diffusion process on the unknown $\mathbf{s}$ . The lower bound of $\log p(G)$ is + +given by the variational diffusion model (Kingma et al., 2021) as: + +$$ +\begin{array}{l} \log p (G) \geq E _ {q \left(G _ {1} \mid G _ {0}\right)} \left[ \log p \left(G _ {0} \mid G _ {1}\right) \right] - D _ {\mathrm {K L}} \left(q \left(G _ {T} \mid G _ {0}\right) \mid \mid p \left(G _ {T}\right)\right) \\ - \sum_ {t = 2} ^ {T} E _ {q \left(G _ {t} \mid G _ {0}\right)} \left[ D _ {\mathrm {K L}} \left(q \left(G _ {t - 1} \mid G _ {t}, G _ {0}\right) \mid \mid p \left(G _ {t - 1} \mid G _ {t}\right)\right) \right], \tag {4} \\ \end{array} +$$ + +where $D_{\mathrm{KL}}(\cdot ||\cdot)$ is the KL divergence, $G_0$ is the latent embedding that follows the distribution of the input atom-level molecular graph $G$ , and $G_{T}$ is the noised data of $G$ . Note that the diffusion process on $G$ does not guarantee $G_0 \approx G$ in our problem setting because the entire model is finally trained to maximize $\log p(y,\mathbf{s},G)$ instead of $\log p(\mathbf{s},G)$ , as shown in Eq. (2). + +The main difference between the vanilla diffusion models and our proposed diffusion process lies in the assumption on $G_{T}$ , i.e., vanilla diffusion models assume $G_{T}$ as a random noise drawn, whereas DELID defines $G_{T}$ as atom-level decomposed substructures of $G$ . Formally, in DELID, $G_{T} = (\mathcal{V}_{T},\mathcal{U}_{T},\mathbf{A}_{T},\mathbf{X}_{T},\mathbf{R}_{T})$ is defined as a graph of graphs, where $\mathcal{V}_T = \{\mathcal{F}_1,\mathcal{F}_2,\dots,\mathcal{F}_K\}$ is a set of decomposed substructures of $G$ , $\mathcal{U}_T = \{\mathcal{E}_1,\mathcal{E}_2,\dots,\mathcal{E}_K\}$ is a set of edges within each substructure, $\mathbf{A}_T$ is an adjacency matrix representing $\mathcal{U}_T$ , $\mathbf{X}_T$ is the atom-feature matrix of the atoms in each substructure, $\mathbf{R}_T$ is the edge-feature matrix of $\mathcal{U}_T$ . The diffusion probability on $G_{T}$ is parameterized by GNN to consider the interactions between the substructures and their electron-level information. + +Definition 1. Complete graph decomposition. A graph decomposition is complete for $G$ if the decomposed substructures of $G$ , denoted by $\mathcal{F}_1, \mathcal{F}_2, \dots, \mathcal{F}_K$ , satisfy $\mathcal{F}_1 \cup \mathcal{F}_2 \cup \dots \cup \mathcal{F}_K = G$ and $\mathcal{F}_1 \cap \mathcal{F}_2 \cap \dots \cap \mathcal{F}_K = \emptyset$ where $K$ is the number of decomposed substructures. + +DELID assumes that $G_{T}$ is decomposed substructures generated through a complete graph decomposition defined by Definition 1. The essential property of the complete graph decomposition is that the nodes in $G$ are preserved through the overall graph decomposition process, i.e., $\mathbf{X}_T$ is preserved through the overall graph decomposition process. Hence, we can consider the node-features of the graphs as constant values in the diffusion process on $G$ . For this reason, the structural differences through the diffusion process are only in the latent adjacency matrix $\mathbf{A}_t$ and latent edge-feature matrix $\mathbf{R}_t$ of the latent graph $G_t$ . However, $\mathbf{R}_t$ is deterministically calculated by $\mathbf{A}_t$ for the given initial edge-feature matrix $\mathbf{R}_0$ because $\mathbf{R}_t$ is a matrix consisting of the rows of $\mathbf{R}_0$ selected by $\mathbf{A}_t$ . Therefore, if $G_{T}$ is generated through the complete graph decomposition, the diffusion process on $G$ can be rewritten based on $\mathbf{A}_t\in [0,1]^{\lvert\mathcal{V}_t\rvert\times\lvert\mathcal{V}_t\rvert}$ for the given $\mathbf{R}_0$ as: + +$$ +\begin{array}{l} \log p (G) \geq E _ {q \left(\mathbf {A} _ {1} \mid \mathbf {A} _ {0}; \mathbf {R} _ {0}\right)} [ \log p (\mathbf {A} _ {0} \mid \mathbf {A} _ {1}; \mathbf {R} _ {0}) ] - D _ {\mathrm {K L}} (q (\mathbf {A} _ {T} \mid \mathbf {A} _ {0}; \mathbf {R} _ {0}) | | p (\mathbf {A} _ {T}; \mathbf {R} _ {0})) \\ - \sum_ {t = 2} ^ {T} E _ {q \left(\mathbf {A} _ {t} \mid \mathbf {A} _ {0}; \mathbf {R} _ {0}\right)} \left[ D _ {\mathrm {K L}} \left(q \left(\mathbf {A} _ {t - 1} \mid \mathbf {A} _ {t}, \mathbf {A} _ {0}; \mathbf {R} _ {0}\right) \mid \mid p \left(\mathbf {A} _ {t - 1} \mid \mathbf {A} _ {t}; \mathbf {R} _ {0}\right)\right) \right]. \tag {5} \\ \end{array} +$$ + +DELID assumes $\mathbf{A}_{t,i,j} \sim \mathcal{N}(\mu_{t,i,j}, \sigma_{t,i,j}^2)$ for $t \in \{1,2,\dots,T-1\}$ , where $\mathbf{A}_{t,i,j}$ is the $(i,j)$ -th element of $\mathbf{A}_t$ , and $\mathcal{N}(\mu_{t,i,j}, \sigma_{t,i,j}^2)$ is a normal distribution parameterized by $\mu_{t,i,j}$ and $\sigma_{t,i,j}$ . However, since $\mathbf{A}_0$ and $\mathbf{A}_T$ , which are the adjacency matrices of $G_0$ and $G_T$ respectively, should be in $\{0,1\}^{|\mathcal{V}| \times |\mathcal{V}|}$ , DELID assumes $\mathbf{A}_{t,i,j} \sim \text{Bernoulli}(p_t)$ parameterized by $p_t$ for $t \in \{0,T\}$ . + +Decomposing $G$ into $G_{T}$ . DELID employs a chemically-informed molecular decomposition method based on extended functional groups (EFGs) (Lu et al., 2021) as an implementation of the complete graph decomposition. The EFG-based method has two benefits: 1) It can generate chemically valid substructures. 2) The size of the substructures is automatically adjusted based on chemical knowledge. In chemical science, several other molecular decomposition methods are available for molecular decomposition, such as the junction tree (Jin et al., 2018) and the BRICS decomposition (Liu et al., 2017). However, DELID uses the EFG-based molecular decomposition due to the following two benefits of the EFG-based molecular decomposition: 1) it is an efficient complete graph decomposition that generates chemically-valid subgraphs, and 2) it can capture commonly appeared large molecular substructures beyond the traditional small functional groups. Appendix G empirically shows the benefits of the EFG-based molecular decomposition over other molecular decomposition methods in molecular property prediction. + +# 3.2.2 CONDITIONAL DIFFUSION PROCESS ON ELECTRON-LEVEL INFORMATION $(p(\mathbf{S}|G))$ + +DELID calculates the unknown electron-aware latent representation $\mathbf{s}$ through a diffusion process guided by the diffusion process on $G$ . $\log p(\mathbf{s}|G)$ is given by the variational diffusion model as: + +$$ +\log p (\mathbf {s} | G) = \log p \left(\mathbf {s} _ {T} | G\right) + \sum_ {t = 1} ^ {T} \log p \left(\mathbf {s} _ {t - 1} \mid \mathbf {s} _ {t}\right), \tag {6} +$$ + +where $\mathbf{s}_0$ is the latent embedding representing the ground truth electron-level information $\mathbf{s}$ , and $\mathbf{s}_T$ is noised electron-level information corresponding to $G_T$ . Recall that we define $\mathbf{s}_T$ as pre-calculated electron-level features (properties) of the decomposed substructures $G_T$ of the input molecule $G$ instead of a simple random variable drawn from the standard normal distribution. Detailed descriptions to obtain $\mathbf{s}_T$ will be presented in Section 3.3. + +We can derive a computable lower bound of the second term in Eq. (6) by marginalizing it with respect to the latent graph $G_{t-1}$ . The lower bound of the second term is given by: + +$$ +\sum_ {t = 1} ^ {T} \log p (\mathbf {s} _ {t - 1} | \mathbf {s} _ {t}, G) \geq \sum_ {t = 1} ^ {T} E _ {q \left(G _ {t - 1} \mid G _ {t}\right)} \left[ \log p \left(\mathbf {s} _ {t - 1} \mid \mathbf {s} _ {t}, G _ {t - 1}\right) \right] - \sum_ {t = 1} ^ {T} D _ {\mathrm {K L}} \left(q \left(G _ {t - 1} \mid G _ {t}\right) \| p \left(G _ {t - 1} \mid \mathbf {s} _ {t}\right)\right). \tag {7} +$$ + +If $G_{T}$ is generated through the complete graph decomposition, the lower bound of $\log p(\mathbf{s}|G)$ can also be rewritten based on $\mathbf{A}_t$ and $\mathbf{R}_0$ as: + +$$ +\begin{array}{l} \log p (\mathbf {s} | G) \geq \log p \left(\mathbf {s} _ {T} \mid \mathbf {A} _ {0}; \mathbf {R} _ {0}\right) + \sum_ {t = 1} ^ {T} E _ {q \left(\mathbf {A} _ {t - 1} \mid \mathbf {A} _ {t}; \mathbf {R} _ {0}\right)} [ \log p \left(\mathbf {s} _ {t - 1} \mid \mathbf {s} _ {t}, \mathbf {A} _ {t - 1}; \mathbf {R} _ {0}\right) ] \tag {8} \\ - \sum_ {t = 1} ^ {T} D _ {\mathrm {K L}} \left(q \left(\mathbf {A} _ {t - 1} \mid \mathbf {A} _ {t}; \mathbf {R} _ {0}\right) | | p \left(\mathbf {A} _ {t - 1} \mid \mathbf {s} _ {t}; \mathbf {R} _ {0}\right)\right). \\ \end{array} +$$ + +The full derivation of the conditional diffusion process on $\mathbf{s}$ is provided in Appendix B. In the conditional diffusion process, DELID assumes that $p(\mathbf{s}_{t - 1}|\mathbf{s}_t,\mathbf{A}_{t - 1};\mathbf{R}_0)$ follows the parameterized normal distributions for $t\in \{2,3,\dots,T\}$ , while $p(\mathbf{s}_0|\mathbf{s}_1,\mathbf{A}_0;\mathbf{R}_0)$ and $p(\mathbf{s}_T|\mathbf{A}_0;\mathbf{R}_0)$ are assumed to follow the parameterized Bernoulli distributions. + +It is important to note that the conditional representation of the diffusion process on $\mathbf{s}$ described above shows that we can calculate the lower bound of $\log p(\mathbf{s}|G)$ without the ground truth values of $\mathbf{s}$ . Furthermore, the conditional representation also demonstrates that we can maximize $\log p(\mathbf{s}|G)$ by minimizing the KL divergence between $q(\mathbf{A}_{t-1}|\mathbf{A}_t; \mathbf{R}_0)$ and $p(\mathbf{A}_{t-1}|\mathbf{s}_t; \mathbf{R}_0)$ so that the diffusion process conditioned by $\mathbf{s}_t$ follows the diffusion process on $G$ . + +# 3.3 A RETRIEVAL PROCESS FOR OBTAINING $\mathbf{S}_T$ IN CONDITIONAL DIFFUSION PROCESS + +In Section 3.2.2, we formulated the conditional diffusion process, which can be performed without the ground truth $\mathbf{s}$ . However, we still need the ground truth $\mathbf{s}_T$ to perform the conditional diffusion process, since DELID defined $\mathbf{s}_T$ in Eq. (8) as the pre-calculated electron-level features of the decomposed substructures $G_T$ instead of the simple random noise. In this section, we will present a retrieval process of DELID to obtain $\mathbf{s}_T$ without expensive quantum mechanical calculations. + +Formally, $\mathbf{s}_T$ is defined as an embedding vector calculated by a trainable neural network for an input matrix $\mathbf{Q} \in \mathbb{R}^{K \times m}$ containing electron-level features about the $K$ decomposed substructures, where the $k$ -th row of $\mathbf{Q}$ , denoted by $\mathbf{Q}_k$ , is the pre-calculated $m$ -dimensional electron-level features of the $k$ -th substructure $\mathcal{F}_k \in \mathcal{V}_T$ . A straightforward way to obtain $\mathbf{Q}$ for calculating $\mathbf{s}_T$ is to execute the quantum mechanical calculations for each $\mathcal{F}_k$ . However, researchers in physical science have constructed public chemical databases that provide the electron-level features of small molecules via high-throughput quantum mechanical calculations (Ramakrishnan et al., 2014; Hoja et al., 2021; Kim et al., 2019), and the public chemical databases already provide various electron-level features for most possible small molecules. Hence, DELID leverages the readily accessible databases by taking the pre-calculated electron-level features of the decomposed substructures $\mathcal{F}_1, \mathcal{F}_2, \dots, \mathcal{F}_K$ based on a graph matching method for the public chemical databases. + +More precisely, $\mathbf{Q}_k$ is determined through the following retrieval process for a given public chemical database $\mathcal{D}_{qm}$ , such as QM9 (Ramakrishnan et al., 2014) and PubChemQC (Nakata & Shimazaki, 2017) datasets. The retrieval process is given by: + +$$ +\mathbf {Q} _ {k} = \mathbf {s} _ {q m, i ^ {*}}, \tag {9} +$$ + +where $\mathbf{s}_{qm,i^*}$ is the pre-calculated electron-level features (e.g., electronic energies) of the $i^*$ -th small molecule $G_{qm,i^*}$ in $\mathcal{D}_{qm}$ , and an index $i^*$ is calculated by: + +$$ +i ^ {*} = \underset {i \in \{1, 2, \dots , | \mathcal {D} _ {q m} | \}} {\arg \max } \phi \left(\mathcal {F} _ {k}, G _ {q m, i}\right), \tag {10} +$$ + +$\phi : \mathcal{G} \times \mathcal{G} \to \mathbb{R}$ is the Tanimoto similarity metric (Bajusz et al., 2015) to calculate the similarity between two molecular graphs $\mathcal{F}_k$ and $G_{qm,i}$ in a graph domain $\mathcal{G}$ . In other words, for a decomposed substructure $\mathcal{F}_k$ , we assign the pre-calculated electron-level features of a molecule in $\mathcal{D}_{qm}$ + +whose Tanimoto similarity with $\mathcal{F}_k$ is the highest. By performing the above retrieval process for all $\mathcal{F}_k\in \{\mathcal{F}_1,\mathcal{F}_2,\dots,\mathcal{F}_K\}$ , we can get $\mathbf{Q}$ for constructing $\mathbf{s}_T$ without expensive quantum mechanical calculations. In the implementation of DELID, we used the QM9 dataset as $\mathcal{D}_{qm}$ and transferred 15 energy- and polarity-related electron-level features for generating $\mathbf{Q}_k$ . + +# 4 EXPERIMENTS + +We compared the prediction capabilities of DELID with those of state-of-the-art methods on various benchmark molecular datasets containing experimentally collected molecules and their properties. We focused on evaluating the prediction capabilities of DELID on the experimentally generated datasets rather than simulated datasets (e.g., the QM9 dataset) due to the following reasons: 1) The simulated datasets are not suitable to evaluate the prediction capabilities of machine learning methods in real-world chemical applications because most molecules in the simulated datasets are too simple and small (Ramakrishnan et al., 2014; Hoja et al., 2021). 2) Unlike the simulated datasets, heterogeneous and out-of-distribution molecules are common in real-world chemical applications, and we will discuss about this difference in Section 4.1 3) Experimental datasets containing the measurement noises from the uncertainty of the electronic distributions are closer to real-world nature than the simulated datasets (Wu et al., 2018; Joung et al., 2020). + +Although we focused on evaluating the prediction capabilities of DELID on the experimental datasets, DELID also showed the prediction accuracy comparable to state-of-the-art methods on a large simulated dataset (Appendix H). In addition to the evaluation on the large simulated dataset, we conducted additional experiments to evaluate the prediction performances of DELID for classification tasks (Appendix I) and for different molecular scales of $\mathcal{D}_{qm}$ (Appendix J). + +Datasets. We employed nine benchmark molecular datasets constructed by real-world chemical experiments. The benchmark molecular datasets were selected from well-known databases in molecular science (Wu et al., 2018; Wu & Wei, 2018; Mendez et al., 2019; Joung et al., 2020). For comprehensive evaluations, we selected the benchmark molecular datasets from four different chemical applications: physicochemistry, toxicity, pharmacokinetics, and optics. The characteristics of the benchmark molecular datasets are summarized in Appendix D. + +Competitors. We categorized competitor methods into three classes according to commonly used molecular descriptors: molecular fingerprint, 2D molecular graph, and 3D molecular graph. 1) For the molecular fingerprints, we generated three XGBoost (Chen & Guestrin, 2016) based ensemble methods called XGB-Mor, XGB-FC, and XGB-MK that predict target molecular properties from input Morgan (Mor) (Rogers & Hahn, 2010), functional-class (FC) (Rogers & Hahn, 2010), and MACCS Key (MK) (Singh et al., 2009) fingerprints, respectively. Even though the XGB-based ensemble methods with the molecular fingerprints are simple and trivial, they have shown state-of-the-art prediction accuracy in various chemical applications (Ding et al., 2021; Li et al., 2023b). 2) For the 2D molecular graph, we employed five GNNs: GIN (Xu et al., 2018), EGCN (Tailor et al., 2021), MPNN (Gilmer et al., 2017), D-MPNN (Yang et al., 2019), UniMP (Shi et al., 2021), and AttFP (Xiong et al., 2019). 3) Although 3D-GNNs are not applicable to the experimental molecular datasets, we calculated the 3D atomic coordinates based on FFSEC and evaluated five 3D-GNNs for the input FFSEC-generated 3D graphs. The following 3D GNNs were employed as competitor methods: SchNet (Schütt et al., 2017), DimeNet++ (Gasteiger et al., 2020), PhysChem (Yang et al., 2021), M3GNet (Chen & Ong, 2022), FAENet (Duval et al., 2023), and ConAN (Nguyen et al., 2024). However, we were not able to execute or evaluate several 3D-GNNs (Schütt et al., 2021; Gasteiger et al., 2021; Liao & Smidt, 2022) due to out-of-memory problems or additional requirements on input data. Appendix E provides brief descriptions of the competitor methods. + +**Implementations.** We used MPNN and GIN for the GNN-based embedding network of $G$ and $G_{T}$ in DELID, respectively. The hyperparameters of DELID and competitor methods were optimized by a grid search on commonly used hyperparameter sets. Also, we followed the original implementation of the competitor methods to set method specific hyperparameters. The hyperparameter settings of DELID for each benchmark datasets are given in Appendix F. For the information retrieval of DELID in Section 3.3, we used the QM9 dataset (Ramakrishnan et al., 2014) generated by a high-throughput quantum mechanical calculation on small organic molecules. Instead of the original QM9 dataset, we used a subset of the QM9 dataset containing the molecules with maximum six atoms as $\mathcal{D}_{qm}$ because too large molecules are redundant in matching the decomposed small substructures. The source code of DELID is publicly available at https://github.com/ngs00/DELID. + +Table 1: The $R^2$ -scores of the competitor methods and DELID on benchmark experimental molecular datasets. N/R and N/A mean a negative $R^2$ -score indicating a failure of regression and an execution failure related to out of memory or numerical errors, respectively. + +
Input TypeMethodLipopESOLADMETIGC50LD50LC50LMC-HCH-DCCH-AC
Molecular +FingerprintXGB-Mor0.5310.6590.7170.6210.3900.4970.505N/RN/R
(0.024)(0.045)(0.021)(0.040)(0.133)(0.016)(0.018)
XGB-FC0.5780.6860.7200.6280.5010.5190.503N/RN/R
(0.018)(0.052)(0.009)(0.023)(0.052)(0.025)(0.007)
XGB-MK0.5420.7640.7610.6800.4860.5260.471N/RN/R
(0.041)(0.047)(0.020)(0.037)(0.112)(0.021)(0.019)
3D Molecular +GraphSchNet0.6670.8810.8340.7650.5270.4670.4560.7130.702
(0.021)(0.026)(0.012)(0.034)(0.062)(0.025)(0.024)(0.050)(0.037)
DimeNet++N/R0.878N/R0.7790.541N/A0.352N/AN/A
(0.025)(0.019)(0.045)(0.101)
PhysChem0.6940.848N/A0.8140.511N/AN/AN/AN/A
(0.024)(0.032)(0.017)(0.053)
M3GNetN/A0.857N/A0.6970.531N/AN/AN/AN/A
(0.025)(0.029)(0.034)
FAENet0.6700.8690.7880.7080.4740.5280.4370.4370.310
(0.036)(0.013)(0.020)(0.015)(0.020)(0.094)(0.025)(0.132)(0.136)
ConAN0.7380.9090.8450.8190.5310.5720.4660.4050.388
(0.018)(0.015)(0.028)(0.007)(0.041)(0.070)(0.028)(0.108)(0.115)
2D Molecular +GraphGIN0.7090.8080.8070.7920.5450.5250.4720.242N/R
(0.019)(0.017)(0.023)(0.015)(0.016)(0.080)(0.033)(0.010)N/R
EGCN0.7160.8220.8140.7770.5500.5030.4970.226N/R
(0.021)(0.029)(0.021)(0.020)(0.018)(0.080)(0.038)(0.086)N/R
MPNN0.7270.8100.8010.7640.5020.4870.4610.385N/R
(0.018)(0.042)(0.028)(0.027)(0.022)(0.108)(0.032)(0.023)N/R
D-MPNN0.7260.8790.8200.7870.5210.5660.494N/RN/R
(0.037)(0.013)(0.018)(0.008)(0.011)(0.098)(0.011)
UniMP0.7180.8100.8170.7560.5120.5310.4780.166N/R
(0.010)(0.036)(0.018)(0.040)(0.026)(0.078)(0.026)(0.051)N/R
AttFP0.7100.9090.8510.8070.5130.6420.4560.4410.296
(0.021)(0.018)(0.027)(0.013)(0.016)(0.079)(0.031)(0.099)(0.370)
DELID0.7820.9120.8340.8440.5660.6440.5320.8860.885
(0.013)(0.014)(0.042)(0.006)(0.024)(0.068)(0.048)(0.035)(0.023)
+ +# 4.1 MOLECULAR PROPERTY PREDICTION ON REAL-WORLD COMPLEX MOLECULES + +We measured the $R^2$ -scores of DELID and the competitor methods on the nine benchmark molecular datasets. In this experiment, we focused on evaluating the representation capabilities of DELID and the competitor methods on the experimental datasets containing experimentally collected complex and large molecules rather than the simulated datasets. Note that the $R^2$ -score is a normalized metric to measure the regression accuracy. For all datasets, the $R^2$ -scores were measured by the 5-fold cross-validation. Table 1 shows the measured $R^2$ -scores on the benchmark molecular datasets. Although the 3D-GNNs were sophisticatedly designed to capture the inter-atomic interactions in the 3D geometry and showed accuracy improvements on simulated molecular datasets, they were not executable on many benchmark molecular datasets containing complex and large real-world molecules. However, DELID showed reliable execution performances and achieved state-of-the-art prediction accuracy on most benchmark datasets. + +One of the main limitations of the 3D-GNNs is that their generalization capabilities are limited on large molecular graphs due to the impractical time complexities and the easily overfitted embedding schemes (Li et al., 2023a). In the experiments, the $R^2$ -scores of the 3D-GNNs were also lower than those of the 2D-GNNs on the Lipop and LMC-H datasets containing many large molecules, even though the 3D-GNNs employ sophisticatedly designed embedding methods with more model parameters. This experimental results directly show the limitations of the 3D-GNNs on real-world complex and large molecules. However, DELID achieved the highest $R^2$ -scores on the Lipop and LMC-H datasets. These results show the practical potential of DELID in real-world chemical applications where complex and large molecules commonly appear. + +We investigated the reasons for the failure of the competitor methods on the CH-DC and CH-AC datasets. Fig. 3 shows the data distributions of the CH-DC and CH-AC datasets. We also presented the data distributions of the ESOL and IGC50 datasets where most competitor methods successfully learned the relationships between the molecules and the target properties. Additionally, we plotted the data distribution of the QM9 dataset together with the data distributions of the benchmark datasets for comparative analysis on the simulated and experimental molecular datasets. The molecules in the datasets were projected to the 2D space through randomly initialized MPNN to preserve the density of the data. + +We observed two major results in Fig. 3. First, the data distribution of the simulated dataset was biased, whereas the data distribution of the experimental datasets covered larger chemical spaces + +![](images/0b1a85a5ce421cc8e81af1c546e3d8e70a4c6be264f9ed43ea08ba2a4801b0d5.jpg) +Benchmark datasets that were easy to regression + +![](images/591adf26431be0c6a44142c2b82aec490d6207bb97bad6684c49a7325740707d.jpg) +Benchmark datasets that were difficult to regression +Figure 3: Data Distributions of the benchmark molecular datasets. Black: molecular embeddings of a simulated dataset called the QM9 dataset. Red: molecular embeddings of an experimentally generated dataset. Note that the data distribution of the QM9 dataset can be plotted differently depending on the scale of the data distribution of the ESOL, IGC50, CH-DC, and CH-AC datasets. + +![](images/9321bc5643ef64f0b5091133adc2fc7df024a9c8ac37a0c8dc4109c38ff862f5.jpg) +Figure 4: The $R^2$ -scores for different sizes of the training data on the Lipop, ESOL, ADMET, IGC50, and LD50 datasets. X-axis: Ratio of the training data. Y-axis: Measured $R^2$ -score. + +with many outlier molecules. This observation justifies why evaluating machine learning methods on experimentally collected molecular datasets is crucial in validating their practical availability in real-world chemical applications. Second, the CH-DC and CH-AC datasets where most competitor methods failed to predict the target properties covered extremely larger chemical spaces compared to the QM9, ESOL, and IGC50 datasets. Nevertheless, DELID successfully captured the underlying relationships between the molecules and their optical properties on the CH-DC and CH-AC datasets. + +# 4.2 PREDICTION ACCURACY ON VARIOUS SIZES OF TRAINING DATA + +Since conducting chemical experiments to obtain the experimentally labeled data is time-consuming and labor-intensive, the lack of training data remains one of the main challenges of machine learning in chemical applications (Dou et al., 2023a). As described in Section 3.3, DELID is flexible in incorporating external electron-level features into molecular representation learning, which is beneficial in constructing an accurate prediction model on small training datasets. In this experiment, we compared the $R^2$ -scores of DELID and the competitor methods over different sizes of training datasets to demonstrate the effectiveness of DELID on small training datasets. + +Fig. 4 shows the $R^2$ -scores of DELID and the competitor methods for different sizes of training datasets. We measured the $R^2$ -scores on the Lipop, ESOL, ADMET, IGC50, and LD50 datasets in which DELID and most competitor methods achieved the $R^2$ -scores greater than 0.5. However, We did not compare the $R^2$ -scores of the XGB- and 3D structure-based methods because most of them failed on small training datasets. Obviously, we were able to observe that the prediction accuracy tends to be improved as the size of the training dataset increases for most methods. Among the competitor methods, AttFP showed comparable generalization capabilities to those of DELID on the ESOL and ADMET datasets. However, the accuracy improvements by AttFP were marginal compared to GIN, EGCN, MPNN, and UniMP on the Lipop, IGC50, and LD50 datasets. By contrast, DELID consistently showed better generalization performances regardless of the benchmark datasets compared to GIN, EGCN, MPNN, and UniMP. Furthermore, DELID outperformed AttFP on the Lipop, IGC50, and LD50 datasets. These experimental results show the practical potential of DELID in real-world chemical applications, which usually suffer from the lack of training data. + +# 4.3 PREDICTION ACCURACY FOR DIFFERENT ELECTRON-LEVEL FEATURES + +The choice of the electron-level features in the information retrieval can affect the representation capabilities of DELID. To evaluate the prediction capability of DELID for different electron-level features, we measured the $R^2$ -scores of DELID for different electron-level features provided in the + +Table 2: The $R^2$ -scores of DELID for different electron-level features. + +
Category of FeaturesLipopESOLADMETIGC50LD50LC50LMC-HCH-DCCH-AC
Energy-related features0.776(0.015)0.911(0.013)0.835(0.036)0.842(0.013)N/R0.642(0.080)0.538(0.029)0.784(0.149)0.832(0.097)
Polarity-related features0.778(0.006)0.908(0.011)0.755(0.196)0.840(0.016)0.569(0.020)0.632(0.091)0.525(0.035)0.886(0.008)0.877(0.013)
Other features0.785(0.012)0.910(0.012)0.711(0.217)0.849(0.012)0.556(0.018)0.632(0.070)0.534(0.024)0.773(0.147)0.861(0.010)
All features (DELID)0.782(0.013)0.912(0.014)0.834(0.042)0.844(0.006)0.566(0.024)0.644(0.068)0.532(0.048)0.886(0.035)0.885(0.023)
+ +Table 3: The $R^2$ -scores of DELID and its three variants in the Ablation study. + +
MethodAtom-Level InformationElectron-Level InformationInformation DiffusionLipopESOLADMETIGC50LD50LC50LMC-HCH-DCCH-AC
DELIDat✓XX0.727(0.018)0.810(0.042)0.801(0.028)0.764(0.027)0.502(0.022)0.487(0.108)0.461(0.032)0.385(0.023)N/R
DELIDetX✓X0.220(0.014)0.445(0.060)0.537(0.022)0.419(0.017)0.200(0.024)0.226(0.094)0.243(0.043)0.600(0.038)0.548(0.032)
DELIDqm✓✓X0.775(0.005)0.908(0.014)0.824(0.005)0.828(0.011)0.537(0.030)0.616(0.085)0.502(0.046)0.846(0.026)0.875(0.013)
DELID✓✓✓0.782(0.013)0.912(0.014)0.834(0.042)0.844(0.006)0.566(0.024)0.644(0.068)0.532(0.048)0.886(0.035)0.885(0.023)
+ +QM9 dataset. We categorized the provided electron-level features into the following three classes: 1) energy-related features, 2) polarity-related features, 3) other features. Note that DELID used all electron-level features in representation learning. Table 2 shows the $R^2$ -scores of DELID for different kinds of the electron-level features. DELID showed significant improvements on the ADMET and CH-DC datasets by using the energy- and polarity-related electron-level features respectively, because of the direct relationships between the target molecular properties and these electron-level features (Dong et al., 2018; Joung et al., 2020). However, DELID exploiting all electron-level features showed the prediction accuracy comparable to the best models for all datasets, and this result shows that DELID can select important electron-level features for a given target task. + +# 4.4 ABLATION STUDY ON DELID + +We conducted an ablation study to evaluate the effectiveness of the electron-level information and self-supervised diffusion of DELID. We generated three variants of DELID for the ablation study. 1) $\mathrm{DELID}_{at}$ is a model that learns the molecular representations using only the atom-level molecular descriptor $G$ , which is the same as MPNN. 2) $\mathrm{DELID}_{et}$ learns the molecular representations using only the fragmented information defined as $G_{T}$ and $\mathbf{s}_T$ . 3) $\mathrm{DELID}_{qm}$ predicts the target molecular property based on Eq. (3) without the self-supervised diffusion on $\mathbf{s}$ , i.e., $\mathrm{DELID}_{qm}$ predicts the target molecular property by $y = f(G) + \psi (G_T,\mathbf{s}_T;G)$ . Table 3 shows the $R^2$ -scores of DELID and its three variants for the ablation study. The $R^2$ -scores were measured by the 5-fold cross-validation. The $R^2$ -scores of $\mathrm{DELID}_{et}$ show that the incomplete electron-level features is not sufficient to predict the molecular properties of the original molecules. The accuracy improvements were remarkable in $\mathrm{DELID}_{qm}$ compared to $\mathrm{DELID}_{at}$ and $\mathrm{DELID}_{et}$ , and this result shows that integrating the atom-level and electron-level information is crucial for accuracy molecular property prediction. However, we were able to observe further improvements by DELID for all benchmark molecular datasets. These results demonstrate the effectiveness of the electron-aware molecular representation learning based on the self-supervised diffusion. + +# 5 CONCLUSION + +This paper proposed DELID to learn informative molecular representations of real-world complex and large molecules based on the self-supervised diffusion process on the electron-level information. In this paper, we mathematically showed that DELID can learn the electron-aware molecular representations by approximating the diffusion process started from the fragmented electron-level information to the diffusion process started from the decomposed substructures, even though the complete electron-level information about the molecules is not known. By employing the self-supervised diffusion, DELID achieved state-of-the-art prediction accuracy on extensive benchmark datasets containing experimentally collected molecules and their molecular properties. The experimental results showed the practical potentials of DELID in real-world chemical applications. As a future work, an efficient method to construct the calculation databases at an accurate calculation level for the coarse-graining representation learning of DELID needs to be considered to provide more accurate electron-level features to DELID. + +# ACKNOWLEDGMENTS + +This work was supported by Ministry of Trade, Industry and Energy (No. TS241-10R) and National Research Foundation of Korea (NRF) funded by Ministry of Science and ICT (NRF-2022M3J6A1063021, RS-2024-00406985). + +# REFERENCES + +Dávid Bajusz, Anita Rácz, and Károly Héberger. Why is tanimoto index an appropriate choice for fingerprint-based similarity calculations? J. Cheminformatics, 7(1):1-13, 2015. +Camille Bilodeau, Wengong Jin, Tommi Jaakkola, Regina Barzilay, and Klavs F Jensen. Generative models for molecular discovery: Recent advances and challenges. Wiley Interdiscip. Rev. Comput. Mol. Sci., 12(5):e1608, 2022. +Ella Bingham and Heikki Mannila. Random projection in dimensionality reduction: applications to image and text data. In ACM SIGKDD, pp. 245-250, 2001. +Chenjing Cai, Shiwei Wang, Youjun Xu, Weilin Zhang, Ke Tang, Qi Ouyang, Luhua Lai, and Jianfeng Pei. Transfer learning for drug discovery. J. Med. Chem., 63(16):8683-8694, 2020. +Chi Chen and Shyue Ping Ong. A universal graph deep learning interatomic potential for the periodic table. Nat. Comput. Sci., 2(11):718-728, 2022. +Chi Chen, Weike Ye, Yunxing Zuo, Chen Zheng, and Shyue Ping Ong. Graph networks as a universal machine learning framework for molecules and crystals. *Chem. Mater.*, 2019. +Dexiong Chen, Leslie O'Bray, and Karsten Borgwardt. Structure-aware transformer for graph representation learning. In ICML, pp. 3469-3489. PMLR, 2022. +Tianqi Chen and Carlos Guestrin. Xgboost: A scalable tree boosting system. In ACM SIGKDD, pp. 785-794, 2016. +William Dawson, Augustin Degomme, Martina Stella, Takahito Nakajima, Laura E Ratcliff, and Luigi Genovese. Density functional theory calculations of large systems: Interplay between fragments, observables, and computational complexity. Wiley Interdiscip. Rev. Comput. Mol. Sci., 12 (3):e1574, 2022. +John S. Delaney. Esol: Estimating aqueous solubility directly from molecular structure. J. Chem. Inf. Comput. Sci., 44:1000-1005, 2004. +Yi Ding, Minchun Chen, Chao Guo, Peng Zhang, and Jingwen Wang. Molecular fingerprint-based machine learning assisted qsr model development for prediction of ionic liquid properties. J. Mol. Liq., 326:115212, 2021. +Jie Dong, Ning-Ning Wang, Zhi-Jiang Yao, Lin Zhang, Yan Cheng, Defang Ouyang, Ai-Ping Lu, and Dong-Sheng Cao. Admetlab: a platform for systematic admet evaluation based on a comprehensively collected admet database. J. Cheminformatics, 10(1):1-11, 2018. +Bozheng Dou, Zailiang Zhu, Ekaterina Merkurjev, Lu Ke, Long Chen, Jian Jiang, Yueying Zhu, Jie Liu, Bengong Zhang, and Guo-Wei Wei. Machine learning methods for small data challenges in molecular science. Chem. Rev., 123(13):8736-8780, 2023a. +Bozheng Dou, Zailiang Zhu, Ekaterina Merkurjev, Lu Ke, Long Chen, Jian Jiang, Yueying Zhu, Jie Liu, Bengong Zhang, and Guo-Wei Wei. Machine learning methods for small data challenges in molecular science. Chem. Rev., 123(13):8736-8780, 2023b. +Alexandre Agm Duval, Victor Schmidt, Alex Hernandez-Garcia, Santiago Miret, Fragkiskos D Malliaros, Yoshua Bengio, and David Rolnick. Faenet: Frame averaging equivariant gnn for materials modeling. In ICML, pp. 9013-9033. PMLR, 2023. +Eberhard Engel and Reiner M Dreizler. Density functional theory. Theor. Math. Phys., pp. 351-399, 2011. + +Artem Fediai, Patrick Reiser, Jorge Enrique Olivares Pña, Pascal Friederich, and Wolfgang Wenzel. Accurate gw frontier orbital energies of 134 kilo molecules. Sci. Data, 10(1):581, 2023. +Shikun Feng, Yuyan Ni, Yanyan Lan, Zhi-Ming Ma, and Wei-Ying Ma. Fractional denoising for 3d molecular pre-training. In ICML, pp. 9938-9961. PMLR, 2023. +Johannes Gasteiger, Shankari Giri, Johannes T Marggraf, and Stephan Gunnemann. Fast and uncertainty-aware directional message passing for non-equilibrium molecules. arXiv preprint arXiv:2011.14115, 2020. +Johannes Gasteiger, Florian Becker, and Stephan Gunnemann. Gemnet: Universal directional graph neural networks for molecules. NeurIPS, 34:6790-6802, 2021. +Justin Gilmer, Samuel S Schoenholz, Patrick F Riley, Oriol Vinyals, and George E Dahl. Neural message passing for quantum chemistry. In ICML, 2017. +Rhys EA Goodall and Alpha A Lee. Predicting materials properties without crystal structure: Deep representation learning from stoichiometry. Nat. Commun., 11(1):1-9, 2020. +Mark S Graham, Walter HL Pinaya, Petru-Daniel Tudosiu, Parashkev Nachev, Sebastien Ourselin, and Jorge Cardoso. Denoising diffusion models for out-of-distribution detection. In CVPR, pp. 2947-2956, 2023. +Piotr S Gromski, Alon B Henson, Jarosław M Granda, and Leroy Cronin. How to explore chemical space using algorithms and automation. Nat. Rev. Chem., 3(2):119-128, 2019. +Jonathan Ho, Chitwan Sahara, William Chan, David J Fleet, Mohammad Norouzi, and Tim Salimans. Cascaded diffusion models for high fidelity image generation. *J. Mach. Learn. Res.*, 23(1): 2249-2281, 2022. +Johannes Hoja, Leonardo Medrano Sandonas, Brian G Ernst, Alvaro Vazquez-Mayagoitia, Robert A DiStasio Jr, and Alexandre Tkatchenko. Qm7-x, a comprehensive dataset of quantum-mechanical properties spanning the chemical space of small organic molecules. Sci. data, 8(1):43, 2021. +Scott A Hollingsworth and Ron O Dror. Molecular dynamics simulation for all. Neuron, 99(6): 1129-1143, 2018. +Chin-Wei Huang, Jae Hyun Lim, and Aaron C Courville. A variational perspective on diffusion-based generative models and score matching. *NeurIPS*, 34:22863–22876, 2021. +Eric Jang, Shixiang Gu, and Ben Poole. Categorical reparameterization with gumbel-softmax. arXiv preprint arXiv:1611.01144, 2016. +Dipendra Jha, Kamal Choudhary, Francesca Tavazza, Wei-keng Liao, Alok Choudhary, Carolyn Campbell, and Ankit Agrawal. Enhancing materials property prediction by leveraging computational and experimental data using deep transfer learning. Nat. Commun., 10(5316), 2019. doi: 10.1038/s41467-019-13297-w. +Wengong Jin, Regina Barzilay, and Tommi Jaakkola. Junction tree variational autoencoder for molecular graph generation. In ICML, pp. 2323-2332. PMLR, 2018. +Joonyoung F Joung, Minhi Han, Minseok Jeong, and Sungnam Park. Experimental database of optical properties of organic compounds. Sci. Data, 7(1):295, 2020. +Seojin Kim, Jaehyun Nam, Junsu Kim, Hankook Lee, Sungsoo Ahn, and Jinwoo Shin. Fragment-based multi-view molecular contrastive learning. In Workshop on "Machine Learning for Materials" ICLR, 2023. +Sunghwan Kim, Jie Chen, Tiejun Cheng, Asta Gindulyte, Jia He, Siqian He, Qingliang Li, Benjamin A Shoemaker, Paul A Thiessen, Bo Yu, et al. Pubchem 2019 update: improved access to chemical data. Nucleic Acids Res., 47(D1):D1102-D1109, 2019. +Diederik Kingma, Tim Salimans, Ben Poole, and Jonathan Ho. Variational diffusion models. NeurIPS, 34:21696-21707, 2021. +Diederik P Kingma. Auto-encoding variational bayes. arXiv preprint arXiv:1312.6114, 2013. + +Thomas N. Kipf and Max Welling. Semi-supervised classification with graph convolutional networks. *ICLR*, 2017. +Ondrej L Krivanek, Matthew F Chisholm, Valeria Nicolosi, Timothy J Pennycook, George J Corbin, Niklas Dellby, Matthew F Murfitt, Christopher S Own, Zoltan S Szilagyi, Mark P Oxley, et al. Atom-by-atom structural and chemical analysis by annular dark-field electron microscopy. Nature, 464(7288):571-574, 2010. +Kangming Li, Brian DeCost, Kamal Choudhary, Michael Greenwood, and Jason Hattrick-Simpers. A critical examination of robustness and generalizability of machine learning prediction of materials properties. Npj Comput. Mater., 9(1):55, 2023a. +Lujun Li, Yiming Zhao, Haibin Yu, Zhuo Wang, Yongjia Zhao, and Mingqi Jiang. An xgboost algorithm based on molecular structure and molecular specificity parameters for predicting gas adsorption. Langmuir, 39(19):6756-6766, 2023b. +Yi-Lun Liao and Tess Smidt. Equformer: Equivariant graph attention transformer for 3d atomistic graphs. arXiv preprint arXiv:2206.11990, 2022. +Tairan Liu, Misagh Naderi, Chris Alvin, Supratik Mukhopadhyay, and Michal Brylinski. Break down in order to build up: Decomposing small molecules for fragment-based drug design with emolfrag. J. Chem. Inf. Model., 57(4):627-631, 2017. +Yunchao Lance Liu, Yu Wang, Oanh Vu, Rocco Moretti, Bobby Bodenheimer, Jens Meiler, and Tyler Derr. Interpretable chirality-aware graph neural network for quantitative structure activity relationship modeling in drug discovery. In AAAI, volume 37, pp. 14356-14364, 2023. +Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization. *ICLR*, 2017. +Jianing Lu, Song Xia, Jieyu Lu, and Yingkai Zhang. Dataset construction to explore chemical space with 3d geometry and deep learning. J. Chem. Inf. Model., 61(3):1095-1104, 2021. +Chris J Maddison, Andriy Mnih, and Yee Whye Teh. The concrete distribution: A continuous relaxation of discrete random variables. arXiv preprint arXiv:1611.00712, 2016. +David Mendez, Anna Gaulton, A Patricia Bento, Jon Chambers, Marleen De Veij, Eloy Félix, María Paula Magariños, Juan F Mosquera, Prudence Mutowo, Michal Nowotka, et al. Chembl: towards direct deposition of bioassay data. *Nucleic Acids Res.*, 47(D1):D930-D940, 2019. +Nico JD Nagelkerke et al. A note on a general definition of the coefficient of determination. biometrika, 78(3):691-692, 1991. +Habib N Najm, Bert J Debusschere, Youssef M Marzouk, Steve Widmer, and OP Le Maitre. Uncertainty quantification in chemical systems. Int. J. Numer. Methods Eng., 80(6-7):789-814, 2009. +Maho Nakata and Tomomi Shimazaki. Pubchemqc project: a large-scale first-principles electronic structure database for data-driven chemistry. J. Chem. Inf. Model., 57(6):1300-1308, 2017. +Duy Minh Ho Nguyen, Nina Lukashina, Tai Nguyen, An Thai Le, Trungtin Nguyen, Nhat Ho, Jan Peters, Daniel Sonntag, Viktor Zaverkin, and Mathias Niepert. Structure-aware e(3)-invariant molecular conformer aggregation networks. In ICML, pp. 37736-37760, 2024. +Robert G Parr and Weitao Yang. Density-functional theory of the electronic structure of molecules. Annu. Rev. Phys. Chem., 46(1):701-728, 1995. +Raghunathan Ramakrishnan, Pavlo O. Dral, Matthias Rupp, and O. Anatole von Lilienfeld. Quantum chemistry structured and properties of 134 kilo molecules. Sci. Data, 1, 2014. +Lucia Reining. The gw approximation: content, successes and limitations. Wiley Interdiscip. Rev. Comput. Mol. Sci., 8(3):e1344, 2018. +Sereina Riniker and Gregory A Landrum. Better informed distance geometry: using what we know to improve conformation generation. J. Chem. Inf. Model., 55(12):2562-2574, 2015. +Howard Percy Robertson. The uncertainty principle. Phys. Rev., 34(1):163, 1929. + +David Rogers and Mathew Hahn. Extended-connectivity fingerprints. J. Chem. Inf. Model., 50(5): 742-754, 2010. +Johannes Schneider and Michail Vlachos. Scalable density-based clustering with quality guarantees using random projections. Data Min. Knowl. Discov., 31:972-1005, 2017. +Norbert Schuch and Frank Verstraete. Computational complexity of interacting electrons and fundamental limitations of density functional theory. Nat. Phys., 5(10):732-735, 2009. +Kristof Schütt, Pieter-Jan Kindermans, Huziel Enoc Sauceda Felix, Stefan Chmiela, Alexandre Tkatchenko, and Klaus-Robert Müller. Schnet: A continuous-filter convolutional neural network for modeling quantum interactions. NeurIPS, 30, 2017. +Kristof Schütt, Oliver Unke, and Michael Gastegger. Equivariant message passing for the prediction of tensorial properties and molecular spectra. In ICML, pp. 9377-9388. PMLR, 2021. +Kristof T Schütt, Huziel E Sauceda, P-J Kindermans, Alexandre Tkatchenko, and K-R Müller. Schnet-a deep learning architecture for molecules and materials. *Chem. Phys.*, 148(24):241722, 2018. +Yuning Shen, Julia E Borowski, Melissa A Hardy, Richmond Sarpong, Abigail G Doyle, and Tim Cernak. Automation and computer-assisted planning for chemical synthesis. Nat. Rev. Dis. Primers, 1(1):1-23, 2021. +Yunsheng Shi, Zhengjie Huang, Shikun Feng, Hui Zhong, Wenjing Wang, and Yu Sun. Masked label prediction: Unified message passing model for semi-supervised classification. In *IJCAI*, 2021. +Eunji Sim, Suhwan Song, and Kieron Burke. Quantifying density errors in dft. J. Phys. Chem. Lett., 9(22):6385-6392, 2018. +Narendra Singh, Rajarshi Guha, Marc A Giulianotti, Clemencia Pinilla, Richard A Houghten, and Jose L Medina-Franco. Chemoinformatic analysis of combinatorial libraries, drugs, natural products, and molecular libraries small molecule repository. J. Chem. Inf. Model., 49(4):1010-1024, 2009. +Yang Song, Jascha Sohl-Dickstein, Diederik P Kingma, Abhishek Kumar, Stefano Ermon, and Ben Poole. Score-based generative modeling through stochastic differential equations. arXiv preprint arXiv:2011.13456, 2020. +Kazu Suenaga and Masanori Koshino. Atom-by-atom spectroscopy at graphene edge. Nature, 468 (7327):1088-1090, 2010. +Shyam A Tailor, Felix Opolka, Pietro Lio, and Nicholas Donald Lane. Do we need anisotropic graph neural networks? In *ICLR*, 2021. +Yusuke Tashiro, Jiaming Song, Yang Song, and Stefano Ermon. Ccsi: Conditional score-based diffusion models for probabilistic time series imputation. NeurIPS, 34:24804-24816, 2021. +Clement Vignac, Igor Krawczuk, Antoine Siraudin, Bohan Wang, Volkan Cevher, and Pascal Frossard. Digress: Discrete denoising diffusion for graph generation. arXiv preprint arXiv:2209.14734, 2022. +Hongwei Wang, Weijiang Li, Xiaomeng Jin, Kyunghyun Cho, Heng Ji, Jiawei Han, and Martin D Burke. Chemical-reaction-aware molecule representation learning. *ICLR*, 2022. +Yusong Wang, Tong Wang, Shaoning Li, Xinheng He, Mingyu Li, Zun Wang, Nanning Zheng, Bin Shao, and Tie-Yan Liu. Enhancing geometric representations for molecules with equivariant vector-scalar interactive message passing. Nat. Commun., 15(1):313, 2024. +Oliver Wieder, Stefan Kohlbacher, Méline Kuenemann, Arthur Garon, Pierre Ducrot, Thomas Seidel, and Thierry Langer. A compact review of molecular property prediction with graph neural networks. *Drug Discovery Today: Technologies*, 37:1-12, 2020. +Daniel S Wigh, Jonathan M Goodman, and Alexei A Lapkin. A review of molecular representation in the age of machine learning. Wiley Interdiscip. Rev. Comput. Mol. Sci., 12(5):e1603, 2022. + +Fang Wu and Stan Z Li. Diffmd: a geometric diffusion model for molecular dynamics simulations. In AAAI, volume 37, pp. 5321-5329, 2023. +Kedi Wu and Guo-Wei Wei. Quantitative toxicity prediction using topology based multitask deep neural networks. J. Chem. Inf. Model., 58(2):520-531, 2018. +Zhenqin Wu, Bharath Ramsundar, Evan N Feinberg, Joseph Gomes, Caleb Genisses, Aneesh S Pappu, Karl Leswing, and Vijay Pande. Moleculenet: a benchmark for molecular machine learning. Chem. Sci., 9(2):513-530, 2018. +Zhaoping Xiong, Dingyan Wang, Xiaohong Liu, Feisheng Zhong, Xiaozhe Wan, Xutong Li, Zhaojun Li, Xiaomin Luo, Kaixian Chen, Hualiang Jiang, et al. Pushing the boundaries of molecular representation for drug discovery with the graph attention mechanism. J. Med. Chem., 63(16): 8749-8760, 2019. +Keyulu Xu, Weihua Hu, Jure Leskovec, and Stefanie Jegelka. How powerful are graph neural networks? ICLR, 2018. +Riqiang Yan and Robert Vassar. Targeting the $\beta$ secretase bace1 for alzheimer's disease therapy. Lancet Neurol., 13(3):319-329, 2014. +Kevin Yang, Kyle Swanson, Wengong Jin, Connor Coley, Philipp Eiden, Hua Gao, Angel Guzman-Perez, Timothy Hopper, Brian Kelley, Miriam Mathea, et al. Analyzing learned molecular representations for property prediction. J. Chem. Inf. Model., 59(8):3370-3388, 2019. +Shuwen Yang, Ziyao Li, Guojie Song, and Lingsheng Cai. Deep molecular representation learning via fusing physical and chemical information. NeurIPS, 34:16346-16357, 2021. +Zhaoning Yu and Hongyang Gao. Molecular representation learning via heterogeneous motif graph neural networks. In ICML, pp. 25581-25594. PMLR, 2022. +Ye Yuan, Jiaming Song, Umar Iqbal, Arash Vahdat, and Jan Kautz. Physdiff: Physics-guided human motion diffusion model. In CVPR, pp. 16010-16021, 2023. +Xuan Zang, Xianbing Zhao, and Buzhou Tang. Hierarchical molecular graph self-supervised learning for property prediction. Commun. Chem., 6(1):34, 2023. +Viktor Zaverkin, David Holzmuller, Luca Bonfirraro, and Johannes Kästner. Transfer learning for chemically accurate interatomic neural network potentials. Phys. Chem. Chem. Phys., 25(7): 5383-5396, 2023. +Lukas Zbinden, Lars Doorenbos, Theodoros Pissas, Adrian Thomas Huber, Raphael Sznitman, and Pablo Márquez-Neila. Stochastic segmentation with conditional categorical diffusion models. In CVPR, pp. 1119-1129, 2023. +Claudio Zeni, Robert Pinsler, Daniel Zügner, Andrew Fowler, Matthew Horton, Xiang Fu, Sasha Shysheya, Jonathan Crabbé, Lixin Sun, Jake Smith, et al. Mattergen: a generative model for inorganic materials design. arXiv preprint arXiv:2312.03687, 2023. +Lvmin Zhang, Anyi Rao, and Maneesh Agrawala. Adding conditional control to text-to-image diffusion models. In CVPR, pp. 3836-3847, 2023. +Zaixi Zhang, Qi Liu, Hao Wang, Chengqiang Lu, and Chee-Kong Lee. Motif-based graph self-supervised learning for molecular property prediction. NeurIPS, 34:15870-15882, 2021. + +# A SAMPLING METHOD FOR PARAMETERIZED BERNOULLI DISTRIBUTION + +Unlike the conventional diffusion models, DELID assumes the parameterized Bernoulli distribution on $\mathbf{A}_0$ and $\mathbf{A}_T$ because each element of them should be in the binary domain $\{0,1\}$ . Hence, we need to generate sample from reparameterized Bernoulli distribution. By the existing work on categorical reparameterization (Jang et al., 2016; Maddison et al., 2016), we can sample a random variable following the Bernoulli distribution under the reparameterized distribution as: + +$$ +\mathbf {z} = \sigma (\log \epsilon - \log (1 - \epsilon) + \log \phi (\mathbf {x}) - \log (1 - \phi (\mathbf {x}))), \tag {11} +$$ + +where $\sigma$ is the sigmoid function, $\phi \in (0,1)$ is a trainable shape parameter of Bernoulli distribution, and $\epsilon \sim U(0,1)$ is a random number from an uniform distribution $U(0,1)$ . + +# B DERIVATION OF THE CONDITIONAL DIFFUSION PROCESS ON S + +In this section, we present a detailed derivation of the conditional diffusion process on $\mathbf{s}$ . Since the second term $p(\mathbf{s}|G)$ in Eq. (2) is not directly computable, we derive the lower bound of $\log p(\mathbf{s}|G)$ based on a diffusion process started from $\mathbf{s}_T$ as follows. + +$$ +\log p (\mathbf {s} | G) = \log p \left(\mathbf {s} _ {T} | G\right) + \sum_ {t = 1} ^ {T} \log p \left(\mathbf {s} _ {t - 1} \mid \mathbf {s} _ {t}\right) \tag {12} +$$ + +We can marginalize the second term in Eq. (12) for $G_{t-1}$ and calculate its lower bound as follows. + +$$ +\begin{array}{l} \sum_ {t = 1} ^ {T} \log p (\mathbf {s} _ {t - 1} | \mathbf {s} _ {t}) = \sum_ {t = 1} ^ {T} \log \left(\int_ {G _ {t - 1}} p (\mathbf {s} _ {t - 1} | \mathbf {s} _ {t}, G _ {t - 1}) p (G _ {t - 1} | \mathbf {s} _ {t}) d G _ {t - 1}\right) \\ = \sum_ {t = 1} ^ {T} \log \left\{\int_ {G _ {t - 1}} \left(\frac {p \left(\mathbf {s} _ {t - 1} \mid \mathbf {s} _ {t} , G _ {t - 1}\right) p \left(G _ {t - 1} \mid \mathbf {s} _ {t}\right)}{q \left(G _ {t - 1} \mid G _ {t}\right)}\right) q \left(G _ {t - 1} \mid G _ {t}\right) d G _ {t - 1} \right\} \\ \geq \sum_ {t = 1} ^ {T} \int_ {G _ {t - 1}} \log \left(\frac {p (\mathbf {s} _ {t - 1} | \mathbf {s} _ {t} , G _ {t - 1}) p (G _ {t - 1} | \mathbf {s} _ {t})}{q (G _ {t - 1} | G _ {t})}\right) q (G _ {t - 1} | G _ {t}) d G _ {t - 1} \\ = \sum_ {t = 1} ^ {T} E _ {q \left(G _ {t - 1} \mid G _ {t}\right)} \left[ \log p \left(\mathbf {s} _ {t - 1} \mid \mathbf {s} _ {t}, G _ {t - 1}\right) \right] - \sum_ {t = 1} ^ {T} D _ {\mathrm {K L}} \left(q \left(G _ {t - 1} \mid G _ {t}\right) \| p \left(G _ {t - 1} \mid \mathbf {s} _ {t}\right)\right). \tag {13} \\ \end{array} +$$ + +Finally, the lower bound of $\log p(\mathbf{s}|G)$ is given by: + +$$ +\begin{array}{l} \log p (\mathbf {s} | G) \geq \log p (\mathbf {s} _ {T} | G) + \sum_ {t = 1} ^ {T} E _ {q (G _ {t - 1} | G _ {t})} [ \log p (\mathbf {s} _ {t - 1} | \mathbf {s} _ {t}, G _ {t - 1}) ] \\ - \sum_ {t = 1} ^ {T} D _ {\mathrm {K L}} \left(q \left(G _ {t - 1} \mid G _ {t}\right) \| p \left(G _ {t - 1} \mid \mathbf {s} _ {t}\right)\right). \tag {14} \\ \end{array} +$$ + +If $G_{T}$ is generated through the complete graph decomposition, we also rewrite the lower bound of $\log p(\mathbf{s}|G)$ as follows. + +$$ +\begin{array}{l} \log p (\mathbf {s} | G) \geq \log p (\mathbf {s} _ {T} | \mathbf {A} _ {0}; \mathbf {R} _ {0}) + \sum_ {t = 1} ^ {T} E _ {q \left(\mathbf {A} _ {t - 1} | \mathbf {A} _ {t}; \mathbf {R} _ {0}\right)} [ \log p (\mathbf {s} _ {t - 1} | \mathbf {s} _ {t}, \mathbf {A} _ {t - 1}; \mathbf {R} _ {0}) ] \\ - \sum_ {t = 1} ^ {T} D _ {\mathrm {K L}} \left(q \left(\mathbf {A} _ {t - 1} \mid \mathbf {A} _ {t}; \mathbf {R} _ {0}\right) \| p \left(\mathbf {A} _ {t - 1} \mid \mathbf {s} _ {t}; \mathbf {R} _ {0}\right)\right). \tag {15} \\ \end{array} +$$ + +# C ALGORITHMIC DESCRIPTION OF DELID + +Algorithm 1 shows an algorithmic description of the forward and training processes of DELID. + +# D STATISTICS OF THE BENCHMARK EXPERIMENTAL DATASETS + +Table 4 shows the statistics and target molecular properties of the nine benchmark molecular datasets used for the experimental evaluations. + +Algorithm 1 Training Process of DELID +Input: $\mathcal{D}_{train}$ : a training dataset; + $\mathcal{D}_{qm}$ : a dataset for the information retrieval; + $\eta$ : an initial learning rate of the optimizer; +Output: $\theta^{*}$ : optimized model parameters; +repeat +for $(G,y)\in \mathcal{D}_{train}$ do +// Decomposition of an atom-level molecular graph. + $\mathcal{F}_1,\mathcal{F}_2,\dots,\mathcal{F}_K\gets \text{EFGDecomposition}(G)$ +// Information retrieval to obtain $\mathbf{s}_T$ +for $k = 1;k\leq K$ do + $i^{*} = \arg \max_{i\in \{1,2,\ldots ,|\mathcal{D}_{qm}|\}}\phi (\mathcal{F}_k,G_{qm,i})$ $\mathbf{Q}_k = \mathbf{s}_{qm,i^*}$ +end for +// Model parameter optimization. +Calculate $J_{\theta} = \log p_{\theta}(y,\mathbf{s},G)$ by Eqs. (3), (5), (8). + $\theta \leftarrow \theta +\eta \nabla J_{\theta}$ +end for +until $\theta$ is converged + +Table 4: Statistics and target molecular properties of the benchmark molecular datasets that contain the atom-level molecular structures and their experimentally observed target properties. + +
Application CategoryDatasetTarget Molecular Property# of MoleculesAverage Number of Atoms
PhysicochemistryLipop (Mendez et al., 2019)Lipophilicity4,20048.51
ESOL (Delaney, 2004)Aqueous solubility1,12825.64
ADMET (Dong et al., 2018)Aqueous solubility4,80126.76
ToxicityIGC50 (Wu & Wei, 2018)Tetrahymenapyriformis toxicity1,79119.29
LC50 (Wu & Wei, 2018)Fathead minnow toxicity82222.32
LD50 (Wu & Wei, 2018)Oral rat toxicity7,41231.30
PharmacokineticsLMC-H (Mendez et al., 2019)Liver microsomal clearance in human5,34754.53
OpticsCH-DC (Joung et al., 2020)Absorption max in Dichloromethane2,42928.95
CH-AC (Joung et al., 2020)Absorption max in Acetonitrile1,78129.71
+ +# E COMPETITOR METHODS + +In the experiments, we compared the prediction capabilities of DELID with a baseline tree method and ten state-of-the-art GNNs, which have been widely used in chemical applications. The competitor methods are briefly described as: + +- XGB-Mor: XGBoost (XGB) (Chen & Guestrin, 2016) is a tree-based gradient boosting model, and it showed state-of-the-art performances in various scientific applications. For the experimental evaluations, we generated XGB-Mor that predicts the target molecular properties for the Morgan (Mor) fingerprints of the atom-level molecular structures (Rogers & Hahn, 2010). +- XGB-FC: We generated XGB-FC by combining XGB with the functional-class (FC) fingerprints of the input molecules (Rogers & Hahn, 2010). The FC fingerprint represents the atom-level molecular structures based on their functional substructures and atoms. +- XGB-MK: We also generated XGB-MK based on the MACCS Key (MK) fingerprint (Singh et al., 2009), which is one of the most commonly used molecular representations. MACCS key encodes the atom-level molecular structures based on 166-bits binary patterns. +- GIN (Xu et al., 2018): Graph isomorphism network (GIN) is an effective framework for graph representation learning based on graph isomorphism test. +- EGCN (Tailor et al., 2021): Efficient graph convolution (EGC) is an isotropic GNN based on adaptive filters and aggregation fusion in the node aggregation phase. EGC outperformed common anisotropic GNNs, such as graph attention networks, on benchmark datasets. + +- MPNN (Gilmer et al., 2017): Message passing neural network is a unified framework of node and edge convolution methods for learning molecular representations on quantum chemistry. +- D-MPNN (Yang et al., 2019): Directed MPNN (D-MPNN) is an extension of the original MPNN for the directed molecular graphs. It employs a message passing scheme via directed edges (bonds). +- UniMP (Shi et al., 2021): Unified message passing (UniMP) is a transformer-based GNN. UniMP showed state-of-the-art prediction capabilities by incorporating feature and label propagation at both training and inference time based on the transformer architecture. +- AttFP (Xiong et al., 2019): AttFP is a network that uses a graph self-attention mechanism to learn molecular representations for drug discovery. AttFP was designed to learn non-local intra-molecular interactions to extract informative molecular representations. +- SchNet (Schütt et al., 2017): It is a convolutional neural network for learning molecular representations based on quantum interactions in molecules. It has been widely used as a baseline model in various chemical applications (Schütt et al., 2017; 2018). +- DimeNet++ (Gasteiger et al., 2020): DimeNet aims to learn molecular representations based on the directional embedding that extracts inter-atomic 3D geometry. DimNet++ is an advanced version of DimeNet to learn the molecular representations based on the uncertainty-aware directional embedding. +- PhysChem (Yang et al., 2021): PhysChem is a neural architecture that learns molecular representations via fusing the information about the inter-atomic geometry and message passing through chemical bonds. PhysChem showed state-of-the-art prediction accuracy on various simulated molecular datasets. +- M3GNet (Chen & Ong, 2022): Graph neural networks with three-body interactions (M3GNet) is a neural network to learn molecular representations based on the three-body inter-atomic interactions. Although M3GNet requires large computational costs to calculate the three-body interactions, it showed state-of-the-art prediction accuracy on various molecular and materials datasets. +- FAENet (Duval et al., 2023): Frame averaging equivariant GNN (FAENet) is simple and fast GNN optimized for stochastic frame-averaging. FAENet can learn molecular representations by processing atom-relative positions with full flexibility without symmetry-preserving requirements. +- ConAN (Nguyen et al., 2024): Conformer aggregation network (ConAN) is an E(3)-invariant molecular conformer aggregation network to learn molecular representations based on ensembles methods on molecular conformers. It showed state-of-the-art prediction accuracy on several molecular datasets by employing a 2D-3D aggregation mechanism based on a differentiable solver for the Fused Gromov-Wasserstein Barycenter problem. + +# F IMPLEMENTATION DETAILS AND HYPERPARAMETER SETTINGS + +We followed a common graph-based descriptor to convert an atom-level molecular structure into an attributed graph $G = (\mathcal{V},\mathcal{U},\mathbf{A},\mathbf{X},\mathbf{R})$ , where $\mathcal{V}$ is a set of nodes (i.e., atoms), $\mathcal{U}$ is a set of edges (i.e., chemical bonds), $\mathbf{A} \in \{0,1\}^{|\mathcal{V}| \times |\mathcal{V}|}$ is an adjacency matrix, $\mathbf{X} \in \mathbb{R}^{|\mathcal{V}| \times d}$ is a $d$ -dimensional node-feature matrix, and $\mathbf{R} \in \mathbb{R}^{|\mathcal{U}| \times r}$ is an $r$ -dimensional edge-feature matrix (Wieder et al., 2020). We used the pre-defined 200-dimensional atomic embeddings (Goodall & Lee, 2020) to construct the node-feature matrix $\mathbf{X}$ . We defined the edge features as an one-hot encoding of 22 bond types (Wieder et al., 2020; Chen et al., 2019). The pre-defined bond types were provided in RDKit1, which is a popular cheminformatics library in computational chemistry. + +The model parameters of DELID were optimized by the AdamW optimizer (Loshchilov & Hutter, 2017) for all experiments in this paper. The initial learning rate and $L_{2}$ regularization coefficients were fixed to 5e-4 and 5e-6 for all benchmark datasets, respectively. Batch size is also fixed to 64 for all benchmark datasets. The GNN-based embedding networks were constructed by two node + +Table 5: Electron-level features used for the retrieval process of DELID on the QM9 dataset. + +
CategoryFeature NameUnit
Energy-related featureHOMOeV
LUMOeV
HOMO-LUMO gapeV
Zero point vibrational energyeV
Internal energy at 0 KeV
Internal energy at 298.15 KeV
Enthalpy at 298.15 KeV
Free energy at 298.15 KeV
Heat capacity at 298.15 KeV
Polarity-related featureDipole momentDebye
Isotropic polarizabilityBohr3
Electronic spatial extentBohr2
Other featuresRotational constant AGHz
Rotational constant BGHz
Rotational constant CGHz
+ +aggregation layers and one dense layer with 64 output channels. DELID and experiment scripts were implemented with PyTorch $2.0.0 + \mathrm{cu}117^{2}$ and PyTorch Geometric $2.3.1^{3}$ under Python 3.9. + +In the implementation of the information retrieval on $\mathbf{s}$ , we used a subset of the QM9 dataset (Ramakrishnan et al., 2014) containing the molecules of maximum six atoms as an external quantum mechanics dataset $\mathcal{D}_{qm}$ . We used 15 electron-level features in the QM9 dataset to construct the feature matrix of the fragmented electron-level information $\mathbf{S}$ . The selected 15 electron-level features of the QM9 dataset are shown in Table 5. + +# G PREDICTION ACCURACY FOR DIFFERENT DECOMPOSITION METHODS + +DELID employs the EFG-based decomposition method for generating the decomposed substructures $G_{T}$ from the input molecule $G$ . Table 6 shows the $R^2$ -scores of two variants of DELID that use two well-known molecular decomposition methods: BRICS (Liu et al., 2017) decomposition and junction tree method (Jin et al., 2018). Although the $R^2$ -scores of DELID were not significantly changed for the implementations of the molecular decomposition methods, DELID with the EFG-based decomposition showed higher $R^2$ -scores for most benchmark experimental datasets. + +Table 6: The $R^2$ -scores of DELID for different molecular decomposition methods. + +
Decomposition MethodLipopESOLADMETIGC50LD50LC50LMC-HCH-DCCH-AC
BRICS (Liu et al., 2017)0.7630.9080.8110.8240.5160.6350.5150.8650.863
(0.018)(0.008)(0.050)(0.008)(0.031)(0.058)(0.040)(0.047)(0.031)
Junction Tree (Jin et al., 2018)0.7700.9050.8080.8230.5180.6220.5180.8660.867
(0.012)(0.013)(0.033)(0.005)(0.023)(0.057)(0.038)(0.053)(0.031)
EFG (Lu et al., 2021)0.7820.9120.8340.8440.5660.6440.5320.8860.885
(0.013)(0.014)(0.042)(0.006)(0.024)(0.068)(0.048)(0.035)(0.023)
+ +# H PREDICTION ACCURACY ON LARGE SIMULATED DATASETS + +Although the calculated physical and chemical properties of the molecules are not reliable in real-world complex molecules, we conducted an experiment of predicting molecular properties on a large simulated dataset to evaluate the prediction capabilities of DELID on large molecular datasets. For the evaluation, we used the QM-GW dataset (Fediai et al., 2023) containing the GW-level HOMO-LUMO gaps of 133,885 molecules. The GW method (Reining, 2018) is an approximation method for the density functional theory calculations. The GW method is computationally expensive but accurate in calculating the molecular properties related to the electronic energies. Thus, the machine learning methods should be able to learn the GW-level calculations on a huge number of molecules in order to build an accurate prediction model on the QM-GW dataset. + +Table 7: The $R^2$ -scores of DELID and the competitor 2D GNNs on the QM-GW dataset containing 13k molecules and their calculated properties. + +
GINEGCNMPNND-MPNNUniMPAttFPDELID
0.8630.8800.8800.8790.8780.8620.885
(0.008)(0.004)(0.005)(0.003)(0.006)(0.002)(0.003)
+ +Table 7 shows the $R^2$ -scores of DELID and the competitor methods on the QM-GW dataset (Fediai et al., 2023) containing the GW-level HOMO-LUMO gaps of 133,885 molecules. In this experiment, DELID and all competitor 2D GNNs easily achieved the $R^2$ -scores greater than 0.85 because the simulated datasets are generated by the simple and consistent methods. In particular, although some GNNs failed to predict the molecular properties on the experimental datasets, they also achieved the $R^2$ -scores greater than 0.85 on the large simulated dataset. This result demonstrates our main argument that the prediction capabilities of the machine learning models on the simulated datasets do not tell us the actual prediction capabilities of the machine learning models in real-world chemical applications. + +# I PREDICTION ACCURACY IN CLASSIFICATION TASKS + +In the experiments, we focused on evaluating the prediction performances of the machine learning methods in regression problems due to the following two reasons: 1) The regression problems is a generalized problem of the classification problem, i.e., the classification problem is a specific case of the regression problem, where the number of possible classes in the target variable is fixed to a countable natural number. 2) Most classification problems in physical and chemical applications are fundamentally the downstream tasks of the regression problem. + +Table 8: The F1-scores of DELID and the competitor 2D GNNs in the classification tasks of the BACE and BBBP datasets. + +
DatasetGINEGCNMPNND-MPNNCGCNNUniMPAttFPDELID
BACE0.7770.7650.7710.7690.7700.7730.7730.805
(0.019)(0.026)(0.027)(0.027)(0.024)(0.017)(0.013)(0.014)
BBBP0.9080.9110.8970.8940.8940.9120.9050.924
(0.012)(0.009)(0.020)(0.014)(0.009)(0.010)(0.008)(0.004)
+ +There is no implementation issue of DELID in the classification tasks. Eq. (2) is generally applicable to both regression and classification tasks. In this experiment, we measured the F1-scores of DELID and the competitor 2D-GNNs in the classification tasks. We used two experimentally collected molecular datasets called BACE (Yan & Vassar, 2014) and BBBP (Wu et al., 2018). The BACE and BBBP dataset contain experimentally measured biological activities of 1,513 and 2,050 molecules, respectively. Table 8 shows the measured F1-scores on the BACE and BBBP datasets, and DELID still showed the highest prediction accuracy. + +# J PREDICTION ACCURACY FOR DIFFERENT MOLECULAR SCALES OF EXTERNAL CALCULATION DATASETS + +We measured the $R^2$ -scores of DELID for different $\mathcal{D}_{qm}$ containing different sizes of small molecules. We generated $\mathcal{D}_{qm,c}$ for $c = \{4,5,6,7\}$ , where $c$ is the maximum number of atoms. For example, $\mathcal{D}_{qm,c}$ is constructed from the QM9 dataset by collecting small molecules containing the atoms less than or equal to $c$ . Table 9 presents the measured $R^2$ -scores of DELID for different values of $c$ . DELID showed consistent $R^2$ -scores for different sizes of the molecules in $\mathcal{D}_{qm}$ because the input complex and large molecules are already decomposed into the small substructures by the EFG-based decomposition. This result shows that DELID is robust to the volume of $\mathcal{D}_{qm}$ required for the information retrieval. + +Table 9: The $R^2$ -scores of DELID on the benchmark molecular datasets for different $\mathcal{D}_{qm}$ containing different sizes of small molecules. + +
Max. Num. Atoms (= c)Num. Molecules in DqmLipopESOLADMETIGC50LD50LC50LMC-HCH-DCCH-AC
c=4450.780 (0.010)0.921 (0.009)0.843 (0.029)0.863 (0.004)0.565 (0.018)0.636 (0.093)0.533 (0.020)0.876 (0.012)0.841 (0.066)
c=51750.776 (0.013)0.912 (0.010)0.680 (0.366)0.848 (0.010)0.586 (0.022)0.641 (0.071)0.538 (0.041)0.873 (0.015)0.880 (0.014)
c=66820.782 (0.013)0.912 (0.014)0.834 (0.042)0.844 (0.006)0.566 (0.024)0.644 (0.068)0.532 (0.048)0.886 (0.035)0.885 (0.023)
c=73,9900.781 (0.016)0.916 (0.012)0.843 (0.023)0.844 (0.015)0.574 (0.020)0.658 (0.061)0.530 (0.033)0.872 (0.022)0.882 (0.012)
+ +# K EXECUTION TIME OF THE TRAINING AND INFERENCE PROCESSES OF DELID + +Compared to the conventional GNNs, DELID requires additional computation to execute the information retrieval and the self-supervised diffusion. In this experiment, we compared the execution time of DELID with those of the competitor GNNs. We separated the entire execution process of machine learning methods into data pre-processing, training, and inference steps. We measured the entire execution time of the data pre-processing and inference processes, whereas we measured the execution time of one epoch for the training process. We compared the execution time of GIN, MPNN, UniMP, SchNet, PhysChem, and DELID, as shown in Table 10. The execution time was measured in a machine with Intel i9-12900K CPU, 128G memory, and NVIDIA GeForce RTX 3090 Ti GPU. + +Table 10: Execution time of DELID and the competitor methods on the Lipop dataset. The execution time was measured in seconds. + +
CategoryMethodData Pre-processingTrainingInferenceTotal
3D-GNNSchNet119.9371,109.3500.1721,229.459
PhysChem59.453109,271.54310.289109,341.285
2D-GNNGIN3.109152.5040.031155.644
MPNN3.109429.5240.062432.695
AttFP3.109125.2730.031128.413
DELID50.875562.5490.124613.548
+ +The 2D-GNNs were the most efficient among the competitor methods and DELID because they do not use additional molecular descriptors and complex node aggregation mechanisms. In contrast, the 3D-GNNs required the most execution time. In particular, the total execution time of PhysmChem was 109,341 seconds, which is 178 times greater than the total execution time of DELID. Although DELID requires more execution time in the data pre-processing and the conditional diffusion process, it showed comparable execution time with vanilla MPNN, which was employed to implement the atom-level embedding network of DELID. + +# L EMBEDDING RESULTS AND MOLECULAR WEIGHT + +We visualized the electron-aware representation s for the molecular weight, which can be one of the underlying variable determining several target molecular properties. We plotted s for the molecular weight on the Lipop, ESOL, and ADMET datasets, where the target molecular properties are related to the molecular weight. As shown in Fig. 5, even though the molecular weight was not provided for training DELID, DELID generated s that roughly describes the underlying molecular weight. + +# M MEAN ABSOLUTE ERRORS IN MOLECULAR PROPERTY PREDICTION + +Table 11 shows maen absolute error (MAE) of the competitor methods and DELID in predicting molecular properties on the experimental molecular datasets. The evaluation results of DELID were consistent with the evaluation reulsts in Talbe 1. + +![](images/1e4d79af18ad9d1b3b4e7f9e722195a6ee292f66f77dbad428a9361ce9297c58.jpg) +Figure 5: Visualization of the electron-aware representation s for the underlying molecular weight. + +![](images/25aa470e6d8b25af351c9fa27549d749cafd5ef456a03e67c62320e3a7f61030.jpg) + +![](images/76e90f6776d1a2c804c5224ea8323ca32935c3b09e9c798d8058810518a47e8b.jpg) + +Table 11: MAEs of the competitor methods and DELID in predicting molecular properties. + +
MethodLipopESOLADMETIGC50LD50LC50LMC-HCH-DCCH-AC
GIN0.456(0.010)0.597(0.042)0.628(0.026)0.330(0.020)0.443(0.007)0.717(0.029)0.349(0.006)37.268(2.818)33.125(2.835)
EGCN0.447(0.014)0.594(0.045)0.602(0.022)0.331(0.021)0.446(0.009)0.722(0.050)0.337(0.008)33.469(1.462)34.578(2.876)
MPNN0.434(0.012)0.603(0.048)0.649(0.022)0.351(0.004)0.460(0.007)0.704(0.073)0.342(0.007)31.257(1.570)32.765(2.870)
D-MPNN0.422(0.011)0.507(0.031)0.636(0.019)0.327(0.018)0.472(0.010)0.645(0.056)3.332(0.009)40.549(2.524)33.574(3.042)
UniMP0.453(0.020)0.609(0.044)0.619(0.019)0.335(0.020)0.450(0.005)0.707(0.051)0.352(0.010)38.546(2.547)35.896(3.204)
AttFP0.466(0.006)0.441(0.034)0.577(0.024)0.315(0.011)0.472(0.004)0.635(0.062)0.335(0.006)54.234(3.334)46.211(3.303)
DELID0.395(0.011)0.425(0.027)0.562(0.028)0.279(0.004)0.443(0.007)0.592(0.037)0.310(0.007)20.430(2.203)19.503(1.860)
+ +# N DIFFUSION PROCESS ON S IN UNSUPERVISED SETTINGS + +In our problem setting in Eq. (2), the entire model parameters of DELID is optimized to maximize $\log p(y, \mathbf{s}, G)$ . For this reason, although the diffusion model on $\mathbf{s}$ is trained by the self-supervised scheme guided by the diffusion model on $G$ , the embedding results on $\mathbf{s}$ are finally affected by the target molecular property $y$ . To investigate the representation learning capabilities of DELID in unsupervised settings, we re-implemented DELID to maximize $\log p(\mathbf{s}, G)$ by removing the prediction layers in DELID and measured the Wasserstein distance between the data distributions of the original molecular graph $G$ and the diffusion output $\mathbf{s}_0$ on the ESOL dataset. $G$ was projected into the vector space through randomly initialized GNNs to preserve the data distribution of the original molecular graphs Schneider & Vlachos (2017); Bingham & Mannila (2001). + +![](images/30ab137562762434583821a2ec3b514d5926717ff5f4fffb43e6c82c9bc0d77c.jpg) +Figure 6: Wasserstein distance between the data distributions of $G$ and $\mathbf{s}_0$ on the ESOL dataset. + +As shown Fig. 6, the Wasserstein distance between $G$ and $\mathbf{s}_0$ consistently decreased as the diffusion model on $\mathbf{s}$ was optimized. This result shows that the diffusion models of DELID worked well in the unsupervised setting. Furthermore, this result is worth noting because the diffusion model on $\mathbf{s}$ successfully learned the data distribution of $G$ with only the fragmented information about decomposed substructures and their electron-level features. + +Table 12: The $R^2$ -scores of the competitor methods, DELID, and NN-DELID on benchmark experimental molecular datasets. + +
Input TypeMethodLipopESOLADMETIGC50LD50LC50LMC-HCH-DCCH-AC
Molecular FingerprintXGB-Mor0.5310.6590.7170.6210.3900.4970.505N/RN/R
(0.024)(0.045)(0.021)(0.040)(0.133)(0.016)(0.018)
XGB-FC0.5780.6860.7200.6280.5010.5190.503N/RN/R
(0.018)(0.052)(0.009)(0.023)(0.052)(0.025)(0.007)
XGB-MK0.5420.7640.7610.6800.4860.5260.471N/RN/R
(0.041)(0.047)(0.020)(0.037)(0.112)(0.021)(0.019)
3D Molecular GraphSchNet0.6670.8810.8340.7650.5270.4670.4560.7130.702
(0.021)(0.026)(0.012)(0.034)(0.062)(0.025)(0.024)(0.050)(0.037)
DimeNet++N/R0.878N/R0.7790.541N/A0.352N/AN/A
(0.025)(0.019)(0.045)(0.101)
PhysChem0.6940.848N/A0.8140.511N/AN/AN/AN/A
(0.024)(0.032)(0.017)(0.053)
M3GNetN/A0.857N/A0.6970.531N/AN/AN/AN/A
(0.025)(0.029)(0.034)
FAENet0.6700.8690.7880.7080.4740.5280.4370.4370.310
(0.036)(0.013)(0.020)(0.015)(0.020)(0.094)(0.025)(0.132)(0.136)
ConAN0.7380.9090.8450.8190.5310.5720.4660.4050.388
(0.018)(0.015)(0.028)(0.007)(0.041)(0.070)(0.028)(0.108)(0.115)
2D Molecular GraphGIN0.7090.8080.8070.7920.5450.5250.4720.242N/R
(0.019)(0.017)(0.023)(0.015)(0.016)(0.080)(0.033)(0.010)
EGCN0.7160.8220.8140.7770.5500.5030.4970.226N/R
(0.021)(0.029)(0.021)(0.020)(0.018)(0.080)(0.038)(0.086)
MPNN0.7270.8100.8010.7640.5020.4870.4610.385N/R
(0.018)(0.042)(0.028)(0.027)(0.022)(0.108)(0.032)(0.023)
D-MPNN0.7260.8790.8200.7870.5210.5660.494N/RN/R
(0.037)(0.013)(0.018)(0.008)(0.011)(0.098)(0.011)
UniMP0.7180.8100.8170.7560.5120.5310.4780.166N/R
(0.010)(0.036)(0.018)(0.040)(0.026)(0.078)(0.026)(0.051)
AttFP0.7100.9090.8510.8070.5130.6420.4560.4410.296
(0.021)(0.018)(0.027)(0.013)(0.016)(0.079)(0.031)(0.099)(0.370)
NN-DELID0.7730.9080.8230.8370.5740.6340.5170.8290.860
DELID(0.019)(0.009)(0.027)(0.010)(0.026)(0.072)(0.031)(0.057)(0.027)
0.7820.9120.8340.8440.5660.6440.5320.8860.885
(0.013)(0.014)(0.042)(0.006)(0.024)(0.068)(0.048)(0.035)(0.023)
+ +# O REPRESENTATION LEARNING CAPABILITIES OF DELID IN UNSUPERVISED SETTINGS + +DELID is designed to learn electron-aware molecular representations for given molecular structures $G$ and target molecular properties $y$ by maximizing $\log p(y, \mathbf{s}, G)$ , as described in Eq. (2). However, the diffusion models on $G$ and $\mathbf{s}$ can be trained without $y$ by maximizing $\log p(\mathbf{s}, G)$ instead of $\log p(y, \mathbf{s}, G)$ . In other words, we can train the diffusion models with a fully unsupervised setting and build a prediction model by transferring the diffusion models into the downstream prediction task. In this experiment, we measured the $\tilde{R}^2$ -scores of a fully connected neural network (FCNN) that employs the molecular representation of the unsupervised DELID as its input data in molecular property prediction. We denote the FCNN following DELID by NN-DELID. + +Table 12 shows the $R^2$ -scores of the competitor methods and NN-DELID. In this experiment, NN-DELID also outperformed the competitor methods for most benchmark datasets. However, the $R^2$ -scores of DELID were usually higher than those of NN-DELID. + +# P LIMITATIONS AND FUTURE WORK + +Since the self-supervised diffusion processes of DELID start from the decomposed molecular substructures and their electron-level features, the performances of DELID are basically dependent on the molecular decomposition methods and the external calculation datasets. In particular, as shown in Table 2, the input electron-level features can directly affect the prediction accuracy of the final prediction models. However, we did not develop a molecular decomposition method and calculation dataset specialized in the self-diffusion processes of DELID. For this reason, the improvements by DLIED are essentially limited to the performances of the EFG-based decomposition method and the QM9 dataset. Therefore, a molecular decomposition and calculation dataset specialized in DELID need to be considered as future work. \ No newline at end of file diff --git a/ICLR/2025/Self-Supervised Diffusion Models for Electron-Aware Molecular Representation Learning/images.zip b/ICLR/2025/Self-Supervised Diffusion Models for Electron-Aware Molecular Representation Learning/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..6ae780187dab8100c59c1d989316f76d0daee2c4 --- /dev/null +++ b/ICLR/2025/Self-Supervised Diffusion Models for Electron-Aware Molecular Representation Learning/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a4c74a5b5104aad7ee5cdc4f5ac9969a6396d93b007654a25d24afeb239b5fc5 +size 1079741 diff --git a/ICLR/2025/Self-Supervised Diffusion Models for Electron-Aware Molecular Representation Learning/layout.json b/ICLR/2025/Self-Supervised Diffusion Models for Electron-Aware Molecular Representation Learning/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..b3a104b3a3f80a0cf362fe3f6e55540beb6c04fa --- /dev/null +++ b/ICLR/2025/Self-Supervised Diffusion Models for Electron-Aware Molecular Representation Learning/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:89694485f6c742ad827b5741ec61ce928834341097ddd6fb23a4436d8a33dc13 +size 868991 diff --git a/ICLR/2025/Self-Updatable Large Language Models by Integrating Context into Model Parameters/9eb7de19-122a-4327-8ba0-fb6fdc32a515_content_list.json b/ICLR/2025/Self-Updatable Large Language Models by Integrating Context into Model Parameters/9eb7de19-122a-4327-8ba0-fb6fdc32a515_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..cb37123577b4d78355e13d3d463afbe1efaf6618 --- /dev/null +++ b/ICLR/2025/Self-Updatable Large Language Models by Integrating Context into Model Parameters/9eb7de19-122a-4327-8ba0-fb6fdc32a515_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f239c21fb6cc62aaa85599355b2482895cb014301dca8311c6e96c3f32ffc08f +size 107247 diff --git a/ICLR/2025/Self-Updatable Large Language Models by Integrating Context into Model Parameters/9eb7de19-122a-4327-8ba0-fb6fdc32a515_model.json b/ICLR/2025/Self-Updatable Large Language Models by Integrating Context into Model Parameters/9eb7de19-122a-4327-8ba0-fb6fdc32a515_model.json new file mode 100644 index 0000000000000000000000000000000000000000..0a5bb303a9a771ec87dc848544eea0a82fc12041 --- /dev/null +++ b/ICLR/2025/Self-Updatable Large Language Models by Integrating Context into Model Parameters/9eb7de19-122a-4327-8ba0-fb6fdc32a515_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3ef7c84fbdb35265aa278d5cbcb3625dcfcd32cc7bc0da5f2f090fd29678df94 +size 131207 diff --git a/ICLR/2025/Self-Updatable Large Language Models by Integrating Context into Model Parameters/9eb7de19-122a-4327-8ba0-fb6fdc32a515_origin.pdf b/ICLR/2025/Self-Updatable Large Language Models by Integrating Context into Model Parameters/9eb7de19-122a-4327-8ba0-fb6fdc32a515_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..10fedb12e68862c7ba3c6d3e308dd145aea0db1c --- /dev/null +++ b/ICLR/2025/Self-Updatable Large Language Models by Integrating Context into Model Parameters/9eb7de19-122a-4327-8ba0-fb6fdc32a515_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fb1e822c9c12fe392ec9dc90f442b865a8ae2666596c9111b8e3544430461efd +size 555812 diff --git a/ICLR/2025/Self-Updatable Large Language Models by Integrating Context into Model Parameters/full.md b/ICLR/2025/Self-Updatable Large Language Models by Integrating Context into Model Parameters/full.md new file mode 100644 index 0000000000000000000000000000000000000000..f6443d8550e649de87e7ea1d94196e74b9ce27c0 --- /dev/null +++ b/ICLR/2025/Self-Updatable Large Language Models by Integrating Context into Model Parameters/full.md @@ -0,0 +1,363 @@ +# SELF-UPDATABLE LARGE LANGUAGE MODELS BY INTEGRATING CONTEXT INTO MODEL PARAMETERS + +Yu Wang $^{1*}$ , Xinshuang Liu $^{1*}$ , Xiusi Chen $^{2}$ , Sean O'brien $^{1}$ , Junda Wu $^{1}$ , Julian McAuley $^{1}$ $^{1}$ University of California San Diego, $^{2}$ University of Illinois Urbana-Champaign + +# ABSTRACT + +Despite significant advancements in large language models (LLMs), the rapid and frequent integration of small-scale experiences, such as interactions with surrounding objects, remains a substantial challenge. Two critical factors in assimilating these experiences are (1) Efficacy: the ability to accurately remember recent events; (2) Retention: the capacity to recall long-past experiences. Current methods either embed experiences within model parameters using continual learning, model editing, or knowledge distillation techniques, which often struggle with rapid updates and complex interactions, or rely on external storage to achieve long-term retention, thereby increasing storage requirements. In this paper, we propose SELF-PARAM (Self-Updatable Large Language Models by Integrating Context into Model Parameters). SELF-PARAM requires no extra parameters while ensuring near-optimal efficacy and long-term retention. Our method employs a training objective that minimizes the Kullback-Leibler (KL) divergence between the predictions of an original model (with access to contextual information) and a target model (without such access). By generating diverse question-answer pairs related to the knowledge and minimizing the KL divergence across this dataset, we update the target model to internalize the knowledge seamlessly within its parameters. Evaluations on question-answering and conversational recommendation tasks demonstrate that SELF-PARAM significantly outperforms existing methods, even when accounting for non-zero storage requirements. This advancement paves the way for more efficient and scalable integration of experiences in large language models by embedding knowledge directly into model parameters. Code is open-sourced at https://github.com/XinshuangL/SELF-PARAM + +# 1 INTRODUCTION + +In dynamic environments, whether in virtual worlds such as video games or real-world human societies, developing a cognitive system capable of effectively interacting with objects poses significant challenges. We define the interactions between the cognitive system and its environment as experiences. To remain functional and adaptive, a cognitive system must continuously evolve by integrating new experiences and reflecting upon past interactions whenever engaged by the environment (Wang et al., 2024d). One of the primary challenges in this evolutionary process is the system's ability to absorb experiences, adapt accordingly, and recall key events in the future. This challenge highlights two critical properties that the system must possess: (1) Efficacy: The system must maintain an impeccable memory of recent events, ensuring that each step of knowledge integration is both accurate and effective. (2) Retention: The system should demonstrate a robust ability to recall experiences from the past, indicating strong long-term memory capabilities. + +To achieve long-term Retention, a cognitive system must effectively store its experiences. Existing methods for managing past experiences can be categorized based on whether they require additional modules or parameters beyond the model's inherent parameters: (1) Methods without Additional Modules or Parameters: These approaches, including continual learning, model editing, and knowledge distillation techniques, embed knowledge directly into the model's parameters. For instance, model editing methods such as MEND (Mitchell et al., 2022), ROME (Meng et al., 2022), MEMIT (Meng et al., 2023), and Model-Editing-FT (Gangadhar & Stratos, 2024) update + +specific components of the language model to incorporate or modify information. These methods are particularly effective for inserting factual statements like "The highest mountain above sea level is Mount Everest." However, they may be limited in handling more complex experiences that extend beyond simple facts. Continual learning methods (Sun et al., 2020a; Wu et al., 2024) can manage more intricate information but typically require compiling a corpus for pre-training or finetuning, which may not be suitable for frequent and rapid updates. Moreover, continual learning often relies on Next-Word Prediction (NWP) loss, which may not guarantee strong Efficacy in immediate knowledge integration. Existing Knowledge Distillation methods mainly focus on distilling factual statements (Padmanabhan et al., 2024) or prompts (Choi et al., 2022) into model parameters, which may fall short when injecting complicated experiences. (2) Methods with Additional Modules or Parameters: These approaches employ external components such as text repositories, constructed knowledge bases, or memory modules to store past experiences, thereby facilitating long-term Retention. For example, MemoryLLM (Wang et al., 2024c) and Retrieval-Augmented Generation (Lewis et al., 2020) allow models to access external information during inference. The language model can directly attend to external modules, which can enhance Efficacy by providing accurate and relevant information. However, relying on external storage necessitates maintaining large modules to store all past experiences, thereby increasing storage requirements. Smaller external modules usually offer only marginal benefits (Wang et al., 2024c; Bulatov et al., 2022; 2023). + +To address these challenges, we propose a novel method that requires zero additional parameters while yielding nearly optimal Efficacy and maintaining robust long-term Retention. We call this method SELF-PARAM (Self-Evolvable Large language models with Parameter Integration). We formally define context injection as effective when the model can accurately answer questions about specific contexts after incorporating them into its parameters. Based on this definition, we introduce a training objective that minimizes the Kullback-Leibler (KL) divergence between the predictions of an original model (which has access to the context) and a target model (which does not). The intuition behind using KL divergence is that the conditional probabilities of the original model capture the relationships between future queries and the context. If our training sentences are sufficiently diverse (ideally encompassing a wide range of possible queries), the target model should be able to generate appropriate responses to any queries related to the context after training. Since it is infeasible to use all possible sentences for training, we employ an instruct model to generate question-answer pairs about the context, along with sentences sampled from the pre-training dataset, to construct a target sentence set for each context. By minimizing the KL divergence between the conditional distributions of the original model (conditioned on the context) and the predicted distributions of the target model (without the context), we effectively update the target model to internalize the context within its parameters. + +To demonstrate the efficacy of our method, we evaluate SELF-PARAM on tasks involving Single Context Injection and Batch Context Injection. To assess knowledge retention, we conduct experiments on Sequential Context Injection. Additionally, we apply our method to a Conversational Recommendation task, injecting conversations between users and the system into an instruct model. In this setting, the models' recommendation recalls improve significantly over all other baselines. These comprehensive experiments show that SELF-PARAM surpasses existing methods by a large margin while maintaining zero additional parameters. This advancement effectively achieves both high Efficacy and robust long-term Retention without the need for extra storage modules. + +# 2 RELATED WORK + +Based on their extra storage needs, existing approaches for injecting context into models can be categorized into methods without extra storage and those with extra storage. We provide a detailed overview of each category below. + +Methods without extra storage. This category primarily encompasses Model Editing, Continual Learning, and Knowledge Distillation techniques. For model editing methods (Yao et al., 2023), we focus on approaches that directly modify the model parameters, thereby embedding new knowledge within the parameters themselves. MEND (Mitchell et al., 2022) introduces rank-one model edits to update the model parameters, utilizing meta-learning to train a lightweight meta-network for the editing process. Similarly, methods such as ROME (Meng et al., 2022) and MEMIT (Meng et al., 2023) propose closed-form solutions for editing the MLP layers. In contrast, Model-EditingFT (Gangadhar & Stratos, 2024) fine-tunes the entire model on the factual statements that need to + +be injected. T-Patcher (Huang et al., 2023) and CaliNet (Dong et al., 2022) store new knowledge in additional neurons. However, these approaches may face challenges related to the continuous growth of parameters when the knowledge to be injected comprises lifespan experiences. As for continual learning, it is usually used in the following situations: (1) Real-Time Assimilation of Dynamic Data: Continual learning facilitates the integration of information from diverse sources such as news (Sun et al., 2020b), scholarly articles Cossu et al. (2022), and social media Cossu et al. (2022). (2) Injection of Extensive Knowledge into Language Models: Jang et al. (2022) presents a method for continual knowledge learning that effectively updates LLMs with new data without compromising previously acquired knowledge. (3) Domain Adaptation: Continual training on new data streams enables models to adapt to specific domains in both language and vision. Cossu et al. (2022) demonstrate this by continuously training models on evolving datasets. Additionally, Ke et al. (2023) propose a soft-masking mechanism to update language models with domain-specific corpora, enhancing performance while preserving general knowledge. Various domain-adapted models have been developed, including those tailored for the financial domain (Xie et al., 2023), E-commerce (Ma et al., 2023), and academic content (Wei et al., 2023). (4) Instruction Tuning for Enhanced Reasoning and Interaction: To enable models to tackle novel tasks, task-incremental continual instruction tuning has been proposed (Wang et al., 2024b; 2023). These tasks encompass mathematical problem-solving (Azerbayev et al., 2023), utilization of calculators, search engines, and databases (Qin et al., 2023). With the rapid development of new tools such as advanced software libraries, novel APIs, and domain-specific utilities (Liang et al., 2023; Jin et al., 2023), there is an increasing necessity to continuously update language models to swiftly adapt and master these innovations. In the realm of Knowledge Distillation, Choi et al. (2022) propose a method for distilling prompts directly into model parameters, effectively replicating scenarios where prompts are appended prior to generation. Later, Padmanabhan et al. (2024) introduces a technique for distilling factual knowledge into model parameters such as "ChatGPT is an AI chatbot developed by OpenAI." Both approaches demonstrate impressive performance in knowledge injection. However, they may not be directly applicable to the injection of experiences which can be much more complicated. + +Methods with extra storage. While the preceding category primarily focus on updating the model itself with new knowledge, another line of research involves storing knowledge in external modules and leveraging these modules to generate responses as needed. This approach encompasses several methodologies: (1) Retrieval-Augmented Generation: This framework involves maintaining a repository of past knowledge, which can be either in the form of knowledge graphs or organized texts (Wang et al., 2024d), from which relevant information is extracted using a retrieval mechanism when generating responses (Gao et al., 2023; Karpukhin et al., 2020; Sarthi et al., 2024; Gutierrez et al., 2024; Izacard et al., 2022; Wang et al., 2022). (2) Long Context Methods: These methods store all relevant knowledge within the model's context window. When prompted, the model processes both the extensive context and the input prompt to generate an appropriate response (Wang et al., 2024a; Tworkowski et al., 2023; Chen et al., 2023; Han et al., 2023). (3) Memory-Augmented Methods: This approach typically involves maintaining a memory pool where knowledge is stored. These methods generally include two main operations: (i) Write Operation: Updating the memory pool, often through the compression of textual information into the memory space (Zhou et al., 2023; Wang et al., 2024c). (ii) Read Operation: Retrieving relevant information from the memory pool to inform response generation (Wang et al., 2024c; Zhong et al., 2023). Although memory-augmented methods can achieve impressive performance, they may require significant additional storage space to accommodate complex knowledge externally. In contrast, SELF-PARAM circumvents the need for external storage by embedding all information directly into the model weights via backpropagation. This approach eliminates the additional space requirements associated with external modules, allowing the model to retain and utilize knowledge internally without external dependencies. + +# 3 METHODOLOGY + +# 3.1 DEFINITION OF CONTEXT INJECTION + +This paper introduces the concept of Context Injection in language models. We define Context Injection as the process of modifying a language model to incorporate specific context $x$ , enabling the model to generate accurate and context-aware responses to related queries. Let $\theta$ represent the original language model that does not contain the information in $x$ . When querying the original model $\theta$ with a prompt $p$ related to the context $x$ , the generated answer $a_1$ is given by: + +$$ +a _ {1} = \text {G e n e r a t e} (\theta , p). +$$ + +![](images/422ffc9338c83577a8d83afdb5c73388124d16aadbf201b1cb6f2edec41f464a.jpg) +Figure 1: The Process of Context Injection. Given the original model $\theta$ and a context $x$ , our goal is to obtain a new model $\theta'$ that incorporates $x$ directly into its parameters. To achieve this, we require that for any prompt $p$ , the model $\theta'$ generates the same output as the original model $\theta$ would when provided with the combined input $x + p$ . In other words, $\theta'$ should emulate $\theta$ 's behavior with access to the context $x$ when only prompted by $p$ . For a random sentence $s$ , let $P(s \mid x + p, \theta)$ denote the token distribution generated by the original model $\theta$ when prompted with $x + p$ , and let $P(s \mid p, \theta')$ represent the distribution from the new model $\theta'$ when prompted with $p$ . Ideally, for all possible sentences $s$ , we aim to minimize the KL divergence between $P(s \mid x + p, \theta)$ and $P(s \mid p, \theta')$ . This ensures that $\theta'$ accurately integrates the context $x$ within its parameters. + +For example, consider the following context and prompt: + +$$ +x: A \text {national survey} \dots \text {only} 38 \% \text {willingly} \dots +$$ + +$$ +p: \text {W h a t p e r t a g e o f b a n k b r a n c h e s w i l l i n g l y d i s c l o s e f e e s} \dots ? +$$ + +Here we omit some words with “…” to save space. In this scenario, the answer $a_1$ produced by $\theta$ is likely to be incorrect due to the absence of relevant information in the model. However, by incorporating the context $x$ into the prompt, the model can generate a more accurate response: + +$$ +a _ {2} = \text {G e n e r a t e} (\theta , x + p), +$$ + +where $x + p$ denotes the concatenation of $x$ and $p$ into a single, extended prompt. Assuming that $\theta$ is sufficiently robust and the necessary information is contained within $x$ , the resulting answer $a_2$ should be correct. Then we define a new model $\theta'$ as the obtained model after injecting the context $x$ into the original model $\theta$ . When $\theta'$ is queried with the prompt $p$ , the generated answer $a_3$ is: + +$$ +a _ {3} = \operatorname {G e n e r a t e} \left(\theta^ {\prime}, p\right). +$$ + +If $a_3$ is accurate, this indicates that we have successfully incorporated the context $x$ into the original model $\theta$ . In summary, Context Injection involves updating the original language model $\theta$ to $\theta'$ by embedding a specific context $x$ , thereby enabling the model to accurately respond to any questions related to $x$ . This holds true provided that the original model $\theta$ can generate correct answers when supplied with both the context $x$ and the relevant question. + +This definition leads to the first essential property of Context Injection: Efficacy. Efficacy is achieved when the modified model $\theta'$ can accurately answer questions pertaining to the injected context $x$ . Furthermore, consider a sequence of contexts $x_1, \ldots, x_n$ injected sequentially into $\theta$ to obtain a final model $\theta_n$ . Retention is defined as the degree to which $\theta_n$ preserves the information from previously injected contexts $x_1, \ldots, x_{n-1}$ . Retention can be measured by querying $\theta_n$ with questions related to each $x_i$ for $i \in \{1, \ldots, n-1\}$ . In this paper, our objective is to maximize both efficacy and retention while maintaining a storage complexity $S$ of zero. + +# 3.1.1 THE PROCESS OF CONTEXT INJECTION + +To integrate a context $x$ into the model parameters, we aim to ensure that the updated model $\theta'$ generates responses identical to those produced by the original model $\theta$ when the latter is provided with the combined prompt $x + p$ . Specifically, the original model $\theta$ utilizes the context $x$ when responding to the prompt $p$ . This approach is illustrated in Figure 1. Formally, to enable $\theta'$ to respond accurately to queries about $x$ , we seek to approximate the following relationship: + +$$ +\operatorname {G e n e r a t e} \left(\theta^ {\prime}, p\right) \approx \operatorname {G e n e r a t e} \left(\theta , x + p\right), \tag {1} +$$ + +where $p$ represents a prompt related to the context $x$ , such as a question pertaining to $x$ . Achieving an ideal scenario where Equation Eq. 1 holds for any possible prompt $p$ implies that any question + +answerable by $\theta$ with the context $x + p$ can also be addressed by $\theta'$ using only $p$ . This signifies effective context injection. Consequently, we define the following optimization objective: + +$$ +\theta^ {\prime} = \arg \min _ {\hat {\theta}} \mathbb {E} _ {s} \left[ K L \left[ P _ {\theta} (s \mid x, p) \| P _ {\hat {\theta}} (s \mid p) \right] \right], \tag {2} +$$ + +where $s$ denotes any sentence, whether related or unrelated to $x$ , and $KL[\cdot|\cdot]$ represents the KL divergence. If the objective in Equation Eq. 2 is minimized to zero, then Equation Eq. 1 is inherently satisfied. This concept is depicted in Figure 1. In practice, it is exhaustive to collect all prompts, thus we simply absorb the prompt into $s$ to obtain the following objective: + +$$ +\theta^ {\prime} = \arg \min _ {\hat {\theta}} \mathbb {E} _ {s} \left[ K L \left[ P _ {\theta} (s \mid x) \| P _ {\hat {\theta}} (s) \right] \right], \tag {3} +$$ + +Moreover, aggregating the KL divergence across all possible sentences $s$ is infeasible. Therefore, we employ sampling techniques to approximate the objective effectively. The sampling methodology for $s$ is detailed in the subsequent section. We denote the set of sentences used to train $\theta'$ according to Eq. 3 as $\mathcal{E}$ and we call this set as Target Sentence Set in the remaining paper. + +# 3.2 CONSTRUCTION OF TARGET SENTENCE SET + +To absorb $x$ into $\theta$ , we need to construct the target sentence set which contains two parts: (1) sentences related to $x$ (to inject the context $x$ ) and (2) sentences unrelated to $x$ (to maintain the model's original abilities). As for (1), we employ an instruct model (we tried two settings: using gpt-4o-mini and using the corresponding instruct model, i.e., Mistral-7B-Instruct-v0.3 for Mistral-7B and Llama-3-8B-Instruct for Llama-3-8B) to generate a set of contextually relevant question-answer pairs as the sentence set. The detailed prompt used for constructing is shown in Appendix A.3. Then for (2), we randomly sample sentences from SlimPajama dataset (Soboleva et al., 2023) as the unrelated set of sentences. Note that SlimPajama helps preserve the model's general capabilities, effectively acting as a form of regularization during training. With the balanced sentences from the context-related and context-unrelated datasets, we hope to inject the specialized knowledge encapsulated in $x$ into the model while maintaining the model's broader linguistic capabilities. + +# 3.3 DISCUSSION + +Where does the performance gain come from? We argue that the new objective in Eq. 3 encourages more effective knowledge injection than simply using the next-word prediction (NWP) loss that is widely used in continual learning (Zhang et al., 2023). In our experiments (shown in Table 1 and Table 2), we implement the baseline of fine-tuning the model on the context and then querying it with the question Q (denoted as "FT (C), Q"), where the results show that the model fine-tuned with NWP loss yields poor performance when responding to queries, indicating a failure in effective context injection (i.e., failure of Efficacy). To understand the inherent reason, consider the following example: let $x$ be a simple sentence "David likes apples.", a model trained with NWP loss on $x$ may overfit to the specific form of the question, failing to answer correctly when queried in a different format – for example, "What fruit does David like?" However, our method trains on various forms of question-answering pairs pertaining to the same underlying knowledge, which encourages the model to both absorb the knowledge and use it, instead of simply memorizing the facts in specific forms. + +Analysis of the Computational Cost We acknowledge that our algorithm could introduce additional computation costs. Compared to the fine-tuning baseline, our approach roughly doubles the overall computational cost in terms of both time and monetary resources. Specifically, our method involves four key steps: (a) generating QA pairs, (b) computing base logits, (c) computing updated logits, and (d) performing backpropagation and optimization. In contrast, continual fine-tuning baselines, such as FT(C) and FT(S) in Tables 1-3, only require steps (c) and (d). Assuming each step is of comparable time complexity, our total cost is approximately twice that of continual fine-tuning. However, given the effectiveness of our method, we argue that these additional costs are justified. + +Hallucination Mitigation As we are encouraging the model to generate answers without seeing the context, there is the risk of hallucination, where the model produces an answer even when it lacks the necessary knowledge. To mitigate this issue, we carefully filter out prompts that require + +direct access to prior context in the original PwC dataset. For example, prompts such as “summarize the previous context” and “write a title for the above text” were removed, leaving only factual questions. This refined dataset contains context and questions that are based on constant knowledge, such as Question: What language was spoken in the tape recording of Jamal Khashoggi's murder? Answer: Arabic. These factual statements are less likely to induce hallucination, which helps support the method's robustness. Regarding the Target Sentence Set, we are not directly fine-tuning the model to predict each word within this set. Instead, we employ KL divergence to transfer the behavior from the original model to the updated one, which may also reduce the risk of hallucination. + +# 4 EXPERIMENTS + +In our experiments, we mainly consider the following tasks: (1) Single Context Injection ( $\S 4.1$ ). We adopt SELF-PARAM to inject a single context into the model and then ask the model with the related questions. (2) Batch Context Injection ( $\S 4.2$ ). We adopt SELF-PARAM to inject multiple contexts simultaneously and then ask the model with the questions related to the injected contexts. (3) Sequential Injection ( $\S 4.3$ ). We sequentially inject multiple contexts into the model, ensuring that the model does not retain access to earlier contexts during the injection of newer ones. We then test the model's ability to recall and respond to questions related to the previously injected contexts, thereby assessing its long-term retention. (4) Conversational Recommendation( $\S 4.4$ ). We inject up to 1,000 conversations between users and the system into the model to allow the model to read the conversations. After injection, we prompt the model to generate movie recommendations and calculate the recall of these recommendations to measure the recommendation quality. In these tasks, (1), (2), (4) correspond to Efficacy evaluation, while (3) represents the Retention evaluation. + +# 4.1 SINGLE CONTEXT INJECTION + +Experimental Setup We use PwC dataset (Ge et al., 2023), consisting of triples in the form (context, question, answer). To ensure concise answers, we filter out examples where the answers exceed five tokens, resulting in 1,581 unique contexts and 3,353 unique questions. From these, we select the first 100 contexts paired with 225 questions for the single context injection task. For each (context, question, answer) example, we inject the context into the model and then query the obtained model with the corresponding question. We evaluate performance using the QA-F1 score, as defined in LongBench (Bai et al., 2023). We conduct experiments with three backbone models: OpenLLaMA-3B-v2 (Geng & Liu, 2023), Mistral-7B (Jiang et al., 2023), and Llama3-8B (Dubey et al., 2024). We compare our proposed method, SELF-PARAM, against the following baselines: (1) Base: The original, unmodified model. (2) FT (C): Fine-tuning the original model solely on the context. (3) FT (S): Fine-tuning the original model on the target sentence set. + +# Overall Performance Comparison + +The results are summarized in Table 1. Our method, SELF-PARAM, significantly outperforms the fine-tuning baselines, demonstrating its effectiveness in knowledge injection. Specifically, fine-tuning the model solely on the context (FT (C), Q) yields poor performance, albeit slightly better than the unmodified base model (Base, Q). This indicates that while some knowledge is injected, much of it remains inaccessible. The poor performance of FT (C), Q highlights a major limitation + +of continual learning approaches that rely on NWP loss: they suffer from low Efficacy, as evidenced by the model's inability to generalize knowledge across different query formulations. In contrast, SELF-PARAM trains the model using diverse question-answer pairs related to the same context, which encourages the model to both absorb and utilize the knowledge effectively. This approach prevents overfitting to specific question formats, ensuring that the model can handle varied queries + +
Openllama-3B-v2Mistral-7BLlama3-8B
Base, C+Q0.50430.54610.5368
Base, Q0.11220.15030.1051
FT (C), Q0.22170.24330.1213
FT (S), Q0.27420.32460.3115
SELF-PARAM, Q0.49270.37050.4213
+ +Table 1: Experimental results for Single Context Injection. “C+Q” indicates that both context and question are provided as input to the model, serving as an upper bound for injection performance. “Q” denotes that only the question is provided, requiring the model to answer the questions based solely on its internal parameters. + +about the injected context. Moreover, FT (S), $\mathbf{Q}$ performs worse than SELF-PARAM, underscoring that our method does more than merely injecting generated QA pairs. Instead, SELF-PARAM facilitates the model's ability to internalize and apply the context dynamically. This observation aligns with our training objective in Eq. 3, where minimizing the KL divergence between the original and target models allows SELF-PARAM to better approach the upper bound represented by Base, $\mathbf{C} + \mathbf{Q}$ . + +# 4.2 BATCH CONTEXT INJECTION + +Experimental Setup We use the PwC dataset and the same three backbone models as in § 4.1. The preprocessing is the same. Then we extract 100 and 500 contexts, with 225 questions and 1044 questions, respectively, from the obtained subset to perform batch injection. The injection step and the evaluation process are separated. We first inject 100/500 context into the model, and then we ask the model all questions. Note that one context may have more than one question, we calculate the average f1-score of multiple questions for one context and then calculate the average f1-score across all contexts. We conduct experiments on the same three backbone models as in § 4.1: OpenLLaMA-3B-v2 (Geng & Liu, 2023), Mistral-7B (Jiang et al., 2023), and Llama3-8B (Dubey et al., 2024). We compare our proposed method, SELF-PARAM, against the following baselines: (1) Base, the original, unmodified model; (2) FT (C), fine-tuning the original model solely on the contexts; (3) FT (S), fine-tuning the original model on question-answering pairs generated by an instruct model; (4) MemoryLLM-8B, a memory-augmented method continually trained on Llama3-8B with an additional memory module of size 1.67B tokens (Wang et al., 2024c); (5) InfLLM, a long-context method that can be integrated with large language models to achieve an effectively infinite context window; (6) Dense Passage Retrieval (DPR)(Karpukhin et al., 2020), a retrieval-augmented generation (RAG) method that encodes documents and questions into embeddings and uses faiss for document retrieval; (7) BM25, a sparse retriever-based RAG method; and (8) RAPTOR(Sarthi et al., 2024), which constructs knowledge graphs using an advanced language model (we use gpt-4o-mini) and leverages the knowledge graph for retrieval. For the long-context methods, we concatenate all contexts to form a single, extended context input and prompt the model with: “context1, ..., contextN, question”. For RAG methods (DPR and BM25), we treat each context as an individual document and perform document-level retrieval. Specifically, we use top-4 retrieval for OpenLLaMA-3B-v2, top-8 retrieval for Mistral-7B and Llama3-8B, and top-1 retrieval for RAPTOR. + +Here we introduce the concept of Storage Complexity $S$ as proposed in Wang et al. (2024d), which indicates the relative storage space required to store all the contexts that need to be injected compared to the size of all the contexts (such as the total number of tokens in all contexts). As we do not require any additional storage space, SELF-PARAM has $S$ as zero. In contrast, RAG and long-context methods need to store all contexts, indicating $O(n)$ storage complexity. As MemoryLLM has a fixed-sized memory, the storage complexity is $O(1)$ . Here for each baseline, we mark the storage complexity to indicate the general complexity which could also be applied to similar methods, rather than the specific complexity for every single baseline, thus offering a more generalized perspective. + +Overall Performance Comparison The results are summarized in Table 2. Our method, SELF-PARAM, consistently outperforms all baselines across different models and context sizes, demonstrating its superior ability to inject and utilize multiple contexts without requiring additional parameters. From Table 2, it is evident that SELF-PARAM consistently achieves the highest QA-F1 scores across all models and context sizes. Specifically, SELF-PARAM closely approaches the upper bound performance of Base, $\mathbf{C} + \mathbf{Q}$ without requiring any additional parameters. This demonstrates the method's ability to effectively inject and utilize multiple contexts solely through parameter updates. In contrast, the fine-tuning baselines (FT (C), FT (S)) exhibit significantly lower performance, especially as the number of contexts increases. Notably, FT (C), which relies on next-word prediction (NWP) loss, struggles with maintaining Efficacy in knowledge injection, similar to observations in single context injection. Meanwhile, FT (S) performs better than FT (C) but still falls short of SELF-PARAM, highlighting that our method does more than merely injecting generated QA pairs—it facilitates the model's ability to internalize and apply the context dynamically. This observation aligns with our training objective in Eq. 3, where minimizing the Kullback-Leibler (KL) divergence between the original and target models allows SELF-PARAM to approach the upper bound represented by Base, $\mathbf{C} + \mathbf{Q}$ . Memory-augmented methods like MemoryLLM-8B and retrieval-augmented generation (RAG) methods such as DPR, BM25, and RAPTOR require additional parameters or modules to store contexts, leading to increased storage complexity ( $O(n)$ ). + +
# of ContextsOpenllama-3B-v2Mistral-7BLlama3-8BS
100500100500100500
Base, C+Q0.50430.48690.54610.57250.53680.5089-
Base, Q0.11220.08140.15030.13820.10510.0967-
FT (C), Q0.20850.12310.16590.14330.10650.08780
FT (S), Q0.19250.17840.23500.34590.31790.28480
MemoryLLM-8B----0.14350.0841O(1)
InfLLM0.14370.10030.16190.17830.13010.1244O(n)
DPR0.27950.25280.31750.30920.21840.2310O(n)
BM250.14750.18720.31040.31350.30830.2862O(n)
RAPTOR0.13440.15290.21330.19690.20000.2055O(n)
SELF-PARAM, Q0.50820.50480.45210.43840.43680.42210
+ +Table 2: Overall performance comparison on the task of batch injection. Here “C+Q” means providing the model with the specific context containing the answer for each question. Thus “Base, C+Q” serves as the upper bound. + +![](images/59288dc8dde9f356a0ba76fc3da1241141118988ed92d6e7631698a4bda2d2e2.jpg) +Figure 2: Average QA-F1 scores after sequentially injecting contexts into the model across 50 sequences. For each sequence, 20 contexts are injected one by one. The first column (step 0) represents the performance of the base model when queried without any injected context. Each subsequent column (step $i$ , where $1 \leq i \leq 20$ ) shows the model's QA-F1 score on each of the contexts across all 20 contexts after $i$ injection steps. The displayed scores are the mean values averaged over all 50 sequences, demonstrating the model's retention ability as contexts are progressively injected. + +Although some of these methods achieve competitive performance, they do not match the effectiveness of SELF-PARAM while incurring additional storage overhead. + +# 4.3 SEQUENTIAL INJECTION + +Experimental Setup To evaluate the model's ability to retain knowledge after multiple injections - termed Retention - we conduct sequential injection experiments. Specifically, we aim to determine whether the model can remember previously injected contexts after successive updates. We construct a list of 20 unique contexts from the PwC dataset (Ge et al., 2023) and inject them into the model one after another in a sequential manner. After each injection step, we assess the model's performance by calculating the QA-F1 score on all questions related to the injected contexts. The QA-F1 scores are averaged across all questions to obtain an average F1-score for each context. To ensure the robustness of our evaluation, we create 50 distinct sequences of contexts. We adopt the Mistral-7B model (Jiang et al., 2023) as our backbone model for these experiments. For each injection step within a sequence, we fine-tune the model using Low-Rank + +
ModelINSPIREDREDIAL
r1r2r3r4r1r2r3r4
Base0.02770.02770.03560.03160.03160.02930.03330.0312
FT (C)0.00000.00000.00000.00000.00000.00000.00000.0000
FT (S)0.00000.00000.00000.00000.00000.00000.00000.0000
DPR0.02770.01980.02770.01980.03370.02950.03500.0314
BM250.01980.01580.01980.01580.03180.02890.03310.0306
RAPTOR0.01980.01980.03560.03160.03240.02990.03430.0316
SELF-PARAM0.03570.03160.03950.03570.03370.03100.03600.0326
+ +Table 3: Recall@1 under four different scenarios. As described in § A.1.1, $r_1$ , $r_2$ , $r_3$ , and $r_4$ correspond to No Filtering, Seen Items Filtered Only, OOV Items Filtered Only, and Both OOV and Seen Items Filtered, respectively. Detailed metric definitions are provided in Appendix A.1.1. + +Adaptation (LoRA) weights. After each step, the LoRA weights are merged into the model to incorporate the new context. The results are depicted in Figure 2, illustrating the QA-F1 scores after each sequential injection step. We also include the ablation studies in Appendix B.2 + +Results and Discussions As shown in Figure 2, our method, SELF-PARAM, demonstrates retention capabilities. Initially, after the first injection, the QA-F1 scores are high on the questions related to the context injected just now. As the number of injections increases to 20 steps, the QA-F1 scores gradually decline to approximately 0.3. Despite this reduction, SELF-PARAM maintains significantly higher performance compared to the base model, which exhibits a QA-F1 score of approximately 0.14 without any injected contexts. The diagonal of the figure shows that our model retains its functionality even after multiple rounds of injection, indicating our model's robustness. + +# 4.4 CONVERSATIONAL RECOMMENDATION + +Experimental Setup Building upon the previous sections where knowledge injection was performed using textual contexts, we explore injecting conversational data into the model. Specifically, we adopt the Conversational Recommendation task, which involves multi-turn interactions between users and a recommendation system. The intuition is that exposure to such conversations enables the model to generate more accurate and user-aligned movie recommendations. We utilize two datasets: (1) INSPIRED (Hayati et al., 2020): Contains 731 conversational interactions. (2) REDIAL (Li et al., 2018): Comprises 7,415 conversational interactions. Following the evaluation procedure from He et al. (2023), we prompt the target instruct model to generate 20 movie recommendations based on user queries. The recommendations are then evaluated using recall metrics $(r_1, r_2, r_3, r_4)$ , detailed in Appendix A.1.1. Our task formulation involves injecting a substantial number of conversations (731 for INSPIRED and 1,000 for REDIAL) into the model's parameters using SELF-PARAM, aiming to enhance recommendation quality compared to the backbone model without access to these conversations. We use the Mistral-7B-instruct-v0.2 model as our backbone. We compare SELF-PARAM against the following baselines: (1) FT (C): Fine-tuning the model on conversations, with loss calculated solely on system utterances; (2) FT (S): Fine-tuning the model on generated question-answer pairs, with loss calculated only on answers; (3) Dense Passage Retrieval (DPR) (Karpukhin et al., 2020): Encodes conversations and queries into embeddings, retrieving relevant conversations using faiss; (4) BM25: A sparse retriever-based method for retrieving relevant conversations; (5) RAPTOR (Sarthi et al., 2024): Constructs knowledge graphs from conversations using gpt-4o-mini and retrieves relevant information from the graph. For retrieval-augmented generation (RAG) methods (DPR, BM25, RAPTOR), all conversations are stored in a knowledge pool. During inference, the most relevant conversations are retrieved and incorporated into the prompt as context. + +Overall Performance Comparison The results are presented in Table 3. SELF-PARAM consistently outperforms all baselines across both datasets, demonstrating its effectiveness in enhancing recommendation quality without requiring additional storage modules. From Table 3, the following observations can be made: (1) SELF-PARAM achieves the highest Recall@1 scores across all scenarios and datasets, outperforming all baselines. This underscores the effectiveness of injecting conversations directly into the model parameters, enabling better understanding and recommenda + +tion generation. (2) Both FT (C) and FT (S) exhibit zero performance across all scenarios, indicating that traditional fine-tuning methods fail to effectively integrate conversational knowledge. This may be due to the divergent styles between recommendation conversations and the original instruct models, leading to degradation in model behavior. However, unlike fine-tuning baselines, SELF-PARAM maintains consistent performance without disrupting the model's inherent capabilities. This is attributed to the use of KL divergence in our training objective, which aligns the target model's behavior with the backbone model while integrating new knowledge. (3) Methods like DPR, BM25, and RAPTOR, which rely on external retrieval mechanisms, achieve little or no improvements. This may be due to the difficulty in effectively retrieving and integrating relevant conversations from a large pool, limiting their ability to enhance recommendation quality. Overall, SELF-PARAM demonstrates significant improvements in recommendation accuracy by effectively internalizing conversational knowledge without additional storage overhead. This highlights the potential of SELF-PARAM in enhancing interactive and dynamic tasks within large language models. + +# 4.5 ABLATION STUDY + +Ablation Study of Training Objective Since we introduce a new training objective, as described in Section 3.1.1, it is also important to examine the performance when applying Next-Word-Prediction loss directly to either the original context or the constructed target sentence set. To explore this, we include two baseline settings, FT (C) and FT (S), in Tables 1, 2, and 3, which correspond to fine-tuning on the original contexts and the target sentence set, respectively. The results show that while fine-tuning on the target sentence set (FT (S)) generally outperforms fine-tuning on the original contexts (FT (C)), it still falls significantly short of our proposed approach. This highlights the importance of our training objective in achieving superior performance. + +Ablation Study of the Model for Target Sentence Set Construction To demonstrate that our performance gains do not stem from using a stronger model - and to distinguish our approach from knowledge distillation methods that transfer knowledge from larger models to smaller ones - we conduct an experiment where we replace the Target Sentence Set generated by gpt-4o-mini (as described in Section 4.2) with a cor + +
100 Contexts500 Contexts
Mistral-7BLlama3-8BMistral-7BLlama3-8B
4o-mini0.45210.43680.43840.4221
instruct0.45020.43410.48360.4464
+ +Table 4: Ablation Study of the Model For Target Sentence Set Construction. Here 4o-mini refers to gpt-4o-mini, instruct means using the corresponding instruct model, i.e., using Mistral-7B-Instruct-v0.3 for Mistral-7B and Llama-3-8B-Instruct for Llama3-8B. + +responding instruct model. This ensures that no additional knowledge from a more advanced model is introduced, aligning with our "self-updatable" objective. The results, presented in Table 4, confirm that our method remains effective even without leveraging a more powerful model to construct the target sentence set. This further validates the robustness of our approach. + +# 5 CONCLUSION AND FUTURE WORK + +In this paper, we addressed the critical challenge of integrating small-scale experiences into large language models (LLMs) with high efficacy and long-term retention without incurring additional storage complexity. We introduced SELF-PARAM (Self-Updatable Large Language Models with Parameter Integration), a novel method that embeds experiences directly into model parameters by minimizing the Kullback-Leibler (KL) divergence between an original model with context and a target model without context. Through comprehensive evaluations across diverse tasks, including Single Context Injection, Batch Context Injection, Sequential Injection, and Conversational Recommendation, we find that SELF-PARAM consistently outperformed existing baselines, demonstrating superior performance in both immediate knowledge integration and robust retention over multiple injections. Notably, SELF-PARAM achieved these advancements without requiring additional parameters or external storage modules, thereby maintaining the model's integrity and scalability in dynamic environments. These findings highlight the potential of SELF-PARAM to enhance the adaptability and efficiency of LLMs. Future work may explore scaling SELF-PARAM to larger models, incorporating more diverse types of experiences, and applying the method to a broader range of applications such as sessions of conversations. + +# ETHICS STATEMENT + +In this research, we use publicly available datasets (PwC, INSPIRED, and REDIAL) that do not contain personally identifiable information, ensuring compliance with data privacy standards and licensing agreements. By embedding contextual knowledge directly into model parameters, there is a potential risk of data leakage; to address this, we adhere to robust security practices and recommend further safeguards for deployment. All methodologies and data handling procedures comply with relevant legal frameworks and ethical guidelines, and we have maintained research integrity through transparent reporting and appropriate citations. Overall, while our approach enhances the capabilities of large language models, we remain committed to promoting fairness, security, and responsible innovation in artificial intelligence. + +# REPRODUCIBILITY STATEMENT + +We describe construction process of the target sentence set in $\S$ A.3. +Single Context Injection ( $\S 4.1$ ): We describe the dataset setup in $\S 4.1$ and describe the implementation details in $\S$ A.2. +Batch Context Injection ( $\S 4.2$ ): Similarly, we describe the dataset setup in $\S 4.2$ and describe the implementation details in $\S A.2$ . +Sequential Injection ( $\S 4.3$ ): The dataset setup is described in $\S 4.3$ and the implementation details are shown in $\S A.2$ . +Conversational Recommendation (§ 4.4): The dataset setup is described in § 4.4 and the implementation details are described in § A.2. + +# REFERENCES + +Zhangir Azerbayev, Hailey Schoelkopf, Keiran Paster, et al. Llemma: An open language model for mathematics. CoRR, 2023. +Yushi Bai, Xin Lv, Jiajie Zhang, Hongchang Lyu, Jiankai Tang, Zhidian Huang, Zhengxiao Du, Xiao Liu, Aohan Zeng, Lei Hou, et al. Longbench: A bilingual, multitask benchmark for long context understanding. arXiv preprint arXiv:2308.14508, 2023. +Aydar Bulatov, Yuri Kuratov, and Mikhail S. Burtsev. Recurrent memory transformer. In NeurIPS, 2022. +Aydar Bulatov, Yuri Kuratov, and Mikhail S Burtsev. Scaling transformer to 1m tokens and beyond with rmt. arXiv preprint arXiv:2304.11062, 2023. +Yukang Chen, Shengju Qian, Haotian Tang, Xin Lai, Zhijian Liu, Song Han, and Jiaya Jia. Longlora: Efficient fine-tuning of long-context large language models. CoRR, abs/2309.12307, 2023. +Eunbi Choi, Yongrae Jo, Joel Jang, and Minjoon Seo. Prompt injection: Parameterization of fixed inputs. arXiv preprint arXiv:2206.11349, 2022. +Andrea Cossu, Tinne Tuytelaars, Antonio Carta, et al. Continual pre-training mitigates forgetting in language and vision. CoRR, 2022. +Qingxiu Dong, Damai Dai, Yifan Song, Jingjing Xu, Zhifang Sui, and Lei Li. Calibrating factual knowledge in pretrained language models. In EMNLP (Findings), pp. 5937-5947. Association for Computational Linguistics, 2022. +Abhimanyu Dubey, Abhinav Jauhri, Abhinav Pandey, Abhishek Kadian, Ahmad Al-Dahle, Aiesha Letman, Akhil Mathur, Alan Schelten, Amy Yang, Angela Fan, Anirudh Goyal, Anthony Hartshorn, Aobo Yang, Archi Mitra, Archie Sravankumar, Artem Korenev, Arthur Hinsvark, Arun Rao, Aston Zhang, Aurélien Rodriguez, Austen Gregerson, Ava Spataru, Baptiste Rozière, Bethany Biron, Binh Tang, Bobbie Chern, Charlotte Caucheteux, Chaya Nayak, Chloe Bi, Chris Marra, Chris McConnell, Christian Keller, Christophe Touret, Chunyang Wu, Corinne Wong, + +Cristian Canton Ferrer, Cyrus Nikolaidis, Damien Allonsius, Daniel Song, Danielle Pintz, Danny Livshits, David Esiobu, Dhruv Choudhary, Dhruv Mahajan, Diego Garcia-Olano, Diego Perino, Dieuwke Hupkes, Egor Lakomkin, Ehab AlBadawy, Elina Lobanova, Emily Dinan, Eric Michael Smith, Filip Radenovic, Frank Zhang, Gabriel Synnaeve, Gabrielle Lee, Georgia Lewis Anderson, Graeme Nail, Gregoire Mialon, Guan Pang, Guillem Cucurell, Hailey Nguyen, Hannah Korevaar, Hu Xu, Hugo Touvron, Iliyan Zarov, Imanol Arrieta Ibarra, Isabel M. Kloumann, Ishan Misra, Ivan Evtimov, Jade Copet, Jaewon Lee, Jan Geffert, Jana Vranes, Jason Park, Jay Mahadeokar, Jeet Shah, Jelmer van der Linde, Jennifer Billock, Jenny Hong, Jenya Lee, Jeremy Fu, Jianfeng Chi, Jianyu Huang, Jiawen Liu, Jie Wang, Jiecao Yu, Joanna Bitton, Joe Spisak, Jongsoo Park, Joseph Rocca, Joshua Johnstun, Joshua Saxe, Junteng Jia, Kalyan Vasuden Alwala, Kartikeya Upasani, Kate Plawiak, Ke Li, Kenneth Heafield, Kevin Stone, and et al. The llama 3 herd of models. CoRR, abs/2407.21783, 2024. +Govind Gangadhar and Karl Stratos. Model editing by pure fine-tuning. CoRR, abs/2402.11078, 2024. +Yunfan Gao, Yun Xiong, Xinyu Gao, Kangxiang Jia, Jinliu Pan, Yuxi Bi, Yi Dai, Jiawei Sun, Qianyu Guo, Meng Wang, and Haofen Wang. Retrieval-augmented generation for large language models: A survey. CoRR, abs/2312.10997, 2023. +Tao Ge, Jing Hu, Xun Wang, Si-Qing Chen, and Furu Wei. In-context autoencoder for context compression in a large language model. arXiv preprint arXiv:2307.06945, 2023. +Xinyang Geng and Hao Liu. Openllama: An open reproduction of llama, May 2023. URL https://github.com/openlm-research/open_llama. +Bernal Jiménez Gutiérrez, Yiheng Shu, Yu Gu, Michihiro Yasunaga, and Yu Su. Hipporag: Neurobiologically inspired long-term memory for large language models. arXiv preprint arXiv:2405.14831, 2024. +Chi Han, Qifan Wang, Wenhan Xiong, Yu Chen, Heng Ji, and Sinong Wang. Lm-infinite: Simple on-the-fly length generalization for large language models. arXiv preprint arXiv:2308.16137, 2023. +Shirley Anugrah Hayati, Dongyeop Kang, Qingxiaoyang Zhu, Weiyan Shi, and Zhou Yu. Inspired: Toward sociable recommendation dialog systems. arXiv preprint arXiv:2009.14306, 2020. +Zhankui He, Zhouhang Xie, Rahul Jha, Harald Steck, Dawen Liang, Yesu Feng, Bodhisattwa Prasad Majumder, Nathan Kallus, and Julian McAuley. Large language models as zero-shot conversational recommenders. In Proceedings of the 32nd ACM international conference on information and knowledge management, pp. 720-730, 2023. +Edward J Hu, Yelong Shen, Phillip Wallis, Zeyuan Allen-Zhu, Yanzhi Li, Shean Wang, Lu Wang, and Weizhu Chen. Lora: Low-rank adaptation of large language models. arXiv preprint arXiv:2106.09685, 2021. +Zeyu Huang, Yikang Shen, Xiaofeng Zhang, Jie Zhou, Wenge Rong, and Zhang Xiong. Transformer-patcher: One mistake worth one neuron. arXiv preprint arXiv:2301.09785, 2023. +Gautier Izacard, Mathilde Caron, Lucas Hosseini, Sebastian Riedel, Piotr Bojanowski, Armand Joulin, and Edouard Grave. Unsupervised dense information retrieval with contrastive learning. Trans. Mach. Learn. Res., 2022, 2022. +Joel Jang, Seonghyeon Ye, Sohee Yang, et al. Towards continual knowledge learning of language models. In ICLR, 2022. +Albert Q Jiang, Alexandre Sablayrolles, Arthur Mensch, Chris Bamford, Devendra Singh Chaplot, Diego de las Casas, Florian Bressand, Gianna Lengyel, Guillaume Lample, Lucile Saulnier, et al. Mistral 7b. arXiv preprint arXiv:2310.06825, 2023. +Qiao Jin, Yifan Yang, Qingyu Chen, and Zhiyong Lu. Genegpt: Augmenting large language models with domain tools for improved access to biomedical information. arXiv:2304.09667, 2023. + +Vladimir Karpukhin, Barlas Oguz, Sewon Min, Patrick S. H. Lewis, Ledell Wu, Sergey Edunov, Danqi Chen, and Wen-tau Yih. Dense passage retrieval for open-domain question answering. In EMNLP (1), pp. 6769-6781. Association for Computational Linguistics, 2020. +Zixuan Ke, Yijia Shao, Haowei Lin, Tatsuya Konishi, Gyuhak Kim, and Bing Liu. Continual pretraining of language models. In ICLR, 2023. +Patrick Lewis, Ethan Perez, Aleksandra Piktus, Fabio Petroni, Vladimir Karpukhin, Naman Goyal, Heinrich Kuttler, Mike Lewis, Wen-tau Yih, Tim Rocktäschel, et al. Retrieval-augmented generation for knowledge-intensive nlp tasks. Advances in Neural Information Processing Systems, 33: 9459-9474, 2020. +Raymond Li, Samira Ebrahimi Kahou, Hannes Schulz, Vincent Michalski, Laurent Charlin, and Chris Pal. Towards deep conversational recommendations. Advances in neural information processing systems, 31, 2018. +Yaobo Liang, Chenfei Wu, Ting Song, et al. Taskmatrix. ai: Completing tasks by connecting foundation models with millions of apis. arXiv:2303.16434, 2023. +Shirong Ma, Shen Huang, Shulin Huang, et al. Ecomgpt-ct: Continual pre-training of e-commerce large language models with semi-structured data. CoRR, 2023. +Sourab Mangrulkar, Sylvain Gugger, Lysandre Debut, Younes Belkada, Sayak Paul, and Benjamin Bossan. Peft: State-of-the-art parameter-efficient fine-tuning methods. https://github.com/huggingface/peft, 2022. +Kevin Meng, David Bau, Alex Andonian, and Yonatan Belinkov. Locating and editing factual associations in gpt. Advances in Neural Information Processing Systems, 35:17359-17372, 2022. +Kevin Meng, Arnab Sen Sharma, Alex J. Andonian, Yonatan Belinkov, and David Bau. Mass-editing memory in a transformer. In ICLR. OpenReview.net, 2023. +Eric Mitchell, Charles Lin, Antoine Bosselut, Chelsea Finn, and Christopher D. Manning. Fast model editing at scale. In *ICLR*. OpenReview.net, 2022. +Shankar Padmanabhan, Yasumasa Onoe, Michael Zhang, Greg Durrett, and Eunsol Choi. Propagating knowledge updates to lms through distillation. Advances in Neural Information Processing Systems, 36, 2024. +Yujia Qin, Shihao Liang, Yining Ye, et al. Toollm: Facilitating large language models to master 16000+ real-world apis. arXiv:2307.16789, 2023. +Parth Sarthi, Salman Abdullah, Aditi Tuli, Shubh Khanna, Anna Goldie, and Christopher D. Manning. RAPTOR: recursive abstractive processing for tree-organized retrieval. In ICLR. OpenReview.net, 2024. +Daria Soboleva, Faisal Al-Khateeb, Robert Myers, Jacob R Steeves, Joel Hestness, and Nolan Dey. SlimPajama: A 627B token cleaned and deduplicated version of RedPajama. https://www.cerebras.net/blog/slimpajama-a-627b-token-cleaned-and-deduplicated-version-of-redp2023. URL https://huggingface.co/datasets/cerebras/SlimPajama-627B. +Fan-Keng Sun, Cheng-Hao Ho, and Hung-Yi Lee. LAMOL: language modeling for lifelong language learning. In ICLR. OpenReview.net, 2020a. +Yu Sun, Shuohuan Wang, Yu-Kun Li, et al. ERNIE 2.0: A continual pre-training framework for language understanding. In AAAI, 2020b. +Szymon Tworkowski, Konrad Staniszewski, Mikolaj Pacek, Yuhuai Wu, Henryk Michalewski, and Piotr Milos. Focused transformer: Contrastive training for context scaling. In NeurIPS, 2023. +Liang Wang, Nan Yang, Xiaolong Huang, Binxing Jiao, Linjun Yang, Daxin Jiang, Rangan Majumder, and Furu Wei. Text embeddings by weakly-supervised contrastive pre-training. CoRR, abs/2212.03533, 2022. + +Xiao Wang, Yuansen Zhang, Tianze Chen, et al. Trace: A comprehensive benchmark for continual learning in large language models. CoRR, 2023. +Xindi Wang, Mahsa Salmani, Parsa Omidi, Xiangyu Ren, Mehdi Rezagholizadeh, and Armaghan Eshaghi. Beyond the limits: A survey of techniques to extend the context length in large language models. CoRR, abs/2402.02244, 2024a. +Yifan Wang, Yafei Liu, Chufan Shi, Haoling Li, Chen Chen, Haonan Lu, and Yujiu Yang. Inscl: A data-efficient continual learning paradigm for fine-tuning large language models with instructions. CoRR, abs/2403.11435, 2024b. URL https://doi.org/10.48550/arXiv.2403.11435. +Yu Wang, Yifan Gao, Xiusi Chen, Haoming Jiang, Shiyang Li, Jingfeng Yang, Qingyu Yin, Zheng Li, Xian Li, Bing Yin, Jingbo Shang, and Julian J. McAuley. MEMORYLLM: towards self-updatable large language models. In ICML. OpenReview.net, 2024c. +Yu Wang, Chi Han, Tongtong Wu, Xiaoxin He, Wangchunshu Zhou, Nafis Sadeq, Xiusi Chen, Zexue He, Wei Wang, Gholamreza Haffari, Heng Ji, and Julian McAuley. Towards lifespan cognitive systems, 2024d. URL https://arxiv.org/abs/2409.13265. +Shufa Wei, Xiaolong Xu, Xianbiao Qi, et al. Academicgpt: Empowering academic research. CoRR, 2023. +Tongtong Wu, Linhao Luo, Yuan-Fang Li, Shirui Pan, Thuy-Trang Vu, and Gholamreza Haffari. Continual learning for large language models: A survey. arXiv preprint arXiv:2402.01364, 2024. +Yong Xie, Karan Aggarwal, and Aitzaz Ahmad. Efficient continual pre-training for building domain specific large language models. CoRR, 2023. +Yunzhi Yao, Peng Wang, Bozhong Tian, Siyuan Cheng, Zhoubo Li, Shumin Deng, Huajun Chen, and Ningyu Zhang. Editing large language models: Problems, methods, and opportunities. arXiv preprint arXiv:2305.13172, 2023. +Zihan Zhang, Meng Fang, Ling Chen, Mohammad-Reza Namazi-Rad, and Jun Wang. How do large language models capture the ever-changing world knowledge? A review of recent advances. In EMNLP, pp. 8289-8311. Association for Computational Linguistics, 2023. +Wanjun Zhong, Lianghong Guo, Qiqi Gao, and Yanlin Wang. Memorybank: Enhancing large language models with long-term memory. arXiv preprint arXiv:2305.10250, 2023. +Wangchunshu Zhou, Yuchen Eleanor Jiang, Peng Cui, Tiannan Wang, Zhenxin Xiao, Yifan Hou, Ryan Cotterell, and Mrinmaya Sachan. Recurrentgpt: Interactive generation of (arbitrarily) long text. arXiv preprint arXiv:2305.13304, 2023. + +# A ADDITIONAL SETTINGS + +# A.1 ADDITIONAL EXPERIMENTAL SETUPS + +# A.1.1 METRICS FOR CONVERSATIONAL RECOMMENDATION TASKS + +Following He et al. (2023), we report Recall@1 using the code base from https://github.com/AaronHeee/LLMs-as-Zero-Shot-Conversational-RecSys under four distinct scenarios. These scenarios are defined based on the post-processing steps applied to the generated recommendations, focusing on the filtering of Out-Of-Vocabulary (OOV) items and Seen items. Below, we describe each metric concisely: + +# Metric Descriptions + +- $r_1$ : No Filtering Applied + +- OOV Items Filtered? X +- Seen Items Filtered? X +- Description: In this baseline scenario, no post-processing filters are applied. All recommended items are included regardless of whether they are out-of-vocabulary (OOV) or have been previously mentioned in the current conversation. This metric serves as an upper bound for recommendation performance, reflecting the model's raw ability to generate relevant suggestions without any constraints. + +- $r_2$ : Seen Items Filtered Only + +- OOV Items Filtered? X +- Seen Items Filtered? +- Description: This scenario filters out items that have already been mentioned in the ongoing conversation (Seen Items) while retaining all OOV items. By eliminating redundant recommendations, $r_2$ ensures that the user receives new and potentially more relevant suggestions, addressing the issue of "Repeated Items Can Be Shortcuts." + +- $r_3$ : OOV Items Filtered Only + +- OOV Items Filtered? +- Seen Items Filtered? X +- Description: In this case, only Out-Of-Vocabulary (OOV) items are filtered out, while all Seen Items are retained. OOV Items refer to recommendations that are not part of the predefined candidate set and may be irrelevant or invalid within the given context. By excluding OOV Items, $r_3$ ensures that only valid and recognized items are considered, thereby improving the overall quality and reliability of the recommendations. + +- $r_4$ : Both OOV and Seen Items Filtered + +- OOV Items Filtered? +- Seen Items Filtered? +- Description: This most stringent scenario filters out both OOV and Seen Items. Only new, valid, and relevant recommendations that have not been previously mentioned in the conversation are presented. By applying both filters, $r_4$ maximizes the novelty and applicability of the recommendations, ensuring alignment with the predefined candidate set and enhancing user satisfaction by avoiding redundancy. + +Summary Table For a concise overview, the metrics are summarized in Table 5. + +# Additional Notes + +- Out-Of-Vocabulary (OOV) Items: These are items not included in the predefined candidate set, potentially leading to irrelevant or invalid recommendations if not filtered out. +- Seen Items: Items that have already been mentioned in the current conversation. Filtering these helps prevent repetitive suggestions and focuses on introducing new recommendations. + +
MetricOOV Items Filtered?Seen Items Filtered?Description
r1XXNo filtering applied; includes all recommended items, serving as the upper bound for performance.
r2X✓Filters out Seen Items while retaining all OOV items to eliminate redundancy.
r3✓XFilters out OOV Items while retaining all Seen Items to ensure validity.
r4✓✓Filters out both OOV and Seen Items, ensuring only new and valid recommendations are presented.
+ +Table 5: Summary of Recall@1 Metrics for Conversational Recommendation Tasks. + +# - Implications for Evaluation: + +- $r_1$ : Serves as an upper bound, showcasing the model's maximum potential without any constraints. +- $r_2$ and $r_3$ : Offer intermediate evaluations, focusing on specific aspects of recommendation quality by filtering either Seen Items or OOV Items. +- $r_4$ : Provides the most stringent assessment by ensuring all recommendations are both new and valid, aligning closely with practical application scenarios. + +These metrics allow us to comprehensively evaluate the effectiveness of our recommendation system under varying levels of filtering, providing deeper insights into the strengths and limitations of our approach. + +# A.2 IMPLEMENTATION DETAILS + +For all the experiments, we conduct experiments with eight NVIDIA-RTX-A6000 GPUs. Each experiment of SELF-PARAM needs two GPUs while all the baselines here need one GPU to run. The learning rate is set to $2 \times 10^{-5}$ for training. We train for 50 epochs in both Single Context Injection and Batch Context Injection, 20 epochs in Sequential Injection, and 1 epoch in Conversational Recommendation. The KL divergence is computed using the torch.nn.Functional.kl_div function from the PyTorch library. For the backbone model Openllama-3B-v2, we train the MLP layers. For Mistral-7B, Mistral-7B-instruct-v0.2, Llama3-8B, we use LoRA (Hu et al., 2021) from the package peft (Mangrulkar et al., 2022). The LoRA configurations are: + +{inference_mode: false, r: 8, lora_alpha: 32, lora_dropout: 0.1, target Modules: ["q.proto", "v.proto", "k.proto", "up.proto", "down.proto", "gate.proto"]}. + +# A.3 CONSTRUCTION OF TARGET SENTENCE SET + +The prompt used for querying the instruct model using the context is shown below: + +Given a context, please generate related questions as comprehensively as possible with bullet points and answers. This is an example: +Context: A small coastal town has a beach known for its colorful sea glass. The town hosts an annual festival celebrating this unique feature with art and conservation efforts. +Question: What attracts tourists to the small coastal town annually? Answer: The unique sea glass beach. +Question: What is celebrated at the town's annual festival? Answer: The natural phenomenon of sea glass. +Question: What type of activities are featured at the festival? + +
Model & # of Contexts50 QA pairs (1 Epoch)10 QA pairs (5 epochs)
OpenLlama-3B-v2 & 1000.50820.4203
OpenLlama-3B-v2 & 5000.50480.4203
Mistral-7B & 1000.45210.3891
Mistral-7B & 5000.43840.3813
+ +Table 6: Sensitivity to Target Sentence Set Diversity. Here we consider batch context injection. + +![](images/2b639e8691970b5cbcc4d9ef108b42a4a489be0a4a4afa237fe6421233d2a91f.jpg) +Figure 3: Average QA-F1 scores after sequentially injecting contexts into the model across 50 sequences without SlimPajama + +Answer: Glass art exhibitions, environmental workshops, and local music performances. + +Question: What is the purpose of the workshops at the festival? + +Answer: To promote environmental awareness among visitors. + +Question: How does the festival impact the local economy? + +Answer: It boosts local businesses by attracting tourists. + +Now, please generate related questions based on the following context: + +Context: {context} + +# B ADDITIONAL EXPERIMENTS + +# B.1 SENSITIVITY TO TARGET SENTENCE SET DIVERSITY + +Our training objective, Eq.(3), uses 50 question-answer pairs as the target sentence set per context over one epoch. During our exploration of this project, we found that training on a smaller set of 10 question-answer pairs for five epochs led to lower performance. We report the results we obtained in Table 6. This analysis suggests that question-answer diversity is important to ensure comprehensive attention to context information. Limited diversity may lead to slightly reduced performance. + +# B.2 ABLATION STUDY FOR SEQUENTIAL INJECTION + +To conduct the ablation study for sequential injection, we consider the following settings: + +![](images/c2575785f4e93688fe2f6552dc77c9dbd932b1c92341aca199fd7b4803c7d1a2.jpg) +Figure 4: Average QA-F1 scores after sequentially injecting contexts into the model across 50 sequences with fine-tuning on the Target Sentence Set. + +![](images/fdebb143b5503e9e073e7d669a95197857dc22f8198e48f85fd8f546aa79deb5.jpg) +Figure 5: Average QA-F1 scores after sequentially injecting contexts into the model across 50 sequences with fine-tuning on the context. + +- SELF-PARAM w/o SlimPajama: As mentioned in Section A.3, we adopt SlimPajama as the training set to retain the model's general abilities. Thus we conduct the experiments with exactly the same settings while skipping the steps of training on SlimPajama. The results are shown in Figure 3. Looking at the dianogal results [0.43, 0.57, 0.44, 0.52, 0.5, 0.67, 0.45, 0.49, 0.55, 0.48, 0.46, 0.4, 0.48, 0.35, 0.36, 0.34, 0.42, 0.24, 0.28, 0.27], we can see that the model's generalization ability has be severely affected after around 20 steps of injection, where the model can only achieve less than 0.30 QA-F1-score when we are using Eq.(2) to inject new knowledge. In contrast, as shown in Figure 2, SELF-PARAM can maintain the QA-F1-score as always around 0.5. This justifies that we need SlimPajama to maintain the model's general functionality. + +- Finetuning on the Context: Following the settings FT (C) in Section 4.1 and 4.2, at each step, we fine-tune the base model, Mistral-7B, with LoRA applied, on a single context for 50 epochs. Similarly, SlimPajama is used as the regularization set during fine-tuning. After completing each step, we merge the LoRA weights into the original model before proceeding to fine-tune on the next context. To evaluate performance, we construct 25 sequences, each consisting of 20 consecutive contexts, and report the average performance across all 25 sequences (These settings are consistent with those described in Section 4.3). The results are shown in Figure 4. From the figure, we can see that FT (C) demonstrates the lowest efficacy. By omitting the first column and examining the diagonal values as highlighted, it is evident that FT (C) barely injects knowledge into the model. + +- Finetuning on the Target Sentence Set: Following the settings FT (S) in Section 4.1 and 4.2, we fine-tune the base model on the constructed question-answering pairs (i.e., the target sentence set) constructed from gpt-4o-mini with the same experimental settings as SELF-PARAM, with the results shown in Figure 5. From the figure, we can find that FT (S) has a retention ability comparable to ours. As shown in the first row of Figure 2 and 5, which shows the accuracy of querying the model with the question related $x_{1}$ after injecting $x_{1},\dots ,x_{n},n = 1,\dots ,20$ into the model (here $x_{1},\dots ,x_{20}$ refer to 20 contexts that are sequentially injected), Our approach starts at a QA-F1 score of around 0.5 after injecting x1 and drops to approximately 0.33 after injecting x20 (Figure 2). In contrast, FT (S) begins at 0.36 and decreases to 0.31. Despite the similar retention ability, FT (S) has much lower efficacy, as shown by the diagonal values of the figures (meaning the QA-F1 score when answering the question related to $x_{n}$ after injecting $x_{1},\dots ,x_{n}$ into the model). \ No newline at end of file diff --git a/ICLR/2025/Self-Updatable Large Language Models by Integrating Context into Model Parameters/images.zip b/ICLR/2025/Self-Updatable Large Language Models by Integrating Context into Model Parameters/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..d783a804d37fa56617d2fcb77d1a1cb43ffa2d9d --- /dev/null +++ b/ICLR/2025/Self-Updatable Large Language Models by Integrating Context into Model Parameters/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c0e93567cd873544928480699fece4a846325f30cc8f61f0a248f6fef50a2910 +size 978658 diff --git a/ICLR/2025/Self-Updatable Large Language Models by Integrating Context into Model Parameters/layout.json b/ICLR/2025/Self-Updatable Large Language Models by Integrating Context into Model Parameters/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..d3caf7a6367795d571b2bf3afa72e19e0aad4ab5 --- /dev/null +++ b/ICLR/2025/Self-Updatable Large Language Models by Integrating Context into Model Parameters/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f604b2dfe9eaef96dc38fd45bfd47db6cbefe74d657ecb14d65a309b45751bc1 +size 531186 diff --git a/ICLR/2025/Self-supervised Monocular Depth Estimation Robust to Reflective Surface Leveraged by Triplet Mining/98ae1c04-a4cc-4c85-a65e-1860a2b5e97f_content_list.json b/ICLR/2025/Self-supervised Monocular Depth Estimation Robust to Reflective Surface Leveraged by Triplet Mining/98ae1c04-a4cc-4c85-a65e-1860a2b5e97f_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..164a2e1787474ad161d814854fd5e837cdfba14a --- /dev/null +++ b/ICLR/2025/Self-supervised Monocular Depth Estimation Robust to Reflective Surface Leveraged by Triplet Mining/98ae1c04-a4cc-4c85-a65e-1860a2b5e97f_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:604f7d1d5eebba07361da8865873fcb8aa974cc1cbc8bb305cf9dc89bf8e2048 +size 115082 diff --git a/ICLR/2025/Self-supervised Monocular Depth Estimation Robust to Reflective Surface Leveraged by Triplet Mining/98ae1c04-a4cc-4c85-a65e-1860a2b5e97f_model.json b/ICLR/2025/Self-supervised Monocular Depth Estimation Robust to Reflective Surface Leveraged by Triplet Mining/98ae1c04-a4cc-4c85-a65e-1860a2b5e97f_model.json new file mode 100644 index 0000000000000000000000000000000000000000..b0792279bc9115b485bb391e69f713e6ea5223b2 --- /dev/null +++ b/ICLR/2025/Self-supervised Monocular Depth Estimation Robust to Reflective Surface Leveraged by Triplet Mining/98ae1c04-a4cc-4c85-a65e-1860a2b5e97f_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e7286c4829fd3566e5942d49b9bed1ea3918db708f11cf8fb2bfda5989db4248 +size 136253 diff --git a/ICLR/2025/Self-supervised Monocular Depth Estimation Robust to Reflective Surface Leveraged by Triplet Mining/98ae1c04-a4cc-4c85-a65e-1860a2b5e97f_origin.pdf b/ICLR/2025/Self-supervised Monocular Depth Estimation Robust to Reflective Surface Leveraged by Triplet Mining/98ae1c04-a4cc-4c85-a65e-1860a2b5e97f_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..5f1bc5b42f17f3fd0b47b7f2399c5f42d9126d9f --- /dev/null +++ b/ICLR/2025/Self-supervised Monocular Depth Estimation Robust to Reflective Surface Leveraged by Triplet Mining/98ae1c04-a4cc-4c85-a65e-1860a2b5e97f_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8864c2147c4c21764dbdf5dbd799bd05cc25d41cc8aeb7b914bca8ca12e94817 +size 6513217 diff --git a/ICLR/2025/Self-supervised Monocular Depth Estimation Robust to Reflective Surface Leveraged by Triplet Mining/full.md b/ICLR/2025/Self-supervised Monocular Depth Estimation Robust to Reflective Surface Leveraged by Triplet Mining/full.md new file mode 100644 index 0000000000000000000000000000000000000000..8d1d9bcfe0cb2e887e8f8dde934beb20ec46ed7d --- /dev/null +++ b/ICLR/2025/Self-supervised Monocular Depth Estimation Robust to Reflective Surface Leveraged by Triplet Mining/full.md @@ -0,0 +1,343 @@ +# SELF-SUPERVISED MONOCULAR深度ESTIMATION ROBUST TO REFLECTIVE SURFACE LEVERAGED BY TRIPLET MINING + +Wonhyeok Choi $^{1,*}$ , Kyumin Hwang $^{1,*}$ , Wei Peng $^{2}$ , Minwoo Choi $^{1}$ , Sunghoon Im $^{1,\dagger}$ + +Electrical Engineering and Computer Science1, Psychiatry and Behavioral Sciences2 + +Daegu Gyeongbuk Institute of Science and Technology1, Stanford University2 + +South Korea $^{1}$ , USA $^{2}$ + +$\{\mathrm{smu06117,kyumin,subminu,sunghoonim}\} @dgist.ac.kr^1$ , wepeng@stanford.edu2 + +# ABSTRACT + +Self-supervised monocular depth estimation (SSMDE) aims to predict the dense depth map of a monocular image, by learning depth from RGB image sequences, eliminating the need for ground-truth depth labels. Although this approach simplifies data acquisition compared to supervised methods, it struggles with reflective surfaces, as they violate the assumptions of Lambertian reflectance, leading to inaccurate training on such surfaces. To tackle this problem, we propose a novel training strategy for an SSMDE by leveraging triplet mining to pinpoint reflective regions at the pixel level, guided by the camera geometry between different viewpoints. The proposed reflection-aware triplet mining loss specifically penalizes the inappropriate photometric error minimization on the localized reflective regions while preserving depth accuracy in non-reflective areas. We also incorporate a reflection-aware knowledge distillation method that enables a student model to selectively learn the pixel-level knowledge from reflective and non-reflective regions. This results in robust depth estimation across areas. Evaluation results on multiple datasets demonstrate that our method effectively enhances depth quality on reflective surfaces and outperforms state-of-the-art SSMDE baselines. + +# 1 INTRODUCTION + +Self-supervised monocular depth estimation (SSMDE) (Godard et al., 2019) is a task that learns depth solely from a continuous RGB image sequence without needing corresponding ground-truth depth maps for each frame in a video. This approach significantly simplifies data acquisition compared to traditional supervised methods (Fu et al., 2018; Lee et al., 2019; Bhat et al., 2021), which often involve high costs for annotation. As such, many SSMDE studies (Godard et al., 2019; Zhou et al., 2017; Garg et al., 2016; Guizilini et al., 2020) have explored its viability as a mainstay for applications such as autonomous driving, highlighting its potential in outdoor environments. + +Despite its advantages, SSMDE approaches typically challenge in accurate depth estimation on non-Lambertian surfaces such as mirrors, transparent objects, and specular surfaces. This difficulty primarily arises from the assumption of Lambertian reflectance (Basri & Jacobs, 2003) embedded in most SSMDE methods. As illustrated in Figure 1, these non-Lambertian surfaces violate the photometric constancy principle, which posits that the color and brightness of a point should appear constant across different images (Godard et al., 2017). This violation leads to incorrect depth training, particularly on non-Lambertian surfaces. Consequently, this issue manifests in a phenomenon known as the "black-hole effect" (Shi et al., 2023), where the model erroneously predicts depths that are greater than the actual surface depth in areas with specular reflections. This effect is a prevalent challenge across various reflective surfaces, significantly impacting the performance and reliability of SSMDE systems. + +![](images/77d0e17fa95382a09da5efc06bf5af39a122637e5ecd9f2f1ae5aa742190cd15.jpg) +Figure 1: Photometric constancy violation on reflective surfaces. The projected non-reflective surface point (denoted as $\odot$ ) satisfies the photometric constancy so the model can obtain the accurate depth by photometric error minimization. On the other hand, projected reflective surface point (denoted as $\odot, \odot$ ) violates the photometric constancy, resulting in wrong disparity by photometric error minimization. This figure depicts a scenario where the relative positions of the cameras shift horizontally, akin to rectified stereo, to simplify the illustration. + +Recent advancements (Costanzino et al., 2023; Shi et al., 2023) attempt to tackle these challenges by utilizing training strategies that involve generating pseudo-labels through inpainting (Costanzino et al., 2023) or reconstructing 3D meshes (Shi et al., 2023). However, these methods still rely on extra labels such as segmentation mask annotations (Costanzino et al., 2023) or use auxiliary methods that have excessive computational costs such as ensemble-based uncertainty algorithms (Shi et al., 2023), TSDF-fusion (Newcombe et al., 2011) and mesh rendering (Matl, 2019). + +To address these issues, we propose a novel training strategy called "reflection-aware triplet mining" that enhances the performance of SSMDEs by leveraging the triplet mining (Schroff et al., 2015). The underlying principle of our approach is that reflective areas, such as mirror light sources or objects, exhibit disparities corresponding to the reflected object rather than the actual surface as illustrated in Figure 1. While non-reflective areas exhibit photometric error due to the difference in camera views from two different perspectives (e.g., source and reference views), reflective areas have abnormally low photometric error between the two views due to the low disparity of reflected objects. Accordingly, our approach treats views from the same camera coordinates as positive pairs and those from different coordinates as negative pairs, as illustrated in Figure 2. Our method aims to minimize the conventional photometric error between positive pairs while maximizing it between negative pairs. This approach effectively neutralizes the impact of contaminated gradients in reflective regions, thereby significantly improving accuracy on these regions. + +Moreover, we introduce a "reflection-aware knowledge distillation" approach to keep the high-frequency details in the predicted depth for non-reflective regions inspired by previous works (Shi et al., 2023). In this method, the student network is trained by distilling knowledge from two distinct SSMDE networks. The first utilizes the proposed triplet loss, providing robustness against reflective areas, while the second employs solely photometric minimization loss, adept at preserving high-frequency details that contribute to the perceptual quality and visual fidelity of the depth map. This hybrid training strategy effectively combines the strengths of both training methods, creating a more versatile and effective depth estimation framework. By leveraging the unique capabilities of each model, the student network can achieve a more comprehensive understanding of depth across various surface conditions. + +Our method is broadly applicable to general SSMDE frameworks that rely on photometric error minimization. We validate our method on three well-known SSMDE networks (Godard et al., 2019; Lyu et al., 2021; Zhao et al., 2022) across three public datasets (Dai et al., 2017; Shotton et al., + +2013; Ramirez et al., 2023) featuring reflective objects and surfaces. The results demonstrate that our method significantly improves depth prediction accuracy on reflective surfaces while preserving performance on non-reflective surfaces. Our main contributions are fourfold as follows: + +1. We propose a new reflection-aware triplet mining loss that significantly enhances the accuracy on reflective surfaces and can be easily integrated into general SSMDE frameworks. +2. We introduce reflection-aware knowledge distillation to improve the overall accuracy on reflective surfaces while preserving high-frequency details on non-reflective surfaces. +3. To the best of our knowledge, our strategy represents the first end-to-end method specifically designed to enhance the performances of SSMDE on reflective surfaces. +4. The proposed method outperforms the existing self-supervised training method and shows comparable results against 3D information distillation methods on various indoor depth benchmarks. + +# 2 RELATED WORK + +# 2.1 SELF-SUPERVISED MONOCULAR DEPTH ESTIMATION + +Self-supervised Monocular Depth Estimation (SSMDE) is a task that estimates a depth map from a single image without a ground truth depth map. This approach significantly simplifies the process of data acquisition, making it scalable for a wide variety of datasets. SfMLearner (Zhou et al., 2017) introduces a pioneering framework for self-supervised depth map estimation, which simultaneously learns depth maps for the input image and pose parameters from sequential views. Monodepth2 (Godard et al., 2019) proposes a masking scheme and minimum reprojection loss to filter out the regions that violate photometric constancy, such as moving objects and occluded regions. Subsequent methods (Zhou et al., 2021; Guizilini et al., 2020; Lyu et al., 2021) have been refined, effectively integrating features of different resolutions based on established constraints. With the introduction of ViT (Dosovitskiy et al., 2020), the field of SSMDE has begun to incorporate transformer backbones. Monoformer (Bae et al., 2023b) and MonoViT (Zhao et al., 2022) have emerged, utilizing hybrid networks of CNN and transformers to adeptly merge local and global features. + +# 2.2 GENERALIZATION OF MONOCULAR DEPTH ESTIMATION + +Recent research has expanded to consider factors such as the impact of weather variations (Saunders et al., 2023; Gasperini et al., 2023), the differences in inference capabilities between CNNs and Transformers (Bae et al., 2023a), the robustness of SSMDEs against various types of data corruption (Kong et al., 2024), and methods for accurately modeling transparent and mirrored surfaces, which are typically non-Lambertian (Costanzino et al., 2023). In addition, the 3D Distillation (Shi et al., 2023) addresses a critical flaw in traditional SSMDEs: the photometric constancy principle used in applying photometric consistency loss may not hold for non-Lambertian surfaces encountered in real-world scenarios, resulting in SSMDE models producing unreliable and low-quality depth estimates for reflective surfaces. To counter this problem, 3D Distillation leverages the 3D mesh rendering function along with ensemble uncertainty to localize the reflective surfaces and refine the inaccurate depth on these regions. + +# 2.3 DEEP METRIC LEARNING + +Deep metric learning (Chen et al., 2020; Chen & He, 2021; Khosla et al., 2020) seeks to develop an effective distance measure between data points. These methods strive to minimize the distance between samples of the same class while maximizing it between samples from different classes. While traditionally focused on classification tasks, where positive and negative pairs are defined based on class similarity, recent studies (Spurr et al., 2021; Wang et al., 2022; Zha et al., 2024) have expanded the application of deep metric learning to regression contexts. Particularly in the context of depth estimation, deep metric learning has demonstrated versatility beyond simple augmentation-based consistency. It has been applied to enhance accuracy through contrasting depth distributions (Fan et al., 2023; Choi et al., 2024) and addressing issues such as edge fattening (Chen et al., 2023). In this paper, we utilize the triplet mining scheme, initially popularized by Schroff et al. (2015), to enhance recognition accuracy, specifically focusing on improving performance on reflective surfaces. + +# 3 METHOD + +Our method aims to enhance depth prediction accuracy on reflective surfaces by strategically penalizing the inappropriate photometric error minimization between the view-synthesized image and the reference image. In Section 3.1, we discuss the photometric constancy principle, which posits that correctly minimizing photometric error is crucial for accurately determining depth (Section 3.1.1). We also provide an overview of the standard training strategies employed in SSMDE frameworks (Section 3.1.2). In Section 3.2, we detail the three components of our training strategy: reflective region localization (Section 3.2.1), reflection-aware triplet mining loss (Section 3.2.2), and reflection-aware knowledge distillation (Section 3.2.3). + +# 3.1 PRELIMINARY + +# 3.1.1 PHOTOMETRIC CONSTANCY PRINCIPLE + +The photometric constancy principle is foundational in SSMDE frameworks, positing that surfaces exhibit uniform reflectance (i.e., Lambertian reflectance) from all viewing angles. A surface adheres to this principle if its color and luminance observed through a camera remain constant, regardless of the camera's viewing angle. By leveraging this property, depth and pose can be accurately estimated by minimizing the photometric error between the view-synthesized image and the reference image, as described in Equation 3. However, real-world scenes rarely adhere strictly to this principle. Non-Lambertian surfaces, such as specular reflections from light sources or mirrored objects, are prevalent, leading to violations of photometric constancy. These deviations result in significant errors when attempting to minimize photometric error, thus compromising the effectiveness of depth estimation methods based on these assumptions. + +# 3.1.2 TRAINING STRATEGY OF GENERAL SSMDE FRAMEWORK + +The objective of SSMDE is to predict a per-pixel basis depth map $\mathbf{D}_{ref}$ of a reference image $\mathbf{I}_{ref}$ given the reference image itself, a source image $\mathbf{I}_{src}$ (or source images) and their camera intrinsics $\pmb{K}$ . The framework consists of a depth network $\mathcal{F}_{\theta}(\cdot)$ , and a pose network $\mathcal{G}_{\phi}(\cdot,\cdot)$ to respectively estimate the depth of the reference image $\mathbf{D}_{ref}$ , and the relative pose $[\pmb{R}|t]_{r2s}$ as follows: + +$$ +\mathbf {D} _ {r e f} = \mathcal {F} _ {\theta} \left(\mathbf {I} _ {r e f}\right), \quad \mathcal {F} _ {\theta}: \mathbb {R} ^ {3 \times h \times w} \rightarrow \mathbb {R} ^ {1 \times h \times w}, \tag {1} +$$ + +$$ +\left[ \boldsymbol {R} | \boldsymbol {t} \right] _ {r 2 s} = \mathcal {G} _ {\phi} \left(\mathbf {I} _ {s r c}, \mathbf {I} _ {r e f}\right), \quad \mathcal {G} _ {\phi}: \mathbb {R} ^ {2 \times 3 \times h \times w} \rightarrow \mathbb {R} ^ {3 \times 4}, \tag {2} +$$ + +where $(h,w)$ represent the spatial resolution of $\mathbf{I}_{ref}$ . Using the obtained relative pose $[\pmb {R}|t]_{r:2s}$ , and depth map $\mathbf{D}_{ref}$ , the source image $\mathbf{I}_{src}$ is warped into the reference coordinates, generating the view-synthesized image $\mathbf{I}_{s2r}$ as follows: + +$$ +\left(\mathbf {I} _ {s 2 r}\right) _ {:, u, v} = \mathbf {I} _ {s r c} \left(\left\langle \boldsymbol {K} [ \boldsymbol {R} | \boldsymbol {t} ] _ {r 2 s} \left(\mathbf {D} _ {r e f}\right) _ {:, u, v} \boldsymbol {K} ^ {- 1} [ u, v, 1 ] ^ {T} \right\rangle\right), \tag {3} +$$ + +where $(u,v)$ represent the image coordinates and $\langle \cdot \rangle$ is the projection function that maps homogeneous coordinates to image coordinates. By the photometric constancy principle detailed in Section 3.1.1, the synthesized image $\mathbf{I}_{s2r}$ should exhibit the same colors and luminances as the reference image on a pixel-by-pixel basis. Consequently, the model can determine the accurate depth and pose by minimizing the photometric errors, $\mathcal{P}(\cdot ,\cdot)$ , between $\mathbf{I}_{s2r}$ and $\mathbf{I}_{ref}$ as follows: + +$$ +\mathcal {P} \left(\mathbf {I} _ {s 2 r}, \mathbf {I} _ {r e f}\right) = \mathbf {M} \odot \left(\alpha_ {1} \frac {1 - \mathcal {S} \left(\mathbf {I} _ {r e f} , \mathbf {I} _ {s 2 r}\right)}{2} + \alpha_ {2} \| \mathbf {I} _ {r e f} - \mathbf {I} _ {s 2 r} \| _ {1}\right), \tag {4} +$$ + +$$ +\mathcal {P}: \mathbb {R} ^ {2 \times 3 \times h \times w} \to \mathbb {R} ^ {1 \times h \times w}, \quad \mathcal {S}: \mathbb {R} ^ {2 \times 3 \times h \times w} \to \mathbb {R} ^ {1 \times h \times w}, +$$ + +where $S(\cdot, \cdot)$ is the mixture of structural similarity index (Wang et al., 2004), and $\mathbf{M}$ is the principled mask (Godard et al., 2019) to prevent the backpropagation of corrupted gradients, caused by anomalies like moving objects in the scene. The weights $\alpha_{1}$ and $\alpha_{2}$ serve as balance terms between two losses, and $\odot$ represents the element-wise multiplication operator. However, if the surface does not conform to the principle of photometric constancy, minimizing photometric errors on such reflective surfaces can lead to significant inaccuracies in the estimated depth. + +![](images/fd973c8069afd7b7b67dd5e88e6c3133d3e0f57098724bd75196963450c4a0d0.jpg) +(a). cross-view warping + +![](images/f225c3e7dcd6cb7a8dc4bf21a08dadd237c64009b75dfa2a53726a5550436104.jpg) +(b). photometric error of pos. & neg. pairs +Figure 2: The effect of the proposed method on reflective/non-reflective surfaces. $(\odot / \odot, \odot)$ imply the projected non-reflective/reflective surface points, respectively, and $(\odot, \odot)$ denotes the location of reflection lobe in view-synthesized image coordinate. Our proposed method cancels out the wrong photometric error minimization in reflection areas by contrasting the negative pair samples. + +# 3.2 METHODOLOGY + +# 3.2.1 REFLECTIVE REGION LOCALIZATION + +The photometric error, as calculated through Equation 4 between $I_{s2r}$ and $I_{ref}$ tends to be smaller in non-reflective regions. This is because these areas reflect consistent colors and luminances irrespective of the viewing direction, adhering to the photometric constancy principle. On the other hand, reflective regions, which violate the photometric constancy principle, exhibit abnormally low disparities due to the additional distance from the reflected light source. Consequently, as illustrated in Figure 2, reflection lobes from different images appear relatively closer in image coordinates, resulting in reduced photometric errors in the RGB images of two different viewpoints. + +This characteristic is crucial for isolating reflective regions within the spatial dimension of the image. To capitalize on this, we first generate cross-view synthesized images $I_{s2r}$ , $I_{r2s}$ in a manner similar to the process outlined in Equation 3: + +$$ +\left(\mathbf {I} _ {s 2 r}\right) _ {:, u, v} = \mathbf {I} _ {s r c} \left(\left\langle K [ R | t ] _ {r 2 s} \left(\mathbf {D} _ {r e f}\right) _ {:, u, v} K ^ {- 1} [ u, v, 1 ] ^ {T} \right\rangle\right), \tag {5} +$$ + +$$ +\left(\mathbf {I} _ {r 2 s}\right) _ {:, u, v} = \mathbf {I} _ {r e f} \left(\left\langle \boldsymbol {K} [ \boldsymbol {R} | \boldsymbol {t} ] _ {s 2 r} \left(\mathbf {D} _ {s r c}\right) _ {:, u, v} \boldsymbol {K} ^ {- 1} [ u, v, 1 ] ^ {T} \right\rangle\right), \tag {6} +$$ + +where the relative pose $[R|t]_{s2r}$ can be obtained by computing the inverse of the predicted pose $[R|t]_{r2s}$ , and $\mathbf{D}_{src}$ is predicted depth from $\mathbf{I}_{src}$ , following a procedure similar to Equation 1. Utilizing these synthesized cross-view images, we compute two photometric errors to measure discrepancies between image pairs as follows: + +$$ +\mathbf {E} ^ {+} = \mathcal {P} \left(\mathbf {I} _ {s 2 r}, \mathbf {I} _ {r e f}\right), \quad \mathbf {E} ^ {-} = \mathcal {P} \left(\mathbf {I} _ {s 2 r}, \mathbf {I} _ {r 2 s}\right). \tag {7} +$$ + +The first error, $\mathbf{E}^{+}$ , quantifies discrepancies between images taken from the same viewpoint $(\mathbf{I}_{s2r},\mathbf{I}_{ref})$ . This error is minimized when depth and pose are accurately estimated on non-reflective surfaces. Conversely, the second error, $\mathbf{E}^{-}$ , measures discrepancies between images from different viewpoints $(\mathbf{I}_{s2r},\mathbf{I}_{r2s})$ . In general, the expected photometric error for $\mathbf{E}^{-}$ should be substantial due to the different camera coordinate systems. However, on reflective surfaces, the variations in light reflection may result in a reduced photometric error. Based on these observations, we identify pixel-level reflective regions $\mathbf{M}_r\in \mathbb{R}^{1\times h\times w}$ as follows: + +$$ +\left(\mathbf {M} _ {r}\right) _ {:, u, v} = \left\{ \begin{array}{l l} 1, & \text {i f} \left(\mathbf {E} ^ {-}\right) _ {:, u, v} - \left(\mathbf {E} ^ {+}\right) _ {:, u, v} \leq \delta , \\ 0, & \text {e l s e}, \end{array} \right. \tag {8} +$$ + +where $\delta$ is a certain margin that represents the minimum significant photometric difference required to distinguish between the two surface types, where a value of 1 corresponds to a reflective pixel and 0 to a non-reflective pixel, respectively. This method effectively utilizes discrepancies in photometric errors to distinguish between reflective and non-reflective surfaces, providing a precise mapping of surface properties within the image. (refer to Section D in the supplementary materials.) + +# 3.2.2 REFLECTION-AWARE TRIPLET MINING LOSS + +We introduce the reflection-aware triplet mining loss, $\mathcal{L}_{tri}$ , which addresses the limitations of using $\mathbf{E}^{+}$ alone in environments where reflections disrupt depth accuracy. In reflective regions, simply minimizing $\mathbf{E}^{+}$ does not effectively discern between real and reflected disparities. To counteract this, we assert that $\mathbf{E}^{-}$ should be significantly greater than $\mathbf{E}^{+}$ . This approach is inspired by triplet mining techniques that aim to minimize the distance within positive pairs and maximize it within negative pairs, enhancing the model's ability to distinguish between reflective and non-reflective surfaces. To implement this, we formulate the reflection-aware triplet mining loss as follows: + +$$ +\mathcal {L} _ {t r i} \left(\mathbf {I} _ {r e f}, \mathbf {I} _ {s 2 r}, \mathbf {I} _ {r 2 s}\right) = \mathbf {M} _ {r} \odot \left(\mathbf {E} ^ {+} - \mathbf {E} ^ {-} + \delta\right) _ {\text {h i n g e}} + \left(1 - \mathbf {M} _ {r}\right) \odot \mathbf {E} ^ {+}, \tag {9} +$$ + +where $(\cdot)_{hinge}$ is the hinge loss function described in Hearst et al. (1998). In this configuration, the reflection-aware triplet mining loss is applied specifically to regions identified as reflective. For non-reflective regions, where reflections do not disrupt photometric assessments, we apply the photometric loss $\mathbf{E}^{+}$ as it reliably reflects photometric consistency. This differentiation allows the model to address the unique challenges presented by each type of region effectively. + +As illustrated in Figure 2, this strategy involves not only penalizing the minimization of $\mathbf{E}^{+}$ but also actively maximizing $\mathbf{E}^{-}$ . This method effectively counteracts the contaminated gradients typically found in reflective regions. By adjusting the balance between $\mathbf{E}^{+}$ and $\mathbf{E}^{-}$ based on the presence of reflective surfaces, our method not only improves depth estimation in complex scenarios but also ensures robust performance against the challenges posed by reflective surfaces. This comprehensive approach results in a model that accurately reflects the true topography of both reflective and non-reflective environments. + +# 3.2.3 REFLECTION-AWARE KNOWLEDGE DISTILLATION + +The proposed end-to-end training scheme described in Section 3.2.2 effectively handles the depth estimation on both reflective and non-reflective surfaces. To further refine depth estimation quality, we introduce a reflection-aware knowledge distillation strategy inspired by the fusion techniques discussed in Shi et al. (2023), aimed at retaining high-frequency details in depth prediction. + +Our approach begins by training two separate SSMDE networks. The first is trained using our reflection-aware triplet mining loss, $\mathcal{L}_{tri}$ , as defined in Equation 9, and the second employs the conventional photometric loss, $\mathbf{E}^{+}$ . From these models, we generate two types of depth maps: $\mathbf{D}_{tri}$ , derived from the reflection-aware model, and $\mathbf{D}_{ori}$ , obtained from the model trained with conventional photometric loss. We then merge these depth maps into a single pseudo depth map $\mathbf{D}_{pse}$ utilizing a reflective region mask $\mathbf{M}_r$ . This mask facilitates the adaptive fusing of depth information from both teacher models based on the presence of reflective properties in the image. The pseudo depth map generation and distillation process is detailed in the following equation: + +$$ +\mathcal {L} _ {r k d} (\hat {\mathbf {D}}, \mathbf {D} _ {p s e}) = | \log \hat {\mathbf {D}} - \log \mathbf {D} _ {p s e} |, \text {w h e r e} \mathbf {D} _ {p s e} = \mathbf {M} _ {r} \odot \mathbf {D} _ {t r i} + (1 - \mathbf {M} _ {r}) \odot \mathbf {D} _ {o r i}, \tag {10} +$$ + +where $\hat{\mathbf{D}}$ represents the depth predicted by the student model. It is important to note that the student model and the two teacher models share the same network architecture as the general SSMDEs. This structured training approach not only addresses the specific challenges posed by reflective surfaces but also ensures that the high-frequency detail is not lost, thus achieving a balanced and accurate depth prediction across different surface types. + +# 4 EXPERIMENTS + +Datasets. ScanNet (v2) (Dai et al., 2017) is a comprehensive indoor RGB-D video dataset comprising 2.7 million images across 1,216 interior scene sequences. Traditionally, this dataset has been pivotal for evaluating multi-view stereo (Im et al., 2019; Bae et al., 2022) and scene reconstruction applications (Murez et al., 2020; Zhou et al., 2024). KITTI (Geiger et al., 2013) captures autonomous driving information from outdoor scenes via cameras and lidar sensors and is the most representative and long-standing benchmark for depth estimation research. NYU-v2 (Silberman et al., 2012) serves as one of the most established and widely used benchmarks for depth estimation, as it provides a diverse set of indoor scenes with varying lighting conditions and a wide variety of objects, captured + +Table 1: Main results on the ScanNet-Reflection Test and Validation sets. + +
BackboneTraining SchemeMethodAbs Rel ↓Sq Rel ↓RMSE ↓RMSE log ↓δ < 1.25 ↑δ < 1.252 ↑δ < 1.253 ↑
ScanNet-Reflection TestMonodepth2End-to-EndSelf-Supervised0.1810.1600.5210.2210.7580.9320.976
Ours0.1570.0960.4680.2010.7620.9490.988
Multi-StageSelf-Teaching0.1790.1460.5020.2180.7500.9380.980
3D Distillation0.1560.0960.4590.1950.7660.9450.988
Ours†0.1500.0870.4460.1920.7770.9550.990
HRDepthEnd-to-EndSelf-Supervised0.1820.1680.5300.2250.7490.9370.979
Ours0.1570.0980.4700.2010.7630.9520.989
Multi-StageSelf-Teaching0.1750.1450.4920.2150.7570.9360.982
3D Distillation0.1520.0890.4510.1900.7710.9560.990
Ours†0.1500.0920.4340.1920.7800.9500.988
MonoViTEnd-to-EndSelf-Supervised0.1540.1290.4580.1970.8220.9550.979
Ours0.1360.0870.4140.1780.8310.9670.988
Multi-StageSelf-Teaching0.1510.1300.4390.1910.8370.9500.978
3D Distillation0.1270.0690.3790.1620.8460.9610.992
Ours†0.1260.0740.3950.1670.8540.9690.990
ScanNet-Reflection ValidationMonodepth2End-to-EndSelf-Supervised0.2060.2270.5840.2460.7500.9120.961
Ours0.1660.1250.4920.2090.7630.9340.981
Multi-StageSelf-Teaching0.1920.1880.5480.2330.7640.9200.967
3D Distillation0.1560.0930.4420.1910.7860.9430.987
Ours†0.1510.1050.4540.1930.7960.9440.985
HRDepthEnd-to-EndSelf-Supervised0.2130.2440.6050.2550.7410.9060.961
Ours0.1670.1270.4960.2100.7700.9370.982
Multi-StageSelf-Teaching0.2020.2080.5650.2430.7560.9140.964
3D Distillation0.1530.0900.4300.1880.7890.9480.989
Ours†0.1510.1040.4500.1920.8000.9490.987
MonoViTEnd-to-EndSelf-Supervised0.1790.2060.5570.2270.8190.9300.963
Ours0.1390.1070.4520.1830.8360.9540.984
Multi-StageSelf-Teaching0.1760.1950.5370.2240.8230.9300.963
3D Distillation0.1260.0680.3670.1590.8510.9650.991
Ours†0.1300.0910.4200.1730.8510.9600.987
+ +using a Kinect sensor. 7-Scenes (Shotton et al., 2013) is a challenging RGB-D dataset captured in indoor scenes with a similar distribution to ScanNet but dominated by non-reflective surfaces. We follow the evaluation protocol of Long et al. (2021); Bae et al. (2022) to demonstrate the cross-dataset generalization performances. Booster (Ramirez et al., 2023) includes a variety of non-Lambertian objects within indoor settings, such as transparent basins, mirrors, and specular surfaces. Following the Costanzino et al. (2023), we use the training split as our test set, which showcases our method's adaptability to more complex scenes. + +Training scenario. In the work of 3D distillation (Shi et al., 2023), the ScanNet dataset has been further segmented into ScanNet-Reflection and ScanNet-NoReflection subsets based on the presence of reflective objects within the scenes. This subdivision results in a ScanNet-Reflection dataset consisting of 45,539 training, 439 validation, and 121 testing samples. Additionally, a ScanNet-NoReflection validation set comprising 1,012 samples evaluates the model's generalization when trained in reflective environments. Aligning with these methodologies, the training process leverages the ScanNet-Reflection train set to simulate real-world scenarios involving reflective surfaces. For the KITTI and NYU-v2 experimental setups, we follow the training protocol of Godard et al. (2019), incorporating our reflection-aware triplet loss and distillation training procedure. All experiments conducted on KITTI and NYU-v2 utilized a ResNet-18 pose network instead of a GT pose. + +Evaluation. For quantitative evaluations, we employ standard metrics from the depth estimation literature (Eigen et al., 2014; Geiger et al., 2012). We differentiate our training approaches into end-to-end and multi-stage (distillation) strategies to effectively assess the models. The model trained solely using reflection-aware triplet mining loss $\mathcal{L}_{tri}$ , referred to as "Ours", and another utilizing the proposed distillation method $\mathcal{L}_{rkd}$ , referred to as "Ours†", are evaluated under their respective conditions. We compare these against both end-to-end and multi-stage baselines across three sets: ScanNet-Reflection {Test, Validation} sets, and ScanNet-NoReflection Validation set. For the KITTI (Geiger et al., 2013) and NYU-v2 (Silberman et al., 2012) datasets, we follow the standard evaluation protocol of Godard et al. (2019). To underline the cross-dataset generalizability of our methods, we also perform zero-shot evaluations on the 7-Scenes and Booster. + +Table 2: Main results on the ScanNet-NoReflection Validation set. + +
BackboneTraining SchemeMethodAbs Rel ↓Sq Rel ↓RMSE ↓RMSE log ↓δ < 1.25 ↑δ < 1.252 ↑δ < 1.253 ↑
Monodepth2End-to-EndSelf-Supervised0.1690.1000.3950.2060.7590.9320.979
Ours0.1680.0950.3950.2080.7510.9310.980
Multi-StageSelf-Teaching0.1610.0900.3750.1960.7770.9390.981
3D Distillation0.1590.0870.3730.1950.7790.9410.983
Ours†0.1570.0850.3730.1950.7760.9420.983
HRDepthEnd-to-EndSelf-Supervised0.1690.1020.3880.2020.7660.9330.980
Ours0.1670.0960.3890.2040.7640.9330.979
Multi-StageSelf-Teaching0.1600.0890.3670.1920.7840.9410.982
3D Distillation0.1580.0860.3650.1900.7860.9420.983
Ours†0.1570.0860.3660.1920.7840.9420.983
MonoViTEnd-to-EndSelf-Supervised0.1400.0740.3330.1710.8290.9520.984
Ours0.1410.0720.3380.1740.8230.9520.987
Multi-StageSelf-Teaching0.1340.0680.3170.1640.8400.9560.987
3D Distillation0.1330.0650.3110.1620.8380.9560.987
Ours†0.1330.0660.3200.1660.8370.9570.987
+ +Implementation details. Our experiments incorporate three leading architectures in SSMDE: Monodepth2 (Godard et al., 2019), HRDepth (Lyu et al., 2021), and MonoViT (Zhao et al., 2022), which have demonstrated exceptional performance in previous studies. Each backbone is trained by different training schemes, including Self-Supervised (Godard et al., 2019), Self-Teaching (Poggi et al., 2020), and 3D Distillation (Shi et al., 2023), to compare with our method. To align closely with 3D Distillation, all training particulars follow their documented conditions, with adaptations only in our proposed training strategy. Specifically, the models are trained using the reflection triplet split introduced in 3D Distillation. To finely tune the margin $\delta$ across positive and negative pairs, it is adaptively selected based on the difference between the first quartile (Q1) of $\mathbf{E}^{+}$ and the third quartile (Q3) of $\mathbf{E}^{-}$ . + +# 4.1 EVALUATION ON REFLECTION DATASETS + +ScanNet-Reflection dataset. To demonstrate the effectiveness of the proposed method on reflective surfaces, we conduct a quantitative evaluation using the ScanNet-Reflection dataset. The evaluations are divided into end-to-end and multi-stage methodologies. As depicted in Table 1, Ours, categorized under end-to-end training schemes, significantly outperforms self-supervised methods across all backbones, achieving an Abs Rel average increase of $12.90\%$ in the test split and $21.12\%$ in the validation split. Moreover, it is noteworthy that Ours shows a significant performance boost, with an average improvement of $10.75\%$ over Self-Teaching across all metrics in both the test and validation splits, with only two exceptions in 42 metrics ( $\delta < 1.25$ of Monodepth2 and MonoViT). This demonstrates that our reflection-aware triplet mining loss is effective in detecting reflective surfaces and encourages the model to obtain accurate depth on these surfaces as shown in Figure 3. Additionally, our multi-stage approach, which employs reflection-aware knowledge distillation (denoted as $Ours^{\dagger}$ ), delivers comparable results across all backbone models of 3D Distillation. Note that the proposed method does not require complex scene reconstruction procedures such as mesh rendering (Matl, 2019; Newcombe et al., 2011) or ensembles of multiple neural network models (Lakshminarayanan et al., 2017). + +ScanNet-NoReflection dataset. Table 2 summarizes the results of a quantitative evaluation performed on the ScanNet-NoReflection dataset. This evaluation aims to measure the generalization performance of models trained on datasets that include reflective surfaces. In an end-to-end training scheme, Ours achieves performance comparable to or within an acceptable margin of self-supervised methods. This confirms that our proposed reflection-aware triplet mining loss effectively prevents the incorrect back-propagation of the photometric loss gradient on reflective surfaces, as illustrated in Figure 2. Furthermore, the model trained by our reflection-aware knowledge distillation (i.e., $Ours^{\dagger}$ ) shows a noticeable performance improvement, which is comparable performance to the 3D distillation method. These results suggest that extending our reflection-aware triplet mining loss to distillation techniques offers a straightforward yet effective strategy for managing reflective surfaces. + +![](images/f46e7409ab3377e1e768f53e28633c67a8c2a69f29c265211ee083c11caf2de2.jpg) +Figure 3: Qualitative results of the proposed methods on the ScanNet. We visualize the predicted depth of the Monodepth2 (Godard et al., 2019) trained by three different methods including the proposed method: Self-supervised, Ours and Ours†. Note that the error map represents the absolute difference between prediction and ground truth depth, normalized to between 0 and 255. + +Table 3: Main results on the KITTI and NYU-v2 datasets. + +
BackboneMethodAbs Rel ↓Sq Rel ↓RMSE ↓RMSE log ↓δ < 1.25 ↑δ < 1.252 ↑δ < 1.253 ↑
KITTIMonodepth2Self-Supervised0.1180.9084.9190.1960.8710.9570.980
Ours0.1180.9124.9430.1980.8670.9560.980
Ours†0.1160.8564.7960.1940.8700.9580.981
NYUV2Monodepth2Self-Supervised0.1710.1440.6220.2130.7460.9410.985
Ours0.1660.1390.6160.2090.7590.9430.985
Ours†0.1550.1210.5730.1960.7820.9510.988
+ +KITTI and NYU-v2 datasets. Table 3 presents the quantitative results of the Monodepth2 architecture on the KITTI and NYU-v2 datasets, both widely used for depth estimation. In the KITTI dataset, most scenes share similar attributes and predominantly consist of non-reflective objects, limiting performance improvements in reflective regions. However, as highlighted in our study, our selective triplet mining loss using $M_r$ and the distillation process effectively preserves performance in non-reflective areas. Consequently, our method achieves performance comparable to existing approaches with negligible margins. These results are consistent with the trends observed in the ScanNet-NoReflection validation split experiments presented in Table 2. On the other hand, in the NYU-v2 dataset, where reflections are more prevalent, our triplet mining loss and distillation method yield significant performance gains. These results demonstrate that the broad applicability of our approach to indoor environments with complex light-object interactions, ensuring consistent enhancements even when incorporating a pose network. + +# 4.2 CROSS-DATASET GENERALIZABILITY + +To demonstrate the generalization ability across different datasets, we conduct a zero-shot evaluation using 7-Scenes and Booster datasets. As shown in Table 4, our proposed methods (denoted as Ours and $Ours^{\dagger}$ ) consistently enhances performance. Specifically, across all backbone architectures and all metrics, $Ours^{\dagger}$ improved by an average of $5.47\%$ and $13.89\%$ for the 7-Scenes and Booster datasets, respectively. Exceptionally, there is no significant difference between Ours and the self-supervised method on the 7-Scenes dataset. This may be attributed to the predominance of + +Table 4: Cross-dataset evaluation result on the 7-Scenes and Booster datasets. + +
BackboneMethodAbs Rel ↓Sq Rel ↓RMSE ↓RMSE log ↓δ < 1.25 ↑δ < 1.252 ↑δ < 1.253 ↑
7-ScenesMonodepth2Self-Supervised0.2100.1300.4450.2480.6560.9060.974
Ours0.2070.1250.4410.2480.6560.9040.975
Ours†0.1980.1100.4150.2380.6670.9110.980
HRDepthSelf-Supervised0.1930.1150.4210.2310.6820.9210.982
Ours0.1950.1090.4190.2320.6740.9210.984
Ours†0.1830.0960.3890.2190.7060.9310.986
MonoViTSelf-Supervised0.1730.0930.3650.2010.7520.9450.988
Ours0.1750.0900.3610.2040.7460.9440.987
Ours†0.1620.0770.3350.1910.7760.9510.989
BoosterMonodepth2Self-Supervised0.5200.4290.6010.4440.3050.5910.827
Ours0.4300.3010.5010.3890.3620.6750.893
Ours†0.4190.2880.4870.3810.3700.6780.897
HRDepthSelf-Supervised0.4950.3910.5590.4260.3070.6110.852
Ours0.4140.2760.4820.3790.3640.6800.907
Ours†0.4290.2920.4870.3850.3660.6590.878
MonoViTSelf-Supervised0.4180.3270.5040.3740.4250.6790.888
Ours0.4080.3020.4820.3620.4140.6770.916
Ours†0.3750.2490.4400.3370.4220.7340.944
+ +non-reflective surfaces in the 7-Scenes dataset, where our model, trained with the reflection-aware triplet mining loss, slightly loses high-frequency details on non-reflective surfaces. Conversely, the consistent performance improvement of $Ours^{\dagger}$ across both reflective and non-reflective surfaces demonstrates the robust generalization capabilities of our method based on reflective region selection. + +# 5 CONCLUSION + +This paper addresses the intricate challenge of self-supervised monocular depth estimation on reflective surfaces. Our method employs a novel metric learning approach, centered around a reflection-aware triplet mining loss. This novel loss function significantly improves depth prediction accuracy by accurately identifying reflective regions on a per-pixel basis and effectively adjusting the minimization of photometric errors, which are typically problematic on reflective surfaces. It also preserves high-frequency details on non-reflective surfaces by selectively regulating photometric error minimization based on reflection region selection. Moreover, we introduce a reflection-aware knowledge distillation method, enabling a student model to enhance performance in both reflective and non-reflective surfaces. This method leverages the strengths of different teaching networks to produce a more robust and versatile student model. Experimental evaluations conducted on the indoor scene datasets demonstrate our method consistently enhances depth performance across various architectural frameworks. These results underscore the robustness and versatility of our approach, marking it as a valuable contribution to the field of self-supervised monocular depth estimation. + +# ACKNOWLEDGEMENT + +This work was supported by Korea Research Institute for defense Technology planning and advancement through Defense Innovation Vanguard Enterprise Project, funded by Defense Acquisition Program Administration (R230206) and the National Research Foundation of Korea (NRF) grant funded by the Korea government (MSIT) (No. RS-2023-00210908). + +# REFERENCES + +Gwangbin Bae, Ignas Budvytis, and Roberto Cipolla. Multi-view depth estimation by fusing single-view depth probability with multi-view geometry. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 2842-2851, 2022. + +Jinwoo Bae, Kyumin Hwang, and Sunghoon Im. A study on the generality of neural network structures for monocular depth estimation. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2023a. +Jinwoo Bae, Sungho Moon, and Sunghoon Im. Deep digging into the generalization of self-supervised monocular depth estimation. In Proceedings of the AAAI conference on artificial intelligence, volume 37, pp. 187-196, 2023b. +Ronen Basri and David W Jacobs. Lambertian reflectance and linear subspaces. IEEE transactions on pattern analysis and machine intelligence, 25(2):218-233, 2003. +Shariq Farooq Bhat, Ibrahim Alhashim, and Peter Wonka. Adabins: Depth estimation using adaptive bins. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 4009-4018, 2021. +Ting Chen, Simon Kornblith, Mohammad Norouzi, and Geoffrey Hinton. A simple framework for contrastive learning of visual representations. In ICML, pp. 1597-1607. PMLR, 2020. +Xingyu Chen, Ruonan Zhang, Ji Jiang, Yan Wang, Ge Li, and Thomas H Li. Self-supervised monocular depth estimation: Solving the edge-fattening problem. In Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision, pp. 5776-5786, 2023. +Xinlei Chen and Kaiming He. Exploring simple siamese representation learning. In CVPR, pp. 15750-15758, 2021. +Wonhyeok Choi, Mingyu Shin, and Sunghoon Im. Depth-discriminative metric learning for monocular 3d object detection. Advances in Neural Information Processing Systems, 36, 2024. +Alex Costanzino, Pierluigi Zama Ramirez, Matteo Poggi, Fabio Tosi, Stefano Mattoccia, and Luigi Di Stefano. Learning depth estimation for transparent and mirror surfaces. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 9244-9255, 2023. +Angela Dai, Angel X Chang, Manolis Savva, Maciej Halber, Thomas Funkhouser, and Matthias Nießner. Scannet: Richly-annotated 3d reconstructions of indoor scenes. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 5828-5839, 2017. +Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, et al. An image is worth 16x16 words: Transformers for image recognition at scale. arXiv preprint arXiv:2010.11929, 2020. +David Eigen, Christian Puhrsch, and Rob Fergus. Depth map prediction from a single image using a multi-scale deep network. Advances in neural information processing systems, 27, 2014. +Rizhao Fan, Matteo Poggi, and Stefano Mattoccia. Contrastive learning for depth prediction. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 3225-3236, 2023. +Huan Fu, Mingming Gong, Chaohui Wang, Kayhan Batmanghelich, and Dacheng Tao. Deep ordinal regression network for monocular depth estimation. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 2002-2011, 2018. +Ravi Garg, Vijay Kumar Bg, Gustavo Carneiro, and Ian Reid. Unsupervised cnn for single view depth estimation: Geometry to the rescue. In Computer Vision-ECCV 2016: 14th European Conference, Amsterdam, The Netherlands, October 11-14, 2016, Proceedings, Part VIII 14, pp. 740-756. Springer, 2016. +Stefano Gasperini, Nils Morbitzer, HyunJun Jung, Nassir Navab, and Federico Tombari. Robust monocular depth estimation under challenging conditions. In Proceedings of the IEEE/CVF international conference on computer vision, pp. 8177-8186, 2023. +A Geiger, M Nießner, M Pollefeys, C Rother, D Scharstein, AA Hassan, A Dai, K Honauer, J Janai, T Sattler, et al. Robust vision challenge. In CVPR Workshop, 2018. + +Andreas Geiger, Philip Lenz, and Raquel Urtasun. Are we ready for autonomous driving? the kitti vision benchmark suite. In 2012 IEEE conference on computer vision and pattern recognition, pp. 3354-3361. IEEE, 2012. +Andreas Geiger, Philip Lenz, Christoph Stiller, and Raquel Urtasun. Vision meets robotics: The kitti dataset. The International Journal of Robotics Research, 32(11):1231-1237, 2013. +Clément Godard, Oisin Mac Aodha, and Gabriel J Brostow. Unsupervised monocular depth estimation with left-right consistency. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 270-279, 2017. +Clément Godard, Oisin Mac Aodha, Michael Firman, and Gabriel J Brostow. Digging into self-supervised monocular depth estimation. In Proceedings of the IEEE/CVF international conference on computer vision, pp. 3828-3838, 2019. +Vitor Guizilini, Rares Ambrus, Sudeep Pillai, Allan Raventos, and Adrien Gaidon. 3d packing for self-supervised monocular depth estimation. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 2485-2494, 2020. +Mu He, Le Hui, Yikai Bian, Jian Ren, Jin Xie, and Jian Yang. Ra-depth: Resolution adaptive self-supervised monocular depth estimation. In European Conference on Computer Vision, pp. 565-581. Springer, 2022. +Marti A. Hearst, Susan T Dumais, Edgar Osuna, John Platt, and Bernhard Scholkopf. Support vector machines. IEEE Intelligent Systems and their applications, 13(4):18-28, 1998. +Sunghoon Im, Hae-Gon Jeon, Stephen Lin, and In So Kweon. Dpsnet: End-to-end deep plane sweep stereo. arXiv preprint arXiv:1905.00538, 2019. +Prannay Khosla, Piotr Teterwak, Chen Wang, Aaron Sarna, Yonglong Tian, Phillip Isola, Aaron Maschinot, Ce Liu, and Dilip Krishnan. Supervised contrastive learning. NeurIPS, 33:18661-18673, 2020. +Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014. +Lingdong Kong, Shaoyuan Xie, Hanjiang Hu, Lai Xing Ng, Benoit Cottereau, and Wei Tsang Ooi. Robodepth: Robust out-of-distribution depth estimation under corruptions. Advances in Neural Information Processing Systems, 36, 2024. +Balaji Lakshminarayanan, Alexander Pritzel, and Charles Blundell. Simple and scalable predictive uncertainty estimation using deep ensembles. Advances in neural information processing systems, 30, 2017. +Jin Han Lee, Myung-Kyu Han, Dong Wook Ko, and Il Hong Suh. From big to small: Multi-scale local planar guidance for monocular depth estimation. arXiv preprint arXiv:1907.10326, 2019. +Xiaoxiao Long, Lingjie Liu, Wei Li, Christian Theobalt, and Wenping Wang. Multi-view depth estimation using epipolar spatio-temporal networks. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 8258-8267, 2021. +Xiaoyang Lyu, Liang Liu, Mengmeng Wang, Xin Kong, Lina Liu, Yong Liu, Xinxin Chen, and Yi Yuan. Hr-depth: High resolution self-supervised monocular depth estimation. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 35, pp. 2294-2301, 2021. +Matthew Matl. Pyrender. https://github.com/mmat1/pyrender, 2019. +Zak Murez, Tarrence Van As, James Bartolozzi, Ayan Sinha, Vijay Badrinarayanan, and Andrew Rabinovich. Atlas: End-to-end 3d scene reconstruction from posed images. In Computer Vision-ECCV 2020: 16th European Conference, Glasgow, UK, August 23-28, 2020, Proceedings, Part VII 16, pp. 414-431. Springer, 2020. + +Richard A Newcombe, Shahram Izadi, Otmar Hilliges, David Molyneaux, David Kim, Andrew J Davison, Pushmeet Kohi, Jamie Shotton, Steve Hodges, and Andrew Fitzgibbon. Kinectfusion: Real-time dense surface mapping and tracking. In 2011 10th IEEE international symposium on mixed and augmented reality, pp. 127-136. IEEE, 2011. +Matteo Poggi, Filippo Aleotti, Fabio Tosi, and Stefano Mattoccia. On the uncertainty of self-supervised monocular depth estimation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 3227-3237, 2020. +Pierluigi Zama Ramirez, Alex Costanzino, Fabio Tosi, Matteo Poggi, Samuele Salti, Stefano Mattoccia, and Luigi Di Stefano. Booster: a benchmark for depth from images of specular and transparent surfaces. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2023. +Kieran Saunders, George Vogiatzis, and Luis J Manso. Self-supervised monocular depth estimation: Let's talk about the weather. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 8907-8917, 2023. +Florian Schroff, Dmitry Kalenichenko, and James Philbin. Facenet: A unified embedding for face recognition and clustering. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 815-823, 2015. +Xuepeng Shi, Georgi Dikov, Gerhard Reitmayr, Tae-Kyun Kim, and Mohsen Ghafoorian. 3d distillation: Improving self-supervised monocular depth estimation on reflective surfaces. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 9133-9143, 2023. +Jamie Shotton, Ben Glocker, Christopher Zach, Shahram Izadi, Antonio Criminisi, and Andrew Fitzgibbon. Scene coordinate regression forests for camera relocalization in rgb-d images. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 2930-2937, 2013. +Nathan Silberman, Derek Hoiem, Pushmeet Kohli, and Rob Fergus. Indoor segmentation and support inference from rgbd images. In Computer Vision-ECCV 2012: 12th European Conference on Computer Vision, Florence, Italy, October 7-13, 2012, Proceedings, Part V 12, pp. 746-760. Springer, 2012. +Adrian Spurr, Aneesh Dahiya, Xi Wang, Xuong Zhang, and Otmar Hilliges. Self-supervised 3d hand pose estimation from monocular rgb via contrastive learning. In ICCV, pp. 11230-11239, 2021. +Yaoming Wang, Yangzhou Jiang, Jin Li, Bingbing Ni, Wenrui Dai, Chenglin Li, Hongkai Xiong, and Teng Li. Contrastive regression for domain adaptation on gaze estimation. In CVPR, pp. 19376-19385, 2022. +Zhou Wang, Alan C Bovik, Hamid R Sheikh, and Eero P Simoncelli. Image quality assessment: from error visibility to structural similarity. IEEE transactions on image processing, 13(4):600-612, 2004. +Kaiwen Zha, Peng Cao, Jeany Son, Yuzhe Yang, and Dina Katabi. Rank-n-contrast: Learning continuous representations for regression. Advances in Neural Information Processing Systems, 36, 2024. +Ning Zhang, Francesco Nex, George Vosselman, and Norman Kerle. Lite-mono: A lightweight cnn and transformer architecture for self-supervised monocular depth estimation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 18537-18546, 2023. +Chaoqiang Zhao, Youmin Zhang, Matteo Poggi, Fabio Tosi, Xianda Guo, Zheng Zhu, Guan Huang, Yang Tang, and Stefano Mattoccia. Monovit: Self-supervised monocular depth estimation with a vision transformer. In 2022 International Conference on 3D Vision (3DV), pp. 668-678. IEEE, 2022. +Chaoqiang Zhao, Matteo Poggi, Fabio Tosi, Lei Zhou, Qiyu Sun, Yang Tang, and Stefano Mattoccia. Gasmono: Geometry-aided self-supervised monocular depth estimation for indoor scenes. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 16209-16220, 2023. + +Hang Zhou, David Greenwood, and Sarah Taylor. Self-supervised monocular depth estimation with internal feature fusion. arXiv preprint arXiv:2110.09482, 2021. + +Tinghui Zhou, Matthew Brown, Noah Snavely, and David G Lowe. Unsupervised learning of depth and ego-motion from video. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 1851-1858, 2017. + +Xiaowei Zhou, Haoyu Guo, Sida Peng, Yuxi Xiao, Haotong Lin, Qianqian Wang, Guofeng Zhang, and Hujun Bao. Neural 3d scene reconstruction with indoor planar priors. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2024. + +# A MORE DETAILED EXPERIMENTAL SETUPS + +As aforementioned in the main manuscripts, we follow all training details and experimental setups mentioned in 3D Distillation (Shi et al., 2023). We train all models with the reflection triplet split proposed by 3D Distillation for 41 epochs through the Adam optimizer (Kingma & Ba, 2014) with an image resolution of $384 \times 288$ , implemented in PyTorch. The training batch sizes of the Monodepth2 (Godard et al., 2019), HRDepth (Lyu et al., 2021), and MonoViT (Zhao et al., 2022) are $\{12, 12, 8\}$ , respectively. The initial learning rate is $10^{-4}$ , and we adopt the multi-step learning rate scheduler that decays the learning rate by $\gamma = 0.1$ once the number of epochs reaches one of the milestones [26, 36]. Moreover, with 3D Distillation, the pose between cameras is ground truth during training, and the minimum and maximum depths used for training and evaluation are $0.1\mathrm{m}$ and $10\mathrm{m}$ . In our evaluation, we do not apply post-processing techniques such as averaging the estimates of both the flipped and original images or using median scaling. + +Table 5: Main results on the ScanNet-Original Test and Validation sets. + +
BackboneTraining SchemeMethodScanNet-Original Test Set
Abs Rel ↓Sq Rel ↓RMSE ↓RMSE log ↓δ < 1.25 ↑δ < 1.252 ↑δ < 1.253 ↑
Monodepth2End-to-EndSelf-Supervised Ours0.1890.1160.4070.2170.7310.9210.974
0.1850.1090.4050.2170.7300.9230.975
Multi-StageSelf-Teaching 3D Distillation Ours†0.1840.1090.3920.2100.7420.9250.976
0.1810.1050.3880.2080.7460.9270.976
0.1750.0980.3850.2060.7460.9300.979
HRDepthEnd-to-EndSelf-Supervised Ours0.1840.1110.3990.2120.7390.9250.976
0.1860.1060.3970.2130.7350.9270.977
Multi-StageSelf-Teaching 3D Distillation Ours†0.1780.1020.3810.2040.7520.9310.979
0.1760.0980.3780.2020.7540.9320.979
0.1730.0960.3750.2020.7550.9340.980
MonoViTEnd-to-EndSelf-Supervised Ours0.1540.0820.3430.1820.8010.9480.984
0.1550.0810.3450.1850.7950.9450.984
Multi-StageSelf-Teaching 3D Distillation Ours†0.1520.0810.3290.1770.8110.9480.983
0.1490.0750.3240.1740.8120.9490.985
0.1490.0750.3350.1790.8050.9490.980
BackboneTraining SchemeMethodScanNet-Original Val. Set
Abs Rel ↓Sq Rel ↓RMSE ↓RMSE log ↓δ < 1.25 ↑δ < 1.252 ↑δ < 1.253 ↑
Monodepth2End-to-EndSelf-Supervised Ours0.1670.1000.3850.2030.7640.9350.981
0.1620.0900.3780.2010.7650.9370.983
Multi-StageSelf-Teaching 3D Distillation Ours†0.1600.0900.3650.1930.7800.9410.983
0.1570.0830.3570.1900.7820.9430.985
0.1530.0800.3580.1900.7830.9440.985
HRDepthEnd-to-EndSelf-Supervised Ours0.1660.1000.3810.2000.7710.9370.982
0.1600.0890.3730.1970.7720.9410.984
Multi-StageSelf-Teaching 3D Distillation Ours†0.1590.0900.3600.1900.7850.9430.984
0.1540.0800.3490.1860.7880.9450.986
0.1510.0780.3500.1860.7900.9480.987
MonoViTEnd-to-EndSelf-Supervised Ours0.1380.0770.3310.1710.8310.9550.986
0.1370.0690.3280.1720.8260.9580.989
Multi-StageSelf-Teaching 3D Distillation Ours†0.1330.0710.3140.1630.8440.9590.988
0.1280.0600.2960.1570.8460.9620.990
0.1290.0620.3100.1630.8400.9610.990
+ +# B EVALUATIONS ON SCANNET DATASET + +To demonstrate the generalizability of our proposed method, we conduct the experiment on several ScanNet (Dai et al., 2017) splits denoted as ScanNet-Original {Test, Val.} sets and ScanNet-Robust Test set following Shi et al. (2023) and Fu et al. (2018); Bae et al. (2022), respectively. ScanNet-Original sets include both reflective and non-reflective surfaces, it is well-suited to evaluate the impact of reflective surfaces on training comprehensively. In addition, the ScanNet-Robust test set was used to measure the generalization performance of Monocular Depth Estimation in the Robust Vision Challenge 2018 (Geiger et al., 2018), as it is small-scale but suitable for evaluating generalization performance. + +# B.1 EVALUATION ON SCANNET-ORIGINAL SETS + +Table 5 summarizes the quantitative evaluation results of the ScanNet-Original sets. We achieve steady performance improvement across most metrics for all backbone models in the end-to-end training scheme, suggesting that the proposed method minimizes the influence of reflective surfaces, which contributes to the general depth estimation performance improvement. Furthermore, Our multi-stage training scheme (i.e., $Ours^{\dagger}$ ) dramatically elevates performance across various depth estimation models. For Monodepth2, $Ours^{\dagger}$ achieves a remarkable average increase of $5.28\%$ on the test set and $6.52\%$ on the validation set across all metrics. HRDepth reaps substantial benefits, with improvements of $4.83\%$ on the test set and $7.19\%$ on the validation set. Likewise, MonoViT consistently gains, with enhancements of $2.28\%$ on the test set and $5.59\%$ on the validation set. When benchmarked against 3D Distillation (Shi et al., 2023), $Ours^{\dagger}$ provides an enhanced performance for Monodepth2, showing an average increase of $1.76\%$ on the test set and $0.87\%$ on the validation set. HRDepth also gains an average of $0.71\%$ on the test set and $0.69\%$ on the validation set. However, for MonoViT, $Ours^{\dagger}$ shows a slight decline, with decreases of $1.09\%$ on the test set and $1.92\%$ on the validation set compared to 3D Distillation. + +Table 6: Main results on the ScanNet-Robust Test set. + +
BackboneMethodScanNet-Robust Test Set
Abs Rel ↓Sq Rel ↓RMSE ↓RMSE log ↓δ < 1.25 ↑δ < 1.252 ↑δ < 1.253 ↑
Monodepth2Self-Supervised0.1930.1180.3950.2190.7290.9210.973
Ours0.1860.1070.3880.2160.7290.9260.976
Ours†0.1790.0990.3710.2070.7440.9300.978
HRDepthSelf-Supervised0.1900.1120.3870.2160.7290.9240.976
Ours0.1880.1070.3840.2150.7310.9260.976
Ours†0.1770.0950.3620.2030.7500.9350.979
MonoViTSelf-Supervised0.1580.0820.3280.1810.7990.9480.984
Ours0.1550.0780.3270.1830.7980.9490.985
Ours†0.1500.0730.3190.1780.8060.9520.986
+ +# B.2 EVALUATION ON SCANNET-ROBUST TEST SET + +Table 6 summarizes the quantitative evaluation results of the ScanNet-Robust test set. Due to the 3D-distillation baselines (Shi et al., 2023) did not release the source code, and the reported performance on this split not existing, we compare the models trained by our methods to the self-supervised methods across three backbones, similar to previous experiments. As depicted in Table 6, our proposed methods (i.e., Ours, $Ours^{\dagger}$ ) achieve significant performance gains for all evaluation metrics and all backbones, consistently. Specifically, for Monodepth2, Ours and $Ours^{\dagger}$ demonstrate an average performance improvement of $2.42\%$ and $5.49\%$ , respectively, across all metrics. Similarly, for HRDepth, Ours showed an average improvement of $1.03\%$ , and $Ours^{\dagger}$ achieved a $5.55\%$ increase in performance across all metrics. In the case of MonoViT, Ours resulted in an average performance improvement of $0.87\%$ , and $Ours^{\dagger}$ achieved a $3.13\%$ improvement across all metrics. The consistent improvements across all metrics for Monodepth2, HRDepth, and MonoViT indicate that our methods effectively mitigate the risk of erroneous learning induced by reflective surfaces. + +Table 7: Evaluation results on the ScanNet-Reflection Test set for the combination of state-of-the-art self-supervised monocular depth framework and our approach. + +
BackboneMethodAbs Rel ↓Sq Rel ↓RMSE ↓RMSE log ↓δ < 1.25 ↑δ < 1.252 ↑δ < 1.253 ↑
RA-DepthSelf-Supervised0.1610.1240.4770.2030.7790.9470.981
RA-Depth +Ltri0.1380.0910.4440.1860.8040.9630.987
RA-Depth +Ltri + Lrkd0.1300.0760.4020.1710.8340.9660.990
GasMonoSelf-Supervised0.1560.1230.4620.1980.8100.9490.980
GasMono +Ltri0.1390.0890.4250.1780.8270.9640.989
GasMono +Ltri + Lrkd0.1270.0720.3860.1640.8430.9680.993
Lite-monoSelf-Supervised0.1790.1720.5170.2210.7750.9350.973
Lite-mono +Ltri0.1590.1130.4620.2010.7750.9470.983
Lite-mono +Ltri + Lrkd0.1480.1010.4330.1900.7880.9600.984
+ +# C EXTENSIBILITY ANALYSIS OF THE PROPOSED METHOD + +To demonstrate performance improvements not only across different architectures but also by applying our method while preserving state-of-the-art methodologies, we evaluate the three outperforming SSMDE models, including RA-Depth (He et al., 2022), GasMono (Zhao et al., 2023), Lite-mono (Zhang et al., 2023), which have own unique methods (e.g., iterative self-distillation in GasMono). We apply our reflection-aware triplet mining loss (denoted as $\lfloor$ Baseline $\rfloor +\mathcal{L}_{tri}$ , and reflection-aware knowledge distillation method (denoted as [Baseline] $^+$ $\mathcal{L}_{tri} + \mathcal{L}_{rkd}$ ) to each baseline. Table 7 summarizes the results of the ScanNet-Reflection test split, comparing the performance of each method when incorporating the triplet loss and our distillation method. The results demonstrate that our method provides substantial performance gains even for recent SoTA methods, underscoring its robustness to reflective surfaces. + +Table 8: Evaluation results on the ScanNet-Reflection Validation and ScanNet-NoReflection Validation sets. w.r.t. reflective region mask $M_r$ . + +
BackboneMethodScanNet-Reflection Validation SetScanNet-NoReflection Validation Set
Abs Rel ↓Sq Rel ↓RMSE ↓δ < 1.253 ↑Abs Rel ↓Sq Rel ↓RMSE ↓δ < 1.253 ↑
Monodepth2Mr=00.2060.2270.5840.9610.1690.1000.3950.979
Mr=10.1700.1320.5050.9790.1710.0990.4020.978
Ours0.1660.1250.4920.9810.1680.0950.3950.980
HRDepthMr=00.2130.2440.6050.9610.1690.1020.3880.980
Mr=10.1840.1670.5640.9650.1790.1130.4330.968
Ours0.1670.1270.4960.9820.1670.0960.3890.979
MonoViTMr=00.1790.2060.5570.9630.1400.0740.3330.984
Mr=10.1550.1510.5270.9710.1680.1120.4200.954
Ours0.1390.1070.4520.9840.1410.0720.3380.987
+ +# D IMPACT OF THE REFLECTION-AWARE TRIPLET MINING LOSS W.R.T. REFLECTIVE REGION LOCALIZATION + +As aforementioned in the main manuscript, the proposed reflection-aware triplet mining loss is applied to reflective regions, thus preserving performance in non-reflective regions. To validate this claim, we conduct an experiment to evaluate the impact of varying the reflection mask $M_{r}$ with three configurations as follows: + +1. $M_r = 0$ : This configuration exactly corresponds to the traditional self-supervised method without the triplet mining loss. +2. $M_r = 1$ : In this configuration, the triplet loss is applied to both reflective and non-reflective regions of the image. +3. Ours: This configuration leverages $M_r$ , which is calculated through Equation 8 in the main manuscript, to selectively regulate the reflective regions. + +![](images/bd76c1d0474a06790c8dcb85b0c45caaf5a0d50757c55a923b85168b62921594.jpg) +Figure 4: Qualitative results of the proposed methods w.r.t. reflective region mask $M_{r}$ . + +As shown in Table 8, the results demonstrate that Ours significantly improves performance on reflective datasets while maintaining comparable performance on non-reflective regions when compared to the first configuration (denoted as $M_r = 0$ ). On the other hand, applying the triplet mining loss across all regions ( $M_r = 1$ ) led to some performance improvement in reflective regions but resulted in a notable drop in performance in non-reflective regions compared to other configurations. These findings verify that the proposed reflection-aware triplet mining loss effectively identifies reflective regions and applies the triplet loss selectively, thereby preserving the performance in non-reflective regions. + +Table 9: Computational overhead comparison. + +
MethodTaskTraining cost (hours)
Self-supervised (1)End-to-end training11.5
Ours (triplet loss) (2)End-to-end training14.1
Ours (distillation) (3)Multi-stage training27.3
3D Distillation (4)Total (1+2+3+4)95.5
1. Ensemble model pre-training65.8
2. Ensemble model inference time4.8
3. Mesh reconstruction and rendering11.7
4. Student model training13.2
+ +# E COMPUTATIONAL OVERHEAD COMPARISON WITH 3D DISTILLATION + +The proposed triplet mining loss has a negligible impact on the training cost of the model. Although the proposed simple distillation method involves multi-stage training and incurs additional training costs, it remains significantly more efficient than the existing 3D distillation approach (Shi et al., 2023). To provide clarity, we summarized the training costs of Monodepth2 (Godard et al., 2019) under four scenarios: (1) training with traditional self-supervision, (2) applying our triplet loss, (3) applying our proposed distillation method, and (4) employing the 3D distillation approach. All training times were measured using a single RTX A6000 GPU, as detailed in the Table 9. + +![](images/3cb16c5823099c0b430b795f28b708c7ea3abaf7ce73b59807fc1967e5079f44.jpg) +(a) Qualitative results of the proposed methods on the 7-Scenes dataset. + +![](images/d950987df14e11b90e30c88547970e6ec53ecccbec3a6e6efdf35e13f66b095b.jpg) +(b) Qualitative results of the proposed methods on the Booster dataset. +Figure 5: Qualitative results of the proposed methods on the 7-scenes and Booster datasets. Note that the error map represents the absolute difference between prediction and ground truth depth, normalized to between 0 and 255. + +# F QUALITATIVE RESULTS ON 7-SCENES AND BOOSTER DATASETS + +We provide additional qualitative results of the proposed methods denoted as Ours and $Ours^{\dagger}$ as discussed in Table 4 of the main manuscript, utilizing the 7-Scenes (Shotton et al., 2013) and Booster (Ramirez et al., 2023) datasets. In Figure 5, we showcase the predicted depth and error map of the Monodepth2 trained by self-supervised, $\mathcal{L}_{tri}$ , and $\mathcal{L}_{rkd}$ . Our methods alleviate the black-hole effect on specular highlight regions while preserving high-frequency details on non-reflective areas. + +As demonstrated by the qualitative evaluation of the 7-Scenes dataset, our proposed methods exhibit robustness to reflective surfaces and impressive performance in preserving details on non-reflective surfaces in other indoor scenes that are similar to the training environment. + +# G LIMITATIONS + +Despite the promising results, our study has several limitations. One major limitation is that the proposed method cannot handle transparent or mirror (ToM) objects. Secondly, a few cases do not satisfy the assumption of Equation 8 of the manuscript (e.g., surfaces including multiple reflection lobes). Lastly, similar to 3D distillation (Shi et al., 2023), the conducted experiments assume that the ground truth camera pose is known during training. Future research should aim to address this limitation by exploring more effective solutions. We encourage future researchers to further investigate this issue and develop improved methodologies to overcome these challenges. \ No newline at end of file diff --git a/ICLR/2025/Self-supervised Monocular Depth Estimation Robust to Reflective Surface Leveraged by Triplet Mining/images.zip b/ICLR/2025/Self-supervised Monocular Depth Estimation Robust to Reflective Surface Leveraged by Triplet Mining/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..99d40e13ee9a20fece40d0d5eb84d50f458d1b05 --- /dev/null +++ b/ICLR/2025/Self-supervised Monocular Depth Estimation Robust to Reflective Surface Leveraged by Triplet Mining/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4ea36526c3f2f2b888da646f7bf04a65d8f41bd1c46bffe858d0091735fd303b +size 1292856 diff --git a/ICLR/2025/Self-supervised Monocular Depth Estimation Robust to Reflective Surface Leveraged by Triplet Mining/layout.json b/ICLR/2025/Self-supervised Monocular Depth Estimation Robust to Reflective Surface Leveraged by Triplet Mining/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..02732cf69e400205fc9121904af6150beeb81833 --- /dev/null +++ b/ICLR/2025/Self-supervised Monocular Depth Estimation Robust to Reflective Surface Leveraged by Triplet Mining/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:11e7540e49172290f6297f86b9fe59b5af89590ea49837827309d4774c7381ec +size 498830 diff --git a/ICLR/2025/Self-supervised contrastive learning performs non-linear system identification/4fc900f3-6859-4627-bb32-13948617f6d5_content_list.json b/ICLR/2025/Self-supervised contrastive learning performs non-linear system identification/4fc900f3-6859-4627-bb32-13948617f6d5_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..202932bc0df24b8bc22408e3470464fcc9f3e9ad --- /dev/null +++ b/ICLR/2025/Self-supervised contrastive learning performs non-linear system identification/4fc900f3-6859-4627-bb32-13948617f6d5_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:93c1e1713ffb041e3601f0d6da66bd33128d05113ee786adf9a7f25632340678 +size 241688 diff --git a/ICLR/2025/Self-supervised contrastive learning performs non-linear system identification/4fc900f3-6859-4627-bb32-13948617f6d5_model.json b/ICLR/2025/Self-supervised contrastive learning performs non-linear system identification/4fc900f3-6859-4627-bb32-13948617f6d5_model.json new file mode 100644 index 0000000000000000000000000000000000000000..273cdcd46bbda2bf3a87f7943b8bf13e85e35169 --- /dev/null +++ b/ICLR/2025/Self-supervised contrastive learning performs non-linear system identification/4fc900f3-6859-4627-bb32-13948617f6d5_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2cc657111b5f9fa69e4a8e5d957c0e26f047f711aa7534a47256b02548f0a1d9 +size 283383 diff --git a/ICLR/2025/Self-supervised contrastive learning performs non-linear system identification/4fc900f3-6859-4627-bb32-13948617f6d5_origin.pdf b/ICLR/2025/Self-supervised contrastive learning performs non-linear system identification/4fc900f3-6859-4627-bb32-13948617f6d5_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..7517061191774c5b3a5e8d77e6f67c7ee1eec9c9 --- /dev/null +++ b/ICLR/2025/Self-supervised contrastive learning performs non-linear system identification/4fc900f3-6859-4627-bb32-13948617f6d5_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4fceaf0a4a2bac3bb4d929a879bc0e6ff67de6f4662dc8666934e56035793867 +size 8356271 diff --git a/ICLR/2025/Self-supervised contrastive learning performs non-linear system identification/full.md b/ICLR/2025/Self-supervised contrastive learning performs non-linear system identification/full.md new file mode 100644 index 0000000000000000000000000000000000000000..e9cf3d22e17703c8cfbe04c0f56c64dd88f6b4a9 --- /dev/null +++ b/ICLR/2025/Self-supervised contrastive learning performs non-linear system identification/full.md @@ -0,0 +1,1056 @@ +# SELF-SUPERVISED CONTRASTIVE LEARNING PERFORMS NON-LINEAR SYSTEM IDENTIFICATION + +Rodrigo González Laiz*, Tobias Schmidt* & Steffen Schneider† + +Institute of Computational Biology, Computational Health Center, Helmholtz Munich and Munich Center for Machine Learning (MCML) + +# ABSTRACT + +Self-supervised learning (SSL) approaches have brought tremendous success across many tasks and domains. It has been argued that these successes can be attributed to a link between SSL and identifiable representation learning: Temporal structure and auxiliary variables ensure that latent representations are related to the true underlying generative factors of the data. Here, we deepen this connection and show that SSL can perform system identification in latent space. We propose dynamics contrastive learning, a framework to uncover linear, switching linear and non-linear dynamics under a non-linear observation model, give theoretical guarantees and validate them empirically. Code: github.com/dynamical-inference/dcl + +# 1 INTRODUCTION + +The identification and modeling of dynamics from observational data is a long-standing problem in machine learning, engineering and science. A discrete-time dynamical system with latent variables $\pmb{x}$ , observable variables $\pmb{y}$ , control signal $\pmb{u}$ , its control matrix $B$ , and noise $\varepsilon, \nu$ can take the form + +$$ +\boldsymbol {x} _ {t + 1} = \boldsymbol {f} \left(\boldsymbol {x} _ {t}\right) + \boldsymbol {B} \boldsymbol {u} _ {t} + \varepsilon_ {t} \tag {1} +$$ + +$$ +\boldsymbol {y} _ {t} = \boldsymbol {g} (\boldsymbol {x} _ {t}) + \boldsymbol {\nu} _ {t}. +$$ + +and we aim to infer the functions $f$ and $g$ from a time-series of observations and, when available, control signals. Numerous algorithms have been developed to tackle special cases of this problem formulation, ranging from classical system identification methods (McGee & Schmidt, 1985; Chen & Billings, 1989) to recent generative models (Duncker et al., 2019; Linderman et al., 2017; Hälva et al., 2021). Yet, it remains an open challenge to improve the generality, interpretability and efficiency of these inference techniques, especially when $f$ and $g$ are non-linear functions. + +Contrastive learning (CL) and next-token prediction tasks have become important backbones of modern machine learning systems for learning from sequential data, proving highly effective for building meaningful latent representations (Baevski et al., 2022; Bommasani et al., 2021; Brown, 2020; Oord et al., 2018; LeCun, 2022; Sermanet et al., 2018; Radford et al., 2019). An emerging view is a connection between these algorithms and learning of world models (Ha & Schmidhuber, 2018; Assran et al., 2023; Garrido et al., 2024). However, the theoretical understanding of non-linear system identification by these sequence-learning algorithms remains limited. + +In this work, we revisit and extend contrastive learning in the context of system identification. We uncover several surprising facts about its out-of-the-box effectiveness in identifying dynamics and unveil common design choices in SSL systems used in practice. Our theoretical study extends identifiability results (Hyvarinen & Morioka, 2016; 2017; Hyvarinen et al., 2019; Zimmermann et al., 2021; Roeder et al., 2021) for CL towards dynamical systems. While our theory makes several predictions about capabilities of standard CL, it also highlights shortcomings. To overcome these and enable interpretable dynamics inference across a range of data generating processes, we propose a general framework for linear and non-linear system identification with CL (Figure 1). + +Background. An influential motivation of our work is Contrastive Predictive Coding (CPC; Oord et al., 2018). CPC can be recovered as a special case of our framework when using an RNN dynamics + +model. Related works have emerged across different modalities: wav2vec (Schneider et al., 2019), TCN (Sermanet et al., 2018) and CPCv2 (Henaff, 2020). In the field of system identification, notable approaches include the Extended Kalman Filter (EKF) (McGee & Schmidt, 1985) and NARMAX (Chen & Billings, 1989). Additionally, several works have also explored generative models for general dynamics (Duncker et al., 2019) and switching dynamics, e.g. rSLDS (Linderman et al., 2017). In the Nonlinear ICA literature, identifiable algorithms for time-series data, such as Time Contrastive Learning (TCL; Hyvarinen & Morioka, 2016) for non-stationary processes and Permutation Contrastive Learning (PCL; Hyvarinen & Morioka, 2017) for stationary data have been proposed, with recent advances like SNICA (Hälvä et al., 2021) for more generally structured data-generating processes. + +In contrast to previous work, we focus on bridging time-series representation learning through contrastive learning with the identification of dynamical systems, both theoretically and empirically. Moreover, by not relying on an explicit data-generating model, our framework offers greater flexibility. We extend and discuss the connections to related work in more detail in Appendix C. + +Contributions. We extend the existing theory on contrastive learning for time series learning and make adaptations to common inference frameworks. We introduce our CL variant (Fig. 1) in section 2, and give an identifiability result for both the latent space and the dynamics model in section 3. These theoretical results are later empirically validated. We then propose a practical way to parameterize switching linear dynamics in section 4 and demonstrate that this formulation corroborates our theory for both switching linear system dynamics and non-linear dynamics in sections 5-6. + +![](images/789e72eb678a2e05c898a921af37f0e5924f410e8a072691faeb3adf36b491e0.jpg) +Figure 1: DCL framework: The encoder $\pmb{h}$ is shared across the reference $\pmb{y}_t$ , positive $\pmb{y}_{t + 1}$ and negative samples $\pmb{y}_i^-$ . A dynamics model $\hat{\pmb{f}}$ forward predicts the reference. A (possibly latent) variable $z$ can parameterize the dynamics (cf. §4) or external control (cf. §I). The model fits the InfoNCE loss $(\mathcal{L})$ . + +# 2 CONTRASTIVE LEARNING FOR TIME-SERIES + +In contrastive learning, we aim to model similarities between pairs of data points (Figure 1). Our full model $\psi$ is specified by the log-likelihood + +$$ +\log p _ {\psi} (\boldsymbol {y} | \boldsymbol {y} ^ {+}, N) = \psi (\boldsymbol {y}, \boldsymbol {y} ^ {+}) - \log \sum_ {\boldsymbol {y} ^ {-} \in N \cup \{\boldsymbol {y} ^ {+} \}} \exp (\psi (\boldsymbol {y}, \boldsymbol {y} ^ {-})). \tag {2} +$$ + +where $\pmb{y}$ is often called the reference or anchor sample, $\pmb{y}^{+}$ is a positive sample, $\pmb{y}^{-} \in N$ are negative examples, and $N$ is the set of negative samples. The model $\psi$ itself is parameterized as a composition of an encoder, a dynamics model, and a similarity function and will be defined further below. We fit the model by minimizing the negative log-likelihood on the time series, + +$$ +\min _ {\psi} \mathcal {L} [ \psi ] = \min _ {\psi} \mathbb {E} _ {t, t _ {1}, \dots , t _ {M} \sim U (1, T)} \left[ - \log p _ {\psi} \left(\boldsymbol {y} _ {t + 1} \mid \boldsymbol {y} _ {t}, \left\{\boldsymbol {y} _ {t _ {m}} \right\} _ {m = 1} ^ {M}\right) \right] \tag {3} +$$ + +where positive examples are just adjacent points in the time-series, and $M$ negative examples are sampled uniformly across the dataset. $U(1,T)$ denotes a uniform distribution across the discrete time steps. + +To attain favourable properties for identifying the latent dynamics, we carefully design the hypothesis class for $\psi$ . The motivation for this particular design will become clear later. To define the full model, a composition of several functions is necessary. Recall from Eq. 1 that the dynamics model is given as $\pmb{f}$ and the mixing function is $\pmb{g}$ . Correspondingly, our model is composed of the encoder $\pmb{h}:\mathbb{R}^D\mapsto \mathbb{R}^d$ (de-mixing), the dynamics model $\hat{\pmb{f}}:\mathbb{R}^d\mapsto \mathbb{R}^d$ , the similarity function $\phi :\mathbb{R}^d\times \mathbb{R}^d\mapsto \mathbb{R}$ and a correction term $\alpha :\mathbb{R}^d\mapsto \mathbb{R}$ . We define their composition as1 + +$$ +\psi (\boldsymbol {y}, \boldsymbol {y} ^ {\prime}) := \phi (\hat {\boldsymbol {f}} (\boldsymbol {h} (\boldsymbol {y})), \boldsymbol {h} (\boldsymbol {y} ^ {\prime})) - \alpha (\boldsymbol {y} ^ {\prime}), \tag {4} +$$ + +and call the resulting algorithm dynamics contrastive learning (DCL). Intuitively, we obtain two observed samples $(\pmb{y},\pmb{y}^{\prime})$ which are first mapped to the latent space, $(h(\pmb{y}),h(\pmb{y}^{\prime}))$ . Then, the + +![](images/22b6366221fa389d6ef6362941b820a4e2c577c11f056f76fdcf76e74f154606.jpg) + +![](images/f8502a061856e486d4a0b3556b568cbe1caf73770bfc9b904b3361180d1e3bb9.jpg) +Figure 2: Graphical intuition behind Theorem 1. (a), the ground truth latent space is mapped to observables through the injective mixing function $g$ . Our model maps back into the latent space. The composition of mixing and de-mixing by the model is an affine transform. (b), dynamics in the ground-truth space are mapped to the latent space. By observing variations introduced by the system noise $\varepsilon$ , our model is able to infer the ground-truth dynamics up to an affine transform. + +dynamics model is applied to $h(y)$ , and the resulting points are compared through the similarity function $\phi$ . The similarity function $\phi$ will be informed by the form of (possibly induced) system noise $\varepsilon_{t}$ . In the simplest form, the noise can be chosen as isotropic Gaussian noise, which results in a negative squared Euclidean norm for $\phi$ . + +Note, the additional term $\alpha(\pmb{y}')$ is a correction applied to account for non-uniform marginal distributions. It can be parameterized as a kernel density estimate (KDE) with $\log \hat{q}(\pmb{h}(\pmb{y}')) \approx \log q(\pmb{x}')$ around the datapoints. In very special cases, the KDE makes a difference in empirical performance (App. B, Fig. 9) and is required for our theory. Yet, we found that on the time-series datasets considered, it was possible to drop this term without loss in performance (i.e., $\alpha(\pmb{y}') = 0$ ). + +# 3 STRUCTURAL IDENTIFIABILITY OF NON-LINEAR LATENT DYNAMICS + +We now study the aforementioned model theoretically. The key components of our theory along with our notion of linear identifiability (Roeder et al., 2021; Khemakhem et al., 2020) are visualized in Figure 2. We are interested in two properties. First, linear identifiability of the latent space: The composition of mixing function $\pmb{g}$ and model encoder $h$ should recover the ground-truth latents up to a linear transform. Second, identifiability of the (non-linear) dynamics model: We would like to relate the estimated dynamics $\hat{\pmb{f}}$ to the underlying ground-truth dynamics $\pmb{f}$ . This property is also called structural identifiability (Bellman & Åström, 1970). Our model operates on a subclass of Eq. 1 with the following properties: + +Data-generating process. We consider a discrete-time dynamical system defined as + +$$ +\boldsymbol {x} _ {t + 1} = \boldsymbol {f} \left(\boldsymbol {x} _ {t}\right) + \varepsilon_ {t}, \quad \boldsymbol {y} _ {t} = \boldsymbol {g} \left(\boldsymbol {x} _ {t}\right), \tag {5} +$$ + +where $\pmb{x}_t\in \mathbb{R}^d$ are latent variables, $\pmb {f}:\mathbb{R}^d\mapsto \mathbb{R}^d$ is a bijective dynamics model, $\varepsilon_{t}\in \mathbb{R}^{d}$ the system noise, and $\pmb {g}:\mathbb{R}^d\mapsto \mathbb{R}^D$ is a non-linear injective mapping from latents to observables $\pmb {y}_t\in \mathbb{R}^D$ $d\leq D$ . We sample a total number of $T$ time steps. + +We proceed by stating our main result: + +Theorem 1 (Contrastive estimation of non-linear dynamics). Assume that + +- (A1) A time-series dataset $\{\pmb{y}_t\}_{t=1}^T$ is generated according to the ground-truth dynamical system in Eq. 5 with a bijective dynamics model $\pmb{f}$ and an injective mixing function $\pmb{g}$ . +- (A2) The system noise follows an iid normal distribution, $p(\varepsilon_t) = \mathcal{N}(\varepsilon_t | 0, \Sigma_{\varepsilon})$ . +- (A3) The model $\psi$ is composed of an encoder $h$ , a dynamics model $\pmb{f}$ , a correction term $\alpha$ , and the similarity metric $\phi(\pmb{u}, \pmb{v}) = -\|\pmb{u} - \pmb{v}\|^2$ and attains the global minimizer of Eq. 3. + +Then, in the limit of $T \to \infty$ for any point $x$ in the support of the data marginal distribution: + +(a) The composition of mixing and de-mixing $\pmb{h}(\pmb{g}(\pmb{x})) = \pmb{L}\pmb{x} + \pmb{b}$ is a bijective affine transform, and $\pmb{L} = \pmb{Q}\pmb{\Sigma}_{\epsilon}^{-1/2}$ with unknown orthogonal transform $\pmb{Q} \in \mathbb{R}^{d \times d}$ and offset $\pmb{b} \in \mathbb{R}^d$ . +(b) The estimated dynamics $\pmb{f}$ are bijective and identify the true dynamics $\pmb{f}$ up to the relation $\hat{\pmb{f}}(\pmb{x}) = \pmb{L}\pmb{f}(\pmb{L}^{-1}(\pmb{x} - \pmb{b})) + \pmb{b}$ . + +Proof. See Appendix A for the full proof, and see Fig. 2 for a graphical intuition of both results. + +With this main result in place, we can make statements for several systems of interest; specifically linear dynamics in latent space: + +Corollary 1. Contrastive learning without dynamics model, $\pmb{f}(\pmb{x}) = \pmb{x}$ , cannot identify latent dynamics. + +In this case, even for a linear ground truth dynamics model, $\pmb{f}(\pmb{x}) = \pmb{A}\pmb{x}$ , we would require that after model fitting, $\hat{\pmb{f}}(\pmb{x}) = \pmb{x} = \pmb{L}\pmb{A}\pmb{L}^{-1}\pmb{x} + \pmb{b}$ , which is impossible (Theorem 1b; also see App. Eq. 22). We can fix this case by either decoupling the two encoders (Appendix D), or taking a more structured approach and parameterizing a dynamics model with a dynamics matrix: + +Corollary 2. For a ground-truth linear dynamical system $\pmb{f}(\pmb{x}) = \pmb{A}\pmb{x}$ and dynamics model $\hat{\pmb{f}}(\pmb{x}) = \hat{\pmb{A}}\pmb{x}$ , we identify the latents up to $\pmb{h}(\pmb{g}(\pmb{x})) = \pmb{L}\pmb{x} + \pmb{b}$ and dynamics with $\hat{\pmb{A}} = \pmb{L}\pmb{A}\pmb{L}^{-1}$ . + +This means that simultaneously fitting the system dynamics and encoding model allows us to recover the system matrix up to an indeterminacy. + +Note on Assumptions. The required assumptions are rather practical: (A1) allows for a very broad class of dynamical systems as long as bijectivity of the dynamics model holds, which is the case of many systems used in the natural sciences. We consider dynamical systems with control signal $\pmb{u}_t$ in Appendix I. While (A2) is a very common one in dynamical systems modeling, it can be seen more strict: We either need knowledge about the form of system noise, or inject such noise. We should note that analogous to the discussion of Zimmermann et al. (2021), it is most certainly possible to extend our results towards other classes of noise distributions by matching the log-density of $\varepsilon$ with $\phi$ . Given the common use of Normally distributed noise, however, we limited the scope of the current theory to the Normal distribution, but show vMF noise in Appendix D. (A3) mainly concerns the model setup. An apparent limitation of Def. 5 is the injectivity assumption imposed on the mixing function $\pmb{g}$ . In practice, a partially observable setting often applies, where $\pmb{g}(\pmb{x}) = C\pmb{x}$ maps latents into lower dimensional observations or has a lower rank than there are latent dimensions. For these systems, we can ensure injectivity through a time-lag embedding. See Appendix H for empirical validation. + +# 4 $\nabla$ -SLDS: TOWARDS NON-LINEAR DYNAMICS ESTIMATION + +Piecewise linear approximation of dynamics. Our theoretical results suggest that contrastive learning allows the fitting of nonlinear bijective dynamics. This is a compelling result, but in practice it requires the use of a powerful, yet easy to parameterize dynamics model. One option is to use an RNN (Elman, 1990; Oord et al., 2018) or a Transformer (Vaswani, 2017) model to perform this link across timescales. An alternative option is to linearize the system, which we propose in the following. + +We propose a new forward model for differentiable switching linear dynamics $(\nabla$ -SLDS) in latent space. The estimation is outlined in Figure 3. This model allows fast estimation of switching dynamics and can be easily integrated into the DCL algorithm. The dynamics model has a trainable bank $\mathbf{W} = [\mathbf{W}_1, \dots, \mathbf{W}_K]$ of possible dynamics matrices. $K$ is a hyperparameter. The dynamics depend on a latent variable $k_{t}$ and are defined as + +$$ +\hat {\pmb {f}} (\pmb {x} _ {t}; \pmb {\mathsf {W}}, k _ {t}) = \pmb {W} _ {k _ {t}} \pmb {x} _ {t}, \quad k _ {t} = \operatorname * {a r g m i n} _ {k} \| \pmb {W} _ {k} \pmb {x} _ {t} - \pmb {x} _ {t + 1} \| ^ {2}. (6) +$$ + +![](images/b3be70aabcee077feb8d2c6eb4c1f3fb479146738f3af6bafac69a0ff34a0c73.jpg) +Figure 3: The core components of the $\nabla$ -SLDS model is parameter-free, differentiable parameterization of the switching process. + +Intuitively, the predictive performance of every available linear dynamical system is used to select the right dynamics with index $k_{t}$ from the bank $\mathbf{W}$ . During training, we approximate the argmin using the Gumbel-Softmax trick (Jang et al., 2016) without hard sampling: + +$$ +\hat {\boldsymbol {f}} (\boldsymbol {x} _ {t}; \boldsymbol {W}, \boldsymbol {z} _ {t}) = \left(\sum_ {k = 1} ^ {K} z _ {t, k} \boldsymbol {W} _ {k}\right) \boldsymbol {x} _ {t}, \quad z _ {t, k} = \frac {\exp \left(\lambda_ {k} / \tau\right)}{\sum_ {j} \exp \left(\lambda_ {j} / \tau\right)}, \quad \lambda_ {k} = \frac {1}{\| \boldsymbol {W} _ {k} \boldsymbol {x} _ {t} - \boldsymbol {x} _ {t + 1} \| ^ {2}} + g _ {k}. \tag {7} +$$ + +Note that the dynamics model $\hat{\pmb{f}}(\pmb{x}_t; \mathbf{W}, \pmb{z}_t)$ depends on an additional latent variable $\pmb{z}_t = [z_{t,1}, \dots, z_{t,K}]^\top$ which contains probabilities to parametrize the dynamics. During inference, we + +can obtain the index $k_{t} = \arg \max_{k} z_{t,k}$ . The variables $g_{k}$ are samples from the Gumbel distribution (Jang et al., 2016) and we use a temperature $\tau$ to control the smoothness of the resulting probabilities. During pilot experiments, we found that the reciprocal parameterization of the logits outperforms other choices for computing an argmin, like flipping the sign. + +From linear switching to non-linear dynamics. Non-linear system dynamics of the general form in Eq. 5 can be approximated using our switching model. We can approximate a continuous-time non-linear dynamical system with latent dynamics $\dot{\pmb{x}} = \pmb{f}(\pmb{x})$ around reference points $\{\tilde{\pmb{x}}_k\}_{k=1}^K$ using a first-order Taylor expansion, $\pmb{f}(\pmb{x}) \approx \tilde{\pmb{f}}(\pmb{x}) = \pmb{f}(\tilde{\pmb{x}}_k) + \pmb{J}_f(\tilde{\pmb{x}}_k)(\pmb{x} - \tilde{\pmb{x}}_k)$ , where we denote the Jacobian matrix of $\pmb{f}$ with $\pmb{J}_f$ . We evaluate the equation at each point $t$ using the best reference point $\tilde{\pmb{x}}_k$ . We obtain system matrices $\pmb{A}_k = \pmb{J}_f(\tilde{\pmb{x}}_k)$ and bias term $\pmb{b}_k = \pmb{f}(\tilde{\pmb{x}}_k) - \pmb{J}_f(\tilde{\pmb{x}}_k)\tilde{\pmb{x}}_k$ which can be modeled with the $\nabla$ -SLDS model $\hat{\pmb{f}}(\pmb{x}_t; k_t)$ : + +$$ +\boldsymbol {x} _ {t + 1} = \left(\boldsymbol {A} _ {k _ {t}} \boldsymbol {x} _ {t} + \boldsymbol {b} _ {k _ {t}}\right) + \varepsilon_ {t} =: \hat {\boldsymbol {f}} \left(\boldsymbol {x} _ {t}; k _ {t}\right) + \varepsilon_ {t}. \tag {8} +$$ + +While a theoretical guarantee for this general case is beyond the scope of this work, we give an empirical evaluation on Lorenz attractor dynamics below. Note, as the number of "basis points" of $\nabla$ -SLDS approaches the number of time steps, we could trivially approach perfect estimation capability of the latents as we store the exact value of $f$ at every point. However, this comes at the expense of having less points to estimate each individual dynamics matrix. Empirically, we used 100-200 matrices for datasets of 1M samples. + +# 5 EXPERIMENTS + +To verify our theory, we implement a benchmark dataset for studying the effects of various model choices. We generate time-series with 1M samples, either as a single sequence or across multiple trials. Our experiments rigorously evaluate different variants of contrastive learning algorithms. + +Data generation. Data is generated by simulating latent variables $\pmb{x}$ that evolve according to a dynamical system (Eq. 5). These latent variables are then passed through a nonlinear mixing function $\pmb{g}$ to produce the observable data $\pmb{y}$ . The mixing function $\pmb{g}$ consists of a nonlinear injective component which is parameterized by a randomly initialized 4-layer MLP (Hyvarinen & Morioka, 2016), and a linear map to a 50-dimensional space. The final mixing function is defined as their composition. We ensure the injectivity of the resulting function by monitoring the condition number of each matrix layer, following previous work (Hyvarinen & Morioka, 2016; Zimmermann et al., 2021). + +LDS. We simulate 1M datapoints in 3D space following $\pmb{f}(\pmb{x}_t) = \pmb{A}\pmb{x}_t$ with system noise standard deviation $\sigma_{\epsilon} = 0.01$ and choose $\pmb{A}$ to be an orthogonal matrix to ensure stable dynamics with all eigenvalues equal to 1. We do so by taking the product of multiple rotation matrices, one for each possible plane to rotate around with rotation angles being randomly chosen to be $-5^{\circ}$ or $5^{\circ}$ . + +SLDS. We simulate switching linear dynamical systems with $\pmb{f}(\pmb{x}_t; k_t) = \pmb{A}_{k_t}\pmb{x}_t$ and system noise standard deviation $\sigma_{\epsilon} = 0.0001$ . We choose $A_k$ to be an orthogonal matrix ensuring that all eigenvalues are 1, which guarantees system stability. Specifically, we set $A_k$ to be a rotation matrix with varying rotation angles $(5^\circ, 10^\circ, 20^\circ)$ . The latent dimensionality is 6. The number of samples is 1M. We use 1000 trials, and each trial consists of 1000 samples. We use $k = 0, 1, \dots, K$ distinct modes following a mode sequence $i_t$ . The mode sequence $i_t$ follows a Markov chain with a symmetric transition matrix and uniform prior: $i_0 \sim \mathrm{Cat}(\pi)$ , where $\pi_j = \frac{1}{K}$ for all $j$ . At each time step, $i_{t+1} \sim \mathrm{Cat}(\Pi_{i_t})$ , where $\Pi$ is a transition matrix with uniform off-diagonal probabilities set to $10^{-4}$ . Example data is visualized in Figure 4 and Appendix E. + +Non-linear dynamics. We simulate 1M points of a Lorenz system, with equations + +$$ +\boldsymbol {f} \left(\boldsymbol {x} _ {t}\right) = \boldsymbol {x} _ {t} + d t \left[ \sigma \left(x _ {2, t} - x _ {1, t}\right), x _ {1, t} \left(\left(\rho - x _ {3, t}\right) - x _ {2, t}\right), \left(x _ {1, t} x _ {2, t} - \beta x _ {3, t}\right) \right] ^ {\top} \tag {9} +$$ + +with varying $dt$ , parameters $\sigma = 10$ , $\beta = \frac{8}{3}$ , $\rho = 28$ and system noise standard deviation $\sigma_{\epsilon} = 0.001$ . The observable data, $y$ . We then apply our non-linear mixing function as for other datasets. + +Model estimation. For the feature encoder $h$ , baseline and our model use an MLP with three layers followed by GELU activations (Hendrycks & Gimpel, 2016). Model capacity scales with the embedding dimensionality $d$ . The last hidden layer has $10d$ units and all previous layers have $30d$ units. For the SLDS and LDS datasets, we train on batches with 2048 samples each (reference + +Table 1: Overview about identifiability of latent dynamics for different modeling choices: We show different data generating processes characterized by the form of the ground truth dynamics $\mathbf{f}$ , the distribution $p(\varepsilon)$ and different model choices for the estimated dynamics $\hat{\mathbf{f}}$ . We compare identity dynamics, linear dynamics (LDS), switching linear dynamics (SLDS), and Lorenz attractor dynamics (Lorenz), and optionally initialize the dynamics model with the ground-truth dynamics (GT). For every combination we indicate whether we can provide theoretical identifiability guarantees ("theory") and compare this to empirical identifiability measures $(R^2$ , LDS, dynR $^2$ ). Mean $\pm$ std. are across 3 datasets (5 for Lorenz) and 3 experiment repeats. + +
DataModelResults
fp(ε)fidentifiable%R2↑LDS [×10-2]↓
identityNormalidentity✓99.56 ± 0.210.00 ± 0.00
identityNormalLDS✓99.31 ± 0.430.04 ± 0.01
LDS (low Δt)Normal (large σ)identity-89.22 ± 4.478.53 ± 0.05
LDSNormalidentityX73.56 ± 24.4521.24 ± 0.31
LDSNormalLDS✓99.03 ± 0.410.77 ± 1.07
LDSNormalGT✓99.46 ± 0.390.44 ± 0.43
%R2↑%dynR2↑
SLDSNormalidentityX76.80 ± 7.4085.47 ± 8.07
SLDSNormal∇-SLDS(✓)199.52 ± 0.0599.93 ± 0.01
SLDSNormalGT(✓)199.20 ± 0.1099.97 ± 0.00
Lorenz (small Δt)Normal (large σ)identity-99.74 ± 0.3699.94 ± 0.07
Lorenz (small Δt)Normal (large σ)LDS-98.31 ± 2.5597.21 ± 5.90
Lorenz (small Δt)Normal (large σ)∇-SLDS-94.14 ± 4.3494.20 ± 6.57
LorenzNormalidentityX40.99 ± 8.5827.02 ± 8.72
LorenzNormalLDSX81.20 ± 16.9380.30 ± 14.13
LorenzNormal∇-SLDS(✓)294.08 ± 2.7593.91 ± 5.32
+ +and positive). We use $2^{16} = 65536$ negative samples for SLDS and $20k$ negative samples for LDS data. For the Lorenz data, we use a batch size of 1024 and $20k$ negative samples. We use the Adam optimizer (Kingma, 2014) with learning rates $3 \times 10^{-4}$ for LDS data, $10^{-3}$ for SLDS data, and $10^{-4}$ for Lorenz system data. For the SLDS data, we use a different learning rate of $10^{-2}$ for the parameters of the dynamics model. We train for $50k$ steps on SLDS data and for $30k$ steps for LDS and Lorenz system data. Our baseline model is standard self-supervised contrastive learning with the InfoNCE loss, which is similar to the CEBRA-time model (with symmetric encoders, i.e., without a dynamics model; cf. Schneider et al., 2023). For DCL, we add an LDS or $\nabla$ -SLDS dynamics model for fitting. For our baseline, we post-hoc fit the corresponding model on the recovered latents minimizing the predictive mean squared error via gradient descent. + +Evaluation metrics. Our metrics are informed by the result in Theorem 1 and measure empirical identifiability up to affine transformation of the latent space and its underlying linear or non-linear dynamics. All metrics are estimated on the dataset the model is fit on. See Appendix F for additional discussion on estimating metrics on independently sampled dynamics. + +To account for the affine indeterminacy, we estimate $L$ , $b$ for $\hat{x} = Lx + b$ which allows us to map ground truth latents $x$ to recovered latents $\hat{x}$ (cf. Theorem 1a). In cases where the inverse transform $x = L^{-1}(\hat{x} - b)$ is required, we can either compute $L^{-1}$ directly, or for the purpose of numerical stability estimate it from data, which we denote as $L'$ . The values of $L, b$ and $L', b'$ are computed via a linear regression: + +$$ +\min _ {\boldsymbol {L}, \boldsymbol {b}} \sum_ {t = 1} ^ {T} \| \hat {\boldsymbol {x}} _ {t} - (\boldsymbol {L} \boldsymbol {x} _ {t} + \boldsymbol {b}) \| _ {2} ^ {2} \quad \text {a n d} \quad \min _ {\boldsymbol {L} ^ {\prime}, \boldsymbol {b} ^ {\prime}} \sum_ {t = 1} ^ {T} \| \boldsymbol {x} _ {t} - \left(\boldsymbol {L} ^ {\prime} \hat {\boldsymbol {x}} _ {t} + \boldsymbol {b} ^ {\prime}\right) \| _ {2} ^ {2}. \tag {10} +$$ + +To evaluate the identifiability of the representation, we measure the $R^2$ between the true latents $\pmb{x}_t$ and the optimally aligned recovered latents $\pmb{L}^{\prime}\hat{\pmb{x}}_t + \pmb{b}^{\prime}$ across time steps $t = 1\ldots T$ in the time-series. + +![](images/2c6ead3d2319921d8ed8ed1cbde45ad482a628765cabbd0b167eab25d2102058.jpg) +Figure 4: Switching linear dynamics: (a) example ground-truth dynamics in latent space for four matrices $A_{k}$ . (b) $R^2$ metric for different noise levels as we increase the angles used for data generation. We compare a baseline (no dynamics) to $\nabla$ -SLDS and a model fitted with ground-truth dynamics. (c) cluster accuracies for models shown in (b). + +![](images/37a1904351a5311aab9430bc59115a9a6364ae69155046ee44feefcaa289d5d8.jpg) + +![](images/59f113fb63ca0458edea723a9fdf478bd924654481e84df5ba48e8023f8f7b67.jpg) + +We also propose two metrics as direct measures of identifiability for the recovered dynamics $\hat{f}$ . For linear dynamics models, we introduce the LDS error. It denotes the norm of the difference between the true dynamics matrix $\mathbf{A}$ and the estimated dynamics matrix $\hat{\mathbf{A}}$ by accounting for the linear transformation between the true and recovered latent spaces. The LDS error (related to the metric for Dynamical Similarity Analysis; Ostrow et al., 2023) is computed as (cf. Corollary 2): + +$$ +\operatorname {L D S} (\boldsymbol {A}, \hat {\boldsymbol {A}}) = \| \boldsymbol {A} - \boldsymbol {L} ^ {- 1} \hat {\boldsymbol {A}} \boldsymbol {L} \| _ {F}. \tag {11} +$$ + +As a second, more general identifiability metric for the recovered dynamics $\hat{f}$ , we introduce $\mathrm{dyn}R^2$ , which builds on Theorem 1b to evaluate the identifiability of non-linear dynamics. This metric computes the $R^2$ between the predicted dynamics $\hat{f}$ and the true dynamics $\pmb{f}$ , corrected for the linear transformation between the two latent spaces. Specifically, motivated by Theorem 1(b), we compute + +$$ +\operatorname {d y n} R ^ {2} (\boldsymbol {f}, \hat {\boldsymbol {f}}) = \mathrm {r} 2 \_ \text {s c o r e} (\hat {\boldsymbol {f}} (\hat {\boldsymbol {x}}), \boldsymbol {L} \boldsymbol {f} \left(\boldsymbol {L} ^ {\prime} \hat {\boldsymbol {x}} + \boldsymbol {b} ^ {\prime}\right) + \boldsymbol {b}) \tag {12} +$$ + +along all time steps. Additional variants of the dynR $^2$ metric are discussed in Appendix G. + +Finally, when evaluating switching linear dynamics, we compute the accuracy for assigning the correct mode at any point in time. To compute the cluster accuracy in the case of SLDS ground truth dynamics, we leverage the Hungarian algorithm to match the estimated latent variables modeling mode switches to the ground truth modes, and then proceed to compute the accuracy. + +Implementation. Experiments were carried out on a compute cluster with A100 cards. On each card, we ran $\sim 3$ experiments simultaneously. Depending on the exact configuration, training time varied from $5 - 20\mathrm{min}$ per model. The combined experiments ran for this paper comprised about 120 days of A100 compute time and we provide a breakdown in Appendix K. We will open source our benchmark suite for identifiable dynamics learning upon publication of the paper. + +# 6 RESULTS + +# 6.1 VERIFICATION OF THE THEORY FOR LINEAR DYNAMICS + +Suitable dynamics models enable identification of latents and dynamics. For all considered classes of models, we show in Table 1 that DCL with a suitable dynamics model effectively identifies the correct dynamics. For linear dynamics (LDS), DCL reaches an $R^2$ of $99.0\%$ , close to the oracle performance $(99.5\%)$ . Most importantly, the average LDS error of our method $(7.7 \times 10^{-3})$ is very close to the oracle $(4.4 \times 10^{-3})$ , in contrast to the baseline model $(2.1 \times 10^{-1})$ which has a substantially larger LDS error. In the case of switching linear dynamics (SLDS), DCL also shows strong performance, both in terms of latent $R^2$ $(99.5\%)$ and dynamics $R^2$ $(99.9\%)$ outperforming the respective baselines $(76.8\% R^2$ and $85.5\%$ dynamics $R^2$ ). For non-linear dynamics, the baseline model fails entirely $(41.0\% / 27.0\%)$ , while $\nabla$ -SLDS dynamics can be fitted with $94.1\% R^2$ for latents and $93.9\%$ dynamics $R^2$ . We also clearly see the strength of our piecewise-linear approximation, as the LDS dynamics models only reaches $81.2\%$ latent identifiability and $80.3\%$ dynamics $R^2$ . + +![](images/7fcafc472df55355b3b410aa93f83cee8da2ff8fce7ee7e254d025c980a739ac.jpg) +Figure 5: Contrastive learning of 3D non-linear dynamics following a Lorenz attractor model. (a), left to right: ground truth dynamics for 10k samples with $dt = 0.0005$ and $\sigma = 0.1$ , estimation results for baseline (identity dynamics), DCL with $\nabla$ -SLDS, estimated mode sequence. (b), empirical identifiability $(R^2)$ between baseline (BAS) and $\nabla$ -SLDS for varying numbers of discrete states $K$ . (c, d), same layout but for $dt = 0.01$ and $\sigma = 0.001$ . + +Learning noisy dynamics does not require a dynamics model. If the variance of the distribution for $\varepsilon_{t}$ dominates the changes actually introduced by the dynamics, we find that the baseline model is also able to identify the latent space underlying the system. Intuitively, the change introduced by the dynamical system is then negligible compared to the noise. In Table 1 ("large $\sigma$ ", we show that recovery is possible for cases with small angles, both in the linear and non-linear case. While in some cases, this learning setup might be applicable in practice, it seems generally unrealistic to be able to perturb the system beyond the actual dynamics. As we scale the dynamics to larger values (Figure 4, panel b and c), the estimation scheme breaks again. However, this property offers an explanation for the success of existing contrastive estimation algorithms like CEBRA-time (Schneider et al., 2023) which successfully estimate dynamics in absence of a dynamics model. + +Symmetric encoders cannot identify non-trivial dynamics. In the more general case where the dynamics dominates the system behavior, the baseline cannot identify linear dynamics (or more complicated systems). In the general LDS and SLDS cases, the baseline fails to identify the ground truth dynamics (Table 1) as predicted by Corollary 1 (rows marked with $\pmb{x}$ ). For identity dynamics, the baseline is able to identify the latents ( $R^2 = 99.56\%$ ) but breaks as soon as linear dynamics are introduced ( $R^2 = 73.56\%$ ). + +# 6.2 APPROXIMATION OF NON-LINEAR DYNAMICS + +Next, we study in more details how the DCL can identify piecewise linear or non-linear latent dynamics using the $\nabla$ -SLDS dynamics model. + +Identification of switching dynamics. Switching dynamics are depicted in Fig. 4a for four different modes of the 10 degrees dataset. DCL obtains high $R^2$ for various choices of dynamics (Fig. 4b) and additionally identifies the correct mode sequence (Fig. 4c) for all noise levels and variants of the underlying dynamics. As we increase the rotation angle used to generate the matrices, the gap between baseline and our model increases substantially. + +Non-linear dynamics. Figure 5 depicts the Lorenz system as an example of a non-linear dynamical system for different choices of algorithms. The ground truth dynamics vary in the ratio between $dt / \sigma$ and we show the full range in panels b/c. When the noise dominates the dynamics (panel a), the baseline is able to estimate also the nonlinear dynamics accurately, with $99.7\%$ . However, as we move to lower noise cases (panel b), performance reduces to $41.0\%$ . Our switching dynamics model is able to estimate the system with high $R^2$ in both cases (94.14% and 94.08%). However, note that in this non-linear case, we are primarily succeeding at estimating the latent space, the estimated dynamics model did not meaningfully outperform an identity model (Appendix G). + +Extensions to other distributions $p_{\varepsilon}$ . While Euclidean geometry is most relevant for dynamical systems in practice, and hence the focus of our theoretical and empirical investigation, contrastive learning commonly operates on the hypersphere in other contexts. We provide additional results for the case of a von Mises-Fisher (vMF) distribution for $p_{\varepsilon}$ and dot-product similarity for $\phi$ in Appendix D. + +![](images/65e421871baf55c19469ce5cd21ea438f671c10dd7025696e9207a43acac8264.jpg) +Figure 6: Variations and ablations for the SLDS. We compare the $\nabla$ -SLDS model to the ground-truth switching dynamics (oracle) and a standard CL model without dynamics (baseline). All variations are with respect to the setting with 1M time steps (1k trials $\times$ 1k samples), $L = 4$ mixing layers, $d = 6$ latent dimensionality, 5 modes, and $p = 0.0001$ switching probability. We study the impact of the dataset size in terms of (a) samples per trial, (b) the number of trials, the impact of nonlinearity of the observations in terms of (c) number of mixing layers, the impact of complexity of the latent dynamics in terms of (d) latent dimensionality, (e) number of modes to switch in between and (f) the switching frequency parameterized via the switching probability. + +# 6.3 ABLATION STUDIES + +For practitioners leveraging contrastive learning for statistical analysis, it is important to know the trade-offs in empirical performance in relation to various parameters. In real-world experiments, the most important factors are the size of the dataset, the trial-structure of the dataset, the latent dimensionality we can expect to recover, and the degree of non-linearity between latents and observables. We consider these factors of influence: As a reference, we use the SLDS system with a 6D latent space, 1M samples (1k trials $\times$ 1k samples), $L = 4$ mixing layers, 10 degrees for the rotation matrices, 65,536 negative samples per batch; batch size 2,048, and learning rate $10^{-3}$ . + +Impact of dataset size (Fig. 6a). We keep the number of trials fixed to 1k. As we vary the sample size per trial, $R^2$ degrades for smaller datasets, and for the given setting we need at least 100 points per trial to attain identifiability empirically. We outperform the baseline model in all cases. + +Impact of trials (Fig. 6b). We next simulate a fixed number of 1M datapoints, which we split into trials of varying length. We consider 1k, 10k, 100k, and 1M as trial lengths. Performance is stable for the different settings, even for cases with small trial length (and less observed switching points). DCL consistently outperforms the baseline algorithm and attains stable performance close to the theoretical maximum given by the ground-truth dynamics. + +Impact of non-linear mixing (Fig. 6c). All main experiments have been conducted with $L = 4$ mixing layers in the mixing function $g$ . Performance of DCL stays at the theoretical maximum as we increase the number of mixing layers. As we move beyond four layers, both oracle performance in $R^2$ and our model declines, hinting that either (1) more data or (2) a larger model is required to recover the dynamics successfully in these cases. + +Impact of dimensionality (Fig. 6d). Increasing latent dimensionality does not meaningfully impact performance of our model. We found that for higher dimensions, it is crucial to use a large number of negative examples (65k) for successful training. + +Number of modes for switching linear dynamics fitting (Fig. 6e). Increasing the number of modes in the dataset leads to more successful fitting of the $R^2$ for the baseline model, but to a decline in accuracy. This might be due to the increased variance: While this + +helps the model to identify the latent space (dynamics appear more like noise), it still fails to identify the underlying dynamics model, unlike DCL which attains high $R^2$ and cluster accuracy throughout. + +![](images/9a7541ff4c0657c6a3862dc9d0f119512b783058285d8ddde1ecff41c3b90e0c.jpg) +Figure 7: Impact of modes for non-linear dynamics in the Lorenz system for different system noise levels $\sigma$ , averaged over all $dt$ . + +Robustness to changes in switching probability (Fig. 6f). Finally, we vary the switching probability. Higher switching probability causes shorter modes, which are harder to fit by the $\nabla$ -SLDS dynamics model. Our model obtains high empirical identifiability throughout the experiment, but the accuracy metric begins to decline when $p = 0.1$ and $p = 0.2$ . + +Number of modes for non-linear dynamics fitting (Fig. 7). We study the effect of increasing the number of matrices in the parameter bank $\mathbf{W}$ in the $\nabla$ -SLDS model. The figure depicts the impact of increasing the number of modes for DCL on the non-linear Lorenz dataset. We observe that increasing modes to 200 improves performance, but eventually converges to a stable maximum for all noise levels. + +# 7 DISCUSSION + +The DCL framework is versatile and allows to study the performance of contrastive learning in conjunction with different dynamics models. By exploring various special cases (identity, linear, switching linear), our study categorizes different forms of contrastive learning and makes predictions about their behavior in practice. In comparison to contrastive predictive coding (CPC; Oord et al., 2018) or wav2vec (Schneider et al., 2019), DCL generalizes the concept of training contrastive learning models with (explicit) dynamics models. CPC uses an RNN encoder followed by linear projection, while wav2vec leverages CNNs dynamics models and affine projections. Theorem 1 applies to both these models, and offers an explanation for their successful empirical performance. + +Nonlinear ICA methods, such as TCL (Hyvarinen & Morioka, 2016) and PCL (Hyvarinen & Morioka, 2017) provide identifiability of the latent variables leveraging temporal structure of the data. Compared to DCL, they do not explicitly model dynamics and assume either stationarity or non-stationarity of the time series (Hyvarinen et al., 2023), whereas DCL assumes bijective latent dynamics, and focuses on explicit dynamics modeling beyond solving the demixing problem. + +For applications in scientific data analysis, CEBRA (Schneider et al., 2023) uses supervised or self-supervised contrastive learning, either with symmetric encoders or asymmetric encoder functions. While our results show that such an algorithm is able to identify dynamics for a sufficient amount of system noise, adding dynamics models is required as the system dynamics dominate. Hence, the DCL approach with LDS or $\nabla$ -SLDS dynamics generalises the self-supervised mode of CEBRA and makes it applicable for a broader class of problems. + +Finally, there is a connection to the joint embedding predictive architecture (JEPA; LeCun, 2022; Assran et al., 2023). The architecture setup of DCL can be regarded as a special case of JEPAs, but with symmetric encoders to leverage distillation of the system dynamics into the predictor (the dynamics model). In contrast to JEPAs, the use of symmetric encoders requires a contrastive loss for avoiding collapse and, more importantly, serves as the foundation for our theoretical result. + +A limitation of the present study is its main focus on simulated data which clearly corroborates our theory but does not yet demonstrate real-world applicability. However, our simulated data bears the signatures of real-world datasets (multi-trial structures, varying degrees of dimensionality, number of modes, and different forms of dynamics). A challenge is the availability of real-world benchmark datasets for dynamics identification. We believe that rigorous evaluation of different estimation methods on such datasets will continue to show the promise of contrastive learning for dynamics identification. Integrating recent benchmarks like DynaDojo (Bhamidipaty et al., 2023) or datasets from Chen et al. (2021) with realistic mixing functions $(g)$ offers a promising direction for evaluating latent dynamics models. As a demonstration of real-world applicability, we benchmarked DCL on a neural recordings dataset in Appendix J. + +# 8 CONCLUSION + +We proposed a first identifiable, end-to-end, non-generative inference algorithm for latent switching dynamics along with an empirically successful parameterization of non-linear dynamics. Our results point towards the empirical effectiveness of contrastive learning across time-series, and back these empirical successes by theory. We show empirical identifiability with limited data for linear, switching linear and non-linear dynamics. Our results add to the understanding of SSL's empirical success, will guide the design of future contrastive learning algorithms and most importantly, make SSL amenable for computational statistics and data analysis. + +# REPRODUCIBILITY STATEMENT + +Code. Code is available at https://github.com/dynamical-inference/dcl under an Apache 2.0 license. Experimental and implementation details for the main text are given in section 5 and for each experiment of the Appendix within the respective chapter. +Theory. Our theoretical claims are backed by a complete proof attached in Appendix A. Assumptions are outlined in the main text (Section 3) and again in more detail in Appendix A. +Datasets. We evaluate our experiments on a variety of synthetic datasets. The datasets comprise different dynamical systems, from linear to nonlinear. +Compute. Moderate compute resources are required to reproduce this paper. As stated in section 5, we used around 120 days of GPU compute on a A100 to produce the results presented in the paper. We provide a more detailed breakdown in Appendix K. + +# AUTHOR CONTRIBUTIONS + +RGL and TS: Methodology, Software, Investigation, Writing-Editing. StS: Conceptualization, Methodology, Formal Analysis, Writing-Original Draft and Writing-Editing. + +# ACKNOWLEDGMENTS + +We thank Luisa Eck and Stephen Jiang for discussions on the theory, and Lilly May for input on paper figures. We thank the five anonymous reviewers at ICLR for their valuable and constructive comments on our manuscript. This work was supported by the Helmholtz Association's Initiative and Networking Fund on the HAICORE@KIT and HAICORE@FZJ partitions. + +# REFERENCES + +Guy Ackerson and K Fu. On state estimation in switching environments. IEEE transactions on automatic control, 15(1):10-17, 1970. +Mahmoud Assran, Quentin Duval, Ishan Misra, Piotr Bojanowski, Pascal Vincent, Michael Rabbat, Yann LeCun, and Nicolas Ballas. Self-supervised learning from images with a joint-embedding predictive architecture. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 15619-15629, 2023. +Alexei Baevski, Wei-Ning Hsu, Qiantong Xu, Arun Babu, Jiatao Gu, and Michael Auli. Data2vec: A general framework for self-supervised learning in speech, vision and language. In International Conference on Machine Learning, pp. 1298-1312. PMLR, 2022. +Carles Balsells-Rodas, Yixin Wang, and Yingzhen Li. On the identifiability of switching dynamical systems. arXiv preprint arXiv:2305.15925, 2023. +Ror Bellman and Karl Johan Åström. On structural identifiability. Mathematical biosciences, 7(3-4): 329-339, 1970. +Logan Mondal Bhamidipaty, Tommy Bruzzese, Caryn Tran, Rami Ratl Mrad, and Max Kanwal. Dynadojo: an extensible benchmarking platform for scalable dynamical system identification. In Thirty-seventh Conference on Neural Information Processing Systems Datasets and Benchmarks Track, 2023. +Rishi Bommasani, Drew A Hudson, Ehsan Adeli, Russ Altman, Simran Arora, Sydney von Arx, Michael S Bernstein, Jeannette Bohg, Antoine Bosselut, Emma Brunskill, et al. On the opportunities and risks of foundation models. arXiv preprint arXiv:2108.07258, 2021. +Tom B Brown. Language models are few-shot learners. arXiv preprint arXiv:2005.14165, 2020. +Steven L Brunton, Joshua L Proctor, and J Nathan Kutz. Discovering governing equations from data by sparse identification of nonlinear dynamical systems. Proceedings of the national academy of sciences, 113(15):3932-3937, 2016. +Chaw-Bing Chang and Michael Athans. State estimation for discrete systems with switching parameters. IEEE Transactions on Aerospace and Electronic Systems, (3):418-425, 1978. + +Boyuan Chen, Kuang Huang, Sunand Raghupathi, Ishaan Chandratreya, Qiang Du, and Hod Lipson. Discovering State Variables Hidden in Experimental Data, December 2021. URL http:// arxiv.org/abs/2112.10755. +Ricky TQ Chen, Brandon Amos, and Maximilian Nickel. Learning neural event functions for ordinary differential equations. arXiv preprint arXiv:2011.03902, 2020a. +Sheng Chen and Steve A Billings. Representations of non-linear systems: the narmax model. International journal of control, 49(3):1013-1032, 1989. +Ting Chen, Simon Kornblith, Mohammad Norouzi, and Geoffrey Hinton. A simple framework for contrastive learning of visual representations. In International conference on machine learning, pp. 1597-1607. PMLR, 2020b. +Silvia Chiappa et al. Explicit-duration markov switching models. Foundations and Trends® in Machine Learning, 7(6):803-886, 2014. +Sy-Miin Chow and Guangjian Zhang. Nonlinear regime-switching state-space (rsss) models. Psychometrika, 78:740-768, 2013. +Hanjun Dai, Bo Dai, Yan-Ming Zhang, Shuang Li, and Le Song. Recurrent hidden semi-markov model. In International Conference on Learning Representations, 2022. +Stéphane d'Ascoli, Sören Becker, Alexander Mathis, Philippe Schwaller, and Niki Kilbertus. Odeformer: Symbolic regression of dynamical systems with transformers. arXiv preprint arXiv:2310.05573, 2023. +Saskia EJ de Vries, Jerome A Lecoq, Michael A Buice, Peter A Groblewski, Gabriel K Ocker, Michael Oliver, David Feng, Nicholas Cain, Peter Ledochowitsch, Daniel Millman, et al. A large-scale standardized physiological survey reveals functional organization of the mouse visual cortex. Nature neuroscience, 23(1):138-151, 2020. +Zhe Dong, Bryan Seybold, Kevin Murphy, and Hung Bui. Collapsed amortized variational inference for switching nonlinear dynamical systems. In International Conference on Machine Learning, pp. 2638-2647. PMLR, 2020. +Lea Duncker, Gergo Bohner, Julien Boussard, and Maneesh Sahani. Learning interpretable continuous-time models of latent stochastic dynamical systems. In International conference on machine learning, pp. 1726-1734. PMLR, 2019. +Jeffrey L Elman. Finding structure in time. Cognitive science, 14(2):179-211, 1990. +Yuanjun Gao, Evan W Archer, Liam Paninski, and John P Cunningham. Linear dynamical neural population models through nonlinear embeddings. Advances in neural information processing systems, 29, 2016. +Quentin Garrido, Mahmoud Assran, Nicolas Ballas, Adrien Bardes, Laurent Najman, and Yann LeCun. Learning and leveraging world models in visual representation learning. arXiv preprint arXiv:2403.00504, 2024. +Zoubin Ghahramani and Geoffrey E Hinton. Variational learning for switching state-space models. Neural computation, 12(4):831-864, 2000. +Albert Gu and Tri Dao. Mamba: Linear-time sequence modeling with selective state spaces. arXiv preprint arXiv:2312.00752, 2023. +Albert Gu, Karan Goel, and Christopher Ré. Efficiently modeling long sequences with structured state spaces. arXiv preprint arXiv:2111.00396, 2021. +David Ha and Jürgen Schmidhuber. World models. CoRR, abs/1803.10122, 2018. URL http://arxiv.org/abs/1803.10122. +Hermanni Halva, Sylvain Le Corff, Luc Lehéricy, Jonathan So, Yongjie Zhu, Elisabeth Gassiat, and Aapo Hyvarinen. Disentangling identifiable features from noisy data with structured nonlinear ica. Advances in Neural Information Processing Systems, 34:1624-1633, 2021. + +Olivier Henaff. Data-efficient image recognition with contrastive predictive coding. In International conference on machine learning, pp. 4182-4192. PMLR, 2020. +Dan Hendrycks and Kevin Gimpel. Gaussian error linear units (gelus). arXiv preprint arXiv:1606.08415, 2016. +Cole Hurwitz, Nina Kudryashova, Arno Onken, and Matthias H Hennig. Building population models for large-scale neural recordings: Opportunities and pitfalls. Current opinion in neurobiology, 70: 64-73, 2021. +Aapo Hyvarinen and Hiroshi Morioka. Unsupervised feature extraction by time-contrastive learning and nonlinear ica. Advances in neural information processing systems, 29, 2016. +Aapo Hyvarinen and Hiroshi Morioka. Nonlinear ica of temporally dependent stationary sources. In Artificial Intelligence and Statistics, pp. 460-469. PMLR, 2017. +Aapo Hyvarinen, Hiroaki Sasaki, and Richard Turner. Nonlinear ica using auxiliary variables and generalized contrastive learning. In The 22nd International Conference on Artificial Intelligence and Statistics, pp. 859-868. PMLR, 2019. +Aapo Hyvärinen, Ilyes Khemakhem, and Hiroshi Morioka. Nonlinear independent component analysis for principled disentanglement in unsupervised deep learning. *Patterns*, 4(10): 100844, October 2023. ISSN 26663899. doi: 10.1016/j.patter.2023.100844. URL https://linkinghub.elsevier.com/retrieve/pii/S2666389923002234. +Eric Jang, Shixiang Gu, and Ben Poole. Categorical reparameterization with gumbel-softmax. arXiv preprint arXiv:1611.01144, 2016. +Pierre-Alexandre Kamienny, Stéphane d'Ascoli, Guillaume Lample, and François Charton. End-to-end symbolic regression with transformers. Advances in Neural Information Processing Systems, 35:10269-10281, 2022. +Ilyes Khemakhem, Diederik Kingma, Ricardo Monti, and Aapo Hyvarinen. Variational autoencoders and nonlinear ica: A unifying framework. In International conference on artificial intelligence and statistics, pp. 2207-2217. PMLR, 2020. +Diederik P Kingma. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014. +Yann LeCun. A path towards autonomous machine intelligence version 0.9.2, 2022-06-27. Open Review, 62(1):1-62, 2022. +Scott Linderman, Matthew Johnson, Andrew Miller, Ryan Adams, David Blei, and Liam Paninski. Bayesian learning and inference in recurrent switching linear dynamical systems. In Artificial intelligence and statistics, pp. 914-922. PMLR, 2017. +Phillip Lippe, Sara Magliacane, Sindy Löwe, Yuki M Asano, Taco Cohen, and Stratis Gavves. Citris: Causal identifiability from temporal intervened sequences. In International Conference on Machine Learning, pp. 13557-13603. PMLR, 2022. +Stefan Matthes, Zhiwei Han, and Hao Shen. Towards a unified framework of contrastive learning for disentangled representations. Advances in Neural Information Processing Systems, 36:67459-67470, 2023. +Leonard A McGee and Stanley F Schmidt. Discovery of the kalman filter as a practical tool for aerospace and industry. Technical report, 1985. +Aaron van den Oord, Yazhe Li, and Oriol Vinyals. Representation learning with contrastive predictive coding. arXiv preprint arXiv:1807.03748, 2018. +Mitchell Ostrow, Adam Eisen, Leo Kozachkov, and Ila Fiete. Beyond geometry: Comparing the temporal structure of computation in neural circuits with dynamical similarity analysis, 2023. URL https://arxiv.org/abs/2306.10168. + +Chethan Pandarinath, Daniel J O'Shea, Jasmine Collins, Rafal Jozefowicz, Sergey D Stavisky, Jonathan C Kao, Eric M Trautmann, Matthew T Kaufman, Stephen I Ryu, Leigh R Hochberg, et al. Inferring single-trial neural population dynamics using sequential auto-encoders. Nature methods, 15(10):805-815, 2018. +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. +Geoffrey Roeder, Luke Metz, and Durk Kingma. On linear identifiability of learned representations. In International Conference on Machine Learning, pp. 9030-9039. PMLR, 2021. +Evgenia Rusak, Patrik Reizinger, Attila Juhos, Oliver Bringmann, Roland S. Zimmermann, and Wieland Brendel. Infonce: Identifying the gap between theory and practice. 2024. URL https://arxiv.org/abs/2407.00143. +Steffen Schneider, Alexei Baevski, Ronan Collobert, and Michael Auli. wav2vec: Unsupervised pre-training for speech recognition. arXiv preprint arXiv:1904.05862, 2019. +Steffen Schneider, Jin Hwa Lee, and Mackenzie Weygandt Mathis. Learnable latent embeddings for joint behavioural and neural analysis. Nature, 617(7960):360-368, 2023. +Pierre Sermanet, Corey Lynch, Yevgen Chebotar, Jasmine Hsu, Eric Jang, Stefan Schaal, Sergey Levine, and Google Brain. Time-contrastive networks: Self-supervised learning from video. In 2018 IEEE international conference on robotics and automation (ICRA), pp. 1134–1141. IEEE, 2018. +Ruian Shi and Quaid Morris. Segmenting hybrid trajectories using latent odes. In International Conference on Machine Learning, pp. 9569-9579. PMLR, 2021. +Jimmy Smith, Scott Linderman, and David Sussillo. Reverse engineering recurrent neural networks with jacobian switching linear dynamical systems. Advances in Neural Information Processing Systems, 34:16700-16713, 2021. +Peter Sorrenson, Carsten Rother, and Ullrich Köthe. Disentanglement by nonlinear ica with general incompressible-flow networks (gin). arXiv preprint arXiv:2001.04872, 2020. +A Vaswani. Attention is all you need. Advances in Neural Information Processing Systems, 2017. +Tongzhou Wang and Phillip Isola. Understanding contrastive representation learning through alignment and uniformity on the hypersphere. In International Conference on Machine Learning, pp. 9929-9939. PMLR, 2020. +Weiran Yao, Yuewen Sun, Alex Ho, Changyin Sun, and Kun Zhang. Learning temporally causal latent processes from general temporal data. arXiv preprint arXiv:2110.05428, 2021. +Weiran Yao, Guangyi Chen, and Kun Zhang. Temporally disentangled representation learning. Advances in Neural Information Processing Systems, 35:26492-26503, 2022. +Roland S. Zimmermann, Yash Sharma, Steffen Schneider, Matthias Bethge, and Wieland Brendel. Contrastive learning inverts the data generating process. In Proceedings of the 38th International Conference on Machine Learning, volume 139 of Proceedings of Machine Learning Research, pp. 12979-12990. PMLR, 2021. + +# Supplementary Material + +A Proof of the main result 16 + +B Kernel density estimate correction 19 + +C Additional Related Work 21 + +D Von Mises-Fisher (vMF) conditional distributions 23 + +E Additional plots for SLDS 24 + +F Generalization - Train- vs. Test Set 25 + +G Variations and additional baselines for the DynR² Metric 27 + +G.1 Method 27 + +G.2 Results 27 + +H Non-Injective Mixing Functions 28 + +H.1 Experimental Validation 28 + +H.2 Results 29 + +I Dynamical Systems with Control Signal 31 + +I.1 Empirical Verification 31 + +I.2 Experiment Details 31 + +I.3 Results 32 + +J Application to Real-World Data 33 + +J.1 Methods 33 + +J.2 Results 34 + +J.3 Discussion 34 + +K Computational Requirements 35 + +L On component-wise vs. linear identifiability 36 + +M Comparison to additional time-series models 37 + +M.1 VerifyingBaselines 37 + +M.2Experiment Details 37 + +M.3 Results 38 + +# A PROOF OF THE MAIN RESULT + +We re-state Theorem 1 from the main paper, and provide a full proof below: + +Theorem 1 (Contrastive estimation of non-linear dynamics). Assume that + +- (A1) A time-series dataset $\{\pmb{y}_t\}_{t=1}^T$ is generated according to the ground-truth dynamical system in Eq. 5 with a bijective dynamics model $\pmb{f}$ and an injective mixing function $\pmb{g}$ . +- (A2) The system noise follows an iid normal distribution, $p(\varepsilon_t) = \mathcal{N}(\varepsilon_t | 0, \Sigma_\varepsilon)$ . +- (A3) The model $\psi$ is composed of an encoder $h$ , a dynamics model $\hat{\pmb{f}}$ , a correction term $\alpha$ , and the similarity metric $\phi(\pmb{u}, \pmb{v}) = -\|\pmb{u} - \pmb{v}\|^2$ and attains the global minimizer of Eq. 3. + +Then, in the limit of $T \to \infty$ for any point $x$ in the support of the data marginal distribution: + +(a) The composition of mixing and de-mixing $\pmb{h}(\pmb{g}(\pmb{x})) = \pmb{L}\pmb{x} + \pmb{b}$ is a bijective affine transform, and $\pmb{L} = \pmb{Q}\pmb{\Sigma}_{\epsilon}^{-1/2}$ with unknown orthogonal transform $\pmb{Q} \in \mathbb{R}^{d \times d}$ and offset $\pmb{b} \in \mathbb{R}^d$ . +(b) The estimated dynamics $\hat{\pmb{f}}$ are bijective and identify the true dynamics $\pmb{f}$ up to the relation $\hat{\pmb{f}}(\pmb{x}) = \pmb{L}\pmb{f}(\pmb{L}^{-1}(\pmb{x} - \pmb{b})) + \pmb{b}$ . + +Proof. Our proof proceeds in three steps: First, we leverage existing theory (Wang & Isola, 2020; Zimmermann et al., 2021) to arrive at the minimizer of the contrastive loss, and relate the limited sample loss function to the asymptotic case. Second, we derive the statement about achieving successful demixing in Theorem 1(a). Finally, we derive the statement in Theorem 1(a) about structural identifiability of the dynamics model. + +Step 1: Minimizer of the InfoNCE loss. By the assumption $\varepsilon_{t}$ is normally distributed, we obtain the positive sample conditional distribution + +$$ +p \left(\boldsymbol {x} _ {t + 1} \mid \boldsymbol {x} _ {t}\right) = \mathcal {N} \left(\boldsymbol {x} _ {t + 1} \mid \boldsymbol {f} \left(\boldsymbol {x} _ {t}\right), \boldsymbol {\Sigma} _ {\varepsilon}\right). \tag {13} +$$ + +The negative sample distribution $q(\pmb{x}_t)$ is obtained by sampling $t$ uniformly from all time steps and can hence be written as a Gaussian mixture along the dynamics imposed by $\pmb{f}$ , + +$$ +\begin{array}{l} q (\boldsymbol {x}) = \frac {1}{T} \sum_ {t = 1} ^ {T} p _ {\varepsilon} (\boldsymbol {x} - \boldsymbol {x} _ {t}) (14) \\ = \frac {1}{T} \sum_ {t = 1} ^ {T} \mathcal {N} \left(\boldsymbol {x} - \boldsymbol {x} _ {t} \mid \boldsymbol {f} \left(\boldsymbol {x} _ {t - 1}\right), \boldsymbol {\Sigma} _ {\varepsilon}\right). (15) \\ \end{array} +$$ + +We use these definitions of $p$ and $q$ to study the asymptotic case of our loss function. For $T \to \infty$ , due to Wang & Isola (2020) we can rewrite the limit of our loss function (Eq. 3) as + +$$ +\begin{array}{l} \mathcal {L} [ \psi ] = \lim _ {T \rightarrow \infty} \mathbb {E} _ {t, N} \left[ - \log p _ {\psi} \left(\boldsymbol {y} _ {t + 1} \mid \boldsymbol {y} _ {t}, N\right)\right] - \log T \\ = \int q (\boldsymbol {y}) \left[ - \int p \left(\boldsymbol {y} ^ {\prime} \mid \boldsymbol {y}\right) \psi \left(\boldsymbol {y}, \boldsymbol {y} ^ {\prime}\right) d \boldsymbol {y} ^ {\prime} + \log \int q \left(\boldsymbol {y} ^ {\prime}\right) \exp \left[ \psi \left(\boldsymbol {y}, \boldsymbol {y} ^ {\prime}\right) \right] d \boldsymbol {y} ^ {\prime} \right]. \tag {16} \\ \end{array} +$$ + +It was shown (Proposition 1, Schneider et al., 2023) that this loss function is convex in $\psi$ with the unique minimizer + +$$ +\psi (\boldsymbol {g} (\boldsymbol {x}), \boldsymbol {g} \left(\boldsymbol {x} ^ {\prime}\right)) = \log \frac {p \left(\boldsymbol {x} ^ {\prime} \mid \boldsymbol {x}\right)}{q \left(\boldsymbol {x} ^ {\prime}\right)} + c (\boldsymbol {x}), \tag {17} +$$ + +where $c: \mathbb{R}^d \mapsto \mathbb{R}$ is an arbitrary scalar-valued function. Note that we also expressed $\pmb{y} = \pmb{g}(\pmb{x}), \pmb{y}' = \pmb{g}(\pmb{x}')$ to continue the proof in terms of the relation between original and estimated latents. We insert the definition of the model on the left hand side. Let us also denote $\pmb{h} \circ \pmb{g} \eqqcolon \pmb{r}$ , and the definition of the ground-truth generating process on the right hand side to obtain + +$$ +\phi (\hat {\boldsymbol {f}} (\boldsymbol {r} (\boldsymbol {x})), \boldsymbol {r} (\boldsymbol {x} ^ {\prime})) - \alpha (\boldsymbol {x} ^ {\prime}) = \log p (\boldsymbol {x} ^ {\prime} | \boldsymbol {f} (\boldsymbol {x})) - \log q (\boldsymbol {x} ^ {\prime}) + c (\boldsymbol {x}). \tag {18} +$$ + +Inserting the potential $^2$ as $\alpha(\pmb{x}) = \log q(\pmb{x})$ simplifies the equation to + +$$ +\phi (\hat {\boldsymbol {f}} (\boldsymbol {r} (\boldsymbol {x})), \boldsymbol {r} (\boldsymbol {x} ^ {\prime})) = \log p (\boldsymbol {x} ^ {\prime} | \boldsymbol {f} (\boldsymbol {x})) + c (\boldsymbol {x}). \tag {19} +$$ + +From here onwards, we will use that $\phi$ is the negative squared Euclidean norm (A.3) and correspondingly, the positive conditional is a normal distribution with concentration $\Lambda = \Sigma_u^{-1}$ (A.2), + +$$ +- \left\| \hat {\boldsymbol {f}} (\boldsymbol {r} (\boldsymbol {x})) - \boldsymbol {r} (\boldsymbol {x} ^ {\prime}) \right\| _ {2} ^ {2} = - \left(\boldsymbol {f} (\boldsymbol {x}) - \boldsymbol {x} ^ {\prime}\right) ^ {\top} \boldsymbol {\Lambda} \left(\boldsymbol {f} (\boldsymbol {x}) - \boldsymbol {x} ^ {\prime}\right) + c ^ {\prime} (\boldsymbol {x}) \tag {20} +$$ + +where we pulled the normalization constant of $p$ into the function $c'$ for brevity. + +Step 2: Properties of the feature encoder. Starting from the last equation, we compute the derivative with respect to $x$ and $x'$ on both sides and obtain + +$$ +\boldsymbol {J} _ {\boldsymbol {r}} ^ {\top} \left(\boldsymbol {x} ^ {\prime}\right) \boldsymbol {J} _ {\hat {\boldsymbol {f}}} (\boldsymbol {r} (\boldsymbol {x})) \boldsymbol {J} _ {\boldsymbol {r}} (\boldsymbol {x}) = \boldsymbol {\Lambda} \boldsymbol {J} _ {\boldsymbol {f}} (\boldsymbol {x}). \tag {21} +$$ + +Because this equation holds for any $x' \in \operatorname{supp} q$ independently of $x$ , we can conclude that the Jacobian matrix of $r$ needs to be constant. From there it follows that $r$ is affine. Let us write $r(x) = Lx + b$ . Then, the Jacobian matrix is $J_r = L$ . Inserting this yields + +$$ +\boldsymbol {L} ^ {\top} \boldsymbol {J} _ {\hat {\boldsymbol {f}}} (\boldsymbol {L} \boldsymbol {x} + \boldsymbol {b}) \boldsymbol {L} = \boldsymbol {\Lambda} \boldsymbol {J} _ {\boldsymbol {f}} (\boldsymbol {x}). \tag {22} +$$ + +We next establish that $L$ has full rank: because the dynamics function $\pmb{f}$ is bijective by assumption, $J_{\pmb{f}}(\pmb{x})$ has full rank $d$ . $\Lambda$ has full rank by assumption about the distribution $p_{\varepsilon}(\varepsilon)$ . All matrices on the LHS are square and need to have full rank as well for any point $\pmb{x}$ . Hence, we can conclude that $L$ has full rank, and likewise $J_{\hat{f}}$ . From there, we conclude that $\pmb{r}$ and $\hat{\pmb{f}}$ are bijective. + +Next, we derive additional constraints on the matrix $\pmb{L}$ . We insert the solution for $\pmb{r}$ obtained so far in Eq. 20, + +$$ +- \left\| \hat {\boldsymbol {f}} (\boldsymbol {L} \boldsymbol {x} + \boldsymbol {b}) - \boldsymbol {L} \boldsymbol {x} ^ {\prime} - \boldsymbol {b} \right\| ^ {2} = - \left(\boldsymbol {f} (\boldsymbol {x}) - \boldsymbol {x} ^ {\prime}\right) ^ {\top} \boldsymbol {\Lambda} \left(\boldsymbol {f} (\boldsymbol {x}) - \boldsymbol {x} ^ {\prime}\right) + c ^ {\prime} (\boldsymbol {x}) \tag {23} +$$ + +and take the derivative twice with respect to $x'$ , to obtain + +$$ +\boldsymbol {L} ^ {\top} \boldsymbol {L} = \boldsymbol {\Lambda} \quad \Leftrightarrow \quad \boldsymbol {L} ^ {\top} = \boldsymbol {\Lambda} \boldsymbol {L} ^ {- 1}. \tag {24} +$$ + +Without loss of generality, we introduce $\pmb{Q} \in \mathbb{R}^{d \times d}$ to write $\pmb{L}$ in terms of $\pmb{\Lambda}$ as $\pmb{L} = \pmb{Q}\pmb{\Lambda}^{1/2}$ . Inserting into the previous equation lets us conclude + +$$ +\boldsymbol {L} ^ {\top} \boldsymbol {L} = \boldsymbol {\Lambda} ^ {1 / 2} \boldsymbol {Q} ^ {\top} \boldsymbol {Q} \boldsymbol {\Lambda} ^ {1 / 2} = \boldsymbol {\Lambda} \tag {25} +$$ + +$$ +\boldsymbol {Q} ^ {\top} \boldsymbol {Q} = \boldsymbol {\Lambda} ^ {- 1 / 2} \boldsymbol {\Lambda} \boldsymbol {\Lambda} ^ {- 1 / 2} = \boldsymbol {I}, \tag {26} +$$ + +from which follows that $Q$ is an orthogonal matrix. Hence, $L$ is a composition of an orthogonal transform and $\Sigma_{\varepsilon}^{-1/2}$ , concluding the first part of the proof for statement (a). + +Step 3: Dynamics. To derive part (b), we start at the condition Eq. 20 again to determine the value of $c^{\prime}(\pmb {x})$ . We can consider two special cases: + +$$ +\boldsymbol {f} (\boldsymbol {x}) = \boldsymbol {x} ^ {\prime}: \quad c ^ {\prime} (\boldsymbol {x}) = - \| \hat {\boldsymbol {f}} (\boldsymbol {r} (\boldsymbol {x})) - \boldsymbol {r} (\boldsymbol {x} ^ {\prime}) \| ^ {2} \leq 0, \tag {27} +$$ + +$$ +\hat {\boldsymbol {f}} (\boldsymbol {r} (\boldsymbol {x})) = \boldsymbol {r} \left(\boldsymbol {x} ^ {\prime}\right): \quad c ^ {\prime} (\boldsymbol {x}) = \left(\boldsymbol {f} (\boldsymbol {x}) - \boldsymbol {x} ^ {\prime}\right) ^ {\top} \boldsymbol {\Lambda} \left(\boldsymbol {f} (\boldsymbol {x}) - \boldsymbol {x} ^ {\prime}\right) \geq 0, \tag {28} +$$ + +where we use that the concentration matrix $\pmb{\Lambda}$ of a Normal distribution is positive semi-definite. When combining both conditions for points where $\pmb{f}(\pmb{x}) = \pmb{x}'$ and $\hat{\pmb{f}}(\pmb{r}(\pmb{x})) = \pmb{r}(\pmb{x}')$ the only admissible solution is $c'(\pmb{x}) = 0$ for points with $\hat{\pmb{f}}(\pmb{r}(\pmb{x})) = \pmb{r}(\pmb{f}(\pmb{x}))$ , i.e. $\hat{\pmb{f}}(\pmb{x}) = \pmb{r}(\pmb{f}(\pmb{r}^{-1}(\pmb{x})))$ , hinting at the final solution. However, we have not shown yet that this solution is unique. + +To show uniqueness, without loss of generality, we use the ansatz (with a residual $v$ ) + +$$ +\boldsymbol {f} (\boldsymbol {x}) = \boldsymbol {A} _ {1} \hat {\boldsymbol {f}} (\boldsymbol {L} \boldsymbol {x} + \boldsymbol {b}) + \boldsymbol {d} _ {1} + \boldsymbol {v} (\boldsymbol {x}), \tag {29} +$$ + +and computing the derivative with respect to $x$ yields + +$$ +\boldsymbol {J} _ {\boldsymbol {f}} (\boldsymbol {x}) = \boldsymbol {A} _ {1} \boldsymbol {J} _ {\hat {\boldsymbol {f}}} (\boldsymbol {L} \boldsymbol {x} + \boldsymbol {b}) \boldsymbol {L} + \boldsymbol {J} _ {\boldsymbol {v}} (\boldsymbol {x}). \tag {30} +$$ + +We insert this into Eq. 22 and obtain + +$$ +\boldsymbol {L} ^ {\top} \boldsymbol {J} _ {\hat {\boldsymbol {f}}} (\boldsymbol {L} \boldsymbol {x} + \boldsymbol {b}) \boldsymbol {L} = \boldsymbol {\Lambda} \boldsymbol {A} _ {1} \boldsymbol {J} _ {\hat {\boldsymbol {f}}} (\boldsymbol {L} \boldsymbol {x} + \boldsymbol {b}) \boldsymbol {L} + \boldsymbol {\Lambda} \boldsymbol {J} _ {\boldsymbol {v}} (\boldsymbol {x}) \tag {31} +$$ + +$$ +\left(\boldsymbol {L} ^ {\top} - \boldsymbol {\Lambda} \boldsymbol {A} _ {1}\right) \boldsymbol {J} _ {\hat {\boldsymbol {f}}} (\boldsymbol {L} \boldsymbol {x} + \boldsymbol {b}) \boldsymbol {L} = \boldsymbol {\Lambda} \boldsymbol {J} _ {\boldsymbol {v}} (\boldsymbol {x}) \tag {32} +$$ + +$$ +\left(\boldsymbol {L} ^ {\top} - \boldsymbol {\Lambda} \boldsymbol {A} _ {1}\right) = \boldsymbol {\Lambda} \boldsymbol {J} _ {\boldsymbol {v}} (\boldsymbol {x}) \boldsymbol {L} ^ {- 1} \boldsymbol {J} _ {\hat {\boldsymbol {f}}} ^ {- 1} (\boldsymbol {L} \boldsymbol {x} + \boldsymbol {b}) \tag {33} +$$ + +The left hand side is a constant, hence the same needs to hold true for the right hand side. Without loss of generality, let us introduce an arbitrary matrix $A_{2}$ we set as this constant, + +$$ +\boldsymbol {J} _ {\boldsymbol {v}} (\boldsymbol {x}) \boldsymbol {L} ^ {- 1} \boldsymbol {J} _ {\boldsymbol {f}} ^ {- 1} (\boldsymbol {L} \boldsymbol {x} + \boldsymbol {b}) = \boldsymbol {A} _ {2} \tag {34} +$$ + +$$ +\boldsymbol {J} _ {\boldsymbol {v}} (\boldsymbol {x}) = \boldsymbol {A} _ {2} \boldsymbol {J} _ {\hat {\boldsymbol {f}}} (\boldsymbol {L} \boldsymbol {x} + \boldsymbol {b}) \boldsymbol {L} \tag {35} +$$ + +which only admits the solution + +$$ +\boldsymbol {v} (\boldsymbol {x}) = \boldsymbol {A} _ {2} \hat {\boldsymbol {f}} (\boldsymbol {L} \boldsymbol {x} + \boldsymbol {b}) + \boldsymbol {d} _ {2}, \tag {36} +$$ + +where we introduced an additional integration constant $d_{2}$ . Inserting this into the ansatz in Eq. 29 gives + +$$ +\boldsymbol {f} (\boldsymbol {x}) = \boldsymbol {A} _ {1} \hat {\boldsymbol {f}} (\boldsymbol {L} \boldsymbol {x} + \boldsymbol {b}) + \boldsymbol {d} _ {1} + \boldsymbol {v} (\boldsymbol {x}), \tag {37} +$$ + +$$ +\boldsymbol {f} (\boldsymbol {x}) = \left(\boldsymbol {A} _ {1} + \boldsymbol {A} _ {2}\right) \hat {\boldsymbol {f}} (\boldsymbol {L} \boldsymbol {x} + \boldsymbol {b}) + \left(\boldsymbol {d} _ {1} + \boldsymbol {d} _ {2}\right). \tag {38} +$$ + +Using the shorthand $\mathbf{A} = \mathbf{A}_1 + \mathbf{A}_2$ , $\mathbf{d} = \mathbf{d}_1 + \mathbf{d}_2$ we can repeat the steps in Eqs. 30-33 to arrive at the condition + +$$ +\left(\boldsymbol {L} ^ {\top} - \boldsymbol {\Lambda} \boldsymbol {A}\right) \boldsymbol {J} _ {\hat {\boldsymbol {f}}} (\boldsymbol {L} \boldsymbol {x} + \boldsymbol {b}) \boldsymbol {L} = 0. \tag {39} +$$ + +Since all matrices have full rank, the only valid solution is $\mathbf{A} = \mathbf{\Lambda}^{-1}\mathbf{L}^{\top} = \mathbf{L}^{-1}$ . Inserting back into the ansatz yields the refined solution + +$$ +\boldsymbol {f} (\boldsymbol {x}) = \boldsymbol {L} ^ {- 1} \hat {\boldsymbol {f}} (\boldsymbol {L} \boldsymbol {x} + \boldsymbol {b}) + \boldsymbol {d}, \tag {40} +$$ + +and for brevity, we let $\pmb {\xi} = \hat{\pmb{f}} (\pmb {r}(\pmb {x})) = \hat{\pmb{f}} (\pmb {L}\pmb {x} + \pmb {b})$ + +$$ +\boldsymbol {f} (\boldsymbol {x}) = \boldsymbol {L} ^ {- 1} \boldsymbol {\xi} + \boldsymbol {d}. \tag {41} +$$ + +We then insert the current solution into Eq. 20 and input $r$ which gives + +$$ +\begin{array}{l} \left\| \boldsymbol {\xi} - \boldsymbol {L} \boldsymbol {x} ^ {\prime} - \boldsymbol {b} \right\| ^ {2} = \left(\boldsymbol {L} ^ {- 1} \boldsymbol {\xi} + \boldsymbol {d} - \boldsymbol {x} ^ {\prime}\right) ^ {\top} \boldsymbol {\Lambda} \left(\boldsymbol {L} ^ {- 1} \boldsymbol {\xi} + \boldsymbol {d} - \boldsymbol {x} ^ {\prime}\right) + c ^ {\prime} (\boldsymbol {x}) (42) \\ = \left(\boldsymbol {L} ^ {- 1} \boldsymbol {\xi} + \boldsymbol {d} - \boldsymbol {x} ^ {\prime}\right) ^ {\top} \boldsymbol {L} ^ {\top} \boldsymbol {L} \left(\boldsymbol {L} ^ {- 1} \boldsymbol {\xi} + \boldsymbol {d} - \boldsymbol {x} ^ {\prime}\right) + c ^ {\prime} (\boldsymbol {x}) (43) \\ = \left\| \boldsymbol {\xi} + \boldsymbol {L} \boldsymbol {d} - \boldsymbol {L} \boldsymbol {x} ^ {\prime} \right\| ^ {2} + c ^ {\prime} (\boldsymbol {x}) (44) \\ \end{array} +$$ + +$$ +c ^ {\prime} (\boldsymbol {x}) = \left\| \boldsymbol {\xi} - \boldsymbol {L} \boldsymbol {x} ^ {\prime} - \boldsymbol {b} \right\| ^ {2} - \left\| \boldsymbol {\xi} - \boldsymbol {L} \boldsymbol {x} ^ {\prime} + \boldsymbol {L} \boldsymbol {d} \right\| ^ {2} \tag {45} +$$ + +Let us denote $\pmb{v} = \pmb{\xi} - \pmb{L}\pmb{x}'$ and note that $\pmb{v}$ and $\pmb{x}$ remain independent variables. We then get + +$$ +\begin{array}{l} c ^ {\prime} (\boldsymbol {x}) = \left\| \boldsymbol {v} - \boldsymbol {b} \right\| ^ {2} - \left\| \boldsymbol {v} + \boldsymbol {L} \boldsymbol {d} \right\| ^ {2} (46) \\ = - 2 \boldsymbol {v} ^ {\top} (\boldsymbol {b} + \boldsymbol {L} \boldsymbol {d}) + \| \boldsymbol {b} \| ^ {2} - \| \boldsymbol {L} \boldsymbol {d} \| ^ {2} (47) \\ \end{array} +$$ + +Because $\pmb{v}$ and $\pmb{x}$ vary independently and the equation is true for any pair of these points, both sides of the equation need to be independent of their respective variables. This is true only if $\pmb{b} = -\pmb{L}\pmb{d}$ . Hence, it follows that + +$$ +c ^ {\prime} (\boldsymbol {x}) = 0 \quad \text {a n d} \quad \boldsymbol {d} = - \boldsymbol {L} ^ {- 1} \boldsymbol {b}. \tag {48} +$$ + +Inserting $\pmb{d}$ into Eq. 40 gives the final solution, + +$$ +\boldsymbol {f} (\boldsymbol {x}) = \boldsymbol {L} ^ {- 1} \hat {\boldsymbol {f}} (\boldsymbol {L} \boldsymbol {x} + \boldsymbol {b}) - \boldsymbol {L} ^ {- 1} \boldsymbol {b}. \tag {49} +$$ + +Solving for $\hat{f}$ gives us + +$$ +\hat {\boldsymbol {f}} (\boldsymbol {L} \boldsymbol {x} + \boldsymbol {b}) = \boldsymbol {L} \boldsymbol {f} (\boldsymbol {x}) + \boldsymbol {b} \tag {50} +$$ + +$$ +\hat {\boldsymbol {f}} (\boldsymbol {x}) = \boldsymbol {L} \boldsymbol {f} \left(\boldsymbol {L} ^ {- 1} (\boldsymbol {x} - \boldsymbol {b})\right) + \boldsymbol {b} = \left(\boldsymbol {r} \circ \boldsymbol {f} \circ \boldsymbol {r} ^ {- 1}\right) (\boldsymbol {x}) \tag {51} +$$ + +which concludes the proof. + +# B KERNEL DENSITY ESTIMATE CORRECTION + +Theorem 1 requires to include a "potential function" $\alpha$ into our model. In this section, we discuss how this function can be approximated by a kernel density estimate (KDE) in practice. The KDE intuitively corrects for the case of non-uniform marginal distributions. Correcting with $\alpha$ overcomes the limitation of requiring a uniform marginal distribution discussed before (Zimmermann et al., 2021). While other solutions have been discussed, such as training a separate MLP (Matthes et al., 2023), the KDE solution discussed below is conceptually simpler and non-parametric. + +For the models considered in the main paper, we considered representation learning in Euclidean space, while Appendix D contains some additional experiments for the very common case of training embeddings on the hypersphere. For both cases, we can parameterize appropriate KDEs. + +For the Euclidean case, we use the KDE based on the squared Euclidean norm, + +$$ +\hat {q} (\boldsymbol {x}) = \frac {1}{\epsilon M} \sum_ {i = 1} ^ {M} \exp \left(- \frac {\| \boldsymbol {x} - \boldsymbol {x} _ {i} \| ^ {2}}{\epsilon}\right), \quad \boldsymbol {x} _ {i} \sim q (\boldsymbol {x}). \tag {52} +$$ + +We note that in the limit $\epsilon \to 0$ , $M \to \infty$ , this estimate converges to the correct distribution, $\hat{q}(\boldsymbol{x}) \to q(\boldsymbol{x})$ . This is also the case used in Theorem 1. However, this estimate depends on the ground truth latents $\boldsymbol{x}_i$ , which are not accessible during training. Hence, we need to find an expression that depends on the observable data. We leverage the feature encoder $\boldsymbol{h}$ to express the estimator as + +$$ +\hat {q} _ {\boldsymbol {h}} (\boldsymbol {y}) = \frac {1}{\epsilon M} \sum_ {i = 1} ^ {M} \exp \left(- \frac {\| \boldsymbol {h} (\boldsymbol {y}) - \boldsymbol {h} (\boldsymbol {y} _ {i}) \| ^ {2}}{\epsilon}\right), \quad \boldsymbol {y} _ {i} \sim q (\boldsymbol {y}). \tag {53} +$$ + +We can express this estimator in terms of the final solution, $\pmb{r}(\pmb{x}) = \pmb{h}(\pmb{g}(\pmb{x})) = \pmb{Q}\pmb{\Sigma}_u^{-1/2}\pmb{x} + \pmb{b}$ in the theorem. If we express the solution in terms of the ground truth latents again, the orthogonal matrix $\pmb{Q}$ vanishes and we obtain + +$$ +\hat {q} _ {\boldsymbol {h}} (\boldsymbol {x}) = \frac {1}{\epsilon M} \sum_ {i = 1} ^ {M} \exp \left(- \frac {\left\| \boldsymbol {\Sigma} _ {u} ^ {- 1 / 2} (\boldsymbol {x} - \boldsymbol {x} _ {i}) \right\| ^ {2}}{\epsilon}\right). \quad \boldsymbol {y} _ {i} \sim q (\boldsymbol {y}) \tag {54} +$$ + +This corresponds to a KDE using a Mahalanobis distance with covariance matrix $\Sigma_{u}$ , which is a valid KDE of $q$ . + +We can derive a similar argument when computing embeddings and dynamics on the hypersphere. When, a von Mises-Fisher distribution is suitable to express the KDE, and we obtain + +$$ +\hat {q} (\boldsymbol {x}) = \frac {C _ {p} (\kappa)}{M} \sum_ {i = 1} ^ {M} \exp \left(\kappa \boldsymbol {x} ^ {\top} \boldsymbol {x} _ {i}\right), \quad \boldsymbol {x} _ {i} \sim q (\boldsymbol {x}) \tag {55} +$$ + +where $C_p(\kappa)$ is the normalization constant of the von Mises-Fisher distribution. This again approaches the correct data distribution for $\hat{q} \to q$ as $M, \kappa \to \infty$ . Following the same arguments above, but + +![](images/f28b23cb57d9019c9100f51448ed3c1437f9e7f83a34d134fe9c9779166c88a9.jpg) +K + +![](images/7019769083a381ddc9e7cb1cd7ce8a0f57a5530dac47e5ae56e58622e597b439.jpg) +K +Figure 8: Introducing KDE into the loss allows to compensate for non-uniform marginal distribution. We show performance in terms of $R^2$ across datasets with increasingly non-uniform marginal. We replicate the data-generating process and experimental setup performed by Zimmermann et al. (2021, Figure 2). + +![](images/141545cff4b6c3befed9d99f217c0ed3f421ae1bf0ed298c174493ea830212d4.jpg) +K + +using $\pmb{r}(\pmb{x}) = \pmb{h}(\pmb{g}(\pmb{x})) = \pmb{Q}\pmb{x}$ as the indeterminacy on the hypersphere, we can express this in terms of the ground truth latents, + +$$ +\begin{array}{l} \hat {q} _ {\boldsymbol {h}} (\boldsymbol {x}) = \frac {C _ {p} (\kappa)}{N} \sum_ {i = 1} ^ {M} \exp \left(\kappa \boldsymbol {r} (\boldsymbol {x}) ^ {\top} \boldsymbol {r} \left(\boldsymbol {x} _ {i}\right)\right), (56) \\ = \frac {C _ {p} (\kappa)}{N} \sum_ {i = 1} ^ {M} \exp \left(\kappa \boldsymbol {x} ^ {\top} \boldsymbol {x} _ {i}\right), (57) \\ \end{array} +$$ + +which is again a valid KDE. + +It is interesting to consider the effect of the KDE on the loss function. Inserting $\psi \gets \psi -\log \hat{q}$ into the loss function yields + +$$ +\begin{array}{l} - \log p _ {\psi} (\boldsymbol {x} | \boldsymbol {x} ^ {+}, N) = - \left(\psi \left(\boldsymbol {x} _ {i}, \boldsymbol {x} _ {i} ^ {+}\right) - \log \hat {q} \left(\boldsymbol {x} _ {i} ^ {+}\right)\right) + \log \sum_ {i = 1} ^ {N} e ^ {\psi \left(\boldsymbol {x} _ {i}, \boldsymbol {x} _ {j} ^ {-}\right) - \log \hat {q} \left(\boldsymbol {x} _ {j} ^ {-}\right)}, (58) \\ = - \psi \left(\boldsymbol {x} _ {i}, \boldsymbol {x} _ {i} ^ {+}\right) + \log \hat {q} \left(\boldsymbol {x} _ {i} ^ {+}\right) + \log \sum_ {i = 1} ^ {N} \frac {1}{\hat {q} \left(\boldsymbol {x} _ {j} ^ {-}\right)} e ^ {\psi \left(\boldsymbol {x} _ {i}, \boldsymbol {x} _ {j} ^ {-}\right)}, (59) \\ = - \psi \left(\boldsymbol {x} _ {i}, \boldsymbol {x} _ {i} ^ {+}\right) + \log \sum_ {i = 1} ^ {N} \frac {\hat {q} _ {h} \left(\boldsymbol {x} _ {i} ^ {+}\right)}{\hat {q} _ {h} \left(\boldsymbol {x} _ {j} ^ {-}\right)} e ^ {\psi \left(\boldsymbol {x} _ {i}, \boldsymbol {x} _ {j} ^ {-}\right)}, (60) \\ = - \psi \left(\boldsymbol {x} _ {i}, \boldsymbol {x} _ {i} ^ {+}\right) + \log \sum_ {i = 1} ^ {N} w _ {h} \left(\boldsymbol {x} _ {i} ^ {+}, \boldsymbol {x} _ {j} ^ {-}\right) e ^ {\psi \left(\boldsymbol {x} _ {i}, \boldsymbol {x} _ {j} ^ {-}\right)} (61) \\ \end{array} +$$ + +with the importance weights $w_{h}(\pmb{x}_{i}^{+},\pmb{x}_{j}^{-}) = \frac{\hat{q}_{h}(\pmb{x}_{i}^{+})}{\hat{q}_{h}(\pmb{x}_{j}^{-})}$ . Intuitively, this means that the negative examples are re-weighted according to the density ratio between the current positive and each negative sample. + +Empirical motivation. Figure 8 shows preliminary results on applying this KDE correction to contrastive learning models. We followed the setting from Zimmermann et al. (2021) and re-produced the experiment reported in Fig. 2 in their paper. We use 3D latents, a 4-layer MLP as non-linear mixing function with a final projection layer to 50D observed data. The reference, positive and negative distributions are all vMFs parameterized according to $\kappa$ (x-axis) in the case of the reference and negative distribution and $\kappa_{p}$ for the positive distribution. + +The grey curve shows the decline in empirical identifiability $(R^2)$ as the uniformity assumption is violated by an increasing concentration $\kappa$ (x-axis). Applying a KDE correction to the data resulted in substantially improved performance (red lines). + +However, when testing the method directly on the dynamical systems considered in the paper, we did not found a substantial improvement in performance. One hypothesis for this is that the distribution of points on the data manifold (not necessarily the whole $\mathbb{R}^d$ is already sufficiently uniform. Hence, while the theory requires inclusion of the KDE term (and it did not degrade results), we suggest to drop this computationally expensive term when applying the method on real-world datasets that are approximately uniform. + +# C ADDITIONAL RELATED WORK + +Contrastive learning. An influential and conceptual motivation for our work is Contrastive Predictive Coding (CPC) (Oord et al., 2018) which uses the InfoNCE loss with an additional non-linear projection head implemented as an RNN to aggregate information from multiple time steps. Then, an affine projection is used for multiple forward prediction steps. However, contrary to our approach, the "dynamics model" is not explicitly parameterized, limiting its interpretability. Similar frameworks have been successfully applied across various domains, including audio, vision, and language, giving rise to applications such as wav2vec (Schneider et al., 2019), time contrastive networks for video (TCN; Sermanet et al., 2018) or CPCv2 (Henaff, 2020). An interesting parallel to DLC+LDS in image representation learning is AnInfoNCE (Rusak et al., 2024) which extends a SimCLR-like (Chen et al., 2020b) training setup by an additional learnable diagonal matrix in its similarity function. + +Non-Contrastive learning. Models such as data2vec (Baevski et al., 2022) and JEPA (Assran et al., 2023) learn a representation by trying to predict missing information in latent space, using an MSE loss. JEPA uses asymmetric encoders, and on top a predictor model in latent space parameterized by a neural net. However, these approaches do not provide any identifiability guarantees. + +System identification. In system identification, a problem closely related to the one addressed in this work is known as "nonlinear system identification. Widely used algorithms for this problem include Extended Kalman Filter (EKM) (McGee & Schmidt, 1985) and Nonlinear Autoregressive Moving Average with Exogenous inputs (NARMAX) (Chen & Billings, 1989). EKF is based on linearizing $\pmb{g}$ and $\pmb{f}$ using a first-order Taylor-series approximation and then apply the Kalman Filter (KF) to the linearized functions. NARMAX, on the other hand, typically employs a power-form polynomial representation to model the non-linearities. In neuroscience, practical (generative algorithms) include systems modeling linear dynamics (fLDS; Gao et al., 2016) or non-linear dynamics modelled by RNNs (LFADS; Pandarinath et al., 2018). Hurwitz et al. (2021) provide a detailed summary of additional algorithms. + +Nonlinear ICA. The field of Nonlinear ICA has recently provided identifiability results for identifying latent variables, usually employing auxiliary variables such as class labels or time information (Hyvarinen & Morioka, 2016; 2017; Hyvarinen et al., 2019; Khemakhem et al., 2020; Sorrenson et al., 2020). In the case of time series data, Time Contrastive Learning (TCL) (Hyvarinen & Morioka, 2016) uses a contrastive loss to predict the segment-ID of multivariate time-series which was shown to perform Non-linear ICA. Permutation Contrastive Learning (PCL) (Hyvarinen & Morioka, 2017) permutes the time series and aims to distinguish positive and negative pairs. + +Temporal causal representation learning. In Nonlinear ICA, the factors are assumed to be independent, subject to some indeterminacy in the original latent variables. However, this approach encounters challenges when the latent variables have time-delayed causal relationships. Approaches like LEAP (Sorrenson et al., 2020) and TDLR (Yao et al., 2021) address these challenges in both stationary and non-stationary environments, even when the transition function's parametric form is unknown. CaRING (Yao et al., 2022) extends these results to cases where the mixing function is non-invertible. Lastly, CITRIS (Lippe et al., 2022) introduces intervention target information to enhance the identification of latent causal factors. In this work, we do not aim to estimate the temporal causal graph. Instead, we focus on estimating the dynamics model $f$ using an interpretable and explicitly parameterized dynamics model (e.g. $\nabla$ -SLDS) which can later be analyzed for applications such as scientific discovery. + +Switching Linear Dynamical Systems. Several papers propose methods to infer SLDSs (Ackerson & Fu, 1970; Chang & Athans, 1978; Ghahramani & Hinton, 2000), leading to a variety of extensions and variants. For example, Recurrent SLDSs (Linderman et al., 2017; Dai et al., 2022) address state-dependent switching by changing the switch transition distribution to $p(y_{t}|y_{t - 1},x_{t - 1})$ , allowing for more flexible dependencies on previous states. Another extension, Explicit duration SLDS introduces additional latent variables to model the distribution of switch durations explicitly (Chiappa et al., 2014). Some approaches relax the assumption of linear dynamics, such as in the case of SNLDS and RSSSSM, where the dynamics model is assumed to be nonlinear (Dong et al., 2020; Chow & Zhang, 2013). In the context of Nonlinear Independent Component Analysis (ICA), recent extensions include structured data generating processes (e.g., SNICA; Halva et al., 2021) which were shown to be useful for the inference of switching dynamics. In this vein, Balsells-Rodas et al. (2023) proposed additional identifiability theory for the switching case. Other approaches, based on Neural Ordinary Differential Equations (Neural ODEs; Chen et al., 2020a; Shi & Morris, 2021), or methods aimed at + +discovering switching dynamics within recurrent neural networks (Smith et al., 2021), also present interesting avenues for modeling switching dynamics. + +Deep state-space models. Recently, (deep) state-space models (SSMs) such as S4 or Mamba (Gu et al., 2021; Gu & Dao, 2023) have emerged as a promising architecture. These models are particularly well-suited for capturing long-range dependencies, making them an attractive choice for sequence modeling tasks. + +Symbolic Regression. An alternative approach to modeling dynamical systems is the use of symbolic regression, which aims to directly infer explicit symbolic mathematical expressions governing the underlying dynamical laws. Examples include Sparse Identification of Nonlinear Dynamics (SINdy; Brunton et al., 2016), as well as more recent transformer-based models (Kamienny et al., 2022; d'Ascoli et al., 2023), which have demonstrated promise in discovering interpretable representations of dynamical systems. + +# D VON MISES-FISHER (VMF) CONDITIONAL DISTRIBUTIONS + +In the main paper, we have shown experimental results that verify Theorem 1 in the case of Normal distributed positive conditional distribution and using the Euclidean distance. This approach has allowed for modeling latents and their dynamics in Euclidean space, which we argue is the most practical setting to apply DCL in. However, self-supervised learning methods and especially contrastive learning have commonly been applied to produce representations on the hypersphere and using the dot-product distance (Oord et al., 2018; Schneider et al., 2023; Wang & Isola, 2020; Zimmermann et al., 2021; Chen et al., 2020b). + +Here we validate empirically that Theorem 1 equally holds under the assumption of vMF conditional distributions and using the dot-product distance $\phi (\pmb {x},\pmb {y}) = \pmb{x}^{\top}\pmb{y}$ as part of the loss. We run experiments as in Table 1 for the case where the true dynamics model $\pmb{f}$ is a linear dynamical system. Additionally, we vary the setting similar to Figure 4 to show increasing $\Delta t$ (angular velocity). + +We compare: + +- DCL (ours) - with linear dynamics: $\hat{f}(\boldsymbol{x}) = \hat{A}\boldsymbol{x}$ . +- GTD - the ground-truth dynamics model (LDS) $\hat{f}(\boldsymbol{x}) = \boldsymbol{A}\boldsymbol{x}$ . +- No dynamics - the baseline setting we use throughout the paper $\hat{f}(\pmb{x}) = \pmb{x}$ . +- **Asymmetric - a variation on the baseline setting that uses asymmetric encoders (one for reference, one for positive or negative) which would be a possible fix of Corollary 1.** We can obtain this setting by skipping the explicit dynamics modeling, and defining two encoders $h_1, h_2$ which relate as follows: $h \circ f \coloneqq h_1$ , $h \coloneqq h_2$ . + +![](images/a60fb9976d650ac4e313a829539d680549539db97a9f4df5d99ba58e50f01959.jpg) +Figure 9: Our findings from Table 1 hold equally under vMF noise distribution when using LDS ground truth dynamics. We show empirical identifiability of the latents in terms of $R^2$ under varying a) angles of the rotation dynamics i.e. angular velocity $\Delta t$ (x-axis) and b) the magnitude of the dynamics noise $\sigma$ (panels, left: low noise, right: high noise) + +![](images/54ba266cfab6c8f63474d710d15d9643295646af524e46c64b149a17e3b54f11.jpg) + +Similar to our results for the Euclidean case (Table 1), in Figure 9 we show results that experimentally verify Theorem 1 for latent dynamics on hypersphere and using vMF as conditional distribution. Both for low (left panel) and high (right panel) variance of the conditional distribution we can see that DCL effectively identifies the ground truth latents on par with the oracle (GTD) model performance. On the other hand, the baseline, standard time contrastive learning without dynamics, can not identify the ground truth latents with underlying linear dynamics as predicted by Corollary 1. This prediction is only violated in the case where the variance of the noise distribution is high enough, such that the noise dominates the changes introduced by the actual dynamics. This is the case for dynamics with rotations up to 4 degrees for $\sigma = 0.01$ and angles up to 10 degrees for $\sigma = 0.1$ . + +# E ADDITIONAL PLOTS FOR SLDS + +![](images/aa97434118bd25847724c24bb983a88451885804dc9599d1758aefd31bfb8159.jpg) +Figure 10: Visualizations of 6D linear dynamical systems at $\sigma = 0.0001$ (left) and $\sigma = 0.01$ for 10 degree rotations. These systems are used in our SLDS experiments. + +# F GENERALIZATION - TRAIN- VS. TEST SET + +In the main paper, all metrics are evaluated using the full training dataset of the respective experiment. We argue that this is sufficient for showing the efficacy of our model and verifying claims from the theory in section 3 because a) in self-supervised learning, the model learns generalizable representations through pretext tasks, making overfitting less of a concern; b) the metrics we are interested in are about uncovering the true underlying latent representation and dynamics of the available training data, not of new data; and c) most importantly, we ensured that the training dataset is large enough to approximate the full data distribution. + +Nonetheless, here we show a series of control experiments to re-evaluate models on new and unseen data. We do so by following the same data generating process of the given experiment (same dynamics model and mixing function) and sample completely new trials (10% of the number of trials of the training dataset). Every new trial starts at a random new starting point, with a randomly sampled new mode sequence and regenerated with different seeds for the dynamics noise. + +First, we re-evaluated every experiment of Figure 6 on the test dataset generated as described above and show these results in Figure 11. Comparing those results to the train dataset version of Figure 6 shows that there is almost no difference in the performance (with regard to identifiability and systems identification). The difference are so small, that visually comparing the results almost becomes impractical, so we additionally provide the exact numbers of the first panel (variations on the number of samples per trial) in Table 2. + +Finally, to qualitatively and quantitatively show the difference between the train and test datasets we provide a) depictions of the ground truth latents of 5 random test trials and their closest possible matching trial from the training set in Figure 12 and b) a distribution of the distances (in terms of $R^2$ between the data from the test and train trials) between all test trials of one of a random test set and their closest trial from the training dataset in Figure 13. + +![](images/dac638ed18e339b3fb36757441364e4e205134b84f5d6ca1d01c24f2ba0e0970.jpg) +Figure 11: Same as Figure 6 (Variations and ablations for SLDS), but re-evaluated on a newly generated test data with different starting points. + +Table 2: A detailed view on the #samples panel from Figure 6 and 11 showing the difference between train and test set evaluation. + +
# samplesDCL (ours)R2(train)R2(test)CL w/o dynamicsR2(train)R2(test)CL w/ ground truth dynamicsR2(train)R2(test)
100.991 ± 0.001370.989 ± 0.001720.923 ± 0.037030.917 ± 0.040000.954 ± 0.003970.952 ± 0.00442
1000.995 ± 0.001060.994 ± 0.001080.786 ± 0.067940.791 ± 0.069310.990 ± 0.001070.990 ± 0.00099
10000.995 ± 0.000740.995 ± 0.000780.765 ± 0.066710.770 ± 0.069730.990 ± 0.005070.990 ± 0.00511
100000.996 ± 0.000460.996 ± 0.000440.694 ± 0.069370.801 ± 0.105680.991 ± 0.005090.991 ± 0.00425
+ +![](images/8d2e67accd4c8f46c9154c742639e5f03806522b4462a2a875e1b17684cef77c.jpg) +Trial #1 $(R^2 = 0.17)$ + +Trial #2 $(R^2 = 0.63)$ +![](images/667656fa7dc50e89f7e1560b531546f52f2c188615c9fa5483dc158def3b663d.jpg) +Test (reference trial) Train (closest match) + +![](images/2c71cb20dcbe42b721897b14cef53ac5fbbd82ff3c9103dad99eba82e8403422.jpg) +Trial #3 $(R^2 = 0.70)$ + +![](images/d584b052ab1a20330eb610b1221f50068630f27de5b0a32b70b968eb9fa78335.jpg) +Trial #4 $(R^2 = 0.73)$ + +![](images/cc4d2a6e70aea05645c51c4aea30ffc63793adf9bb57ef0c6dfcef905f9f351f.jpg) +Trial #5 $(R^2 = 0.89)$ + +![](images/03b9c4f787a731f384f4dee2aa680651b611dadfbdf38fc8dde099ba82812b72.jpg) +Figure 12: Ground truth latents from five random trials of the testsets for Figure 11 and their closest match within the corresponding trainset. The closest match is evaluated by computing the $R^2$ -Score between a given trial from the testset and every possible trial. +Figure 13: Histogram of all $R^2$ -Scores between every trial from the testset and its closest possible match from the trainset as shown in Figure 12. + +# G VARIATIONS AND ADDITIONAL BASELINES FOR THE DYNR² METRIC + +# G.1 METHOD + +As an addition to Table 1, we analyse the Dyn $R^2$ in more detail. In Table 3 we show variants for the metric. Firstly, we modify the number of forward prediction steps, + +$$ +\boldsymbol {f} ^ {n} (\boldsymbol {x}) := \underbrace {\left(\boldsymbol {f} \circ \cdots \circ \boldsymbol {f}\right)} _ {n \text {t i m e s}} (\boldsymbol {x}) \tag {62} +$$ + +and respectively for $\hat{\pmb{f}}^n$ in relation to $\hat{\pmb{f}}$ . We then consider two variants of Eq. 12. Firstly, we perform multiple forward predictions ( $n > 1$ ) and compare the resulting embeddings: + +$$ +\operatorname {r 2} \text {s c o r e} \left(\hat {\boldsymbol {f}} ^ {n} (\hat {\boldsymbol {x}}), \boldsymbol {L} \boldsymbol {f} ^ {n} \left(\boldsymbol {L} ^ {\prime} \hat {\boldsymbol {x}} + \boldsymbol {b} ^ {\prime}\right) + \boldsymbol {b}\right). \tag {63} +$$ + +A rationale for this metric is that the prediction task becomes increasingly difficult with an increasing number of time steps, and errors accumulate faster. + +Secondly, as an additional control, we replace $f$ with the identity, and compute + +$$ +\operatorname {r 2} \text {s c o r e} (\hat {\boldsymbol {x}}, \boldsymbol {L} \boldsymbol {f} ^ {n} \left(\boldsymbol {L} ^ {\prime} \hat {\boldsymbol {x}} + \boldsymbol {b} ^ {\prime}\right) + \boldsymbol {b}). \tag {64} +$$ + +This metric can be regarded as a naive baseline/control for comparing performance of the dynamics model. If the $\mathrm{dyn}R^2$ is not significantly larger than this value, we cannot conclude to have obtained meaningful dynamics. + +For the lower part of Table 1, we report the resulting metrics in Table 3, setting the number of forward steps $n$ to 1 or 10, and using either the original metric (Eq. 62), or the control (Eq. 63). + +# G.2 RESULTS + +For the SLDS system, we can corroborate our results further: the baseline model obtains a $\mathrm{dyn}R^2$ of around $85\%$ for single step prediction, both for the original and control metric. Our $\nabla$ -SLDS model and the ground truth dynamical model obtain over $99.9\%$ well above the level of the control metric which remains at around $95\%$ . The high value of the control metric is due to the small change introduced by a single time step, and should be considered when using and interpreting the metric. If more steps are performed, the performance of the $\nabla$ -SLDS model drops to about $95.5\%$ vs. chance level for the control metric, again highlighting the high performance of our model, but also the room for improvement, as the oracle model stays at above $99\%$ as expected. + +For the Lorenz system, we do not see a substantial difference between original dyn $R^2$ metric and dyn $R^2$ control for any of the considered algorithms. Yet, as noted in the main paper, $\nabla$ -SLDS is the only dynamics model that gets a high $R^2$ of $94.08\%$ , vs. the lower $81.20\%$ for a single LDS model, or $40.99\%$ for the baseline model. In other words, while DCL with the $\nabla$ -SLDS dynamics model falls short of identifying the true underlying dynamics for this non-linear chaotic system, without DCL we wouldn't even identify the latents. We leave optimizing the parameterization of the dynamics model to identify non-linear chaotic systems for future work. + +Table 3: Extended metrics for dynamics models including additional variations on the dynR² metric where Control is replacing $\hat{\pmb{f}}$ with the identity and 10 Steps is applying $\hat{\pmb{f}}$ (and $\pmb{f}$ ) 10 times, i.e., predicting 10 steps forward instead of only one step as is done in the Original version. + +
datamodel% dynR2, n=1 step% dynR2, n=10 steps
fp(ε)fidentifiableOriginalControlOriginalControl
SLDSNormalidentityX85.47 ± 8.0784.54 ± 7.312.78 ± 9.34-58.62 ± 7.22
SLDSNormal∇-SLDS(✓)99.93 ± 0.0195.15 ± 0.6895.53 ± 0.47-124.65 ± 6.97
SLDSNormalGT(✓)99.97 ± 0.0094.94 ± 0.6899.36 ± 0.18-129.32 ± 6.95
LorenzNormalidentityX27.02 ± 8.7227.17 ± 8.7422.87 ± 7.1324.85 ± 7.14
LorenzNormalLDSX80.30 ± 14.1382.98 ± 12.64-13.07 ± 41.0342.08 ± 26.14
LorenzNormal∇-SLDS(✓)93.91 ± 5.3293.70 ± 5.1134.48 ± 6.4755.75 ± 6.01
+ +# H NON-INJECTIVE MIXING FUNCTIONS + +Our identifiability guarantees (Theorem 1, Def. 5) require an injective mixing function $\pmb{g}(\pmb{x}_t) = \pmb{y}_t$ . On the first glance, this clashes with common requirements in system identification under partial observability. Specifically, let us consider a system of the form: + +$$ +\boldsymbol {x} _ {t + 1} = \boldsymbol {f} \left(\boldsymbol {x} _ {t}\right) + \varepsilon_ {t} = \boldsymbol {A} \boldsymbol {x} _ {t} + \varepsilon_ {t} \tag {65} +$$ + +$$ +\boldsymbol {y} _ {t} = \boldsymbol {C} \boldsymbol {x} _ {t} = \boldsymbol {g} (\boldsymbol {x} _ {t}), +$$ + +where $\boldsymbol{x}_t \in \mathbb{R}^n$ , $\boldsymbol{y}_t \in \mathbb{R}^m$ , $\boldsymbol{C} \in \mathbb{R}^{m \times n}$ with $n > m$ is a non-square matrix that projects the states of the dynamical system into a lower dimensional space. Similarly, we may have $n \leq m$ with $\mathrm{rank}(\boldsymbol{C}) < n$ . In those cases, $\boldsymbol{C}$ and hence $\boldsymbol{g}$ is non-invertible, and naively, the injectivity assumptions of Def. 5 would fail to hold. + +However, in practice this issue can be tackled through the use of a time-delay embedding. Specifically, we consider the following reformulation of the system: + +$$ +\tilde {\boldsymbol {y}} _ {t} ^ {i} := \left[ \begin{array}{c} \boldsymbol {y} _ {t - \tau} \\ \boldsymbol {y} _ {t - \tau + 1} \\ \boldsymbol {y} _ {t - \tau + 2} \\ \vdots \\ \boldsymbol {y} _ {t} \end{array} \right] = \underbrace {\left[ \begin{array}{c} C \\ C A \\ C A ^ {2} \\ \vdots \\ C A ^ {\tau} \end{array} \right]} _ {O} \boldsymbol {x} _ {t - \tau} + \left[ \begin{array}{c} \boldsymbol {0} \\ \boldsymbol {\nu} _ {t} ^ {1} \\ \boldsymbol {\nu} _ {t} ^ {2} \\ \vdots \\ \boldsymbol {\nu} _ {t} ^ {\tau} \end{array} \right] \tag {66} +$$ + +$$ +\text {w h e r e} \boldsymbol {\nu} _ {t} ^ {\tau} := C \sum_ {i = 0} ^ {\tau - 1} A ^ {i} \varepsilon_ {t - i}. \tag {67} +$$ + +For a sufficiently large time lag $\tau$ , the linear map $\tilde{g}(\boldsymbol{x}_{t - \tau}) = \boldsymbol{O}\boldsymbol{x}_{t - \tau} = \tilde{\boldsymbol{y}}_t^i$ will become injective again. This is the case if $\boldsymbol{O}$ is full rank which holds if $\boldsymbol{A}$ is full rank, since $\boldsymbol{f}$ is bijective and therefore $\boldsymbol{A}$ is a full rank square matrix. For example, if $\boldsymbol{C}$ had rank $m$ , then using at least $\tau = \frac{n}{m}$ time steps would make $\tilde{g}$ injective and our theoretical guarantees from Theorem 1 would hold, up to the offset introduced by the noise $\nu$ . + +In practice, the change in latent space between different time steps might be small (especially when the time resolution of the system is very high). A practical way to avoid feeding increasingly large inputs, is to not feed in all time-lags $0\ldots \tau$ into the construction of $O$ , but to subselect $k$ time lags $\tau_{1},\dots,\tau_{k}$ , with $\tau_{1} = 0$ and $\tau_{k} = \tau$ , and instead consider the system + +$$ +\tilde {\boldsymbol {y}} _ {t} ^ {i} := \left[ \begin{array}{c} \boldsymbol {y} _ {t - \tau} \\ \boldsymbol {y} _ {t - \tau + \tau_ {2}} \\ \vdots \\ \boldsymbol {y} _ {t - \tau + \tau_ {k - 1}} \\ \boldsymbol {y} _ {t - \tau_ {n}} \end{array} \right] = \underbrace {\left[ \begin{array}{c} C \\ C A ^ {\tau_ {2}} \\ \vdots \\ C A ^ {\tau_ {k - 1}} \\ C A ^ {\tau} \end{array} \right]} _ {O} \boldsymbol {x} _ {t - \tau_ {1}} + \left[ \begin{array}{c} 0 \\ \nu_ {t} ^ {1} \\ \nu_ {t} ^ {2} \\ \vdots \\ \nu_ {t} ^ {\tau} \end{array} \right] \tag {68} +$$ + +This system allows to have a sufficiently large context window (from $t - i_1$ to $t$ ) to ensure injectivity, while keeping the input dimensionality of the model fixed. Note, when we set $\tau_i = i - 1$ for each $i$ , we recover Eq. 66. + +Regarding the noise vector $\pmb{\nu}$ , Hälva et al. (2021) recently showed that noisy and noise-free demixing problems can be mapped onto each other. While a full rigorous proof in conjunction with our Theorem 1 is beyond the scope of this work, invoking Theorem 1 of Hälva et al. (2021) to account for $\pmb{\nu}$ is a promising avenue. Importantly, our empirical validation later on already shows that the model is in practice indeed functioning even in the presence of the noise distribution. + +# H.1 EXPERIMENTAL VALIDATION + +We validate our theoretical considerations by two sets of experiments as closely related to the LDS setting from Table 1 as possible. We use two types of mixing functions: + +$$ +\boldsymbol {g} (\boldsymbol {x}) = \boldsymbol {C} _ {1} \boldsymbol {C} _ {2} \boldsymbol {x} _ {t} \tag {69} +$$ + +$$ +\boldsymbol {g} (\boldsymbol {x}) = \boldsymbol {C} _ {2} \boldsymbol {g} ^ {\prime} \left(\boldsymbol {C} _ {1} \boldsymbol {x} _ {t}\right) \tag {70} +$$ + +![](images/29a3796776b245356184eb56086616c42babd120adeec40ff0329bf218f3c26b.jpg) + +![](images/c6e2b0ba8552269c5e752dc1b4ccf2901ffc9d210afc744f66a73c66f84acd5b.jpg) + +![](images/26cceba147b8354a837110edf0fe54dfd180c9cd368cfa250044e07346f56615.jpg) + +![](images/caa7c07a0ca1d7977351dbc0c3bbd436e7f7ef332b234a8cb93616d8fffa55b2.jpg) +Figure 14: Non-injective mixing functions can be successfully handled by a time-lag embedding. $\mathbf{a}$ , in the first setting, we pass observations from $\tau$ consecutive time steps into our feature encoder. $\mathbf{b}$ , empirical identifiability of the latent space $(R^2)$ for baseline (no dynamics) vs. DCL (linear dynamics) as we increase $n$ for a linear and $\mathbf{c}$ non-linear mixing function. $\mathbf{d}$ , to achieve injective mixing functions through time-lag embeddings, we here include the full 100-step length window, but only pass $k$ equidistantly spaced points within this window of length $\tau$ . $\mathbf{e}$ , empirical identifiability for baseline (no dynamics) vs. DCL (linear dynamics) as we increase the number of points in the context for a fixed $\tau = 100$ -step window and $\mathbf{f}$ for nonlinear mixing. + +![](images/41622b3c3adb0ae02d401f536c76ef95194ccf71d9c1ec86d36f32e4f7fd4ad9.jpg) + +![](images/1e91262efc0642d29619ff8d3dd94d3a27ed93c3a4d37aeb135ce80e92995091.jpg) + +where $C_1 \in \mathbb{R}^{m \times r}$ , $C_2 \in \mathbb{R}^{r \times n}$ are randomly sampled, $g: \mathbb{R}^r \to \mathbb{R}^r$ is a random injective and nonlinear function and $m$ is the observable dimension, $n$ is the latent dimension and $r$ is the matrix rank. In line with the LDS experiments from Table 1, we set $n = 6$ and $m = 50$ . The mixing functions from Eq. 69 & 70 are then applied to the latents, including the parameter $r \in \{1, 2, 3\}$ to restrict the rank and thereby dimensionality of the mixing functions to $r$ . + +We run experiments for different numbers of time steps that get passed to the encoder $h$ . In the first setting, we use $k$ consecutive time steps. In this setting, we expect that more time steps than the theoretical minimum $n / m$ are required, because the variation between consecutive time steps is limited. To corroborate this hypothesis, we run a second variant where the length of the context window is fixed, and $k$ equidistantly placed points are selected to be fed in the encoder. + +As in Table 1, we repeat each experiment 9 times with different dataset and model seeds and report the $95\%$ confidence interval. + +# H.2 RESULTS + +Generally, we can see from Figure 14 that we can successfully verify our theoretical considerations about weakening the injectivity constraint. + +To begin with, we confirm that the default parametrization of DCL with only a single time step $i = 1$ cannot solve the demixing problem. Next, for the theoretical minimum of time steps ( $i = 6$ for rank 1, $i = 3$ for rank 2, $i = 2$ for rank 3) we can already observe a considerable improvement of the empirical identifiability for DCL in terms of the $R^2$ Score: $16\% \rightarrow 66\%$ for rank 1, $30\% \rightarrow 78\%$ for rank 2, $43\% \rightarrow 88\%$ for rank 3 (Fig. 14b). As mentioned above, the minimal amount of time steps required for the identifiability guarantees only hold for $\nu_t = 0$ which is not the case in these experiments. As we increase the number of time points to 100, we can see that DCL approaches close to perfect $R^2$ Scores: For linear mixing, we get the best results for $i = 100$ with $99\%$ $R^2$ for + +ranks 1, 2, and 3. While for nonlinear mixing, averaged across seeds, we get up to $86\%$ for rank 1 and $i = 100$ , $97\%$ for rank 2 and $i = 20$ , and $94\%$ for $i = 20$ . In contrast, the baseline without a dynamics model, does not benefit at all from the additional time steps. + +To further test our intuition about recovering injectivity, we include an experiment where the full 100-step length window is used, but only $n$ equidistantly spaced time steps are passed. In this setup, we much quicker recover acceptable identifability scores for the linear (Fig. 14e) and non-linear mixing settings (Fig. 14f). + +# I DYNAMICAL SYSTEMS WITH CONTROL SIGNAL + +We have initially introduced the problem formulation of this paper (Equation 1) as identifying the latent variables $\boldsymbol{x}_t$ and the governing latent dynamics $\boldsymbol{f}$ from the observations $\boldsymbol{y}_t$ for: + +$$ +\boldsymbol {x} _ {t + 1} = \boldsymbol {f} \left(\boldsymbol {x} _ {t}\right) + \boldsymbol {B} \boldsymbol {u} _ {t} + \varepsilon_ {t} \tag {71} +$$ + +$$ +\boldsymbol {y} _ {t} = \boldsymbol {g} (\boldsymbol {x} _ {t}) + \boldsymbol {\nu} _ {t}. +$$ + +with control signal $\pmb{u}$ , its control or actuator matrix $B$ , system noise $\varepsilon$ and observation noise $\nu$ . + +However, so far we have only explicitly considered autonomous latent dynamics (see Def. 5), which by definition did not include a control input $\boldsymbol{u}_t$ . In this section, we show that the DCL framework works equally well in the presence of a control input and verify this empirically. + +Being able to include a control signal is crucial for many applications and common practice in systems identification literature. Without adding $\pmb{u}_t$ to the model, the task of identifying dynamics gets substantially harder as the effects of the control signal become entangled with the intrinsic dynamics of the system. Additionally, only identifying the combined dynamics without factoring out the effect of $\pmb{u}_t$ would make the framework less useful as it would not allow predictions in the presence of new/different control inputs. + +# I.1 EMPIRICAL VERIFICATION + +We extend our existing experiments for linear dynamical systems (LDS) by including a control signal $\pmb{u}_t$ in the data generating process: + +$$ +\boldsymbol {x} _ {t + 1} = \boldsymbol {A} \boldsymbol {x} _ {t} + \boldsymbol {B} \boldsymbol {u} _ {t} + \varepsilon_ {t} \tag {72} +$$ + +We train and evaluate four model variants: + +- **Baseline:** Identity dynamics model, using the control input with a trainable $\mathbf{B}$ . The dynamics model is fit post-hoc, +- DCL: with a LDS dynamics model where $B = 0$ +- DCL w/ control: with a LDS dynamics model and trainable $B$ . + +We choose the control signal $\pmb{u}_t$ to be generated from: + +- Step function: A composition of a negative and positive step function, starting at random time steps and random magnitudes. +- Linear Dynamical System: $\boldsymbol{u}_{t+1} = \boldsymbol{A}_u \boldsymbol{u}_t + \varepsilon_t$ , similar to the LDS system used before for latent dynamics. + +# I.2 EXPERIMENT DETAILS + +We generate three datasets with linear dynamics using a) no control, b) control following another LDS, and c) control following a step function. Each dataset consists of 1000 trials, each trial is 1000 time steps long. The latent linear dynamics have intrinsic rotational dynamics with rotation angles $\theta_{i} \sim \mathrm{Uniform}[0,10]$ and control matrix $B \sim \mathcal{N}(\mu = 0.01, \Sigma = I \cdot 0.01)$ . The system noise $\varepsilon$ follows a standard normal with $\sigma_{\varepsilon} = 0.001$ . The mixing function $g$ is the same nonlinear mixing function with 4 layers as for Table 1. We use 5-dimensional latents and have 50-dimensional observations. For the control following another LDS, we use the same sampling strategy for the parameters as for the latent dynamics. For the control following a step function, we pick two points $T_{1}$ , $T_{2}$ such that the $T_{2} - T_{1} = 200$ and that the step is centered within the trial including some random offset. We use different controls $u_{t}$ for every trial. We extend DCL with a parametrization of the linear dynamics model that follows Eq. 72 and includes the control $u_{t}$ and trainable control matrix $B$ . We use the same dynamics model for the baseline. However there, this only affects the post hoc dynamics fitting. We also train DCL with a LDS model that does not include the control input. We train every model for 20k steps and besides that, we use the same hyperparameters as for training the LDS models in Table 1. + +Table 4: Empirical identifiability results when including both system noise and a deterministic control signal $\mathbf{u}$ . The ground truth dynamics $\mathbf{f}$ are chosen as an LDS, and the intrinsic dynamics model $\hat{\mathbf{f}}$ is either an LDS, or the identity (baseline); $\mathbf{B}\mathbf{u}$ indicates whether the dynamics model includes the control or not; $p_{\varepsilon}(\varepsilon)$ is Normal (small $\sigma$ ). Mean $\pm$ std. are across 3 datasets and 3 experiment repeats. + +
Data Control (u)ModelResults
fBu%R2↑%dynR2↑
Step (1D)identity✓91.80 ± 1.1587.27 ± 10.6
LDSx98.36 ± 0.6699.16 ± 1.00
LDS✓98.70 ± 0.4499.53 ± 0.27
LDS (5D)identity✓74.17 ± 13.876.47 ± 7.51
LDSx98.26 ± 0.1799.87 ± 0.04
LDS✓98.10 ± 0.3599.85 ± 0.08
+ +![](images/17337efba84e7b371482f008a411a2063976e206d1556ec37b3bfb73ed9f4c07.jpg) +Figure 15: Visualization of dynamics inference in the presence of a control signal $\pmb{u}$ . a LDS dynamics are complemented by a b 1D step function signal, which c is projected to 5D using a random matrix $\pmb{B}$ (not shown). The ground truth dynamics then show signatures of the autonomous dynamics when $\pmb{u} = 0$ (gray box), and move through latent space as we apply the step function. d, DCL uses a dynamics model and the control input $\pmb{u}$ ; e, the baseline uses only the control input $\pmb{u}$ . The three rows show different dynamical systems, each plot is one trial with 1000 steps. + +![](images/8e7a860ad1cb3da38ed7b72e74ec84cccfb795e89d0ae9292d91e53e91495b74.jpg) + +![](images/ef805c30f94641bfba240dc9ce8488c3a7e748c19302817a6f5e2c2088ab3560.jpg) + +![](images/dabc1646c780db013aa6b92114166e02cf9220efd32cb8c311d457604b9707c1.jpg) + +# I.3 RESULTS + +As shown in Table 4, when applying a step function for the control signal (Step 1D), DCL is able to identify both the latent space $(98.7\% R^2)$ and the dynamics $(99.5\% \mathrm{dyn}R^{2})$ . This result holds even when the control signal $\pmb{u}$ is not used for training the model. However, a baseline with identity dynamics is not able to identify the dynamical system with a substantially lower $\mathrm{dyn}R^2$ of $87.3\%$ . Nevertheless, the latent space can be estimated reasonably well, although not perfect $(91.8\% R^2)$ , most likely because the availability of $\pmb{u}$ converts the de-mixing problem into a supervised learning problem (we have access to $(\pmb{u},\pmb{y})$ pairs). This is reflected in the visualization in Figure 15: While the baseline (identity dynamics, but using $\pmb{u}$ ) reasonably estimates the direction of $\pmb{u}$ provided during training, the local dynamics cannot be fitted. We highlighted a gray box denoting the phase where $\pmb{u} = 0$ to facilitate easier comparison. + +To test DCL for more complex control signals, we also apply a full 5D LDS as the control signal $\mathbf{u}$ (Table 4, LDS 5D). Both latent space estimation and dynamics estimation performs on par with the step setting ( $>98\%$ ), while the baseline fails to estimate either the latent space or the dynamics with $R^2$ values below $80\%$ . + +# J APPLICATION TO REAL-WORLD DATA + +![](images/05eef141c92a595a4d98e250ce73e77f56738a0f27889591f16ef5d98b95c102.jpg) + +![](images/2ba786ccaaa611d8caa27996edbcb1df50abc92247f957e75fb329cd3fe2dc4b.jpg) + +![](images/96773f44a363b0ba75f4c4c4f465bff20a8d68ba6aefa9da68a6852e2d26b4c4.jpg) +Figure 16: Application to real-world neural data. (a) We leverage the Allen visual coding dataset using calcium imaging data (de Vries et al., 2020). We consider the subset of the data which is comprised of 10 movie repeats with 900 samples each at $30\mathrm{Hz}$ . We hold out the last trial for validation. Mouse icon from scidraw.io (Ann Kennedy), panel adopted from Schneider et al. (2023). (b) We feed multiple time steps to the model as outlined in Appendix H. All experiments concat five equidistant points with a maximum time lag of at the sample locations $(t, t - 5, \dots, t - 20)$ . (c) Quantitative comparison of DCL with identity vs. linear dynamics and qualitative overview of embeddings computed for the hyperparameters that (i) maximize consistency for LDS dynamics, (ii) have high consistency for both models, (iii) maximize consistency for identity dynamics. Train embedding is depicted as points (unsmoothed for LDS, smoothed for identity to show structure), test embedding as smoothed black trajectory. (d) Effect of smoothing applied to the embedding, left column depicts unsmoothed, right column smoothed embedding on train repeats. Upper panel is colored according to trial time, lower panel is colored according to overall time (train portion of data, test only shown above). In all embedding plots, the test-embedding smoothed with a 151-sample filter is overlayed as a black line. + +![](images/2eb7b731120ed259f2270f891c711580e64b89801d4080cb647b8468eb61f0f1.jpg) + +Here we evaluate DCL using a real-world dataset obtained from the Allen Institute (de Vries et al., 2020). The dataset contains recordings from awake, head-fixed mice as they viewed visual stimuli including three movies on a continuous loop. The recordings were collected using 2-photon calcium imaging. Our analysis focuses on paired data from 10 repetitions of "Natural Movie 1" comprised of 900 frames (Fig 16a). This exact dataset was also used by Schneider et al. (2023) and available as allen-movie-one-ca-VISp-800- $\star$ in the CEBRA software package. + +# J.1 METHODS + +We train DCL with an LDS dynamics model. As our baseline, we use the identical training setup but with identity dynamics as in our synthetic experiments. We use an MLP with three layers. The number of units for each layer scales with the embedding dimensionality $d$ . The last hidden layer has $10d$ units and all previous layers have $30d$ units. We train on batches with 512 samples (reference and positive) and use $2^{14} = 16384$ negative samples. The model is optimized using the Adam optimizer (Kingma, 2014) with learning rate $10^{-4}$ . We train DCL for 10k steps using the negative mean squared error as the similarity metric. For both models we also make use of the time-lag embeddings introduced in Appendix H (Figure 14), setting $k = 5$ and $\tau = 20$ (Figure 16b). Additionally, we vary the dimensionality $d \in \{8, 16, 32, 64\}$ of the embeddings. We also vary the time offset $i$ that determines the time step of the positive sample $t_{\mathrm{pos}} = t_{\mathrm{ref}} + i$ relative to the time step of the reference sample and run experiments for $i \in \{1, 5, 10, 15, 20, 25, 30\}$ . We train each model 5 times with different initializations. For a shuffle control, we randomize the time dimension within each individual movie repeat (900 frames) and conduct the same training as previously discussed. We train on the neural activity of the first 9 repetitions (8100 samples, 270s) and use the 10th (900 samples, 30s) for evaluation. To evaluate the models, we compute the consistency metric – the $R^2$ metric between the embeddings – used by Schneider et al. (2023) between the five runs of the same model and training setup as a proxy for empirical identifiability. For the consistency calculation, we + +![](images/7f627157e3f1dd392966c44a86cf032a2cb8900d751188789dc2be0c45848eb4.jpg) +Figure 17: Comparison of consistency with a shuffle control on (a) the train split and (b) the validation split. (c), example embeddings for both identity and LDS dynamics, in shuffle and no shuffle conditions. + +![](images/b3d0e54727e9bf03786192628798bb951bd6600a93cb68f2b36247a74bae5b85.jpg) + +![](images/c916b0ab8b05c1a69bc073c3b7e1b8a5daea359d9fe90d2e79895a202ff2414e.jpg) + +fit a linear regression model between all pairs of embeddings across training runs, and quantify the resulting $5 \times 4$ comparisons using the $R^2$ . We report the mean $R^2$ on the validation trial across all comparisons. + +# J.2 RESULTS + +We compare the consistency scores between multiple runs of the same model training for DCL with LDS and our baseline (Figure 16c). Overall, DCL with a linear dynamics model has higher consistency scores compared to training without a dynamics model for all settings except for time offset equal to 1, where results are on par. The positive effect of leveraging dynamics learning increases as we increase the time offset. Across all variations of the time offset, we additionally observe an increase in consistency with an increase in the dimensionality up to 32 dimensions, followed by a drop in consistency for 64-dimensional embeddings. + +In addition to the quantitative performance improvements of DCL with LDS, we can also observe more structured embedding spaces for DCL with LDS in Figures 16c and 16d compared to DCL without a dynamics model. The embeddings of DCL with LDS exhibit a clear manifold and follow relatively smooth trajectories, while the embeddings and trajectories of DCL without a dynamics model are considerably more entangled. Considering the color code showing the relative time of each trial, we can also see that DCL with LDS recovers an embedding space in which each trial follows roughly the same circular motion as the other trials. + +When removing temporal structure by shuffling (Fig. 17), neither embedding shows non-trivial structure and the consistency metric is low on both the train (panel a) and validation set (panel b). + +# J.3 DISCUSSION + +We observe the strongest improvements in consistency for those settings in which the time difference between the reference and positive sample is the largest (time offset 30). Under our assumed dynamics model, predicting further ahead in time results in dynamics which differ increasingly from the identity dynamics. In our synthetic data experiments, we already observed a similar effect. The identity dynamics baseline was able to estimate an embedding space when the noise dominated the system dynamics, but failed to estimate the embedding space as the dynamics became more prominent (Fig 5). + +Note that our baseline model is similar – but technically not identical – to the CEBRA-time models considered by Schneider et al. (2023) on the same dataset. Our results demonstrate potential improvements through the introduction of the dynamics model: First, we demonstrate that fitting embeddings in Euclidean space using a negative mean squared error as the loss function, vs. the cosine similarity used by Schneider et al. (2023) benefits from the introduction of a dynamics model. Second, the circular, repetitive structure of movie repeats also emerges in this Euclidean space, most clearly in the presence of a dynamics model (Fig. 16c, i, LDS). Third, we found it crucial to include the positive sample in the denominator which stabilizes training in the absence of normalized embeddings. + +# K COMPUTATIONAL REQUIREMENTS + +As stated in the main paper, we required 120 GPU days of compute for the experiments we ran for the paper. This does not include the initial period of prototyping and exploration that preceded the final sweep of experiments. To provide more transparency and more detailed breakdown, we list the number of experiments (= model trainings) run for each table and figure in the paper. + +
ResultNumber of Experiments
Table 1171
Figure 4 (SLDS)162
Figure 5 & 7 (Lorenz)675
Figure 6 (Ablation)648
Figure 8 (KDE)1,125
Figure 9 (SLDS with vMF)432
Total3,213
+ +Table 5: Number of experiments per table/figure. + +For 120 GPU days this comes out at an average of 53 minutes per experiment that made it into the final paper. However, the actual runtime of an average DCL training is 15-20 minutes for settings equivalent to the experiments in Table 1. This difference to what we report as the overall average compute time per experiment can be attributed to several factors: (1) approximately one-third of experiments involved KDE estimation which required 4-6x longer training times, (2) extensive evaluation and metric computation for debugging and reporting purposes added additional overhead, and (3) additional experimental iterations that did not make it into the final paper but contributed to the total compute time of the final sweep. + +# L ON COMPONENT-WISE VS. LINEAR IDENTIFIABILITY + +In the context of non-linear ICA, the mean correlation coefficient (MCC) is frequently reported as a measure of component-wise identifiability. In non-linear ICA, it is typically assumed that a set of independent sources $s_1(t), \ldots, s_n(t)$ is passed through a mixing function to arrive at the observable signal (cf. Hyvarinen & Morioka, 2017). In contrast, in our work the sources are not independent, but are conditioned on the previous time step and the passed through a dynamics model. This is conceptually similar to the conditional independent assumption in Hyvarinen et al. (2019) with auxiliary variable $f(x)$ , but with the distinction that at training time, we do not have $u$ available, only $x$ which requires the use of a dynamics model. + +Because of these distinctions in the generation of the latent space, we can generally not expect component-wise identifiability (Theorem 1) but will instead obtain linear identifiability. Related work in non-linear ICA likewise can only provide linear identifiability for a comparable Gaussian case (Hyvarinen et al., 2019; Zimmermann et al., 2021; Schneider et al., 2023). However, if we assume access to the dynamics model (but not the actual latent space), it is possible to reduce ambiguity in the latent space, and assuring component-wise identifiability. + +In Table 6 we compare MCC and $\% R^2$ across two datasets (SLDS and Lorenz) to extend Table 1 of the main paper. As expected, we observe a non-perfect MCC score for all models except for the SLDS model which is provided with the ground-truth dynamics. Due to Eq 29 this strenghten the guarantee to component-wise identifiability, yielding an MCC of close to $100\%$ . + +
Data fModel fMCC%R2
SLDSidentity0.59 ± 0.0676.80 ± 7.40
SLDSSLDS0.70 ± 0.0599.52 ± 0.05
SLDSGT1.00 ± 0.0099.20 ± 0.10
Lorenzidentity0.34 ± 0.0741.00 ± 8.57
LorenzLDS0.68 ± 0.1481.20 ± 16.9
LorenzSLDS0.78 ± 0.1394.08 ± 2.75
+ +Table 6: SLDS and Lorenz dataset from Table 1 with the addition of the MCC metric. + +# M COMPARISON TO ADDITIONAL TIME-SERIES MODELS + +The baseline - DCL without a dynamics model - employed in all experiments in the main paper is technically a CEBRA-time (Schneider et al., 2023) model which was originally designed for time-series inference. Note that we use the negative mean squared error as the similarity measure in almost all experiments, and include general improvements for estimation of Euclidean embeddings also in the baseline model (positive sample in the denominator of the InfoNCE loss, additional negative examples). Other modes of CEBRA-time (using a cosine similarity, etc.) were not prominently considered in this work. Other popular contrastive learning methods include time-contrastive learning (TCL; Hyvarinen & Morioka, 2016), permutation contrastive learning (PCL; Hyvarinen & Morioka, 2017). More recently, VAE models designed for time-series analysis and dynamics learning were proposed, such as Temporally Disentangled Representation Learning (TDRL; Yao et al., 2022). + +Naturally, these methods propose different data generating processes, and the empirical performance of DCL as well as these comparison methods will strongly depend on whether these assumptions are met. For instance, TCL requires non-stationary independent sources, PCL requires stationary independent sources, and TDRL uses non-parametric transition models with non-Gaussian noise. Hence, in general, it is not possible to fairly compare all these methods as they have different regimes of operation. We still include a comparison of these methods and DCL for dynamics inference. + +# M.1 VERIFYING BASELINES + +Yao et al. (2022) published a benchmarking setup for these algorithms3. We adapted the TDRL codebase minimally and provide a reference implementation for our experiments in our official code release. Our implementation can be diffed against the original TDRL code to highlight the minimal code changes performed for running the benchmarking suite. We leverage this codebase to run verified baseline algorithms on our SLDS dataset. First, we ensure that we can reproduce the results from Yao et al. (2022). We report the results in Table 7 for the "changing" experimental setting. + +We perform 5 runs with different seeds for the exact hyperparameter configurations reported in the TDRL codebase. Remaining differences in the in numbers might be attributed to discrepancies between the paper and the code distribution or the choice of different random seeds, as we observed large variances in some of the models. We label these models with "B" to indicate the base configuration provided by the public code base. We report the full results in Table 7. + +
ModelMCC
ReproducedReported
PCL-B0.535 ± 0.0300.599 ± 0.041
TCL-B0.367 ± 0.0180.399 ± 0.021
TDRL-B0.910 ± 0.0670.958 ± 0.017
+ +Table 7: Verification on "changing" experiment Setting from Yao et al. (2022) + +# M.2 EXPERIMENT DETAILS + +Both TCL and TDRL make use of a categorical context variable indicating changes in the distributions of the true latents. To make the comparison to our framework as fair as possible, we choose the SLDS datasets to allow for a similar context variable in form of the mode/state sequence that modulates the switching between linear dynamics. Our dataset is comprised of 5 modes, which corresponds to the same number of categories the models from Table 7 already use. + +Base models. To be able to apply the baseline models to our SLDS setting, we only change their base configuration in two required ways: We increase the input dimension from 8 to 50 to match the observation produced by the SLDS and reduce the latent dimension from 8 to 6. + +Large models. Because PCL is the closest match to our existing baseline (CEBRA-time) and our encoder architecture is equal to the baseline architecture, we introduce an additional variant "PCL-L" $(\mathrm{L} = \mathrm{Large})$ to match the number of parameters as close as possible. We do so by increasing the hidden dimension of the PCL encoder model from 50 to 160 and reduce the number of layers from 4 to 3, + +
Modellow noisehigh noise
MCC (%)R2(%)MCC (%)R2(%)
TCL-B36.07 ± 2.2766.56 ± 3.8737.21 ± 3.6661.75 ± 12.56
PCL-B68.28 ± 2.4091.33 ± 0.8566.86 ± 3.1677.99 ± 3.93
PCL-L68.02 ± 2.7790.92 ± 1.1669.67 ± 3.8680.88 ± 1.38
TDRL-B64.34 ± 6.0183.85 ± 7.7862.93 ± 5.3780.90 ± 7.82
TDRL-L63.51 ± 4.8784.01 ± 7.9862.65 ± 6.2981.40 ± 6.42
CEBRA-time59.46 ± 5.8476.80 ± 7.4065.71 ± 4.9998.66 ± 0.19
DCL+SLDS69.62 ± 4.7899.52 ± 0.0568.76 ± 5.0598.95 ± 0.08
DCL+GT SLDS99.51 ± 0.0699.20 ± 0.1098.57 ± 0.1697.82 ± 0.17
+ +Table 8: Baseline results for TCL, PCL, and TDRL models on switching linear dynamics datasets. The low noise setting is equivalent to Table 1. For the high noise setting (low $\Delta t$ ), we use larger noise and lower rotation angles, setting $\sigma_{\varepsilon} = 0.001$ , $\max(\theta_i) = 5$ . + +effectively increasing the number of parameters by factor 5. Because TDRL can be considered the most promising baseline candidate (beside CEBRA-time) based on the results from table 7, we also double its encoder size from using hidden dimension 128 to 256, resulting in the "TDRL-L" baseline model. + +Dataset. Leverage two versions of the SLDS dataset used in the main paper. First, we apply it to the exact setting of the SLDS in our Table 1 to compare against our default setting with dynamics noise $\sigma_{\varepsilon} = 0.0001$ and rotation angles $\max (\theta_i) = 10$ . Additionally, since our main baseline (CEBRA-time) performed best on datasets with lower $\Delta t$ where the noise dominates over the dynamics, we also compare against an SLDS dataset generated with larger dynamics noise $\sigma_{\varepsilon} = 0.001$ and smaller rotation angles $\max (\theta_i) = 5$ (see Figure 4b). We generate 3 different versions of each dataset using different random seeds and on each dataset we train 3 models with different seeds, resulting in 9 models for each baseline and for each of the two settings. We train every baseline model for 50 epochs or until the training time reaches 8 hours. + +Metrics. We compute the Mean Correlation Coefficient (MCC) as well as the $R^2$ metric used for Table 1 during training. For the baselines run with the public code base from Yao et al. (2022), we follow their reporting strategy and report the best MCC complemented by the best $R^2$ achieved at any point during training to make the baseline appear even stronger. For our DCL models and our default baseline, we report the MCC and $R^2$ based on the last model checkpoint as in the main paper. + +# M.3 RESULTS + +We outline results for all benchmarked algorithms in Table 8. + +In the low noise setting, DCL with the SLDS dynamics model achieves an $R^2$ of $99.5\%$ . The next best baseline algorithm is the PCL base model, with a maximum $R^2$ of $91.3\%$ . While both DCL and PCL are learning by contrasting samples across time in the time series, only DCL with the SLDS dynamics model can fully model the ground truth dynamical process. In contrast, the score function in PCL is setup to model variations along independent latent dimensions. + +Interestingly, PCL outperforms CEBRA-time, which is equivalent to running DCL without a dynamics model $(76.8\%)$ . This indicates that the score method in PCL (component-wise linear transformations) outperforms the score method in CEBRA-time on this dataset (negative squared Euclidean distance). It would be interesting to combine the scoring method in PCL with the dynamics model in DCL for further improvements on non-linear dynamics settings. + +In the high noise setting, DCL with SLDS dynamics achieves comparable performance as CEBRA-time, as outlined in the main paper (99.0% vs. 98.7%). In this setting, PCL performs worse, potentially because the score function in CEBRA-time is better matched to the dominating Gaussian system noise. + +In all cases, MCC is not a meaningful metric, with highest scores ranging around $60 - 70\%$ . An exception is training DCL with the underlying ground truth dynamics system, which achieves component-wise identifiability and an MCC of $99.51\%$ . \ No newline at end of file diff --git a/ICLR/2025/Self-supervised contrastive learning performs non-linear system identification/images.zip b/ICLR/2025/Self-supervised contrastive learning performs non-linear system identification/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..2fed7ef8dbceb5199d2fc39d23cd3b68875b2094 --- /dev/null +++ b/ICLR/2025/Self-supervised contrastive learning performs non-linear system identification/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cb9f84b5650589ac94bfba60bd2977ccb36ae79d8c34b2418b0b5d45529e16ff +size 1642695 diff --git a/ICLR/2025/Self-supervised contrastive learning performs non-linear system identification/layout.json b/ICLR/2025/Self-supervised contrastive learning performs non-linear system identification/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..9aa882a1eb391cea67703a69335606233a9e2a0f --- /dev/null +++ b/ICLR/2025/Self-supervised contrastive learning performs non-linear system identification/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9ca3aa2a760b9984d397a72153fa37fe90aae8be4fe941eb7f456954e0eb19df +size 1436992 diff --git a/ICLR/2025/Semantic Aware Representation Learning for Lifelong Learning/3952a27e-2e48-46dd-9cb1-a6c27f524cf3_content_list.json b/ICLR/2025/Semantic Aware Representation Learning for Lifelong Learning/3952a27e-2e48-46dd-9cb1-a6c27f524cf3_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..9325700640a81343e14f224b2a65c5f54eed1292 --- /dev/null +++ b/ICLR/2025/Semantic Aware Representation Learning for Lifelong Learning/3952a27e-2e48-46dd-9cb1-a6c27f524cf3_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a8cee75310b95f7acc0edc1cfd807fcb5aa9c17b2cc56a136dbc678f7d05849c +size 117901 diff --git a/ICLR/2025/Semantic Aware Representation Learning for Lifelong Learning/3952a27e-2e48-46dd-9cb1-a6c27f524cf3_model.json b/ICLR/2025/Semantic Aware Representation Learning for Lifelong Learning/3952a27e-2e48-46dd-9cb1-a6c27f524cf3_model.json new file mode 100644 index 0000000000000000000000000000000000000000..932eead963aac24e457e445b2f1b3c3639928a0a --- /dev/null +++ b/ICLR/2025/Semantic Aware Representation Learning for Lifelong Learning/3952a27e-2e48-46dd-9cb1-a6c27f524cf3_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ce31d1e793861815fde41db243fd0afe98f3f93da81d8e4ab4e370086487b1c1 +size 137365 diff --git a/ICLR/2025/Semantic Aware Representation Learning for Lifelong Learning/3952a27e-2e48-46dd-9cb1-a6c27f524cf3_origin.pdf b/ICLR/2025/Semantic Aware Representation Learning for Lifelong Learning/3952a27e-2e48-46dd-9cb1-a6c27f524cf3_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..09894659b6891bb909f4fb89979a872e1075e3ca --- /dev/null +++ b/ICLR/2025/Semantic Aware Representation Learning for Lifelong Learning/3952a27e-2e48-46dd-9cb1-a6c27f524cf3_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c81359e24e815b9f89965cbc3107291b9845477fff5e2e2d42e2b158c6d36c48 +size 11620019 diff --git a/ICLR/2025/Semantic Aware Representation Learning for Lifelong Learning/full.md b/ICLR/2025/Semantic Aware Representation Learning for Lifelong Learning/full.md new file mode 100644 index 0000000000000000000000000000000000000000..3d71a071367b7f7a2de1affdbbb3f2afd2bdd639 --- /dev/null +++ b/ICLR/2025/Semantic Aware Representation Learning for Lifelong Learning/full.md @@ -0,0 +1,363 @@ +# SEMANTIC-AWARE REPRESENTATION LEARNING FOR LIFELONG LEARNING + +Fahad Sarfraz $^{1,2}$ , Elahe Arani $^{1,3,*}$ & Bahram Zonooz $^{1,*}$ + +1 Dep. of Mathematics and Computer Science, Eindhoven University of Technology (TU/e), Netherlands +2 TomTom, Netherlands +3 Wayve Technologies Ltd, London, United Kingdom {f.sarfraz, e.arani, b.zonooz}@tue.nl + +# ABSTRACT + +The human brain excels at lifelong learning by not only encoding information in sparse activation codes, but also leveraging rich semantic structures and relationships between newly encountered and previously learned objects. This ability to utilize semantic similarities is crucial for efficient learning and knowledge consolidation, yet it is often underutilized in current continual learning approaches. To bridge this gap, we propose Semantic-Aware Representation Learning (SARL), which employs sparse activations and a principled approach to evaluate similarities between objects encountered across different tasks and subsequently uses them to guide representation learning. Using these relationships, SARL enhances the reusability of features and reduces interference between tasks. This approach empowers the model to adapt to new information while maintaining stability, significantly improving performance in complex incremental learning scenarios. Our analysis demonstrates that SARL achieves a superior balance between plasticity and stability by harnessing the underlying semantic structure. $^{1}$ + +# 1 INTRODUCTION + +Deep neural networks (DNNs) have been designed for static in-distribution batch learning, whereby the model assumes that each batch of training data is representative of the underlying joint distribution. However, this assumption fails when processing sequential data in continual learning (CL) scenarios where information is made available incrementally over time, and hence the training batch at a given point only contains samples from the current task. The inadequacy of standard training to handle such dynamic data distributions often results in catastrophic forgetting (McCloskey & Cohen, 1989), erasing previously acquired knowledge as the model learns the new data. To address these challenges, CL methods aim to retain previous knowledge while learning new tasks, enabling models to accumulate knowledge across tasks (Parisi et al., 2019). The key challenge in CL is maintaining an optimal balance between stability and plasticity (Mermillod et al., 2013): the model needs enough plasticity to quickly adapt to new tasks, but also enough stability to preserve previously acquired knowledge. Existing approaches often trade off between high plasticity (quick adaptation) and high stability (knowledge retention), without effectively balancing the two. This trade-off highlights the difficulty in consolidating knowledge efficiently while learning sequentially. + +Many CL approaches tend to emphasize either stability or plasticity, often overlooking the complex relationship between these two essential components. Stability-focused methods aim to preserve important weights to maintain previously acquired knowledge (Zenke et al., 2017; Li et al., 2023), while plasticity-oriented approaches allow significant representation changes to adapt flexibly to new tasks (Caccia et al., 2022; Liang & Li, 2023). This dichotomy often treats stability and plasticity as separate objectives rather than interconnected factors in knowledge consolidation. We hypothesize that leveraging semantic relationships between objects can bridge this gap by enhancing knowledge transfer and integrating new information with existing knowledge. By exploiting these semantic structures, a CL model can reuse and consolidate overlapping concepts, enabling it to learn new + +objects without severely disrupting previously learned representations. This approach mirrors the human cognitive ability to form associations between related concepts, facilitating retrieval, transfer, and consolidation of knowledge across tasks (Binder & Desai, 2011; Saxena et al., 2022). + +The human brain exemplifies the power of semantic relationships in organizing and retaining knowledge. By forming associations between related concepts, the brain facilitates the retrieval, transfer, and consolidation of information. When encountering a new object similar to a previously learned one, the brain retrieves relevant information using semantic relationships (Saxena et al., 2022), aiding the learning of new objects and linking new information to existing knowledge. Furthermore, semantic relationships support knowledge consolidation and retention by reusing common concepts and adapting them in a cohesive manner. Moreover, semantic relationships play an important role in organizing memory (Artuso et al., 2022), necessitating that information be encoded in a way that captures these relationships. The brain employs sparse coding (Foldiak, 2003), where information is represented by the strong activation of a small subset of neurons. Notably, objects sharing concepts likely activate overlapping sets of neurons, efficiently encoding semantic relationships. We hypothesize that emulating these mechanisms can enable DNNs to better balance stability and plasticity by leveraging the rich semantic structure between objects. + +To this end, Semantic-Aware Representation Learning (SARL) emulates sparse coding in the brain and employs a principled approach to capture the semantic relationships between objects and to use them to guide representation learning. SARL leverages activation sparsity to emulate sparse coding and represents each object through semantically rich object prototypes (Snell et al., 2017) derived from the mean sparse activations of the object samples. These prototypes effectively capture the semantic structure of object relationships, allowing the model to reuse and consolidate knowledge efficiently. By capturing the inherent similarities between objects, SARL leverages semantic relationships to guide the alignment of new object prototypes with those of similar classes from previously learned tasks, while promoting separation from dissimilar ones. This alignment encourages a structured representation of knowledge, facilitating knowledge transfer across tasks and reducing interference. Furthermore, SARL incorporates prototype regularization to ensure model stability, mitigating the risk of forgetting previously learned information, and fostering effective consolidation of knowledge in a cohesive manner. This mechanism enables the preservation of valuable representations while adapting to new tasks, ultimately enhancing the model's overall learning capabilities. + +Our empirical analysis on challenging class-incremental learning scenarios across various datasets demonstrates that SARL significantly enhances lifelong learning performance by leveraging semantic structure for representation learning. By effectively aligning representations based on semantic relationships, SARL facilitates efficient knowledge transfer and consolidation, enabling the model to adapt seamlessly to new tasks while retaining previously acquired knowledge. These capabilities are further supported by our analysis, which reveals that SARL achieves a better balance between model stability and plasticity, mitigates forgetting, and reduces task recency bias. + +# 2 RELATED WORK + +Approaches to addressing catastrophic forgetting in CL can be broadly categorized into three groups. Regularization-based methods penalize changes in the model either in parameter space (Farajtabar et al., 2020; Ritter et al., 2018) or functional space (Benjamin et al., 2019; Li & Hoiem, 2017). These methods primarily focus on stability and generally fail in class-incremental learning settings where task information is unavailable. Dynamic architecture approaches (Rusu et al., 2016), expand the network to allocate distinct parameters for each task. While reducing forgetting, these methods lead to model size scaling linearly with the number of tasks and often require task identity at test time, limiting their applicability. Rehearsal-based approaches draw inspiration from the brain's experience replay for knowledge consolidation (Olafsdóttir et al., 2018). They store a subset of data samples from previous tasks in a memory buffer, which are interleaved with new tasks samples to approximate the joint distribution. Rehearsal-based approaches have proven to be more general and effective for various continual learning scenarios (Farquhar & Gal, 2018). + +The baseline Experience Replay (ER) (Riemer et al., 2018) interleaves the training of new task samples with previous task samples in memory. Several approaches have since been proposed to provide additional learning cues to the model from its previous state. Dark Experience Replay (DER++) + +![](images/ed0ce2a593b620efed03f75d99909773026c5b2a88e1cde788cd20b86b1cd809.jpg) +Figure 1: SARL employs activation sparsity to emulate brain-like sparse coding, representing each object with a class prototype derived from the mean representations of object samples. The semantic relationships are utilized to encourage new object prototypes to align with the class prototypes of similar objects and diverge from dissimilar ones. Additionally, SARL ensures model stability through prototype regularization, mitigating forgetting and enabling effective consolidation of information in lifelong learning. Darker shades represent higher values. + +(Buzzega et al., 2020) additionally stores the output logits and applies a consistency loss to the memory samples. ER-ACE (Caccia et al., 2022) uses an asymmetric cross-entropy loss, considering only new task logits, on the incoming samples to reduce representation drift. Gradient Coreset Replay (GCR)(Tiwari et al., 2022) selects and maintains a core-set based on gradient approximation. + +Recently, there has been a shift towards multi-memory-based CL approaches, inspired by the complementary learning systems theory in the brain (McClelland et al., 1995). CLS-ER (Arani et al., 2022) simulates the interaction between fast and slow learning by using two semantic memories that aggregate model weights at different rates with an exponential moving average. $\mathrm{CO}^2\mathrm{L}$ (Cha et al., 2021) initially learns representations with a modified SupCon loss and subsequently trains a classifier using samples from the last task and buffer data. Deep Retrieval and Imagination (DRI)(Wang et al., 2022a) leverages an embedding network and generative model to retrieve and generate imaginary data. SCoMMER (Sarfraz et al., 2023) enforces sparse coding for efficient representation learning and uses multiple memories, using the previous state of the model to reduce similarity drift. While these multi-memory approaches effectively reduce forgetting, they incur additional computational and memory costs, which can be prohibitive in some real-world settings. Therefore, we believe that it is crucial to improve CL performance in a single-model setting, which can later be extended to a dual-memory framework. Please see extended related work in Appendix G. + +# 3 METHODOLOGY + +We begin with an overview of the biological mechanisms that inspire our approach, followed by details on how we mimic these mechanisms in DNNs and an outline of our overall formulation. + +# 3.1 BIOLOGICAL MOTIVATION + +The human brain excels at adapting to dynamic environments by transferring knowledge from previously learned concepts to new ones, mitigating interference, and efficiently consolidating information. A critical component of this lifelong learning ability is the brain's capacity to exploit semantic relationships between objects, which guides both information encoding and memory formation (Binder & Desai, 2011). By establishing associations between related concepts, the brain organizes information into semantic networks in which interconnected concepts share common features, enabling efficient retrieval, transfer, and consolidation of knowledge (Saxena et al., 2022). When encountering a new objects, the brain rapidly integrates them into these networks, leveraging previ + +![](images/fc2ee1237e632866b1e9ea12bfbe8fff577912afb8ae0d49f7743a0c358d6276.jpg) +Figure 2: Similarity matrices were computed using object representations from the model trained on the joint CIFAR-10 dataset, with dense and sparse activations, respectively. + +![](images/b435155d4324ee5766345d9940b989a01dc8f1463d4e8f996664e27c9e88935b.jpg) + +ously acquired knowledge to facilitate learning and reduce relearning efforts. This process is further supported by the brain's use of sparse coding (Foldiak, 2003), where only a small subset of neurons is activated. Objects with conceptual similarities activate overlapping neuron sets, hence efficiently encoding semantic relationships which can be leveraged for retrieval and learning. + +Inspired by these cognitive mechanisms, we propose that incorporating sparsely activated neurons, which allow for the extraction of semantic structures, and leveraging these relationships for learning in DNNs, can significantly enhance their lifelong learning capabilities. + +# 3.2 SEMANTIC-AWARE REPRESENTATION LEARNING + +Building on these cognitive insights, we introduce Semantic-Aware Representation Learning (SARL), which adopts a principled approach to extract the semantic relationships between objects encountered across sequential tasks and subsequently utilizes them to guide representation learning in a cohesive manner. SARL draws inspiration from the brain's sparse coding approach and employs activation sparsity to facilitate semantic information encoding in representations. Each object is represented by an object prototype, capturing the average features of its instances, which are saved in memory at the end of each task. By evaluating the similarity between these stored prototypes and the average features of new objects, SARL identifies sets of positive (similar) and negative (dissimilar) objects from both previous and current tasks. Leveraging these relationships, SARL applies a novel semantic-aware metric learning approach, guiding the model to bring representations of new objects closer to similar prototypes while distancing them from dissimilar ones. This mechanism enables the model to reuse knowledge from similar objects, enhancing learning efficiency and reducing interference. To further promote stability, SARL implements prototype-based regularization, encouraging the activations of previously learned objects to remain consistent with their established prototypes and thus preventing drift over time. By integrating new information in a structured manner, SARL fosters effective knowledge consolidation and maintains a balance between plasticity and stability in lifelong learning. The following sections introduce the different components of SARL. + +# 3.3 SPARSE CODING + +To mimic sparse coding in the brain, we employ activation sparsity using k-winners-take-all (k-WTA) (Maass, 2000), where only the K most active neurons in each layer are allowed to propagate to the next layer. For convolutional layers, we apply k-WTA locally across the channels at each spatial location rather than globally across the entire input and all channels. This localized approach ensures that the most relevant features are selected at each position, promoting specialization of filters. As a result, the network can focus on distinct patterns at different spatial locations, leading to more efficient feature extraction, better semantic encoding, and reduced interference in lifelong learning scenarios. + +# 3.3.1 OBJECT PROTOTYPES + +Building on the sparse coding mechanism through k-WTA, we extend this principle to our formulation of object prototypes. These prototypes are central to capturing and incorporating the intrinsic similarities between objects to guide representation learning. By capturing shared concepts through overlapping sparse activations, k-WTA offers an efficient and intuitive method to encode such relationships. Each object is represented by its object prototype, defined as the mean of all instance representations, a strategy commonly employed in metric learning (Kaya & Bilge, 2019). Specifically, we utilize the $\ell_2$ -normalized activations of the penultimate layer as object representations, with the prototype for each class $c$ computed as: + +$$ +\mathcal {O} _ {c} = \frac {1}{N _ {c}} \sum_ {i} \mathbb {I} (y _ {i} = c) a _ {i} ^ {\prime} \tag {1} +$$ + +where $a_{i}^{\prime}$ represents the normalized activation of sample $x_{i}$ with label $y_{i}$ , and $N_{c}$ is the number of instances in class $c$ . This provides an efficient means of forming object prototypes that guide subsequent learning. At the end of each task, we calculate and store the object prototypes of all the new object categories. Hence, while learning task $t$ , we have access to the object prototypes for all the object categories learned until task $t - 1$ . + +# 3.3.2 SEMANTIC-AWARE METRIC LEARNING + +Having developed an efficient method for representing objects using prototypes that capture the essence of each category, we can now evaluate the similarity between objects across tasks. We use cosine similarity, which measures the cosine of the angle between two class prototypes, providing a scale-invariant measure independent of magnitude. This approach is particularly advantageous when comparing object prototypes, as it focuses on directional alignment between vectors rather than their magnitudes, effectively capturing semantic similarity in high-dimensional spaces. The similarity between the object categories $i$ and $j$ , and the corresponding object prototypes $\mathcal{O}_i$ and $\mathcal{O}_j$ is given by: + +$$ +\operatorname {s i m} \left(\mathcal {O} _ {i}, \mathcal {O} _ {j}\right) = \frac {\mathcal {O} _ {i} \cdot \mathcal {O} _ {j}}{\| \mathcal {O} _ {i} \| \cdot \| \mathcal {O} _ {j} \|} \tag {2} +$$ + +This provides us with an efficient approach to evaluating the similarity between object categories encountered across different tasks, which is subsequently used to inform learning. Figure 2 shows that the proposed approach can capture semantic similarities, and sparse activations further enhance the model's ability to distinguish between similar and dissimilar objects. Section E in Appendix shows that sparse activations enhances the capacity of the model to capture semantic similarities between objects within animal and vehicle clusters as well as between the two clusters. + +Specifically, for each new object category introduced in task $t$ , we calculate intermediate object prototypes $\overline{\mathcal{O}}$ using Equation 1, and evaluate the similarity between each new object and other objects in the combined set of both newly introduced and previously learned object categories. We employ a warm-up stage for each new task to allow the model to learn meaningful representations before computing the intermediate object prototypes. For each new object category $c$ , we use the degree of similarity between object prototypes to identify a set of similar object categories $\mathbb{S}_c$ : + +$$ +\mathbb {S} _ {c} = \{i \mid \mathcal {O} _ {i} \geq \tau_ {s} \wedge i \neq c \quad \forall i \in \mathbb {C} ^ {0: t} \} \tag {3} +$$ + +where $\tau_{s}$ is the similarity threshold ranging from 0 to 1, and $\mathbb{C}^{0:t}$ represents the set of all object categories observed up to task $t$ . + +We employ our semantic-aware metric learning loss in subsequent epochs following the warm-up stage. For each new object category $c$ , we encourage the mean $\ell_2$ -normalized representations of its object instances in the batch, denoted as $\overline{o_c}$ , to be closer to the object prototypes of objects in the set $\mathbb{S}_c$ —indicating similarity. Simultaneously, they are pushed to be distant from dissimilar objects. Formally, the loss is given by: + +$$ +\mathcal {L} _ {S M} = \sum_ {c \in \mathbb {C} ^ {t}} \frac {\sum_ {i \in \mathbb {S} _ {c}} \| \mathcal {O} _ {i} - \bar {o} _ {c} \| ^ {2}}{\sum_ {i \notin \mathbb {S} _ {c}} \| \mathcal {O} _ {i} - \bar {o} _ {c} \| ^ {2}} \tag {4} +$$ + +where $\mathbb{C}^t$ is the set of new object categories at task $t$ . The semantic-aware metric learning loss enables the model to leverage similarities between objects and acquire semantic-aware representations. This, in turn, facilitates effective knowledge sharing and reusing while mitigating interference. Such enhancements augment the model's capacity to consolidate knowledge more cohesively. + +# 3.3.3 REGULARIZATION ON OBJECT PROTYPES + +To enhance stability and preserve the semantic structure within the acquired representations, we introduce a regularization loss on the object prototypes. This regularization is applied to buffer samples, penalizing the divergence of mean representations of buffered samples in the batch from their originally learned object prototypes. Formally, in each training batch, we sample from the memory buffer, $M_{b}$ , calculate the $\ell_{2}$ -normalized mean representations for each object category, $o_{c}^{b}$ and minimize the mean squared error between $o_{c}^{b}$ and their corresponding object prototypes, $\mathcal{O}_{c}$ , stored in the prototype memory, $M_{o}$ : + +$$ +\mathcal {L} _ {O P} = \sum_ {c \in \mathbb {C} ^ {0: t - 1}} \| \boldsymbol {o} _ {c} ^ {b} - \mathcal {O} _ {c} \| ^ {2} \tag {5} +$$ + +where $\mathbb{C}^{0:t - 1}$ is the set of previously learned object categories. By imposing this regularization, we encourage the model to maintain the semantic integrity of learned object categories across tasks, minimizing deviations in the representations of buffered samples from their learned prototypes. This not only fosters stability in the model's knowledge but also mitigates the risk of forgetting important semantic relationships established in earlier learning phases. + +# 3.3.4 FUNCTIONAL REGULARIZATION + +Functional regularization plays a crucial role in helping models retain previous knowledge and effectively consolidate new information by directly regulating changes in the model's input-output behavior rather than just its parameters. When applied to new data, it encourages the model to adapt while remaining within the functional vicinity of its previous state, thereby facilitating the smooth integration of new information. On old data, functional regularization helps maintain consistency with prior learned functions, minimizing forgetting by directly aligning the current model's outputs with those from earlier tasks. This approach stabilizes the learning process and allows the model to evolve while preserving essential knowledge. + +Specifically, before training on a new task, we pass its samples through the model and save the output logits, denoted as $z^t$ , in memory. This allows us to enforce functional consistency during training on the new task without the need to maintain the previous model state in memory. To further promote consistency in model behavior and maintain semantic relationships, we also save the output logits along with the data samples in a memory buffer. During the replay of these samples, similar to Buzzega et al. (2020), we apply a consistency regularization loss on the model's output. At each training step with new task samples $x^t$ and $y^t$ , along with their precomputed output logits $z^t$ from previous model state, we sample $x^b$ , $y^b$ , and $z^b$ from the memory buffer and apply the following functional consistency loss: + +$$ +\mathcal {L} _ {F R} = \alpha \| F \left(x ^ {b}: \theta\right) - z ^ {b} \| ^ {2} + \beta | F \left(x ^ {t}: \theta\right) - z ^ {t} \| ^ {2} \tag {6} +$$ + +where $F(.)$ is the model's output parameterized by weights $\theta$ . $\alpha$ and $\beta$ control the strength of functional consistency on buffer samples and new task samples, respectively. This combination of regularization on object prototypes and regularization of consistency improves the stability of the model and preserves the semantic structure learned in previous tasks. + +# 3.4 OVERALL FORMULATION + +SARL involves training a model $f(\cdot ;\theta)$ on a non static data stream, $D$ containing a sequence of T i.i.d tasks $(D^{1},D^{2},\dots ,D^{T})$ . To employ rehearsal, it maintains a small episodic memory, $M_{b}$ using reservoir sampling (Vitter, 1985). Additionally, it maintains a memory of object prototypes, $M_{o}$ . During each training iteration of task t, the model is fed with the training batch $(x^{t},y^{t})\sim D^{t}$ and a random batch from episodic memory $(x^{b},y^{b},z^{b})\sim M_{b}$ . Task 1 is trained using standard cross-entropy loss. For each subsequent task, we employ a warm-up stage where we train the model + +Table 1: Comparison analysis of single- and dual-model CL methods across various CL settings. The baseline taken from the repetitive methods. We ran SCoMMER for Seq-TinyImageNet using the hyperparameter setting approach provided by the authors. We report the average accuracy and 1 std of 3 different seeds. + +
BufferMethodSeq-CIFAR10Seq-CIFAR100Seq-TinyImg
Class-ILTask-ILClass-ILTask-ILClass-ILTask-IL
-JOINT92.20±0.1598.31±0.1270.62±0.6486.19±0.4359.99±0.1982.04±0.10
SGD19.62±0.0561.02±3.3317.58±0.0440.46±0.997.92±0.2618.31±0.68
200ER44.79±1.8691.19±0.9421.40±0.2261.36±0.398.49±0.1638.17±2.00
FDR30.91±2.7491.01±2.7422.02±0.00861.72±1.028.70±0.1940.36±0.68
DER++64.88±1.1791.92±0.6029.60±1.1462.49±0.7810.96±1.1740.87±1.16
ER-ACE62.08±1.4435.17±1.1727.44±0.6425.29±1.8911.25±0.5444.17±1.02
GCR64.84±1.6390.8±1.0533.69±1.4064.24±0.8313.05±0.9142.11±1.01
CO2L65.57±1.3793.43±0.7831.90±0.3855.02±0.313.88±0.4042.37±0.74
CLS-ER66.19±0.7593.90±0.6043.80±1.8973.49±1.0423.47±0.8049.60±0.72
SCOMMER69.19±0.6193.20±0.1040.25±0.0569.39±0.4316.30±1.5449.37±0.81
SARL70.97±0.4795.72±0.3648.96±0.5378.91±0.1528.95±1.1371.56±0.18
500ER57.74±0.2793.61±0.2728.02±0.3168.23±0.169.99±0.2948.64±0.46
FDR28.71±3.2393.29±0.5929.19±0.3369.76±0.5110.54±0.2149.88±0.71
DER++72.70±1.3693.88±0.5041.40±0.9670.61±0.1119.38±1.4151.91±0.68
ER-ACE68.45±1.7840.67±0.0630.14±1.1124.81±0.6317.73±0.5649.99±1.51
GCR74.69±0.8594.44±0.3245.91±1.3071.64±2.1019.66±0.6852.99±0.89
CO2L74.26±0.7739.21±0.3939.21±0.3962.98±0.5820.12±0.4253.04±0.69
CLS-ER75.22±0.7194.94±0.5351.40±1.0078.12±0.2431.03±0.5660.41±0.50
SCOMMER74.97±1.0594.36±0.0649.63±1.4375.49±0.4322.60±0.8558.46±1.31
SARL75.64±0.3695.95±0.2455.30±0.6181.23±0.2432.56±1.2370.94±0.43
+ +with the combination of cross-entropy loss, $\mathcal{L}_{CE}$ on the training batch and buffer samples and the regularization losses. At the end of the warm-up stage when the model has learned meaningful representations, we evaluate the intermediate object references for each object category, $c$ , in the current task using Equation 1 and identify a set of corresponding similar object categories, $\mathbb{S}_c$ using Equation 3 to employ the semantic-aware metric learning loss in the subsequent training on the task. The overall loss for training the model is given by: + +$$ +\mathcal {L} = \mathcal {L} _ {C E} \left(F \left(x ^ {t}: \theta\right), y ^ {t}\right) + \mathcal {L} _ {C E} \left(F \left(x ^ {b}: \theta\right), y ^ {b}\right) + \lambda_ {S M} \mathcal {L} _ {S M} + \lambda_ {O P} \mathcal {L} _ {O P} + \mathcal {L} _ {F R} \tag {7} +$$ + +where $\lambda_{SM}$ and $\lambda_{OP}$ are the hyperparameters that control the weight of each loss. + +At the end of each task, we evaluate the object prototypes of the object categories introduced in the task using Eqn 1. Additionally, to mitigate the biases of the batch norm statistics towards the current task (Pham et al., 2022), we employ a simple yet effective technique of passing the model through all buffer samples to shift the batch norm statistics towards the approximate joint distribution. + +# 4 EMPIRICAL EVALUATION + +Settings. To evaluate the effectiveness of SARL, we consider various CL scenarios that each present unique challenges for lifelong learning models. In the class-incremental learning (Class-IL) scenario, with each new task, the model is introduced to a new set of classes and must learn to distinguish not only among the current task's classes but also across all previously encountered classes. This setting tests the model's ability to build generalizable representations, consolidate knowledge, and transfer that knowledge to efficiently distinguish all classes seen so far. We only train our models for the Class-IL setting; for completion, we also provide task-incremental learning (Task-IL) setting. In this context, the model has access to task labels during inference, enabling the utilization of task labels to selectively choose the subset of output logits. + +While Class-IL focuses on knowledge accumulation across distinct tasks, it does not fully capture the complexity of real-world scenarios, where tasks often lack clear boundaries, and classes can + +Table 2: Comparison analysis of single- and dual-model CL methods on GCIL-CIFAR-100 dataset. + +
Dist.BufferJOINTSGDERDER++CLS-ERSCoMMERSARL
Uniform20058.36±1.0212.67±0.2416.40±0.3718.84±0.6025.06±0.8130.84±0.8036.97±0.54
50028.21±0.6932.92±0.7436.34±0.5936.87±0.3639.03±0.45
Longtail20056.94±1.5622.88±0.5319.27±0.7726.94±1.2728.54±0.8729.08±0.3135.26±0.75
50020.30±0.6325.82±0.8328.63±0.6835.20±0.2135.47±1.20
+ +![](images/2c14067529c4cf87bf4d6521dedda89c2e767e7d83b7204168b9fe27dbc5747a.jpg) +Figure 3: Cosine similarities between the object prototypes computed at the end of each training task on Seq-CIFAR10 with 200 buffer size and the similarity structure of the final model on test set. + +![](images/8a677bb7c32108dcf3e92bc48adf949c08d2250a74e217e959adae9c08ccaa36.jpg) + +reappear with varying distributions. To address this, we also evaluate SARL in the generalized class-incremental learning (GCIL) setting. GCIL introduces a more dynamic and realistic environment where classes reoccur across tasks, and the number of classes and their sample sizes can vary. This scenario tests the model's ability to deal with class imbalance, sample efficiency, and the continual integration of knowledge from overlapping or reappearing classes. + +Additionally, we consider online continual learning (Online CL), a highly challenging setting where the model is exposed to each data instance only once, requiring it to learn and adapt dynamically without revisiting previous data. Details of the experimental setup and datasets are provided in Appendix A. + +Results. We benchmarked SARL's performance against established rehearsal-based approaches across varying CL settings and dataset complexities. Table 1 demonstrates consistent performance improvements across all settings. Notably, under the low buffer regime, where the model has to retain knowledge while having access to very limited samples from previous tasks (approximately two samples per class for Seq-CIFAR-100 and one sample per class for Seq-Tiny/ImageNet), SARL effectively retains previously acquired knowledge, demonstrating its ability to learn new tasks while remaining in the functional vicinity of earlier tasks despite the limited buffer size and consolidating knowledge as it learns new tasks. Interestingly, as the complexity of the dataset increases with the number of classes with high semantic similarity, the performance gains are more pronounced, suggesting that SARL is able to exploit the semantic structure and utilize it to consolidate knowledge. + +Table 2 highlights the advantage of SARL in the challenging GCIL setting, where the model must update its knowledge across multiple occurrences of the same object with varying sample sizes, while addressing class imbalance and task complexity. SARL's ability to update object prototypes when re-encountering a class ensures efficient use of new samples without penalizing for deviations from earlier suboptimal representations. SARL shows remarkable resilience to these challenges and provides additional credence to the benefits of semantic-aware representation learning. + +These results are particularly impressive considering that SARL uses only a single model, while many state-of-the-art methods rely on multiple models. For instance, CLS-ER uses two additional models, and SCoMMER incorporates one. Although these methods claim to use a single model for inference, the distinction between training and inference in lifelong learning is blurred, as the model + +Table 3: Performance comparison across Seq-CIFAR10 and Seq-CIFAR100 in the online CL setting. Baseline results are taken from Wu et al. (2024). We report the mean and std of three runs. + +
MethodSeq-CIFAR10Seq-CIFAR100
AAAAccAAAAcc
SGD34.85±1.7116.96±0.6011.63±0.385.27±0.28
ER55.53±2.5843.83±4.8423.19±0.3816.07±0.88
DER45.85±1.6229.87±2.9513.35±0.366.12±0.18
DER++64.22±0.7052.29±1.8619.88±0.4311.79±0.65
CLSER63.02±1.5452.80±1.6625.46±0.5717.88±0.69
OCM66.14±0.9553.39±1.0022.54±0.7914.40±0.82
ER-OBC65.82±0.9154.85±2.1625.54±0.2517.21±0.92
On-EWC38.44±0.5017.12±0.5111.81±0.425.88±0.31
IS37.33±0.2317.39±0.1912.32±0.225.20±0.18
La-MAML42.98±1.6033.43±1.2112.55±0.3911.78±0.65
VR-MCL66.97±1.5856.48±1.7927.01±0.4819.49±0.69
SARL66.85±1.1557.21±0.2731.66±1.4924.39±1.44
+ +must continuously learn from the environment. This can make the overhead of maintaining multiple memories prohibitive in real-world applications, especially for resource-constrained systems like embedded devices. The ability of SARL to achieve superior results with a single model further underscores its practicality and efficiency for lifelong learning. + +Additionally, while SARL is not explicitly designed for Online CL, we adapted it to this setting to assess its versatility and broader applicability. By maintaining running feature sums and sample counts to dynamically update object prototypes, SARL effectively learns in an online manner. We introduce a brief warm-up phase during the first 10 iterations of each task to stabilize feature accumulation before evaluating prototypes. Despite this adaptation being secondary to our primary focus, SARL-Online demonstrates strong performance. As shown in Table 3, it achieves notable improvements across all datasets, particularly on Seq-CIFAR100, where it significantly boosts both AAA and Acc. These results further reinforce the effectiveness of semantic-aware representation learning, highlighting SARL's adaptability to different continual learning paradigms without requiring extensive modifications. Our ablation study in Appendix B.1 shows that each component of SARL contributes to the performance gains. + +# 5 ANALYSIS + +Here, we delve deeper into what enables performance improvements in SARL. We compare with the baseline ER and the state-of-the-art in single-model (DER++) and multiple-memory (SCOMMER). + +# 5.1 SEMANTIC STRUCTURE + +At the core of SARL is semantic-aware representation learning. We investigate whether SARL can learn and retain a meaningful semantic structure during sequential task training. We evaluate the similarities between object prototypes calculated stored in memory during training that are evaluated at the end of each task for new object categories and compared them with the similarity structure of the trained model on test data. Figure 3 shows that SARL not only retains the similarity structure but also updates it by consolidating new knowledge. Notably, the class prototypes from early tasks, where the model was trained to distinguish only between two classes, show strong similarities even with other classes, indicating that the initial representations were not yet fully optimized for all classes. However, as the model encounters more tasks, the semantic relationships across classes become more refined and meaningful. For instance, classes such as 'cat', 'dog', and 'horse' exhibit higher similarity values post-training, reflecting their semantic coherence, while unrelated classes such as 'plane' and 'truck' maintain lower similarities. The semantic-aware metric learning loss, combined with object prototype regularization, guides training to enforce and maintain this semantic + +![](images/9b6e7a049b8aa08850a3088cc37395a0926f7f519f25c86b33ec51f41ba55b18.jpg) +(a) Stability Plasticity Tradeoff + +![](images/93fe2628e4466dbf67d7756d6bc3a9d833e8809fa78ad70c49a5ea566f0adeb9.jpg) +(b) Recency Bias +Figure 4: (a) Comparison of the stability and plasticity of the models; and (b) average probability of predicting each task at the end of training for models trained on Seq-CIFAR100 with 200 buffer size. Figure 5 in Appendix shows the task-wise performance of the different models. + +structure, allowing the model to incorporate new knowledge without losing the relationships between previously learned classes. + +# 5.2 STABILITY-PLASTICITY TRADE-OFF + +Continual learning requires balancing plasticity (learning new tasks) and stability (retaining past knowledge). To evaluate this trade-off, we use the metric from (Sarfraz et al., 2022), where plasticity (P) is the average performance on newly learned tasks, and stability (S) is the retention of past tasks after learning task t. The trade-off is given by $(2\mathrm{xPxS}) / (\mathrm{P} + \mathrm{S})$ . Figure 4(a) shows that SARL significantly enhances stability without sacrificing plasticity, achieving a $362\%$ gain over ER and $127\%$ over $\mathrm{DER}++$ . In contrast, SCoMMER, which employs an additional exponentially averaged model for knowledge accumulation, improves stability but severely degrades plasticity over longer task sequences, as reflected in its lower final-task accuracy (47.7% vs. 73.60% for SARL, Figure 5 in Appendix). This highlights the advantage of SARL's semantic-aware sparse learning in fostering a better stability-plasticity balance. + +Sequential task learning also introduces a recency bias, favoring recently seen objects (Hou et al., 2019). Figure 4(b) shows that SARL significantly reduces this bias compared to ER and $\mathrm{DER}++$ . While SCoMMER's EMA model produces more uniform predictions, it exhibits a declining probability for the last task, which may impact long-term performance. Notably, SARL assigns higher probabilities to earlier tasks, suggesting that its regularization mechanisms effectively preserve the initial function space, mitigating forgetting. + +These analyses collectively show that SARL is able to effectively evaluate semantic similarities between objects across tasks and utilize them to enforce a semantic structure in the representation space. This creates a synergy between plasticity and stability, leading to a better balance between the two and reduces forgetting and recency bias. + +# 6 CONCLUSION + +Inspired by how the brain uses sparse coding and semantic relationships between objects to inform memory formation and retrieval, we proposed semantic-aware representation learning (SARL), which employs sparse activations to create semantically rich object prototypes which can effectively capture the inherent similarities between objects. The semantic structure is leveraged to align new object representations with similar objects from previous tasks while promoting separation from dissimilar ones. Our approach facilitates feature reuse while reducing interfering, creating a synergy between the plasticity and stability of the model. Our empirical evaluation in challenging CL scenarios demonstrates SARL's effectiveness. By enforcing a semantic structure on the representations of objects across tasks, SARL balances model plasticity and stability, reduces task recency bias, and mitigates forgetting. Our findings present a compelling case for incorporating semantic-aware representation learning similar to the brain's method. + +# REFERENCES + +Elahe Arani, Fahad Sarfraz, and Bahram Zonooz. Learning fast, learning slow: A general continual learning method based on complementary learning system. In International Conference on Learning Representations, 2022. URL https://openreview.net/forum?id=uxxFrDwrE7Y. +Caterina Artuso, Francesco Bossi, Carmen Belacchi, and Paola Palladino. Effects of semantic relationship and preactivation on memory updating. Cognitive Processing, 23(3):407-422, 2022. +Ari Benjamin, David Rolnick, and Konrad Kording. Measuring and regularizing networks in function space. In International Conference on Learning Representations, 2019. URL https://openreview.net/forum?id=SkMwpiR9Y7. +Jeffrey R Binder and Rutvik H Desai. The neurobiology of semantic memory. Trends in cognitive sciences, 15(11):527-536, 2011. +Pietro Buzzega, Matteo Boschini, Angelo Porrello, Davide Abati, and Simone Calderara. Dark experience for general continual learning: a strong, simple baseline. Advances in neural information processing systems, 33:15920-15930, 2020. +Lucas Caccia, Rahaf Aljundi, Nader Asadi, Tinne Tuytelaars, Joelle Pineau, and Eugene Belilovsky. New insights on reducing abrupt representation change in online continual learning. In International Conference on Learning Representations. +Lucas Caccia, Rahaf Aljundi, Nader Asadi, Tinne Tuytelaars, Joelle Pineau, and Eugene Belilovsky. New insights on reducing abrupt representation change in online continual learning. In International Conference on Learning Representations, 2022. URL https://openreview.net/forum?id=N8MaByOzUfb. +Hyuntak Cha, Jaeho Lee, and Jinwoo Shin. Co2l: Contrastive continual learning. In Proceedings of the IEEE/CVF International conference on computer vision, pp. 9516-9525, 2021. +Mehrdad Farajtabar, Navid Azizan, Alex Mott, and Ang Li. Orthogonal gradient descent for continual learning. In International Conference on Artificial Intelligence and Statistics, pp. 3762-3773. PMLR, 2020. +Sebastian Farquhar and Yarin Gal. Towards robust evaluations of continual learning. arXiv preprint arXiv:1805.09733, 2018. +Peter Foldiak. Sparse coding in the primate cortex. The handbook of brain theory and neural networks, 2003. +Saihui Hou, Xinyu Pan, Chen Change Loy, Zilei Wang, and Dahua Lin. Learning a unified classifier incrementally via rebalancing. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 831-839, 2019. +Mahmut Kaya and Hasan Şakir Bilge. Deep metric learning: A survey. Symmetry, 11(9):1066, 2019. +Alex Krizhevsky et al. Learning multiple layers of features from tiny images. 2009. +Ya Le and Xuan Yang. Tiny imagenet visual recognition challenge. CS 231N, 7(7):3, 2015. +Haoran Li, Jingfeng Wu, and Vladimir Braverman. Fixed design analysis of regularization-based continual learning. In Conference on Lifelong Learning Agents, pp. 513-533. PMLR, 2023. +Zhizhong Li and Derek Hoiem. Learning without forgetting. IEEE transactions on pattern analysis and machine intelligence, 40(12):2935-2947, 2017. +Yan-Shuo Liang and Wu-Jun Li. Adaptive plasticity improvement for continual learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 7816-7825, 2023. + +Wolfgang Maass. On the computational power of winner-take-all. Neural computation, 12(11): 2519-2535, 2000. +James L McClelland, Bruce L McNaughton, and Randall C O'Reilly. 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, 1995. +Michael McCloskey and Neal J Cohen. Catastrophic interference in connectionist networks: The sequential learning problem. In *Psychology of learning and motivation*, volume 24, pp. 109-165. Elsevier, 1989. +Martial Mermillod, Aurélia Bugaiska, and Patrick Bonin. The stability-plasticity dilemma: Investigating the continuum from catastrophic forgetting to age-limited learning effects. Frontiers in psychology, 4:504, 2013. +Fei Mi, Lingjing Kong, Tao Lin, Kaicheng Yu, and Boi Faltings. Generalized class incremental learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition Workshops, pp. 240-241, 2020. +Xing Nie, Shixiong Xu, Xiyan Liu, Gaofeng Meng, Chunlei Huo, and Shiming Xiang. Bilateral memory consolidation for continual learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 16026-16035, 2023. +H Freyja Olafsdóttir, Daniel Bush, and Caswell Barry. The role of hippocampal replay in memory and planning. *Current Biology*, 28(1):R37–R50, 2018. +German I Parisi, Ronald Kemker, Jose L Part, Christopher Kanan, and Stefan Wermter. Continual lifelong learning with neural networks: A review. Neural Networks, 113:54-71, 2019. +Quang Pham, Chenghao Liu, and Steven HOI. Continual normalization: Rethinking batch normalization for online continual learning. In International Conference on Learning Representations, 2022. URL https://openreview.net/forum?id=vwLLQ-HwqhZ. +Biqing Qi, Xinquan Chen, Junqi Gao, Dong Li, Jianxing Liu, Ligang Wu, and Bowen Zhou. Interactive continual learning: Fast and slow thinking. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 12882-12892, 2024. +Matthew Riemer, Ignacio Cases, Robert Ajemian, Miao Liu, Irina Rish, Yuhai Tu, and Gerald Tesauro. Learning to learn without forgetting by maximizing transfer and minimizing interference. arXiv preprint arXiv:1810.11910, 2018. +Hippolyt Ritter, Aleksandar Botev, and David Barber. Online structured laplace approximations for overcoming catastrophic forgetting. In Advances in Neural Information Processing Systems, pp. 3738-3748, 2018. +Andrei A Rusu, Neil C Rabinowitz, Guillaume Desjardins, Hubert Soyer, James Kirkpatrick, Koray Kavukcuoglu, Razvan Pascanu, and Raia Hadsell. Progressive neural networks. arXiv preprint arXiv:1606.04671, 2016. +Fahad Sarfraz, Elahe Arani, and Bahram Zonooz. Synergy between synaptic consolidation and experience replay for general continual learning. In Conference on Lifelong Learning Agents, pp. 920-936. PMLR, 2022. +Fahad Sarfraz, Elahe Arani, and Bahram Zonooz. Sparse coding in a dual memory system for lifelong learning. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 37, pp. 9714-9722, 2023. +Rajat Saxena, Justin L Shobe, and Bruce L McNaughton. Learning in deep neural networks and brains with similarity-weighted interleaved learning. Proceedings of the National Academy of Sciences, 119(27):e2115229119, 2022. +Jake Snell, Kevin Swersky, and Richard Zemel. Prototypical networks for few-shot learning. Advances in neural information processing systems, 30, 2017. + +Rishabh Tiwari, Krishnateja Killamsetty, Rishabh Iyer, and Pradeep Shenoy. Gcr: Gradient coreset based replay buffer selection for continual learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 99-108, 2022. +Jeffrey S Vitter. Random sampling with a reservoir. ACM Transactions on Mathematical Software (TOMS), 11(1):37-57, 1985. +Zhen Wang, Liu Liu, Yiqun Duan, and Dacheng Tao. Continual learning through retrieval and imagination. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 36, pp. 8594-8602, 2022a. +Zifeng Wang, Zizhao Zhang, Sayna Ebrahimi, Ruoxi Sun, Han Zhang, Chen-Yu Lee, Xiaqi Ren, Guolong Su, Vincent Perot, Jennifer Dy, et al. Dualprompt: Complementary prompting for rehearsal-free continual learning. arXiv preprint arXiv:2204.04799, 2022b. +Zifeng Wang, Zizhao Zhang, Chen-Yu Lee, Han Zhang, Ruoxi Sun, Xiaoqi Ren, Guolong Su, Vincent Perot, Jennifer Dy, and Tomas Pfister. Learning to prompt for continual learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 139-149, 2022c. +Yichen Wu, Long-Kai Huang, Renzhen Wang, Deyu Meng, and Ying Wei. Meta continual learning revisited: Implicitly enhancing online hessian approximation via variance reduction. In The Twelfth International Conference on Learning Representations, 2024. +Friedemann Zenke, Ben Poole, and Surya Ganguli. Continual learning through synaptic intelligence. Proceedings of machine learning research, 70:3987, 2017. + +# A EXPERIMENTAL SETUP + +To ensure fair comparisons between continual learning (CL) methods and isolate algorithmic improvements from training regimen variability, we adopt consistent experimental conditions across all models. In line with Buzzega et al. (2020), we use a ResNet-18 architecture trained with an SGD optimizer and a batch size of 32 for both task data and memory buffer. We use an initial learning rate (lr) of 0.03 with multistep decay scheduler with factor 0.1. Standard data augmentations—random cropping and horizontal flipping—are applied. For all tasks, we include a warm-up stage consisting of 3 epochs, during which the model trains solely on the task-specific data without utilizing memory buffer samples. This allows the model to initialize a strong representation for each task before integrating knowledge from past tasks. For Seq-CIFAR10 we trained for 20 epochs with decay steps For Seq-CIFAR10, the model is trained for 20 epochs with lr decay steps at 15th epoch, for Seq-CIFAR100 and GCIL-CIFAR100, we extend the training to 50 epochs with lr decay steps at 35 and 45. For the Tiny ImageNet dataset, we further increase the number of epochs to 100 with lr decay steps at 70 and 90. + +# A.1 SPARSE BACKBONE: + +In all experiments, we incorporate activation sparsity by replacing ReLU activations with the k-Winner-Take-All (kWTA) activation function. In kWTA, for each layer, only the top $\mathrm{k}\%$ of activations at each spatial location are allowed to propagate, while the rest are set to zero. This localized sparsity mechanism ensures that the most relevant features are selected at each spatial location, promoting filter specialization and reducing interference across tasks. The level of sparsity (i.e., $\mathrm{k}\%$ ) is kept fixed across all layers and experiments. Beyond this change to the activation function, no other modifications are made to the backbone architecture. + +# A.2 EVALUATION SETTINGS: + +For the Class-IL setting, we follow established baselines and evaluate on three datasets: sequential CIFAR-10 (Seq-CIFAR10) (Krizhevsky et al., 2009), where 10 classes are split into 5 disjoint tasks with 2 classes per task; sequential CIFAR-100 (Seq-CIFAR100) (Krizhevsky et al., 2009), splitting 100 classes into 5 tasks with 20 classes each; and sequential TinyImageNet (Le & Yang, 2015) (Seq-TinyImageNet), where 200 classes are divided into 10 tasks of 20 classes each. + +For the Generalized Class-IL (GCIL) setting (Mi et al., 2020), probabilistic modeling is used to randomly vary three task characteristics: the number of classes, the specific classes included, and the sample sizes. As in Sarfraz et al. (2023), we apply this GCIL setting to CIFAR-100, using 20 tasks with 1,000 samples per task and a maximum of 50 classes per task. To separate the effects of class imbalance from the model's ability to learn from recurring classes across tasks, we evaluate the model on both uniform and long-tailed data distributions. For consistency, the GCIL dataset seed is fixed at 1993 for all experiments, ensuring a fair comparison across methods. + +For Online-CL, we follow previous works Caccia et al.; Wu et al. (2024) and evaluate our method under the single-head setting. For this setting, we also report average anytime accuracy (AAA) Caccia et al., which measures the model's performance throughout the training stream. Let $\mathrm{AA}_j$ denote the test average accuracy after training on task $T_{j}$ . Then, the metrics are defined as: + +$$ +\mathrm {A A A} = \frac {1}{N} \sum_ {j = 1} ^ {N} \mathrm {A A} _ {j}, \quad \mathrm {A c c} = \mathrm {A A} _ {N}, +$$ + +where $N$ is the total number of tasks. Following (Wu et al., 2024), we evaluate our method on the Seq-CIFAR10 and Seq-CIFAR100.. Seq-CIFAR10 comprises 5 tasks, each containing 2 classes, Seq-CIFAR100 consists of 10 tasks with 10 classes each. + +# B ADDITIONAL RESULTS + +# B.1 ABLATION STUDY + +![](images/34cc3fe5875fb5b991eea8d56d7a16f4fa8a11cacdc74a51f9b29fb3dd31a10e.jpg) +Figure 5: The task-wise performance (x-axis) of the different models assessed after training on each task (y-axis) in Seq-CIFAR100 with a buffer size of 200. + +Table 4: Selected hyperparameters for SARL. For all our experiments, we use $\lambda_{SM} = 0.01$ , $\tau_s = 0.8$ and $\beta = 1$ . + +
DatasetBufferkw%λOPα
Seq-CIFAR102000.80.50.2
5000.80.50.2
Seq-CIFAR1002000.90.50.5
5000.90.50.2
Seq-TinyImageNet2000.90.20.2
5000.90.50.5
GCIL-Uniform2000.70.20.2
5000.70.20.2
GCIL-Longtail2000.70.20.5
5000.70.20.5
+ +Here, we systematically assess the contribution of each key component of SARL by incrementally adding them on top of the baseline ER. Table 5 reveals the importance of each element in improving model performance. Firstly, the inclusion of sparse coding via activation sparsity alone yields a substantial performance boost. This underscores the importance of activation sparsity in mitigating task interference by allowing only the most salient neurons to remain active, effectively con + +Table 5: Impact of adding distinct elements of SARL on Seq-CIFAR10 performance with 200 buffer size. + +
Sparsity\( \mathcal{L}_{OP} \)\( \mathcal{L}_{SM} \)\( \mathcal{L}_{FR} \)Accuracy
XXXX44.79±1.86
✓XXX58.23±1.73
✓✓XX62.53±0.41
✓X✓X61.60±0.58
✓✓✓X63.83±0.60
✓✓✓✓70.97±0.47
+ +trolling task-specific noise and enhancing generalization. Next, we observe the separate effects of adding object prototype loss $(\mathcal{L}_{OP})$ and semantic-aware metric learning $(\mathcal{L}_{SM})$ on top of sparsity. Object prototype loss introduces regularization, stabilizing the model by maintaining the average representations of objects, which further improves accuracy to $63.01\%$ . Semantic-aware metric learning, on the other hand, enhances forward transfer by leveraging the semantic similarities between objects while reducing interference. Notably, when both losses are applied together, the synergy between them becomes evident. The object prototype loss ensures stable representations of previously learned object, which in turn helps semantic-aware metric learning enforce a consistent semantic structure throughout training. Finally, adding forward regularization $(\mathcal{L}_{FR})$ to the mix encourages the model to stay within the functional vicinity of previously learned states as new tasks are introduced. This final combination of all components achieves the best performance, highlighting the cohesive benefits of SARL's components working together to reduce interference and improve knowledge retention. + +# B.2 RESULTS ON DIFFERENT BACKBONE + +To further test the versatility of our approach, we evaluate SARL on the ViT Small backbone and VGG. It is well known that Vision Transformers (ViTs) struggle with smaller datasets due to their inherent architectural requirements, which demand pretraining on large-scale datasets to achieve performance comparable to convolutional networks like ResNet. This limitation is particularly evident in continual learning settings with smaller datasets, leading to a noticeable performance gap between ViT and ResNet backbones. + +Despite this inherent challenge, Table 6 shows that SARL provides considerable performance gains over ER across all evaluation settings. These results highlight the robustness and adaptability of SARL, even in scenarios where the backbone architecture is less suited for the dataset size. Additionally, SARL's performance on the VGG backbone is particularly noteworthy. The VGG backbone, which lacks the inductive bias of residual connections and is less efficient compared to modern architectures, still benefits significantly from SARL. Specifically, SARL achieves state-of-the-art results in both Class-IL and Task-IL settings with VGG. This demonstrates SARL's ability to enhance learning effectiveness even in scenarios where the backbone architecture itself has inherent limitations. + +Importantly, it should be noted that no hyperparameter tuning was performed specifically for these backbones. Instead, we used the same hyperparameters optimized for the ResNet backbone. This suggests that further improvements in performance are possible by tailoring the hyperparameters to better suit the backbone architecture and adapting the functional regularization. The significant performance improvements observed with SARL validate its capability to enhance learning effectiveness across diverse backbone architectures, emphasizing its potential as a versatile and robust continual learning method. + +Table 6: Performance comparison on ViT-Small and VGG backbones. We report the mean and std of three runs. + +
BackboneBufferMethodSeq-CIFAR10Seq-CIFAR100
Class-ILTask-ILClass-ILTask-IL
ViT-Small200ER21.92±1.7069.65±4.0511.90±1.7529.11±7.05
SARL26.04±0.4582.74±1.3919.08±3.0044.82±4.46
500ER24.41±1.4672.30±1.7912.51±1.4731.08±4.25
SARL32.94±1.1483.25±1.8622.00±0.7947.68±1.99
VGG200ER40.63±0.7480.50±1.0518.71±0.7840.53±2.85
SARL63.06±2.4891.07±0.8426.47±0.6051.73±0.81
500ER54.09±0.8786.83±0.8823.01±0.6650.27±0.91
SARL66.15±0.7092.37±0.4233.82±0.6558.69±0.50
+ +# C ADDITIONAL METRICS + +We provide additional metrics for all our experiments to comprehensively evaluate SARL's performance. Since the number of test samples per task is uniform across all tasks, the final accuracy, calculated as the total number of correctly classified samples across all tasks divided by the total number of samples, is equivalent to the average accuracy, which is the mean accuracy across individual tasks at the end of training. Table 7 provides additional metrics such as forgetting, stability, and plasticity, which provide deeper insights into model behavior. Forgetting measures the model's ability to retain knowledge from previous tasks by quantifying the average drop in accuracy of a task at the end of continual learning training compared to its accuracy when first learned, where lower forgetting indicates better knowledge preservation. Stability (S) reflects the average accuracy on previously learned tasks at the end of training, demonstrating how well the model performs on earlier tasks. Plasticity (P), on the other hand, evaluates the model's ability to effectively learn new tasks, measured as the average accuracy of tasks when they are initially trained. Trade-off is measured by $(2 * S * P) / (P + S)$ and measure how well the method keeps a balance between the stability + +and plasticity of the model. Together, these metrics offer a holistic view of SARL's performance, capturing its strengths and trade-offs in diverse continual learning scenarios. + +Note that the vast majority of baselines do not provide these metrics and hence we cannot compare the baselines across these metrics unfortunately. In addition to the comparison on Average Accuracy in Table 1, we compare the forgetting and additional metrics for the baselines in Table 7 (where available). Note that DER++ is the strongest single model baseline and SARL considerable reduces forgetting by a considerable margin. + +Table 7: Performance metrics across datasets and buffer sizes. + +
DatasetBufferAccuracyForgettingStabilityPlasticityTrade-off
Seq-CIFAR1020070.97±0.4714.83±0.4367.72±1.0582.64±0.7374.44±0.78
50075.64±0.368.75±6.8973.39±1.0085.31±0.9278.90±0.88
Seq-CIFAR10020048.96±0.5333.82±0.5643.12±0.9176.45±1.0155.14±0.98
50055.30±0.6126.78±1.5350.21±1.3976.73±0.6260.69±0.83
Seq-TINYIMG20028.95±1.1342.08±2.9423.99±1.4166.82±1.5235.27±1.29
50032.56±1.2327.34±0.5629.88±1.5257.16±1.7339.24±0.72
+ +Table 8: Results of different methods on Seq-CIFAR10 and Seq-CIFAR100 datasets with varying buffer sizes. + +
DatasetBufferMethodAccuracyForgettingStabilityPlasticityTrade-off
Seq-CIFAR10200ER50.36±2.4157.60±3.5338.40±3.0196.44±0.4254.88±2.98
DER++65.74±1.8231.75±2.8658.73±2.5391.13±0.6571.40±1.76
CLSER65.92±0.7328.74±1.4567.70±1.2181.17±1.4573.83±1.21
SCOMMER66.80±0.9428.32±1.3562.26±1.4984.72±1.1871.76±0.78
SARL70.97±0.4714.83±0.4367.72±1.0582.64±0.7374.44±0.78
500ER62.70±1.0441.92±1.9853.92±1.3496.24±0.8669.11±1.04
DER++70.10±1.4726.79±1.0863.70±1.8991.53±0.6475.11±1.51
CLSER75.16±0.8622.56±1.0473.40±0.3378.03±0.8175.64±0.57
SCOMMER74.25±0.4220.13±1.3070.62±0.4587.99±0.4578.36±0.37
SARL75.64±0.368.75±6.8973.39±1.0085.31±0.9278.90±0.88
Seq-CIFAR100200ER21.73±0.0376.13±0.295.29±0.1582.63±0.219.94±0.26
DER++30.68±1.3565.10±1.7417.19±1.7582.77±0.7228.44±2.37
CLSER43.80±1.8936.33±1.4645.75±1.7850.47±1.0347.99±1.35
SCOMMER40.74±0.5342.20±1.1335.98±0.9063.30±6.2145.80±1.76
SARL48.96±0.5333.82±0.5643.12±0.9176.45±1.0155.14±0.98
500ER28.03±1.0667.08±1.1113.42±1.6081.69±0.1723.03±2.37
DER++42.03±2.0148.90±2.4232.01±2.7481.15±0.8045.87±2.89
CLSER51.68±0.9930.74±0.2552.18±0.2758.07±2.1754.95±1.04
SCOMMER50.11±0.3132.98±0.8046.40±0.7966.93±1.7254.79±0.35
SARL55.30±0.6126.78±1.5350.21±1.3976.73±0.6260.69±0.83
+ +# D HYPERPARAMETER TUNING + +During hyperparameter tuning, we used a small validation set to adjust values for $\mathrm{kW\%}$ , $\lambda_{OP}$ , and the coefficient $\alpha$ for $\mathcal{L}_{FR}$ . For all experiments, we set $\tau_s = 0.8$ , $\beta = 1$ and $\lambda_{SM} = 0.01$ . The value of $\mathrm{kW\%}$ was selected from the set $\{0.7, 0.8, 0.9\}$ , while $\lambda_{OP}$ and $\alpha$ were chosen from $\{0.2, 0.5, 1\}$ . The final selected parameters are presented in Table 4. It is important to note that we did not perform an exhaustive hyperparameter search, so better configurations may exist. Furthermore, we observed a synergistic relationship among the parameters, and the model demonstrated robustness to a range of values, which significantly eased the tuning process. + +To further illustrate this, the results in Table 9 demonstrate that SARL is not overly sensitive to specific hyperparameter values, as multiple configurations yield consistent performance improvements. For instance, across different values of $\alpha$ , $\lambda_{OP}$ , and $\mathrm{kW\%}$ , the method achieves robust + +Class-IL and Task-IL accuracies on Seq-CIFAR10, with minor variations in performance. While certain configurations (e.g., $\alpha = 0.2$ , $\lambda_{OP} = 0.5$ , $\mathrm{kw}\% = 0.8$ ) achieve the highest Class-IL accuracy (70.97%), other values (e.g., $\mathrm{kw}\% = 0.9$ , $\alpha = 0.2$ , $\lambda_{OP} = 0.5$ ) provide similar results (70.08%). We present results for all the grid values explored during hyperparameter tuning, demonstrating that SARL achieves consistent performance improvements across various configurations without relying heavily on precise hyperparameter adjustments. This reliability underscores SARL's practicality and suitability for a wide range of continual learning applications + +Table 9: Sensitivity to hyperparameters on the performance of SARL. For all the experiments, we use learning rate $\eta = 0.1$ , $\alpha = 0.999$ , $\lambda_{OP} = 0.5$ , $\lambda_{SA} = 0.01$ , $\lambda_{CR} = 0.15$ and $\tau = 0.8$ . + +
seq-cifar10
kw%αλOPClass-ILTask-IL
0.80.20.270.73±2.3195.77±0.16
0.570.97±0.4795.72±0.36
170.57±0.7395.71±0.08
0.50.268.53±1.1495.23±0.07
0.569.40±1.2195.21±0.19
168.79±0.8495.14±0.09
10.265.30±1.4093.73±0.68
0.564.59±0.6293.72±0.42
163.86±1.4593.19±0.08
0.90.20.270.05±1.4495.49±0.14
0.570.08±1.4895.63±0.22
169.07±0.6895.52±0.01
0.50.268.12±2.9095.13±0.41
0.566.66±0.5594.92±0.31
165.49±0.0894.48±0.38
10.263.99±2.8393.34±0.91
0.564.04±0.0693.00±1.05
163.80±1.5692.87±1.33
+ +Table 10: Memory and performance comparison of SARL and baselines on Seq-CIFAR100. #M stands for number of models, #FWD for number of forward passes, and $|B|$ for buffer size. + +
Method#M#FWD (Tasks)#FWD (Buffer)|B| (MB)Total Memory (MB)Memory Ratio (vs ER)Avg. Acc (%)Avg. Acc / Memory Ratio
ER1115.8648.521.000028.0228.02
DER++1126.0548.711.003941.4041.24
CLS-ER3135.86133.842.758451.4018.63
SCoMMER2125.8691.181.879249.6326.41
SARL1118.1550.091.032355.3053.57
+ +# E SEMANTIC SIMILARITY BETWEEN CLUSTERS + +To further strengthen our analysis in Figure 2 which provides similarity matrices for dense and sparse activations, we defined two clusters within the CIFAR-10 classes: the Animal Cluster, comprising 'bird,' 'cat,' 'deer,' 'dog,' 'frog,' and 'horse,' and the Vehicle Cluster, consisting of 'airplane,' 'automobile,' 'ship,' and 'truck.' The comparison of inter- and intra-cluster similarities is visualized in Figure 6, and the results indicate that sparse activations exhibit consistently higher average similarity within clusters compared to dense activations. For the Animal Cluster, sparse activations achieve an average similarity of 0.8873 compared to 0.8367 for dense activations. Similarly, for the Vehicle Cluster, sparse activations achieve 0.8694 compared to 0.8684 for dense activations. This suggests that sparse activations better group objects within the same semantic category, capturing seman + +![](images/dc55fa34ed3a5f554a7573af41f7e1a25d726c235653534a628d8b940f456a75.jpg) +Figure 6: Inter- and Intra-Cluster Similarities Across Animal and Vehicle Clusters in CIFAR-10 for Dense and Sparse Activations + +tic cohesion more effectively. By activating only the most relevant neurons, sparse representations reduce noise and focus on features critical for semantic grouping. + +Sparse activations also demonstrate a slightly higher average similarity between clusters, with 0.8295 compared to 0.8068 for dense activations. However, this inter-cluster similarity is significantly lower than the intra-cluster similarity, aligning with the expected semantic distinction between clusters. Notably, sparse representations encode inter-cluster relationships more semantically rather than merely enforcing hard separations. For instance, airplane and bird, which share abstract features like wings and the ability to fly, exhibit a higher similarity of 0.90 with sparse activations compared to 0.87 with dense activations. In contrast, ship and horse, which are semantically dissimilar, show a similarity of 0.81 with sparse activations compared to 0.83 with dense activations. These findings reinforce our hypothesis that sparse activations can enhance the model's capability to capture semantic structure across objects. + +# F VISUALIZATION OF REPRESENTATION SPACE + +To further analyze the representations and evaluate how well SARL captures and enforces a semantic structure among objects, we project the object prototypes into a two-dimensional space using t-SNE and compare SARL with ER on Seq-CIFAR10 with a buffer size of 200 (Figure 7). The t-SNE visualizations reveal clear differences in the representational quality of SARL compared to ER. In the left panel (ER), object prototypes exhibit a lack of structured clustering, with semantically similar classes, such as animals ("bird," "frog," "deer"), being dispersed and overlapping with other categories. This indicates that ER struggles to effectively group related objects or separate distinct semantic categories in the representation space. In contrast, the right panel (SARL) demonstrates significant improvements, forming compact and cohesive clusters for semantically similar objects. For example, animals are tightly grouped together, and SARL effectively captures the semantic similarity between "bird" and "airplane," a relationship that ER fails to encode. This structured organization of prototypes highlights SARL's ability to leverage semantic relationships to guide representation learning, aligning similar classes while maintaining clear distinctions between unrelated ones. These findings underscore the effectiveness of SARL in creating a more meaningful, semantically aware, and structured representation space. + +# G EXTENDED RELATED WORKS + +Continual learning has seen significant advancements in recent years, with diverse approaches targeting the challenges of catastrophic forgetting, model stability, and effective knowledge transfer across tasks. In this section, we extend our related works section and position our SARL in the broader context of these developments. + +![](images/c236ecc5b0805f8e981a8b2740f0647ba95f3364d7ec75ba6ac8b347fe5b6fa2.jpg) +Figure 7: t-SNE plot of object prototypes using trained model with ER and SARL on Seq-CIFAR10 with 200 buffer size. + +![](images/1156f922f2755c1456fdd5a1d4a345d01f4180779f1586ccbd3abd085925a1a9.jpg) + +Meta-learning approaches have shown promise in continual learning by leveraging task-specific adaptations. VR-MCL (Wu et al., 2024) proposes an online CL approach that combines Meta-CL with regularization to efficiently approximating online Hessians, enhancing adaptability in real-time learning scenarios. While our work adopts a batch training setup, allowing multiple passes over sequential task data which we believe is more aligned with many real-world scenarios where datasets can be revisited periodically (e.g., staged data collection or iterative training), VR-MCL provides a focuses on online single-pass learning. The fundamental differences in training settings make direct comparisons challenging, but we recognize the potential of such meta-learning techniques to inspire future extensions of SARL in online CL. Interactive Continual Learning (ICL) (Qi et al., 2024) utilizes multimodal large language models (LLMs) to achieve state-of-the-art performance in continual learning. By leveraging extensive pretraining on diverse datasets (often a superset of classes in the baseline CL datasets) and significantly larger architectures, this approach gains a lot of advantage over the standard setting. It also makes them infeasible for many CL applications due to the magnitudes larger memory and computational costs. The reliance on pretraining introduces an inherent disparity when comparing with SARL, which operates with a randomly initialized model and focuses on both learning robust representations in the CL regime and retaining them as training progresses. Furthermore, Memory-based approaches are widely used in rehearsal-based CL to alleviate catastrophic forgetting. Bilateral Memory Consolidation (BiMeCo) (Nie et al., 2023) introduces a method that consolidates long-term and short-term memories to improve performance. Their approach is complementary to SARL and could potentially enhance SARL further if integrated. However, their evaluation setting of involves pretraining on a large number of base classes before sequential learning, whereas SARL and its baselines initiate continual learning with a randomly initialized model. This distinction in experimental setups underscores the importance of careful contextualization when comparing results across studies. + +Prompt-based methods, such as L2P (Wang et al., 2022c) and DualPrompt (Wang et al., 2022b), utilize pre-trained backbones, like those trained on ImageNet, to achieve strong performance in class incremental learning setting. These pre-trained backbones inherently include representations for many classes encountered later in CL tasks or for classes that are semantically similar. This allows these methods to bypass one of the core challenges of CL: learning and preserving general representations of objects across sequential tasks. In contrast, SARL operates in a more challenging setting, starting from a randomly initialized state without leveraging pretraining. Extending SARL to integrate pre-trained models could be a promising direction for future research, but the current work focuses on enabling robust representation learning from a random start utilizing the semantic structure to learn and retain representations. + +We would like to emphasize that evaluating CL methods across diverse baselines presents several challenges. Variations in architectures, the use of additional pretraining, access to implicit or explicit auxiliary information, and differences in task structures and metrics significantly influence reported results. Uniform evaluation settings are critical for meaningful assessments, as discrepancies in setup may reflect differences in methodology rather than genuine improvements. \ No newline at end of file diff --git a/ICLR/2025/Semantic Aware Representation Learning for Lifelong Learning/images.zip b/ICLR/2025/Semantic Aware Representation Learning for Lifelong Learning/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..84aeb3a00db928fe27f68f277a100925765329b3 --- /dev/null +++ b/ICLR/2025/Semantic Aware Representation Learning for Lifelong Learning/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:81ae789dab476ba6e87731e03fe84a00f257d809b3ab6239058e97587be4d0d9 +size 1072296 diff --git a/ICLR/2025/Semantic Aware Representation Learning for Lifelong Learning/layout.json b/ICLR/2025/Semantic Aware Representation Learning for Lifelong Learning/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..437cc976980b1c64c100facf5eed96793d4e170d --- /dev/null +++ b/ICLR/2025/Semantic Aware Representation Learning for Lifelong Learning/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c157e3a82893ec0768cfd9012e751c724e939fb31f58acd16873f0547d71e325 +size 486632 diff --git a/ICLR/2025/Semantic Image Inversion and Editing using Rectified Stochastic Differential Equations/70b34e4f-1c79-4d65-baa2-3363124d0420_content_list.json b/ICLR/2025/Semantic Image Inversion and Editing using Rectified Stochastic Differential Equations/70b34e4f-1c79-4d65-baa2-3363124d0420_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..c2f79b6c99c6084830ff18021d04f15a777c6386 --- /dev/null +++ b/ICLR/2025/Semantic Image Inversion and Editing using Rectified Stochastic Differential Equations/70b34e4f-1c79-4d65-baa2-3363124d0420_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:27178ba9840ea80731a8c71bdd6eaba289bcbb6cc292d787af9e04b515431898 +size 265283 diff --git a/ICLR/2025/Semantic Image Inversion and Editing using Rectified Stochastic Differential Equations/70b34e4f-1c79-4d65-baa2-3363124d0420_model.json b/ICLR/2025/Semantic Image Inversion and Editing using Rectified Stochastic Differential Equations/70b34e4f-1c79-4d65-baa2-3363124d0420_model.json new file mode 100644 index 0000000000000000000000000000000000000000..4211dd0156803c20cf69866c235c2b9b28737c28 --- /dev/null +++ b/ICLR/2025/Semantic Image Inversion and Editing using Rectified Stochastic Differential Equations/70b34e4f-1c79-4d65-baa2-3363124d0420_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:35a54268a43fa5e9a65fa5dcef094707bae0b05ce38e9606577d86f187aef87d +size 322710 diff --git a/ICLR/2025/Semantic Image Inversion and Editing using Rectified Stochastic Differential Equations/70b34e4f-1c79-4d65-baa2-3363124d0420_origin.pdf b/ICLR/2025/Semantic Image Inversion and Editing using Rectified Stochastic Differential Equations/70b34e4f-1c79-4d65-baa2-3363124d0420_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..433b1ea64a2095e09e64d13a75325ad873a72a04 --- /dev/null +++ b/ICLR/2025/Semantic Image Inversion and Editing using Rectified Stochastic Differential Equations/70b34e4f-1c79-4d65-baa2-3363124d0420_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1d4b786d9908819e5077659bc3f6f7188fc6284e355b1f0512c1a975735519b9 +size 36175050 diff --git a/ICLR/2025/Semantic Image Inversion and Editing using Rectified Stochastic Differential Equations/full.md b/ICLR/2025/Semantic Image Inversion and Editing using Rectified Stochastic Differential Equations/full.md new file mode 100644 index 0000000000000000000000000000000000000000..ef048e5a3da9beb11813e569d276fa4f3f287433 --- /dev/null +++ b/ICLR/2025/Semantic Image Inversion and Editing using Rectified Stochastic Differential Equations/full.md @@ -0,0 +1,1476 @@ +# SEMANTIC IMAGE INVERSION AND EDITING USING RECTIFIED STOCHASTIC DIFFERENTIAL EQUATIONS + +Litu Rout $^{1,2*}$ Yujia Chen $^{1}$ Nataniel Ruiz $^{1}$ +Constantine Caramanis $^{2}$ Sanjay Shakkottai $^{2}$ Wen-Sheng Chu $^{1}$ + +1 Google 2 UT Austin + +{litu.rout,constantine,sanjay.shakkottai}@utexas.edu {liturout,yujiachen,natanielruiz,wschu}@google.com + +# ABSTRACT + +Generative models transform random noise into images, while their inversion aims to reconstruct structured noise for recovery and editing. This paper addresses two key tasks: (i) inversion and (ii) editing of real images using stochastic equivalents of rectified flow models (e.g., Flux). While Diffusion Models (DMs) dominate the field of generative modeling for images, their inversion suffers from faithfulness and editability challenges due to nonlinear drift and diffusion. Existing DM inversion methods require costly training of additional parameters or test-time optimization of latent variables. Rectified Flows (RFs) offer a promising alternative to DMs, yet their inversion remains underexplored. We propose RF inversion using dynamic optimal control derived via a linear quadratic regulator, and prove that the resulting vector field is equivalent to a rectified stochastic differential equation. We further extend our framework to design a stochastic sampler for Flux. Our method achieves state-of-the-art performance in zero-shot inversion and editing, surpassing prior works in stroke-to-image synthesis and semantic image editing, with large-scale human evaluations confirming user preference. See our project page https://rf-inversion.github.io/ for code and demo. + +# 1 INTRODUCTION + +Vision generative models typically transform noise into images. Inverting such models, given a reference image, involves finding the structured noise that can regenerate the original image. Efficient inversion must satisfy two crucial properties. First, the structured noise should produce an image that is faithful to the reference image. Second, the resulting image should be easily editable using new prompts, allowing fine modifications over the image. + +Diffusion Models (DMs) have become the mainstream approach for generative modeling of images (Sohl-Dickstein et al., 2015; Song & Ermon, 2019; Ho et al., 2020), excelling at sampling from high-dimensional distributions (Ramesh et al., 2021; Sahara et al., 2022; Ramesh et al., 2022; Rombach et al., 2022; Podell et al., 2023; Pernias et al., 2024). The sampling process follows a Stochastic Differential Equation known as reverse SDE (Anderson, 1982; Efron, 2011; Song et al., 2021b). Notably, these models can invert a given image. Recent advances in DM inversion have shown a significant impact on conditional sampling, such as stroke-to-image synthesis (Meng et al., 2022), image editing (Hertz et al., 2022; Mokady et al., 2023; Couairon et al., 2023; Rout et al., 2023a,b; 2024; Delbracio & Milanfar, 2023) and stylization (Hertz et al., 2023; Rout et al., 2025). + +Despite its widespread usage, DM inversion faces critical challenges in faithfulness and editability. First, the stochastic nature of the process requires fine discretization of the reverse SDE (Ho et al., 2020; Song et al., 2021b), which increases expensive Neural Function Evaluations (NFEs). Coarse discretization, on the other hand, leads to less faithful outputs (Meng et al., 2022), even with deterministic methods like DDIM (Song et al., 2021a;b). Second, nonlinearities in the reverse trajectory introduce unwanted drift, reducing the accuracy of reconstruction (Karras et al., 2024). While existing methods enhance faithfulness by optimizing latent variables (Rout et al., 2024) or prompt embeddings (Mokady et al., 2023; Miyake et al., 2023), they tend to be less efficient, harder to edit, + +![](images/b59de70c1690de81d49cc400a75c42efb3435ff08d1abed0980c79312ee81e16.jpg) +—→ Rectified Flows + +![](images/fc88323a2ee83e96301266c56fe8e57cb271d3181057b5808af986e00e404a98.jpg) +Optimal Control +Forward (ours) +Reverse (ours) +Figure 1: Our method consists of three key steps: (i) Inversion - We map a (corrupted) image to a structured noise using our controlled forward ODE (8); (ii) Conditioning - We condition the reverse process on the desired text (e.g., "A bedroom"); and (iii) Generation - We then transform the structured noise into the desired image using our controlled reverse ODE (15). (Left) Inversion with rectified flows results in an atypical noise sample $(\bullet)$ , while optimal control produces a typical noise sample $(\bullet)$ . Our method interpolates between these two processes to generate a typical structured noise $(\bullet)$ . (Right) We follow a similar strategy when converting noise back into an image. + +and rely on complex attention processors to align with a given prompt (Hertz et al., 2022; Rout et al., 2024). These added complexities make such methods less suitable for real-world deployment. + +For inversion and editing, we introduce a zero-shot conditional sampling algorithm using Rectified Flows (RFs) (Liu et al., 2022; Albergo & Vanden-Eijnden, 2023; Lipman et al., 2022; Esser et al., 2024), a powerful alternative to DMs. Unlike DMs, where sampling is governed by a reverse SDE, RFs use an Ordinary Differential Equation known as reverse ODE, offering advantages in both efficient training and fast sampling. We construct a controlled forward ODE, initialized from a given image, to generate the initial conditions for the reverse ODE. The reverse ODE is then guided by an optimal controller, obtained through solving a Linear Quadratic Regulator (LQR) problem. We prove that the resulting vector fields have a stochastic interpretation with an appropriate drift and diffusion. We evaluate RF inversion on stroke-to-image generation and image editing tasks, with additional qualitative results on cartoonization, object insertion, image generation, and content-style composition. Our method significantly improves photorealism in stroke-to-image generation, surpassing a state-of-the-art (SoTA) method (Mokady et al., 2023) by $89\%$ while maintaining faithfulness to the input stroke. In addition, we show that RF inversion outperforms DM inversion (Meng et al., 2022) in faithfulness by $4.7\%$ and in realism by $13.8\%$ on LSUN-bedroom dataset (Wang et al., 2017). Figure 1 shows a graphical illustration of our method RF-Inversion. + +Our theoretical and practical contributions can be summarized as: + +- We present an efficient inversion method for RF models, including Flux, that requires no additional training, latent optimization, prompt tuning, or complex attention processors. +- We develop a new vector field for RF inversion, interpolating between two competing objectives: consistency with a possibly corrupted input image, and consistency with the "true" distribution of clean images (§3.3). We prove that this vector field is equivalent to a rectified SDE that interpolates between the stochastic equivalents of these competing objectives (§3.4). +- We demonstrate the faithfulness and editability of RF inversion across three benchmarks: (i) LSUN-Bedroom, (ii) LSUN-Church, and (iii) SFHQ, on two tasks: stroke-to-image synthesis and image editing. In addition, we provide extensive qualitative results and conduct large-scale human evaluations to assess user preference metrics ( $\S 5$ ). + +Finally, we note that RF-Inversion has the interpretation of a counterfactual sampler, specifically as an instantiation of noise abduction (Pearl et al., 2016); please see Appendix B for discussion. + +# 2 RELATED WORKS + +DM Inversion. Diffusion models have become the mainstream approach for generative modeling, making DM inversion an exciting area of research (Meng et al., 2022; Couairon et al., 2023; Song et al., 2021b; Hertz et al., 2023; Mokady et al., 2023; Rout et al., 2024). Among training-free methods, SDEdit (Meng et al., 2022) adds noise to an image and uses the noisy latent as structured noise. For semantic image editing based on a given prompt, it simulates the standard reverse SDE starting from this structured noise. SDEdit requires no additional parameter training, latent variable optimization, or complex attention mechanisms. However, it is less faithful to the original image because adding noise in one step is equivalent to linear interpolation between the image and noise, while the standard reverse SDE follows a nonlinear path (Liu et al., 2022; Karras et al., 2022). + +An alternate method, DDIM inversion (Song et al., 2021a;b), recursively adds predicted noise at each forward step and returns the final state as the structured noise (illustrated by $Y_{t}$ process in Figure 1(a)). However, DDIM inversion often deviates significantly from the original image due to nonlinearities in the drift and diffusion coefficients, as well as inexact score estimates (Mokady et al., 2023). To reduce this deviation, recent approaches optimize prompt embeddings (Mokady et al., 2023) or latent variables (Rout et al., 2024), but they have high time complexity. Negative prompt inversion (Miyake et al., 2023) speeds up the inversion process but sacrifices faithfulness. Methods like CycleDiffusion (Wu & De la Torre, 2023) and Direction Inversion (Ju et al., 2023) use inverted latents as references during editing, but they are either computationally expensive or not applicable to rectified flow models like Flux (Black Forest Labs, 2024) or SD3 (Esser et al., 2024). + +DM Editing. Efficient inversion is crucial for real image editing. Once a structured noise is obtained by inverting the image, a new prompt is fed into the T2I generative model. Inefficient inversion often fails to preserve the original content and therefore requires complex editing algorithms. These editing algorithms can be broadly classified into (i) attention control, such as prompt-to-prompt (Hertz et al., 2022), plug-and-play (PnP) (Tumanyan et al., 2023), (ii) optimization-based methods like DiffusionCLIP (Kim et al., 2022), DiffuseIT (Kwon & Ye, 2023), STSL (Rout et al., 2024), and (iii) latent masking to edit user-provided regions of an image (Nichol et al., 2022; Huberman-Spiegelglas et al., 2024) or automatically extracted from the generative model (Couairon et al., 2023). We focus on efficient inversion, avoiding the need for complex editing algorithms. + +Challenges in RF Inversion. Previous inversion or editing approaches have been tailored towards diffusion models and do not directly apply to SoTA rectified flow models like Flux (Black Forest Labs, 2024). This limitation arises because the network architecture of Flux is MM-DiT (Peebles & Xie, 2023), which is fundamentally different from the traditional UNet used in DMs (Ho et al., 2020; Song et al., 2021a;b). In MM-DiT, text and image information are entangled within the architecture itself, whereas in UNet, text conditioning is handled via cross-attention layers. Additionally, Flux primarily uses T5 text encoder, which lacks an aligned latent space for images, unlike CLIP encoders. Therefore, extending these prior methods to modern T2I generative models requires a thorough investigation. We take the first step by inverting and editing a given image using Flux. + +RF Inversion and Editing. DMs (Ho et al., 2020; Song et al., 2021a; Rombach et al., 2022) traditionally outperform RFs (Lipman et al., 2022; Liu et al., 2022; Albergo & Vanden-Eijnden, 2023) in high-resolution image generation. However, recent advances have shown that RF models like Flux can surpass SoTA DMs in text-to-image (T2I) generation tasks (Esser et al., 2024). Despite this, their inversion and editing capabilities remain underexplored. In this paper, we introduce an efficient RF inversion method that avoids the need for training additional parameters (Hu et al., 2021; Ruiz et al., 2023), optimizing latent variables (Rout et al., 2024), prompt tuning (Mokady et al., 2023), or using complex attention processors (Hertz et al., 2022). While our focus is on inversion and editing, we also show that our framework can be easily extended to generative modeling. + +Filtering, Control and SDEs. There is a rich literature on the connections between nonlinear filtering, optimal control and SDEs (Fleming & Rishel, 1975; Øksendal, 2003; Tzen & Raginsky, 2019; Zhang & Chen, 2022). These connections are grounded in the Fokker-Planck equation (Øksendal, 2003), which RF methods (Lipman et al., 2022; Liu et al., 2022; Albergo & Vanden-Eijnden, 2023; Albergo et al., 2023) heavily exploit in sampling. Our study focuses on rectified flows for conditional sampling, and shows that the resulting drift field also has an optimal control interpretation. + +# 3 METHOD + +# 3.1 PRELIMINARIES + +In generative modeling, the goal is to sample from a target distribution $p_0$ given a finite number of samples from that distribution. Rectified flows (Lipman et al., 2022; Liu et al., 2022) represent a class of generative models that construct a source distribution $q_0$ and a time varying vector field $v_t(\mathbf{x}_t)$ to sample $p_0$ using an ODE: + +$$ +\mathrm {d} X _ {t} = v _ {t} \left(X _ {t}\right) \mathrm {d} t, \quad X _ {0} \sim q _ {0}, \quad t \in [ 0, 1 ]. \tag {1} +$$ + +Starting from $X_0 = \mathbf{x}_0$ , the ODE (1) is integrated from $t: 0 \to 1$ to yield a sample $\mathbf{x}_1$ distributed according to $p_0$ (e.g., the distribution over images). A common choice of $q_0$ is standard Gaussian $\mathcal{N}(0, I)$ and $v_t(X_t) = -u(X_t, 1 - t; \varphi)$ , where $u$ is a neural network parameterized by $\varphi$ . The neural network is trained using the conditional flow matching objective as discussed below. + +Training Rectified Flows. To train a neural network to serve as the vector field for the ODE (1), we couple samples from $p_0$ with samples from $q_0$ - which we call $p_1$ to simplify the notation - via a linear path: $Y_{t} = tY_{1} + (1 - t)Y_{0}$ . The resulting marginal distribution of $Y_{t}$ becomes: + +$$ +p _ {t} (\mathbf {y} _ {t}) = \mathbb {E} _ {Y _ {1} \sim p _ {1}} \left[ p _ {t} \left(\mathbf {y} _ {t} \mid Y _ {1}\right) \right] = \int p _ {t} \left(\mathbf {y} _ {t} \mid \mathbf {y} _ {1}\right) p _ {1} \left(\mathbf {y} _ {1}\right) \mathrm {d} \mathbf {y} _ {1}. \tag {2} +$$ + +Given an initial state $Y_0 = \mathbf{y}_0$ and a terminal state $Y_1 = \mathbf{y}_1$ , the linear path induces an ODE: $\mathrm{d}Y_t = u_t(Y_t|\mathbf{y}_1)\mathrm{d}t$ with the conditional vector field $u_t(Y_t|\mathbf{y}_1) = \mathbf{y}_1 - \mathbf{y}_0$ . The marginal vector field is derived from the conditional vector field using the following relation (Lipman et al., 2022): + +$$ +u _ {t} (\mathbf {y} _ {t}) = \mathbb {E} _ {Y _ {1} \sim p _ {1}} \left[ u _ {t} \left(\mathbf {y} _ {t} \mid Y _ {1}\right) \frac {p _ {t} \left(\mathbf {y} _ {t} \mid Y _ {1}\right)}{p _ {t} \left(\mathbf {y} _ {t}\right)} \right] = \int u _ {t} \left(\mathbf {y} _ {t} \mid \mathbf {y} _ {1}\right) \frac {p _ {t} \left(\mathbf {y} _ {t} \mid \mathbf {y} _ {1}\right)}{p _ {t} \left(\mathbf {y} _ {t}\right)} p _ {1} \left(\mathbf {y} _ {1}\right) d \mathbf {y} _ {1}. \tag {3} +$$ + +We can then use a neural network $u(\mathbf{y}_t, t; \varphi)$ , parameterized by $\varphi$ , to approximate the marginal vector field $u_t(\mathbf{y}_t)$ through the flow matching objective defined as: + +$$ +\mathcal {L} _ {F M} (\varphi) := \mathbb {E} _ {t \sim \mathcal {U} [ 0, 1 ], Y _ {t} \sim p _ {t}} \left[ \| u _ {t} (Y _ {t}) - u \left(Y _ {t}, t; \varphi\right) \| _ {2} ^ {2} \right]. \tag {4} +$$ + +For tractability, we can instead consider a different objective, called conditional flow matching: + +$$ +\mathcal {L} _ {C F M} (\varphi) := \mathbb {E} _ {t \sim \mathcal {U} [ 0, 1 ], Y _ {t} \sim p _ {t} (\cdot | Y _ {1}), Y _ {1} \sim p _ {1}} \left[ \| u _ {t} \left(Y _ {t} | Y _ {1}\right) - u \left(Y _ {t}, t; \varphi\right) \| _ {2} ^ {2} \right]. \tag {5} +$$ + +$\mathcal{L}_{CFM}$ and $\mathcal{L}_{FM}$ have the identical gradients (Lipman et al., 2022, Theorem 2), and are hence equivalent. However, $\mathcal{L}_{CFM}(\varphi)$ is computationally tractable, unlike $\mathcal{L}_{FM}(\varphi)$ , and therefore preferred during training. Finally, the required vector field in (1) is computed as $v_{t}(X_{t}) = -u(X_{t},1 - t;\varphi)$ . In this way, rectified flows sample a data distribution by an ODE with a learned vector field. + +# 3.2 CONNECTION BETWEEN RECTIFIED FLOWS AND LINEAR QUADRATIC REGULATOR + +The unconditional rectified flows (RFs) (e.g., Flux) from Section §3.1 above, enable image generation by simulating the vector field $v_{t}(\cdot)$ initialized with a sample of random noise. Subsequently, by simulating the reversed vector field $-v_{1 - t}(\cdot)$ starting from the image, we get back the sample of noise that we started with. We formalize this statement below. + +Proposition 3.1. Given an image $\mathbf{y}_0$ and the vector field $v_{t}(\cdot)$ of the generative ODE (1), suppose the structured noise $\mathbf{y}_1$ is obtained by simulating an ODE: + +$$ +\mathrm {d} Y _ {t} = u _ {t} \left(Y _ {t}\right) \mathrm {d} t, \quad Y _ {0} = \mathbf {y} _ {0}, \quad t \in [ 0, 1 ]. \tag {6} +$$ + +If $u_{t}(\cdot) = -v_{1 - t}(\cdot)$ and $X_0 = \mathbf{y}_1$ , then the ODE (1) recovers the original image, i.e., $X_{1} = \mathbf{y}_{0}$ . + +Implication. Rectified flows enable exact inversion of a given image when the vector field of the generative ODE (1) is precisely known. Employing ODE (6) for the structured noise and ODE (1) to transform that noise back into an image, RF inversion accurately recovers the given image. + +Suppose instead that we start with a corrupted image and simulate the reversed vector field $-v_{1 - t}(\cdot)$ . Then we obtain a noise sample. There are two salient aspects of this noise sample. First, it is consistent with the original image: when processed through $v_{t}(\cdot)$ it results in the same corrupted image. Second, if the image sample is "atypical" (e.g., corrupted, or, say, a stroke painting as in §5), then the sample of noise is also likely to be atypical. In other words, the noise sample is only consistent to the (possibly corrupted) image sample. + +Our goal is to modify the pipeline above so that even when we start with a corrupted image, we can get back a clean image (see stroke-to-image synthesis in Figure 3), but for this, we need to process by $v_{t}(\cdot)$ a noise sample that is closer to being "typical". + +Thus, as a first step, we derive an optimal controller that takes a minimum energy path to convert any image $Y_{0}$ (whether corrupted or not) to a typical noise sample $Y_{1} \sim p_{1}$ (Fleming & Rishel, 1975). Specifically, we consider optimal control in a $d$ -dimensional vector space $\mathbb{R}^{d}$ : + +$$ +V (c) := \int_ {0} ^ {1} \frac {1}{2} \| c (Z _ {t}, t) \| _ {2} ^ {2} \mathrm {d} t + \frac {\lambda}{2} \| Z _ {1} - Y _ {1} \| _ {2} ^ {2}, \mathrm {d} Z _ {t} = c (Z _ {t}, t) \mathrm {d} t, Z _ {0} = \mathbf {y} _ {0}, Y _ {1} \sim p _ {1}, \tag {7} +$$ + +where $\lambda$ is the weight assigned to the terminal cost and $V(c)$ denotes the total cost of the control $c: \mathbb{R}^d \times [0,1] \to \mathbb{R}^d$ . The minimization of $V(c)$ over the admissible set of controls, denoted by $\mathcal{C}$ , is known as the Linear Quadratic Regulator (LQR) problem. The solution of the LQR problem (7) is given in Proposition 3.2, which minimizes the quadratic transport cost of the dynamical system. + +Proposition 3.2. For $Z_0 = \mathbf{y}_0$ and $Y_1 = \mathbf{y}_1$ , the optimal controller of the LQR problem (7), denoted by $c^*(\cdot, t)$ is equal to the conditional vector field $u_t(\cdot | \mathbf{y}_1)$ of the rectified linear path $Y_t = tY_1 + (1 - t)Y_0$ when $Y_0 = \mathbf{y}_0$ , i.e., $c^*(\mathbf{z}_t, t) = u_t(\mathbf{z}_t | \mathbf{y}_1) = (\mathbf{y}_1 - \mathbf{z}_t) / (1 - t)$ . + +# 3.3 INVERTING RECTIFIED FLOWS WITH DYNAMIC CONTROL + +So far, we have two vector fields. The first, from the RFs, transforms an image $Y_{0}$ typical for distribution $p_{0}$ to a typical sample of random Gaussian noise $Y_{1} \sim p_{1}$ . As discussed above, if the image sample is atypical, then the sample of noise is also likely to be atypical. We also have a second vector field resulting from the optimal control formulation that transforms any image (whether corrupted or not) to a noise sample that is typical-by-design from the distribution $p_{1}$ . Therefore, this sample, when passed through the rectified flow ODE (1) results in a "typical" image from the "true" distribution $p_{0}$ . This image is clean, i.e., typical for $p_{0}$ , but it is not related to the image $Y_{0}$ . Our controlled ODE, defined below, interpolates between these two differing objectives - consistency with the given (possibly corrupted) image, and consistency with the distribution of images $p_{0}$ - with a tunable parameter $\gamma$ : + +$$ +\mathrm {d} Y _ {t} = \left[ u _ {t} \left(Y _ {t}\right) + \gamma \left(u _ {t} \left(Y _ {t} \mid \mathbf {y} _ {1}\right) - u _ {t} \left(Y _ {t}\right)\right) \right] \mathrm {d} t, \quad Y _ {0} = \mathbf {y} _ {0}, \tag {8} +$$ + +where $u_{t}(Y_{t}|\mathbf{y}_{1}) = c^{*}(Y_{t},t)$ is computed based on the insights from Proposition 3.2, and $u_{t}(Y_{t}) = -v_{1 - t}(Y_{t})$ as established in Proposition 3.1. Here, we call $\gamma \in [0,1]$ the controller guidance. Thus, ODE (8) generalizes (6) to editing applications, while keeping its inversion accuracy comparable. + +When $\gamma = 1$ , the drift field of the ODE (8) becomes optimal controller of LQR problem (7), ensuring that the structured noise $Y_{1} = \mathbf{y}_{1}$ adheres to the distribution $p_1$ . Consequently, initializing the generative ODE (1) with $\mathbf{y}_1$ results in samples with high likelihood under the data distribution $p_0$ . + +Conversely, when $\gamma = 0$ , the system follows the ODE (6) described in Proposition 3.1, resulting a structured noise $Y_{1}$ that is not guaranteed to follow the noise distribution $p_1$ . However, initializing the generative ODE (1) with this noise precisely recovers the reference image $\mathbf{y}_0$ . + +Beyond this vector field interpolation intuition, we show in the next section §3.4 that the controlled ODE (8) has an SDE interpretation. As is well known (Ho et al., 2020; Song et al., 2021a; Meng et al., 2022; Song et al., 2021b), SDEs are robust to initial conditions, in proportion to the variance of the additive noise. Specifically, errors propagate over time in an ODE initialized with an incorrect or corrupted sample. However, SDEs (Markov processes) under appropriate conditions converge to samples from a carefully constructed invariant distribution with reduced sensitivity to the initial condition, resulting in a form of robustness to initialization. As we see, the parameter $\gamma$ (the controller guidance) appears in the noise term to the SDE, thus the SDE analysis in the next section again provides intuition on the trade-off between consistency to the (corrupted) image and consistency to the terminal invariant distribution, and helps design a stochastic sampler for Flux (Appendix D.7). + +Remark 3.3. We note that our analysis extends to the case where $\gamma$ is time-varying, though we omit these results for simplicity of notation. This is useful in practice, especially when $\mathbf{y}_0$ is a corrupted image, because for large $\gamma$ the stochastic evolution (22) moves toward a sample from the invariant measure $\mathcal{N}(0,I)$ . This noise encodes clean images. Starting from this noise, the corresponding reverse process operates in pure diffusion mode, resulting in a clean image. As the process approaches the terminal state, $\gamma$ is gradually reduced to ensure that $\mathbf{y}_0$ is encoded through $u_t(\cdot)$ into the final structured noise sample. + +# 3.4 CONTROLLED RECTIFIED FLOWS AS STOCHASTIC DIFFERENTIAL EQUATIONS + +An SDE (Ho et al., 2020) is known to have an equivalent ODE formulation (Song et al., 2021a) under certain regularity conditions (Anderson, 1982; Song et al., 2021b). In this section, we derive the opposite: an SDE formulation for our controlled ODE (8) from §3.3. Let $W_{t}$ be a $d$ -dimensional Brownian motion in a filtered probability space $(\Omega, \mathcal{F}, \{\mathcal{F}_t\}, \mathbb{P})$ . + +Theorem 3.4. Fix any $T \in (0,1)$ . For any $t \in [0,T]$ , the controlled ODE (8) is explicitly given by: + +$$ +\mathrm {d} Y _ {t} = \left[ - \frac {1}{1 - t} \left(Y _ {t} - \gamma \mathbf {y} _ {1}\right) - \frac {(1 - \gamma) t}{1 - t} \nabla \log p _ {t} \left(Y _ {t}\right) \right] \mathrm {d} t, \quad Y _ {0} \sim p _ {0}. \tag {9} +$$ + +Its density evolution is identical to the density evolution of the following SDE for $Y_0 \sim p_0$ : + +$$ +\mathrm {d} Y _ {t} = \left(- \frac {1}{1 - t} \left(Y _ {t} - \gamma \mathbf {y} _ {1}\right) - \frac {t}{1 - t} (1 - \gamma) (\nabla \log p _ {t} (Y _ {t}) - \nabla \log p _ {t, \gamma} (Y _ {t}))\right) \mathrm {d} t + \sqrt {\frac {2 (1 - \gamma) t}{1 - t}} \mathrm {d} W _ {t}. \tag {10} +$$ + +Finally, denoting $p_{t,\gamma}(\cdot)$ as the marginal pdf of $Y_{t}$ , the density evolution is explicitly given by: + +$$ +\frac {\partial p _ {t , \gamma} (Y _ {t})}{\partial t} = \nabla \cdot \left[ \left(\frac {1}{1 - t} \left(Y _ {t} - \gamma \mathbf {y} _ {1}\right) + \frac {(1 - \gamma) t}{1 - t} \nabla \log p _ {t} (Y _ {t})\right) p _ {t, \gamma} (Y _ {t}) \right]. \tag {11} +$$ + +Properties of SDE (10). Elaborating on the intuition discussed at the end of §3.3, when the controller guidance $\gamma = 0$ , then $\nabla \log p_t(Y_t) = \nabla \log p_{t,0}(Y_t)$ , and SDE (10) becomes the stochastic equivalent of the standard RFs; see Lemma A.2. The resulting SDE is given by + +$$ +\mathrm {d} Y _ {t} = - \frac {1}{1 - t} Y _ {t} \mathrm {d} t + \sqrt {\frac {2 t}{1 - t}} \mathrm {d} W _ {t}, \quad Y _ {0} \sim p _ {0}, \tag {12} +$$ + +which improves faithfulness to the image $Y_0$ . When $\gamma = 1$ , the SDE (10) solves the LQR problem (7) and drives towards the terminal state $Y_1 = \mathbf{y}_1$ . This improves the generation quality, because the sample $Y_1$ is from the correct noise distribution $p_1$ as previously discussed in §3.3. Therefore, a suitable choice of $\gamma$ retains faithfulness while simultaneously applying the desired edits. + +Finally, we assume $T = 1 - \delta$ for sufficiently small $\delta$ (such that $0 < \delta \ll 1$ ) to avoid irregularities at the boundary (Øksendal, 2003). This is typically considered in practice for numerical stability (even for diffusion models). Thus, in practice, the final sample $\mathbf{y}_{1 - \delta}$ is returned as $\mathbf{y}_1$ . + +Comparison with DMs. Analogous to the SDE (12), the stochastic noising process of DMs is typically modeled by the Ornstein-Uhlenbeck (OU) process, governed by the following SDE: + +$$ +\mathrm {d} Y _ {t} = - Y _ {t} \mathrm {d} t + \sqrt {2} \mathrm {d} W _ {t}. \tag {13} +$$ + +The corresponding ODE formulation is given by: + +$$ +\mathrm {d} Y _ {t} = \left[ - Y _ {t} - \nabla \log p _ {t} \left(Y _ {t}\right) \right] \mathrm {d} t. \tag {14} +$$ + +Instead, our approach is based on rectified flows (1), which leads to a different ODE and consequently translates into a different SDE. As an additional result, we formalize the ODE derivation in Lemma A.1. In Lemma A.2, we show that the marginal distribution of this ODE is equal to that of an SDE with appropriate drift and diffusion terms. In Proposition A.3, we show that the stationary distribution of this new SDE (12) converges to the standard Gaussian $\mathcal{N}(0,I)$ in the limit as $t\to 1$ + +The standard OU process (13) interpolates between the data distribution at time $t = 0$ and a standard Gaussian as $t \to \infty$ . The SDE (12), however, interpolates between the data distribution at time $t = 0$ and a standard Gaussian at $t = 1$ . In other words, it effectively "accelerates" time as it progresses to achieve the terminal Gaussian distribution. This is accomplished by modifying the coefficients of drift and diffusion as in (12) to depend explicitly on time $t$ . Thus, a sample path of (12) appears like a noisy line, unlike that of the OU process (see Appendix D.3 for numerical simulations). + +# 3.5 CONTROLLED REVERSE FLOW USING RECTIFIED ODES AND SDEs + +In this section, we develop an ODE and an SDE similar to our discussions above, but for the reverse direction (i.e., from noise to images). + +Reverse process using ODE. Starting from the structured noise $\mathbf{y}_1$ obtained by integrating the controlled ODE (8), we construct another controlled ODE (15) for the reverse process (i.e., noise to image). In this process, the optimal controller uses the reference image $\mathbf{y}_0$ for guidance: + +$$ +\mathrm {d} X _ {t} = \left[ v _ {t} \left(X _ {t}\right) + \eta \left(v _ {t} \left(X _ {t} \mid \mathbf {y} _ {0}\right) - v _ {t} \left(X _ {t}\right)\right) \right] \mathrm {d} t, \quad X _ {0} = \mathbf {y} _ {1}, \quad t \in [ 0, 1 ], \tag {15} +$$ + +where $\eta \in [0,1]$ is the controller guidance parameter as before that controls faithfulness and editability of the given image $\mathbf{y}_0$ . Similar to the analysis in Proposition 3.2, $v_{t}(X_{t}|\mathbf{y}_{0})$ is obtained by solving the modified LQR problem (16): + +$$ +V (c) = \int_ {0} ^ {1} \frac {1}{2} \| c (Z _ {t}, t) \| _ {2} ^ {2} \mathrm {d} t + \frac {\lambda}{2} \| Z _ {1} - \mathbf {y} _ {0} \| _ {2} ^ {2}, \mathrm {d} Z _ {t} = c (Z _ {t}, t) \mathrm {d} t, \quad Z _ {0} = \mathbf {y} _ {1}. \tag {16} +$$ + +Solving (16), we get $c(Z_{t}, t) = \frac{\mathbf{y}_{0} - Z_{t}}{1 - t}$ . Our controller steers the samples toward the given image $\mathbf{y}_{0}$ . Thus, the controlled reverse ODE (15) effectively reduces the reconstruction error incurred in the standard reverse ODE (1) of RF models (e.g. Flux). + +Reverse process using SDE. Finally, in Theorem 3.5, we provide the stochastic equivalent of our controlled reverse ODE (15) for generation. Recall that we initialize with the terminal structured noise by running the controlled forward ODE (8), along with a reference image $\mathbf{y}_0$ . As discussed above, we terminate the inversion process at a time $T = 1 - \delta$ for numerical stability, resulting in a vector $\mathbf{y}_{1 - \delta}$ . Our reverse SDE thus starts at a corresponding time $\delta$ with this vector $\mathbf{y}_{1 - \delta}$ at initialization, and terminates at time $T' < 1$ . + +Theorem 3.5. Fix any $T' \in (\delta, 1)$ , and for any $t \in [\delta, T']$ , the density evolution of the controlled ODE (15) initialized at $X_0 = \mathbf{y}_{1 - \delta}$ is identical to the density evolution of the following SDE: + +$$ +\begin{array}{l} \mathrm {d} X _ {t} = \left[ \frac {(1 - t - \eta) X _ {t} + \eta t \mathbf {y} _ {0}}{t (1 - t)} + \frac {(1 - t) (1 - \eta)}{t} \left(\nabla \log p _ {1 - t} \left(X _ {t}\right) + \nabla \log q _ {t, \eta} \left(X _ {t}\right)\right) \right] \mathrm {d} t \tag {17} \\ + \sqrt {\frac {2 (1 - t) (1 - \eta)}{t}} d W _ {t}. \\ \end{array} +$$ + +Furthermore, denoting $q_{t}(\cdot)$ as the marginal pdf of $X_{t}$ , its density evolution is given by: + +$$ +\frac {\partial q _ {t , \eta} (X _ {t})}{\partial t} = \nabla \cdot \left[ - \left(\frac {1 - t - \eta}{t (1 - t)} X _ {t} + \frac {\eta}{1 - t} \mathbf {y} _ {0} + \frac {(1 - t)}{t} (1 - \eta) \nabla \log p _ {1 - t} (X _ {t})\right) q _ {t, \eta} (Y _ {t}) \right]. \tag {18} +$$ + +Properties of SDE (17). When the controller parameter $\eta = 0$ , we obtain a stochastic sampler (22) for the pre-trained Flux, as given in Lemma A.4. This case of our SDE (17) corresponds to the stochastic variant of standard RFs (Liu et al., 2022; Lipman et al., 2022; Albergo & Vanden-Eijnden, 2023). Our key contribution lies in conditioning on $X_{1} = \mathbf{y}_{0}$ for inverting rectified flows. Importantly, our explicit construction does not require additional training or test-time optimization, enabling for the first time an efficient sampler for zero-shot inversion and editing using Flux. When $\eta = 1$ , the score term and Brownian motion vanish from the SDE (17). The resulting drift becomes $\frac{\mathbf{y}_0 - X_t}{1 - t}$ , the optimal controller for the LQR problem (16), exactly recovering the given image $\mathbf{y}_0$ . + +Remark 3.6. Similar to Remark 3.3, our analysis extends to the case when $\eta$ is time-varying. This is useful in editing, as it allows the flow to initially move toward the given image $\mathbf{y}_0$ by choosing a large $\eta$ . As the flow approaches $\mathbf{y}_0$ on the image manifold, $\eta$ is gradually reduced, ensuring that the text-guided edits are enforced through the unconditional vector field $v_{t}(\cdot)$ provided by Flux. + +Finally, we note that RF-Inversion has an interpretation as a counterfactual sampler; please see Appendix B for more discussion on this interpretation (Pearl et al., 2016). + +# 4 ALGORITHM: INVERSION AND EDITING VIA CONTROLLED ODES + +In this section, we define the problem setup and outline the procedure using controlled ODEs (8) and (15). We employ Algorithm 1 for inversion and Algorithm 2 for editing: see Appendix D. + +Problem Setup. The user provides a text "prompt" to edit reference content, which could be a corrupt or a clean image. For the corrupt image guide, we use the dataset from SDEdit (Meng et al., 2022), which contains color strokes to convey high-level details. In this setting, the reference guide $\mathbf{y}_0$ is typically not a realistic image under the data distribution $p_0$ . The objective is to transform this guide into a more realistic image under $p_0$ while maintaining faithfulness to the original guide. + +For the clean image guide, the user provides a real image $\mathbf{y}_0$ along with an accompanying text "prompt" to specify the desired edits. The task is to apply text-guided edits to $\mathbf{y}_0$ while preserving its content. Examples include face editing, where the text might instruct change in age or gender. + +![](images/bbae49e4fabc161829bcb5c3cf2f3304be9dfe60d4d06ecf65f59400fd681a11.jpg) +Figure 2: Inverting flows by controlled ODEs (8) and (15). + +Procedure. Our algorithm has two key steps: inversion and editing. We discuss each step below. + +![](images/201f311be0337e558d2b4d55433c04d54ae931edd247766ef7d051d768f2d15f.jpg) +Input + +![](images/ae972cb0ec0127264553ed31f71fa897c023ad5b2f58645a0ba410cd6e14a686.jpg) +SDEdit + +![](images/36d75a6c6b4c368196a621c16f9db8d8ff582f3e2ad238a13aca2bc8ff59ff45.jpg) +DDIM Inversion + +![](images/e4f8453298faf1f5c7f2f7c3d72022276fea1838625de524c330ae2a763364f9.jpg) +NTI +Figure 3: Stroke2Image generation. Our method generates photo-realistic images of bedroom or church given stroke paints, showing robustness to initial corruptions. + +![](images/d84cd66391c9d0e2e5a6efcfe0cb69e50e09cd9a723c25ad49632d1f1ce47643.jpg) +NT1+P2P + +![](images/ebf21a701e42eb53f5eddf8021a2ab6c4e6638bb32f3d9a6f93ee1f7bdcc366e.jpg) +Ours + +Inversion. The first step involves computing the structured noise $Y_{1}$ by employing our controlled ODE (8), initialized at the reference content $Y_{0} = \mathbf{y}_{0}$ . To compute the unconditional vector field, we use the pre-trained Flux model $u(\cdot, \cdot, \cdot; \varphi)$ , which requires three inputs: the state $Y_{t}$ , the time $t$ , and the prompt embedding $\Phi(\text{prompt})$ . During the inversion process, we use null prompt in the Flux model, i.e., $u_{t}(\mathbf{y}_{t}) = u(\mathbf{y}_{t}, t, \Phi^{('')}; \varphi)$ . For the conditional vector field, we apply the analytical solution derived in Proposition 3.2. The inversion process yields a latent variable that is then used to initialize our controlled ODE (15), i.e., $X_{0} = \mathbf{y}_{1}$ . In this phase, we again use the null prompt to compute the vector field $v_{t}(\mathbf{x}_{t}) = -u(\mathbf{x}_{t}, 1 - t, \Phi^{('')}; \varphi)$ : see Figure 2 for the final output. + +Editing. The second step involves text-guided editing of the reference content $\mathbf{y}_0$ . This process is governed by our controlled ODE (15), where the vector field is computed using the desired text prompt within Flux: $v_{t}(X_{t}) = -u(\mathbf{x}_{t},1 - t,\Phi (\mathrm{prompt});\varphi)$ . The controller guidance $\eta$ in (15) balances faithfulness and editability: higher $\eta$ improves faithfulness but limits editability, while lower $\eta$ allows significant edits at the cost of reduced faithfulness. Consequently, the controller guidance $\eta$ provides a smooth interpolation between faithfulness and editability, a crucial feature in semantic image editing. Motivated by Remark 3.3 and 3.6, we consider a time-varying controller guidance $\eta_t$ , such that for a fixed $\eta \in [0,1]$ and $\tau \in [0,1]$ , $\eta_t = \eta \forall t\leq \tau$ and 0 otherwise. + +# 5 EXPERIMENTAL EVALUATION + +We show that RF inversion outperforms DM inversion across three benchmarks: LSUN-church, LSUN-bedroom (Wang et al., 2017), and SFHQ (Beniaguev, 2022) on two tasks: Stroke2Image generation and image editing. Stroke2Image generation shows the robustness of our algorithm to initial corruption. In semantic image editing, we emphasize the ability to edit clean images without additional training, optimization, or complex attention processors. We use Flux (Black Forest Labs, 2024) as our base foundation model and show compatibility with SD3.5 (Esser et al., 2024). + +Baselines. As this paper focuses on inverting flows, we compare with SoTA inversion approaches, such as NTI (Mokady et al., 2023), DDIM Inversion (Song et al., 2021a), and SDEdit (Meng et al., 2022). We use the official NTI implementation for both NTI and DDIM inversion, and Diffusers library for SDEdit. Hyper-parameters for all these baselines are tuned for optimal performance. We compare with NTI for both direct prompt change and with prompt-to-prompt Hertz et al. (2022) editing. All methods are training-free; however, NTI (Mokady et al., 2023) solves an optimization problem at each denoising step during inversion and uses P2P (Hertz et al., 2022) attention processor during editing. We follow the evaluation protocol from SDEdit (Meng et al., 2022). More qualitative results and comparison are in Appendix §D. + +Stroke2Image generation. As discussed in §4, our goal is to generate a photo-realistic image from a stroke paint (a corrupted image) and the text prompt "photo-realistic picture of a bedroom". In this case, the high level details in the stroke painting guide the reverse process toward a clean image. + +In Figure 3, we compare RF inversion (ours) with DM inversions. DM inversions propagate the corruption from the stroke painting into the structured noise, which leads to outputs resembling the input stroke painting. NTI optimizes null embeddings to align the reverse process with the DDIM forward trajectory. Although adding P2P to the NTI pipeline helps localized editing as in Figure 4, + +Table 1: Quantitative results for Stroke2Image generation. L2 and Kernel Inception Distance (KID) capture faithfulness and realism, respectively. Optimization-based methods are colored gray. User Pref. shows the percentage of users that prefer our method over each alternative in pairwise comparisons (and ties). E.g.: $62.11\%$ $(+8\%$ ties) prefer ours over SDEdit-Flux for LSUN Bedroom. + +
MethodLSUN BedroomLSUN Church
L2 ↓KID ↓User Pref. (%) ↑L2 ↓KID ↓User Pref. (%) ↑
SDEdit-SD1.586.720.02959.67 (5.33)90.720.08965.33 (4.11)
SDEdit-SDXL96.820.133-98.190.112-
SDEdit-SD393.400.037-98.140.096-
SDEdit-Flux94.890.03262.11 (8.00)92.470.08166.22 (5.22)
DDIM Inv-SD1.587.950.11382.56 (1.67)97.360.10785.44 (2.78)
NTI-SD1.582.770.09580.89 (4.33)87.880.09877.11 (4.89)
NTI+P2P-SD1.546.460.23498.11 (1.78)34.480.16899.22 (0.56)
Ours82.650.025-80.360.059-
+ +![](images/71ab3e77908ac2c267658e9d43bcd37db71b4df5d9d4062d1c27c5506ee26650.jpg) + +![](images/d77511d93669036ed02f80ac6bf6d623fe2b5abb4ad26ef2c3fde48611d736b2.jpg) +Original + +![](images/d7495b64a8dafbf20b9778b6f65b452b4e0390ab0c89f8ec2116f585bbff6891.jpg) + +![](images/8bb05498b03c818eac075277b3c966e3c789a121b6241f48769c147e143c91d6.jpg) +SDEdit + +![](images/c909d0779076dd985ed6a3ddb410cc882a806793636e4ea02daf9ef6d815d571.jpg) + +![](images/efc94d26bf66096eabe146cbd676918892e46ecc633e836715ef9bc4667a7879.jpg) +DDIM Inversion +Figure 4: Image editing for adding face accessories. Prompt: "face of a man/woman wearing glasses". The proposed method better preserves the identity while applying the desired edits. + +![](images/a4dcb972d9b8ad0c258f09b00a217f79036d464594c27d38522cf5871f69a1a4.jpg) + +![](images/0ccf83e0ca392488b639960d4e69f2cea4b7a139e4465dd2c2490300707094e2.jpg) +NTI + +![](images/69f3818e9d121ca9ccbce2965048ac50c8330ad35838a9704435d44419d13fa4.jpg) + +![](images/f68b8ee05a8b99294298696875c6f1d8fed64fc55c2442de7d9374a4830ab4a7.jpg) +NT1+P2P + +![](images/a9e81b1910911921beb732d43d3e38d3b29eac55bba0c47bb55a88b9baaff802.jpg) + +![](images/a3e3e119d2167d0a1d82f31ba50558775623a43a4a400b4a808255518a44be46.jpg) +Ours + +for corrupted images, it drives the reverse process even closer to the corruption. In contrast, our controlled ODE (8) yields a structured noise that is consistent with the corrupted image and also the invariant terminal distribution, as discussed in §3.3, resulting in more realistic images. + +In Table 1, we show that our method outperforms prior works in faithfulness and realism. On the test split of LSUN bedroom dataset, our approach is $4.7\%$ more faithful and $13.79\%$ more realistic than the best optimization free method SDEdit-SD1.5. Ours is $73\%$ more realistic than the optimization-based method NTI, but comparable in L2. As discussed, NTI+P2P gets closer toward the corrupt image, which gives a very low L2 error, but the resulting image becomes unrealistic. Our approach is $89\%$ more realistic than NTI+P2P. We observe similar gains on LSUN church dataset. + +User study. We conduct a user study using Amazon Mechanical Turk to evaluate the overall performance of the our method. With 3 responses for each question, we collected in total 9,000 comparisons from 126 participants. As given in Table 1, our method outperforms all the other baselines by at least $59.67\%$ in terms of overall satisfaction. More details are provided in Appendix §D.6. + +Semantic Image Editing. Given a clean image and a text "prompt", the objective is to modify the image according to the given text while preserving the contents of the image (identity for face images). In rectified linear paths, editing from a noisy latent becomes straightforward, further enhancing the efficiency of our approach. Compared with SoTA approaches (Figure 4), our method requires no additional optimization or complex attention processors as in NTI (Mokady et al., 2023) + P2P (Hertz et al., 2022). Thus, it is more efficient than a current SoTA approach, and importantly, more faithful to the original image while applying the desired edits. + +In Table 2, we show that our method outperforms the optimization-free methods by at least $29\%$ in face reconstruction, $6.6\%$ in DINO patch-wise similarity, and $26.4\%$ in CLIP-Image similarity while being comparable in prompt alignment metric CLIP-T. Importantly, our approach offers $54.11\%$ gain in runtime while staying comparable to NTI+P2P. + +![](images/67d59ba94d107610b500f60c76b60bd02ffcf60d004b59abab09b345eb5cd336.jpg) +(a) Original + +![](images/8820dcd19c4eaeb1facfad8cec14ac2a9d1d5fea6219c4c32c6071687148ede9.jpg) +"laugh" + +![](images/1429e61fa7c1ecb43143fcec56687986d04a7b0728e6c056b8fba7f5eb90ed2d.jpg) +"angry" + +![](images/b557d19353845abb55a02f049b9938498eb89ba6f606040e897c2d75faf73d27.jpg) +(c) + +![](images/4301e32f180ac91654ac81fa324e0d01cb2f611e373266de2ba650dc31e32133.jpg) +man $\rightarrow$ woman + +![](images/033e1aede5ddd1e5f2afc9a2ebd3352e1efe4dfaae8efa8cc7ae5dca13c4c656.jpg) +Figure 5: Semantic Image Editing: (a) stylized expression, (b) age, (c) gender, (d) object insert. Given an image and a text prompt, our algorithm performs semantic image editing in the wild. + +![](images/6fbd7f693ca395c90ba022d1fc5b6f6fb52c4b4cf0d9f61a9627b9282aa911bb.jpg) +(b) "A woman" + +![](images/0a3a5471c2f6375b07550fa2ca6ca770013998cb00d129fc7ab5297537a5d5da.jpg) +"old" + +![](images/df1541ee752e714342b73f4cff90b95f693a47a531d60a56c1714a1cd07822d3.jpg) +"older" + +![](images/a87ea1b06e5b15e5f43d903f529a5fb64d8dc8d57b87abb36234977f6b49d3eb.jpg) +(d) Original + +![](images/ad6fc4353a1bb84e9224e222d3e537e9e75ddc922ed3f5d765cfa5b134426f08.jpg) ++ "pepperoni" + +![](images/535a676c41c1ec1f0d4137846bd2cd9edf75841fb6a29c2133f750fd4f8be88d.jpg) ++ "mushroom" + +Table 2: Quantitative results for face editing on SFHQ for "wearing glasses". + +
MethodFace Rec. ↓DINO ↑CLIP-T ↑CLIP-I ↑Runtime(s) ↓
SDEdit-SD1.50.6260.8850.3000.7128
SDEdit-Flux0.6320.8920.2920.71024
DDIM Inv.0.7090.8840.3110.66915
NTI0.7070.8760.3040.66678
NTI+P2P0.4430.9530.2930.84585
Ours0.4420.9510.3000.90039
+ +In Figure 5, we showcase four complex editing tasks: (a) prompt-based stylization with the prompt: "face of a boy in disney 3d cartoon style", where facial expressions, such as "laugh" or "angry" are used for editing; (b) ability to control the age of a person; (c) interpolating between two concepts: "A man" $\leftrightarrow$ "A woman"; (d) sequentially inserting pepperoni and mushroom to an image of a pizza. We provide more examples of editing in the wild in Appendix §D. + +# Comparison using the same backbone: Flux. + +In Figure 6, we compare our method with SDEdit and DDIM inversion both adapted to Flux. NTI optimizes null embeddings to align with forward latents before applying text-guided edits, an approach well-suited for DMs that use both null and text embeddings. However, this strategy cannot be applied to Flux, as it does not explicitly use null embeddings. Consequently, we only reimplement SDEdit and DDIM inversion with the Flux backbone and compare them to our method. Since all methods leverage the same generative model, the im + +provements clearly stem from our controlled ODEs, grounded in a solid theoretical foundation (§3). + +![](images/c48d955eccf3663a28186038c86c99276f1e2a578fa23cbe348796e98eca8cff.jpg) +Original + +![](images/9667a13bc087e75b6f2445cbf73ab39bd0c85dadf410f3a768de2979dd5b6ef1.jpg) +SDEdit(Flux) + +![](images/ecadf540f9e49d785170f9b653507418dca2be4c8969f10062328617232c1b77.jpg) +Flux Inversion + +![](images/dcdf3bca12fdcdfd4fc192119d4faca441b3bf6aca671bec17672ff9e6bd4f60.jpg) +Ours +Figure 6: Comparison using Flux backbone. + +# 6 CONCLUSION + +We present the first approach for inversion and editing with state-of-art rectified flow models such as Flux. Our method interpolates between two vector fields: $(i)$ the unconditional RF field that transforms a "clean" image to "typical" noise, and $(ii)$ a conditional vector field derived from optimal control that transforms any image (clean or not) to "typical" noise. Our new field thus navigates between these two competing objectives of consistency with the given (possibly corrupted) image, and consistency with the distribution of clean images. Theoretically, we show that this is equivalent to a new rectified SDE formulation, sharing this intuition of interpolation. Practically, we show that our method results in state-of-art zero-shot performance, without the need of additional training, optimization of latent variables, prompt tuning, or complex attention processors. + +# BROADER IMPACT STATEMENT + +Semantic image inversion and editing have both positive and negative social impacts. +On the positive side, this technology enables (i) the generation of photo-realistic images from high level descriptions, such as stroke paintings, and (ii) the modification of clean images by changing various attributes like the age, gender, or adding glasses ( $\S 5$ ). +On the negative side, it can be misused by malicious users to manipulate photographs of individuals with inappropriate or offensive edits. Additionally, it carries the inherent risks associated with the underlying generative model. +To mitigate the negative social impacts, we enable safety features such as NSFW filters in the underlying generative model. Furthermore, we believe watermarking images generated by this technology can reduce misuse in inversion and editing applications. +Reproducibility. The pseudocode and hyper-parameter details have been provided in the paper. Refer to our project page: https://rf-inversion.github.io/ for source code and demo. + +# ACKNOWLEDGMENTS + +This research has been supported by NSF Grant 2019844, a Google research collaboration award, and the UT Austin Machine Learning Lab. We thank Dr. Karthikeyan Shanmugam (Google DeepMind) for insightful discussions on the connections to causal inference and counterfactuals. We also thank the reviewers and area chair for their suggestions during the discussion phase. + +# REFERENCES + +Michael S Albergo, Nicholas M Boffi, and Eric Vanden-Eijnden. Stochastic interpolants: A unifying framework for flows and diffusions. arXiv preprint arXiv:2303.08797, 2023. +Michael Samuel Albergo and Eric Vanden-Eijnden. Building normalizing flows with stochastic interpolants. In The Eleventh International Conference on Learning Representations, 2023. +Brian D.O. Anderson. Reverse-time diffusion equation models. Stochastic Processes and their Applications, 12(3):313-326, 1982. +Tamer Basar, Sean Meyn, and William R Perkins. Lecture notes on control system theory and design. arXiv preprint arXiv:2007.01367, 2020. +David Beniaguev. Synthetic faces high quality (sfhq) dataset, 2022. URL https://github.com/SelfishGene/SFHQ-dataset. +Black Forest Labs. Black forest labs, 2024. URL https://blackforestlabs.ai/. Accessed: September 1, 2024. +Manuel Brack, Felix Friedrich, Katharia Kornmeier, Linoy Tsaban, Patrick Schramowski, Kristian Kersting, and Apolinário Passos. *Ledits++: Limitless image editing using text-to-image models.* In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 8861-8870, 2024. +Tim Brooks, Aleksander Holynski, and Alexei A Efros. Instructpix2pix: Learning to follow image editing instructions. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 18392-18402, 2023. +Guillaume Couairon, Jakob Verbeek, Holger Schwenk, and Matthieu Cord. Diffedit: Diffusion-based semantic image editing with mask guidance. In ICLR 2023 (Eleventh International Conference on Learning Representations), 2023. +Maurizio Delbracio and Peyman Milanfar. Inversion by direct iteration: An alternative to denoising diffusion for image restoration. Transactions on Machine Learning Research, 2023. + +Bradley Efron. Tweedie's formula and selection bias. Journal of the American Statistical Association, 106(496):1602-1614, 2011. +Patrick Esser, Sumith Kulal, Andreas Blattmann, Rahim Entezari, Jonas Müller, Harry Saini, Yam Levi, Dominik Lorenz, Axel Sauer, Frederic Boesel, et al. Scaling rectified flow transformers for high-resolution image synthesis. In *Forty-first International Conference on Machine Learning*, 2024. +Wendell H Fleming and Raymond W Rishel. Deterministic and stochastic optimal control, volume 1. Springer Science & Business Media, 1975. +Daniel Garibi, Or Patashnik, Andrey Voynov, Hadar Averbuch-Elor, and Daniel Cohen-Or. Renoise: Real image inversion through iterative noising. 2024. +Amir Hertz, Ron Mokady, Jay Tenenbaum, Kfir Aberman, Yael Pritch, and Daniel Cohen-or. Prompt-to-prompt image editing with cross-attention control. In The Eleventh International Conference on Learning Representations, 2022. +Amir Hertz, Andrey Voynov, Shlomi Fruchter, and Daniel Cohen-Or. Style aligned image generation via shared attention. arXiv preprint arXiv:2312.02133, 2023. +Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. Advances in Neural Information Processing Systems, 33:6840-6851, 2020. +Edward J Hu, Phillip Wallis, Zeyuan Allen-Zhu, Yuzhhi Li, Shean Wang, Lu Wang, Weizhu Chen, et al. Lora: Low-rank adaptation of large language models. In International Conference on Learning Representations, 2021. +Inbar Huberman-Spiegelglas, Vladimir Kulikov, and Tomer Michaeli. An edit friendly ddpm noise space: Inversion and manipulations. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 12469-12478, June 2024. +Xuan Ju, Ailing Zeng, Chenchen Zhao, Jianan Wang, Lei Zhang, and Qiang Xu. Humansd: A native skeleton-guided diffusion model for human image generation. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 15988-15998, 2023. +Tero Karras, Miika Aittala, Timo Aila, and Samuli Laine. Elucidating the design space of diffusion-based generative models. Advances in Neural Information Processing Systems, 35:26565-26577, 2022. +Tero Karras, Miika Aittala, Jaakko Lehtinen, Janne Hellsten, Timo Aila, and Samuli Laine. Analyzing and improving the training dynamics of diffusion models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 24174-24184, 2024. +Gwanghyun Kim, Taesung Kwon, and Jong Chul Ye. Diffusionclip: Text-guided diffusion models for robust image manipulation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 2426-2435, 2022. +Gihyun Kwon and Jong Chul Ye. Diffusion-based image translation using disentangled style and content representation. In The Eleventh International Conference on Learning Representations, 2023. URL https://openreview.net/forum?id=Nayau9fwXU. +Yaron Lipman, Ricky TQ Chen, Heli Ben-Hamu, Maximilian Nickel, and Matt Le. Flow matching for generative modeling. arXiv preprint arXiv:2210.02747, 2022. +Xingchao Liu, Chengyue Gong, et al. Flow straight and fast: Learning to generate and transfer data with rectified flow. In The Eleventh International Conference on Learning Representations, 2022. +Chenlin Meng, Yutong He, Yang Song, Jiaming Song, Jiajun Wu, Jun-Yan Zhu, and Stefano Ermon. Sdedit: Guided image synthesis and editing with stochastic differential equations. In International Conference on Learning Representations, 2022. +Daiki Miyake, Akihiro Iohara, Yu Saito, and Toshiyuki Tanaka. Negative-prompt inversion: Fast image inversion for editing with text-guided diffusion models. arXiv preprint arXiv:2305.16807, 2023. + +Ron Mokady, Amir Hertz, Kfir Aberman, Yael Pritch, and Daniel Cohen-Or. Null-text inversion for editing real images using guided diffusion models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 6038-6047, 2023. +Alexander Quinn Nichol, Prafulla Dhariwal, Aditya Ramesh, Pranav Shyam, Pamela Mishkin, Bob McGrew, Ilya Sutskever, and Mark Chen. Glide: Towards photorealistic image generation and editing with text-guided diffusion models. In International Conference on Machine Learning, pp. 16784-16804. PMLR, 2022. +Bernt Øksendal. Stochastic differential equations. Springer, 2003. +Zhihong Pan, Riccardo Gherardi, Xiufeng Xie, and Stephen Huang. Effective real image editing with accelerated iterative diffusion inversion. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 15912-15921, 2023. +Judea Pearl, Madelyn Glymour, and Nicholas P Jewell. Causal inference in statistics: A primer. John Wiley & Sons, 2016. +William Peebles and Saining Xie. Scalable diffusion models with transformers. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 4195-4205, 2023. +Pablo Pernias, Dominic Rampas, Mats Leon Richter, Christopher Pal, and Marc Aubreville. Würstchen: An efficient architecture for large-scale text-to-image diffusion models. In The Twelfth International Conference on Learning Representations, 2024. URL https://openreview.net/forum?id=gU58d5QeGv. +Dustin Podell, Zion English, Kyle Lacey, Andreas Blattmann, Tim Dockhorn, Jonas Müller, Joe Penna, and Robin Rombach. Sdxl: Improving latent diffusion models for high-resolution image synthesis. In The Twelfth International Conference on Learning Representations, 2023. +Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, et al. Learning transferable visual models from natural language supervision. In International conference on machine learning, pp. 8748-8763. PMLR, 2021. +Aditya Ramesh, Mikhail Pavlov, Gabriel Goh, Scott Gray, Chelsea Voss, Alec Radford, Mark Chen, and Ilya Sutskever. Zero-shot text-to-image generation. In International Conference on Machine Learning, pp. 8821-8831. PMLR, 2021. +Aditya Ramesh, Prafulla Dhariwal, Alex Nichol, Casey Chu, and Mark Chen. Hierarchical text-conditional image generation with clip latents. arXiv preprint arXiv:2204.06125, 2022. +Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Björn Ommer. High-resolution image synthesis with latent diffusion models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 10684-10695, 2022. +Litu Rout, Advait Parulekar, Constantine Caramenis, and Sanjay Shakkottai. A theoretical justification for image inpainting using denoising diffusion probabilistic models. arXiv preprint arXiv:2302.01217, 2023a. +Litu Rout, Negin Raoof, Giannis Daras, Constantine Caramanis, Alexandros G Dimakis, and Sanjay Shakkottai. Solving inverse problems provably via posterior sampling with latent diffusion models. In Thirty-seventh Conference on Neural Information Processing Systems, 2023b. URL https://openreview.net/forum?id=XKBFdYwfRo. +Litu Rout, Yujia Chen, Abhishek Kumar, Constantine Caramanis, Sanjay Shakkottai, and WenSheng Chu. Beyond first-order tweedie: Solving inverse problems using latent diffusion. In 2024 IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2024. +Litu Rout, Yujia Chen, Nataniel Ruiz, Abhishek Kumar, Constantine Caramanis, Sanjay Shakkottai, and Wen-Sheng Chu. RB-modulation: Training-free stylization using reference-based modulation. In The Thirteenth International Conference on Learning Representations, 2025. URL https://openreview.net/forum?id=bnINPG5A32. + +Nataniel Ruiz, Yuzhen Li, Varun Jampani, Yael Pritch, Michael Rubinstein, and Kfir Aberman. Dreambooth: Fine tuning text-to-image diffusion models for subject-driven generation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 22500-22510, 2023. +Nataniel Ruiz, Yanzhen Li, Varun Jampani, Wei Wei, Tingbo Hou, Yael Pritch, Neal Wadhwa, Michael Rubinstein, and Kfir Aberman. Hyperdream booth: Hypernetworks for fast personalization of text-to-image models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 6527-6536, 2024. +Chitwan Sahara, William Chan, Huiwen Chang, Chris A. Lee, Jonathan Ho, Tim Salimans, David J. Fleet, and Mohammad Norouzi. Palette: Image-to-image diffusion models, 2022. +Jascha Sohl-Dickstein, Eric Weiss, Niru Maheswaranathan, and Surya Ganguli. Deep unsupervised learning using nonequilibrium thermodynamics. In Francis Bach and David Blei (eds.), Proceedings of the 32nd International Conference on Machine Learning, volume 37 of Proceedings of Machine Learning Research, pp. 2256-2265, Lille, France, 07-09 Jul 2015. PMLR. URL https://proceedings.mlr.press/v37/sohl-dickstein15.html. +Jiaming Song, Chenlin Meng, and Stefano Ermon. Denoising diffusion implicit models. In International Conference on Learning Representations, 2021a. URL https://openreview.net/forum?id=StlgiarCHLP. +Yang Song and Stefano Ermon. Generative modeling by estimating gradients of the data distribution. Advances in Neural Information Processing Systems, 32, 2019. +Yang Song, Jascha Sohl-Dickstein, Diederik P Kingma, Abhishek Kumar, Stefano Ermon, and Ben Poole. Score-based generative modeling through stochastic differential equations. In International Conference on Learning Representations, 2021b. URL https://openreview.net/forum?id=PxTIG12RRHS. +Narek Tumanyan, Michal Geyer, Shai Bagon, and Tali Dekel. Plug-and-play diffusion features for text-driven image-to-image translation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 1921-1930, 2023. +Belinda Tzen and Maxim Raginsky. Theoretical guarantees for sampling and inference in generative models with latent diffusions. In Conference on Learning Theory, pp. 3084-3114. PMLR, 2019. +Limin Wang, Sheng Guo, Weilin Huang, Yuanjun Xiong, and Yu Qiao. Knowledge guided disambiguation for large-scale scene classification with multi-resolution cnns. IEEE Transactions on Image Processing, 26(4):2055-2068, 2017. +Chen Henry Wu and Fernando De la Torre. A latent space of stochastic diffusion models for zero-shot image editing and guidance. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 7378-7387, 2023. +Qinsheng Zhang and Yongxin Chen. Path integral sampler: A stochastic control approach for sampling. In International Conference on Learning Representations, 2022. URL https://openreview.net/forum?id=__uCb2ynRu7Y. + +# A ADDITIONAL THEORETICAL RESULTS + +In this section, we present the theoretical results omitted from the main draft due to space constraints. We formalize the ODE derivation of the standard rectified flows in Lemma A.1. + +Lemma A.1. Given a coupling $(Y_0, Y_1) \sim p_0 \times p_1$ , consider the noising process $Y_t = tY_1 + (1 - t)Y_0$ . Then, the rectified flow ODE formulation with the optimal vector field is given by + +$$ +\mathrm {d} Y _ {t} = \left[ - \frac {1}{1 - t} Y _ {t} - \frac {t}{1 - t} \nabla \log p _ {t} \left(Y _ {t}\right) \right] \mathrm {d} t, \quad Y _ {0} \sim p _ {0}. \tag {19} +$$ + +Furthermore, denoting $p_t(\cdot)$ as the marginal pdf of $Y_{t}$ , its density evolution is given by: + +$$ +\frac {\partial p _ {t} \left(Y _ {t}\right)}{\partial t} = \nabla \cdot \left[ \left(\frac {1}{1 - t} Y _ {t} + \frac {t}{1 - t} \nabla \log p _ {t} \left(Y _ {t}\right)\right) p _ {t} \left(Y _ {t}\right) \right]. \tag {20} +$$ + +In Lemma A.2, we show that the marginal distribution of the rectified flow (6) is equal to that of an SDE with appropriate drift and diffusion terms. + +Lemma A.2. Fix any $T \in (0,1)$ , and for any $t \in [0,T]$ , the density evolution (20) of the rectified flow model (19) is identical to the density evolution of the following SDE: + +$$ +\mathrm {d} Y _ {t} = - \frac {1}{1 - t} Y _ {t} \mathrm {d} t + \sqrt {\frac {2 t}{1 - t}} \mathrm {d} W _ {t}, \quad Y _ {0} \sim p _ {0}. \tag {21} +$$ + +In Proposition A.3, we show that the stationary distribution of the SDE (21) converges to the standard Gaussian $\mathcal{N}(0,I)$ in the limit as $t\to 1$ + +Proposition A.3. Fix any $T \in (0,1)$ , and for any $t \in [0,T]$ , the density evolution for the rectified flow ODE (6) is same as that of the SDE (12). Furthermore, denoting $p_t(\cdot)$ as the marginal pdf of $Y_{t}$ , its stationary distribution $p_t(Y_t) \propto \exp \left(-\frac{\|Y_t\|^2}{2t}\right)$ , which converges to $\mathcal{N}(0,I)$ as $t \to 1$ . + +We note that Lemma A.1 and Lemma A.2 follow from the duality between the heat equation and the continuity equation (Øksendal, 2003), where it is classically known that one can interpret a diffusive term as a vector field that is affine in the score function, and vice-versa. This connection has been carefully used to study a large family of stochastic interpolants (that generalize rectified flows) in (Albergo & Vanden-Eijnden, 2023; Albergo et al., 2023), and which can lead to a family of ODE-SDE pairs. In the lemmas above, we have provided explicit coefficients that have been directly derived, instead of using the stochastic interpolant formulation. Our key contribution lies in constructing a controlled ODEs (8) and (15), along with their equivalent SDEs (10) and (17) in Theorem 3.4 and Theorem 3.5, respectively. This aids faithfulness and editability as discussed in §4. + +In Lemma A.4, we derive a rectified SDE that transforms noise into images by reversing the stochastic equivalent of rectified flows (12). + +Lemma A.4. Fix any small $\delta \in (0,1)$ , and for any $t\in [\delta ,1]$ , the process $X_{t}$ governed by the SDE: + +$$ +\mathrm {d} X _ {t} = \left[ \frac {1}{t} X _ {t} + \frac {2 (1 - t)}{t} \nabla \log p _ {1 - t} \left(X _ {t}\right) \right] \mathrm {d} t + \sqrt {\frac {2 (1 - t)}{t}} \mathrm {d} W _ {t}, \quad X _ {0} \sim p _ {1}, \tag {22} +$$ + +is the time-reversal of the SDE (12). + +**Implication.** The reverse SDE (22) provides a stochastic sampler for SoTA rectified flow models like Flux. Unlike diffusion-based generative models that explicitly model the score function $\nabla \log p_t(\cdot)$ in (22), rectified flows model a vector field, as discussed in §3.1. However, given a neural network $u(\mathbf{y}_t,t;\varphi)$ approximating the vector field $u_{t}(\mathbf{y}_{t})$ , Lemma A.1 offers an explicit formula for computing the score function: + +$$ +\nabla \log p _ {t} \left(Y _ {t}\right) = - \frac {1}{t} Y _ {t} - \frac {1 - t}{t} u \left(Y _ {t}, t; \varphi\right). \tag {23} +$$ + +This score function is used to compute the drift and diffusion coefficients of the SDE (22), resulting in a practically implementable stochastic sampler for Flux. This extends the applicability of Flux to downstream tasks where SDE-based samplers have demonstrated practical benefits, as seen in diffusion models (Ho et al., 2020; Song et al., 2021b; Rombach et al., 2022; Podell et al., 2023). + +![](images/450e00159bae4e918af5fdc569f430de874980322f0bc3aa820820e571c7ceb9.jpg) +Ref. Image + +![](images/1fc641286fd7083e38b853ed8b12ba353dfc4ecf8dfb67846869591241d54f3e.jpg) +w/o controller $^+$ null-text $(^{**})$ + +![](images/34d1f0a00bde86009f494af1a8bf5fb952564052fa43442bc67f8380e12fb6c8.jpg) +w/ controller + null-text ("") +Figure 7: Noise abduction and counterfactual sampling using our controlled rectified flows. The first image is the original reference image of a cat. The second image is generated by mapping the original cat image to a structured noise and then transforming this noise into an image. In this case, we do not apply the controller and use null-text prompt during both inversion and generation. As expected, without the controller and text conditioning, the generated image appears unrelated to the original cat. Interestingly, when the controller is applied (and with null-text prompt) according to (15), the generated image closely reconstructs the original cat, illustrating that the structured noise preserves the salient features of the reference image, drawing a parallel to noise abduction discussed in (Pearl et al., 2016). The rightmost two images illustrate counterfactual sampling. Using the text prompts "A silver cat sculpture" and "A tiger", we generate images that correspond to the 'do' action in (Pearl et al., 2016). This demonstrates how our controlled rectified flow ODEs enable sampling of counterfactual images — imagining the original cat as a silver sculpture or a tiger. + +![](images/e74082a3566d1abbaf1cf30faf259918ebb3990b548532ced822bfafdb6802dd.jpg) +w/ controller + "silver sculpture" + +![](images/6a702ab2cd7623e5144314050db6ec77e17ce4c3a2e8c6298036f00c218e7db6.jpg) +w/ controller + "tiger" + +# B RF-INVERSION AS A COUNTERFACTUAL SAMPLER + +RF-Inversion pipeline consists of three key steps: (i) Inversion - Mapping an image to a structured noise with null-text in RF vector field; (ii) Conditioning - Modifying the text input of the RF vector field to desired prompt; and (iii) Generation - Transforming the structured noise back to the desired image. This triplet can be interpreted as a prototype implementation of a counterfactual sampler. In particular, Pearl et al. (2016) (Section 4.2.4) propose a three-step process for counterfactual sampling in a Structural Causal Model (SCM): (i) Noise Abduction - Identifying the underlying noise sample that leads to the observed event; (ii) Action - Applying a "do" intervention on the SCM to encode new constraints; and (iii) Prediction (Sampling from the new SCM) - Using the abducted noise sample to generate outcomes in the updated SCM, ensuring sample-path coupling between the original and the modified SCMs. + +As a concrete example, consider an image of a cat where we wish to generate silver sculpture of the same cat: see Figure 7. In the framework of Pearl et al. (2016), we start with an SCM as a world model. Given the observed event (the sample is the reference cat image), we first abduct to the underlying noise that led to this sample. This corresponds to the inversion step in our method, where we map the image to a structured noise using our controlled forward ODE (8). Next, we apply a "do" action by modifying the text conditioning of the RF model to "silver cat sculpture". In a flow-based model, text conditioning functions as an intervention because the score network is deterministic. This ensures meaningful propagation of the desired prompt through the generation process. Finally, we generate the new image using the controlled reverse ODE (15), producing a counterfactual version of the original cat — now imagined as a silver sculpture. Thus, RF Inversion has an interpretation as a counterfactual sampler working with a powerful world model (here, the combination of the Flux generative model (Black Forest Labs, 2024) and the optimal control flow)1. This interpretation, we believe, has several applications beyond image editing and stylization, and is a fruitful direction for future work. + +# C TECHNICAL PROOFS + +This section contains technical proofs of the theoretical results presented in this paper. + +# C.1 PROOF OF PROPOSITION 3.2 + +Proof. The standard approach to solving an LQR problem is the minimum principle theorem that can be found in control literature (Fleming & Rishel, 1975; Basar et al., 2020). We follow this approach and provide the full proof below for completeness. + +The Hamiltonian of the LQR problem (7) is given by + +$$ +H \left(\mathbf {z} _ {t}, \mathbf {p} _ {t}, \mathbf {c} _ {t}, t\right) = \frac {1}{2} \left\| \mathbf {c} _ {t} \right\| ^ {2} + \mathbf {p} _ {t} ^ {T} \mathbf {c} _ {t}. \tag {24} +$$ + +For $\mathbf{c}_t^* = -\mathbf{p}_t$ , the Hamiltonian attains its minimum value: $H(\mathbf{z}_t, \mathbf{p}_t, \mathbf{c}_t^*, t) = -\frac{1}{2} \| \mathbf{p}_t \|^2$ . Using minimum principle theorem (Fleming & Rishel, 1975; Basar et al., 2020), we get + +$$ +\frac {\mathrm {d} \mathbf {p} _ {t}}{\mathrm {d} t} = \nabla_ {\mathbf {z} _ {t}} H \left(\mathbf {z} _ {t}, \mathbf {p} _ {t}, \mathbf {c} _ {t} ^ {*}, t\right) = 0; \tag {25} +$$ + +$$ +\frac {\mathrm {d} \mathbf {z} _ {t}}{\mathrm {d} t} = \nabla_ {\mathbf {p} _ {t}} H \left(\mathbf {z} _ {t}, \mathbf {p} _ {t}, \mathbf {c} _ {t} ^ {*}, t\right) = - \mathbf {p} _ {t}; \tag {26} +$$ + +$$ +\mathbf {z} _ {0} = \mathbf {y} _ {0}; \tag {27} +$$ + +$$ +\mathbf {p} _ {1} = \nabla_ {\mathbf {z} _ {1}} \left(\frac {\lambda}{2} \| \mathbf {z} _ {1} - \mathbf {y} _ {1} \| _ {2} ^ {2}\right) = \lambda (\mathbf {z} _ {1} - \mathbf {y} _ {1}). \tag {28} +$$ + +From (25), we know $\mathbf{p}_t$ is a constant $\mathbf{p}$ . Using this constant in (26) and integrating from $t\to 1$ , we have $\mathbf{z}_1 = \mathbf{z}_t - \mathbf{p}(1 - t)$ . Substituting $\mathbf{z}_1$ in (27), + +$$ +\mathbf {p} = \lambda (\mathbf {z} _ {t} - \mathbf {p} (1 - t) - \mathbf {y} _ {1}) = \lambda (\mathbf {z} _ {t} - \mathbf {y} _ {1}) - \lambda (1 - t) \mathbf {p}, +$$ + +which simplifies to + +$$ +\mathbf {p} = \left(1 + \lambda (1 - t)\right) ^ {- 1} \lambda (\mathbf {z} _ {t} - \mathbf {y} _ {1}) = \left(\frac {1}{\lambda} + (1 - t)\right) ^ {- 1} (\mathbf {z} _ {t} - \mathbf {y} _ {1}). +$$ + +Taking the limit $\lambda \to \infty$ , we get $\mathbf{p} = \frac{\mathbf{z}_t - \mathbf{y}_1}{1 - t}$ and the optimal controller $\mathbf{c}_t^* = \frac{\mathbf{y}_1 - \mathbf{z}_t}{1 - t}$ . Since $u_t(\mathbf{z}_t|\mathbf{y}_1) = \mathbf{y}_1 - \mathbf{y}_0$ , the proof follows by substituting $\mathbf{y}_0 = \frac{\mathbf{z}_t - t\mathbf{y}_1}{1 - t}$ . + +# C.2 PROOF OF PROPOSITION 3.1 + +Proof. Initializing the generative ODE (1) with the structured noise $\mathbf{y}_1$ , we get + +$$ +\frac {\mathrm {d} X _ {t}}{\mathrm {d} t} = v _ {t} \left(X _ {t}\right), \quad X _ {0} = \mathbf {y} _ {1}, \quad \forall t \in [ 0, 1 ]. \tag {29} +$$ + +Substituting $u_{t}(\cdot) = -v_{1 - t}(\cdot)$ in ODE (6), + +$$ +\frac {\mathrm {d} Y _ {t}}{\mathrm {d} t} = u _ {t} (Y _ {t}) = - v _ {1 - t} (Y _ {t}), \quad Y _ {0} = \mathbf {y} _ {0}, \quad \forall t \in [ 0, 1 ]. +$$ + +Replacing $t\to (1 - t)$ + +$$ +\frac {\mathrm {d} Y _ {1 - t}}{\mathrm {d} t} = v _ {t} \left(Y _ {1 - t}\right), \quad \forall t \in [ 0, 1 ]. \tag {30} +$$ + +Since (29) and (30) hold $\forall t\in [0,1]$ and $X_0 = \mathbf{y}_1$ , then $X_{t} = Y_{1 - t}$ that implies $X_{1} = Y_{0} = \mathbf{y}_{0}$ + +# C.3 PROOF OF THEOREM 3.4 + +Proof. From Proposition 3.2, we have $u_{t}(Y_{t}|Y_{1}) = \frac{Y_{1} - Y_{t}}{1 - t}$ . In Lemma A.1, we show that + +$$ +u _ {t} (Y _ {t}) = \left[ - \frac {1}{1 - t} Y _ {t} - \frac {t}{1 - t} \nabla \log p _ {t} (Y _ {t}) \right]. +$$ + +Now, the controlled ODE (8) becomes: + +$$ +\begin{array}{l} \mathrm {d} Y _ {t} = \left[ u _ {t} (Y _ {t}) + \gamma \left(u _ {t} \left(Y _ {t} \mid Y _ {1}\right) - u _ {t} (Y _ {t})\right) \right] \mathrm {d} t, \quad Y _ {0} \sim p _ {0}, \quad Y _ {1} = \mathbf {y} _ {1} \\ = \left[ (1 - \gamma) \left(- \frac {1}{1 - t} Y _ {t} - \frac {t}{1 - t} \nabla \log p _ {t} \left(Y _ {t}\right)\right) + \gamma \left(\frac {Y _ {1} - Y _ {t}}{1 - t}\right) \right] d t \\ = \left[ - \frac {1}{1 - t} Y _ {t} - \frac {t}{1 - t} (1 - \gamma) \nabla \log p _ {t} (Y _ {t}) + \frac {\gamma}{1 - t} Y _ {1} \right] \mathrm {d} t \\ = \left[ - \frac {1}{1 - t} \left(Y _ {t} - \gamma Y _ {1}\right) - \frac {t}{1 - t} (1 - \gamma) \nabla \log p _ {t} (Y _ {t}) \right] d t. \\ \end{array} +$$ + +Using continuity equation (Øksendal, 2003), the density evolution of the controlled ODE (8) then becomes: + +$$ +\frac {\partial p _ {t , \gamma} (Y _ {t})}{\partial t} = \nabla \cdot \left[ \left(\frac {1}{1 - t} \left(Y _ {t} - \gamma Y _ {1}\right) + \frac {t}{1 - t} (1 - \gamma) \nabla \log p _ {t} (Y _ {t})\right) p _ {t, \gamma} (Y _ {t}) \right]. \tag {31} +$$ + +Applying Fokker-Planck equation (Øksendal, 2003) to the SDE (10), we have + +$$ +\begin{array}{l} \frac {\partial p _ {t , \gamma} (Y _ {t})}{\partial t} + \nabla \cdot \left[ \left(- \frac {1}{1 - t} \left(Y _ {t} - \gamma Y _ {1}\right) - \frac {t}{1 - t} (1 - \gamma) (\nabla \log p _ {t} (Y _ {t}) - \nabla \log p _ {t, \gamma} (Y _ {t}))\right) p _ {t, \gamma} (Y _ {t}) \right] \\ = \nabla \cdot \left[ \frac {t}{1 - t} (1 - \gamma) \nabla p _ {t, \gamma} (Y _ {t}) \right], \\ \end{array} +$$ + +which can be rearranged to equal (31) completing the proof. + +![](images/112ee18b06892aa2148e546fb4ed6239e4c7bb4f62a298d0a99c72dde581e922.jpg) + +# C.4 PROOF OF LEMMA A.1 + +Proof. Given $(Y_0, Y_1) \sim p_0 \times p_1$ , the conditional flow matching loss (5) can be reparameterized as: + +$$ +\mathcal {L} _ {C F M} (\varphi) := \mathbb {E} _ {t \sim \mathcal {U} [ 0, 1 ], (Y _ {0}, Y _ {1}) \sim p _ {1} \times p _ {0}} \left[ \| (Y _ {1} - Y _ {0}) - u (Y _ {t}, t; \varphi) \| _ {2} ^ {2} \right], \quad Y _ {t} = t Y _ {1} + (1 - t) Y _ {0}, +$$ + +where the optimal solution is given by the minimum mean squared estimator: + +$$ +u _ {t} \left(\mathbf {y} _ {t}\right) = \mathbb {E} _ {\left(Y _ {0}, Y _ {1}\right) \sim p _ {1} \times p _ {0}} \left[ Y _ {1} - Y _ {0} \mid Y _ {t} = \mathbf {y} _ {t} \right]. \tag {32} +$$ + +Since $Y_{t} = tY_{1} + (1 - t)Y_{0}$ , we use Tweedie's formula (Efron, 2011) to compute + +$$ +\mathbb {E} \left[ Y _ {0} \mid Y _ {t} = \mathbf {y} _ {t} \right] = \frac {1}{1 - t} \mathbf {y} _ {t} + \frac {t ^ {2}}{1 - t} \nabla \log p _ {t} (\mathbf {y} _ {t}). \tag {33} +$$ + +Using the above relation, we obtain the following: + +$$ +\begin{array}{l} \mathbb {E} \left[ Y _ {1} \mid Y _ {t} = \mathbf {y} _ {t} \right] = \frac {1}{t} \mathbb {E} \left[ Y _ {t} - (1 - t) Y _ {0} \mid Y _ {t} = \mathbf {y} _ {t} \right] \\ = \frac {1}{t} \left(\mathbf {y} _ {t} - (1 - t) \mathbb {E} \left[ Y _ {0} \mid Y _ {t} = \mathbf {y} _ {t} \right]\right) \\ = \frac {1}{t} \left(\mathbf {y} _ {t} - (1 - t) \left(\frac {1}{1 - t} \mathbf {y} _ {t} + \frac {t ^ {2}}{1 - t} \nabla \log p _ {t} (\mathbf {y} _ {t})\right)\right) \\ = - t \nabla \log p _ {t} (\mathbf {y} _ {t}). \tag {34} \\ \end{array} +$$ + +Combining (33) and (34) using linearity of expectation, we get + +$$ +\begin{array}{l} u _ {t} \left(\mathbf {y} _ {t}\right) = \mathbb {E} \left[ Y _ {1} \mid Y _ {t} = \mathbf {y} _ {t} \right] - \mathbb {E} \left[ Y _ {0} \mid Y _ {t} = \mathbf {y} _ {t} \right] (35) \\ = - t \nabla \log p _ {t} (\mathbf {y} _ {t}) - \frac {1}{1 - t} \mathbf {y} _ {t} - \frac {t ^ {2}}{1 - t} \nabla \log p _ {t} (\mathbf {y} _ {t}) (36) \\ = - \frac {1}{1 - t} \mathbf {y} _ {t} - \frac {t}{1 - t} \nabla \log p _ {t} (\mathbf {y} _ {t}), (37) \\ \end{array} +$$ + +The density evolution of $Y_{t}$ now immediately follows from the continuity equation (Øksendal, 2003) applied to (19). + +# C.5 PROOF OF LEMMA A.2 + +Proof. The Fokker-Planck equation of the SDE (12) is given by + +$$ +\frac {\partial p _ {t} \left(Y _ {t}\right)}{\partial t} + \nabla \cdot \left[ - \frac {1}{1 - t} Y _ {t} p _ {t} \left(Y _ {t}\right) \right] = \nabla \cdot \left[ \frac {t}{1 - t} \nabla p _ {t} \left(Y _ {t}\right) \right]. \tag {38} +$$ + +Rearranging (38) by multiplying and dividing $p_t(Y_t)$ in the right hand side, we get + +$$ +\frac {\partial p _ {t} \left(Y _ {t}\right)}{\partial t} = \nabla \cdot \left[ \left(\frac {1}{1 - t} Y _ {t} + \frac {t}{1 - t} \nabla \log p _ {t} \left(Y _ {t}\right)\right) p _ {t} \left(Y _ {t}\right) \right]. \tag {39} +$$ + +To conclude, observe that the density evolution above is identical to (20). + +![](images/e8e7177067b176a98bfd54b5c7ff21f22902e08c9e54d9aace6437f546024817.jpg) + +# C.6 PROOF OF PROPOSITION A.3 + +Proof. The optimal vector field of the rectified flow ODE (6) is given by Lemma A.1. The proof then immediately follows from the Fokker-Planck equations in Lemma A.1 and Lemma A.2. + +From Lemma A.2, the density evolution of the SDE (12) is given by + +$$ +\frac {\partial p _ {t} (Y _ {t})}{\partial t} = \nabla \cdot \left[ \left(\frac {1}{1 - t} Y _ {t} + \frac {t}{1 - t} \nabla \log p _ {t} (Y _ {t})\right) p _ {t} (Y _ {t}) \right]. +$$ + +The stationary (or steady state) distribution satisfies the following: + +$$ +\frac {\partial p _ {t} (Y _ {t})}{\partial t} = 0 = \nabla \cdot \left[ \left(\frac {1}{1 - t} Y _ {t} + \frac {t}{1 - t} \nabla \log p _ {t} (Y _ {t})\right) p _ {t} (Y _ {t}) \right]. +$$ + +Using the boundary conditions (Øksendal, 2003), we get + +$$ +\frac {1}{1 - t} Y _ {t} + \frac {t}{1 - t} \nabla \log p _ {t} (Y _ {t}) = 0, +$$ + +which immediately implies $p_t(Y_t) \propto e^{-\frac{\|Y_t\|^2}{2t}}$ . + +![](images/470a520ea02cbaee004d4521d4d6ebdb7fc622923cf87e1d80ee933b147575e2.jpg) + +# C.7 PROOF OF THEOREM 3.5 + +Proof. Using Fokker-Planck equation (Øksendal, 2003), Lemma A.4 implies + +$$ +\frac {\partial q _ {t} (X _ {t})}{\partial t} = \nabla \cdot \left[ - q _ {t} (X _ {t}) \left(\frac {1}{t} X _ {t} + \frac {1 - t}{t} \nabla \log q _ {t} (X _ {t})\right) \right]. +$$ + +Therefore, the optimal vector field $v_{t}(X_{t})$ of the controlled ODE (15) is given by + +$$ +v _ {t} \left(X _ {t}\right) = \frac {1}{t} X _ {t} + \frac {1 - t}{t} \nabla \log p _ {1 - t} \left(X _ {t}\right). \tag {40} +$$ + +The LQR problem (16) is identical to the LQR problem (7) with changes in the initial and terminal states. Similar to Proposition 3.2, we compute the closed-form solution for the conditional vector field of the ODE (15) as: + +$$ +v _ {t} \left(X _ {t} \mid X _ {1}\right) = \frac {X _ {1} - X _ {t}}{1 - t}. \tag {41} +$$ + +Combining (40) and (41), we have + +$$ +\begin{array}{l} \mathrm {d} X _ {t} = \left[ v _ {t} \left(X _ {t}\right) + \eta \left(v _ {t} \left(X _ {t} \mid X _ {1}\right) - v _ {t} \left(X _ {t}\right)\right) \right] \mathrm {d} t \\ = \left[ (1 - \eta) \left(\frac {1}{t} X _ {t} + \frac {1 - t}{t} \nabla \log p _ {1 - t} (X _ {t})\right) + \eta \left(\frac {X _ {1} - X _ {t}}{1 - t}\right) \right] d t \\ = \left[ \frac {(1 - \eta) (1 - t) - \eta t}{t (1 - t)} X _ {t} + \frac {\eta}{1 - t} X _ {1} + \frac {(1 - \eta) (1 - t)}{t} \nabla \log p _ {1 - t} (X _ {t}) \right] d t \\ = \left[ \frac {1 - t - \eta}{t (1 - t)} X _ {t} + \frac {\eta}{1 - t} X _ {1} + \frac {(1 - \eta) (1 - t)}{t} \nabla \log p _ {1 - t} (X _ {t}) \right] \mathrm {d} t. \\ \end{array} +$$ + +The resulting continuity equation (Øksendal, 2003) becomes: + +$$ +\begin{array}{l} \frac {\partial q _ {t , \eta} (X _ {t})}{\partial t} = \nabla \cdot \left[ - \left(\frac {1 - t - \eta}{t (1 - t)} X _ {t} + \frac {\eta}{1 - t} X _ {1} + \frac {(1 - \eta) (1 - t)}{t} \nabla \log p _ {1 - t} (X _ {t})\right) q _ {t, \eta} (X _ {t}) \right] \\ = \nabla \cdot \left[ - \left(\frac {1 - t - \eta}{t (1 - t)} X _ {t} + \frac {\eta}{1 - t} X _ {1} + \frac {(1 - \eta) (1 - t)}{t} (\nabla \log p _ {1 - t} (X _ {t}) + \nabla \log q _ {t, \eta} (X _ {t}))\right) q _ {t, \eta} (X _ {t}) \right. \\ \left. + \left(\frac {(1 - \eta) (1 - t)}{t} \nabla \log q _ {t, \eta} (X _ {t})\right) q _ {t, \eta} (X _ {t}) \right]. \\ \end{array} +$$ + +Using time-reversal property from Proposition 3.2, the above expression simplifies to + +$$ +\begin{array}{l} \frac {\partial q _ {t , \eta} (X _ {t})}{\partial t} + \nabla \cdot \left[ \left(\frac {1 - t - \eta}{t (1 - t)} X _ {t} + \frac {\eta}{1 - t} X _ {1} + \frac {(1 - \eta) (1 - t)}{t} (\nabla \log p _ {1 - t} (X _ {t}) + \nabla \log p _ {1 - t, \eta} (X _ {t}))\right) q _ {t, \eta} (X _ {t}) \right] \\ = \nabla \cdot \left[ \frac {(1 - \eta) (1 - t)}{t} \nabla q _ {t, \eta} (X _ {t}) \right], \\ \end{array} +$$ + +which yields the following SDE: + +$$ +\begin{array}{l} \mathrm {d} X _ {t} = \left[ \frac {1 - t - \eta}{t (1 - t)} X _ {t} + \frac {\eta}{1 - t} X _ {1} + \frac {(1 - \eta) (1 - t)}{t} \left(\nabla \log p _ {1 - t} (X _ {t}) + \nabla \log p _ {1 - t, \eta} (X _ {t})\right) \right] \mathrm {d} t \\ + \sqrt {\frac {2 (1 - \eta) (1 - t)}{t}} \mathrm {d} W _ {t}, \\ \end{array} +$$ + +and thus, completes the proof. + +![](images/4b32e53745546a2fb01a15bd193575054d1131c6dcaa7009e0e14803e132aaef.jpg) + +# C.8 PROOF OF LEMMA A.4 + +Proof. It suffices to show that the Fokker-Planck equations of the SDE (22) and (12) are the same after time-reversal. Let $q_{t}(\cdot)$ denote the marginal pdf of $X_{t}$ such that $q_{0}(\cdot) = p_{1}(\cdot)$ . The Fokker-Planck equations of the SDE (22) become + +$$ +\frac {\partial q _ {t} (X _ {t})}{\partial t} + \nabla \cdot \left[ q _ {t} (X _ {t}) \left(\frac {1}{t} X _ {t} + \frac {2 (1 - t)}{t} \nabla \log p _ {1 - t} (X _ {t})\right) \right] = \nabla \cdot \left[ \left(\frac {1 - t}{t}\right) \nabla q _ {t} (X _ {t}) \right], +$$ + +which can be rearranged to give + +$$ +\begin{array}{l} \frac {\partial q _ {t} (X _ {t})}{\partial t} = \nabla \cdot \left[ - q _ {t} (X _ {t}) \left(\frac {1}{t} X _ {t} + \frac {2 (1 - t)}{t} \nabla \log p _ {1 - t} (X _ {t})\right) + \left(\frac {1 - t}{t}\right) \nabla q _ {t} (X _ {t}) \right] \\ = \nabla \cdot \left[ - q _ {t} \left(X _ {t}\right) \left(\frac {1}{t} X _ {t} + \frac {2 (1 - t)}{t} \nabla \log p _ {1 - t} \left(X _ {t}\right) - \frac {1 - t}{t} \nabla \log q _ {t} \left(X _ {t}\right)\right) \right] \\ \end{array} +$$ + +Since $Y_{t}$ is the time-reversal process of $X_{t}$ as discussed in Proposition (3.1), + +$$ +\frac {\partial q _ {t} (X _ {t})}{\partial t} = \nabla \cdot \left[ - q _ {t} (X _ {t}) \left(\frac {1}{t} X _ {t} + \frac {1 - t}{t} \nabla \log q _ {t} (X _ {t})\right) \right]. +$$ + +Substituting $t\to 1 - t$ + +$$ +\frac {\partial q _ {1 - t} (X _ {1 - t})}{\partial t} = \nabla \cdot \left[ q _ {1 - t} (X _ {1 - t}) \left(\frac {1}{1 - t} X _ {1 - t} + \frac {t}{1 - t} \nabla \log q _ {1 - t} (X _ {1 - t})\right) \right], +$$ + +which implies the density evolution of (12): + +$$ +\frac {\partial p _ {t} (Y _ {t})}{\partial t} = \nabla \cdot \left[ p _ {t} (Y _ {t}) \left(\frac {1}{1 - t} Y _ {t} + \frac {t}{1 - t} \nabla \log p _ {t} (Y _ {t})\right) \right]. +$$ + +This completes the proof of the statement. + +![](images/e43f99e853aa31f902cde415554656aa26364cd58ba75ed3f9ba7ee45c56236d.jpg) + +# D ADDITIONAL EXPERIMENTS + +This section substantiates our contributions further by providing additional experimental details. + +Baselines. We use the official NTI codebase2 for the implementations of NTI (Mokady et al., 2023), P2P (Hertz et al., 2022), and DDIM (Song et al., 2021a) inversion. We use the official Diffusers implementation3 for SDEdit and Flux4. We modify the pipelines for SDEdit and DDIM inversion to adapt to the Flux backbone. In Figure 6, for SDEdit, we use the optimally tuned strength parameter 0.7 (Meng et al., 2022), and for DDIM inversion, we use a midway starting point which is the same as ours ( $s = 1 - 6/28 = 0.78$ for glasses and $s = 1 - 3/28 = 0.89$ for stroke2image). + +For completeness, we include qualitative comparison with a leading training-based approach InstructPix2Pix (Brooks et al., 2023) and a higher-order differential equation based LEDIT++ (Brack et al., 2024). Table 3 summarizes the requirements of the compared baselines. + +Table 3: Requirements of compared baselines. Our method outperforms prior works while requiring no additional training, optimization of prompt embedding, or attention manipulation scheme. + +
MethodTrainingOptimizationAttention Manipulation
SDEdit (Meng et al., 2022)XXX
DDIM (Song et al., 2021a)XXX
NTI (Mokady et al., 2023)X✓X
NTI+P2P (Hertz et al., 2022)X✓✓
LEBIT++ (Brack et al., 2024)XX✓
InstructPix2Pix (Brooks et al., 2023)✓XX
OursXXX
+ +Metrics. Following SDEdit (Meng et al., 2022), we measure faithfulness using L2 loss between the stroke input and the output image, and assess realism using Kernel Inception Distance (KID) between real and generated images. Stroke inputs are generated from RGB images using the algorithm provided in SDEdit. Given the subjective nature of image editing, we conduct a large-scale user study to calculate the user preference metric. + +For face editing, we evaluate identity preservation, prompt alignment, and overall image quality using a face recognition metric (Ruiz et al., 2024), CLIP-T scores (Radford et al., 2021), and using CLIP-I scores (Radford et al., 2021), respectively. For the face recognition score, we calculate the L2 distance between the face embedding of the original image and the edited image, obtained from Inception ResNet trained on CASIA-Webface dataset. Similar to SDEdit (Meng et al., 2022), we conduct extensive experiments on Stroke2Image generation, and showcase additional capabilities qualitatively on a wide variety of semantic image editing tasks. + +Algorithm. As shown in Figure 8, given a reference style or reference content denoted by $\mathbf{y}_0$ , we first use Algorithm 1 to obtain a structured noise $Y_{1}$ as discussed in §4. Then, we use Algorithm 2 to transform the structured noise $Y_{1}$ back into an image based on a new text prompt. + +# D.1 HYPER-PARAMETER CONFIGURATIONS + +In Table 4, we provide the hyper-parameters for the empirical results reported in §5. We use a fix $\gamma = 0.5$ in our controlled forward ODE (8) and a time-varying guidance parameter $\eta_t$ in our controlled reverse ODE (15), as motivated in Remark 3.3 and Remark 3.6. Thus, our algorithm introduces one additional hyper-parameter $\eta_t$ into the Flux pipeline. For each experiment, we use a fixed time-varying schedule of $\eta_t$ described by starting time $(s)$ , stopping time $\tau$ , and strength $(\eta)$ . + +2https://github.com/google/prompt-to-prompt +3https://github.com/huggingface/diffusers +4https://github.com/black-forest-labs/flux +5https://huggingface.co/spaces/timbrooks/instruct-pix2pix + + +Algorithm 1: Controlled Forward ODE (8) +Input: Discretization steps $N$ , reference image $\mathbf{y}_0$ , prompt embedding network $\Phi$ , Flux model $u(\cdot, \cdot, \cdot; \varphi)$ , Flux noise scheduler $\sigma : [0,1] \to \mathbb{R}$ +Tunable parameter: Controller guidance $\gamma$ +Output: Structured noise $Y_1$ +1 Initialize $Y_0 = \mathbf{y}_0$ +2 Fix a noise sample $\mathbf{y}_1$ +3 for $i = 0$ to $N - 1$ do +4 Current time step: $t_i = \frac{i}{N}$ +5 Next time step: $t_{i + 1} = \frac{i + 1}{N}$ +6 Unconditional vector field: $u_{t_i}(Y_{t_i}) = u(Y_{t_i}, t_i, \Phi(""); \varphi)$ ▷ Proposition 3.1 +7 Conditional vector field: $u_{t_i}(Y_{t_i} | \mathbf{y}_1) = \frac{\mathbf{y}_1 - Y_{t_i}}{1 - t_i}$ ▷ Proposition 3.2 +8 Controlled vector field: $\hat{u}_{t_i}(Y_{t_i}) = u_{t_i}(Y_{t_i}) + \gamma (u_{t_i}(Y_{t_i} | \mathbf{y}_1) - u_{t_i}(Y_{t_i}))$ ▷ODE (8) +9 Next state: $Y_{t_{i + 1}} = Y_{t_i} + \hat{u}_{t_i}(Y_{t_i}) (\sigma(t_{i + 1}) - \sigma(t_i))$ +10 end +11 return $Y_1$ + +Algorithm 2: Controlled Reverse ODE (15) +Input: Discretization steps $N$ , reference text "prompt", reference image $\mathbf{y}_0$ , prompt embedding network $\Phi$ , Flux model $u(\cdot, \cdot, \cdot; \varphi)$ , Flux noise scheduler $\sigma : [0,1] \to \mathbb{R}$ , structured noise $\mathbf{y}_1$ +Tunable parameter: Controller guidance $\eta$ +Output: Edited image $X_1$ +1 Initialize $X_0 = \mathbf{y}_1$ +2 for $i = 0$ to $N - 1$ do +3 Current time step: $t_i = \frac{i}{N}$ +4 Next time step: $t_{i + 1} = \frac{i + 1}{N}$ +5 Unconditional vector field: $v_{t_i}(X_{t_i}) = -u(X_{t_i}, 1 - t_i, \Phi(\text{prompt}); \varphi) \triangleright$ Proposition 3.1 +6 Conditional vector field: $v_{t_i}(X_{t_i} | \mathbf{y}_0) = \frac{\mathbf{y}_0 - X_{t_i}}{1 - t_i}$ +7 Controlled vector field: $\hat{v}_{t_i}(X_{t_i}) = v_{t_i}(X_{t_i}) + \eta (v_{t_i}(X_{t_i} | \mathbf{y}_0) - v_{t_i}(X_{t_i})) \triangleright$ ODE (15) +8 Next state: $X_{t_{i + 1}} = X_{t_i} + \hat{v}_{t_i}(X_{t_i}) (\sigma(t_{i + 1}) - \sigma(t_i))$ +9 end +10 return $X_1$ + +We use the default config for Flux model: 3.5 for classifier-free guidance and 28 for the total number of inference steps. + +Table 4: Hyper-parameter configuration of our method for inversion and editing tasks. + +
TaskStarting Time (s)Controller Guidance (ηt)
Stopping Time (τ)Strength (η)
Stroke2Image350.9
Object insert061.0
Gender editing081.0
Age editing051.0
Adding glasses6250.7
Stylization060.9
Inversion only8251
+ +![](images/b3d12c8b3a39f6b60954e926efae71d25bcacf9e958736b64b5b55d3d92ada46.jpg) +(a) Ref. style + +![](images/77a9ae7ff2f1800a2d72709800ee6feba9730eb00921824869ef81a6e8f8a5ef.jpg) + +![](images/6c3228aeb862d52c93c26db00ccd639a24cfc7f435964a82da10b8073c92b15c.jpg) + +![](images/cdabb5872b9ab432e7d045d8325c0b3bd6c470f2df53819e4256440c4d6cf9b0.jpg) + +![](images/76ae0558083d4695e76339c0748ed369ecc130aa26fe2b77706ec38bc2201307.jpg) + +![](images/9bea719a003ab90ef77288b4e5dc4244869a8cfa00883b035d43c19182de4c0d.jpg) + +![](images/b454616b9aa5071615c0473000c9a264d525cae9abefe704afe04f00fb0dfe6c.jpg) +(c) Ref. content + +![](images/a99fe1473ef515b5a5d1ce146b73e3f40cf5ef5822da4ea1e6ad5e936db23989.jpg) + +![](images/f0ff35ec191f0a8da2cc4384559a87a7cefca895d9b5703653bfe128ca3f794c.jpg) + +![](images/abb27c5b8fdd970f547955a4cc368778a2769926d6a7e9a3335643d7e5343c37.jpg) + +![](images/ae33f90e9d7a4d54ab7fcc8c2ce2edcb17e4d2e88f5ee87dc5bd6ea924113ec5.jpg) + +![](images/c0200bfaa4ea19b68b6882e484225fc1883bf32463b01b12ae682e6cf6e53853.jpg) +(d) Ref. content +smiling cartoon +Figure 8: Rectified flows for image inversion and editing. Our approach efficiently inverts reference style images in (a) and (b) without requiring text descriptions of the images and applies desired edits based on new prompts (e.g. "a girl" or "a dwarf"). For a reference content image (e.g. a cat in (c) or a face in (d)), it performs semantic image editing (e.g. "sleeping cat") and stylization (e.g. "a photo of a cat in origmai style"), without leaking unwanted content from the reference image. Input images have orange borders. + +![](images/28c7eb48f5c2bf0975e88976d8b49f116f02cded1dc7580feaacccbbbe554838.jpg) +"angry cartoon" + +![](images/34927c3f828cfdb161231a2c7793ee55bba4ac95e728d78c3c227d2ec8c13721.jpg) +"girl" + +![](images/774e68d00d3777df43e1ed694906246a5d238c6a9c17f713ce120c13f668f117.jpg) +"old man" +"young boy+ glasses" + +![](images/fa5fb7da6e225ef4001e34274aab33b8c71609ed43f8d0ecdac7e4902fdb1523.jpg) + +# D.2 ABLATION STUDY + +In this section, we conduct ablation study for our controller guidance parameter $\eta_t$ . We consider two different time-varying schedules for $\eta_t$ , and show that our controller strength allows for a smooth interpolation between unconditional and conditional generation. + +In Figure 9, we show the effect of starting time in controlling the faithfulness of inversion; starting time $s \in [0,1]$ is defined as the time at which our controlled reverse ODE (15) is initialized. The initial state $X_{s} = \mathbf{y}_{1 - s}$ is obtained by integrating the controlled forward ODE (8) from $0 \to 1 - s$ . + +![](images/d4e92c62626c277b1944a0751d70aa45d31da2490487902edb2370544efbc4f4.jpg) +0 + +![](images/3e75cb1a9319ca73dcf49a4f5514c3cf968638b061b0e95ba452a1a2e2ba69b9.jpg) +2 + +![](images/20b0b26a5c170aa10e1e140943fa4de97348a36cf35c33196f2e0768d83e7fb4.jpg) + +![](images/9a89380ceec468f4413553ff2ba6049a1e606548afc5a39e59cbd273e130cb5f.jpg) + +![](images/c68826630f12ab9de257bba56fa5a4b2d82c828e03cfe89476ee883eba1bcc67.jpg) + +![](images/180082ceb48f3a0c7a6f758578fb8bfb0224f4190533d2b81b6e08121833329e.jpg) + +![](images/2fb1b45f8c8ebc9122605867e03dbc48211da02a1896cdf67c2140851fa29076.jpg) +12 +Figure 9: Effect of starting time. Prompt: "A young man". The number below each figure denotes the starting time scaled by 28 (the total number of denoising steps) for better interpretation. In the absence of controller guidance $(\eta_{t} = 0)$ , increasing the starting time $(s)$ in our controlled ODE (15) improves faithfulness to the original image. + +![](images/8ed49651c13cce4a074613171202ba4bfb1dac2ac1bd49313cd059de0da694f7.jpg) +15 + +![](images/5e70b9aa41c632ab3f45d64f8e0a09b871452ac3e39750785e4a450b64a339e2.jpg) +4 +20 + +![](images/70788a98a3e49d5891349be50d7ab37400582bdca1485ecfa198852018f0f198.jpg) +6 +25 + +![](images/04a0dd71583069878c3929ef1bc4e1b33b3fb7cf7c9ee03e2e4db94e1de14a81.jpg) +8 +27 + +![](images/87eeec03678c1a6c3a7b76e895a44eddd3894734b7641c0e789c7291877c4189.jpg) +10 +Original + +In Figure 10, we study the effect of stopping time. We find that increasing controller guidance $\eta_{t}$ by increasing the stopping time $\tau$ guides the reverse flow towards the original image. However, we observe a phase transition around $\tau = 0.14 = 4 / 28$ , indicating that the resulting drift in our controlled reverse ODE (15) is dominated by the conditional vector field $v_{t}(X_{t}|\mathbf{y}_{0})$ for $t\geq \tau$ . Therefore, the reverse flow solves the LQR problem (16) and drives toward the terminal state (i.e., the original image). + +![](images/7865fc9a6fcb4f0005495e6385555c476f566d1b7209926e17fec2bae7b7d168.jpg) +0 + +![](images/ef3160af0d9010b6ff22da99ad60ba1afee028cf6d190080c24c71682065deb5.jpg) +2 + +![](images/2f47c19364009e9d15e337071443b4414508c2226399d00eb9a3208e90343102.jpg) +4 + +![](images/3cb8be12a18cda6c5a891adf3dffbd9ad7c157ed869e1763174e9d32ed1c70ed.jpg) +6 + +![](images/165aae7b1596e7cf7a54f4800e145137fbc17ce6bc3b267839103d8df0a62f50.jpg) +8 + +![](images/5729815796f9a9d7f612df659bf6b88e5c4fbfa7998733441894273f1207691b.jpg) +10 + +![](images/d5af92efdbdea1c3d6403a457a96edd0c660c9fe9fc8dd53231ddb760a87cd03.jpg) +12 + +![](images/4fe24a6efa00a0cafde19ac3dedf40e3a23bb05091806194f65a476835d4fc0e.jpg) +15 + +![](images/6f580097521916272f956636768528021bdd07916b5297fce524f3342814db11.jpg) +20 + +![](images/ad50fdcab5997dd8f45e0ed88df036ec7f171db9ee797d9af2bb00082105c043.jpg) +25 +Figure 10: Effect of controller guidance. Prompt: "A young man". For a fixed starting time $s = 0$ , consider a time-varying controller guidance schedule $\eta_t = \eta \forall t \leq \tau$ and 0 otherwise. The number below each figure denotes the stopping time $\tau$ scaled by 28 (the total number of denoising steps) for better interpretation. Increasing $\tau$ increases the controller guidance $(\eta_t)$ that improves faithfulness to the original image. + +![](images/5006cca6cc31db75096dd75ebb9da055a3b6bef2289f3fee386575b8a7e37617.jpg) +27 + +![](images/60e9ad3b908b48b1dd30e1789b1fba264f9daa3e3b0f137f50b0dff10b76a689.jpg) +Original + +![](images/2672d7227a7b9364fc85551470b24d1d40e1caef98c3c84636fe999ae2e7037a.jpg) +In Figure 11, we visualize the effect of our controller guidance for another time-varying schedule. We make a similar observation as in Figure 10: increasing $\eta_{t}$ improves faithfulness. However, we notice a smooth transition from the unconditional to the conditional vector field, evidence from the smooth interpolation between "A young man" at the top left ( $\eta = 0$ ) and the original image at the bottom right. + +![](images/e06d5e858ecda9752acc8d8f51bad36696f5b80441c1bea3f809ad70e8f80e77.jpg) + +![](images/623e4630c310634326b47c742cef7a9ff556ebb9da5439bbe3aa20b289206db6.jpg) + +![](images/cef1ceb46682aa2b64246d020bf274c0b04ff17dc4f25ad804912ee06c50ada7.jpg) + +![](images/253f985ebc5b05ba974401a6f0d84c5d5fe0b0540c3c284d4acc9e4a6f1ee1ab.jpg) + +![](images/014601bb22433a990bbd1d7027b882514dca7805eefac2b760968baeb500c8d9.jpg) + +![](images/727147edf587683d6e30cb16bf5fbbccc311b4a29441b62d6ae30388663fa91e.jpg) +0 +0.6 +Figure 11: Effect of controller guidance for another time-varying schedule. Prompt: "A young man". For a fixed starting time $s = 0$ and stopping time $\tau = 8/28$ , consider a time-varying controller guidance schedule $\eta_t = \eta \forall t \leq \tau$ and 0 otherwise. Increasing $\eta$ increases the controller guidance $(\eta_t)$ that improves faithfulness to the original image. + +![](images/15505216e51c6c9a8c85c36ca753c5e22a9f9e86881777047d5d610df51d87ce.jpg) +0.1 +0.7 + +![](images/8aae1f95564da6dcd24dc1d03cdd7f13f022faab9ee509ccfb9dcd7f4f764320.jpg) +0.2 +0.8 + +![](images/098c191c2d8588183da2c2fbca7e785ac42a88e67cd72b18af4f4edd4968db00.jpg) +0.3 +0.9 + +![](images/f248f6e26cb486e4e4795b4b63256df6dea7df78f48d5d8300fb3295d67178f0.jpg) +0.4 +1.0 + +![](images/f23558b35cddd12b5de7fef05cf77fec2c7ee74f4e036d21d63dcb42f863b8e6.jpg) +0.5 +Original + +# D.3 NUMERICAL SIMULATION + +In this section, we design synthetic experiments to compare reconstruction accuracy of DM and RF inversion. Given $Y_0 \sim p_0$ , where the data distribution $p_0 \coloneqq \mathcal{N}(\mu, I)$ and the source distribution + +$q_{0} \coloneqq \mathcal{N}(0, I)$ , we numerically simulate the ODEs and SDEs associated with DM and RF inversion; see our discussion in §3. + +For $\mu = 10$ , we fix $\gamma = 0.5$ in the controlled forward ODE (8), and $\eta = 0.5$ in the controlled reverse ODE (15). These ODEs are simulated using the Euler discretization scheme with 100 steps. Additionally, we simulate the uncontrolled rectified flow ODEs $(6) \rightarrow (1)$ as a special case of our controlled ODEs $(8) \rightarrow (15)$ by setting $\gamma = \eta = 0$ , and the deterministic diffusion model DDIM (Song et al., 2021a) in the same experimental setup. + +The inversion accuracy is reported in Table 5. Observe that RF inversion has less L2 and L1 error compared to DDIM inversion (14). The minimum error is obtained by setting $\gamma = \eta = 0$ (i.e., reversing the standard rectified flows), which supports our discussion in §3.3. + +Furthermore, we simulate the stochastic samplers corresponding to these ODEs in Table 5, highlighted in orange. Similar to the deterministic samplers, we observe that stochastic equivalents of rectified flows more accurately recover the original sample compared to diffusion models. Our controller in RF Inversion $(10) \rightarrow (17)$ effectively reduces the reconstruction error in the uncontrolled RF Inversion $(12) \rightarrow (22)$ , which are special cases when $\gamma = \eta = 0$ . Thus, we demonstrate that (controlled) rectified stochastic processes are better at inverting a given sample from the target distribution, outperforming the typical OU process used in diffusion models (Song & Ermon, 2019; Ho et al., 2020; Song et al., 2021a;b). + +Table 5: DM and RF inversion accuracy. Stochastic samplers are highlighted in orange. + +
MethodL2 ErrorL1 Error
DDIM Inversion (14)6.02419.038
DDPM Inversion (13)6.00715.758
RF Inversion (γ = η = 0) (8) → (15)0.0920.20
RF Inversion (γ = η = 0) (10) → (17)3.5648.795
RF Inversion (γ = 0.5, η = 0) (8) → (15)4.77711.628
RF Inversion (γ = 0, η = 0.5) (8) → (15)1.2193.074
RF Inversion (γ = 0.5, η = 0.5) (8) → (15)0.6281.643
RF Inversion (γ = η = 0.5) (10) → (17)0.2690.694
RF Inversion (γ = η = 1.0) (10) → (17)0.0030.010
+ +In Figure 12, we compare sample paths of diffusion models and recitified flows using 10 IID samples drawn from $p_0$ . In Figure 13, we visualize paths for those samples using our controlled ODEs and SDEs with $\gamma = \eta = 0.5$ . + +![](images/c7103fc2a752c9c528fe3302c473b8df9b6ca0fdc6622909349b754141f3701f.jpg) + +![](images/bfecefaf74544b947098fb8838b5caa42ccc92f2c1e2e0029f96240f4d1775bf.jpg) + +![](images/6190131b131ea4e7c70c4460fa87c5cc08e83c38f6c710ff01124b33ff59015f.jpg) + +![](images/42fccbab3376af157fa5d064680b9d1ec66aec4272cdb0893bd4fa4030d763ff.jpg) + +![](images/07b4fdff1f38da9895d243e2978d9738378906c1d02c09bf2356e40e48c7d45f.jpg) +(a) DDPM (13) Fwd. +(e) DDPM (13) Rev. +Figure 12: Sample paths of DMs and RFs. Top row corresponds to the forward process $\{Y_t\}$ , and bottom row, reverse process $\{X_t\}$ . In each plot, time is along the horizontal axis and the process, along the vertical axis. The sample paths of RFs are straighter than that of DMs, allowing coarse discretization and faithful reconstruction. + +![](images/a38334d8d36527fd212621965486ef4e6df928ac609b012d6192923dbd2c7f90.jpg) +(b) DDIM (14) Fwd. +(f) DDIM (14) Rev. + +![](images/79b5ddcde383bc06e2444fd48335c57f42e5e6416af2987b3fd3fbfe49cd2976.jpg) +(c) SDE (12) Fwd. +(g) SDE (12) Rev. + +![](images/46a594180859892106e73e91ab0432e990846fe185bf6dadfd0bb21af7b0c86e.jpg) +(d) RF (6) Fwd. +(h) RF (6) Rev. + +![](images/f74571938c9dc77c8b5c7e3cb085f87bc29894206c62579888071b553293345d.jpg) +(a) ODE (8) Fwd. + +![](images/3e66fae6e334af0170023b4b1866df27deb44936e8d6ae2b5cb1123e8c34a0e9.jpg) +(b) ODE (15) Rev. +Figure 13: Sample paths of our controlled ODEs and SDEs. (a,c) The optimal controller $u_{t}(Y_{t}|Y_{1})$ steers $Y_{t}$ towards the terminal state $Y_{1} \sim p_{1}$ during inversion. (b,d) Similarly, $v_{t}(X_{t}|Y_{0})$ guides $X_{t}$ towards the reference image $Y_{0} \sim p_{0}$ , significantly reducing the reconstruction error. + +![](images/636578f55afb0611d5b9e675fc7155c091b1cb1746bc27f273422e5e319f60ff.jpg) +(c) SDE (10) Fwd. + +![](images/334c1b8603cf58820aaf175f8570f3652c84f2d75bbd5e7007134f20eae3497f.jpg) +(d) SDE (17) Rev. + +# D.4 ADDITIONAL RESULTS ON STROKE2IMAGE GENERATION + +In Figure 14 and Figure 15, we show additional qualitative results on Stroke2Image generation. Our method generates more realistic images compared to leading training-free approaches in semantic image editing including optimization-based NTI (Mokady et al., 2023) and attention-based NTI+P2P (Hertz et al., 2022). Furthermore, it gives a competitive advantage over the training-based approach InstructPix2Pix (Brooks et al., 2023). + +![](images/1907e46af75bdc5bbc630ce7f2edf8aca7fe4d3011940f023e76f3142e142f8f.jpg) + +![](images/a44a32297d4f2ef5f305c694372fdd40c2d73b50b91de8653e35195894357503.jpg) + +![](images/76c327ac8590fc848d260fcb125628644a6b5e6391879be96584d6783c60d2e5.jpg) + +![](images/534ed0a3ea8f111dac9eb8362a0d118dfa00f5f24f82c8197155cb1f3c4f7b9a.jpg) +Input +Figure 14: Stroke2Image generation. Additional qualitative results on LSUN-Bedroom dataset comparing our method with SoTA training-free and training-based editing approaches. + +![](images/a11d6421901e003551561916e4982dbfee9b5452994abdf0bbc6879996e7c1fe.jpg) + +![](images/e39b073119a707184cdc78ff14b915b25e4bf9e1679c938f13a35897c27606bb.jpg) + +![](images/360dc5ce52a93285fec38edc8f63ab4ef8cf7b1b7687eaf79c0e8caa9a049f1f.jpg) + +![](images/afe012658f9af3a22f2a1ba18e1be57d98072299db1b01deb05edea22c0845ff.jpg) +SDEdit + +![](images/cf056339b1a7489035703a8f80fbc854f0d0b2081ba70ec78f13b6bfb9622cf5.jpg) + +![](images/bbdf07ced822b2135f72560b41abd1df39a3a24b49e118152c3e95813d704640.jpg) + +![](images/26b94cdd2ae7594af8c98d893dd161b9673ed29f4d94e2e7a306297683d10935.jpg) + +![](images/4d6fe61a0d1f80895cdb9975d96660cffc5c46f9cf7e5cb77f371d2d15bfb158.jpg) +DDIM Inversion + +![](images/8c55ba413402839b40cdd1cff81b2170d398c3bd7aa9afeac3b8dcdfcde702d9.jpg) + +![](images/1dd7ad4fb200a88214eb3a338e406df59d0b00fbadb6e6a816d3fa90705c30cd.jpg) + +![](images/a70d67d239a908e575ab1dd7b48b05b45c6a940db811f3047ccebe2e80254e12.jpg) + +![](images/44de33898417d25cdcbaa9a2448d859f12f1197a79c12bd0e25701c9e082bbb7.jpg) +NTI + +![](images/dd99d3fbf64f09e2e5538eee85696feeb3a5582f1b1b33f535344f1e93447521.jpg) + +![](images/fd4cc43770e190b923b901b6416ad385771121f2145cb0635f39b3b35d6e20e2.jpg) + +![](images/41cb6ba961e110a5a03af5c7998fa2ee09169a6581d8965b45b30b0dcde5cd53.jpg) + +![](images/3de5c2f331613324f221b196e241e1d3d052862f65904f4e76f12f7a67e50e4a.jpg) +NT1+P2P + +![](images/d01ecddcef956cc11a61a7fc03b52800e615477f2049df560567db41fb295e0f.jpg) + +![](images/c0381bb69e79770828b6eccc3668e9c1476dc97a2dea3f28830c6f459296cb2a.jpg) + +![](images/3f09ab99fb4f4fbaf09b4444eb3b01321c7cfe0bff44f713d1772a3b9db83ede.jpg) + +![](images/ee9d8279123d33550f45b08dca800bf88f93bb4d6b021dff9684f524f3f2024f.jpg) +LEDIT++ + +![](images/8818b5f06c72845b5ec18e6816e54fab8e1e45d2ed3bd9423bf6db8ba0067bc8.jpg) + +![](images/5035a4b4851eec0acdfda017836f73179218fc79c19a1202a8ddc4494e7f173c.jpg) + +![](images/92da87f26a643ba374f5db4d9e9a50fdb8c35926e654413b0992bf558c95ee0c.jpg) + +![](images/d1fd841cf0595ac62f789f4fdef45bcb71d68a466fbc7aebf4b10b6a4d04933d.jpg) +InstructPix2Pix + +![](images/49b292427a90206fe1fe82cfe9e5714069dfefe8bc0cf02862b7b5b30ea3aecd.jpg) + +![](images/f302c5cb168c8d99b3f4142885bfa7c9e0d0b334bb509fa853d9fc90758774fa.jpg) + +![](images/e136030b14120195f6150416c35b2189c437fc95057b1196eb358616f6624f03.jpg) + +![](images/dbd8a30f06c59eb002db0333eca916d5af8bedda9c9a6c53ca38cd76282a0347.jpg) +Ours + +In Figure 16, we demonstrate the robustness of our approach to corruption at initialization. All the methods transform the stroke input (corrupt image) to a structured noise, which is again transformed back to a similar looking stroke input, highlighting the faithfulness of these methods. However, unlike our approach, the resulting images in other methods are not editable given a new prompt. + +# D.5 ADDITIONAL RESULTS ON SEMANTIC IMAGE EDITING + +Figure 17 illustrates a smooth interpolation between "A man" $\rightarrow$ "A woman" (top row) and "A woman" $\rightarrow$ "A man" (bottom row). The facial expression and the hair style are gradually morphed from one person to the other. + +In Figure 18, we show the ability to regulate the extent of age editing. Given an image of a young woman and the prompt "An old woman", we gradually reduce the controller strength $\eta_{t}$ to make the person look older. Similarly, we reduce the strength to make an old man look younger. + +Figure 19 shows the insertion of multiple objects by text prompts, such as "pepperoni", "mushroom", and "black leaves" to an image of a pizza. Interestingly, pepperoni is not deleted while + +![](images/4ce1f4a0aa405fc7d9fce0f6503125b2ffdf81ea5001b7a5655596ff0d0bf480.jpg) +Figure 15: Stroke2Image generation. Additional qualitative results on LSUN-Church dataset comparing our method with SoTA training-free and training-based editing approaches. + +![](images/fc8121ac5cabe9bcf10b1519c2c8583cb0e2345dad2f55c486dd3be285c52ac9.jpg) +Figure 16: Robustness. For inversion, all methods perform well at recovering the stroke input when given a null prompt. However, when a new prompt like "a photo-realistic picture of a bedroom" is provided, only our method successfully generates realistic images. The other methods continue to suffer from the initial corruption, failing to make the output more realistic. + +inserting mushroom, and mushroom is not deleted while inserting black leaves. The product is finally presented in a lego style. + +Figure 20 captures a variety of facial expressions that stylize a reference image. Given the original image and text prompt: e.g. "Face of a girl in disney 3d cartoon style", we first invert the image to generate the stylized version of the original image. Then, we add the prompt for the expression (e.g., "surprised") at the end of the prompt and run our editing algorithm (15) with this new prompt: "Face of a girl in disney 3d cartoon style, surprised". By changing the expression, we are able to preserve the identity of the stylized girl and generate prompt-based facial expressions. + +![](images/503111692bab85fb6940de4a66e1209ca0fb0319b8b84df4c11297a410fdc71b.jpg) +Figure 17: Gender editing. Our method smoothly interpolates between "A man" $\leftrightarrow$ "A woman". + +![](images/a7bd7698c4d0459e8ffe4fd4d178bb0f0c877a18d3b28037f536d9e08709b9b2.jpg) +Figure 18: Age editing. Our method regulates the extent of age editing. + +![](images/a2b945b87b056251bf3aa0775f28501bc8434a7f4e85bde20424d33b941e997b.jpg) +Figure 19: Object insert. Text-guided insertion of multiple objects sequentially. + +# D.6 HUMAN EVALUATION + +We conduct a user study on the test splits of both LSUN Bedroom and LSUN Church dataset using Amazon Mechanical Turk, with 126 participants in total. As shown in Figure 21, each question was accompanied by an explanation of the task, the question, and the evaluation criteria. Participants were shown a pair of stroke-to-image outputs from different models, in random order, along with the input stroke image. They were asked to select one of three options based on their preference using the following two criteria: + +1. Realism: which of these two images look more like a real, photorealistic image? +2. Faithfulness: which of these two images match more closely to the input stroke image? + +We collect 3 responses per question. With 300 images in the test dataset and 10 pairwise comparisons, we gathered 9,000 responses for this evaluation. The example in Figure 21 is for the LSUN Church dataset; for LSUN Bedroom dataset, we simply replace the word "church" to "bedroom" in the instructions. + +# D.7 GENERATIVE MODELING USING RECTIFIED STOCHASTIC DIFFERENTIAL EQUATIONS + +In Figure 22, we compare images generated by the ODE (1) and SDE (22) variant of Flux across different discretization steps. Figure 23 illustrates text-to-image generation using the stochastic + +"Face of a young girl in disney 3d cartoon style" + +![](images/d02b712d0a4b019e8b810b63ab48d21582ac5109c68870d47efcaf606bcd93f5.jpg) +Original + +![](images/f8f3a67045709ae5b8e7429d3ba692d3d9b4e2c837414c1bb49538d39dc52f0a.jpg) +surprised + +![](images/92566096ad2c5b96cbf3b3e240911e1bad549ee284daada4bab8f0a16ea75dbe.jpg) +"scared" + +![](images/ca673c393ca25d94f5a3140acfd377a9fa1b4f2bc1a125c89bc6254092e0c1a1.jpg) +"frowning" + +![](images/d31b7c0359f0004f724b4bdcf5786904c7cc756caa537a0c0843472e670fe8fd.jpg) +"yawning" + +![](images/4f55eaf17c2695ff3310620b29e8315afcd432012c63d36c52e779df58ecbc1f.jpg) +"Laughing" + +![](images/752cf80e4875fc7fd98f166f7202923c4e356ac659b69c411ef76dbd7746c374.jpg) +"grinning" + +![](images/5aaa8e530b3732611cd9bbbe9682707f7b106cf3cf5a9ea9c024138c9a7b3e64.jpg) +"sad" + +![](images/c020b86ee13955f7d0bd18c3cbc2d740eaeac4bf7b3b85b2ad99aa9ef91b2187.jpg) +smiling + +![](images/1c35d47e991b68fc5081787f93d3c67715b29862d6db3e17f103c5337bbcec94.jpg) +"winking" + +![](images/2f774a2fe48c957c0f94eb1be0ca864b7e1be0ebae88adeaa571afad2fc13f70.jpg) +"gasping" + +![](images/b9c34855a188b5dc7036381fda2d1b0763ec15dd670df01ef59211c6303f6a1c.jpg) +"angry" + +"Face of a boy in disney 3d cartoon style" + +![](images/ec6f61fcbdd2f9f8bdf6c999b06e254fcbb119233a4c31c43ff9c3f01a03c421.jpg) +Original + +![](images/791f6dc0bf1bf45fd4931efb632e39ac79c8d7124422df8e840a55118e072044.jpg) +"laugh" + +![](images/4a53dcf1385f7d6c246052fdb08c826d2b8f26aca16db08a4633bf95d880ee58.jpg) +"smirking" + +![](images/6da4a53b3d8d6e0e80b9e1848de71b97a81ebfc495aea1e846d631d60ef14744.jpg) +"frown" +Figure 20: Stylization of a reference image given prompt-based facial expressions. Given the reference content (e.g., an image of a woman) and the desired prompt (e.g., "a young girl in disney 3d cartoon style"), our method makes the person younger and follows the disney 3d cartoon style. This demonstrates the ability of our method to generate various stylized expressions. + +![](images/6ba743c01d7b055c5733f8ce6beb042d0551193aa56422c32103c9c01434bb0e.jpg) +"angry" + +![](images/fe15c102220d5bf6eafffcf1bb2f7a53479ada5b290fb6c6ea4d185d3112b606.jpg) +"yelling" + +# Instructions: + +This is a task for stroke image to real image generation quality evaluation. +You will see 3 images: input image, generated image 1 and generated image 2. +The input image is a "stroke"/painting" image for a church (shape/color). The generated image 1 and 2 are synthetic images using two different models given the input image. +Your task is to evaluate which generated image is better overall, based on the following criteria: +(1) Realism: Prefer the generated image that looks more like a real, photorealistic image. +(2) Faithfulness: Prefer the generated image that more closely follows the input stroke image. + +![](images/e945556db8f2fc24239f095d6c3c2d27bdfe5ddb177d1b9286f6d760d2ab905f.jpg) + +![](images/963bfc51f4288702cc9c8d07cf9c7f7e1511ad2691304566ed711894e0414e49.jpg) +Input Image + +![](images/2bb52ebaf45110010ef8a43198880b1b2b72e1d0a7c263c3f96e254503bff93b.jpg) +Generated Image 1 + +![](images/e59f6e6148c44540ad126cba70ac9aee926f46ac799bd6fb4c914eea21b81388.jpg) +Generated Image 2 + +# Select an option + +Generated Image1 +Generated Image 2 +Cannot determine/Equal 3 + +![](images/08bb0e78079af7b7cdb1d6620079388c2303c3efbbb233171da1b510d9d13bae.jpg) + +![](images/833fb57a1c6b4ba4d2dfa041b90f0f2b6b1472ab20340309c83607165205ae15.jpg) +Figure 21: Interface for human evaluation. Each participant is asked to select their preferred image based on two criteria: realism and faithfulness. + +sampler for Flux7, highlighting the practical significance of our theoretical findings in §3 and Appendix A. + +# D.8 DISCUSSION ON ACCELERATING CONTROLLED RECTIFIED FLOWS + +![](images/121398e89b3d353243221ec5bb95bc6a706a5b47d7434b630d6a35f22d0a7a01.jpg) +FluxODE +FluxSDE + +![](images/5916b24a0cc090f8a2dde2f95e70d2d77948de7973d53d67e7c6778110975167.jpg) + +![](images/c6fd80f2e132fbb2de21b3eba9d7df7e3210f1442febd0c59a3d8c802f76d2a5.jpg) + +![](images/17c98848de3520d8adb4487c30e7b2ae2c2080b8cea19c886d74f171ea6bf83f.jpg) + +![](images/2b60e0f5ff7bbee8a51435e4232523efb92a2ae9474ff425b5c3a6f7066cf5fa.jpg) + +![](images/baf20fee66181e3a4a933baee6901e01bc2a87a68cd52384cd2eb2a45cfe5eae.jpg) + +![](images/cc6c13dde432989be9ed980e683df0e8f6dd451242115a7b8d828311bb3f5663.jpg) +50 + +![](images/3521062b69b8268766d1031425a09ac935357f2ed0fa0a910936797ecaa8cc63.jpg) +100 + +![](images/8d75d41af446ade9d57f9ad6887e46ff7c46b71c451af11a0bd75894efa97248.jpg) +300 + +![](images/3867d2926cb6ddf010a7f83588a44b6ec177efef7ac70113ee5899689c295b83.jpg) +500 + +![](images/e15c39e6321d1ea74ef85fc8f62405dc577ec13319e47e7d4d090d43f5750b61.jpg) +700 + +![](images/2473fbf984f66c19359d034ac336ce73f449f930d8ca388dbff3b850e914d9f7.jpg) +1000 + +![](images/513fab390fc2f128b2ae3b3f66763a8ee3cacae0ceb9a07a4f7d7aa3356ca94f.jpg) +Prompt: "This dreamlike digital art captures a vibrant, kaleidoscopic bird in a lush rainforest". +FluxODE +FluxSDE + +![](images/3694675333aca152d71566ee14dc2e272a8e8f41f25461f5ac8522b5f219eb78.jpg) + +![](images/442d961a0d6ac3f1e1c227ea45739e75666ee4caecb25c21c723311ba2185f02.jpg) + +![](images/31642cb9f789ddf867085d8b0d05b8fce40a3c48fb8b3450ccdbed70167a2098.jpg) + +![](images/5d6584b5b115036edddc44ba4fc8ebbae4d9eb2fd44c477a3e614d1b9915eebc.jpg) + +![](images/c7a712f359ce1af8960f64b27054f978278c3399239f04f95e15392062cca23e.jpg) + +![](images/86e0b3a0560317b902f1289c520f6d5e7c41212bc1b6798922600145fa3d4c93.jpg) +50 +Figure 22: T2I generation using rectified ODE (top) and SDE (bottom) for different number of discretization steps marked along the X-axis. The stochastic equivalent sampler FluxSDE generates samples visually comparable to FluxODE at different levels of discretization. + +![](images/b374ff47fcf7d6d7f2066427515bd856a3aad599b64ebcf20cfa1b9414ed98c4.jpg) +100 + +![](images/92493a7cdcb2e8f02f9ff2df018d4dd9c29f39d646d99bc5bc81202284de38b3.jpg) +300 + +![](images/e985be6bb85847e6bd24516d096f613976dcd3c6fd1e93a12a41d79c3636ca66.jpg) +500 + +![](images/8fd7ec54cf0dfa7f9706beaecf4f18adb2ce60b435a1af90c9cd5713bbffe1c7.jpg) +700 +Prompt: "A futuristic robot depicted entirely out of fractals". + +![](images/888f6210e6168cb0d179e8fd7878fec8d1bc2ee8e412cdf6b38ae1aa30b9407c.jpg) +1000 + +In this paper, we used 28 inference steps, the default setting for Flux. It is well established that reconstruction error increases as the number of inference steps decreases due to coarse discretization. Prior works on diffusion models have developed methods to mitigate this error with fewer steps (Garibi et al., 2024; Pan et al., 2023). In particular, the accelerated iteration procedure from AIDI (Pan et al., 2023) and the renoising iteration step in ReNoise (Garibi et al., 2024) could enhance the inversion and editing capabilities of our method with fewer steps. Integration of such sampling techniques in rectified flows represents a promising direction for future work. + +# D.9 RF-INVERSION AS A PLUG-AND-PLAY SOLUTION FOR RECTIFIED FLOWS + +Figure 24 presents stylization results achieved using RF-Inversion with Stable Diffusion 3.5 (Esser et al., 2024). The generated images accurately reflect the artistic styles of the reference style images while faithfully adhering to the desired prompts. The top row includes reference styles from StyleAligned (Hertz et al., 2023) benchmark. The bottom row contains hand-drawn styles: plastic crayon8 and pencil sketch9. + +# D.10 RF-INVERSION WITH DIFFERENT INITIALIZATION + +Flux +![](images/77c84e0dfb1fe3b839be6a10e0318758c187d8df931241792c3665cd1d2ca6b9.jpg) +Prompt: "portrait, looking to one side of frame, lucid dream-like 3d model of an owl, video game character, forest, wonderland, photorealism, cinematic artistic style." + +![](images/95eb459bf8e190e661f7c5319244f374055f5e8e151f5c1fde9a1f5a591385d0.jpg) +FluxSDE (Ours) + +Flux +![](images/10d317f24d7679d762e7c91f65c0ed1113b715d0e23805510ea913cb92f34da8.jpg) +Prompt: "a robot with a reflective helmet, iron armor, photorealistic, in shades of red and golden brown, dark gloomy environment, epic scene." + +![](images/9fe3dfda5e48ccf125d269d21cea2858324c99dc9cba7309180f53686c246c07.jpg) +FluxSDE (Ours) + +![](images/b2538fad7331dc29dcc6f9571cea5ee957ac9be8a06ea22c0c28327f2cbaf09b.jpg) +Prompt: "a space elevator, cinematic scifi art, spacecrafts flying in the background" + +![](images/a073c07bb6eb87671204d84b44269750f713f66353b41ae4226f589747dca413.jpg) + +Figure 23: T2I generation using rectified flow SDE (22). Our stochastic sampler is visually comparable to the standard deterministic sampler provided by Flux. +![](images/ef101753b768d8dbaa0a7664e7103d98a1429264c7f39d15ddbdfb0598814e25.jpg) +Prompt: "a dragon soaring through the sky, battle ground, people fighting on the ground." + +![](images/f9fa44b17691cfddadba28350f08686b486ec1138b1186fbc1c78640386a779e.jpg) +Prompt: "a 3d model of a magical creature, long nose, green color, movie asset, ultra detailed." + +![](images/ba1077d403c76fd648c596c72e854c2ca9bdd5c6d2c932d01f3d47f1dccbe93a.jpg) + +![](images/cb25ac887c197bd450fa928645550ba054f2eaa98b4a540954718598892aa6af.jpg) +Prompt: "a genius scientist, in his 60s stands, writing on the black board, white hair, white beard, round spectacles." + +![](images/c9997f4ce1501d3bf996653f3898a56e8b3f8f3cdb324283c1a43daea2c63611.jpg) + +Figure 25 shows the effect of $\mathbf{y}_1$ on reference image-based stylization and structure preservation. The proposed method reliably generates accurately stylized image and preserves the structure of the input image. While the choice of $\mathbf{y}_1$ does have an impact, our controller ensures that the semantics of the reference input are still preserved for different random choices of $\mathbf{y}_1$ . + +Regarding stroke-to-image quality, the manually annotated clean stroke images used in SDEdit are not publicly available. Therefore, we simulate stroke images following Section D.2 (Figures 30 and 31) in SDEdit, as this strategy was also used in their large-scale evaluation. The simulated stroke images are noisy which increases variability in the layout of the generated images. We also added one example in Figure 25 (d) using an annotated bedroom stroke input (by taking a screenshot of stroke paint from Figure 1 of SDEdit), showing that the layout of the generated images are better aligned with a cleaner stroke input. + +# D.11 COMPATIBILITY OF RF-INVERSION WITH FLUX-LORA + +Figure 26 illustrates content-style composition using Flux-LoRA (Hu et al., 2021). In this experiment, we apply LoRA fine-tuning only for content while using our method for stylization. We train two LoRA models with the $<$ sks $>$ token using images from the DreamBooth (Ruiz et al., 2023) + +dataset10: (1) "a sks dog" (6 images) and (2) "a sks cat" (5 images). For each LoRA, we use rank 16 and fine-tune for 1000 iterations, which takes around 25 minutes. We first use $u_{t}(\mathbf{y}_{t})$ in Algorithm 1 to obtain a structured noise corresponding to the reference style image (e.g., "line drawing"). Subsequently, we employ Algorithm 2 with LoRA weights added to $v_{t}(\cdot)$ using the desired prompt (e.g., "a sks dog in line drawing style"). Observe that the unique identifiers of the dog (e.g., the beard) are effectively captured in the generated sample. + +![](images/bd5d45b99221b9e2e84b20935b31987cb62aa2606813a9149357c00c52f26360.jpg) + +![](images/68860962f5af4f7be39f6de21225bcba1e6821b95df0c6e6444b6739c3d736c9.jpg) + +![](images/8c1cc55cecb96df9b0aa3c9ecc4b47151e6fe6a07ef432ba9e8826df9e4c8d1d.jpg) + +![](images/1bf1c95a2158cb8d540e2e0907e2a20a267f2d0b099fe48e8296d8270326a1c0.jpg) + +![](images/61ef7bed764fd9100a5989e89f4e2f9050a8d3c1c6435452048173e6878a0914.jpg) + +![](images/efef7ad17ed3f2be8639e43257bf62f178df478d87ee2035d2fe927f3dc24422.jpg) + +![](images/b92bc10dd7d8a7dabe7bdb797c89d15cc9f583acad8755cee0634757d27d64f7.jpg) +(a) Ref. style +(c) Ref. style + +![](images/d4cd912e79ddd62277ff19df1bb60ddd3b5efd9bcb76c239575a06915403cfcb.jpg) +"A boat" +"A house on a hill" + +![](images/e78533a6d8c4c89da0cd896532425f25477def197b241b2fda61aceac4df742f.jpg) +"A car" +"A racing car" +Figure 24: Compatibility of our method with another RF model, Stable Diffusion 3.5. Reference styles in (a) "melting golden 3d rendering" and (b) "vintage travel poster" are from StyleAligned benchmark (Hertz et al., 2023), and (c) "plastic crayon drawing art" and (d) "pencil sketch" are hand-drawn styles provided by users. Please see §D.10 for the reference style credits. + +![](images/4b0f83c1a2e45085104d498a83543e17f805a6832be720a1a3e4ffa24cba8fe5.jpg) +(b) Ref. Style +(d) Ref. Style + +![](images/849a472391c474522467626111cf2b354edae6949b2099224b5b8a1af90fe7b3.jpg) +"A mad scientist" +"An elephant" + +![](images/e6f8f8ab779d0c467fedc48335ea4195c918a6ac487bd3e30897c2993bafccdd.jpg) +"A lion boy" +"A futuristic robot" + +# D.12 ADAPTABILITY OF RF-INVERSION TO GENERAL INVERSE PROBLEMS + +Figure 27 shows that our method RF-Inversion easily extends to a broad class of inverse problems without using additional training, latent variable optimization, or complex attention processors. For restoration task, we consider super-resolution by 8X (left) and motion blur by a kernel $(61\times 61)$ (right). + +# D.13 STUDY OF CONTROLLER GUIDANCE IN IMAGE EDITING + +Figure 28 demonstrates the influence of the controller guidance parameters $\gamma$ (forward flow) and $\eta$ (reverse flow) on the image transformation process. The interplay between $\gamma$ and $\eta$ is crucial for balancing the forward and reverse flows, ensuring that the resulting output follows the structure of the given input. Increasing $\gamma$ improves realism but the structure changes. For instance, the church door is facing towards right. For a fixed $\gamma$ (say 0.5), increasing $\eta$ aligns the structure with the reference input $(\mathbf{y}_0)$ . Interestingly, at a midway point $(\gamma = 0.5, \eta = 0.5)$ , the image looks blurry because this is a superposition of two conflicting images (e.g., in one image, the door is facing to the right, and in another, to the front). Finally, our controller guidance $(\eta)$ rectifies this process to become more faithful to the reference input. + +# D.14 ADDITIONAL EDITING RESULTS USING 8 STEP DISTILLED MODEL + +Figure 29 shows additional qualitative results on face editing and stroke2image generation using our method integrated with Flux-Turbo-LoRA11. These results demonstrate the compatibility of our method with a distilled base model capable of sampling in as few as 8 steps. In this experiment, we employ the distilled Flux-Turbo-LoRA model for computing $u_{t}(\cdot)$ and $v_{t}(\cdot)$ in our Algorithm 1 and Algorithm 2, respectively. + +![](images/7dd4634aeba7dd7db8eba230c5bbf195a0cd3c18711068f5c6cf36a26d684f26.jpg) +Figure 25: Robustness to initialization $(\mathbf{y}_1)$ . Given an input image (e.g., a style image of "pencil sketch" in (e)) as $\mathbf{y}_0$ and 5 different typical samples $\{\mathbf{y}_1^i\}_{i=1}^5$ from $p_1$ , our method effectively captures the semantics of the reference input while adhering to the desired prompt (e.g., "a cute panda"). The annotated bedroom input in (d) is a screenshot of the bedroom from SDEdit (Meng et al., 2022). Compared to simulated stroke inputs in (b,c), the annotated stroke input in (d) helps with better alignment of the generated layout. + +# D.15 COMPARISON WITH DDIM INVERSION FOR DIFFERENT START STEP + +Figure 30 shows the effect of different starting time for DDIM Inversion. The generated samples become less realistic but more faithful as the starting time increases. + +# D.16 LIMITATION + +The lack of comparison with expensive diffusion-based editing solutions may be viewed as a limitation. However, these implementations are either not available for Flux or not directly applicable due to Flux's distinct multi-modal architecture. The key contribution of this paper lies in its theoretical foundations, validated using standard benchmarks and relevant baselines. + +![](images/7948d30571483ecf3f51fded3e8039ba1a93669ae280bc4ac9e9bc51ab1f2c90.jpg) +Figure 26: Compatibility of our method with LoRA for content-style composition. The generated image preserves the identity of the reference content while adhering to the desired style. + +![](images/dfa03d7b848f455c3425737c5d1522632e1b16f3fb2756ed1ab3b09df7f41e0a.jpg) +Figure 27: Image editing in (a) non-rigid task, (b) image restoration and (c) local color change. The proposed method generalizes to a wide-variety of inverse problems without training, test-time optimization or cross-attention manipulation. + +![](images/6bbfd8f22410e386aafdcacaf95c29d834ed941dcd94e071a5beb30b1b4a76f4.jpg) + +![](images/057ff28a92fe23423aca28eff139133f71c5163199544f153d46ea501cd4d46d.jpg) +Input $(y_0)$ +Figure 28: Impact of the forward and reverse controller guidance in image editing. Increasing $\gamma$ helps transform an "atypical" sample to a "typical" sample, making the generated samples more realistic. Subsequently, increasing the controller guidance for reverse flows $(\eta)$ improves faithfulness to the reference input, as discussed in §3. + +![](images/17ffb27149f78599561787f9d759642e1592352bb8b878f6082891d2bc428f47.jpg) +Figure 29: Face editing and Stroke2Image generation in 8 steps. We noise and denoise using a distilled model that is capable of sampling from the data distribution in 8 steps. + +![](images/fff3d9503cf45e670ae4b9baf6f44c3b58dcda070073d9fdc296dc7d3b7a8a70.jpg) +Figure 30: Qualitative comparison with DDIM Inversion with different starting time. Our method outperforms DDIM Inversion with a mid-way starting point. \ No newline at end of file diff --git a/ICLR/2025/Semantic Image Inversion and Editing using Rectified Stochastic Differential Equations/images.zip b/ICLR/2025/Semantic Image Inversion and Editing using Rectified Stochastic Differential Equations/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..8cf359082d743138de95ba6e94a9083f32c474a8 --- /dev/null +++ b/ICLR/2025/Semantic Image Inversion and Editing using Rectified Stochastic Differential Equations/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0c077d3d5b75fab65de1bb252394918e3b973918d8e4d33dee1130f77c136abc +size 3251265 diff --git a/ICLR/2025/Semantic Image Inversion and Editing using Rectified Stochastic Differential Equations/layout.json b/ICLR/2025/Semantic Image Inversion and Editing using Rectified Stochastic Differential Equations/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..18fbe0c1094d4d007ebf3a02f6a3e33f75f1b655 --- /dev/null +++ b/ICLR/2025/Semantic Image Inversion and Editing using Rectified Stochastic Differential Equations/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:90e677b0f966c356eb6682918a7b6076d429108ab70c2714c50bba4a0160b283 +size 1697896 diff --git a/ICLR/2025/Semantic Temporal Abstraction via Vision-Language Model Guidance for Efficient Reinforcement Learning/650929a4-49e8-411b-afd7-37a141b26ec5_content_list.json b/ICLR/2025/Semantic Temporal Abstraction via Vision-Language Model Guidance for Efficient Reinforcement Learning/650929a4-49e8-411b-afd7-37a141b26ec5_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..07424e4fe7f7de45295189f613d33e920de54882 --- /dev/null +++ b/ICLR/2025/Semantic Temporal Abstraction via Vision-Language Model Guidance for Efficient Reinforcement Learning/650929a4-49e8-411b-afd7-37a141b26ec5_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:62e456a05a1f0c2b97d75f5688e27e49728a3f33d4548732ef0b4a78891e5322 +size 146631 diff --git a/ICLR/2025/Semantic Temporal Abstraction via Vision-Language Model Guidance for Efficient Reinforcement Learning/650929a4-49e8-411b-afd7-37a141b26ec5_model.json b/ICLR/2025/Semantic Temporal Abstraction via Vision-Language Model Guidance for Efficient Reinforcement Learning/650929a4-49e8-411b-afd7-37a141b26ec5_model.json new file mode 100644 index 0000000000000000000000000000000000000000..947c9c1e1529d875e7c62e5ded85c6e4d784781c --- /dev/null +++ b/ICLR/2025/Semantic Temporal Abstraction via Vision-Language Model Guidance for Efficient Reinforcement Learning/650929a4-49e8-411b-afd7-37a141b26ec5_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7c4bb398bbe6e8e2811f184aefcb4d1bdb8cc909df5f59a211cae0b3bd4c23f5 +size 179102 diff --git a/ICLR/2025/Semantic Temporal Abstraction via Vision-Language Model Guidance for Efficient Reinforcement Learning/650929a4-49e8-411b-afd7-37a141b26ec5_origin.pdf b/ICLR/2025/Semantic Temporal Abstraction via Vision-Language Model Guidance for Efficient Reinforcement Learning/650929a4-49e8-411b-afd7-37a141b26ec5_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..bcd1014a40d5475e48b7f7f1f0b2301a03eb0277 --- /dev/null +++ b/ICLR/2025/Semantic Temporal Abstraction via Vision-Language Model Guidance for Efficient Reinforcement Learning/650929a4-49e8-411b-afd7-37a141b26ec5_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5e3d389839972a45370ba4374d772b0bfb5fd0bdd1687795bb6e7120bdeeb2fd +size 6596365 diff --git a/ICLR/2025/Semantic Temporal Abstraction via Vision-Language Model Guidance for Efficient Reinforcement Learning/full.md b/ICLR/2025/Semantic Temporal Abstraction via Vision-Language Model Guidance for Efficient Reinforcement Learning/full.md new file mode 100644 index 0000000000000000000000000000000000000000..fab2e8d10ff8d5bbb08425458bee3133910ea6ea --- /dev/null +++ b/ICLR/2025/Semantic Temporal Abstraction via Vision-Language Model Guidance for Efficient Reinforcement Learning/full.md @@ -0,0 +1,600 @@ +# SEMANTIC TEMPORAL ABSTRACTION VIA VISION-LANGUAGE MODEL GUIDANCE FOR EFFICIENT REINFORCEMENT LEARNING + +Tian-Shuo Liu $^{1,2*}$ , Xu-Hui Liu $^{1*}$ , Ruifeng Chen $^{1,2*}$ , Lixuan Jin $^{1}$ , Pengyuan Wang $^{1,2}$ , Zhilong Zhang $^{1,2}$ , Yang Yu $^{1,2\dagger}$ + +$^{1}$ National Key Laboratory for Novel Software Technology, Nanjing University, China &School of Artificial Intelligence, Nanjing University, China + +2Polixir Technologies + +{liuts, liuxh, chenrf}@lamda.nju.edu.cn, jinlx@smail.nju.edu.cn, + +{wangpy,zhangzl}@lamda.nju.edu.cn,yuy@nju.edu.cn + +# ABSTRACT + +Extracting temporally extended skills can significantly improve the efficiency of reinforcement learning (RL) by breaking down complex decision-making problems with sparse rewards into simpler subtasks and enabling more effective credit assignment. However, existing abstraction methods either discover skills in an unsupervised manner, which often lacks semantic information and leads to erroneous or scattered skill extraction results, or require substantial human intervention. In this work, we propose to leverage the extensive knowledge in pretrained Vision-Language Models (VLMs) to progressively guide the latent space after vector quantization to be more semantically meaningful through relabeling each skill. This approach, termed Vision-language model guided Temporal Abstraction (VanTA), facilitates the discovery of more interpretable and task-relevant temporal segmentations from offline data without the need for extensive manual intervention or heuristics. By leveraging the rich information in VLMs, our method can significantly outperform existing offline RL approaches that depend only on limited training data. From a theory perspective, we demonstrate that stronger internal sequential correlations within each sub-task, induced by VanTA, effectively reduces suboptimality in policy learning. We validate the effectiveness of our approach through extensive experiments on diverse environments, including Franka Kitchen, Minigrid, and Crafter. These experiments show that our method surpasses existing approaches in long-horizon offline reinforcement learning scenarios with both proprioceptive and visual observations. + +# 1 INTRODUCTION + +Reinforcement learning (RL) (Sutton & Barto, 2018) has demonstrated remarkable success across a variety of domains, including robotics (Peng et al., 2020; Haarnoja et al., 2018), games (Silver et al., 2016; Zha et al., 2021), and combinatorial optimization (Geng et al., 2024; Wang et al., 2024). However, in complex environments with sparse rewards, learning efficiently over long horizons remains challenging. Temporal abstraction (Sutton et al., 1999; Villecroze et al., 2022; Park et al., 2023; Fu et al., 2024) provides a solution by breaking down complex, long-term problems into simpler subtasks, allowing agents to learn hierarchically, where credit assignment can be more easily managed at the segment level. These methods seek to extract temporally extended primitive structures from tasks into skills for further learning, while in real-world scenarios with logged data, this falls under the scope of offline RL (Ajay et al., 2021; Venkatraman et al., 2024). The agent learns to behave within the constraints of the skill context, which reduces the action search space. + +Despite previous efforts in hierarchical or goal-conditioned RL focusing on skill extraction for downstream policy learning, creating useful and effective abstractions remains challenging. Some methods apply unsupervised methods to discover skills (Ajay et al., 2021; Venkatraman et al., 2024), which often result in fragmented segments. While heuristic approaches, such as using fixed horizons to define subgoals (Emmons et al., 2022; Ghosh et al., 2021; Yang et al., 2022), can lead to unmeaningful divisions. In long-horizon tasks, particularly in offline RL, misleading extraction of primitive options can result in poor value function learning and suboptimal policy learning. To address this issue, another line of research incorporates human annotations or language descriptions into skill extraction (Lee et al., 2019; Fu et al., 2024; Peng et al., 2024), but these methods are heavily reliant on human supervision, which contradicts the pursuit of fully automated intelligence. + +Humans inherently excel at efficient learning by instinctively decomposing complex tasks into smaller, manageable components. Drawing inspiration from this phenomenon, we aim to extract interpretable segments that emulate this task decomposition process, focusing on identifying meaningful contexts that denote subtasks. These contexts serve as temporally extended signals, representing the current subtask or the next subgoal, and condition the learning of skills (low-level contextual policies) for effective task execution. How can we discover more reasonable context and build skills without relying on cumbersome human labor? One promising approach to addressing this challenge is the integration of reinforcement learning agents with the prior knowledge and reasoning capabilities of pretrained foundation models, such as Vision-Language Models (VLMs). These models, trained on large-scale Internet data, offer rich interpretations of the environment and semantic understanding, allowing agents to reason in a more meaningful and effective manner (Du et al., 2024; Mees et al., 2023). + +Inspired by the success of VLM, we propose a novel approach that leverages the prior knowledge of VLMs to decompose trajectories into reasonable subsequences, termed Vision-Language Model Guided Temporal Abstraction (VanTA). Our method progressively shapes the latent space after vector quantization to be more semantically meaningful by relabeling each segment. This process facilitates the discovery of more interpretable, task-relevant temporal segmentations, all while reducing the reliance on extensive manual intervention. Specifically, the latent space undergoes alternating updates in two stages: first, it commits to the vector-quantized results; then, after VLM assigns indices to the segments, the latent space is further refined. We employ a two-level policy extraction framework, where the high-level policy selects from a compact, discrete primitive skill space, and Implicit Q-Learning (IQL) (Kostrikov et al., 2022) is used for low-level policy training. From a theoretical standpoint, we demonstrate that our method, in a hierarchical manner, compresses the raw MDP action space and reduces the horizon. Compared to the primitive skill space without VLM guidance, VanTA reduces the complexity of low-level policy space, allowing the agent to address subtasks more efficiently in expectation. We empirically validate our approach through extensive experiments on environments including Franka Kitchen in D4RL (Fu et al., 2020), Mini-grid (Chevalier-Boisvert et al., 2023), and Crafter (Hafner, 2021). These experiments show that our method outperforms previous approaches in long-horizon offline reinforcement learning scenarios for both proprioceptive and visual observations. + +# 2 RELATED WORK + +# 2.1 TEMPORAL ABSTRACTION IN HIERARCHICAL REINFORCEMENT LEARNING + +Temporal abstraction is a key topic in hierarchical reinforcement learning. Many previous methods rely on unsupervised objectives to discover skills (Pertsch et al., 2020; Eysenbach et al., 2019; Singh et al., 2021), which can lead to scattered and unmeaningful skill extraction. To achieve more coherent skill discovery, some approaches incorporate human intervention (Lin et al., 2024; Oh et al., 2017; Xu et al., 2018). Then these skills are used for planning (Sharma et al., 2020), few-shot imitation learning (Nam et al., 2022), or online RL (Nachum et al., 2019). In contrast, our work leverages VLM-guided skill extraction to enhance the limited available data, reducing the need for extensive human intervention. While temporally extended and recurring structures have been effective in solving complex tasks in online RL, integrating them into offline RL is also beneficial (Dietterich, 1998; Sutton et al., 1999; Kulkarni et al., 2016). The main challenge lies in how to hierarchically decompose trajectories (Ajay et al., 2021; Jiang et al., 2023; Pertsch et al., 2020). Our method focuses on extracting more meaningful skill context from offline data via VLM guidance. + +# 2.2 KNOWLEDGE DISTILLATION FROM VLM FOR REINFORCEMENT LEARNING + +Vision-language models (VLMs) possess extensive world knowledge. The efficiency of reinforcement learning is crucial (Chen et al., 2024; Wang et al., 2022), and leveraging knowledge in VLMs can enhance it. VLMs are used to decompose high-level long-sequence tasks into multiple low-level executable step-by-step plans (Huang et al., 2022; Wang et al., 2023; Brohan et al., 2023). These plans then serve as conditions for downstream reinforcement learning tasks to guide RL learning (Huang et al., 2023). However, due to the limited reasoning abilities of VLMs, they struggle to accurately recognize dynamic environments and reason precisely. On the other hand, VLMs are also used to embed useful information such as instructions (Liu et al., 2022; Mees et al., 2023; Myers et al., 2023), feedback (Bucker et al., 2023) and data for world modeling (Lin et al., 2023). These approaches leverage (V)LMs to encode the semantic information of input text and images. Compared to traditional knowledge distillation methods, our approach uses VLMs as a discriminative model to assist in segmentation, which is more reliable than relying on their generation abilities (Pang et al., 2024). + +# 3 PRELIMINARIES + +Let $M = (\mathcal{S}, \mathcal{A}, P, r, \gamma, \rho_0)$ represent a Markov Decision Process (MDP), where $\mathcal{S}$ is the state space, $\mathcal{A}$ is the action space, $P: \mathcal{S} \times \mathcal{A} \to \Delta(\mathcal{S})$ is the transition function $(\Delta(\cdot)$ is the probability simplex), $r: \mathcal{S} \times \mathcal{A} \to [0, R_{\max}]$ is the reward function, $\gamma \in [0,1)$ is the discount factor and $\rho_0$ is the initial distribution over states. A policy $\pi: \mathcal{S} \to \Delta(\mathcal{A})$ describes a distribution over actions for each state. The goal of RL is to learn the best policy $\pi^*$ that maximizes cumulative discounted reward, i.e., $\sum_t \mathbb{E}_{a_t \sim \pi^*} \gamma^t r(s_t, a_t)$ . The value function and Q function of policy $\pi$ are $V^\pi(s) = \sum_t \mathbb{E}_{a_t \sim \pi(s_t)} [\gamma^t r(s_t, a_t)] |s_0 = s]$ , $Q^\pi(s, a) = \sum_t \mathbb{E}_{a_t \sim \pi(s_t)} [\gamma^t r(s_t, a_t)] |s_0 = s, a_0 = a]$ . $V^\pi$ and $Q^\pi$ be the shorthand for $V^\pi^*$ and $Q^\pi^*$ respectively. We assume access to experience dataset $\mathcal{D} := \{\tau_i : (s_t, a_t, r_t, s_{t+1})_{t=0}^{H}\}_{i=1}^N$ . + +Vector Quantized Variational Autoencoder (VQ-VAE) (van den Oord et al., 2017) is a neural network architecture designed for unsupervised learning of latent representations. In VQ-VAE, the input data $x$ is mapped to a continuous latent space by the encoder $q_{\psi}$ , which is then quantized to the nearest codeword $z$ in the discrete codebook embedding space $\mathcal{Z}$ . This codeword, $c_{j}$ , is indexed in the codebook $\mathcal{C}$ , where the size of the codebook set is denoted as $|\mathcal{C}|$ . The decoder $p_{\phi}$ maps the discrete code back to the output space, generating new samples. VQ-VAE updates the encoder, decoder, and codebook parameters with the loss function Eq. (1), respectively reconstruction loss, codebook loss and commitment loss: + +$$ +\mathcal {L} = \hat {\mathbb {E}} _ {x \sim \mathcal {D}} \left[ \| x - \hat {x} \| _ {2} ^ {2} + \| \mathbf {s g} (h) - z \| _ {2} ^ {2} + \beta \| h - \mathbf {s g} (x) \| _ {2} ^ {2} \right], \tag {1} +$$ + +where $\hat{x} \sim p_{\phi}(\cdot | z), h \sim q_{\psi}(\cdot | x)$ , and $\mathbf{sg}(\cdot)$ represents the stop-gradient operation. Additionally, we follow the technique from Gumbsch et al. (2024), which models sequential transitions in latent space by introducing $L_{1}$ -regularization to context changes $\Delta h_{t} = \| h_{t + 1} - h_{t}\|_{1}$ , as the context code is intended to change relatively sparsely. + +# 4 METHOD + +In this section, we introduce VanTA, a novel framework for extracting skills from offline trajectory datasets $\mathcal{D}$ , grounded in pretrained vision-language models (VLMs). We incorporate VLM into the skill context codebook $\mathcal{Z}$ update process, which distills states into a discrete space $\pi_{\theta}(z|s)$ . Then conditioned on the extracted skill, low-level policy is further learned by offline RL. + +Our framework, as illustrated in Fig. 1, consists of two stages. In the first stage, state sequences are initially segmented using vector quantization (VQ) techniques to generate the initial set of skills. These skills are then passed to the VLM, which relabels them based on its internal knowledge. The relabeled skills are subsequently used to update the VQ codebook following the method described in van den Oord et al. (2017). This process is repeated iteratively until convergence. In the second stage, the low-level policy is refined using the skills derived from the first stage. The following sections provide detailed insights into the implementation of our approach. + +![](images/00f973fa69a622af6d33f5fcf4202296f73c5b3be67cd72ce3058ece930e2dad.jpg) +-Stage 1 Primitive Skill Extraction + +![](images/8ec50f81fd7863fcc18f07362a1c9866e5fb243a1ce636024686e559fb07798f.jpg) +-Stage 2 Policy Extraction +Figure 1: Vision-language model guided Temporal Abstraction (VanTA) Overview: First stage for primitive skill extraction, second stage for policy extraction, conditioned on the extracted skill. + +# 4.1 SKILL CONTEXT LEARNING + +To better distill the skill context, we leverage the knowledge in the foundation model VLM. VQ provides a standard codebook $\mathcal{Z}$ , but directly querying each image may lead to hallucinations due to the lack of clear meaning in a single observation. Additionally, this approach is inefficient when handling large offline datasets. Therefore, we start with the VQ method to initialize trajectory segments. The input for VQ is a single observation. By projecting consecutive observations into a single skill context, segments are formed, which serve as a proper initialization for querying the VLM. We propose a modification to the original VQ-VAE architecture, to learn text-aligned temporal abstractions of trajectories for decision-making policies. The original decoder is replaced with a policy decoder $p_{\phi}(a|s,z)$ , as temporal abstractions focus on behavior information for policy learning rather than sharing the reconstruction objective. + +As the encoder $q_{\psi}(h|s)$ embeds the state into the continuous latent space, it is then projected into a discrete code vector $z_{j}$ , where the index $j$ corresponds to codebook $c_{j}$ in $\mathcal{C}$ . Consecutive states assigned to the same code index naturally segment the trajectory into sub-trajectories, where the initial and terminal states of each sub-trajectory define the boundaries of a primitive skill. To ground the codebook embedding space with semantic meaning, we query the VLM as follows: $j = \mathrm{VLM}(\bar{s})$ , where $\bar{s}$ represents the initial and terminal states of the primitive skill. The returned $j$ is the identified index. We adopt the update rule from van den Oord et al. (2017); Roy et al. (2018); Razavi et al. (2019) to update the $c_{j}$ embedding $z_{j}$ , applying an exponential moving average with a smaller decay rate after querying the VLM: + +$$ +z _ {j} \leftarrow z _ {j} \cdot \lambda + \sum_ {n _ {j}} h _ {j} (1 - \lambda), \tag {2} +$$ + +where $\sum_{n_j}$ represents all projected embeddings assigned to index $j$ by the VLM. We denote the EMA target of $(\sum_{n_1}h_1(1 - \lambda),\dots,\sum_{n_j}h_j(1 - \lambda),\dots)$ as $e$ , where $j$ ranges from 1 to $|\mathcal{C}|$ in Eq. (3). + +Scattered or unmeaningful skills are common during unsupervised learning. Leveraging knowledge in the VLM, primitive skills can be merged, and misleading indices corrected. This alternation process gradually makes the segmentation more semantically meaningful. Exception handling for VLM is crucial, as the output of VLM can be stochastic, often providing misleading answers when + +an image only partially depicts the subtask. We thereby add one option for VLM to choose as no suitable skill. During optimization, we increase the smoothness loss to improve consistency with surrounding states, incorporating scattered observations into neighboring skills in subsequent iterations. The final loss for training encoder $q_{\psi}$ , decoder $p_{\phi}$ is defined as: + +$$ +\mathcal {L} _ {\psi , \phi} = \underset {s, a \sim \mathcal {D}} {\hat {\mathbb {E}}} \left[ \| a - \hat {a} \| _ {2} ^ {2} + \beta \| h - \mathbf {s g} (z) \| _ {2} ^ {2} + \| z - \mathbf {s g} (h) \| _ {2} ^ {2} + \| z - e \| _ {2} ^ {2} + \gamma \| \Delta h \| _ {1} \right], \tag {3} +$$ + +where $\mathbf{sg}(\cdot)$ represents the stop-gradient operation, and $\Delta h$ denotes the smoothness loss, which ensures representation consistency between consecutive states, following the approach in Gumbsch et al. (2024). And $z\in \mathcal{Z}$ is the latent variable discretized by vector quantization in this loss function. + +# 4.2 LOW-LEVEL POLICY EXTRACTION + +We collect a replay buffer $\mathcal{B}$ from the dataset $\mathcal{D}$ , consisting of segmented sub-trajectories, and store transition tuples $\{\sigma_{i} := (s_{t},a_{t},z_{t},r_{t:t + K - 1},s_{t + K})_{t = 0}^{C_{i}}\}_{i = 0}^{M}$ from $\sigma_{i} \sim \mathcal{B}$ . Here, $s_t$ and $a_{t}$ represent the state-action pairs from $\mathcal{D}$ , $z_{t}$ is the latent variable labeled by our primitive skill extraction method, $r_{t + K - 1}$ denotes the $\gamma$ -discounted sum of rewards accumulated over $K - 1$ time steps starting from time step $t$ in $\sigma_{i}$ , and $s_{t + K}$ represents the initial state of the next skill. We first update the high-level Q-function, which is conservatively learned using temporal-difference error at the skill level. A batch of primitive transitions is sampled from $\mathcal{B}$ for maximizing the cumulative return of the primitive skills. Since the latent space in the codebook is quantized, we apply discrete Deep Q-learning under offline setting in a conservative manner (Kumar et al., 2020). The Bellman error for the Q-update in high-level policy learning can be expressed as: + +$$ +Q \left(s _ {t}, z _ {t}\right) \leftarrow r _ {t: t + K - 1} + \gamma^ {K} Q \left(s _ {t + K}, \underset {z \sim \pi_ {\theta} (z \mid s _ {t + K})} {\arg \max } Q \left(s _ {t + K}, z\right)\right), \tag {4} +$$ + +Once the high-level policy is applied to generate candidate primitive skills during evaluation, the final policy for VanTA generates low-level actions conditioned on both the primitive skill and the observation. The low-level policy is learned using a behavior cloning-style algorithm, where the policy network approximates the action logits from the offline dataset: + +$$ +\min _ {\omega} J (\omega ; \mathcal {D}) = \hat {\mathbb {E}} _ {\tau \sim \mathcal {D}} \left[ - \sum_ {t = 0} ^ {H - 1} \log \pi_ {\omega} \left(a _ {t} \mid s _ {t}, z _ {t}\right) \right], \tag {5} +$$ + +where $z$ is the latent space label assigned to the state. Additionally, we apply importance weighting during the update, using $\exp(Q(s,a) - V(s))$ (Kostrikov et al., 2022) with a certain coefficient. + +# 5 ANALYSIS + +Intuitively, more semantically meaningful skills can lead to better policies. To theoretically validate this intuition, we analyze the relationship between algorithm performance and the learned skills. We compare VanTA with reinforcement learning in the original space or hierarchical reinforcement learning methods that lack external semantic information guidance in this section. Our algorithm is divided into two parts: offline reinforcement learning for the high-level policy and weighted behavior cloning for the low-level policy. First, we focus on the offline reinforcement learning part. In the offline setting, the performance of the policy is highly related to the dataset. Therefore, we introduce an assumption on the quality of the dataset as previous works did (Chen & Jiang, 2019; Liu et al., 2024). We also give the definition of admissible distributions. + +Definition 5.1 (Admissible distributions). We say a distribution $\nu \in \Delta (\mathcal{S}\times \mathcal{A})$ is admissible in MDP $M$ , if there exists $t\geq 0$ and a policy $\pi$ such that $\nu (s,a) = \operatorname *{Pr}[s_t = s,a_t = a|s_0\sim \rho_0,\pi ]$ + +In other words, admissible distributions are distributions that can be generated by some policy under the given MDP. + +Assumption 5.2 (Concentratability coefficient). Given the dataset $D$ , let the distribution of the dataset be $\mu(s, a)$ . We assume that there exists $C < \infty$ s.t. for any admissible $\nu$ , $\frac{\nu(s, a)}{\mu(s, a)} \leq C$ , $\forall (s, a) \in S \times \mathcal{A}$ . + +The assumption means the distribution of the offline dataset should be able to include all the state-action pairs. Chen & Jiang (2019) gives the sample complexity of performing fitted Q iteration under this assumption. + +Theorem 5.3 (Theorem 2 of Chen & Jiang (2019)). Given a dataset $D$ with sample size $|D| = n$ and $\mathcal{F}$ satisfies completeness, i.e., $\forall f\in \mathcal{F},\mathcal{T}f\in \mathcal{F}$ , w.p. $\geq 1 - \delta$ , the output policy of Fitted $Q$ Iteration after $k$ iterations, $\pi_k$ , satisfies $v^{*} - v^{\pi_{k}}\leq \epsilon V_{\max}$ when $k\to \infty$ and $n = O\left(\frac{C\log\frac{|F|}{\delta}}{\epsilon^2(1 - \gamma)^4}\right)$ . + +We assume the size of the function class $|\mathcal{F}|$ is influenced by the dimensions of the state space and action space, i.e., $|\mathcal{F}| = g(|\mathcal{S}|,|\mathcal{A}|)$ . This assumption is reasonable because the complexity of function approximation is closely tied to the number of possible state-action pairs. Specifically, in a tabular setting, the size of the function class can be represented as: $|\mathcal{F}| = (|\mathcal{S}||\mathcal{A}|)^R$ , where $|\mathcal{S}|$ is the cardinality of the state space, $|\mathcal{A}|$ is the cardinality of the action space, and $R$ represents the range of possible values that the Q-function can take. If we do Q iteration without establishing the hierarchical structure, the sample complexity of the learning process is indicated by Thm. 5.3. + +In our setting, the high-level policy outputs not the actions but the skills, the low-level policy learns with weighted BC conditioned on the skill output by the high-level policy. To facilitate our analysis, we assume the length of skills is the same, denoted as $K$ . The learning process of the high-level policy is similar to fitted Q iteration except the action space is replaced with the skill space and the horizon changes correspondingly. Therefore, we get the sample complexity of high-level policy directly from Thm. 5.3. + +Corollary 5.4. Given a dataset $D$ with sample size $|D| = n$ and $\mathcal{F}$ satisfies completeness, w.p. $\geq 1 - \delta$ , the output policy of FQI after $k$ iterations, $\pi_k$ , satisfies $\hat{v}^* - v^{\pi_k} \leq \epsilon V_{\max}$ when $k \to \infty$ and $n = O\left(\frac{C \log \frac{g(|S|_k |\mathcal{Z}|)}{\delta}}{\epsilon^2 (1 - \gamma^K)^4}\right)$ , where $\hat{v}^*$ is the optimal policy conditioned on the low-level policy. + +Note that $v^{*}$ in Thm. 5.3 is replaced with $\hat{v}^{*}$ , this is because the quality of the skills is also an influence factor of the performance. Then we need to determine the difference between $\hat{v}^{*}$ and $v^{*}$ . + +Note that the low-level policy is trained by weighted behavior cloning, the optimal policy of weighted behavior cloning is Kostrikov et al. (2022): $\tilde{\pi}^{*}(a|s) \propto \mu(a|s)\exp\left(\beta(\hat{Q}(s,a)-\hat{V}(s))\right)$ . We denote the value induced by the optimal policy as $\tilde{v}^{*}$ . Therefore, $v^{*}-\hat{v}^{*}$ can be decomposed as $v^{*}-\tilde{v}^{*}+\tilde{v}^{*}-\hat{v}^{*}$ . Let $\Delta(\beta,\hat{Q},\hat{V})$ denote $v^{*}-\tilde{v}^{*}$ , this is because this term is only related to $\beta$ , $\hat{Q}$ and $\hat{V}$ . If $\hat{Q}=Q^{*}$ , $\hat{V}=V^{*}$ , and $\beta \to \infty$ , then $\tilde{v}^{*} \to v^{*}$ . The last term we need to determine is $\tilde{v}^{*}-\hat{v}^{*}$ . We give the result here, and the proof is deferred to Appx. A. + +Lemma 5.5. For any $\tilde{\pi}^{*}\in \Pi$ , weighted BC algorithm ensures that with probability at least $1 - \delta$ + +$$ +\tilde {v} ^ {*} - \hat {v} \leq O (1) \cdot \sqrt {1 + \hat {Q} _ {V a r} (\beta)} \frac {H}{K} \sqrt {\frac {\sigma_ {K} ^ {2} \log (| \Pi | \delta^ {- 1})}{n}} + O (R \log (n)) \cdot (1 + \hat {Q} _ {V a r} (\beta)) \frac {H}{K} \frac {\log (| \Pi | \delta^ {- 1})}{n}, +$$ + +where $\hat{v}$ is the value function induced by the learnt policy $\hat{\pi}$ , $n$ is the number of samples in the dataset, $\hat{Q}_{Var} = \text{Var}\left(\frac{\exp(\beta(\hat{Q}(s,a) - \hat{V}(s)))}{Z(s)}\right)$ , $Z(s)$ is the normalization factor, and + +$$ +\sigma_ {K} ^ {2} = \sum_ {h = 1} ^ {K} \mathbb {E} ^ {\pi^ {*}} \left[ \left(Q _ {t} ^ {\pi^ {*}} \left(s _ {t}, \pi^ {*} (s _ {t})\right) - Q _ {t} ^ {\pi^ {*}} \left(s _ {t}, a _ {t}\right)\right) ^ {2} \right]. +$$ + +Note that a semantic skill implies temporal correlations of action sequences, which means the policy space of a semantic skill is not the same as the original policy space. For ease of discussion, we can make the following assumptions: + +1. Original policy space (no temporal correlation assumptions): In the original policy space, there is no temporal correlation between action sequences. The agent can freely choose each action without considering the relationships between actions over time. This space is denoted as $\Pi_{\mathrm{ori}}$ . + +2. Semantic skill policy space (with temporal correlation): Introducing temporal correlation means that actions at the current time step are influenced not only by the current state but also by previous actions. This will reduce the size of the strategy space, as not all action sequences are valid. + +Suppose the autocorrelation coefficient of action sequences generated by the policy belongs to the new policy space is larger than $\alpha$ , then the new space can be denoted as $\Pi_{\alpha} = \{\pi \in \Pi_{\mathrm{ori}} | \rho(\pi) > \alpha\}$ , where $\rho(\pi)$ is the autocorrelation coefficient of the action sequence generated by policy $\pi$ . + +Combine the results together, we have + +Theorem 5.6. Given a dataset $D$ with sample size $n$ , under the hierarchical learning process, with probability as least $1 - \delta$ , + +$$ +\begin{array}{l} v ^ {*} - v ^ {\pi_ {k}} \leq O \left(\sqrt {\frac {C \log \frac {| g (| S | , | Z |)}{\delta}}{(1 - \gamma^ {K}) ^ {4} n}}\right) \cdot V _ {\max } + O (1) \cdot \sqrt {1 + \hat {Q} _ {V a r} (\beta)} \frac {H}{K} \sqrt {\frac {\sigma_ {K} ^ {2} \log (| \Pi_ {\alpha} | \delta^ {- 1})}{n}} \\ + O (R \log (n)) \cdot (1 + \hat {Q} _ {V a r} (\beta)) \frac {H}{K} \frac {\log (| \Pi_ {\alpha} | \delta^ {- 1})}{n} + \Delta (\beta , \hat {Q}, \hat {V}). \\ \end{array} +$$ + +Compare Thm. 5.6 with Thm. 5.3, the hierarchical structure reduces the size of $Q$ function class from $g(|S|, |\mathcal{A}|)$ to $g(|S|, |\mathcal{Z}|)$ , and the scale induced by horizon is reduced from $(1 - \gamma)^4$ to $(1 - \gamma^K)^4$ . However, it also introduces three other terms. Generally, $\Delta(\beta, \hat{Q}, \hat{V})$ is not large, as the weighted BC algorithm has already achieved good performance (Nair et al., 2020; Zhao et al., 2022; Kostrikov et al., 2022) and $\Delta(\beta, \hat{Q}, \hat{V})$ is even smaller because there is no BC loss and the high-level policy is assumed as optimal. If the hierarchical structure of the problem is good, for example, the action sequence of the skill has high temporal correlation and the middle two terms are also small, then the performance bound of hierarchical methods is better than the original one. + +Furthermore, Thm. 5.6 provides us with an approach to determine the performance of different hierarchical methods. If the action sequence of the learned skill has high temporal correlation, $|\Pi_{\alpha}|$ can be much smaller, then the performance bound is much better. Intuitively, the skills with semantic information are more temporal correlated, which explains why our method can be better than previous methods. We test the temporal correlation in the experiment Sec. 6.5. + +Table 1: Performance on Franka Kitchen, MiniGrid and Crafter environments, averaged over 5 random seeds. The best results are bolded and the second-best results are underlined. + +
Task NameBCCQLIQLRvSGCSLWGCSLLDCQVanTA (Ours)
kitchen-complete-v065.043.862.550.258.657.752.869.2±8.5
kitchen-partial-v038.050.146.360.355.059.467.871.2±5.7
kitchen-mixed-v051.552.451.051.456.249.662.368.5±4.4
MiniGrid-DoorKey-6x6-complete-v00.920.670.910.890.820.850.860.92±0.03
MiniGrid-DoorKey-6x6-mixed-v00.700.610.720.670.590.790.720.80±0.17
MiniGrid-DoorKey-8x8-complete-v00.880.430.890.940.870.760.700.92±0.07
MiniGrid-DoorKey-8x8-mixed-v00.430.300.470.320.390.440.380.51±0.18
MiniGrid-KeyCorridorS3R3-complete-v00.470.620.720.640.550.570.690.81±0.06
MiniGrid-KeyCorridorS3R3-mixed-v00.090.230.510.420.210.230.380.61±0.12
MiniGrid-RedBlueDoors-6x6-complete-v00.800.510.900.780.730.610.640.85±0.11
MiniGrid-RedBlueDoors-6x6-mixed-v00.640.470.690.420.720.510.440.73±0.20
Crafter-partial2.691.732.752.11————0.965.46
+ +# 6 EXPERIMENTS + +In this section, we empirically validate the effectiveness of VanTA in providing a hierarchical structure that improves agent learning performance. Sec. 6.1 evaluates the performance of offline RL methods against hierarchical goal-conditioned approaches on tasks with hierarchical sub-tasks. Sec. 6.2 explains VanTA's superior performance by showcasing how it segments trajectories into interpretable skills, outperforming traditional VQ methods. Sec. 6.3 reinforces this with an ablation study, comparing codebooks with and without VLM guidance, showing that VLM guidance enhances learning, while its absence hinders performance. Sec. 6.4 demonstrates VanTA's strength in data-scarce scenarios, leveraging pretrained VLM knowledge to augment datasets and improve results. Finally, Sec. 6.5 verifies our theory and demonstrate the higher temporal correlation of VanTA. For experimental benchmarks, we conduct our experiments on three long-horizon domains: Franka Kitchen (Gupta et al., 2019) for manipulation tasks, MiniGrid (Chevalier-Boisvert et al., 2023) + +![](images/31a0ad1a7b71487a5624c8763e2a8d50467f3c5feea70a89a03faa6abd98752e.jpg) +Figure 2: Skill extraction results without VLM guidance; no clear semantic meaning in each skill. + +![](images/4c9897398e118eada7396e73f8f45498e24b4c71cc707a0eb68a401fbc30a15d.jpg) +Figure 3: Skill extraction results using VanTA: sequentially 1) open the microwave, 2) move the kettle, 3) rotate the knob, and 4) open the cabinet. + +for navigation, and Crafter (Hafner, 2021), an open-world survival game. Further implementation details, including model architectures and hyperparameter settings, are provided in Appx. B.5.4. We first introduce the environment setup. + +Franka Kitchen: This environment is initially introduced in Gupta et al. (2019). In our experiments, we use offline data from the Fu et al. (2020) benchmark, which includes three types of datasets collected from human demonstrations, with visual observations rendered using OpenAI's Gym framework rendering functions (Brockman et al., 2016) as input for VLMs. + +MiniGrid: Chevalier-Boisvert et al. (2023) is a lightweight grid-world environment suite with OpenAI Gym interfaces. All tasks fall within the grid navigation domain, where the agent starts from an initial position, picks up an object, and navigates to the goal destination with sparse rewards. + +Crafter: (Hafner, 2021) is a 2D open-world survival game benchmark with visual inputs that evaluates a wide range of general abilities within a single environment. We collect data using intermediate model training checkpoints from online reinforcement learning with PPO (Schulman et al., 2017). + +# 6.1 EVALUATION ON BENCHMARKS + +We empirically evaluate our two-level policy extraction method on diverse tasks, with all of them providing sparse reward feedback. Prior approaches include typical offline reinforcement learning or imitation learning methods including Behavior Cloning (BC), Conservative Q-Learning (CQL) (Kumar et al., 2020), and Implicit Q-Learning (IQL) (Kostrikov et al., 2022), along with goal-conditioned variants RvS (Emmons et al., 2022), GCSL (Ghosh et al., 2021), WGCSL (Yang et al., 2022) and LDCQ (Venkatraman et al., 2024), which use goal-setting methods like hindsight goal relabeling or prior-shaped latent space. As shown in Fig. 1, VanTA outperforms the baselines in most tasks, which demonstrates that the extracted primitive skills aid in policy learning. Since Crafter is an open-world, vision-based environment, manually setting a desirable observation as the + +goal in GCSL and WGCSL is infeasible. Investigating the Kitchen tasks, when performing the final subtask of opening the cabinet, the agent selects actions from a higher-level, discrete and internally-compact skill space, where the robot arm has already been raised, rather than searching through the full original action space. In Crafter, which involves more subtasks, the extracted skills motivate the agent to explore a wider range of tasks, as demonstrated in Tab. 6. A similar conclusion can be drawn in the KeyCorridor environment, which is comparatively more complex in MiniGrid. + +# 6.2 VISUALIZATION OF SEGMENTATION RESULT + +In this section, we compare the segmentation results with the vanilla VQ method to demonstrate VanTA's superiority in interpretable skill extraction. In the kitchen-complete-v0 task, the agent sequentially opens the microwave door, moves the kettle, turns on the light, and finally opens the cabinet. The skill assignment results, shown in Fig. 3, display the first two observations and the terminal observation for each skill, highlighting how VanTA reduces the incoherence of primitive skills. In contrast, the vanilla VQ method may abruptly shift to a new skill in successive time steps, as seen during the microwave door opening in Fig. 2. Intuitively, although VQ occasionally provides imperfect initialization, VLM intervention quickly corrects these erroneous assignments and merges meaningful skills. Additional segmentation visualizations can be found in Appx. B.5.1. + +# 6.3 ABLATION + +VanTA v.s. VanTA w/o VLM guidance We next evaluate whether VLM guidance significantly improves learning in hierarchical models. To test this, we replace the indices assigned to primitive skills with those from the VanTA without VLM guidance method. As shown in Fig. 4, in the Franka Kitchen environment, VLM-guided skills are conducive to policy learning, demonstrating superiority across all environments. When compared with the performance of offline reinforcement learning baselines shown in Tab. 1, the performance of using non-VLM-guided extracted skill contexts to supplement state information for policy learning even shows a drop. This suggests that an erroneous or broken codebook introduces challenges in two-level policy learning, especially making it more difficult to learn primitive skills. Besides, using + +irrational primitive skills to augment the state also may not be beneficial. Additional ablation results are available in Appx.B.5.3. + +![](images/6783e1d54ef6b0a59db4e3a343494c707b0d746a913b78e876138f79559cba1d.jpg) +Figure 4: Comparison of normalized return between VanTA and VanTA without VLM guidance in the Franka Kitchen environment. + +# 6.4 EXPERIMENTS IN LOW-DATA REGIME + +Leveraging the rich knowledge pretrained in VLMs enhances the efficiency of reinforcement learning, as it is a supplement to the limited available data. We further investigate whether VanTA enables more efficient learning with limited data using varying data ratios: $100\%$ , $50\%$ , and $10\%$ . As shown in Tab. 2, VanTA maintains its performance advantage and degrades relatively more slowly as the available data decreases. Notably, on the kitchen-complete-v0 task with only $10\%$ of the data, the smallest dataset in our experiment, VanTA achieves a $28.6\%$ improvement, highlighting its ability to boost the efficiency of offline reinforcement learning. + +# 6.5 REDUCTION IN COMPLEXITY + +As discussed in Sec. 5, the performance of the algorithm is influenced by the size of the policy space it identifies. This size is largely determined by temporal correlations in the data. Therefore, in this section, we calculate the temporal correlation to assess the identified policy space. We assume that the original policy space is derived from the original dataset. To analyze this, we randomly sample + +Table 2: Performance with reduced offline data usage in Kitchen, averaged over 5 random seeds. + +
Task NameBCCQLIQLRvSGCSLWGCSLLDCQVanTA (Ours)
kitchen-complete-v0 (100%)65.043.862.550.258.657.752.869.2±8.5
kitchen-complete-v0 (50%)23.618.635.436.028.329.532.544.2±6.2
kitchen-complete-v0 (10%)7.62.713.35.07.39.112.517.1±7.7
kitchen-partial-v0 (100%)38.050.146.360.355.059.467.871.2±5.7
kitchen-partial-v0 (50%)27.112.839.715.612.925.817.742.8±5.1
kitchen-partial-v0 (10%)19.19.233.219.514.236.921.337.5±3.3
kitchen-mixed-v0 (100%)51.552.451.051.456.249.662.368.5±4.4
kitchen-mixed-v0 (50%)30.414.425.520.816.931.421.245.8±5.2
kitchen-mixed-v0 (10%)21.28.723.420.015.227.811.429.9±3.0
+ +fractions of the trajectories from the dataset and calculate their temporal correlation. This allows us to obtain the distribution of temporal correlations within the original policy space. For various hierarchical algorithms, including VanTA and VanTA without VLM guidance, we similarly calculate the temporal correlations of the identified skills. By comparing the range of temporal correlations from these algorithms with the original distribution, we can estimate the ratio between the size of the policy space identified by each algorithm and that of the original policy space. + +To approximate the distribution of the temporal correlation of the original policy space, we sample 1000 fractions of trajectories and use Kernel Density Estimation (KDE). We also use 100 samples to approximate the range of temporal correlation of low-level policies. The temporal correlation is measured by the autocorrelation coefficient. For an action sequence $\{a_1, a_2, \ldots, a_K\}$ , the autocorrelation coefficient is defined as: $r_k = \left( \sum_{t=k+1}^{K} (a_t - \bar{a})(a_{t-k} - \bar{a}) \right) / \sum_{t=1}^{K} (a_t - \bar{a})^2$ . In the experiment, we set $k = 1$ , with the results presented in Tab. 3. VanTA achieves a higher autocorrelation coefficient than the non-VLM-guided version across all three environments. On average, the policy space is reduced to $64\%$ without VLM guidance and further to $54\%$ with VLM guidance. This reduction in policy space complexity explains VanTA's superior performance and supports the theory discussed in Sec. 5. + +Table 3: The comparison of the policy spaces of the low-level policy learned using VanTA without VLM guidance alone and those learned using VanTA. + +
Task NameVanTA w/o VLMVanTA
r1Ratior1Ratio
kitchen-complete-v00.4260%0.6941%
kitchen-partial-v00.4480%0.5969%
kitchen-mixed-v00.6753%0.6852%
+ +# 7 CONCLUSION + +Discussion. We introduce VanTA, a method for extracting discrete, task-relevant and semantic skills from offline data with the guidance of pretrained Vision-Language Models (VLMs), which improves learning efficiency. This grounding of the codebook in semantic knowledge facilitates subsequent offline RL. In future work, we primarily aim to explore temporal abstraction with VLM for offline preference learning (Zhang et al., 2024) and cooperative multi-agent systems (Yuan et al., 2023). Our initialization technique has significantly reduced query complexity, which we aim to reduce further in future work. However, VanTA has certain limitation. In our experiments, proper initialization is essential for effective VLM guidance; without it, significant query complexity can arise, making it difficult to extract interpretable meaning from a single observation. Additionally, if mode collapse occurs, a common issue in unsupervised learning (Srivastava et al., 2017), VLM is unable to rectify these errors. Therefore, in future work, we aim to explore simpler yet more effective initialization methods. + +# REPRODUCIBILITY STATEMENT + +In this study, to ensure the reproducibility of our approach, we provide key information from our submission as follows. + +1. Training Algorithm. We provide the architecture in Sec. 4 and pseudo-code of our approach in Appx. 1. +2. Source Code. We have submitted the source code of our approach in the supplementary materials. For BC, IQL (Kostrikov et al., 2022), CQL (Kumar et al., 2020) in Tab. 1, we apply the code from https://github.com/yihaosun1124/OfflineRL-Kit. For the other baselines in Sec. 6, we follow the official code and build upon them. We use the code from Emmons et al. (2022) for RvS. available at https://github.com/scottemmons/reinforcement-learning-via-supervised-learning. For GCSL (Ghosh et al., 2021) and WGCSL (Yang et al., 2022), we modify upon https://github.com/YangRui2015/AWGCSL. For LDCQ (Venkatram et al., 2024), we build upon the official code, available at https://github.com/ldcq/ldcq. +3. Experimental Details. We list the detailed experiment settings, computational resources and hyperparameters in Appx. B +4. Theoretical Proofs. We provide the missing proofs in Appx. A. + +# AUTHOR CONTRIBUTIONS + +Y. Y.: led the direction, oversaw the project; +T.-S. L., X.-H. L., R. C.: designed the method; +X.-H. L.: proved the theory; +T.-S. L., P. W.: implemented the codes; +T.-S. L.: designed the experiments; +L. J.: conducted experiments; +T.-S. L.: analyzed the results; +T.-S. L., R. C.: wrote the paper; +P. W., Z. Z.: revised the paper; +T.-S. L.: discussed and wrote the response; + +# ACKNOWLEDGEMENTS + +This work was supported by the NSFC (62495093) and Jiangsu SF (BK20243039). + +# REFERENCES + +Anurag Ajay, Aviral Kumar, Pulkit Agrawal, Sergey Levine, and Ofir Nachum. OPAL: offline primitive discovery for accelerating offline reinforcement learning. In Proceedings of the 9th International Conference on Learning Representations (ICLR'21), Virtual Event, 2021. +Greg Brockman, Vicki Cheung, Ludwig Pettersson, Jonas Schneider, John Schulman, Jie Tang, and Wojciech Zaremba. Openai gym. CoRR, abs/1606.01540, 2016. +Anthony Brohan, Yevgen Chebotar, Chelsea Finn, Karol Hausman, Alexander Herzog, Daniel Ho, Julian Ibarz, Alex Irpan, Eric Jang, Ryan Julian, et al. Do as i can, not as i say: Grounding language in robotic affordances. In Proceedings of the 7th Annual Conference on Robot Learning (CoRL'23), Atlanta, USA, 2023. +Arthur Tucker, Luis Figueredo, Sami Haddadin, Ashish Kapoor, Shuang Ma, Sai Vemprala, and Rogerio Bonatti. Latte: Language trajectory transformer. In 2023 IEEE International Conference on Robotics and Automation (ICRA'23), London, UK, 2023. + +Jinglin Chen and Nan Jiang. Information-theoretic considerations in batch reinforcement learning. In Proceedings of the 36th International Conference on Machine Learning (ICML'19), Long Beach, USA, 2019. +Ruifeng Chen, Xu-Hui Liu, Tian-Shuo Liu, Shengyi Jiang, Feng Xu, and Yang Yu. Foresight distribution adjustment for off-policy reinforcement learning. In Proceedings of the 23rd International Conference on Autonomous Agents and Multiagent Systems (AAMAS'24), pp. 317-325, Auckland, New Zealand, 2024. +Maxime Chevalier-Boisvert, Bolun Dai, Mark Towers, Rodrigo Perez-Vicente, Lucas Willems, Salem Lahlou, Suman Pal, Pablo Samuel Castro, and Jordan K. Terry. Minigrid & miniworld: Modular & customizable reinforcement learning environments for goal-oriented tasks. In Advances in Neural Information Processing Systems 36: Annual Conference on Neural Information Processing Systems 2023 (NeurIPS'23), New Orleans, USA, 2023. +Thomas G. Dietterich. The MAXQ method for hierarchical reinforcement learning. In Jude W. Shavlik (ed.), Proceedings of the 15th International Conference on Machine Learning (ICML'98), Madison, Wisconsin, USA, 1998. +Yilun Du, Sherry Yang, Pete Florence, Fei Xia, Ayzaan Wahid, Brian Ichter, Pierre Sermanet, Tianhe Yu, Pieter Abbeel, Joshua B. Tenenbaum, Leslie Pack Kaelbling, Andy Zeng, and Jonathan Tompson. Video language planning. In Proceedings of the 12th International Conference on Learning Representations (ICLR'24), Vienna, Austria, 2024. +Scott Emmons, Benjamin Eysenbach, Ilya Kostrikov, and Sergey Levine. Rvs: What is essential for offline RL via supervised learning? In The Tenth International Conference on Learning Representations (ICLR'22), Virtual Event, 2022. +Benjamin Eysenbach, Abhishek Gupta, Julian Ibarz, and Sergey Levine. Diversity is all you need: Learning skills without a reward function. In Proceedings of the 7th International Conference on Learning Representations (ICLR'19), New Orleans, USA, 2019. +Dylan J. Foster, Adam Block, and Dipendra Misra. Is behavior cloning all you need? understanding horizon in imitation learning. CoRR, abs/2407.15007, 2024. +Haotian Fu, Pratyusha Sharma, Elias Stengel-Eskin, George Konidaris, Nicolas Le Roux, Marc-Alexandre Côté, and Xingdi Yuan. Language-guided skill learning with temporal variational inference. In Proceedings of the 41st International Conference on Machine Learning (ICML'24), Vienna, Austria, 2024. +Justin Fu, Aviral Kumar, Ofir Nachum, George Tucker, and Sergey Levine. D4RL: datasets for deep data-driven reinforcement learning. CoRR, abs/2004.07219, 2020. +Zijie Geng, Jie Wang, Ziyan Liu, Siyuan Xu, Zhentao Tang, Mingxuan Yuan, Jianye Hao, Yongdong Zhang, and Feng Wu. Reinforcement learning within tree search for fast macro placement. In *Forty-first International Conference on Machine Learning (ICML'24)*, Vienna, Austria, 2024. +Dibya Ghosh, Abhishek Gupta, Ashwin Reddy, Justin Fu, Coline Manon Devin, Benjamin Eysenbach, and Sergey Levine. Learning to reach goals via iterated supervised learning. In Proceedings of the 9th International Conference on Learning Representations (ICLR'21), Virtual Event, 2021. +Christian Gumbsch, Noor Sajid, Georg Martius, and Martin V. Butz. Learning hierarchical world models with adaptive temporal abstractions from discrete latent dynamics. In The Twelfth International Conference on Learning Representations (ICLR'24), Vienna, Austria, 2024. +Abhishek Gupta, Vikash Kumar, Corey Lynch, Sergey Levine, and Karol Hausman. Relay policy learning: Solving long-horizon tasks via imitation and reinforcement learning. In Leslie Pack Kaelbling, Danica Kragic, and Komei Sugiura (eds.), Proceedings of the 3rd Annual Conference on Robot Learning (CoRL'19), Osaka, Japan, 2019. +Tuomas Haarnoja, Aurick Zhou, Pieter Abbeel, and Sergey Levine. Soft actor-critic: Off-policy maximum entropy deep reinforcement learning with a stochastic actor. In Proceedings of the 35th International Conference on Machine Learning (ICML'18), Stockholm, Sweden, 2018. + +Danijar Hafner. Benchmarking the spectrum of agent capabilities. CoRR, abs/2109.06780, 2021. +Wenlong Huang, Pieter Abbeel, Deepak Pathak, and Igor Mordatch. Language models as zero-shot planners: Extracting actionable knowledge for embodied agents. In Proceedings of the 39th International Conference on Machine Learning (ICML'22), Baltimore, USA, 2022. +Wenlong Huang, Fei Xia, Ted Xiao, Harris Chan, Jacky Liang, Pete Florence, Andy Zeng, Jonathan Thompson, Igor Mordatch, Yevgen Chebotar, et al. Inner monologue: Embodied reasoning through planning with language models. In Proceedings of the 7th Annual Conference on Robot Learning (CoRL'23), Atlanta, USA, 2023. +Zhengyao Jiang, Tianjun Zhang, Michael Janner, Yueying Li, Tim Rocktäschel, Edward Grefenstette, and Yuandong Tian. Efficient planning in a compact latent action space. In Proceedings of the 11th International Conference on Learning Representations (ICLR'23), Kigali, Rwanda, 2023. +Ilya Kostrikov, Ashvin Nair, and Sergey Levine. Offline reinforcement learning with implicit q-learning. In Proceedings of the 10-th International Conference on Learning Representations (ICLR'22), Virtual Event, 2022. +Tejas D. Kulkarni, Karthik Narasimhan, Ardavan Saeedi, and Josh Tenenbaum. Hierarchical deep reinforcement learning: Integrating temporal abstraction and intrinsic motivation. In Daniel D. Lee, Masashi Sugiyama, Ulrike von Luxburg, Isabelle Guyon, and Roman Garnett (eds.), Annual Conference on Neural Information Processing Systems (NeurIPS'16), Barcelona, Spain, 2016. +Aviral Kumar, Aurick Zhou, George Tucker, and Sergey Levine. Conservative q-learning for offline reinforcement learning. In Advances in Neural Information Processing Systems 33 (NeurIPS'20), Virtual Event, 2020. +Youngwoon Lee, Shao-Hua Sun, Sriram Somasundaram, Edward S. Hu, and Joseph J. Lim. Composing complex skills by learning transition policies. In Proceedings of the 7th International Conference on Learning Representations (ICLR'19), New Orleans, USA, 2019. +Zhixuan Liang, Yao Mu, Hengbo Ma, Masayoshi Tomizuka, Mingyu Ding, and Ping Luo. Skilldiffuser: Interpretable hierarchical planning via skill abstractions in diffusion-based task execution. In IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR'24), Seattle, USA, 2024. +Haohong Lin, Radu Corcodel, and Ding Zhao. Generalize by touching: Tactile ensemble skill transfer for robotic furniture assembly. In IEEE International Conference on Robotics and Automation (ICRA'24), 2024. +Jessy Lin, Yuqing Du, Olivia Watkins, Danijar Hafner, Pieter Abbeel, Dan Klein, and Anca Dragan. Learning to model the world with language, 2023. +Hao Liu, Lisa Lee, Kimin Lee, and Pieter Abbeel. Instruction-following agents with multimodal transformer. CoRR, abs/2210.13431, 2022. +Xu-Hui Liu, Tian-Shuo Liu, Shengyi Jiang, Ruifeng Chen, Zhilong Zhang, Xinwei Chen, and Yang Yu. Energy-guided diffusion sampling for offline-to-online reinforcement learning. In Proceedings of the 41st International Conference on Machine Learning (ICML'24), Vienna, Austria, 2024. +Oier Mees, Jessica Borja-Diaz, and Wolfram Burgard. Grounding language with visual affordances over unstructured data. In 2023 IEEE International Conference on Robotics and Automation (ICRA'23), London, UK, 2023. +Vivek Myers, Andre Wang He, Kuan Fang, Homer Rich Walke, Philippe Hansen-Estruch, Ching-An Cheng, Mihai Jalobeanu, Andrey Kolobov, Anca Dragan, and Sergey Levine. Goal representations for instruction following: A semi-supervised language interface to control. In Proceedings of the 7th Annual Conference on Robot Learning (CoRL'23), Atlanta, USA, 2023. + +Ofir Nachum, Shixiang Gu, Honglak Lee, and Sergey Levine. Near-optimal representation learning for hierarchical reinforcement learning. In Proceedings of the 7th International Conference on Learning Representations (ICLR'19), New Orleans, USA, 2019. +Ashvin Nair, Murtaza Dalal, Abhishek Gupta, and Sergey Levine. Accelerating online reinforcement learning with offline datasets. CoRR, abs/2006.09359, 2020. +Taewook Nam, Shao-Hua Sun, Karl Pertsch, Sung Ju Hwang, and Joseph J. Lim. Skill-based meta-reinforcement learning. In Proceedings of the 10th International Conference on Learning Representations (ICLR'22), Virtual Event, 2022. +Junhyuk Oh, Satinder Singh, Honglak Lee, and Pushmeet Kohli. Zero-shot task generalization with multi-task deep reinforcement learning. In Doina Precup and Yee Whye Teh (eds.), Proceedings of the 34th International Conference on Machine Learning (ICML'17), Sydney, Australia, 2017. +Jing-Cheng Pang, Pengyuan Wang, Kaiyuan Li, Xiong-Hui Chen, Jiacheng Xu, Zongzhang Zhang, and Yang Yu. Language model self-improvement by reinforcement learning contemplation. In Proceedings of the 12th International Conference on Learning Representations (ICLR'24), Vienna, Austria, 2024. +Seohong Park, Dibya Ghosh, Benjamin Eysenbach, and Sergey Levine. HIQL: offline goal-conditioned RL with latent states as actions. In Alice Oh, Tristan Naumann, Amir Globerson, Kate Saenko, Moritz Hardt, and Sergey Levine (eds.), Advances in Neural Information Processing Systems 36: Annual Conference on Neural Information Processing Systems 2023 (NeurIPS'23), New Orleans, USA, 2023. +Andi Peng, Belinda Z. Li, Ilia Sucholutsky, Nishanth Kumar, Julie A. Shah, Jacob Andreas, and Andreae Bobu. Adaptive language-guided abstraction from contrastive explanations. In Proceedings of the 8th Annual Conference on Robot Learning (CoRL'24), Munich, Germany, 2024. +Xue Bin Peng, Erwin Coumans, Tingnan Zhang, Tsang-Wei Edward Lee, Jie Tan, and Sergey Levine. Learning agile robotic locomotion skills by imitating animals. In Proceedings of the 14th Robotics: Science and Systems (RSS'20), Virtual Event, 2020. +Karl Pertsch, Youngloon Lee, and Joseph J. Lim. Accelerating reinforcement learning with learned skill priors. In Jens Kober, Fabio Ramos, and Claire J. Tomlin (eds.), Proceedings of the 4th Annual Conference on Robot Learning (CoRL'20), Virtual Event, 2020. +Ali Razavi, Aäron van den Oord, and Oriol Vinyals. Generating diverse high-fidelity images with VQ-VAE-2. In Hanna M. Wallach, Hugo Larochelle, Alina Beygelzimer, Florence d'Alché-Buc, Emily B. Fox, and Roman Garnett (eds.), Advances in Neural Information Processing Systems 32: Annual Conference on Neural Information Processing Systems 2019 (NeurIPS'19), Vancouver, Canada, 2019. +Aurko Roy, Ashish Vaswani, Arvind Neelakantan, and Niki Parmar. Theory and experiments on vector quantized autoencoders. CoRR, abs/1805.11063, 2018. +John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms. CoRR, abs/1707.06347, 2017. +Archit Sharma, Shixiang Gu, Sergey Levine, Vikash Kumar, and Karol Hausman. Dynamics-aware unsupervised discovery of skills. In Proceedings of the 8th International Conference on Learning Representations (ICLR'20), Addis Ababa, Ethiopia, 2020. +David Silver, Aja Huang, Chris J. Maddison, Arthur Guez, Laurent Sifre, George van den Driessche, Julian Schrittwieser, Ioannis Antonoglou, Vedavyas Panneershelvam, Marc Lanctot, Sander Dieleman, Dominik Grewe, John Nham, Nal Kalchbrenner, Ilya Sutskever, Timothy P. Lillicrap, Madeleine Leach, Koray Kavukcuoglu, Thore Graepel, and Demis Hassabis. Mastering the game of go with deep neural networks and tree search. Nat., 529, 2016. +Avi Singh, Huihan Liu, Gaoyue Zhou, Albert Yu, Nicholas Rhinehart, and Sergey Levine. Parrot: Data-driven behavioral priors for reinforcement learning. In Proceedings of the 9th International Conference on Learning Representations (ICLR'21), Virtual Event, 2021. + +Akash Srivastava, Lazar Valkov, Chris Russell, Michael U. Gutmann, and Charles Sutton. VEEGAN: reducing mode collapse in gans using implicit variational learning. In Isabelle Guyon, Ulrike von Luxburg, Samy Bengio, Hanna M. Wallach, Rob Fergus, S. V. N. Vishwanathan, and Roman Garnett (eds.), Advances in Neural Information Processing Systems 30: Annual Conference on Neural Information Processing (NeurIPS'17), Long Beach, CA, 2017. +Richard S Sutton and Andrew G Barto. Reinforcement learning: An introduction. MIT press, 2018. +Richard S. Sutton, Doina Precup, and Satinder Singh. Between mdps and semi-mdps: A framework for temporal abstraction in reinforcement learning. Artif. Intell., 112, 1999. +Aäron van den Oord, Oriol Vinyals, and Koray Kavukcuoglu. Neural discrete representation learning. In Isabelle Guyon, Ulrike von Luxburg, Samy Bengio, Hanna M. Wallach, Rob Fergus, S. V. N. Vishwanathan, and Roman Garnett (eds.), Advances in Neural Information Processing Systems 30: Annual Conference on Neural Information Processing Systems (NeurIPS'17), Long Beach, USA, 2017. +Siddarth Venkatraman, Shivesh Khaitan, Ravi Tej Akella, John Dolan, Jeff Schneider, and Glen Berseth. Reasoning with latent diffusion in offline reinforcement learning. In Proceedings of the 12th International Conference on Learning Representations (ICLR'24), Vienna, Austria, 2024. +Valentin Villecloze, Harry J. Braviner, Panteha Naderian, Chris J. Maddison, and Gabriel Loaiza-Ganem. Bayesian nonparametrics for offline skill discovery. In Proceedings of the 39th International Conference on Machine Learning (ICML'22), Baltimore, USA, 2022. +Zhihai Wang, Jie Wang, Qi Zhou, Bin Li, and Houqiang Li. Sample-efficient reinforcement learning via conservative model-based actor-critic. Proceedings of the AAAI Conference on Artificial Intelligence (AAAI'22), 2022. +Zhihai Wang, Jie Wang, Dongsheng Zuo, Yunjie Ji, Xinli Xia, Yuzhe Ma, Jianye Hao, Mingxuan Yuan, Yongdong Zhang, and Feng Wu. A hierarchical adaptive multi-task reinforcement learning framework for multiplier circuit design. In Proceedings of the 41st International Conference on Machine Learning (ICML'24), Vienna, Austria, 2024. +Zihao Wang, Shaofei Cai, Guanzhou Chen, Anji Liu, Xiaojian Ma, Yitao Liang, and Team CraftJarvis. Describe, explain, plan and select: interactive planning with large language models enables open-world multi-task agents. In Proceedings of the 37th International Conference on Neural Information Processing Systems (NeurIPS'23), New Orleans, USA, 2023. +Danfei Xu, Suraj Nair, Yuke Zhu, Julian Gao, Animesh Garg, Li Fei-Fei, and Silvio Savarese. Neural task programming: Learning to generalize across hierarchical tasks. In 2018 IEEE International Conference on Robotics and Automation (ICRA'18), Brisbane, Australia, 2018. +Rui Yang, Yiming Lu, Wenzhe Li, Hao Sun, Meng Fang, Yali Du, Xiu Li, Lei Han, and Chongjie Zhang. Rethinking goal-conditioned supervised learning and its connection to offline RL. In The 10th International Conference on Learning Representations (ICLR'22), Virtual Event, 2022. +Lei Yuan, Ziqian Zhang, Lihe Li, Cong Guan, and Yang Yu. A survey of progress on cooperative multi-agent reinforcement learning in open environment. CoRR, abs/2312.01058, 2023. +Daochen Zha, Jingru Xie, Wenye Ma, Sheng Zhang, Xiangru Lian, Xia Hu, and Ji Liu. Douzero: Mastering doudizhu with self-play deep reinforcement learning. In Marina Meila and Tong Zhang (eds.), Proceedings of the 38th International Conference on Machine Learning (ICML'21), Virtual Event, 2021. +Zhilong Zhang, Yihao Sun, Junyin Ye, Tian-Shuo Liu, Jiaji Zhang, and Yang Yu. Flow to better: Offline preference-based reinforcement learning via preferred trajectory generation. In The Twelfth International Conference on Learning Representations (ICLR'24), Vienna, Austria, 2024. +Yi Zhao, Rinu Boney, Alexander Ilin, Juho Kannala, and Joni Pajarinen. Adaptive behavior cloning regularization for stable offline-to-online reinforcement learning. CoRR, abs/2210.13846, 2022. + +# A MISSING PROOFS + +We state the proof of Lemma 5.5 here. Foster et al. (2024) provided the performance bound of BC algorithms: + +Theorem A.1 (Corollary 3.1 of (Foster et al., 2024)). For any $\pi^{*} \in \Pi$ , BC algorithm ensures that with probability at least $1 - \delta$ , + +$$ +v ^ {*} - \hat {v} \leq O (1) \cdot \sqrt {\frac {\sigma_ {K} ^ {2} \log (| \Pi | \delta^ {- 1})}{n}} + O (R \log (n)) \cdot \frac {\log (| \Pi | \delta^ {- 1})}{n}, +$$ + +where $\hat{v}$ is the value function induced by the learnt policy $\hat{\pi}$ , $n$ is the number of samples in the dataset, and + +$$ +\sigma_ {K} ^ {2} = \sum_ {h = 1} ^ {H} \mathbb {E} ^ {\pi^ {*}} \left[ \left(Q _ {t} ^ {\pi^ {*}} \left(s _ {t}, \pi^ {*} (s _ {t})\right) - Q _ {t} ^ {\pi^ {*}} \left(s _ {t}, a _ {t}\right)\right) ^ {2} \right]. +$$ + +Note that weighted BC does not share the same performance bound as BC. Given the same dataset, weighted BC has a higher variance, which increases the bound in Theorem A.1. Intuitively, applying weighted BC in a given dataset can be seen as applying BC in another data distribution at the expense of excluding the data that does not conform to the new data distribution. Therefore, to apply Theorem A.1 to our setting, we introduce the concept of effective sample size, under which the estimator of the unweighted distribution has the same variance as that of the weighted estimator under the original sample size. + +Lemma A.2. Suppose the distribution before adding weight is $p$ , and after adding weight is $q$ , the effective sample size is + +$$ +n _ {e f f} \approx \frac {n}{1 + \operatorname {V a r} \left(\frac {q}{p}\right)}, +$$ + +where $n$ is the size of the original dataset. + +Proof. 1. Consider an unbiased estimator $\hat{\mu}$ obtained through resampling: + +$$ +\hat {\mu} = \frac {1}{N} \sum_ {i = 1} ^ {n} w _ {i} X _ {i} +$$ + +Here, $X_{i}$ are the observed values, and $w_{i}$ are the weights reflecting the resampling. If all weights $w_{i}$ are equal (e.g., $w_{i} = 1$ ), this corresponds to simple random sampling. However, with weighted sampling, unequal weights can reduce the "effective" information in the sample. + +2. To derive effective sample size, we introduce the variance of the estimator: + +$$ +\operatorname {V a r} (\hat {\mu}) _ {\text {w e i g h t e d}} = \frac {1}{n ^ {2}} \sum_ {i = 1} ^ {n} w _ {i} ^ {2} \operatorname {V a r} (X _ {i}) = \frac {1}{n ^ {2}} \sum_ {i = 1} ^ {n} w _ {i} ^ {2} \sigma^ {2}, +$$ + +where $\sigma^2$ is the variance of a single sample $X_{i}$ + +In the absence of weighting (i.e., $w_{i} = 1$ ), the variance becomes: + +$$ +\operatorname {V a r} (\hat {\mu}) _ {\text {u n w e i g h t e d}} = \frac {\sigma^ {2}}{n}. +$$ + +3. Replace $n$ in $\mathrm{Var}(\hat{\mu})_{\mathrm{unweighted}}$ as $n_{\mathrm{eff}}$ , we make the two variances to be the same by tuning $n_{\mathrm{eff}}$ , i.e., + +$$ +\frac {1}{n ^ {2}} \sum_ {i = 1} ^ {n} w _ {i} ^ {2} \sigma^ {2} = \frac {\sigma^ {2}}{n _ {\mathrm {e f f}}} +$$ + +$$ +n _ {\mathrm {e f f}} = \frac {n ^ {2}}{\sum_ {i = 1} ^ {n} w _ {i} ^ {2}} +$$ + +In other words, effective sample size is the total sample size $n$ squared divided by the sum of the squared weights. + +4. Given that $w_{i} = \frac{q(x_{i})}{p(x_{i})}$ , we have: + +$$ +\frac {1}{N} \sum_ {i = 1} ^ {N} w _ {i} = 1 \quad \Rightarrow \quad \sum_ {i = 1} ^ {N} w _ {i} = N +$$ + +We need to evaluate the sum of the squared weights: + +$$ +\sum_ {i = 1} ^ {N} w _ {i} ^ {2} +$$ + +This can be related to the variance of the weights. Recall that the variance of a set of values is defined as: + +$$ +\operatorname {V a r} (w) = \frac {1}{N} \sum_ {i = 1} ^ {N} \left(w _ {i} - \overline {{w}}\right) ^ {2} +$$ + +where $\overline{w}$ is the mean of the weights. Given that the weights are normalized to have a mean of 1 $(\overline{w} = 1)$ , the variance simplifies to: + +$$ +\operatorname {V a r} (w) = \frac {1}{N} \sum_ {i = 1} ^ {N} \left(w _ {i} - 1\right) ^ {2} +$$ + +Expanding this: + +$$ +\operatorname {V a r} (w) = \frac {1}{N} \left(\sum_ {i = 1} ^ {N} w _ {i} ^ {2} - 2 \sum_ {i = 1} ^ {N} w _ {i} + \sum_ {i = 1} ^ {N} 1\right) = \frac {1}{N} \left(\sum_ {i = 1} ^ {N} w _ {i} ^ {2} - 2 N + N\right) = \frac {1}{N} \left(\sum_ {i = 1} ^ {N} w _ {i} ^ {2} - N\right) +$$ + +Rearranging to solve for $\sum w_{i}^{2}$ : + +$$ +\sum_ {i = 1} ^ {N} w _ {i} ^ {2} = N (1 + \operatorname {V a r} (w)) +$$ + +5. Recall the original formula: + +$$ +n _ {\mathrm {e f f}} = \frac {n ^ {2}}{\sum_ {i = 1} ^ {n} w _ {i} ^ {2}} +$$ + +Substitute $\sum w_{i}^{2} = n(1 + \operatorname {Var}(w))$ + +$$ +n _ {\mathrm {e f f}} = \frac {n ^ {2}}{n (1 + \operatorname {V a r} (w))} = \frac {n}{1 + \operatorname {V a r} (w)} +$$ + +Thus, we obtain: + +$$ +n _ {\mathrm {e f f}} = \frac {n}{1 + \operatorname {V a r} \left(\frac {q (x)}{p (x)}\right)} +$$ + +![](images/35886b41f2f8e8e140998bab363a380c3d494b86f05a579fc9283de656aec2da.jpg) + +Let $\nu(s, a)$ denote the state-action distribution of the dataset. In our setting, $p(s, a) = \nu(s, a)$ , $q(s, a) \propto \nu(s, a) \exp(\beta(\hat{Q}(s, a) - \hat{V}(s)))$ . Then + +$$ +\operatorname {V a r} (p / q) = \operatorname {V a r} \left(\frac {\exp (\beta (\hat {Q} (s , a) - \hat {V} (s)))}{Z (s)}\right) = \hat {Q} _ {\operatorname {V a r}} (\beta), +$$ + +where $Z(s)$ is the normalization factor. $\hat{Q}_{\mathrm{Var}}(\beta)$ is related to $\hat{Q}\hat{V}$ and $\beta$ . Use $n_{\mathrm{eff}}$ to replace $n$ in Theorem A.1, we conclude our proof. + +# B EXPERIMENTAL DETAILS + +All experiments are conducted on AMD EPYC™ 9654 CPUs and NVIDIA RTX 4090 GPUs. GPT-4o is used as our VLMs, while prompt designs are listed in Sec. B.3. The input to the VQ model can be a state representation $\phi(s)$ or a high-dimensional pixel-based input, but for the VLM, rendered observations are required. + +# B.1 ENVIRONMENT DESCRIPTION + +# Franka Kitchen + +Franka Kitchen (Gupta et al., 2019) offers a variety of tasks in a simulated kitchen environment, such as turning on the stove, turning on the light, opening microwave doors, and sliding drawers. Each collected trajectory sequentially lists these subtasks, making it well-suited for continuous control studies. The environment simulates realistic physical interactions, allowing the robot arm to perform complex actions like grasping, rotating, and sliding. With tasks naturally broken down into subtasks, it provides an ideal platform for exploring hierarchical reinforcement learning. Additionally, the sparse reward mechanism, where rewards are granted only upon completing specific goals, requires precise credit assignment. Minigrid + +MiniGrid (Chevalier-Boisvert et al., 2023) is a lightweight, fast grid-world environment suite with OpenAI Gym interfaces, specifically designed for reinforcement learning tasks. Each environment consists of a 2D grid, where cells may be empty or occupied by objects such as walls, keys, doors, or goals. In our experiments, we fix both the initial and terminal states, using rendered images to represent the environment state, providing a controlled setting for reinforcement learning studies. Agents are required to perform actions like turning left or right, moving forward or backward, and interacting with objects such as picking up or dropping items to complete tasks efficiently. The reward function is sparse, with non-zero rewards typically given only upon task completion, and penalties applied based on the number of time steps taken. + +# Crafter + +Crafter (Hafner, 2021) designs a survival game benchmark to evaluate reinforcement learning agents. Inspired by Minecraft, the game features procedurally generated 2D environments—forests, lakes, mountains, and caves—where agents perform survival tasks such as foraging, gathering resources, crafting tools, and defending against enemies. These tasks are organized into 22 semantically meaningful achievements, making Crafter an ideal environment for researching semantic skill extraction. Each new achievement unlocked during an episode rewards the agent with $+1$ , making achievements the primary source of rewards in the game. + +# B.2 MODEL ARCHITECTURE AND HYPERPARAMETERS + +For the visual encoder, we adopt the same architecture as described in Liang et al. (2024). For the state encoder, we use a linear layer, and for the policy decoder, we employ an MLP network that maps the observation and skill context to the corresponding action. We list the hyperparameters used in VanTA for Kitchen, MiniGrid, and Crafter, respectively. + +# B.3 PROMPT FOR VLMS + +We use GPT-4o as the VLM to extract semantic skills. The query and response are separated into two parts: first, we provide the initial state, followed by the terminal state with a designed + +![](images/642bd8892eb896f3fd2bdb0896ade1559f354d0770aea95ee98b4c986dce45ad.jpg) +(a) Franka Kitchen + +![](images/2a8459fcd33f4d6446f474ab5d8a2256616f1b8f185dd45ab7e094a24bbd3855.jpg) +(b) Minigrid + +![](images/2cb5cf07ff35d7b8e42b34b5c6f185dce03eaabc755dc3705e62df9279221139.jpg) +(c) Crafter +Figure 5: Rendering of the procedurally-generated environments in our experiments. + +Table 4: Hyperparameters and their values in VanTA. + +
HyperparameterKitchenMiniGridCrafter
Batch size256256256
Learning rate1e-41e-41e-4
OptimizerAdamAdamAdam
Iteration interval (I)502020
VQ option dim161616
VQ option num20620
β355
γ0.10.20.2
λ0.990.990.99
Gradient step3M1M2M
+ +prompt. The query format follows a user-assistant-user structure. This simulated dialogue significantly reduces VLM hallucinations in skill identification. However, the environment context differs slightly. For MiniGrid, the listed prompt is tailored to MiniGrid-RedBlueDoors, while for MiniGrid-KeyCorridorS3R3 and MiniGrid-DoorKey, the task descriptions require minor modifications. + +# Prompt Design and Q&A procedure for kitchen + +User: Are you familiar with the Franka Kitchen environment used for reinforcement learning? In this environment, various skills represent different subtasks. You can deduce which skill was executed or identify the agent's subprocess based on the initial and terminal observations. I will now show you an image of the initial state. Here are examples of possible subtasks already summarized: 1. No obvious skill 2. Red flame circles appear on the stove as it turns on the gas stove 3. Rotate the knob to turn on the white light above the stove, which is the left one among those knobs 4. Open the cabinet 5. Move the kettle 6. Open the microwave. From my perspective, you can reason what the skill is according to the initial observation and terminal observation. Now I will show you the image, it is the initial state. If you think the task happened between two states in the summarized list, point the index out. Remember maybe many changes happen between two images, so choose the most suitable skill name. If not in them, and you still regard it as a new skill, try your best to give only one suitable new name. Each time, you can provide only one new name if necessary and carefully ensure that it is truly different from the names in the original set. In total, you can describe up to 20 skills. + +Assistant: Got it! Please provide the terminal observation image, and I can help identify the skill or subtask executed between the initial and terminal states. + +User: Now I will show you the image of the terminal state, which means it is the last frame of this segment. You should first judge what is the most obvious one if many changes happen. Check the difference and choose the most probable one. Please determine whether to choose from the given subtask list or name yourself. Write down your choice in the following format: the index selected by you; all the skills index and content. For example 1; 1.content of 1 2(content of 2 etc. Do not need to display your reasoning process. + +# Prompt Design and Q&A procedure for MiniGrid + +User: Are you familiar with the Minigrid environment used for reinforcement learning? In this environment, Door Key task have several subtasks. This environment has a key that the agent must pick up in order to unlock a door and then get to the green goal square. You can deduce which skill was executed or identify the agent's subprocess based on the initial and terminal observations. I will now show you an image of the initial state. Here are all the possible subtasks already summarized: 1. In the middle part, move to the blue door 2. Try to get out from the left part 3. In the middle part, move to the red door 4. Reach the Goal. From my perspective you can reason what the skill is according to the initial observation and terminal observation. Now i will show you the image, it is the initial state. + +Assistant: Got it, let's proceed with identifying the skills based on the initial and terminal observations. Please go ahead and show me the terminal observation so we can determine which subtask was executed or describe a new possible skill if necessary. + +User: Now I will show you the image of the terminal state, which means it is the last frame of this segment. You should first judge what is the most obvious one if many changes happen. Please determine which one to choose from the given subtask list or name yourself. Write down your choice in the following format: the index selected by you; all the skills index and content i provided. For example 1;1. No obvious skill 2. Initial Positioning 3. Move to Key 4. Pass the door 5. Reach the goal position. Do not need to display your reasoning process. + +# Prompt Design for Crafter + +User: Are you familiar with the Crafter environment used for reinforcement learning? Crafter features randomly generated 2D worlds where the player needs to forage for food and water, find shelter to sleep, defend against monsters, collect materials, and build tools. It is the open world survival game for evaluating a wide range of agent abilities. The agent's view evolves as the timestep increases, like from wood to water. You can deduce which skill was executed or identify the agent's subprocess based on the initial and terminal observations. I will now show you an image of the initial state. Here are all the possible subtasks already summarized: 1. No obvious skill 2. collect sapling 3. collect stone. pay attention that the legend at the bottom of the image shows new tools the agent made if it changes. From my perspective, you can reason what the skill is according to the initial observation and terminal observation. Now i will show you the image, it is the initial state. The task happened between two states is summarized in the list, just point out the index. Try your best to suspect the skill. + +Assistant: Thank you for sharing the initial state image. To proceed, please provide the terminal state image as well. With both the initial and terminal observations, I can help deduce the executed skill or identify the agent's subprocess according to the summarized list of possible subtasks. + +User: Now I will show you the image of the terminal state, which means it is the last frame of this segment. You should first judge what is the most obvious one if many changes happen. Please determine which one to choose from the given subtask list. Please only choose no obvious skill when indeed necessary, otherwise try your best to analyze according to the iconic item, like water, stone or wood! Write down your choice with the following format: the index selected by you; all the 16 skills index and content i provided. This is an example: 3; 1. No obvious skill 2. collect sapling 3. collect stone etc. Do not need to display your reasoning process. + +# B.4 PSEUDO-CODE FOR VANTA + +We provide the pseudo-code for VanTA to further clarify the process. During the offline initialization phase, we iterate at 2 times the VLM frequency to prepare the initial segmentation and reduce query complexity in the early stages. The absence of smooth loss may give rise to misleading initialization which is not conducive for VLM to reidentify the sub-task. Therefore, we add the smooth loss with the appropriate coefficient, if meeting the no obvious skill option, the coefficient will increase to 10 times. + +Algorithm 1 Vision-language model guided Temporal Abstraction (VanTA) for offline RL +Require: offline data $\mathcal{D}$ ; pretrained VLM; high-level policy $\pi_{\theta}$ low-level policy $\pi_{\phi}$ query VLM frequency $I$ ; temporal abstraction epoch $N$ ; policy update epoch $M$ 1: // Primitive Skill Extraction +2: for iter $= 1$ to $N$ do +3: Sample a minibatch $\{(s,a,s^{\prime},r)\}$ from $\mathcal{D}$ +4: Update codebook with Eq. (3) +5: if step meets query VLM frequency $I$ then +6: Query VLM with initial segmentation $\{\bar{s}_1,\bar{s}_2,\dots \}$ +7: Update codebook with VLM indices using Eq. (2) +8: end if +9: end for +10: Relabel offline data with primitive skill as $\mathcal{D}^z = \{(s,a,s',r,z)\}$ +11: // Policy Extraction +12: $\pi_{\omega},\pi_{\theta} =$ Policy Extraction $(\mathcal{D}^z,M)$ . +Output: policy $\pi_{\omega},\pi_{\theta}$ + +# B.5 ADDITIONAL RESULTS + +# B.5.1 MISSING SKILL EXTRACTION RESULTS + +![](images/96f48d91e774231e8ae8eb5dd7ae45f853b6e87951aefee2e47f7623e3cdc815.jpg) +Figure 6: Skill extraction results without VLM guidance in kitchen-mixed; no clear semantic meaning in each skill. + +![](images/2bcb68320458c38f48d15429077bcc4b8a425d60f2b2d8c23d52436fc8926f25.jpg) +Figure 7: Skill extraction results using VanTA in kitchen-mixed: sequentially 1) open the microwave, 2) red flame circles appear on stove as it turns on the gas stove, 3) rotate the knob to turn on the white light above the stove, which is the left one among those knobs, and 4) open the cabinet. + +![](images/5db37007e65c916f0cc7638912f3ee9c041e4cd9b3bcfab1f994dc4f2b4c9407.jpg) +Figure 8: Skill extraction results without VLM guidance in kitchen-partial; no clear semantic meaning in each skill. + +![](images/e3fae1543feb710d93a11d696c478c381d8370595ba40dfc978defd302a60e1d.jpg) +Figure 9: Skill extraction results using VanTA in kitchen-partial: sequentially 1) Move the kettle, 2) red flame circles appear on the stove as it turns on the gas stove, 3) rotate the knob to turn on the white light above the stove, which is the left one among those knobs, and 4) open the cabinet. + +![](images/bc269a7a7e4ff4b06a2e42f807f94f3427588ee6dbcc6ca9357643b98459ca46.jpg) +Figure 10: Skill extraction results without VLM guidance in MiniGrid-DoorKey-6×6; the baseline method mistakenly treats wandering as a valid action. + +![](images/53e0986550bbf3b424e3b4167d4031f3a15a5f1ef7a47964e7c1e5b12afc35cd.jpg) +Figure 11: Skill extraction results using VanTA in MiniGrid-DoorKey-6×6: sequentially 1) move to key, 2) pass the door, and 3) reach the goal position. Our method accurately segments the dataset into these three essential skills without any redundant parts. + +![](images/98b330f0db9805dd910726bd580792a547ad74859c93870296c3448dad11062b.jpg) +Figure 12: Skill extraction results without VLM guidance in MiniGrid-DoorKey- $8 \times 8$ ; no clear semantic meaning in each skill. + +![](images/5f2a65de631689c9d806f907a03a0145d534c7fac1e8350d07d9f48d9d5ef0e6.jpg) +Figure 13: Skill extraction results using VanTA in MiniGrid-DoorKey- $8 \times 8$ : sequentially 1) move to key, 2) pass the door, and 3) reach the goal position. Unlike the baseline method, our approach can effectively separate the semantic information for 'move to the key' and 'pass the door'. + +![](images/4635518ff36d831f86a1086b992fa60f231a9ec57e447ced384e8551964ed477.jpg) +Figure 14: Skill extraction results without VLM guidance in MiniGrid-KeyCorridorS3R3; although it can be roughly divided into four semantic parts: move to the sky blue door at the top right corner, move to the purplish red door at the top right corner, reach the red key at the top left corner, and move to the red door at the bottom right corner, there are still some unnecessary skills in between. + +![](images/2533c3baaf5df4cc932c9e7981a52438611475731dca3eec5a7fe523c02693e6.jpg) +Figure 15: Skill extraction results using VanTA in MiniGrid-KeyCorridorS3R3: sequentially 1) move to the sky blue door at the top right corner, 2) move to the purplish red door at the top right corner, 3) reach the red key at the top left corner, and 4) move to the red door at the bottom right corner. Compared to the baseline, our method merges segments that do not carry meaningful semantics. + +![](images/033746771cec76e6bd79353b9b9f9648f4dc897380eba294c3d4c62980da2888.jpg) +Figure 16: Skill extraction results without VLM guidance in MiniGrid-RedBlueDoors; no clear semantic meaning in each skill. + +![](images/6b724eb02a114a41f14f90489f2422fc35f6db61c414bf2332f557bf0ac58098.jpg) +Figure 17: Skill extraction results using VanTA in MiniGrid-RedBlueDoors: sequentially 1) in the middle part move to the blue doors, and 2) in the middle part move to the red door. + +![](images/1b3bf13c7f24bca95ea96334c9677ff70f998190d567567c178ff131ddd460f7.jpg) +Figure 18: Skill extraction results without VLM guidance in Crafter-partial; no clear semantic meaning in each skill. + +![](images/745d859486739d9233fce40ae6146d817da6f91cd9c97a9403cdf891d0b4665c.jpg) +Figure 19: Skill extraction results using VanTA in Crafter-partial: sequentially 1) collect sapling, 2) sleep to refresh, 3) collect water to drink, and 4) collect wood. The extracted segments largely correspond to the achievements in the Crafter environment, and there are significant scene differences between distinct segments. + +# B.5.2 VISUALIZATION OF THE REDUCED DATA EXPERIMENTS + +We have included a graphical visualization that more clearly demonstrates the slower degradation of VanTA compared to other methods, such as CQL and GCSL. We believe this visualization highlights the comparison more effectively and strengthens the clarity of our claims. The graphical representation is provided in Fig. 20. + +![](images/e80d3b18d1d4430723db40987bfc5059df6d05b63efaf4093bac8b303ad984ad.jpg) +Figure 20: Visualization of reduced offline data experiment. + +# B.5.3 FULL ABLATION STUDY + +We conduct an ablation study across all environments, comparing the performance of VanTA with its variant that lacks VLM guidance. The results show that conditioning training on irrational primitive skills negatively impacts the final policy performance. + +Table 5: Ablation study on VanTA and conditioning only non-VLM guidance skills, averaged over 5 random seeds. + +
Task Namew/o VLM Guidancew/ VLM Guidance
MiniGrid-DoorKey-6x6-complete-v00.91±0.020.92±0.03
MiniGrid-DoorKey-6x6-mixed-v00.72±0.140.80±0.17
MiniGrid-DoorKey-8x8-complete-v00.90±0.030.92±0.07
MiniGrid-DoorKey-8x8-mixed-v00.43±0.140.51±0.18
MiniGrid-KeyCorridorS3R3-complete-v00.77±0.120.81±0.06
MiniGrid-KeyCorridorS3R3-mixed-v00.47±0.090.61±0.12
MiniGrid-RedBlueDoors-6x6-complete-v00.82±0.070.85±0.11
MiniGrid-RedBlueDoors-6x6-mixed-v00.67±0.120.73±0.20
Crafter-partial2.85.46
+ +# B.5.4 DETAILS OF CRAFTER PERFORMANCE + +We observe that the policy induced by VanTA achieves the highest success rate in almost half of the achievements. The overall score is calculated as the geometric mean of success rates across all achievements. + +Table 6: Performance listing of all achievements on Crafter benchmark for VanTA and 5 baselines, averaged over 5 random seeds. + +
AchievementSuccess Rate (%)
BCCQLIQLRvSLDCQVanTA(Ours)
Collect Coal0.20.00.00.00.00.6 ± 0.2
Collect Diamond0.00.00.00.00.00.0± 0.0
Collect Drink15.633.44.220.00.017.9± 5.5
Collect Iron0.00.00.00.00.00.0 ± 0.0
Collect Sapling42.863.488.290.699.078.7± 9.4
Collect Stone2.40.00.00.00.04.4±2.2
Collect Wood73.653.860.273.80.074.1±8.5
Defeat Skeleton0.20.41.80.00.02.2 ± 0.7
Defeat Zombie11.86.220.828.215.021.8±6.3
Eat Cow21.67.427.020.015.627.2±2.4
Eat Plant0.10.00.20.00.00.0 ± 0.0
Make Iron Pickaxe0.00.00.00.00.00.0± 0.0
Make Iron Sword0.00.00.00.00.00.0± 0.0
Make Stone Pickaxe0.00.00.00.00.00.0 ± 0.0
Make Stone Sword0.00.00.00.00.00.0 ± 0.0
Make Wood Pickaxe31.00.00.40.40.030.5± 6.7
Make Wood Sword17.20.015.00.00.021.7±8.9
Place Furnace0.00.00.00.00.00.0± 0.0
Place Plant0.07.286.870.698.064.4± 5.6
Place Stone0.00.00.00.00.04.4±1.2
Place Table53.80.036.87.00.073.1 ± 2.4
Wake Up0.247.60.00.00.016.7±8.1
Score2.691.732.752.110.965.46
+ +*The score is computed as $S = \exp \left( \frac{1}{N} \sum_{i=1}^{N} \ln(1 + s_i) \right) - 1$ , where $s_i \in [0, 100]$ is the success rate of the $i$ -th achievement and $N = 22$ denotes the total number of achievements. + +Table 7: Performance listing of all achievements for VanTA ablation study on Crafter benchmark. + +
AchievementSuccess Rate (%)
w/o VLM Guidancew/ VLM Guidance
Collect Coal0.0±0.00.6±0.2
Collect Diamond0.0±0.00.0±0.0
Collect Drink10.8±6.017.9±5.5
Collect Iron0.0±0.00.0±0.0
Collect Sapling94.2±2.278.7±9.4
Collect Stone0.0±0.04.4±2.2
Collect Wood41.3±16.374.1±8.5
Defeat Skeleton1.1±0.72.2±0.7
Defeat Zombie20.3±2.321.8±6.3
Eat Cow20.5±2.027.2±2.4
Eat Plant0.0±0.00.0±0.0
Make Iron Pickaxe0.0±0.00.0±0.0
Make Iron Sword0.0±0.00.0±0.0
Make Stone Pickaxe0.0±0.00.0±0.0
Make Stone Sword0.0±0.00.0±0.0
Make Wood Pickaxe3.2±1.730.5±6.7
Make Wood Sword2.5±1.621.7±8.9
Place Furnace0.0±0.00.0±0.0
Place Plant81.5±9.464.4±5.6
Place Stone1.6±1.24.4±1.2
Place Table18.2±1.873.1±2.4
Wake Up1.8±1.616.7±8.1
Score2.855.46
+ +*The score is computed as $S = \exp \left( \frac{1}{N} \sum_{i=1}^{N} \ln(1 + s_i) \right) - 1$ , where $s_i \in [0,100]$ is the success rate of the $i$ -th achievement and $N = 22$ denotes the total number of achievements. \ No newline at end of file diff --git a/ICLR/2025/Semantic Temporal Abstraction via Vision-Language Model Guidance for Efficient Reinforcement Learning/images.zip b/ICLR/2025/Semantic Temporal Abstraction via Vision-Language Model Guidance for Efficient Reinforcement Learning/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..8ae2340217bf0235cc0f235b7c555efd0ec4a660 --- /dev/null +++ b/ICLR/2025/Semantic Temporal Abstraction via Vision-Language Model Guidance for Efficient Reinforcement Learning/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:926c7affff9fd6debca76140a180c7d66f167d06c3c224309062dc07f7554b40 +size 1552561 diff --git a/ICLR/2025/Semantic Temporal Abstraction via Vision-Language Model Guidance for Efficient Reinforcement Learning/layout.json b/ICLR/2025/Semantic Temporal Abstraction via Vision-Language Model Guidance for Efficient Reinforcement Learning/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..ea43fde380f784d65540138e54192b175391e28a --- /dev/null +++ b/ICLR/2025/Semantic Temporal Abstraction via Vision-Language Model Guidance for Efficient Reinforcement Learning/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5970f0e3c22a3cae11a137235d4d80b1ea447f34ee4527f2df29bc04c02d7bae +size 785837 diff --git a/ICLR/2025/Semantics-Adaptive Activation Intervention for LLMs via Dynamic Steering Vectors/e8d0237b-6a3e-43a7-a3e6-6ceec1283480_content_list.json b/ICLR/2025/Semantics-Adaptive Activation Intervention for LLMs via Dynamic Steering Vectors/e8d0237b-6a3e-43a7-a3e6-6ceec1283480_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..a2a6134c8d683b1091cdf9cc3b5b798afd6bea31 --- /dev/null +++ b/ICLR/2025/Semantics-Adaptive Activation Intervention for LLMs via Dynamic Steering Vectors/e8d0237b-6a3e-43a7-a3e6-6ceec1283480_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:da6e3df3ec7a516373348e69210d24227011c1e4bc43e621f655812433566f5a +size 109652 diff --git a/ICLR/2025/Semantics-Adaptive Activation Intervention for LLMs via Dynamic Steering Vectors/e8d0237b-6a3e-43a7-a3e6-6ceec1283480_model.json b/ICLR/2025/Semantics-Adaptive Activation Intervention for LLMs via Dynamic Steering Vectors/e8d0237b-6a3e-43a7-a3e6-6ceec1283480_model.json new file mode 100644 index 0000000000000000000000000000000000000000..6d3af3d0d6a4b148f7a601cacfe54f358185df35 --- /dev/null +++ b/ICLR/2025/Semantics-Adaptive Activation Intervention for LLMs via Dynamic Steering Vectors/e8d0237b-6a3e-43a7-a3e6-6ceec1283480_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0ce2074bce1a520829c05c589f5de5fafe6afb46b23c4208f9370b820f5e4aee +size 132498 diff --git a/ICLR/2025/Semantics-Adaptive Activation Intervention for LLMs via Dynamic Steering Vectors/e8d0237b-6a3e-43a7-a3e6-6ceec1283480_origin.pdf b/ICLR/2025/Semantics-Adaptive Activation Intervention for LLMs via Dynamic Steering Vectors/e8d0237b-6a3e-43a7-a3e6-6ceec1283480_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..bbf7d29e909857c7e177812df6e14d21f6b2e4eb --- /dev/null +++ b/ICLR/2025/Semantics-Adaptive Activation Intervention for LLMs via Dynamic Steering Vectors/e8d0237b-6a3e-43a7-a3e6-6ceec1283480_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:38ba06d52b169daa00d72196d313bee405b4335d01b57797019628c8d4c25981 +size 780449 diff --git a/ICLR/2025/Semantics-Adaptive Activation Intervention for LLMs via Dynamic Steering Vectors/full.md b/ICLR/2025/Semantics-Adaptive Activation Intervention for LLMs via Dynamic Steering Vectors/full.md new file mode 100644 index 0000000000000000000000000000000000000000..0ef9edd06d7f53fc93b4560ea72ab00fbd64f994 --- /dev/null +++ b/ICLR/2025/Semantics-Adaptive Activation Intervention for LLMs via Dynamic Steering Vectors/full.md @@ -0,0 +1,402 @@ +# SEMANTICS-ADAPTIVE ACTIVATION INTERVENTION FOR LLMS VIA DYNAMIC STEERING VECTORS + +Weixuan Wang $^{1}$ Jingyuan Yang $^{2}$ Wei Peng $^{3}$ + +$^{1}$ School of Informatics, University of Edinburgh $^{2}$ Huawei Technologies Co., Ltd. +$^{3}$ School of Engineering, RMIT University + +weixuan.wang@ed.ac.uk yangjingyuan2@huawei.com wei.peng3@rmit.edu.au + +# ABSTRACT + +Large language models (LLMs) have achieved remarkable performance across many tasks, yet aligning them with desired behaviors remains challenging. Activation intervention has emerged as an effective and economical method to modify the behavior of LLMs. Despite considerable interest in this area, current intervention methods exclusively employ a fixed steering vector to modify model activations, lacking adaptability to diverse input semantics. To address this limitation, we propose Semantics-Adaptive Dynamic Intervention (SADI), a novel method that constructs a dynamic steering vector to intervene model activations at inference time. More specifically, SADI utilizes activation differences in contrastive pairs to precisely identify critical elements of an LLM (i.e., attention heads, hidden states, and neurons) for targeted intervention. During inference, SADI dynamically steers model behavior by scaling element-wise activations based on the directions of input semantics. Experimental results show that SADI outperforms established baselines by substantial margins, improving task performance without training. SADI's cost-effectiveness and generalizability across various LLM backbones and tasks highlight its potential as a versatile alignment technique. $^{1}$ + +# 1 INTRODUCTION + +Large language models (LLMs) have demonstrated remarkable capabilities across many tasks (OpenAI, 2023; Touvron et al., 2023; Anil et al., 2023b;a; Mesnard et al., 2024). Nevertheless, aligning these models to target behaviors remains challenging (Longpre et al., 2023; Ding et al., 2023). Existing approaches like supervised fine-tuning (Wei et al., 2022) (SFT), Reinforcement Learning from Human Feedback (Bai et al., 2022) (RLHF), and prompt engineering (Shin et al., 2020; Wang et al., 2023) are effective but have limitations. They often require extensive datasets, struggle to prevent hallucinations, and sometimes fail to produce the desired results. + +Recently, advancements in model alignment techniques, known as "activation engineering", aim to address these limitations (Subramani et al., 2022; Hernandez et al., 2023; Zou et al., 2023; Li et al., 2023b; Chen et al., 2024). Activation engineering involves making targeted modifications to the internal activations of LLMs to guide their outputs more precisely. This technique constructs steering vectors that, when integrated into the forward pass of a frozen LLM, induce specific desirable changes in the output text. However, traditional steering vectors are static and may not adapt well to the diverse semantic contexts encountered during inference (Turner et al., 2023; Rimsky et al., 2023). This misalignment between the direction of steering vector and the input's semantic direction can adversely impact the model's predictive performance, particularly when the discrepancy is substantial. These limitations highlight the need for dynamic and adaptive steering mechanisms capable of effectively handling varied input semantics. + +In this work, we introduce the Semantics-Adaptive Dynamic Intervention (SADI), a novel approach designed to overcome the limitations of fixed steering mechanisms. SADI adjusts model activations by dynamically generating a steering vector tailored to each input's semantic context. Specifically, SADI utilizes activation differences from contrastive pairs to create a binary mask that + +![](images/33a77a30f067525aee1b5640ca29723ad4f56dae6f0678814078417ae36fb366.jpg) +Figure 1: Three steps of SADI: (1) Difference Extraction: extract the activation differences between positive and negative examples from all model layers; (2) Binary Masking: compute the mean activation difference to locate the key elements and produce an identification mask by binarization; and (3) Adaptive Steering: intervene the activations during inference by applying the identification mask to the input activations scaled by a factor of $\delta$ . + +identifies critical model elements for targeted intervention. During inference, this mask is applied to user input activations with element-wise scaling, effectively manipulating the LLM's behavior to align with the input semantics. This process ensures that modifications preserve the semantic alignment of the inputs, allowing for more precise and context-sensitive interventions. Furthermore, we apply SADI to various components of LLMs, including hidden states (SADI-HIDDEN), attention heads (SADI-HEAD), and neurons in feed-forward networks (FFNs) (SADI-NEURON). + +To validate the effectiveness of SADI, we conduct extensive experiments using four diverse model backbones: LLAMA2-7B-CHAT, BLOOMZ-7B, MISTRAL-7B, FALCON-7B-INSTRUCT across eleven widely used benchmarks. The experiments involve a comprehensive range of tasks, from multiple-choice tasks (COPA, StoryCloze, NLI, MMLU, SST2, SST5, BoolQ, Winogrande), to open-ended generation tasks (TriviaQA, ToxiGen, and TruthfulQA). Our experimental results reveal that SADI significantly outperforms existing activation intervention methods. + +Our contributions are summarized as follows: + +- We propose a dynamic activation intervention approach named Semantics-Adaptive Dynamic Intervention (SADI), which automatically modulates LLM activations at inference time to adapt to varied input semantics without requiring any additional training (see Section 3). +- SADI is a generic steering method applicable to a wide range of LLMs. Through extensive experiments with four model backbones over eleven diverse tasks, SADI has proven to significantly enhance model performance, surpassing baseline methods by substantial margins, with accuracy improvements reaching up to $+14.69$ (see Section 4). Our detailed analysis demonstrates that interventions targeting attention heads (SADI-HEAD) consistently yields significant performance improvements across various tasks, validating the effectiveness of our dynamic steering approach (see Section 4). +- SADI demonstrates excellent generalizability across different model sizes, few-shot settings, and multilingual scenarios (see Section 5). We further show that SADI is a cost-effective steering method that necessitates only a small number of additional examples (i.e., 150 items) in developing a dynamic steering vector and does not require any training (see Section 6). + +# 2 RELATED WORK + +Activation engineering has been proposed as a cost-effective method to modify an LLM's activations during decoding (Hernandez et al., 2023; Zou et al., 2023; Wang et al., 2024c). By analyzing + +activation differences between contrastive pairs, these methods identify specific directions to adjust LLM behaviors. For instance, some studies have improved LLM truthfulness by shifting activations along vectors between true and false output distributions (Li et al., 2023b; Chen et al., 2024). Moreover, discrepancies in contextual examples have been used to identify crucial modifications needed to reduce LLM toxicity (Liu et al., 2023). More generally, these differences can be used to update the residual stream without requiring explicit direction settings for adjustments. Turner et al. (2023) construct steering vectors by assessing intermediate activation differences between two prompts, effectively shifting emotions from negative to positive. Similarly, Rimsky et al. (2023) use contrast pairs to create steering vectors that modify model behaviors by adjusting hidden states. + +Our problem formulation aligns with the "linear representation hypothesis" (Park et al., 2024; Turner et al., 2023) which posits that high-level concepts (i.e., features of the input) are represented linearly as directions in the representation space. Model behavior intervention can be achieved by adding an appropriate steering vector to the representation of a concept without altering other concepts. One key insight is that intervening along the direction of the feature representation of an input is expected to enhance the probability of producing a desirable output. Intuitively, we need to preserve the semantic direction of an input when applying a steering vector to update activations. + +Existing methods use fixed steering vectors generated from additional contrastive pairs during intervention without aligning with input semantics (Turner et al., 2023; Rimsky et al., 2023). As activation patterns can vary significantly across different inputs for the same task (Wang et al., 2024a;b), model steering with a fixed vector may cause the intervention direction to deviate from the representation of input contexts. This highlights the need for more adaptive approaches. Developing a dynamic steering mechanism to adapt to the input semantics is critical for effective intervention. + +# 3 SEMANTICS-ADAPTIVE DYNAMIC INTERVENTION + +In this section, we provide a comprehensive description of the proposed SADI. We begin with an overview of SADI in Section 3.1, and then introduce each step of SADI, including Difference Extraction (Section 3.2), Binary Masking (Section 3.3), and Adaptive Steering (Section 3.4). + +# 3.1 OVERVIEW OF SADI + +Our method, SADI, encompasses three pivotal steps to dynamically steer model behavior, as shown in Figure 1 and Algorithm 1. First, the activation differences between positive and negative examples are extracted across all layers of the model. These differences are aggregated to compute the mean difference, which is used to identify critical elements influencing the model's behavior. Based on this computation, we create an identification mask through binarization, keeping the crucial elements while masking out the insignificant ones. Furthermore, this mask is applied to the activations of user inputs, scaled by a factor during inference. In this way, we manage to manipulate the behaviors of LLMs. We present more details in the following sections. + +# 3.2 DIFFERENCE EXTRACTION + +In the initial step of SADI, our objective is to extract activation differences from contrastive pairs to isolate the internal activations most closely associated with the target behavior of the language model. Specifically, we aim to identify features that distinguish positive outcomes (e.g., correct answers) from negative ones (e.g., incorrect answers), thereby allowing adjustments to the model's behavior. + +Let $\mathcal{P} = \{\mathcal{P}^l\mid 0\leq l < L\}$ represents an LLM consisting of $L$ layers, whose behavior we seek to modify. We build a dataset $T = \{(x_{i},y_{i}^{\mathrm{pos}},y_{i}^{\mathrm{neg}})\}_{i = 1}^{N}$ containing $N$ instances, where each instance includes the question $x_{i}$ , a positive output $y_{i}^{\mathrm{pos}}$ , and a negative output $y_{i}^{\mathrm{neg}}$ . For each instance $i$ and layer $(l)$ , we obtain activations by forwarding the concatenation of the input and the corresponding output through the model $\mathcal{P}$ . Specifically, we forward $x_{i}$ concatenated with $y_{i}^{\mathrm{pos}}$ to derive the positive activation $\mathcal{A}_{i,j}^{\mathrm{pos},(l)} = \mathcal{P}^l\left(x_i||y_i^{\mathrm{pos}}\right)_j$ , where $\cdot ||\cdot$ denotes concatenation and $j$ represents the $j$ -th token in the sequence. Similarly, we obtain $\mathcal{A}_{i,j}^{\mathrm{neg},(l)}$ for the negative activation. Additionally, we focus on the activation of the last token in each sequence, as it typically encapsulates the complete semantics + +of the input-output pair. For simplicity, we denote the activation of the last token as $\mathcal{A}_i^{\mathrm{pos},(l)}$ and $\mathcal{A}_i^{\mathrm{neg},(l)}$ for the positive and negative outputs, respectively. + +To identify the features within the model that differentiate correct from incorrect outputs, we compute the difference between the positive and negative activations for each instance at each layer as follows: + +$$ +D _ {i} ^ {(l)} = \mathcal {A} _ {i} ^ {\text {p o s}, (l)} - \mathcal {A} _ {i} ^ {\text {n e g}, (l)}. \tag {1} +$$ + +By examining differences $D_{i}^{(l)}$ , we can determine which activations are crucial for model's behavior. + +# 3.3 BINARY MASKING + +We now present how we construct a mask to identify and focus interventions on the critical model elements that affect model's behavior. As shown in Figure 1 (Step 2), after extracting the activation differences from contrastive pairs, we compute the mean difference across all instances and layers, and concatenate them to build the overall mean difference vector $D$ for all model elements: + +$$ +D = \operatorname {C o n c a t} \left(D ^ {(0)}, D ^ {(1)}, \dots , D ^ {(L - 1)}\right), \text {w h e r e} D ^ {(l)} = \frac {1}{N} \sum_ {i = 1} ^ {N} D _ {i} ^ {(l)}. \tag {2} +$$ + +Here, $D \in \mathbb{R}^{L \times d_m}$ represents the concatenated mean activation differences across all $L$ layers, and $d_m$ denotes the dimensionality of the model components, which may correspond to hidden states, attention heads, or neurons in FFNs. + +We then binarize the mean activation difference $D$ to create an identification mask $M \in \mathbb{R}^{L \times d_m}$ . This is done by setting the entries corresponding to the top-K elements with the largest differences to 1 and the rest to 0: + +$$ +M [ l, m ] = \left\{ \begin{array}{l l} 1 & (l, m) \in E _ {K} \\ 0 & \text {o t h e r w i s e} \end{array} , \right. \tag {3} +$$ + +where $l$ indexes the layers, $m$ indexes the model elements within a layer, and $E_K$ is the set of indices of the top-K elements with the highest mean activation differences. This step ensures that SADI focuses on the most impactful elements contributing to the desired behavior, reducing unnecessary alterations to non-essential elements and enhancing the efficiency of the intervention. + +# 3.4 ADAPTIVE STEERING + +Previous activation intervention methods modify all activation elements indiscriminately, which can disrupt the model's overall behavior (Li et al., 2023b; Rimsky et al., 2023). To mitigate this issue, we perform a focused intervention on the top-K elements during inference. By leaving irrelevant activations intact, our intervention becomes less intrusive and preserves the model's non-target behaviors. With this design, SADI precisely adjusts activations to minimize disruption to the model's residual functionalities. This approach is visualized in Step 3 of Figure 1. + +Unlike previous studies using the fixed steering vector to intervene models, and inspired by Park et al. (2024), we design a steering mechanism that considers the semantic direction of the input. The steering vector dynamically adapts to the input's semantic direction (see Equation 5), maintaining the effectiveness of the intervention without deviating from the intended semantics. + +For a given user input $q$ , we first extract the activations of the last token from each layer: $\mathcal{A}_q^{(l)}$ for $l = 0,1,\dots,L - 1$ . We then concatenate these activations to form a single vector: + +$$ +\boldsymbol {\mathcal {A}} _ {q} = \operatorname {C o n c a t} \left(\boldsymbol {\mathcal {A}} _ {q} ^ {(0)}, \boldsymbol {\mathcal {A}} _ {q} ^ {(1)}, \dots , \boldsymbol {\mathcal {A}} _ {q} ^ {(L - 1)}\right). \tag {4} +$$ + +Next, we apply the identification mask $M$ to these activations and update them using: + +$$ +\boldsymbol {\mathcal {A}} _ {q} ^ {\prime} = \boldsymbol {\mathcal {A}} _ {q} + \delta (\boldsymbol {\mathcal {A}} _ {q} \odot M). \tag {5} +$$ + +Here, $\odot$ represents the element-wise product, and $\delta$ is a hyperparameter controlling the strength of the intervention along the input's semantic direction. By calculating the steering vector based on the activations of input $q$ , the intervention dynamically aligns with the input's semantics. This approach maintains the direction of the activation projections, ensuring that the intervention remains semantically relevant and effective. Subsequently, we complete the altered forward pass with the updated activations $\mathcal{A}_q'$ . + +Hyperparameters $K$ and $\delta$ Our method introduces two key hyperparameters: $K\in \mathbb{N}^{+}$ , specifying the number of top elements targeted during the intervention, and $\delta \in \mathbb{R}^+$ , controlling the strength of the intervention. We perform a hyperparameter sweep to empirically determine their optimal values. Detailed analysis of the hyperparameter selection is provided in Section 4.3. + +By selectively targeting the most impactful activation elements and adapting our intervention to the input's semantic direction, our method effectively steers the model toward the desired behavior. + +Algorithm 1: SADI: Semantics-Adaptive Dynamic Intervention +Input $T = \{(x_{i}^{\mathrm{pos}},x_{i}^{\mathrm{neg}})\}_{i = 1}^{N}$ , a set of contrastive pairs; $U = \{u_j\}_{j = 1}^K$ , a test set; $\mathcal{P}$ , a pre-trained LLM; $A$ , a function to extract activations from $\mathcal{P}$ Output: $O$ , the modified outputs collection; +1 $\Delta A\gets 0$ // Initialize the mean difference +2 for $i = 1$ to $N$ do // Collect and compute the mean difference of activations +3 $\Delta \mathcal{A}\leftarrow \Delta \mathcal{A} + (A(\mathcal{P}(x_i^{\mathrm{pos}})) - A(\mathcal{P}(x_i^{\mathrm{neg}})))$ +4 end for +5 $\Delta \mathcal{A}\gets \frac{1}{N}\Delta \mathcal{A}$ +6 $M\gets$ binarize(△A) // Create the identification mask +7 $O\gets []$ // Intervene generation +8 for $j = 1$ to $K$ do +9 $\mathcal{A}_j\gets A(P(u_j))$ // Extract activations for each input +10 $S_{j}\gets M\odot \mathcal{A}_{j}$ // Apply mask to activations and update +11 $\mathcal{A}_j^\prime \gets \mathcal{A}_j + \delta \times S_j$ +12 $O\gets O\bigcup \{P(\mathcal{A}_j^\prime)\}$ // Complete the modified forward pass +13 end for +14 return $O$ + +# 4 EXPERIMENTS + +We present our experimental setup (Section 4.1), comparative methods (Section 4.2), main results (Section 4.3), and specific contributions of SADI's constitutes (Section 4.4) in this section. + +# 4.1 EXPERIMENT SETTINGS + +In this subsection, we describe the experimental settings for evaluating SADI. First, we outline the tasks and the evaluation metrics used to assess model performance. Following that, we detail the construction of contrastive pairs. Finally, we introduce the selected LLMs. + +Tasks and Evaluation Metrics We conduct experiments on the following two types of tasks: multiple-choice tasks and open-ended generation tasks. For the multiple-choice tasks, we use datasets: COPA (Gordon et al., 2012), StoryCloze (Mostafazadeh et al., 2016), NLI (Bowman et al., 2015), MMLU (Hendrycks et al., 2021), SST2 (Socher et al., 2013), SST5 (Socher et al., 2013), BoolQ (Clark et al., 2019), and Winogrande (Sakaguchi et al., 2020), with response formats ranging from 2-way to 5-way choices. Detailed descriptions of the datasets are provided in Appendix A.1. We measure performance across these tasks using accuracy. + +For the open-ended generation tasks, we apply SADI on TriviaQA (Joshi et al., 2017), TruthfulQA (Lin et al., 2022), ToxiGen (Hartvigsen et al., 2022) datasets. The Exact Match (EM) metric assesses TriviaQA, while TruthfulQA is evaluated using multiple-choice accuracy (MC) and pre-trained judge models for truthfulness $^{2}$ and informativeness $^{3}$ . ToxiGen is evaluated with a HATEBERT classifier $^{4}$ to measure toxicity. Dataset sizes are detailed in Table 9 (Appendix A.2). + +Contrastive Pairs Construction For multiple-choice tasks, we generate positive prompts by concatenating questions with correct answers and generate negative prompts using a randomly chosen incorrect answer. For TriviaQA, a unique approach involves using a blank space as the + +Table 1: The overall results of seven multiple-choice tasks in a zero-shot setting, performed by LLAMA2-7B-CHAT. "SFT + SADI" indicates that SADI is applied to instruction fine-tuned models. A dash indicates that the training dataset is unavailable. + +
TaskCOPAStoryClozeNLIMMLUSST2BoolQWinograndeAVG
BASELINE70.8065.0663.1144.9088.6370.5250.9164.85
ITI77.2068.5063.9746.0791.3874.1052.8067.72
CAA75.2074.6564.1346.1791.1674.9852.6468.42
SADI
SADI-HIDDEN81.0055.9959.2845.6692.1576.2552.6466.14
SADI-NEURON82.2067.5762.9746.9188.6970.4051.9367.24
SADI-HEAD78.8079.7564.2148.2392.2074.3553.0470.08
SFT93.2096.4990.07-96.7088.7578.3790.59
SFT + SADI
SADI-HIDDEN94.9096.4990.07-96.7688.9178.3790.91
SADI-NEURON94.8096.5590.36-96.9288.4578.4590.92
SADI-HEAD94.6096.5590.30-96.8188.9478.6190.97
+ +incorrect answer. In TruthfulQA, we utilize data from its multiple-choice format to identify crucial elements. For the ToxiGen task, we leverage the RealToxicityPrompts dataset (Gehman et al., 2020), selecting entries with a toxicity score exceeding 0.955 to serve as negative prompts. This helps us pinpoint elements contributing to toxic outputs. + +Target LLMs We evaluate the performance of SADI in enhancing the baseline model (BASELINE) - an instruction-tuned LLM, LLAMA2-7B-CHAT (Touvron et al., 2023). To verify the generalizability of SADI across various model backbones, we include three additional LLMs: BLOOMZ-7B (Muen-nighoff et al., 2023), MISTRAL-7B (Jiang et al., 2023), FALCON-7B-INSTRUCT (Almazrouei et al., 2023). These models are selected based on their demonstrated efficacy across diverse linguistic tasks and their widespread use in the research community. Furthermore, we extend our experiments to other models within the BLOOMZ family, specifically BLOOMZ-560M, BLOOMZ-1B, and BLOOMZ-3B, exploring how SADI performs across different model sizes. + +# 4.2 EXPERIMENTAL COMPARISONS + +In addition to evaluating SADI, we compare it against several approaches: + +Supervised fine-tuning (SFT) We finetune all model parameters using the training dataset for each task, as previous works suggest that this approach serves as an upper bound for supervised finetuning. Specifically, we employ the AdamW optimizer with a learning rate of $2 \times 10^{-6}$ and a batch size of 4, conducting the fine-tuning across three epochs on four NVIDIA A-100 GPUs (80G). + +Inference-Time Intervention (ITI) We follow Li et al. (2023b) in using contrastive pairs to identify the top heads for intervention. We sweep the hyperparameters of the heads involved and the strength of intervention to optimize results. + +Contrastive Activation Addition (CAA) Rimsky et al. (2023) use the mean difference in the model's activations at the position of the answer letter between all the positive and negative prompts to construct a fixed steering vector to shift activations. + +Our Approach (SADI) We compare three different configurations of the SADI shift. SADI-HIDDEN applies SADI to the identified key hidden states across all layers. SADI-HEAD modifies activations from the outputs of all attention heads across all layers. SADI-NEURON is based on the outputs from each non-linear activation function in the FFN blocks across all layers. + +# 4.3 EXPERIMENTAL RESULTS + +SADI Significantly improves multiple-choice task performance. As illustrated in Table 1, SADI demonstrates superior performance compared to the BASELINE and other intervention methods across multiple-choice tasks. While SFT consistently outperforms other methods in tasks with available training data, such as COPA and StoryCloze, its high data resource demands limit its effectiveness in tasks with scarce data, like MMLU. Both ITI and CAA show notable improvements, highlighting + +Table 3: The overall results of three open-ended generation tasks performed by LLAMA2-7B-CHAT. The results of TriviaQA are obtained in a zero-shot setting, and we use 5-shot in-context learning in the ToxiGen and TruthfulQA tasks. † denotes results reproduced from other authors. + +
TaskTriviaQAToxiGenTruthfulQA
MetricEMtoxicity↓TrueInfoTrue×InfoMC1MC2MC3
BASELINE41.6049.7166.8399.5166.5033.4151.0724.76
SFT-----24.20†--
ITI42.8045.27---34.64†51.55†25.32†
CAA43.2049.7171.6083.8460.0334.0352.7625.62
SADI
SADI-HIDDEN43.8034.4335.1351.7325.3867.0792.9062.31
SADI-NEURON43.5017.1474.5493.5169.7134.8852.5025.79
SADI-HEAD44.0034.5077.7298.5376.5835.9054.6526.99
+ +the effectiveness of intervention-based methods. SADI, leveraging dynamic interventions, achieves optimal performance overall, significantly outperforming the BASELINE. In comparison to fixed vector-based intervention methods (ITI and CAA), our dynamic intervention SADI yields substantial gains across all tasks. Specifically, SADI exceeds ITI and CAA by margins of $+11.25$ and $+5.10$ , respectively, and surpasses the BASELINE by a large margin of $+14.69$ in the StoryCloze task. Furthermore, SADI can enhance the performance of task-specific fine-tuned models (SFT +SADI), underscoring its practicality for precise and targeted interventions. + +Improvement varies across SADI configurations. Performance gains from the three SADI configurations vary, but all outperform ITI and CAA across tasks. Notably, SADI-HEAD achieves the most significant improvements, enhancing average accuracy by up to +5.23. While SADI-HIDDEN and SADI-NEURON also demonstrate strong performance improvements in certain scenarios, such as 76.25 for BoolQ and + +Table 2: Average weighted accuracy on all four broad disciplines for MMLU task with LLAMA2-7B-CHAT. + +
DomainHumanitiesSTEMSocialOther
BASELINE46.6834.2654.6249.71
SADI
- SADI-HIDDEN48.9935.0355.8248.51
- SADI-NEURON48.8337.4655.7450.65
SADI-HEAD49.7639.3556.2152.31
+ +82.20 for COPA, they occasionally show slight decreases in specific tasks, like NLI. Nevertheless, manipulating attention heads consistently results in improvements across all tasks and achieves the highest scores in most cases. For a detailed analysis, we present the results covering various domains of knowledge of MMLU tasks, including humanities, STEM and social sciences and other are shown in Table 2. SADI consistently enhances performances across these domains compared to the BASELINE, with SADI-HEAD yielding the highest improvements, up to $+5.09$ in the STEM domain. + +SADI improves open-ended generation task performance. We further evaluate the performance of SADI on the open-ended generation tasks in Table 3. SADI, in its three configurations, generally outperforms the BASELINE, except for SADI-HIDDEN in the TruthfulQA generation track. SADI-HIDDEN underperforms in the generation track, but shows significant improvements in the truthful multiple-choice track. This suggests that hidden states may be particularly sensitive to multiple-choice formats. Conversely, SADI-HEAD significantly boosts truthfulness, with improvements reaching up to $+10.08$ on the True $\times$ Info metric for TruthfulQA. This underscores the generalizability of SADI's dynamic intervention, effectively tailoring activations to the semantics required by each task. + +Hyperparameters are task-specific. In Figure 2, we sweep two hyperparameters to control the intervention: the number of identified key attention heads, and the strength of intervention. Results indicate that optimal settings for these hyperparameters markedly vary across different tasks. This variability underscores the importance of carefully balancing the number of heads engaged and the scale of their amplification. For precise task performance optimization, it is recommended to search optimal hyperparameters using data from the validation sets specific to each task. + +![](images/d6101e8fc797197eaabbd367ec39aad265a87048d16153ee4c5ca5270413f1a5.jpg) +Figure 2: Results with varying intervention strength and numbers of key attention heads based on COPA, StoryCloze, SST2, TriviaQA tasks with LLAMA2-7B-CHAT. + +![](images/3a1ae3be776dcd8c151f61ae2a09169bba7c133466b6762388469d79b582e196.jpg) + +![](images/cefa72eeb2cef1bbfdb872d27a1d9be88a96a5a6cd35bf657d835adc83d63225.jpg) + +![](images/d7f9058397fdad3ba370daee35ed180257499df7a36da51e9f4cdfd90bb11437.jpg) + +# 4.4 SCRUTINIZE EFFECTS OF DYNAMIC INTERVENTION OF SADI + +SADI outperforms fixed steering and random intervention. In Table 4, we conduct an ablation study to examine the contribution of Binary Masking (Step 2 in Section 3.3) and Adaptive Steering (Step 3 in Section 3.4) in SADI applied to tasks COPA, StoryCloze, Winogrande, SST2, and TriviaQA. SADI involves constructing an identification mask $M$ , where we randomly assign K elements to 1 with the values of remainder elements set to 0 (termed "random identify" in Table 4). It can be observed from Table 4 that random element identification leads to a notable performance decrease, with reductions as great as -7.88 (dropping from 79.75 to 71.87 on StoryCloze). Subsequently, the mask $M$ is applied to the activations corresponding to the semantics of user inputs in SADI. + +Additionally, we explore the effects of fixed steering, in which the mask $M$ is directly applied to the mean difference $D$ , derived from the activations of contrastive pairs (see Eq. 2). If Step 3 (Eq. 5) employs fixed steering, it updates activations as: + +$$ +\boldsymbol {\mathcal {A}} _ {q} ^ {\prime} = \boldsymbol {\mathcal {A}} _ {q} + \delta (\boldsymbol {D} \odot M). \tag {6} +$$ + +The results in Table 4 show that using a fixed steering vector leads to significant performance degradation compared to the semantic-adaptive approach of SADI. This decline likely stems from a misalignment between the direction of intervention and that of input semantics. + +Table 4: Ablation study for randomly identifying key elements and intervening with a fixed steering vector for SADI-HEAD with LLAMA2-7B-CHAT. + +
SADIrandom identifyfixed steering
COPA78.8072.4071.20
StoryCloze79.7571.8769.42
Winogrande53.0452.8852.56
SST292.2091.4891.43
TriviaQA44.0042.9041.50
+ +# 5 DISCUSSION + +In this section, we examine the generalizability across multiple LLMs (Section 5.1), different model sizes (Section 5.2), few-shot settings (Section 5.3), and multilingual scenarios (Section 5.4). + +# 5.1 GENERALIZABILITY ACROSS MULTIPLE LLMS + +Table 5: Generalizability evaluation of SADI given by BLOOMZ-7B, MISTRAL-7B, and FALCON-7B-INSTRUCT on the COPA, BoolQ and NLI tasks. + +
TaskCOPABoolQNLI
LLMsBLOOMZMISTRALFALCONBLOOMZMISTRALFALCONBLOOMZMISTRALFALCON
BASELINE76.4084.8062.2091.2871.8071.8354.8153.3352.29
SFT86.8086.8088.2090.5286.5784.2257.4189.9455.45
SADI
- SADI-HIDDEN76.4093.0060.6091.3149.4362.7353.2535.6943.67
- SADI-NEURON82.2084.2062.4091.4074.6174.4856.4354.0752.48
- SADI-HEAD82.2092.0062.2091.2867.3873.2355.3753.6554.83
+ +SADI enhances performance across multiple LLMs in various tasks. An important question is whether SADI can generalize over various LLMs. We apply SADI to three other well-performing + +LLMs: BLOOMZ-7B, MISTRAL-7B, and FALCON-7B-INSTRUCT in COPA, BoolQ and NLI tasks. According to the results in Table 5, SADI consistently enhances performance across tasks compared to the BASELINE, despite varying improvement levels by configuration. It is noteworthy that the SADI-NEURON configuration with BLOOMZ-7B achieves the most substantial performance gains in all three tasks, demonstrating that different models may exhibit distinct functional elements. + +# 5.2 GENERALIZABILITY ACROSS MODEL SIZES + +SADI outperforms SFT in smaller LLMs. We further investigate the effectiveness of SADI on the BLOOMZ series across various model sizes. As shown in Table 6, SADI maintains its improvement over BASELINE even with smaller LLM sizes, confirming its generalizability across model sizes. Notably, SADI outperforms SFT with incremental gains of up to +1.2 for BLOOMZ-1B and +2.4 for BLOOMZ-560M, highlighting its effectiveness, especially in smaller models. + +# 5.3 GENERALIZABILITY IN FEW-SHOT SETTINGS + +Table 6: Generalizability evaluation on BLOOMZ series in COPA task. + +
Size7b3b1.1b560m
BASELINE70.879.249.850.0
SFT88.885.850.652.0
SADI
- SADI-HIDDEN76.479.250.050.0
- SADI-NEURON74.079.250.052.6
- SADI-HEAD78.879.251.854.4
+ +SADI improves few-shot performance but with less gains. In Table 7, we compare SADI-HEAD to the BASELINE across zero-shot and few-shot settings on the SST5, Winogrande, and TruthfulQA tasks. The results highlight the generalizability of SADI in enhancing model performance with few-shot prompting across various tasks. While manipulating heads improves the performances in few-shot settings, the gains are less pronounced compared to those in zero-shot settings. This suggests that few-shot examples already provide a strong learning signal (to both BASELINE and SADI), somewhat overshadowing the additional benefits derived from head manipulation. + +Table 7: Comparisons between few-shot and zero-shot on the SST5, Winogrande, and TruthfulQA. + +
TaskSST5WinograndeTruthfulQA MC1TruthfulQA MC2TruthfulQA MC3
Configuration0-shot5-shot0-shot5-shot0-shot5-shot0-shot5-shot0-shot5-shot
BASELINE28.2453.2150.9152.0127.6633.4144.4551.0720.5924.76
SADI-HEAD35.4354.0753.0453.3532.1935.9950.8154.6524.8326.99
+ +# 5.4 GENERALIZABILITY IN MULTILINGUAL SCENARIOS + +Table 8: Evaluating SADI on multilingual task XCOPA with LLAMA2-7B-CHAT. + +
LanguageiditswtathtrvizhAVG
BASELINE51.4061.2050.2049.4050.8049.4051.8062.8053.38
SADI
SADI-HIDDEN51.4062.4050.0050.0051.2048.8052.2064.8053.85
SADI-NEURON63.6068.8050.2048.8053.8050.6060.4070.4058.33
SADI-HEAD62.6070.6050.8049.6051.4051.6060.2070.1058.36
+ +SADI enhances performance in multilingual scenarios. Although our primary experiments are in English, extending SADI to multilingual scenarios reveals its broader applicability. We further evaluate SADI on the multilingual XCOPA task (Ponti et al., 2020), covering eight languages: Indonesian (id), Italian (it), Swahili (sw), Tamil (ta), Thai (th), Turkish (tr), Vietnamese (vi), Chinese (zh). Table 8 illustrates varying degrees of performance enhancements across different languages. It can be observed that Indonesian shows the highest improvement, while Swahili gains the least. Despite these variations, SADI consistently boosts performance across diverse language settings and configurations. A detailed analysis of the key components effective language-wise is provided in Appendix A.3. Additional insights from cross-lingual evaluations are discussed in Appendix A.4. + +# 6 ANALYSIS + +In this section, we analyze activation difference distribution patterns for key model elements (Section 6.1), and how SADI behaves under varying numbers of contrastive pairs (Section 6.2). + +# 6.1 CHARACTERISTICS OF ACTIVATION DIFFERENCE + +![](images/94dd560c7eaee15d74e499fe6a4c1154b6b8f4f82866cf8470ca5822b41ca741.jpg) +(a) Difference for all heads across layers. Darker blue represents bigger difference. + +![](images/e3d361ca67d042953fa3a99cc4f469fea383a1dab945c7f42fac670d076293fa.jpg) +(b) Distribution of top-100 activation difference of neurons and hidden states. The y-axis represents the number of neurons or hidden states in top-100. + +![](images/d32c68543bc4b3f42c2cdb8911e1d704ad62093a01fb6838bc2233f9794c14bf.jpg) +Figure 4: Relationship between accuracy and the amount of contrastive pairs. +Figure 3: Activation difference of each head across layers and the distribution of top-100 activation difference of neurons and hidden states with LLAMA2-7B-CHAT in StoryCloze. + +Figure 3(a) reveals activation patterns of attention heads in the middle to latter layers for contrastive pairs in StoryCloze, indicating primary information processing within these layers. Figure 3(b) shows that activation differences in neuron activity and hidden states are concentrated in the latter layers, with the most significant discrepancies observed in the final layer. These consistent patterns across tasks (see Appendix A.5) lend support to the functional segregation hypothesis, which posits that latter layers are associated with language generation and middle layers are responsible for reasoning (Zhao et al., 2024). Given this, our interventions on attention heads likely influence both reasoning and generation, contributing to the consistent improvements. + +# 6.2 SADI AND SFT WITH VARYING DATA + +We assess the impact of varying amounts of contrastive pairs on SADI and SFT in COPA task. As shown in Figure 4, SFT performance improves with an increasing number of fine-tuning data. In contrast, SADI achieves optimal results with significantly fewer pairs, e.g., only 150 items are sufficient to calculate an identification mask for targeting critical heads for intervention. This highlights SADI's effectiveness and efficiency in low-resource conditions. + +# 7 CONCLUSION + +In this study, we propose Semantics-Adaptive Dynamic Intervention (SADI), a novel approach designed to dynamically steer model behavior by adapting to the semantic contexts of inputs. SADI enhances model adaptability by modulating the activations of the identified critical model elements during inference, taking into account the directions of input semantics. Our extensive experiments across various tasks, LLMs backbones, and languages settings have demonstrated that SADI significantly outperforms established baselines, offering generalizable improvements without requiring additional training. Our study advances the field of "activation engineering" in LLMs, with the potential to inform the development of more advanced LLM intervention techniques. + +# ETHICS STATEMENT + +This work presents Semantics-Adaptive Dynamic Intervention (SADI), a method designed to enhance the performance of large language models (LLMs) by dynamically adjusting their activations without additional training. We have conducted extensive experiments across diverse tasks to evaluate SADI's effectiveness, but we recognize that biases in the underlying models and datasets may still affect outcomes. We encourage practitioners to use SADI responsibly, with careful consideration of fairness, accountability, and transparency. No human subjects were involved in this research, and all experiments were conducted using publicly available models and datasets, adhering to their respective licenses and use policies. + +# REPRODUCIBILITY STATEMENT + +We are committed to ensuring the reproducibility of our findings in this work. To facilitate this, we provide comprehensive details of our proposed Semantics-Adaptive Dynamic Intervention (SADI) method in Section 3 of the main paper, including the algorithms and mechanisms for dynamic steering vector generation and application to different model components. The experimental setups, including model configurations, datasets, and evaluation metrics, are thoroughly described in Section 4. We utilize publicly available models: LLAMA2-7B-CHAT, BLOOMZ-7B, MISTRAL-7B, and FALCON-7B-INSTRUCT, and detail any modifications or specific settings used during experimentation. All datasets employed in our evaluation are standard benchmarks, and we include references and links to these resources for accessibility. To further support reproducibility, we will release our code used for experiments upon publication, enabling other researchers to replicate our results and extend our work. + +# REFERENCES + +Ebtesam Almazrouei, Hamza Alobeidli, Abdulaziz Alshamsi, Alessandro Cappelli, Ruxandra Cojocaru, Mérouane Debbah, Étienne Goffinet, Daniel Hesslow, Julien Launay, Quentin Malartic, Daniele Mazzotta, Badreddine Noune, Baptiste Pannier, and Guilherme Penedo. The falcon series of open language models. CoRR, abs/2311.16867, 2023. doi: 10.48550/ARXIV.2311.16867. URL https://doi.org/10.48550/arXiv.2311.16867. +Rohan Anil, Sebastian Borgeaud, Yonghui Wu, Jean-Baptiste Alayrac, Jiahui Yu, Radu Soricut, Johan Schalkwyk, Andrew M. Dai, Anja Hauth, Katie Millican, David Silver, Slav Petrov, Melvin Johnson, Ioannis Antonoglou, Julian Schrittwieser, Amelia Glaese, Jilin Chen, Emily Pittler, Timothy P. Lillicrap, Angeliki Lazaridou, Orhan First, James Molloy, Michael Isard, Paul Ronald Barham, Tom Hennigan, Benjamin Lee, Fabio Viola, Malcolm Reynolds, Yuanzhong Xu, Ryan Doherty, Eli Collins, Clemens Meyer, Eliza Rutherford, Erica Moreira, Kareem Ayoub, Megha Goel, George Tucker, Enrique Piqueras, Maxim Krikun, Iain Barr, Nikolay Savinov, Ivo Danihelka, Becca Roelofs, Anaïs White, Anders Andreassen, Tamara von Glehn, Lakshman Yagati, Mehran Kazemi, Lucas Gonzalez, Misha Khalman, Jakub Sygnowski, and et al. Gemini: A family of highly capable multimodal models. CoRR, abs/2312.11805, 2023a. doi: 10.48550/ARXIV.2312.11805. URL https://doi.org/10.48550/arXiv.2312.11805. +Rohan Anil, Andrew M. Dai, Orhan First, Melvin Johnson, Dmitry Lepikhin, Alexandre Passos, Siamak Shakeri, Emanuel Taropa, Paige Bailey, Zhifeng Chen, Eric Chu, Jonathan H. Clark, Laurent El Shafey, Yanping Huang, Kathy Meier-Hellstern, Gaurav Mishra, Erica Moreira, Mark Omernick, Kevin Robinson, Sebastian Ruder, Yi Tay, Kefan Xiao, Yuanzhong Xu, Yujing Zhang, Gustavo Hernandez Abrego, Junwhan Ahn, Jacob Austin, Paul Barham, Jan A. Botha, James Bradbury, Siddhartha Brahma, Kevin Brooks, Michele Catasta, Yong Cheng, Colin Cherry, Christopher A. Choquette-Choo, Aakanksha Chowdhery, Clément Crepy, Shachi Dave, Mostafa Dehghani, Sunipa Dev, Jacob Devlin, Mark Diaz, Nan Du, Ethan Dyer, Vladimir Feinberg, Fangxiaoyu Feng, Vlad Fienber, Markus Freitag, Xavier Garcia, Sebastian Gehrmann, Lucas Gonzalez, and et al. Palm 2 technical report. CoRR, abs/2305.10403, 2023b. doi: 10.48550/ARXIV.2305.10403. URL https://doi.org/10.48550/arXiv.2305.10403. +Yuntao Bai, Andy Jones, Kamal Ndousse, Amanda Askell, Anna Chen, Nova DasSarma, Dawn Drain, Stanislav Fort, Deep Ganguli, Tom Henighan, Nicholas Joseph, Saurav Kadavath, Jackson + +Kernion, Tom Conerly, Sheer El Showk, Nelson Elhage, Zac Hatfield-Dodds, Danny Hernandez, Tristan Hume, Scott Johnston, Shauna Kravec, Liane Lovitt, Neel Nanda, Catherine Olsson, Dario Amodei, Tom B. Brown, Jack Clark, Sam McCandlish, Chris Olah, Benjamin Mann, and Jared Kaplan. Training a helpful and harmless assistant with reinforcement learning from human feedback. CoRR, abs/2204.05862, 2022. doi: 10.48550/ARXIV.2204.05862. URL https://doi.org/10.48550/arXiv.2204.05862. +Samuel R. Bowman, Gabor Angeli, Christopher Potts, and Christopher D. Manning. A large annotated corpus for learning natural language inference. In Lluis Márquez, Chris Callison-Burch, Jian Su, Daniele Pighin, and Yuval Marton (eds.), Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing, EMNLP 2015, Lisbon, Portugal, September 17-21, 2015, pp. 632-642. The Association for Computational Linguistics, 2015. doi: 10.18653/V1/D15-1075. URL https://doi.org/10.18653/v1/d15-1075. +Zhongzhi Chen, Xingwu Sun, Xianfeng Jiao, Fengzong Lian, Zhanhui Kang, Di Wang, and Chengzhong Xu. Truth forest: Toward multi-scale truthfulness in large language models through intervention without tuning. In Michael J. Wooldridge, Jennifer G. Dy, and Sriraam Natarajan (eds.), Thirty-Eighth AAAI Conference on Artificial Intelligence, AAAI 2024, Thirty-Sixth Conference on Innovative Applications of Artificial Intelligence, IAAI 2024, Fourteenth Symposium on Educational Advances in Artificial Intelligence, EAAI 2014, February 20-27, 2024, Vancouver, Canada, pp. 20967-20974. AAAI Press, 2024. doi: 10.1609/AAAI.V38I19.30087. URL https://doi.org/10.1609/aaai.v38i19.30087. +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 Jill Burstein, Christy Doran, and Thamar Solorio (eds.), *Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies*, NAACL-HLT 2019, Minneapolis, MN, USA, June 2-7, 2019, Volume 1 (Long and Short Papers), pp. 2924-2936. Association for Computational Linguistics, 2019. doi: 10.18653/V1/N19-1300. URL https://doi.org/10.18653/v1/n19-1300. +Ning Ding, Yulin Chen, Bokai Xu, Yujia Qin, Shengding Hu, Zhiyuan Liu, Maosong Sun, and Bowen Zhou. Enhancing chat language models by scaling high-quality instructional conversations. In Houda Bouamor, Juan Pino, and Kalika Bali (eds.), Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing, EMNLP 2023, Singapore, December 6-10, 2023, pp. 3029-3051. Association for Computational Linguistics, 2023. doi: 10.18653/V1/2023.EMNLP-MAIN.183. URL https://doi.org/10.18653/v1/2023.emnlp-main.183. +Samuel Gehman, Suchin Gururangan, Maarten Sap, Yejin Choi, and Noah A. Smith. Realtoxicityprompts: Evaluating neural toxic degeneration in language models. In Trevor Cohn, Yulan He, and Yang Liu (eds.), Findings of the Association for Computational Linguistics: EMNLP 2020, Online Event, 16-20 November 2020, volume EMNLP 2020 of Findings of ACL, pp. 3356-3369. Association for Computational Linguistics, 2020. doi: 10.18653/V1/2020.FINDINGS-EMNLP.301. URL https://doi.org/10.18653/v1/2020-findings-emnlp.301. +Andrew Gordon, Zornitsa Kozareva, and Melissa Roemmele. SemEval-2012 task 7: Choice of plausible alternatives: An evaluation of commonsense causal reasoning. In Eneko Agirre, Johan Bos, Mona Diab, Suresh Manandhar, Yuval Marton, and Deniz Yuret (eds.), *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), pp. 394–398, Montréal, Canada, 7-8 June 2012. Association for Computational Linguistics. URL https://aclanthology.org/S12-1052. +Thomas Hartvigsen, Saadia Gabriel, Hamid Palangi, Maarten Sap, Dipankar Ray, and Ece Kamar. Toxigen: A large-scale machine-generated dataset for adversarial and implicit hate speech detection. In Smaranda Muresan, Preslav Nakov, and Aline Villavicencio (eds.), Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), ACL 2022, Dublin, Ireland, May 22-27, 2022, pp. 3309-3326. Association for Computational Linguistics, 2022. doi: 10.18653/V1/2022.ACL-LONG.234. URL https://doi.org/10.18653/v1/2022.acl-long.234. + +Dan Hendrycks, Collin Burns, Steven Basart, Andy Zou, Mantas Mazeika, Dawn Song, and Jacob Steinhardt. Measuring massive multitask language understanding. 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=d7KBjmI3GmQ. +Evan Hernandez, Belinda Z Li, and Jacob Andreas. Inspecting and editing knowledge representations in language models. arXiv preprint arXiv:2304.00740, 2023. +Albert Q. Jiang, Alexandre Sablayrolles, Arthur Mensch, Chris Bamford, Devendra Singh Chaplot, Diego de Las Casas, Florian Bressand, Gianna Lengyel, Guillaume Lample, Lucile Saulnier, Lélio Renard Lavaud, Marie-Anne Lachaux, Pierre Stock, Teven Le Scao, Thibaut Lavril, Thomas Wang, Timothée Lacroix, and William El Sayed. Mistral 7b. CoRR, abs/2310.06825, 2023. doi: 10.48550/ARXIV.2310.06825. URL https://doi.org/10.48550/arXiv.2310.06825. +Mandar Joshi, Eunsol Choi, Daniel Weld, and Luke Zettlemoyer. TriviaQA: A large scale distantly supervised challenge dataset for reading comprehension. In Regina Barzilay and Min-Yen Kan (eds.), Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 1601-1611, Vancouver, Canada, July 2017. Association for Computational Linguistics. doi: 10.18653/v1/P17-1147. URL https://aclanthology.org/P17-1147. +Chong Li, Shaonan Wang, Yunhao Zhang, Jiajun Zhang, and Chengqing Zong. Interpreting and exploiting functional specialization in multi-head attention under multi-task learning. In Houda Bouamor, Juan Pino, and Kalika Bali (eds.), Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing, EMNLP 2023, Singapore, December 6-10, 2023, pp. 16460-16476. Association for Computational Linguistics, 2023a. doi: 10.18653/V1/2023.EMNLPMAIN.1026. URL https://doi.org/10.18653/v1/2023.emnlp-main.1026. +Kenneth Li, Oam Patel, Fernanda B. Viégas, Hanspeter Pfister, and Martin Wattenberg. Inference-time intervention: Eliciting truthful answers from a language model. In Alice Oh, Tristan Naumann, Amir Globerson, Kate Saenko, Moritz Hardt, and Sergey Levine (eds.), Advances in Neural Information Processing Systems 36: Annual Conference on Neural Information Processing Systems 2023, NeurIPS 2023, New Orleans, LA, USA, December 10 - 16, 2023, 2023b. URL http://papers.nips.cc/paper_files/paper/2023/bitical/81b8390039b7302c909cb769f8b6cd93-Abstract-Conference.html. +Stephanie Lin, Jacob Hilton, and Owain Evans. Truthfulqa: Measuring how models mimic human falsehoods. In Smaranda Muresan, Preslav Nakov, and Aline Villavicencio (eds.), Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), ACL 2022, Dublin, Ireland, May 22-27, 2022, pp. 3214-3252. Association for Computational Linguistics, 2022. doi: 10.18653/V1/2022.ACL-LONG.229. URL https://doi.org/10.18653/v1/2022.acl-long.229. +Sheng Liu, Lei Xing, and James Zou. In-context vectors: Making in context learning more effective and controllable through latent space steering. CoRR, abs/2311.06668, 2023. doi: 10.48550/ ARXIV.2311.06668. URL https://doi.org/10.48550/arXiv.2311.06668. +Shayne Longpre, Le Hou, Tu Vu, Albert Webson, Hyung Won Chung, Yi Tay, Denny Zhou, Quoc V. Le, Barret Zoph, Jason Wei, and Adam Roberts. The flan collection: Designing data and methods for effective instruction tuning. In Andreas Krause, Emma Brunskill, Kyunghyun Cho, Barbara Engelhardt, Sivan Sabato, and Jonathan Scarlett (eds.), International Conference on Machine Learning, ICML 2023, 23-29 July 2023, Honolulu, Hawaii, USA, volume 202 of Proceedings of Machine Learning Research, pp. 22631-22648. PMLR, 2023. URL https://proceedings.mlr .press/v202/longpre23a.html. +Thomas Mesnard, Cassidy Hardin, Robert Dadashi, Surya Bhupatiraju, Shreya Pathak, Laurent Sifre, Morgane Riviere, Mihir Sanjay Kale, Juliette Love, Pouya Tafti, Léonard Hussenot, Aakanksha Chowdhery, Adam Roberts, Aditya Barua, Alex Botev, Alex Castro-Ros, Ambrose Slone, Amélie Héliou, Andrea Tacchetti, Anna Bulanova, Antonia Paterson, Beth Tsai, Bobak Shahriari, Charline Le Lan, Christopher A. Choquette-Choo, Clément Crepy, Daniel Cer, Daphne Ippolito, David Reid, Elena Buchatskaya, Eric Ni, Eric Noland, Geng Yan, George Tucker, George-Cristian Muraru, Grigory Rozhdestvenskiy, Henryk Michalewski, Ian Tenney, Ivan Grishchenko, Jacob Austin, James Keeling, Jane Labanowski, Jean-Baptiste Lespiau, Jeff Stanway, Jenny Brennan, + +Jeremy Chen, Johan Ferret, Justin Chiu, and et al. Gemma: Open models based on gemini research and technology. CoRR, abs/2403.08295, 2024. doi: 10.48550/ARXIV.2403.08295. URL https://doi.org/10.48550/arXiv.2403.08295. +Nasrin Mostafazadeh, Nathanael Chambers, Xiaodong He, Devi Parikh, Dhruv Batra, Lucy Vanderwende, Pushmeet Kohli, and James Allen. A corpus and cloze evaluation for deeper understanding of commonsense stories. In Kevin Knight, Ani Nenkova, and Owen Rambow (eds.), Proceedings of the 2016 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pp. 839-849, San Diego, California, June 2016. Association for Computational Linguistics. doi: 10.18653/v1/N16-1098. URL https://aclanthology.org/N16-1098. +Niklas Muennighoff, Thomas Wang, Lintang Sutawika, Adam Roberts, Stella Biderman, Teven Le Scao, M. Saiful Bari, Sheng Shen, Zheng Xin Yong, Hailey Schoelkopf, Xiangru Tang, Dragomir Radev, Alham Fikri Aji, Khalid Almubarak, Samuel Albanie, Zaid Alyafeai, Albert Webson, Edward Raff, and Colin Raffel. Crosslingual generalization through multitask finetuning. In Anna Rogers, Jordan L. Boyd-Graber, and Naoaki Okazaki (eds.), Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), ACL 2023, Toronto, Canada, July 9-14, 2023, pp. 15991-16111. Association for Computational Linguistics, 2023. doi: 10.18653/V1/2023.ACL-LONG.891. URL https://doi.org/10.18653/v1/2023.a cl-long.891. +OpenAI. GPT-4 technical report. CoRR, abs/2303.08774, 2023. doi: 10.48550/ARXIV.2303.08774. URL https://doi.org/10.48550/arXiv.2303.08774. +Kiho Park, Yo Joong Choe, and Victor Veitch. The linear representation hypothesis and the geometry of large language models. In *Forty-first International Conference on Machine Learning*, ICML 2024, Vienna, Austria, July 21-27, 2024. OpenReview.net, 2024. URL https://openreview.net/forum?id=UGpGkLzwpP. +Edoardo Maria Ponti, Goran Glavas, Olga Majewska, Qianchu Liu, Ivan Vulic, and Anna Korhonen. XCOPA: A multilingual dataset for causal commonsense reasoning. In Bonnie Webber, Trevor Cohn, Yulan He, and Yang Liu (eds.), Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing, EMNLP 2020, Online, November 16-20, 2020, pp. 2362-2376. Association for Computational Linguistics, 2020. doi: 10.18653/V1/2020.EMNLP-MAIN.185. URL https://doi.org/10.18653/v1/2020.emnlp-main.185. +Nina Rimsky, Nick Gabrieli, Julian Schulz, Meg Tong, Evan Hubinger, and Alexander Matt Turner. Steering llama 2 via contrastive activation addition. CoRR, abs/2312.06681, 2023. doi: 10.48550/ ARXIV.2312.06681. URL https://doi.org/10.48550/arXiv.2312.06681. +Keisuke Sakaguchi, Ronan Le Bras, Chandra Bhagavatula, and Yejin Choi. Winogrande: An adversarial winograd schema challenge at scale. In The Thirty-Fourth AAAI Conference on Artificial Intelligence, AAAI 2020, The Thirty-Second Innovative Applications of Artificial Intelligence Conference, IAAI 2020, The Tenth AAAI Symposium on Educational Advances in Artificial Intelligence, EAAI 2020, New York, NY, USA, February 7-12, 2020, pp. 8732-8740. AAAI Press, 2020. doi: 10.1609/AAAI.V34I05.6399. URL https://doi.org/10.1609/aaai.v34i05.6399. +Taylor Shin, Yasaman Razeghi, Robert L. Logan IV, Eric Wallace, and Sameer Singh. Autoprompt: Eliciting knowledge from language models with automatically generated prompts. In Bonnie Webber, Trevor Cohn, Yulan He, and Yang Liu (eds.), Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing, EMNLP 2020, Online, November 16-20, 2020, pp. 4222-4235. Association for Computational Linguistics, 2020. doi: 10.18653/V1/2020.EMNLP-MAIN.346. URL https://doi.org/10.18653/v1/2020.emnlp-main.346. +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, pp. 1631-1642, Seattle, Washington, USA, October 2013. Association for Computational Linguistics. URL https://www.aclweb.org/anthology/D13-1170. + +Nishant Subramani, Nivedita Suresh, and Matthew E. Peters. Extracting latent steering vectors from pretrained language models. In Smaranda Muresan, Preslav Nakov, and Aline Villavicencio (eds.), Findings of the Association for Computational Linguistics: ACL 2022, Dublin, Ireland, May 22-27, 2022, pp. 566-581. Association for Computational Linguistics, 2022. doi: 10.18653/V1/2022.FINDINGS-ACL.48. URL https://doi.org/10.18653/v1/2022-findings-acl.48. +Hugo Touvron, Louis Martin, Kevin Stone, Peter Albert, Amjad Almahairi, Yasmine Babaei, Nikolay Bashlykov, Soumya Batra, Prajjwal Bhargava, Shruti Bhosale, Dan Bikel, Lukas Blecher, Cristian Canton-Ferrer, Moya Chen, Guillem Cucurull, David Esiobu, Jude Fernandes, Jeremy Fu, Wenyin Fu, Brian Fuller, Cynthia Gao, Vedanuj Goswami, Naman Goyal, Anthony Hartshorn, Saghar Hosseini, Rui Hou, Hakan Inan, Marcin Kardas, Viktor Kerkez, Madian Khabsa, Isabel Kloumann, Artem Korenev, Punit Singh Koura, Marie-Anne Lachaux, Thibaut Lavril, Jenya Lee, Diana Liskovich, Yinghai Lu, Yuning Mao, Xavier Martinet, Todor Mihaylov, Pushkar Mishra, Igor Molybog, Yixin Nie, Andrew Poulton, Jeremy Reizenstein, Rashi Rungta, Kalyan Saladi, Alan Schelten, Ruan Silva, Eric Michael Smith, Ranjan Subramanian, Xiaqing Ellen Tan, Binh Tang, Ross Taylor, Adina Williams, Jian Xiang Kuan, Puxin Xu, Zheng Yan, Iliyan Zarov, Yuchen Zhang, Angela Fan, Melanie Kambadur, Sharan Narang, Aurélien Rodriguez, Robert Stojnic, Sergey Edunov, and Thomas Scialom. Llama 2: Open foundation and fine-tuned chat models. CoRR abs/2307.09288, 2023. doi: 10.48550/ARXIV.2307.09288. URL https://doi.org/10.48550/arXiv.2307.09288. +Alexander Matt Turner, Lisa Thiergart, David Udell, Gavin Leech, Ulisse Mini, and Monte MacDiarmid. Activation addition: Steering language models without optimization. CoRR, abs/2308.10248, 2023. doi: 10.48550/ARXIV.2308.10248. URL https://doi.org/10.48550/arXiv.2308.10248. +Weixuan Wang, Barry Haddow, and Alexandra Birch. Retrieval-augmented multilingual knowledge editing. arXiv preprint arXiv:2312.13040, 2023. +Weixuan Wang, Barry Haddow, Alexandra Birch, and Wei Peng. Assessing factual reliability of large language model knowledge. In Proceedings of the 2024 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies (Volume 1: Long Papers), pp. 805-819, 2024a. +Weixuan Wang, Barry Haddow, Wei Peng, and Alexandra Birch. Sharing matters: Analysing neurons across languages and tasks in llms. CoRR, abs/2406.09265, 2024b. doi: 10.48550/ ARXIV.2406.09265. URL https://doi.org/10.48550/arXiv.2406.09265. +Weixuan Wang, Minghao Wu, Barry Haddow, and Alexandra Birch. Bridging the language gaps in large language models with inference-time cross-lingual intervention. arXiv preprint arXiv:2410.12462, 2024c. +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. In The Tenth International Conference on Learning Representations, ICLR 2022, Virtual Event, April 25-29, 2022. OpenReview.net, 2022. URL https://openreview.net/forum?id=gEZrGCozdqR. +Yiran Zhao, Wenxuan Zhang, Guizhen Chen, Kenji Kawaguchi, and Lidong Bing. How do large language models handle multilingualism? CoRR, abs/2402.18815, 2024. doi: 10.48550/ ARXIV.2402.18815. URL https://doi.org/10.48550/arXiv.2402.18815. +Andy Zou, Long Phan, Sarah Chen, James Campbell, Phillip Guo, Richard Ren, Alexander Pan, Xuwang Yin, Mantas Mazeika, Ann-Kathrin Dombrowski, Shashwat Goel, Nathaniel Li, Michael J. Byun, Zifan Wang, Alex Mallen, Steven Basart, Sanmi Koyejo, Dawn Song, Matt Fredrikson, J. Zico Kolter, and Dan Hendrycks. Representation engineering: A top-down approach to AI transparency. CoRR, abs/2310.01405, 2023. doi: 10.48550/ARXIV.2310.01405. URL https://doi.org/10.48550/arXiv.2310.01405. + +# A APPENDIX + +# A.1 DESCRIPTION OF TASKS + +- COPA Each question consists of a premise and two alternatives, with the task being to choose the alternative that more plausibly has a causal relationship with the premise. +- StoryCloze Each question requires a model to choose the correct ending to a four-sentence story for evaluating story understanding and script learning. +- NLI It is a collection of sentence pairs manually labeled for balanced classification with the labels entailment, contradiction, and neutral. +- MMLU It is a benchmark designed to measure knowledge acquired during pretraining, covering 57 subjects across STEM, the humanities, the social sciences, and more. +- SST2 and SST5 They are datasets used for sentiment analysis with 2 labels (negative, positive) and 5 labels (negative, somewhat negative, neutral, somewhat positive, or positive), respectively. +- BoolQ It is a question answering dataset for yes/no questions where questions are naturally occurring. +- Winogrande It a fill-in-a-blank task with binary options, with the goal of choosing the right option for a given sentence which requires commonsense reasoning. +- TriviaQA It is a realistic text-based question answering dataset which includes question-answer pairs from documents collected from Wikipedia and the web. +- TruthfulQA It is a benchmark to measure whether a language model is truthful in generating answers to questions. The benchmark comprises 817 questions that span 38 categories, including health, law, finance and politics. TruthfulQA includes both multiple-choice and generation tracks. The performance of multiple-choice track is gauged using multiple-choice accuracy (MC). This metric is based on the conditional probabilities of candidate answers given the question, with a successful result counted when the truthful answer ranks first. In the generation track, we use two pre-trained judge models to evaluate the truthfulness and informativeness. +- ToxiGen It is a dataset that contains implicitly toxic and benign sentences mentioning 13 minority groups. +- XCOPA A multilingual dataset, translated from the English COPA, is used to evaluate the capacity of models to transfer commonsense reasoning across languages. + +# A.2 DATASET SIZES + +The size of datasets for each task are described in the Table 9. + +Table 9: The number of data used for identifying key elements and testing for 11 tasks. + +
TaskCOPAStoryClozeNLIMMLUSST2SST5BoolQWinograndeTriviaQAToxiGenTruthfulQA
# identify500360200012178100010001000100010001000817
# testset5001511500012178182122103270126710001400817
+ +# A.3 ELEMENTS OVERLAP + +In our analysis, detailed in Figure 5, we examine the overlap of identified key elements (attention heads, neurons, and hidden states) across various tasks. We observed minimal overlap across components between open-ended generation and multiple-choice tasks, particularly in attention heads and neurons. This indicates a high degree of functional specialization within these components. Unlike attention heads and neurons, hidden states demonstrate greater overlap, mainly due to their positioning in the final layer which more directly influences the model's output (as shown in Figure 4). The specialization observed among attention heads supports the notion that multi-head attention mechanisms evolve uniquely according to the task similarities. It is consistent with the finding in Li et al. (2023a). + +![](images/31daebdc8037da0f6d5493ac7f97992d33d79d98dc130b47029f5794ac6490e2.jpg) +Figure 5: Overlap of identified key elements across various tasks. From 1 to 10 represents the tasks: COPA, StoryCloze, SST2, BoolQ, MMLU, NLI, Winogrande, TriviaQA, ToxiGen, TruthfulQA. + +![](images/bb30aa2ca57378c67ff07c203304c7df536e302bf5b40cdf2b3008e6a97cad9e.jpg) + +![](images/f8c544363ee3f6cfdaa175152f1df2ad488810f1c1c4042e65953da2823ebf6a.jpg) + +# A.4 CROSS-LINGUAL SADI + +Table 10: Cross-lingual results based on the identified heads/neurons from the English contrastive pairs. + +
Languageiditswtathtrvizh
BASELINE51.4061.2050.2049.4050.8049.4051.8062.80
SFT68.6079.2052.0047.0049.6057.8068.6077.80
SADI-HEAD62.8067.6050.4050.2051.0051.2056.6070.00
SADI-NEURON60.4061.8050.2049.8051.0059.6058.6064.00
+ +We have shown the effectiveness of SADI in the multilingual scenarios where contrastive pairs, constructed in the same language as the test input, are used to identify relevant components. Further, we explored its impact in a cross-lingual setting by employing English contrastive pairs to identify key elements and then applying SADI to multilingual test inputs. The results, along with those of SFT—which involves fine-tuning in English and testing on a multilingual dataset—are presented in Table 10. We found that SADI displayed enhanced language transfer capabilities, particularly in Tamil, Thai, and Turkish. These successful interventions suggest that critical elements are shared across languages, supporting SADI's utility in cross-lingual applications. + +# A.5 ACTIVATION DIFFERENCE DISTRIBUTIONS ACROSS TASKS + +We demonstrate the distributions of activation difference across layers for heads, neurons and hidden states in Figure 6 and in Figure 7 in COPA, BoolQ,TriviaQA, and TruthfulQA tasks. They show consistent patterns across various tasks. + +![](images/31861a99014590831f991fa182a27d9b52d7909fc09e7b5c654c251debae4c5c.jpg) +(a) Difference on COPA. + +![](images/3083ae6ba62a9de4a9fef0522a3ad6bd29fa7e4c0986ea22cdcc6fe6d241e68d.jpg) +(b) Difference on $\mathsf{Boo1Q}$ + +![](images/2d6ef1a30640a1a23abc857fbe7c758a7aa38b137ee057fc9856f8f7f86c962f.jpg) +(c) Difference TriviaQA. +Figure 6: Activation difference of each head across layer. + +![](images/ccdc45292cd61ef2e8daa5bf496f621dcafcb035436dbf3298a7365f90728652.jpg) +(d) Difference on TruthfulQA. + +![](images/1a593db8a3fd2655b8f9d4dee8e133a0d7ff7aca8ce57bd0d2bdfb2bb0ba25c5.jpg) +(a) Distribution on COPA. + +![](images/30e37a56aa03cfb5c0da3a1b119ff685f776a445eab641dc54800abfc7513c3e.jpg) +(b) Distribution +BoolQ. + +![](images/3c01e214bd8cdec2157c29b6a105ac31353c4e31aa99553eecb7a0e25fabfc4c.jpg) +(c) Distribution TriviaQA. +Figure 7: Activation difference of top-100 neurons and hidden states. + +![](images/3b0703d93eb71c0499b476d0795af4f7243190586286a927e1358e8ac0d0ac38.jpg) +(d) Distribution TruthfulQA. \ No newline at end of file diff --git a/ICLR/2025/Semantics-Adaptive Activation Intervention for LLMs via Dynamic Steering Vectors/images.zip b/ICLR/2025/Semantics-Adaptive Activation Intervention for LLMs via Dynamic Steering Vectors/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..81277057c68b27fc09fa495d61e1a68d13dd8731 --- /dev/null +++ b/ICLR/2025/Semantics-Adaptive Activation Intervention for LLMs via Dynamic Steering Vectors/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:256d939917857cbed141d322632efabfc573d73a838c2e2cc9fdb75a7c9cfaba +size 672241 diff --git a/ICLR/2025/Semantics-Adaptive Activation Intervention for LLMs via Dynamic Steering Vectors/layout.json b/ICLR/2025/Semantics-Adaptive Activation Intervention for LLMs via Dynamic Steering Vectors/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..1bd451053ad18efd39f2ab5547f3c0cc30c5b95d --- /dev/null +++ b/ICLR/2025/Semantics-Adaptive Activation Intervention for LLMs via Dynamic Steering Vectors/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0d0c175b33a118a29bbb2598fc959778f245e3842e1b62949bcd8db1b6feb022 +size 494341 diff --git a/ICLR/2025/Semantix_ An Energy-guided Sampler for Semantic Style Transfer/d4b6653e-ea65-4123-ba90-bbc79e0256ec_content_list.json b/ICLR/2025/Semantix_ An Energy-guided Sampler for Semantic Style Transfer/d4b6653e-ea65-4123-ba90-bbc79e0256ec_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..d1aed581489580fe2cc88a32eaff831b08c03925 --- /dev/null +++ b/ICLR/2025/Semantix_ An Energy-guided Sampler for Semantic Style Transfer/d4b6653e-ea65-4123-ba90-bbc79e0256ec_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7c23f96fbc5899020d921d42d4ca685545c3d1c667ab4e34c0f234bce665ae6a +size 139509 diff --git a/ICLR/2025/Semantix_ An Energy-guided Sampler for Semantic Style Transfer/d4b6653e-ea65-4123-ba90-bbc79e0256ec_model.json b/ICLR/2025/Semantix_ An Energy-guided Sampler for Semantic Style Transfer/d4b6653e-ea65-4123-ba90-bbc79e0256ec_model.json new file mode 100644 index 0000000000000000000000000000000000000000..ee247fb6b54efd9a7d8edf08cb831e3257f08d47 --- /dev/null +++ b/ICLR/2025/Semantix_ An Energy-guided Sampler for Semantic Style Transfer/d4b6653e-ea65-4123-ba90-bbc79e0256ec_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a6a886473fcb416cea151976367152f282be532fd07d09a5ebbef8226b9ff897 +size 179768 diff --git a/ICLR/2025/Semantix_ An Energy-guided Sampler for Semantic Style Transfer/d4b6653e-ea65-4123-ba90-bbc79e0256ec_origin.pdf b/ICLR/2025/Semantix_ An Energy-guided Sampler for Semantic Style Transfer/d4b6653e-ea65-4123-ba90-bbc79e0256ec_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..445491dc619f0533fecc009e3b9f0f716c9b196e --- /dev/null +++ b/ICLR/2025/Semantix_ An Energy-guided Sampler for Semantic Style Transfer/d4b6653e-ea65-4123-ba90-bbc79e0256ec_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:932fdc5b572ee72c1877850edb45dd99f4e4f742da94a2668e8920b2b6a11c82 +size 11356904 diff --git a/ICLR/2025/Semantix_ An Energy-guided Sampler for Semantic Style Transfer/full.md b/ICLR/2025/Semantix_ An Energy-guided Sampler for Semantic Style Transfer/full.md new file mode 100644 index 0000000000000000000000000000000000000000..19217d38e48b60d345c21e5b10e0318998a5d380 --- /dev/null +++ b/ICLR/2025/Semantix_ An Energy-guided Sampler for Semantic Style Transfer/full.md @@ -0,0 +1,587 @@ +# SEMANTIX: AN ENERGY-GUIDED SAMPLER FOR SEMANTIC STYLE TRANSFER + +Huiang He * + +South China University of Technology mshuianghe@mail.scut.edu.cn + +Minghui Hu * + +SpellBrush & Nanyang Technological University e200008@e.ntu.edu.sg + +Chuanxia Zheng + +VGG, University of Oxford cxzheng@robots.ox.ac.uk + +Chaoyue Wang + +The University of Sydney +chaoyue.wang@outlook.com + +Tat-Jen Cham + +College of Computing and Data Science Nanyang Technological University ASTJCham@ntu.edu.sg + +# ABSTRACT + +Recent advances in style and appearance transfer are impressive, but most methods isolate global style and local appearance transfer, neglecting semantic correspondence. Additionally, image and video tasks are typically handled in isolation, with little focus on integrating them for video transfer. To address these limitations, we introduce a novel task, Semantic Style Transfer, which involves transferring style and appearance features from a reference image to a target visual content based on semantic correspondence. We subsequently propose a training-free method, Semantix, an energy-guided sampler designed for Semantic Style Transfer that simultaneously guides both style and appearance transfer based on semantic understanding capacity of pre-trained diffusion models. Additionally, as a sampler, Semantix can be seamlessly applied to both image and video models, enabling semantic style transfer to be generic across various visual media. Specifically, once inverting both reference and context images or videos to noise space by SDEs, Semantix utilizes a meticulously crafted energy function to guide the sampling process, including three key components: Style Feature Guidance, Spatial Feature Guidance and Semantic Distance as a regularisation term. Experimental results demonstrate that Semantix not only effectively accomplishes the task of semantic style transfer across images and videos, but also surpasses existing state-of-the-art solutions in both fields. + +# 1 INTRODUCTION + +The vision community has rapidly improved the quality of image and video generation over a short period. In particular, some powerful baseline systems for Text-to-Image (Podell et al., 2023; Sahara et al., 2022; Nichol et al., 2021; Rombach et al., 2022; Ramesh et al., 2022) and Text-to-Video (Blattmann et al., 2023; Guo et al., 2023; Girdhar et al., 2023) have been proposed, which contributes a series of applications such as controllable generation in ControlNet (Zhang et al., 2023a; Hu et al., 2023), IPAdapter (Ye et al., 2023) and InstantID (Wang et al., 2024c). Among these innovations, one significant field is visual transfer, which modifies a context image to fit the style or appearance of the reference image, while preserving the original content or structure. + +Prior works have extensively explored visual transfer. However, they typically focus on two distinct scenarios: (1) Style transfer (Gatys et al., 2015; 2016; Huang and Belongie, 2017; Li et al., 2017; Liu et al., 2021; Deng et al., 2022; Wang et al., 2023b; 2024a; Ye et al., 2023) that utilizes the global stylistic features for the entire image style modification, but overly emphasize the overarching style of the reference images; and (2) Appearance transfer (Isola et al., 2017; Zhu et al., 2017; Park et al., 2020a;b; Zheng et al., 2021; Mou et al., 2023; Alaluf et al., 2023; Wang et al., 2024b) that conveys + +![](images/07bd158fbd76be0d41a9424e499cde9341758ac356b2062ffbb6d47ea0aab639.jpg) +Figure 1: Examples of our Semantic Style Transfer. Given a visual context and a reference image (Top examples), Semantic Style Transfer can perform Semantic Style Transfer based on the semantic correspondence. Besides, our Semantic Style Transfer also can be directly adapted for the videos (Bottom examples) without the need of additional modification. It is important to emphasize that, as a sampler, Semantic Style Transfer directly leverages the knowledge from the pretrained model to guide the sampling process based on our proposed energy function for Semantic Style Transfer, without the need for any additional training or optimization. + +the object appearance from the reference to the context image, but exhibits only limited sensitivity to the overall perceptual style. Besides, both of them ignore semantic alignment and video continuity during the transfer process. These factors destroy the video continuity and lead to global style transfer risking content leakage, while local appearance transfer may disrupt structural integrity. + +We observe that the tasks of style transfer and appearance transfer share similarities in their underlying objectives: to transfer relevant information from the reference visual content to the context visual content. We assume that a feature transfer task guided by semantic alignment can better integrate these two tasks, mitigating the risks of content leakage and structural disruption. Thus we define a task termed Semantic Style Transfer as: given a context visual content, e.g., image or video, and a reference image with style and (or) appearance features, the objective of Semantic Style Transfer is to analyse and transfer the features from the reference image to the context visual content through precise semantic mapping. Specifically, semantic style transfer considers semantic correspondence between context and reference images. When there is a clear semantic correspondence between the context image and the reference image, the transfer is executed based on the semantic correspondence. For instance, as shown in Fig. 1, the body of the giraffe and the zebra exhibit semantic correspondence, + +then the visual features of the body of zebra will be applied to the body of giraffe. Conversely, when semantic correspondence is weak, as between village in Van Gogh's style and the giraffe, the style is injected based on the other correlations, e.g., color information or positional information. + +To achieve this goal, we propose Semantix, an energy-guided sampler, which leverages the strong semantic alignment capabilities of pre-trained diffusion models (Epstein et al., 2023) to transfer features from the reference image to the context visual based on the semantic correspondence without any training or optimization. Initially, we employ SDE Inversion (Huberman-Spiegelglas et al., 2023; Nie et al., 2023) to invert given content into the noise manifold, establishing a conducive foundation for semantic style manipulation. We then introduce a specialized energy function for semantic style transfer that guides the sampling process rather than modify the model structure (Alaluf et al., 2023), thus maintaining the original capabilities of the visual models and supporting video continuity. Our proposed energy function comprises three terms: i) Style Feature Guidance, to align the style features with the reference image; ii) Spatial Feature Guidance, to maintain spatial coherence with context; and iii) Semantic Distance, to regularise the whole function. In particular, within the term of style feature guidance, we initially leverage semantic correspondence in the diffusion model (Tang et al., 2023) and position encoding (Vaswani et al., 2017; Dosovitskiy et al., 2020) to align the output and style features. In the spatial feature guidance component, we directly consider the feature distances at corresponding positions to ensure consistency between the generated content and the context. Lastly, we utilize the distance between the cross-attention maps of the generated content and the given context as a regularisation term to enhance stability. + +Integrating these capabilities, Semantix effectively transfers the features with semantic from the reference image to the context with precise spatial alignment, satisfying the requirements of Semantic Style Transfer. Additionally, as Semantix functions as a sampler for diffusion models, it can be seamlessly applied to various image or video base models. Since these pre-trained models already encapsulate sufficient semantic information and maintain action coherence, Semantix enables training-free semantic style transfer across image and video simply through guided sampling. + +In summary, our contributions include the following key points: + +- We introduce Semantix, an energy-guided sampler specifically designed for training-free semantic style transfer. We further extend Semantix across images and videos, demonstrating the versatility of energy-guided samplers. +- Experimental results demonstrate that Semantix yields superior results in training-free semantic style transfer across images and videos, surpassing existing solutions in both style and appearance transfer in terms of accuracy and adaptability. + +# 2 RELATED WORKS + +Style and Appearance Transfer Style transfer infuses the style information of a reference image into a context image to synthesize a stylized context image. Previous convolution-based methods (Huang and Belongie, 2017; Gatys et al., 2016; Johnson et al., 2016; Li et al., 2017; 2018; Park and Lee, 2019; Lai et al., 2017; Gu et al., 2018) and Transformer-based methods (Deng et al., 2022; Wu et al., 2021; Wang et al., 2022; Liu et al., 2021) have successfully facilitated style transfer through the fusion of style and context information. Recently, diffusion-based style transfer has seen significant attention and progress. Some works (Ye et al., 2023; Wang et al., 2024a; 2023b; Sohn et al., 2023) use additional trained networks to extract style features for guiding image synthesis. These methods inject global style features into the context image, altering its overall color and brush strokes but ignoring the necessary semantic correspondence for meaningful style transfer. Other training-based methods (Ruiz et al., 2023a,b; Shi et al., 2023; Wei et al., 2023; Li et al., 2024) require fine-tuning the diffusion model to learn specific styles or introducing new text embeddings for style representation through textual inversion (Gal et al., 2022; Zhang et al., 2023b). These methods are time-consuming and often struggle to balance style injection with context preservation. Some studies (Qi et al., 2024; Wang et al., 2023a; Jeong et al., 2023; Frenkel et al., 2024; Gandikota et al., 2023) attempt to achieve style transfer through decoupling, but they either face challenges in acquiring paired style datasets or risk losing image context. Contrastive learning (Yang et al., 2023; Chen et al., 2021; Zhang et al., 2022; Park et al., 2020a) has also been employed, requiring carefully designed loss functions for optimization. However, all these methods need additional training. Some + +training-free methods (Chung et al., 2023; Deng et al., 2023; Hertz et al., 2023; Jeong et al., 2024) induce style transfer by manipulating features within the attention blocks of the diffusion model. + +Meanwhile, appearance transfer aims to map appearance from one image to another. Early methods based on GANs (Isola et al., 2017; Zhu et al., 2017; Yi et al., 2017) have faced practical limitations. Other approaches using VAEs (Park et al., 2020b; Liu et al., 2017; Jha et al., 2018; Pidhorskyi et al., 2020) encode images into separate structure and appearance representations to combine features from different images. Recent diffusion-based techniques have significantly advanced appearance transfer (Mou et al., 2023; Epstein et al., 2023; Kwon and Ye, 2022; Alaluf et al., 2023; Wang et al., 2024b). However, these approaches utilize local appearance features for guidance, overlooking precise semantic correspondence between images, leading to inaccurate appearance transfer. + +While related dense style transfer work (Ozaydin et al.) introduces the concept of semantics, our definitions and tasks differ significantly, particularly in how semantic features are extracted and used. Specifically, unlike some semantic style transfer methods relying on segmentation labels (Shen et al., 2019; Bhattacharjee et al., 2020) or CLIP visual features (Ozaydin et al.), they lose natural language alignment. Furthermore, such existing works only extract dense semantic features and reuse it in given image. Instead, our work defines a more expansive zero-shot semantic style transfer task focused on generation. In detail, rather than merely reusing the low-level features from a given image, e.g., color, we leveraged a powerful pre-trained diffusion model to generate novel style images that adhere to semantic constraints derived from the features of the given image. + +Semantic Correspondence between Images Establishing semantic correspondence between images is crucial. Past methods (Zhang et al., 2021; Zhao et al., 2021) using supervised learning require extensive annotations. To address data limitations, some works (Wang et al., 2020; Rocco et al., 2018; Lee et al., 2019; Seo et al., 2018) use weakly supervised approaches. Recently, self-supervised learning has gained attention, especially with diffusion models. Studies (Tang et al., 2023; Zhang et al., 2024; Caron et al., 2021) leverage these models representation abilities to calculate feature similarities and establish semantic correspondence during the denoising process. + +Energy Functions Previous research interprets diffusion models as energy-based models (Liu et al., 2022), where the energy function guides the generation process for precise outputs. The energy function has various applications, such as energy-guided image editing (Mou et al., 2023; 2024; Epstein et al., 2023) and translation (Zhao et al., 2022). The energy function also shows potential in controllable generation, guiding generation through conditions such as sketch (Voynov et al., 2023a), mask (Singh et al., 2023), layout (Chen et al., 2024), concept (Liu et al., 2022) and universal guidance (Bansal et al., 2023; Yu et al., 2023), enabling precise control over the output. + +# 3 PRELIMINARIES + +Energy Function Diffusion models can be viewed as score-based generative models (Song et al., 2020b). In classifier guidance (Dhariwal and Nichol, 2021; Ho and Salimans, 2022), the gradient of the classifier $\nabla_{x_t}\log p_\phi (y|x_t)$ is used to influence generation. From the perspective of score functions, the condition $y$ can be integrated within a conditional probability $q(x_{t}|y)$ via an auxiliary score function and expressed as such: + +$$ +\nabla_ {x _ {t}} \log q (x _ {t} | y) = \nabla_ {x _ {t}} \log \left(\frac {q (y | x _ {t}) q (x _ {t})}{q (y)}\right) \propto \nabla_ {x _ {t}} \log q (x _ {t}) + \nabla_ {x _ {t}} \log q (y | x _ {t}), \tag {1} +$$ + +where the first term is viewed as the unconditional denoiser $\epsilon_{\theta}(x_t; t, \emptyset)$ , and the second term can be interpreted as the gradient of the energy function: $\mathcal{E}(x_t; t, y) = \log q(y|x_t)$ . Alternatively, classifier-free guidance (CFG) (Ho and Salimans, 2022) can also be used, expressed as: + +$$ +\hat {\epsilon} _ {t} = (1 + \omega) \epsilon_ {\theta} \left(x _ {t}; t, y\right) - \omega \epsilon_ {\theta} \left(x _ {t}; t, \emptyset\right) \tag {2} +$$ + +where $\omega$ is the classifier-free guidance strength. In fact, the diffusion model can also be interpreted as an energy-based model (Liu et al., 2022), guided by any energy function. One can design an energy function beyond class-based conditioning and use it for guidance (Zhao et al., 2022; Epstein et al., 2023; Bansal et al., 2023; Chen et al., 2024; Yu et al., 2023; Voynov et al., 2023a; Kwon and Ye, 2022). Such guidance provides directional information to guide the diffusion process, and if appropriately + +![](images/5b84d1bbd691b121650f909c70bec4193c0a52bfcf0d773e1eb725cfcad51ae6.jpg) +Figure 2: Overview of Semantix. Given a reference image $I^{ref}$ and a context image $I^c$ or video $V^c$ , we first invert them to the latent $x_{T}$ through an edit-friendly DDPM inversion. In the denoising process, we then modify the $x_{t}^{out}$ through the designed energy gradient in every sampling step. + +designed, as we shall show in this paper, it can be used to preserve semantic structure while adjusting the style or appearance of the context visual according to the reference image. Following from Eq. 2, the guidance from an energy function can be expressed as follows: + +$$ +\hat {\epsilon} _ {t} = (1 + \omega) \epsilon_ {\theta} \left(x _ {t}; t, y\right) - \omega \epsilon_ {\theta} \left(x _ {t}; t, \emptyset\right) + \gamma \nabla_ {x _ {t}} \mathcal {E} \left(x _ {t}; t, y\right), \tag {3} +$$ + +where $\omega$ is the classifier-free guidance strength, and $\gamma$ is the newly introduced guidance weight for the energy function $\mathcal{E}(x_t; t, y)$ . In this section, $x_t, \phi, \theta, \emptyset$ represent diffused signal, classifier parameters, noise estimator parameters, null token respectively. + +# 4 METHODS + +To address the task of Semantic Style Transfer, it is essential to establish precise semantic mappings between the content to be transferred and the target. And the style features and visual appearance are required to be transferred with the guidance from semantic correspondence, while preserving the main structure of the original content. + +To achieve this, we propose Semantix, a novel energy-guided sampler built upon off-the-shelf diffusion models, as illustrated in Fig. 2. Given a context image $I^c$ or video $V^c$ and the reference image $I^{ref}$ , we begin with inverting these images or videos to latents $x_{T}$ through the edit-friendly DDPM inversion (Fig. 2 (left)). In the denoising process, we then modify the target $x_{t}^{out}$ , which is initialized using the inverse noise of the context visual $x_{T}^{c}$ at the final step $T$ , through the designed energy gradient in every sampling step(Fig. 2 (right)). During the sampling process, we integrate the guidance from our sampler with classifier-free guidance to generate high-quality samples (Liu et al., 2022; Epstein et al., 2023). Notably, our approach only provides additional guidance during sampling, without altering the generative capabilities of the visual model. As a result, the pre-trained video model inherently maintains motion consistency without additional modification. Besides, an AdaIN (Huang and Belongie, 2017) is employed to harmonize color disparities among $I^{out}$ and $I^{ref}$ , which is also widely used in recent works (Alaluf et al., 2023; Chung et al., 2023). The algorithm details can be found in Alg. 1. + +# 4.1 DDPM INVERSION + +To enhance image or video style editing capabilities, we first employ DDPM inversion (Huberman-Spiegelglas et al., 2023) to invert the input to the noise space as outlined in Appendix A. This method significantly reduces the reconstruction errors associated with CFG. As shown in Fig. 2 (left), given a reference image $I^{ref}$ and a context image $I^c$ or video $V^c$ , we first derive the respective independent inversion noise sequences $\{\pmb{x}_T^{ref},\pmb{z}_T^{ref},\pmb{z}_{T - 1}^{ref},\dots,\pmb{z}_1^{ref}\}$ for $I^{ref}$ , and $\{\pmb{x}_T^c,\pmb{z}_T^c,\pmb{z}_{T - 1}^c,\dots,\pmb{z}_1^c\}$ for $I^c$ or $V^c$ in the forward process. As shown in Fig. 3, at $t = 601$ , the features we extracted from the diffusion model contain sufficient contextual information and exhibit precise semantic correspondence between context and reference images. Thus, we revert the images to the $T = 601$ timestep. Once obtained noise sequences, these noise maps are fixed for using in the guided sampling process later. We then initialize $x_{T}^{\mathrm{out}}$ , $z_{t}^{\mathrm{out}}$ as $x_{T}^{c}$ , $z_{t}^{c}$ and only manipulate the predictions from this sequence. + +![](images/0561c260014097691cf191b97c67d6beed9d145f3315220f8f3eb603f01a9323.jpg) +Figure 3: Visualizing feature maps. We extracted features from the second block of the diffusion model decoder and visualized the top three PCA components and feature mapping at each timestep. + +![](images/2e29201036759dd696ea7a5e043630456af271b2be443d877fa087d316da4c4d.jpg) + +![](images/d1a364d4898e74f83c4e3551c25336bca172feb042beb690089fe9ccc71c10cc.jpg) + +![](images/fd5d1bea856cfc9b70f28d6c776941705f962b1e2006128bec182ded1037bf45.jpg) + +# 4.2 DESIGN OF ENERGY FUNCTION + +Inspired by guidance-based image generation and editing methods (Epstein et al., 2023; Mou et al., 2023), we regulate the sampling process through the design of an energy function to achieve semantic style transfer. By leveraging the gradient of the energy function, we can guide the context visual toward the desired style while preserving its structural integrity. Eq. 3 can be re-expressed as follows: + +$$ +\hat {\epsilon} _ {t} = (1 + \omega) \epsilon_ {\theta} (\boldsymbol {x} _ {t}; t, \mathcal {C}) - \omega \epsilon_ {\theta} (\boldsymbol {x} _ {t}; t, \phi) + \nabla_ {\boldsymbol {x} _ {t}} \mathcal {F} (\boldsymbol {x} _ {t}; t, \mathcal {C}), \tag {4} +$$ + +where $\omega$ is the classifier-free guidance strength and $\mathcal{F}$ is the designed energy function which includes three parts: $\mathcal{F}_{ref}$ for Style Feature Guidance, $\mathcal{F}_c$ for Spatial Feature Guidance, and $\mathcal{F}_{reg}$ for regularisation: + +$$ +\mathcal {F} \left(\boldsymbol {x} _ {t}; t, \mathcal {C}\right) = \gamma_ {r e f} \mathcal {F} _ {r e f} + \gamma_ {c} \mathcal {F} _ {c} + \gamma_ {r e g} \mathcal {F} _ {r e g}, \tag {5} +$$ + +where $\gamma$ is the weight of corresponding components. We detail the three components below. + +Style Feature Guidance To achieve semantic style transfer, we propose style feature guidance, which accurately captures the semantic correspondence between reference and context features to guide style feature injection. In DIFT (Tang et al., 2023), the authors observed that the internal features of the pre-trained Stable Diffusion model can be used to establish accurate semantic correspondence. Inspired by it, we initially feed the inversion latents $\pmb{x}_t^c$ , $\pmb{x}_t^{ref}$ and the infusion latent $\pmb{x}_t^{out}$ to the diffusion model and acquire the corresponding feature maps $F_t^c$ , $F_t^{ref}$ & $F_t^{out} \in \mathbb{R}^{\{B,c',h',w'\}}$ from the intermediate layers of the network. For videos, feature maps $F_t^c$ & $F_t^{out}$ are extracted from each individual frame $I^c \in V^c$ , $I^{ref} \in V^{ref}$ . Next, we pre-align the features via DIFT. Specifically, given the features $F_t^c$ , $F_t^{ref}$ and pixels $p_i, p_j$ in $I^c$ , $I^{ref}$ respectively, we calculate the $\ell_2$ distance between the pairwise vectors $\mathrm{v}_{p_i}^c$ from $F_t^c$ and $\mathrm{v}_{p_j}^{ref}$ from $F_t^{ref}$ , and then define the pixels with the smallest distance as the corresponding pixels: + +$$ +D _ {i j} = \left\| \mathrm {v} _ {p _ {i}} ^ {c} - \mathrm {v} _ {p _ {j}} ^ {r e f} \right\| _ {2} ^ {2}, \quad \forall \mathrm {v} _ {p _ {i}} ^ {c} \in F _ {t} ^ {c}, \quad \forall \mathrm {v} _ {p _ {j}} ^ {r e f} \in F _ {t} ^ {r e f}, \tag {6} +$$ + +$$ +p _ {j} ^ {*} = \underset {p _ {j}} {\arg \min } D _ {i j}. \tag {7} +$$ + +Therefore, for any context feature vector of the context image $\mathbf{v}_{p_i}^c\in F_t^c$ , the corresponding feature pair can be defined as $\left(\mathrm{v}_{p_i}^c,\mathrm{v}_{p_j^*}^{ref}\right)$ . For all $\mathbf{v}^c$ in $F_{t}^{c}$ , we can identify corresponding feature pairs. Consequently, we obtain a new set $F_{t}^{ref*}$ according to corresponding feature pairs. + +![](images/22e11a1973dadc92d96eb4e977084c005bed129f3a61288d277574db4684a02b.jpg) +Figure 4: Qualitative comparison with style transfer and appearance transfer methods. The top two rows are comparisons of style transfer, the bottom two of appearance transfer. +Figure 5: Qualitative comparison of video style transfer. Click the images to play the animation clips. (Recommended to use Adobe Reader to ensure the GIFs play properly.) + +MCCNet + +UNIST + +Cross-Image + +CCPL + +Ours + +MCCNet + +UNIST + +Cross-Image + +CCPL + +Ours + +However, such an affinity-based approach overlooks the spatial location of the vectors within the context features and fails to account for their relationships with adjacent vectors. Inspired by Position Encoding (PE) (Vaswani et al., 2017; Dosovitskiy et al., 2020), we integrate an additional optimizing-free position encoding term to maintain relative position. Thus the feature maps can be regarded as: + +$$ +\bar {F} _ {t _ {\{i \}}} ^ {c} \leftarrow F _ {t} ^ {c} + \lambda_ {p e} \cdot p e _ {\{i \}}, \tag {8} +$$ + +$$ +\bar {F} _ {t _ {\{i \}}} ^ {r e f} \leftarrow F _ {t} ^ {r e f} + \lambda_ {p e} \cdot p e _ {\{i \}}. \tag {9} +$$ + +Subsequently, we locate the corresponding pairs of features $\bar{F}_t^{ref*}$ using the $\ell_2$ distance, and utilize the obtained new pairs of feature vectors $\left(\mathbf{v}_{p_i}^c,\mathbf{v}_{\bar{p}_j^*}^{ref}\right)$ to form the new rearranged $F_{t}^{ref*}$ . Therefore, the optimization objective for Style Feature Guidance is to minimize: + +$$ +\mathcal {F} _ {r e f} \propto \boldsymbol {d} \left(F _ {t} ^ {\text {o u t}}, F _ {t} ^ {\text {r e f *}}\right), \tag {10} +$$ + +where $d$ is a type of distance metric. We use the cosine similarity as implemented in (Mou et al., 2023). Besides, we use self-attention (Tumanyan et al., 2023) to define region masks $m_{c}$ and $m_{ref}$ , which are generated via $k$ -means clustering and applied to the features, limiting calculations and guidance to the masked regions. + +Spatial Feature Guidance To preserve the spatial structure of the generated content during style guidance, we introduce spatial feature guidance. It minimizes the distance between context and output features, ensuring spatial integrity. Unlike previous methods that replace features, we calculate feature distances at corresponding positions during sampling and design an energy function to align and maintain spatial structure. Specifically, based on the features $F_{t}^{c}$ extracted from the context + +image or video, we perform point-to-point feature mapping between $F_{t}^{c}$ and $F_{t}^{out}$ to obtain feature vector pairs $(\mathbf{v}_{p_i}^c, \mathbf{v}_{p_i}^{out})$ where $p_i \in F_t^c$ . Therefore, we can calculate the similarity between the output features $F_{t}^{out}$ and the context features $F_{t}^{c}$ as Spatial Feature Guidance: + +$$ +\mathcal {F} _ {c} \propto \boldsymbol {d} \left(F _ {t} ^ {\text {o u t}}, F _ {t} ^ {c}\right). \tag {11} +$$ + +Semantic Distance To avoid overfitting to style or context and achieve a balance between style and structure, we incorporate a commonly used regularisation term in training-based methods. Previous methods have demonstrated that self-attention and cross-attention mechanisms encode context and structural information of images (Hertz et al., 2022; Epstein et al., 2023; Tumanyan et al., 2023). Additionally, recent methods have achieved style transfer by swapping the keys and values in self-attention (Alaluf et al., 2023; Chung et al., 2023; Deng et al., 2023; Hertz et al., 2023; Wang et al., 2024b; Jeong et al., 2024). Inspired by these works, we design a regularisation term to balance style injection and context preservation. Specifically, the parameters of style and spatial guidance are their respective feature vectors, while the swapped attention features combine the outputs of both. By constraining and penalizing the parameters from the swapped attention features in the regularization terms, it ensures that the style and spatial feature vectors remain within a more compact space, resulting in a smoother solution, reduced overfitting, and enhanced stability during sampling. During the sampling process, we feed $x_{t}^{out}$ into U-net again and replace the original $K_{l}^{out}$ , $V_{l}^{out}$ in self-attention with $K_{l}^{ref}$ , $V_{l}^{ref}$ , which come from the reference image $I^{ref}$ . Expressed as follows: + +$$ +\text {S e l f - A t t n} \left(Q _ {l} ^ {\text {o u t}}, K _ {l} ^ {\text {r e f}}, V _ {l} ^ {\text {r e f}}\right) = \operatorname {S o f t m a x} \left(\frac {Q _ {l} ^ {\text {o u t}} K _ {l} ^ {\text {r e f}} {} ^ {T}}{\sqrt {d}}\right) V _ {l} ^ {\text {r e f}}. \tag {12} +$$ + +where $l$ is the index of the transformer blocks that need to replace $K$ and $V$ , and $d$ is the dimension. Consequently, we calculate the L2 distance between the cross-attention map Cross-Attrout after replacing $K$ and $V$ and the cross-attention map Cross-Attr of the context image: + +$$ +\mathcal {F} _ {r e g} = \left\| \text {C r o s s - A t t n} _ {\text {s w a p}} ^ {\text {o u t}} - \operatorname {s g} \left(\text {C r o s s - A t t n} ^ {c}\right) \right\| _ {2} ^ {2}, \tag {13} +$$ + +where $\mathrm{sg}(\cdot)$ represents the operation of stop gradient. + +# 5 EXPERIMENTS + +In this section, we conduct an exhaustive experimental analysis to substantiate the efficacy and superiority of our proposed method through qualitative comparison (Sec. 5.1), quantitative comparison (Sec. 5.2) and ablation study (Sec. 5.3). For more experimental details, please refer to the Appendix B. + +# 5.1 QUALITATIVE COMPARISON + +We compare our proposed method with previous state-of-the-art methods in style and appearance transfer, including Transformer-based methods AdaAttn (Liu et al., 2021), StyleFormer (Wu et al., 2021), StyTr2 (Deng et al., 2022), CNN-based method CAST (Zhang et al., 2022), CCPL (Wu et al., 2022) and Diffusion-based methods InST (Zhang et al., 2023b), Dragon Diffusion (Mou et al., 2023), CrossImage (Alaluf et al., 2023), StyleID (Chung et al., 2023), DreamStyler (Ahn et al., 2024), TI-Guided-Edit (Wang et al., 2024b). As illustrated in Fig. 4, our approach excels at generating visually appealing images in both style and appearance transfer tasks. Specifically, our method not only preserves the structural integrity of the context image, but also integrates style features more effectively based on semantic correspondence. AdaAttn, Styleformer, StyTr2, CAST and CCPL mainly change the color without injecting + +![](images/c07013871afb96f12665682e9342334070c4a54616fdc7fede840471a9f83522.jpg) + +![](images/8b1a8eb40affec5f63ee5fa093b608078955eb423cd837a6b62e6b9a0e233b2f.jpg) +(b) Video Examples w/ Semantix +Figure 6: Image and Video Examples for Semantic Style Transfer + +Table 1: Quantitative comparison with style transfer and appearance transfer methods. + +
MetricsAdaAttnStyleFormerStyTR2CASTCCPLInSTCross-ImageStyleIDDreamStylerTI-GuidedOurs
LPIPS ↓0.5810.5600.4760.4650.5230.5480.7030.5140.5800.6490.461
CFSD ↓0.1890.1560.1550.1330.1330.4080.2320.1600.7890.1830.117
SSIM ↑0.4030.3310.5610.5140.5360.3830.4540.5270.3340.4530.589
Gram Metrics×102 ↓7.9292.8225.4036.5944.8614.9175.8502.8786.9904.8112.524
PickScore ↑16.8718.8516.7616.7216.7516.8017.4519.6816.8018.3919.95
HPS ↑16.8118.2016.8116.7716.7916.8716.5918.7016.8717.5618.78
+ +The best results are highlighted in bold font, and the second-best are underlined. +We compare our method with recent state-of-the-art methods in terms of structure preservation, style similarity and image aesthetics. +* To measure structure preservation capability, we calculate the LPIPS, CFSD and SSIM. +* For style similarity, we compute Gram Metrics as style loss. +* We utilize PickScore and HPS as aesthetic evaluation metrics. + +the whole style information. InST and DreamStyler fail to effectively learn style and disrupt the context image. Dragon Diffusion employs global feature guidance for appearance transfer, yet fails to maintain structural integrity, causing severe distortion of image context. Meanwhile, Cross-Image leads to significant structural degradation and results in a blending of foreground and background. StyleID is unable to infuse enough style information, potentially leading to color deviation. Furthermore, TI-Guided Edit struggles with semantic-driven style transfer, causing blurry images and structural damage. For video style transfer, we compare our method with previous video style transfer methods such as MCCNet (Deng et al., 2021), UNIST (Gu et al., 2023) and CCPL (Wu et al., 2022). We also adapt Cross-Image (Alaluf et al., 2023) to a video version for comparison. As shown in Fig. 5, our method outperforms others in terms of visual quality, consistency, and continuity. Additional qualitative comparisons of images are provided in the Appendix G. Besides, we provide image and video semantic style transfer results as shown in the Fig. 6, as well as additional visual results in the Appendix I. + +# 5.2 QUANTITATIVE COMPARISON + +Metrics. For quantitative performance of image semantic style transfer, we evaluate stylized images from three aspects: structure preservation ability, style injection capability and image quality. We quantify the structure preservation ability by LPIPS (Zhang et al., 2018), CFSD (Chung et al., 2023) and SSIM (Wang et al., 2004). For style injection capability, we employ Gram matrices, which are widely used in style and appearance transfer (Gatys et al., 2016; Alaluf et al., 2023; Wang et al., 2024b). In addition, we utilize the aesthetic score metrics to measure the quality of the generated images such as PickScore (Kirstain et al., 2024) and Human Preference Score (HPS) (Wu et al., 2023). For video transfer, we evaluate video continuity with Semantic and Object Consistency metrics and a Motion Alignment metric for assessing the difference of motions between source and editing videos as described in (Sun et al., 2024). We further evaluate the visual appeal, motion quality and temporal consistency by Visual Quality, Motion Quality and Temporal Consistency metrics respectively as described in EvalCreafter (Liu et al., 2024). + +Comparison Analysis We quantitatively evaluate our method on 1000 sampled context-style image pairs and compare it with previous state-of-the-art methods mentioned above. As demonstrated in Tab. 1, our method not only significantly surpasses previous techniques but also excels over recent diffusion-based methods in several context preservation metrics, including LPIPS, CFSD and SSIM. It indicates that our + +Table 2: Quantitative Comparison of Video Style Transfer. + +
MetricMCCNetUNISTCross-ImageCCPLOurs
Semantic Consistency ↑0.7140.8610.9360.9420.944
Object Consistency ↑0.7230.7770.9390.9430.955
Motion Alignment ↑-5.251-4.178-3.878-1.792-1.894
Visual Quality ↑52.1143.9747.3348.9255.86
Motion Quality ↑53.3555.0753.1453.2553.99
Temporal Consistency ↑59.1445.4355.8559.6460.05
+ +The best results are highlighted in bold font, and the second-best results are underlined. + +method possesses a significant edge in maintaining structural integrity. For the style similarity metric, we measure the L2 loss between Gram Matrices (Gatys et al., 2015), which represents the style similarity between the generated image and the reference style image. Our Semantix has the lowest Gram Matrices style loss among all methods. This demonstrates that the images generated by our method most closely resemble the reference style images. Besides, Semantix achieves the highest PickScore and HPS, which indicates that the images generated by Semantix are more visually attractive. Therefore, experiments illustrate that Semantix not only solves the problem of context disruption, but also effectively injects style into context images in a harmonious way. + +![](images/66d00d21cfc37cb3a92d3b58cbcf4145019b62f11218d4d6e707716c2abc73bb.jpg) +Figure 7: Ablation study on our proposed components. From the $3^{\mathrm{rd}}$ to the $6^{\mathrm{th}}$ columns, each column has a separate component removed compared to our default. + +In terms of video semantic style transfer, we conducted evaluations across 100 stylized videos in comparison with MCCNet (Deng et al., 2021), UNIST (Gu et al., 2023), Cross-Image (Alaluf et al., 2023) and CCPL (Wu et al., 2022). In contrast to Cross-Image, our approach did not modify the model's structure, which allowed it to achieve commendable outcomes in generation quality, consistency and continuity aspects. As shown in Tab. 2, our approach exhibited superior performance across all metrics among all methods. + +Table 3: User Study. + +
StyleFormerCross-ImageStyleIDTI-GuidedOurs
Context Preservation8.2%3.2%33.6%3.2%51.8%
Style Similarity3.9%21.8%15.0%28.2%31.1%
Visual Appeal7.8%3.6%32.1%5.4%51.1%
+ +* We ask all volunteers to evaluate the stylized images based on three aspects: context preservation, style similarity, and visual appeal. +style similarity, and visual appeal. \* The results are averaged across all volunteers + +Table 4: Ablation study on our proposed components. + +
MetricOurs(default)- Style Guidance- Spatial Guidance- Position Encoding- Semantic Distance
LPIPS ↓0.4610.4060.5120.4670.451
CFSD ↓0.1170.1160.1540.1360.121
SSIM ↑0.5890.6100.5470.5740.626
Gram Metrics×102↓2.52424.22892.63152.89822.8610
PickScore ↑19.94516.75616.75616.75816.758
HPS ↑18.780116.76916.76816.76916.766
+ +From the $3^{\mathrm{nd}}$ to the $6^{\mathrm{th}}$ columns, each column has a separate component removed compared to the second column (ours default). + +**User Study** In order to obtain a more convincing comparison, we conducted a user study to compare our method with StyleFormer (Wu et al., 2021), Cross-Image (Alaluf et al., 2023), StyleID (Chung et al., 2023) and TI-Guided (Wang et al., 2024b). We enrolled 30 volunteers, and for each volunteer we randomly selected 40 generated images for user evaluation in three aspects: structural preservation, style similarity and visual appeal. The results, as detailed in the Tab. 3, demonstrate that our method excels at maintaining image structure, enhancing style injection, and achieves superior image quality. + +# 5.3 ABLATION STUDY + +To validate the effects of each component, we conducted a series of ablation studies. In particular, we experiment with style feature guidance, spatial feature guidance, position encoding and semantic distance in both qualitative and quantitative aspects. As illustrated in the Tab. 4 and Fig. 7, style feature guidance injects style features into context visual based on semantic correspondence. Spatial feature guidance effectively maintains the structure, thereby ensuring the coherence of image context. Position Encoding enhances the harmony of stylized images. As a regularisation term, semantic distance mitigates overfitting to structure or style and contributes to balancing style injection and structure maintenance. Further analysis is provided in Appendix E. Parameter sensitivity analysis and ablation on semantic distance can be found in Fig. 13 and Fig. 15 respectively. + +# 6 CONCLUSION + +We propose Semantix, a carefully crafted energy-guided sampler designed to facilitate semantic alignment feature transfer in both image and video diffusion models. By utilizing three proposed components, Semantix effectively transferred both the style and appearance features with semantic guidance. Experimental results demonstrate that our approach not only produces high-quality stylized images and videos but also efficiently prevents contextual interference and effectively incorporates style features. Moreover, video experiments confirm that our method excels in maintaining consistency and continuity across frames. + +# LIMITATIONS + +While our method achieves style and appearance transfer across various visual, there are still certain limitations. Specifically, it tends to be less effective when the context visual has strong inherent style features. In such scenarios, our method may lead to failures in semantic style transfer. Moreover, Semantix relies on the semantic information from pre-trained diffusion models, with the UNet architecture (Rombach et al., 2022). Future work will explore semantic alignment in advanced models like UViT (Bao et al., 2023) and DiT (Peebles and Xie, 2023). + +# BROADER IMPACTS + +Powerful feature transfer capabilities can facilitate creative content generation. However, there is also a risk that these technologies could be used to generate harmful content with negative societal impacts. A particularly concerning misuse could involve placing an actual people in a compromising scene involving illicit activities. + +# REFERENCES + +Aishwarya Agarwal, Srikrishna Karanam, KJ Joseph, Apoorv Saxena, Koustava Goswami, and Balaji Vasan Srinivasan. A-star: Test-time attention segregation and retention for text-to-image synthesis. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 2283-2293, 2023a. +Aishwarya Agarwal, Srikrishna Karanam, Tripti Shukla, and Balaji Vasan Srinivasan. An image is worth multiple words: Multi-attribute inversion for constrained text-to-image synthesis. arXiv preprint arXiv:2311.11919, 2023b. +Namhyuk Ahn, Junsoo Lee, Chunggi Lee, Kunhee Kim, Daesik Kim, Seung-Hun Nam, and Kibeom Hong. Dreamstyler: Paint by style inversion with text-to-image diffusion models. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 38, pages 674-681, 2024. +Yuval Alaluf, Daniel Garibi, Or Patashnik, Hadar Averbuch-Elor, and Daniel Cohen-Or. Cross-image attention for zero-shot appearance transfer. arXiv preprint arXiv:2311.03335, 2023. +Arpit Bansal, Hong-Min Chu, Avi Schwarzschild, Soumyadip Sengupta, Micah Goldblum, Jonas Geiping, and Tom Goldstein. Universal guidance for diffusion models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 843-852, 2023. +Fan Bao, Shen Nie, Kaiwen Xue, Yue Cao, Chongxuan Li, Hang Su, and Jun Zhu. All are worth words: A vit backbone for diffusion models. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pages 22669-22679, 2023. +Deblina Bhattacharjee, Seungryong Kim, Guillaume Vizier, and Mathieu Salzmann. Dunit: Detection-based unsupervised image-to-image translation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 4787-4796, 2020. +Andreas Blattmann, Tim Dockhorn, Sumith Kulal, Daniel Mendelevitch, Maciej Kilian, Dominik Lorenz, Yam Levi, Zion English, Vikram Voleti, Adam Letts, et al. Stable video diffusion: Scaling latent video diffusion models to large datasets. arXiv preprint arXiv:2311.15127, 2023. +Mathilde Caron, Hugo Touvron, Ishan Misra, Hervé Jégou, Julien Mairal, Piotr Bojanowski, and Armand Joulin. Emerging properties in self-supervised vision transformers. In Proceedings of the IEEE/CVF international conference on computer vision, pages 9650-9660, 2021. +Haibo Chen, Zhizhong Wang, Huiming Zhang, Zhiwen Zuo, Ailin Li, Wei Xing, Dongming Lu, et al. Artistic style transfer with internal-external learning and contrastive learning. Advances in Neural Information Processing Systems, 34:26561-26573, 2021. +Minghao Chen, Iro Laina, and Andrea Vedaldi. Training-free layout control with cross-attention guidance. In Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision, pages 5343-5353, 2024. + +Jiwoo Chung, Sangeek Hyun, and Jae-Pil Heo. Style injection in diffusion: A training-free approach for adapting large-scale diffusion models for style transfer. arXiv preprint arXiv:2312.09008, 2023. +Yingying Deng, Fan Tang, Weiming Dong, Haibin Huang, Chongyang Ma, and Changsheng Xu. Arbitrary video style transfer via multi-channel correlation. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 35, pages 1210-1217, 2021. +Yingying Deng, Fan Tang, Weiming Dong, Chongyang Ma, Xingjia Pan, Lei Wang, and Changsheng Xu. Stytr2: Image style transfer with transformers. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pages 11326-11336, 2022. +Yingying Deng, Xiangyu He, Fan Tang, and Weiming Dong. Z*: Zero-shot style transfer via attention rearrangement. arXiv preprint arXiv:2311.16491, 2023. +Prafulla Dhariwal and Alexander Nichol. Diffusion models beat gans on image synthesis. Advances in neural information processing systems, 34:8780-8794, 2021. +Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, et al. An image is worth 16x16 words: Transformers for image recognition at scale. arXiv preprint arXiv:2010.11929, 2020. +Dave Epstein, Allan Jabri, Ben Poole, Alexei Efros, and Aleksander Holynski. Diffusion self-guidance for controllable image generation. Advances in Neural Information Processing Systems, 36:16222-16239, 2023. +Yarden Frenkel, Yael Vinker, Ariel Shamir, and Daniel Cohen-Or. Implicit style-content separation using b-lora. arXiv preprint arXiv:2403.14572, 2024. +Rinon Gal, Yuval Alaluf, Yuval Atzmon, Or Patashnik, Amit H Bermano, Gal Chechik, and Daniel Cohen-Or. An image is worth one word: Personalizing text-to-image generation using textual inversion. arXiv preprint arXiv:2208.01618, 2022. +Rohit Gandikota, Joanna Materzynska, Tingrui Zhou, Antonio Torralba, and David Bau. Concept sliders: Lora adaptors for precise control in diffusion models. arXiv preprint arXiv:2311.12092, 2023. +Leon A Gatys, Alexander S Ecker, and Matthias Bethge. A neural algorithm of artistic style. arXiv preprint arXiv:1508.06576, 2015. +Leon A Gatys, Alexander S Ecker, and Matthias Bethge. Image style transfer using convolutional neural networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 2414-2423, 2016. +Rohit Girdhar, Mannat Singh, Andrew Brown, Quentin Duval, Samaneh Azadi, Sai Saketh Rambhatla, Akbar Shah, Xi Yin, Devi Parikh, and Ishan Misra. Emu video: Factorizing text-to-video generation by explicit image conditioning. arXiv preprint arXiv:2311.10709, 2023. +Bohai Gu, Heng Fan, and Libo Zhang. Two birds, one stone: A unified framework for joint learning of image and video style transfers. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 23545-23554, 2023. +Shuyang Gu, Congliang Chen, Jing Liao, and Lu Yuan. Arbitrary style transfer with deep feature reshuffle. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 8222-8231, 2018. +Yuwei Guo, Ceyuan Yang, Anyi Rao, Yaohui Wang, Yu Qiao, Dahua Lin, and Bo Dai. Animatediff: animate your personalized text-to-image diffusion models without specific tuning. arXiv preprint arXiv:2307.04725, 2023. +Amir Hertz, Ron Mokady, Jay Tenenbaum, Kfir Aberman, Yael Pritch, and Daniel Cohen-Or. Prompt-to-prompt image editing with cross attention control. arXiv preprint arXiv:2208.01626, 2022. + +Amir Hertz, Andrey Voynov, Shlomi Fruchter, and Daniel Cohen-Or. Style aligned image generation via shared attention. arXiv preprint arXiv:2312.02133, 2023. +Jonathan Ho and Tim Salimans. Classifier-free diffusion guidance. arXiv preprint arXiv:2207.12598, 2022. +Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. Advances in neural information processing systems, 33:6840-6851, 2020. +Minghui Hu, Jianbin Zheng, Daqing Liu, Chuanxia Zheng, Chaoyue Wang, Dacheng Tao, and Tat-Jen Cham. Cocktail: Mixing multi-modality control for text-conditional image generation. In Thirty-seventh Conference on Neural Information Processing Systems (NeurIPS), 2023. +Xun Huang and Serge Belongie. Arbitrary style transfer in real-time with adaptive instance normalization. In Proceedings of the IEEE international conference on computer vision, pages 1501-1510, 2017. +Inbar Huberman-Spiegelglas, Vladimir Kulikov, and Tomer Michaeli. An edit friendly ddpm noise space: Inversion and manipulations. arXiv preprint arXiv:2304.06140, 2023. +Phillip Isola, Jun-Yan Zhu, Tinghui Zhou, and Alexei A Efros. Image-to-image translation with conditional adversarial networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 1125-1134, 2017. +Jaeseok Jeong, Mingi Kwon, and Youngjung Uh. Training-free style transfer emerges from h-space in diffusion models. arXiv e-prints, pages arXiv-2303, 2023. +Jaeseok Jeong, Junho Kim, Yunjey Choi, Gayoung Lee, and Youngjung Uh. Visual style prompting with swapping self-attention. arXiv preprint arXiv:2402.12974, 2024. +Ananya Harsh Jha, Saket Anand, Maneesh Singh, and VS Rao Veeravasarapu. Disentangling factors of variation with cycle-consistent variational auto-encoders. In Proceedings of the European Conference on Computer Vision (ECCV), pages 805–820, 2018. +Justin Johnson, Alexandre Alahi, and Li Fei-Fei. Perceptual losses for real-time style transfer and super-resolution. In Computer Vision-ECCV 2016: 14th European Conference, Amsterdam, The Netherlands, October 11-14, 2016, Proceedings, Part II 14, pages 694-711. Springer, 2016. +Yuval Kirstain, Adam Polyak, Uriel Singer, Shahbuland Matiana, Joe Penna, and Omer Levy. Pick-a-pic: An open dataset of user preferences for text-to-image generation. Advances in Neural Information Processing Systems, 36, 2024. +Gihyun Kwon and Jong Chul Ye. Diffusion-based image translation using disentangled style and content representation. arXiv preprint arXiv:2209.15264, 2022. +Wei-Sheng Lai, Jia-Bin Huang, Narendra Ahuja, and Ming-Hsuan Yang. Deep laplacian pyramid networks for fast and accurate super-resolution. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 624-632, 2017. +Junghyup Lee, Dohyung Kim, Jean Ponce, and Bumsub Ham. Sfnet: Learning object-aware semantic correspondence. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 2278-2287, 2019. +Dongxu Li, Junnan Li, and Steven Hoi. Blip-diffusion: Pre-trained subject representation for controllable text-to-image generation and editing. Advances in Neural Information Processing Systems, 36, 2024. +Yijun Li, Chen Fang, Jimei Yang, Zhaowen Wang, Xin Lu, and Ming-Hsuan Yang. Universal style transfer via feature transforms. Advances in neural information processing systems, 30, 2017. +Yijun Li, Ming-Yu Liu, Xueting Li, Ming-Hsuan Yang, and Jan Kautz. A closed-form solution to photorealistic image stylization. In Proceedings of the European conference on computer vision (ECCV), pages 453-468, 2018. + +Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dólar, and C Lawrence Zitnick. Microsoft coco: Common objects in context. In Computer Vision-ECCV 2014: 13th European Conference, Zurich, Switzerland, September 6-12, 2014, Proceedings, Part V 13, pages 740-755. Springer, 2014. +Ming-Yu Liu, Thomas Breuel, and Jan Kautz. Unsupervised image-to-image translation networks. Advances in neural information processing systems, 30, 2017. +Nan Liu, Shuang Li, Yilun Du, Antonio Torralba, and Joshua B Tenenbaum. Compositional visual generation with composable diffusion models. In European Conference on Computer Vision, pages 423-439. Springer, 2022. +Songhua Liu, Tianwei Lin, Dongliang He, Fu Li, Meiling Wang, Xin Li, Zhengxing Sun, Qian Li, and Errui Ding. Adaattn: Revisit attention mechanism in arbitrary neural style transfer. In Proceedings of the IEEE/CVF international conference on computer vision, pages 6649-6658, 2021. +Yaofang Liu, Xiaodong Cun, Xuebo Liu, Xintao Wang, Yong Zhang, Haoxin Chen, Yang Liu, Tieyong Zeng, Raymond Chan, and Ying Shan. Evalcrafter: Benchmarking and evaluating large video generation models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 22139-22149, 2024. +Ron Mokady, Amir Hertz, Kfir Aberman, Yael Pritch, and Daniel Cohen-Or. Null-text inversion for editing real images using guided diffusion models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 6038–6047, 2023. +Chong Mou, Xintao Wang, Jiechong Song, Ying Shan, and Jian Zhang. Dragondiffusion: Enabling drag-style manipulation on diffusion models. arXiv preprint arXiv:2307.02421, 2023. +Chong Mou, Xintao Wang, Jiechong Song, Ying Shan, and Jian Zhang. Diffeditor: Boosting accuracy and flexibility on diffusion-based image editing. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 8488-8497, 2024. +Alex Nichol, Prafulla Dhariwal, Aditya Ramesh, Pranav Shyam, Pamela Mishkin, Bob McGrew, Ilya Sutskever, and Mark Chen. Glide: Towards photorealistic image generation and editing with text-guided diffusion models. arXiv preprint arXiv:2112.10741, 2021. +Shen Nie, Hanzhong Allan Guo, Cheng Lu, Yuhao Zhou, Chenyu Zheng, and Chongxuan Li. The blessing of randomness: Sde beats ode in general diffusion-based image editing. arXiv preprint arXiv:2311.01410, 2023. +OpenAI. Sora: Creating video from text. https://openai.com/sora, 2024. +Baran Ozaydin, Tong Zhang, Sabine Susstrunk, and Mathieu Salzmann. Dsi2i: Dense style for unpaired exemplar-based image-to-image translation. Transactions on Machine Learning Research. +Dae Young Park and Kwang Hee Lee. Arbitrary style transfer with style-attentional networks. In proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pages 5880-5888, 2019. +Taesung Park, Alexei A Efros, Richard Zhang, and Jun-Yan Zhu. Contrastive learning for unpaired image-to-image translation. In Computer Vision-ECCV 2020: 16th European Conference, Glasgow, UK, August 23-28, 2020, Proceedings, Part IX 16, pages 319-345. Springer, 2020a. +Taesung Park, Jun-Yan Zhu, Oliver Wang, Jingwan Lu, Eli Shechtman, Alexei Efros, and Richard Zhang. Swapping autoencoder for deep image manipulation. Advances in Neural Information Processing Systems, 33:7198-7211, 2020b. +William Peebles and Saining Xie. Scalable diffusion models with transformers. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 4195-4205, 2023. +Stanislav Pidhorskyi, Donald Adjeroh, and Gianfranco Doretto. Adversarial latent autoencoders. In 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2020. + +Dustin Podell, Zion English, Kyle Lacey, Andreas Blattmann, Tim Dockhorn, Jonas Müller, Joe Penna, and Robin Rombach. Sdxl: Improving latent diffusion models for high-resolution image synthesis. arXiv preprint arXiv:2307.01952, 2023. +Tianhao Qi, Shancheng Fang, Yanze Wu, Hongtao Xie, Jiawei Liu, Lang Chen, Qian He, and Yong-dong Zhang. Deadiff: An efficient stylization diffusion model with disentangled representations. arXiv preprint arXiv:2403.06951, 2024. +Aditya Ramesh, Prafulla Dhariwal, Alex Nichol, Casey Chu, and Mark Chen. Hierarchical text-conditional image generation with clip latents. arXiv preprint arXiv:2204.06125, 1(2):3, 2022. +Ignacio Rocco, Relja Arandjelović, and Josef Sivic. End-to-end weakly-supervised semantic alignment. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 6917-6925, 2018. +Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Björn Ommer. High-resolution image synthesis with latent diffusion models. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pages 10684-10695, 2022. +Nataniel Ruiz, Yuzhhen Li, Varun Jampani, Yael Pritch, Michael Rubinstein, and Kfir Aberman. Dreambooth: Fine tuning text-to-image diffusion models for subject-driven generation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 22500-22510, 2023a. +Nataniel Ruiz, Yuanzhen Li, Varun Jampani, Wei Wei, Tingbo Hou, Yael Pritch, Neal Wadhwa, Michael Rubinstein, and Kfir Aberman. Hyperdreambooth: Hypernetworks for fast personalization of text-to-image models. arXiv preprint arXiv:2307.06949, 2023b. +Chitwan Sahara, William Chan, Saurabh Saxena, Lala Li, Jay Whang, Emily L Denton, Kamyar Ghasemipour, Raphael Gontijo Lopes, Burcu Karagol Ayan, Tim Salimans, et al. Photorealistic text-to-image diffusion models with deep language understanding. Advances in neural information processing systems, 35:36479-36494, 2022. +Paul Hongsuck Seo, Jongmin Lee, Deunsol Jung, Bohyung Han, and Minsu Cho. Attentive semantic alignment with offset-aware correlation kernels. In Proceedings of the European Conference on Computer Vision (ECCV), pages 349-364, 2018. +Zhiqiang Shen, Mingyang Huang, Jianping Shi, Xiangyang Xue, and Thomas S Huang. Towards instance-level image-to-image translation. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pages 3683-3692, 2019. +Jing Shi, Wei Xiong, Zhe Lin, and Hyun Joon Jung. Instantbooth: Personalized text-to-image generation without test-time finetuning. arXiv preprint arXiv:2304.03411, 2023. +Jaskirat Singh, Stephen Gould, and Liang Zheng. High-fidelity guided image synthesis with latent diffusion models. In 2023 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 5997-6006. IEEE, 2023. +Jascha Sohl-Dickstein, Eric Weiss, Niru Maheswaranathan, and Surya Ganguli. Deep unsupervised learning using nonequilibrium thermodynamics. In International conference on machine learning, pages 2256-2265. PMLR, 2015. +Kihyuk Sohn, Nataniel Ruiz, Kimin Lee, Daniel Castro Chin, Irina Blok, Huiwen Chang, Jarred Barber, Lu Jiang, Glenn Entis, Yuanzhen Li, et al. Styledrop: Text-to-image generation in any style. arXiv preprint arXiv:2306.00983, 2023. +Jiaming Song, Chenlin Meng, and Stefano Ermon. Denoising diffusion implicit models. arXiv preprint arXiv:2010.02502, 2020a. +Yang Song, Jascha Sohl-Dickstein, Diederik P Kingma, Abhishek Kumar, Stefano Ermon, and Ben Poole. Score-based generative modeling through stochastic differential equations. arXiv preprint arXiv:2011.13456, 2020b. + +Wenhao Sun, Rong-Cheng Tu, Jingyi Liao, and Dacheng Tao. Diffusion model-based video editing: A survey. arXiv preprint arXiv:2407.07111, 2024. +Wei Ren Tan, Chee Seng Chan, Hernan E Aguirre, and Kiyoshi Tanaka. Improved artgan for conditional synthesis of natural image and artwork. IEEE Transactions on Image Processing, 28 (1):394-409, 2018. +Luming Tang, Menglin Jia, Qianqian Wang, Cheng Perng Phoo, and Bharath Hariharan. Emergent correspondence from image diffusion. Advances in Neural Information Processing Systems, 36: 1363-1389, 2023. +Narek Tumanyan, Michal Geyer, Shai Bagon, and Tali Dekel. Plug-and-play diffusion features for text-driven image-to-image translation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 1921-1930, 2023. +Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. Advances in neural information processing systems, 30, 2017. +Andrey Voynov, Kfir Aberman, and Daniel Cohen-Or. Sketch-guided text-to-image diffusion models. In ACM SIGGRAPH 2023 Conference Proceedings, pages 1-11, 2023a. +Andrey Voynov, Qinghao Chu, Daniel Cohen-Or, and Kfir Aberman. $p+$ : Extended textual conditioning in text-to-image generation. arXiv preprint arXiv:2303.09522, 2023b. +Haofan Wang, Qixun Wang, Xu Bai, Zekui Qin, and Anthony Chen. Instantstyle: Free lunch towards style-preserving in text-to-image generation. arXiv preprint arXiv:2404.02733, 2024a. +Jiacheng Wang, Ping Liu, and Wei Xu. Unified diffusion-based rigid and non-rigid editing with text and image guidance. arXiv preprint arXiv:2401.02126, 2024b. +Jianbo Wang, Huan Yang, Jianlong Fu, Toshihiko Yamasaki, and Baining Guo. Fine-grained image style transfer with visual transformers. In Proceedings of the Asian Conference on Computer Vision, pages 841-857, 2022. +Qianqian Wang, Xiaowei Zhou, Bharath Hariharan, and Noah Snavely. Learning feature descriptors using camera pose supervision. In Computer Vision-ECCV 2020: 16th European Conference, Glasgow, UK, August 23-28, 2020, Proceedings, Part I 16, pages 757-774. Springer, 2020. +Qixun Wang, Xu Bai, Haofan Wang, Zekui Qin, and Anthony Chen. Instantid: Zero-shot identity-preserving generation in seconds. arXiv preprint arXiv:2401.07519, 2024c. +Zhizhong Wang, Lei Zhao, and Wei Xing. *Stylediffusion: Controllable disentangled style transfer via diffusion models*. In *Proceedings of the IEEE/CVF International Conference on Computer Vision*, pages 7677-7689, 2023a. +Zhou Wang, Alan C Bovik, Hamid R Sheikh, and Eero P Simoncelli. Image quality assessment: from error visibility to structural similarity. IEEE transactions on image processing, 13(4):600-612, 2004. +Zhouxia Wang, Xintao Wang, Liangbin Xie, Zhongang Qi, Ying Shan, Wenping Wang, and Ping Luo. Styleadapter: A single-pass lora-free model for stylized image generation. arXiv preprint arXiv:2309.01770, 2023b. +Yuxiang Wei, Yabo Zhang, Zhilong Ji, Jinfeng Bai, Lei Zhang, and Wangmeng Zuo. Elite: Encoding visual concepts into textual embeddings for customized text-to-image generation. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 15943-15953, 2023. +Chen Henry Wu and Fernando De la Torre. A latent space of stochastic diffusion models for zero-shot image editing and guidance. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 7378-7387, 2023. +Xiaolei Wu, Zhihao Hu, Lu Sheng, and Dong Xu. Styleformer: Real-time arbitrary style transfer via parametric style composition. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 14618-14627, 2021. + +Xiaoshi Wu, Yiming Hao, Keqiang Sun, Yixiong Chen, Feng Zhu, Rui Zhao, and Hongsheng Li. Human preference score v2: A solid benchmark for evaluating human preferences of text-to-image synthesis. arXiv preprint arXiv:2306.09341, 2023. +Zijie Wu, Zhen Zhu, Junping Du, and Xiang Bai. Ccpl: Contrastive coherence preserving loss for versatile style transfer. In European Conference on Computer Vision, pages 189-206. Springer, 2022. +Serin Yang, Hyunmin Hwang, and Jong Chul Ye. Zero-shot contrastive loss for text-guided diffusion image style transfer. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 22873-22882, 2023. +Hu Ye, Jun Zhang, Sibo Liu, Xiao Han, and Wei Yang. Ip-adapter: Text compatible image prompt adapter for text-to-image diffusion models. arXiv preprint arXiv:2308.06721, 2023. +Zili Yi, Hao Zhang, Ping Tan, and Minglun Gong. Dualgan: Unsupervised dual learning for image-to-image translation. In Proceedings of the IEEE international conference on computer vision, pages 2849-2857, 2017. +Jiwen Yu, Yinhuai Wang, Chen Zhao, Bernard Ghanem, and Jian Zhang. Freedom: Training-free energy-guided conditional diffusion model. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 23174-23184, 2023. +Junyi Zhang, Charles Herrmann, Junhwa Hur, Luisa Polania Cabrera, Varun Jampani, Deqing Sun, and Ming-Hsuan Yang. A tale of two features: Stable diffusion complements dino for zero-shot semantic correspondence. Advances in Neural Information Processing Systems, 36, 2024. +Lvmin Zhang, Anyi Rao, and Maneesh Agrawala. Adding conditional control to text-to-image diffusion models. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 3836-3847, 2023a. +Richard Zhang, Phillip Isola, Alexei A Efros, Eli Shechtman, and Oliver Wang. The unreasonable effectiveness of deep features as a perceptual metric. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 586-595, 2018. +Yuxin Zhang, Fan Tang, Weiming Dong, Haibin Huang, Chongyang Ma, Tong-Yee Lee, and Changsheng Xu. Domain enhanced arbitrary image style transfer via contrastive learning. In ACM SIGGRAPH 2022 conference proceedings, pages 1-8, 2022. +Yuxin Zhang, Nisha Huang, Fan Tang, Haibin Huang, Chongyang Ma, Weiming Dong, and Changsheng Xu. Inversion-based style transfer with diffusion models. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pages 10146-10156, 2023b. +Yuxuan Zhang, Huan Ling, Jun Gao, Kangxue Yin, Jean-Francois Lafleche, Adela Barriuso, Antonio Torralba, and Sanja Fidler. Datasetgan: Efficient labeled data factory with minimal human effort. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 10145-10155, 2021. +Dongyang Zhao, Ziyang Song, Zhenghao Ji, Gangming Zhao, Weifeng Ge, and Yizhou Yu. Multiscale matching networks for semantic correspondence. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 3354-3364, 2021. +Min Zhao, Fan Bao, Chongxuan Li, and Jun Zhu. Egsde: Unpaired image-to-image translation via energy-guided stochastic differential equations. Advances in Neural Information Processing Systems, 35:3609-3623, 2022. +Chuanxia Zheng, Tat-Jen Cham, and Jianfei Cai. The spatially-correlative loss for various image translation tasks. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition (CVPR), pages 16407-16417, 2021. +Jun-Yan Zhu, Taesung Park, Phillip Isola, and Alexei A Efros. Unpaired image-to-image translation using cycle-consistent adversarial networks. In Proceedings of the IEEE international conference on computer vision, pages 2223-2232, 2017. + +# Appendix for Semantix: An Energy Guided Sampler for Semantic Style Transfer + +# A EDIT FRIENDLY INVERSION + +This section reproduces, for the reader's convenience, much of the derivation for edit friendly inversion presented in Huberman-Spiegelglas et al. (2023). Diffusion models (Sohl-Dickstein et al., 2015) consist of a forward process and a denoise process. In the forward process, an image $x_0$ is transformed into a Gaussian distribution $x_{T}$ by gradually adding Gaussian noise. This process can be described by a stochastic differential equation (SDE) (Song et al., 2020b): + +$$ +\mathrm {d} x = f (\mathbf {x}, t) \mathrm {d} t + g (t) \mathrm {d} w, \tag {14} +$$ + +here, $w$ represents the standard Wiener process, $f(\cdot ,t):\mathbb{R}^d\to \mathbb{R}^d$ is a vector-valued function known as the drift coefficient of $x(t)$ , and $g(\cdot):\mathbb{R}\rightarrow \mathbb{R}$ is a scalar function referred to as the diffusion coefficient of $x(t)$ . In DDPM (Ho et al., 2020), the SDE can be discretized into the following form: + +$$ +x _ {t} = \sqrt {1 - \beta_ {t}} x _ {t - 1} + \sqrt {\beta_ {t}} \epsilon_ {t}, \quad t = 1, \dots , T \tag {15} +$$ + +where $\epsilon_t \sim \mathcal{N}(0, I)$ represents standard Gaussian noise, and $\beta_t$ is variance schedule. Formally, the diffusion process can be equivalently expressed as: + +$$ +x _ {t} = \sqrt {\bar {\alpha} _ {t}} x _ {0} + \sqrt {1 - \bar {\alpha} _ {t}} \epsilon_ {t} \tag {16} +$$ + +where $\alpha_{t} = 1 - \beta_{t}$ , $\bar{\alpha}_{t} = \prod_{s=1}^{t} \alpha_{s}$ , and $\epsilon_{t} \sim \mathcal{N}(0, I)$ . In the denoising process, a Gaussian noise $x_{T} \sim \mathcal{N}(0, I)$ is progressively denoised to sample an image $\hat{x}_{0}$ . A non-Markovian sampling method was proposed in DDIM (Song et al., 2020a), which can be formulated as follows: + +$$ +x _ {t - 1} = \hat {\mu} _ {t} \left(x _ {t}\right) + \sigma_ {t} z _ {t}, \quad t = T, \dots , 1 \tag {17} +$$ + +where $z_{t} \sim \mathcal{N}(0, I)$ represents standard Gaussian noise and is independent of $x_{t}$ . The term $\hat{\mu}_{t}(x_{t})$ can be expressed by the following formula: + +$$ +\hat {\mu} _ {t} \left(x _ {t}\right) = \sqrt {\bar {\alpha} _ {t - 1}} \frac {x _ {t} - \sqrt {1 - \bar {\alpha} _ {t}} \epsilon_ {\theta} \left(x _ {t}\right)}{\sqrt {\bar {\alpha} _ {t}}} + \sqrt {1 - \bar {\alpha} _ {t - 1} - \sigma_ {t} ^ {2}} \epsilon_ {\theta} \left(x _ {t}\right) \tag {18} +$$ + +the fixed schedulers $\sigma_{t}$ are represented in the general form as: $\sigma_{t} = \frac{\eta\beta_{t}(1 - \bar{\alpha}_{t - 1})}{1 - \bar{\alpha}_{t}}$ , where $\eta$ belongs to [0,1]. Within this framework, $\eta = 0$ corresponds to the deterministic DDIM scheme, and $\eta = 1$ corresponds to the original DDPM scheme. Owing to the deterministic nature of the Ordinary Differential Equations (ODEs), the DDIM does not introduce randomness during the diffusion process. However, classifier-free guidance amplifies the accumulation of errors in text-guided sampling process (Mokady et al., 2023), hence the deterministic DDPMs (Huberman-Spiegelglas et al., 2023; Wu and De la Torre, 2023) are proposed. In DDPM inversion, a sequence $x_{1},\ldots ,x_{T}$ is constructed directly from $x_0$ according to the following formula: + +$$ +x _ {t} = \sqrt {\bar {\alpha} _ {t}} x _ {0} + \sqrt {1 - \bar {\alpha} _ {t}} \tilde {\epsilon} _ {t}, \quad t = 1, \dots , T, \tag {19} +$$ + +where $\tilde{\epsilon}_t\sim \mathcal{N}(0,I)$ are statistically independent, which are different from Eq. 15. Therefore, we can compute $\hat{\mu}_t(x_t)$ according to the Eq. 18, which allows us to isolate $z_{t}$ according to Eq. 17 as shown in the following equation: + +$$ +z _ {t} = \frac {x _ {t - 1} - \hat {\mu} _ {t} \left(x _ {t}\right)}{\sigma_ {t}}, \quad t = T, \dots , 1. \tag {20} +$$ + +Therefore, the diffusion process evolves into a deterministic DDPM. It has been demonstrated that the introduction of randomness in image editing tasks can produce high quality results (Nie et al., 2023). + +# B IMPLEMENTATION DETAIL + +We use NVIDIA A100 (80G) GPUs for all experiments. For image semantic style transfer, our method is built upon the pre-trained Stable Diffusion v1.5 model. For video task,AnimateDiff (Guo et al., 2023) serves as our base model and we extend the reference image into video sequence. We invert the input images or videos into noises through DDPM inversion across 60 timesteps. For + +classifier-free guidance, we set the scale factor $\omega = 3.5$ , aligning it with the sampling procedures. During the sampling process, the features for guidance are extracted from the second and third blocks of the UNet's decoder. In image style transfer tasks, we adjust the weights of style feature guidance, spatial feature guidance and semantic distance regularisation to $\gamma_{ref} = 3.0$ , $\gamma_c = 0.9$ , $\gamma_{reg} = 1.0$ respectively. Additionally, we incorporate a 2D position encoding into the features and assign it a weight of $\lambda_{pe} = 3.0$ . For video task, the corresponding hyper-parameters are set to $\gamma_{ref} = 6.0$ , $\gamma_c = 3.0$ , $\gamma_{reg} = 5.0$ , $\lambda_{pe} = 3.0$ . We further employ a hard clamp in the range of $[-1,1]$ for all guidance. + +To compute the regularisation term, we extract cross-attention maps of context image or video and output image or video in the U-net to calculate L2 distance. Besides, we replace the keys and values in the self-attention layer of the decoder at the $32 \times 32$ and the $64 \times 64$ resolutions following 10 timesteps, as described in Cross-Image (Alaluf et al., 2023). After 20 denoising timesteps, we apply AdaIN (Huang and Belongie, 2017) for the style latents $\boldsymbol{x}_t^{ref}$ and output latents $\boldsymbol{x}_t^{out}$ . + +# C EVALUATION DATASET + +We select the COCO (Lin et al., 2014) dataset as the source of context images and obtain style images from WikiArt (Tan et al., 2018) and appearance images from Cross-Image (Alaluf et al., 2023). We randomly sample 1000 context images in the COCO dataset and pair each with a style image from the WikiArt dataset to form 1000 context-style image pairs. All images are cropped and resized to $512 \times 512$ resolutions. For context video datas, we obtain high quality videos generated by Sora (OpenAI, 2024). Additionally, we also utilize some of our internal data as style images for qualitative result. + +# D ALGORITHM OF SEMANTIX + +In order to make it easier to understand our proposed Semantix, we present the detailed algorithm in Algorithm 1. + +# E FURTHER ANALYSIS. + +Sampling speed and memory analysis. Since our sampler is guided by energy gradients, there is a slight increase in sampling time and memory usage. Tab. 5 shows a comparison between our method and other diffusion-based approaches, indicating that our approach has a negligible impact on inference time and memory usage. + +Table 5: Comparison of computational speed and memory usage. + +
AttributeTime (sec)Memory (G)
DragonDiff158
CrossImage1812
StyleID622
TI-Guided1620
Ours2622
+ +* The evaluations were carried out on a single NVIDIA A100 GPU, with each method executing 50 timesteps of sampling. + +Impact of correspondence accuracy. To further validate the versatility of our approach, we randomly disrupted the feature correspondences between context and reference images. As illustrated in the Fig. 9, this + +random disruption of feature correspondences led to only a slight decline in image quality, without significantly degrading the stylized images. This is attributable to the robustness of our proposed method. Our energy-based approach does not demand high accuracy in semantic correspondences, and the replacement of the K, V in self-attention with semantic correspondences in our semantic distance term also reduces the method's reliance on precise semantic correspondence. + +Choices of Position Encoding. In video style transfer, we conducted experiments on 2D and 3D Position Encoding(PE) to explore the impact of different types of PE. The results for 3D PE, as shown in the Fig. 10, illustrate a slight decrease in style similarity compared to 2D PE(Fig. 5). Notably, the role of PE is mainly to establish semantic correspondence. Thus, this decline can be attributed to the increased difficulty in establishing semantic correspondence across all frames, as opposed to within individual frames. Therefore, in video tasks, we employ 2D PE, aligning with image style transfer. + +The selection of timestep. In our proposed method, we reverse the input to $\mathrm{T} = 601$ timestep by DDPM inversion (Huberman-Spiegelglas et al., 2023). During the experiment, we observed that when $\mathrm{T} = 601$ , there was an optimal trade-off between generation quality and sampling speed. Both previous studies (Voynov et al., 2023b; Agarwal et al., 2023a;b) and Fig. 3 indicate that the image + +Algorithm 1: Proposed Semantix +Input: context image $I^c$ or video $V^{c}$ ; reference image $I^{ref}$ or video $V^{ref}$ ; prompts $P$ +Output: reconstructed and stylized images/videos $\hat{I}^c (\hat{V}^c),\hat{I}^{ref}(\hat{V}^{ref}),\hat{I}^{out}(\hat{V}^{out})$ +Require: UNet denoiser $\epsilon_{\theta}$ ; UNet feature extractor $\mathcal{F}_{\theta}$ ; hyper-parameters $\gamma_{ref},\gamma_c,\gamma_{reg},\lambda_{pe},$ $\omega$ ; timestep $T$ +Initialization: +(1) Encode image/video: + $x_0^c = \mathrm{Encoder}(I^c /V^c)$ . + $x_0^{ref} = \mathrm{Encoder}(I^{ref} / V^{ref})$ +(2) DDPM inversion to obtain latent $\pmb{x}_T$ and noise $\textbf{z}$ .. + $x_{T}^{c},z_{T}^{c},z_{T - 1}^{c},\ldots ,z_{1}^{c}\leftarrow$ DDPM inversion $(x_0^c)$ . + $x_{T}^{ref},z_{T}^{ref},z_{T - 1}^{ref},\ldots ,z_{1}^{ref}\leftarrow$ DDPM inversion $(x_0^{ref})$ . + $x_{T}^{out},z_{T}^{out},z_{T - 1}^{out},\ldots ,z_{1}^{out}\leftarrow x_{T}^{c},z_{T}^{c},z_{T - 1}^{c},\ldots ,z_{1}^{c};$ +for $t = T,\dots ,1$ do + $x_{t}\gets \mathrm{Concat}(x_{t}^{c},x_{t}^{ref},x_{t}^{out});$ $\epsilon_t^c,\epsilon_t^{uc},\mathrm{CA}^c\gets \epsilon_\theta (\pmb {x}_t;t,P);$ $\mathrm{CA}_{swap}^{out}\gets \epsilon_{\theta}(\pmb {x}_t;t,P);$ where $K_l^{out} = K_l^{ref},V_l^{out} = V_l^{ref}$ $m_c,m_{ref}\gets$ Self-Attn; + $\hat{\epsilon}_t = \epsilon_t^{uc} + \omega \cdot (\epsilon_t^c -\epsilon_t^{uc});$ $F_{t}^{c},F_{t}^{ref},F_{t}^{out} = F_{\theta}(\pmb {x}_{t};t,P);$ $\bar{F}_t^{ref*} = \mathrm{Align}\Big((F_t^c +\lambda_{pe}\cdot PE)[m_c],(F_t^{ref} + \lambda_{pe}\cdot PE)[m_{ref}] \Big);$ $\mathcal{F} = \gamma_{ref}\mathcal{F}_{ref}(F_t^{out},\bar{F}_t^{ref*}) + \gamma_c\mathcal{F}_c(F_t^{out},F_t^c) + \gamma_{reg}\mathcal{F}_{reg}(\mathrm{CA}_{swap}^{out},\mathrm{CA}^c);$ $\hat{\epsilon}_t = \hat{\epsilon}_t + \nabla_{\pmb{x}_t^{out}}\pmb {F};$ $x_{t - 1} = \sqrt{\bar{\alpha}_{t - 1}} (\frac{x_t - \sqrt{1 - \bar{\alpha}_t}\hat{\epsilon}_t}{\sqrt{\bar{\alpha}_t}} +\sqrt{1 - \bar{\alpha}_{t - 1} - \sigma_t^2}\hat{\epsilon}_t) + \sigma_t z_t;$ $x_{t - 1}^{out} = \mathrm{AdaIN}(x_{t - 1}^{out},x_{t - 1}^{ref};$ +end +Return $\hat{I}^c (\hat{V}^c),\hat{I}^{ref}(\hat{V}^{ref}),\hat{I}^{out}(\hat{V}^{out}) = \mathrm{Decoder}(x_0^c,x_0^s,x_0^{out});$ + +structure is formed early in the sampling process. Therefore, when $\mathrm{T} > 601$ , the spatial structure of the image has not fully developed, and the semantic correspondence is ambiguous. At this stage, feature guidance can disrupt the image structure, thereby reducing the quality of the generated image. When $\mathrm{T} < 601$ , the correspondence tends to be more accurate. However, too few sampling steps weaken the guidance of energy function, reducing style transfer effectiveness. Fewer timesteps with more sampling steps may also lead to overfitting due to minimal feature variation. Furthermore, we conducted an ablation study on the sampling timesteps, with the results shown in Fig. 8. + +# F QUANTITATIVE COMPARISON IN APPEARANCE TRANSFER. + +To quantitatively confirm the effectiveness of our method in the appearance transfer task, we conduct additional evaluations, similar to our quantitative comparisons of style transfer. We compare our method with some other appearance transfer methods (Cross-Image (Alaluf et al., 2023), TI-Guided (Wang et al., 2024b)) on the data sourced from Cross-Image. Our evaluation metrics include structure preservation ability (LPIPS, CFSD, SSIM), style similarity (Gram matrices) and aesthetic scores (PickScore, HPS) on the images of 11 domains provided by Cross-Image. We display the evaluation results of structural preservation capability in Tab. 6, + +![](images/cdd01835d239682cb44b9857223ff22530ba0404c07002d3d4c2dbe419abc9c2.jpg) +Figure 8: Ablation of sampling timesteps. + +and the results of style similarity and aesthetic scores in Tab. 7. It can be seen that our method not only excels in structural preservation but also leads in appearance transfer capability and overall image aesthetics, significantly outperforming competing methods. + +Table 6: Structure Preservation Capacity Quantitative Comparisons to Appearance Transfer Methods. + +
Structure PreservationLPIPS ↓CFSD ↓SSIM ↑
DomainCross-ImageTI-GuidedOursCross-ImageTI-GuidedOursCross-ImageTI-GuidedOurs
Animals0.63890.55860.43401.09490.43130.36590.39960.46700.5347
Birds0.52980.47180.39200.46520.11190.07530.63430.67630.7283
Buildings0.48600.40010.30041.16370.51020.49500.46460.46440.5788
Cake0.57370.52740.39290.55880.42250.24310.50990.52350.6120
Cars0.54510.47940.36940.35050.16730.12020.49300.50120.6319
Fish0.48500.39950.39050.53910.22340.20760.45600.51310.5373
Food0.48140.29240.29240.43140.11120.11120.54050.52280.6905
Fruits0.54170.50620.38720.16570.13910.04680.54980.53220.6711
House0.52680.44630.41350.79680.47720.18860.40230.39640.5433
Landscapes0.66690.58930.48170.22740.15780.06180.41170.41860.5284
Vehicles0.57460.52330.39900.74710.32600.34740.41180.37240.5564
Average0.55000.47220.38660.59460.27980.20570.47940.48980.6012
+ +Table 7: Appearance Similarity and Aesthetics Scores Quantitative Comparisons to Appearance Transfer Methods. + +
Appearance & Aesthetics Gram Metrics×102↓PickScore ↑HPS ↑
DomainCross-ImageTI-GuidedOursCross-ImageTI-GuidedOursCross-ImageTI-GuidedOurs
Animals13.410510.91547.301619.1320.2920.5618.9920.1820.27
Birds9.12992.40861.339519.2719.5620.2019.5319.8120.31
Buildings15.895814.60799.904819.6319.9920.4818.1918.6119.06
Cake10.752511.81988.029419.4319.9120.0519.1919.7119.95
Cars5.98483.67762.661619.7920.0820.2919.7719.9320.01
Fish9.237911.85514.662520.3020.8720.8619.8820.1620.12
Food13.20225.44412.837120.7121.6722.2619.6220.2720.68
Fruits5.21023.65031.208619.6320.1520.5219.4219.5819.91
House16.292312.89453.823720.6120.7220.7019.2819.6119.44
Landscapes10.49067.16022.118519.4319.8920.3518.3418.7518.86
Vehicles11.11997.19116.914320.0420.5921.1619.2519.6520.16
Average10.97518.32954.618319.8220.3420.6819.2219.6619.89
+ +![](images/951be6b488200a06390097cb95202edec681adc034d3c72de6daf07b55b82857.jpg) +Figure 9: Impact of correspondence accuracy. +Figure 10: Video results with 3D Position Encoding. + +# G ADDITIONAL QUALITY COMPARISON RESULTS. + +We provide additional style and appearance transfer qualitative comparison results with diffusion-based methods (Dragondiff (Mou et al., 2023), Cross-Image (Alaluf et al., 2023), StyleID (Chung et al., 2023) and TI-Guided (Wang et al., 2024b)) in Fig. 11 and Fig. 12. + +![](images/e1ca3becb77f8ca77599e566751b8a2821f41feb0d8e66368aee94fb464be53a.jpg) +Figure 11: Additional qualitative comparison with baselines (Dragondiff, Cross-Image, StyleID, TI-Guided) on semantic style transfer (style) task. + +# H PARAMETER SENSITIVITY + +We further demonstrate the parameter effects on different levels in Fig. 13. We found that excessively high values of $\gamma_{ref}$ can disrupt the structure, while excessively high values of $\gamma_{c}$ can diminish the impact of style and appearance. The parameter $\gamma_{reg}$ balances $\gamma_{ref}$ and $\gamma_{c}$ , thereby enhancing image quality. Meanwhile, $\lambda_{pe}$ controls the intensity of the affinity between semantic information and the position information. Besides, it also shows that the performance of our proposed sampler is not highly sensitive to these hyper-parameters. + +# I ADDITIONAL VISUAL RESULTS. + +We also provide additional image style transfer results in Fig. 14, Fig. 16, and additional image appearance transfer results in Fig. 17 and Fig. 18. Additional video style and appearance transfer results are shown in Fig. 19. For more video results, please refer to the supplementary materials in the submitted file. + +![](images/422870c3f170553cdf4246583311bbbff95562b35b7af1c8fdb2ab13a31a1662.jpg) +Figure 12: Additional qualitative comparison with baselines (Dragondiff, Cross-Image, StyleID, TI-Guided) on semantic style transfer (appearance) task. + +![](images/f142747ab15d901f654657062b9945e563e38e4dc2254154e02c6aa704ff83db.jpg) +Default setting + +$$ +\gamma_ {r e f} = 3. 0 +$$ + +$$ +\gamma_ {c} = 0. 9 +$$ + +$$ +\gamma_ {r e g} = 1. 0 +$$ + +$$ +\lambda_ {p e} = 3. 0 +$$ + +![](images/c695c2f12241a460028321a60739c86e3ab2c5f8dd87f6de4a8626a91105c43b.jpg) +Figure 13: Parameter sensitivity of $\gamma_{ref}$ , $\gamma_c$ , $\gamma_{reg}$ and $\lambda_{pe}$ . + +![](images/613c046263ff092f8531cb916622bcfe21d98855ffdc05d9cc38746e95f8cf9c.jpg) + +![](images/6299d8d980d3ea6a7c48f9b205ca450dd3aab1b8aef7514f7f96d055ae87f35a.jpg) + +![](images/10ef5a93140286f73808ff9c1c6bb67cba813e839626a54e223b7ae428ad348c.jpg) + +![](images/1a28eaaf518840d09a25e69db60a62c853fd8aad4afe25a79998bdc9cdd45a9f.jpg) +Figure 14: Additional image semantic style transfer (style) results on given context and reference image pairs. + +![](images/5f851e5cc913558de0e32e45ad14cb7ecf2bd8d2a0f91048d2ac00bce2eb3d98.jpg) +Figure 15: Additional ablation study on Semantic Distance. + +![](images/54212214f2d4cc5a119996cb2e8e8f3ba74edfc4c16d32b17321b54f4478cb92.jpg) +Figure 16: Additional image semantic style transfer (style) results on given context and reference image pairs. + +![](images/241337bf14b4b9d4e28a7735e36e89cd1461a284ac458b2cd34d838c2168aca5.jpg) +Figure 17: Additional image semantic style transfer (appearance) results on given context and reference image pairs. + +![](images/0f076ec19317de1405de09821b0b57578145686869a64ef262e1bf944b14b620.jpg) +Figure 18: Additional image semantic style transfer (appearance) results on given context and reference image pairs. + +![](images/17105a5bd81c235c292e518183ad820f0607b024ca099d2fc05c0615ec254c4f.jpg) +Figure 19: Additional video semantic style transfer results on given context videos and reference images. \ No newline at end of file diff --git a/ICLR/2025/Semantix_ An Energy-guided Sampler for Semantic Style Transfer/images.zip b/ICLR/2025/Semantix_ An Energy-guided Sampler for Semantic Style Transfer/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..3ed32efe5c6e8e7e20b321a594f4c70d12c1fe3a --- /dev/null +++ b/ICLR/2025/Semantix_ An Energy-guided Sampler for Semantic Style Transfer/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:eb55ef236b9b57df20c3600cbf476a4d99b343d264c10408297139c290e4b2e4 +size 2899146 diff --git a/ICLR/2025/Semantix_ An Energy-guided Sampler for Semantic Style Transfer/layout.json b/ICLR/2025/Semantix_ An Energy-guided Sampler for Semantic Style Transfer/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..38d654e9ae253a157615db149d89cd6dfba99804 --- /dev/null +++ b/ICLR/2025/Semantix_ An Energy-guided Sampler for Semantic Style Transfer/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:798400395001ec5d5a4a406bfb91aad1ce3aa41b429683f6cfd04017286a2cb7 +size 770913 diff --git a/ICLR/2025/Semi-Parametric Retrieval via Binary Bag-of-Tokens Index/71e4d846-e824-4bba-a279-6881c1199e60_content_list.json b/ICLR/2025/Semi-Parametric Retrieval via Binary Bag-of-Tokens Index/71e4d846-e824-4bba-a279-6881c1199e60_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..78f7484951355f158eccf699056247fdb2ac7fed --- /dev/null +++ b/ICLR/2025/Semi-Parametric Retrieval via Binary Bag-of-Tokens Index/71e4d846-e824-4bba-a279-6881c1199e60_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b0f3cd04bf9fe1540dd5056817ed75462990537b6b9b2a6571f5c3ee9e1bc9ee +size 125923 diff --git a/ICLR/2025/Semi-Parametric Retrieval via Binary Bag-of-Tokens Index/71e4d846-e824-4bba-a279-6881c1199e60_model.json b/ICLR/2025/Semi-Parametric Retrieval via Binary Bag-of-Tokens Index/71e4d846-e824-4bba-a279-6881c1199e60_model.json new file mode 100644 index 0000000000000000000000000000000000000000..f8abbb88b256283d1133488f116dee7d5728928b --- /dev/null +++ b/ICLR/2025/Semi-Parametric Retrieval via Binary Bag-of-Tokens Index/71e4d846-e824-4bba-a279-6881c1199e60_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:da95f8a461051a90987bf062ab3c9d8a80017548e12d6819df2a0ff7ca828b8a +size 152105 diff --git a/ICLR/2025/Semi-Parametric Retrieval via Binary Bag-of-Tokens Index/71e4d846-e824-4bba-a279-6881c1199e60_origin.pdf b/ICLR/2025/Semi-Parametric Retrieval via Binary Bag-of-Tokens Index/71e4d846-e824-4bba-a279-6881c1199e60_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..6ac147d809794bd520fa44a057fc93273507c074 --- /dev/null +++ b/ICLR/2025/Semi-Parametric Retrieval via Binary Bag-of-Tokens Index/71e4d846-e824-4bba-a279-6881c1199e60_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:85d263af8b1531c0215bc26a948cf40ebf9fdb77922f9e26cc27abf9c6d55351 +size 570009 diff --git a/ICLR/2025/Semi-Parametric Retrieval via Binary Bag-of-Tokens Index/full.md b/ICLR/2025/Semi-Parametric Retrieval via Binary Bag-of-Tokens Index/full.md new file mode 100644 index 0000000000000000000000000000000000000000..14fd3ddc07b3eebf5c56217ce9f2163e4e19c7de --- /dev/null +++ b/ICLR/2025/Semi-Parametric Retrieval via Binary Bag-of-Tokens Index/full.md @@ -0,0 +1,437 @@ +# SEMI-PARAMETRIC RETRIEVAL VIA BINARY BAG-OF-Tokens INDEX + +Jiawei Zhou $^{1,3}$ Li Dong $^{2}$ Furu Wei $^{2}$ Lei Chen $^{1,3}$ + +The Hong Kong University of Science and Technology1 Microsoft Research2 The Hong Kong University of Science and Technology (Guangzhou)3 + +{jzhoubu,leichen}@ust.hk,{lidong1,fuwei}@microsoft.com + +# ABSTRACT + +Information retrieval has transitioned from standalone systems into essential components across broader applications, with indexing efficiency, cost-effectiveness, and freshness becoming increasingly critical yet often overlooked. In this paper, we introduce SemI-parametric Disentangled Retrieval (SIDR), a bi-encoder retrieval framework that decouples retrieval index from neural parameters to enable efficient, low-cost, and parameter-agnostic indexing for emerging use cases. Specifically, in addition to using embeddings as indexes like existing neural retrieval methods, SIDR supports a non-parametric bag-of-tokens index for search, achieving BM25-like indexing complexity with significantly better effectiveness. Our comprehensive evaluation across 16 retrieval benchmarks demonstrates that SIDR outperforms both neural and term-based retrieval baselines under the same indexing workload: (i) When using an parametric embedding-based index, SIDR exceeds the performance of conventional neural retrievers while maintaining similar training complexity; (ii) When using a non-parametric tokenization-based index, SIDR matches the complexity of traditional term-based retrieval BM25, while consistently outperforming it on in-domain datasets; (iii) Additionally, we introduce a late parametric mechanism that matches BM25 index preparation time for search while outperforming both BM25 and other neural retrieval baselines in effectiveness. Code is available at https://github.com/jzhoubu/sidr. + +# 1 INTRODUCTION + +In recent years, information retrievers has evolved from end-to-end systems to essential components in various applications, including question answering (Kolomiyets & Moens, 2011; Zhu et al., 2021), classification (Long et al., 2022), recommendation (Dong et al., 2020; Manzoor & Jannach, 2022) and dialog systems (Liu et al., 2024b). This evolution has notably accelerated with the advent of the retrieval-augmented generation (RAG) paradigm (Bommasani et al., 2021; Guu et al., 2020; Yu et al., 2022; Mialon et al., 2023), in which the retrieval component enables large language models (LLMs) to access relevant data from external sources, effectively addressing challenges such as like hallucination (Ji et al., 2023; Zhang et al., 2023), obsolescence (Wang et al., 2023), and privacy concerns (Huang et al., 2022). + +Traditional retrieval systems provide end-to-end search services and build indexes offline, without concern for cost or latency. In contrast, advanced retrieval components integrate with various downstream models, requiring greater flexibility to meet the diverse needs of applications. We present several emerging retrieval scenarios where current neural retrievers face limitations, and introduce specific index properties in our proposed framework designed to overcome these challenges. + +Scenario 1: Online indexing for RAG applications with real-time knowledge sources. In RAG applications that depend on real-time knowledge source, such as up-to-the-minute internet information (Liu et al., 2023) and user-uploaded content requiring immediate responses (Wang et al., 2024), efficient online indexing is essential as it determines the time lag between the availability of data and its application. Effective neural retrieval with efficient online indexing facilitates the rapid assimilation and filtering of real-time datastreams, reducing computational burdens and mitigating hallucinations (Liu et al., 2024a; Shuster et al., 2021) when LLMs process long contexts. + +Scenario 2: Low-cost index for exploration and deployment. Concerns about data privacy (Huang et al., 2022; Arora et al., 2023) and licensing issues (Min et al., 2023) are driving startups and individual developers towards building their own local retrieval pipelines for RAG applications. In this context, it is common to construct temporary retrieval indexes that are frequently modified and rebuilt to cater to different data sources and to optimize for varying chunk size selections, allowing for effective analysis of large datastores (Shao et al., 2024) and the fine-tuning of configurations. Given their sensitivity to resource constraints, smaller entities often prioritize cost reduction over maximizing effectiveness, making Low-cost Index more important than achieving state-of-the-art performance. + +![](images/7dd7943764c10de4e77cecffafa0be65c4c51fe2349c0399cc0acc9015f17a80.jpg) +Figure 1: Comparison of storage (2 GB vs. 31 GB) and resource costs (1 CPU hour vs. 30 GPU hours) between two indexes. + +Scenario 3: Parameter-agnostic index for co-training retrievers with LLMs. A significant challenge in co-training neural retrievers with LLMs is the index update issue (Asai et al., 2023) caused by in-training retrieval (Guu et al., 2020; Izacard et al., 2022a; Shi et al., 2023). Specifically, during training, a neural retriever parameterized by $\theta$ is learned to search information from a datastore $\mathcal{D}$ to enhance the LLMs. The retrieval index, denoted as $E_{\theta}(\mathcal{D})$ , consists of the neural embeddings of the datastore $\mathcal{D}$ . As the parameters update $\theta \rightarrow \theta'$ , the datastore index needs to be rebuilt $E_{\theta}(\mathcal{D}) \rightarrow E_{\theta'}(\mathcal{D})$ to prevent it from becoming stale. This process is computationally expensive and compromises the training objectives. Developing a neural retrieval that supports a Parameter-agnostic Index could address this issue and streamline the co-training pipelines. + +To meet these emerging needs, our paper introduces the SemI-parametric Disentangled Retrieval framework (S1DR), which decouples retrieval index from neural parameters to facilitate an efficient, low-cost, and non-parametric indexing setup. Specifically, our framework involves learning parametric term weighting within a language model vocabulary space, where non-parametric representations can be straightforwardly defined and constructed via tokenization. By aligning these two types of representations, one encoder within the bi-encoder framework can optionally utilize tokenization-based representations as a shortcut for indexing large data volumes. As a result, S1DR simultaneously supports a parametric index that utilizes neural embeddings and a non-parametric index that employs bag-of-tokens representations. As illustrated in Figure 1, using the non-parametric index for the Wikipedia corpus drastically reduces the indexing cost and time from 30 GPU hours to just 1 CPU hour and reduces storage size from 31GB to 2GB. This design offers flexibility in choosing indexes with varying complexity to meet diverse retrieval scenarios and co-training propose. + +Our comprehensive evaluations across 16 retrieval benchmarks demonstrate that SIDR outperforms both neural and term-based retrieval baselines under comparable indexing workloads. Specifically, our framework with a non-parametric index achieves a $10.6\%$ improvement in top-1 accuracy in-domain compared to BM25, while maintaining indexing efficiency on par with BM25. Additionally, when utilizing a parametric index, our framework surpasses neural retrieval methods by $2.7\%$ with similar training complexity. Furthermore, our late parametric approach that retrieves from a non-parametric index and re-ranks the results on-the-fly, achieving indexing efficiency comparable to BM25 while maintaining the effectiveness of neural retrieval. + +We summarize our contributions from two main aspects: + +- From IR perspective: We introduce a versatile semi-parametric retrieval framework that supports both parametric and non-parametric indexes to accommodate diverse downstream scenarios. The parametric index uses neural embeddings for effectiveness, while the non-parametric relies solely on tokenization for efficiency. We further propose a late parametric mechanism to maximize the trade-off between retrieval effectiveness and indexing efficiency. +- From RAG perspective: Our approach introduces in-training retrieval on a fixed non-parametric index, which avoids index staleness and eliminates the need for costly index rebuilds within the retriever's training loop. This simplifies the co-training the retrieval system with other models. + +# 2 BACKGROUND + +Information retrieval task. Given a query $q$ and a datastore $\mathcal{D}$ , information retrieval (Manning, 2009) aims to identify the most relevant passage $p \in \mathcal{D}$ based on $q$ . This task is typically performed using a bi-encoder framework, which employs two independent encoders to embed queries and passages into vector representations. The retrieval process can be formulated as: + +$$ +\hat{p} = \operatorname *{argmax}_{\forall p\in \mathcal{D}}f(q,\mathcal{D}) = \operatorname *{argmax}_{\forall p\in \mathcal{D}}f(q,p) +$$ + +In this equation, $\hat{p}$ is the retrieved passage, and $f$ is a function measures the relevance between $q$ and $p$ , usually calculated as the inner product of their vector representations. + +Notation. We use $E_{\theta}(\cdot)$ to denote a general neural embedding process, applicable to both dense and sparse retrieval. Specifically, for term-based and sparse lexical retrieval, a $|V|$ -dimensional representation is used, where each dimension represents the weight of a token or word within vocabulary $V$ . We denote this embedding function as $V_{\mathrm{Model}_{\theta}}(\cdot): x \to \mathcal{R}^{|V|}$ , where the subscript indicates the model architecture, and $\theta$ reflects whether the embedding involves learnable parameters. + +Traditional term-based retrieval. Traditional term-based retrieval, such as TF-IDF (Ramos et al., 2003) and BM25 (Robertson et al., 2009), assess relevance based on weighted term overlap, which can be described as: + +$$ +f _ {\mathrm {B M} 2 5} (q, p) = \left\langle V _ {\mathrm {B M} 2 5} (q), V _ {\mathrm {B M} 2 5} (p) \right\rangle = \left\langle w _ {\mathrm {B M} 2 5} \cdot V _ {\mathrm {B o W}} (q), w _ {\mathrm {B M} 2 5} \cdot V _ {\mathrm {B o W}} (p) \right\rangle +$$ + +These methods do not involve learned neural parameters and are therefore categorized as non-parametric (Min et al., 2022; Freeman et al., 2002). They employ a million-scale dimensional bag-of-words (BoW) representation $V_{\mathrm{BoW}}(\cdot)$ , with heuristic statistical metrics determining the term weighting $w_{\mathrm{BM25}}$ for each dimension. Due to the efficiency and cost-effectiveness in constructing the term-based index $V_{\mathrm{BM25}}(\mathcal{D})$ , these methods are still widely used in industry applications. + +Neural retrieval. Unlike term-based retrieval that is heuristic-driven, neural retrieval (Karpukhin et al., 2020; Zhu et al., 2023) is data-driven and parameterized, tailored to learn on specific datasets and tasks. The relevance assessment is defined as: + +$$ +f _ {\theta} (q, p) = \left\langle E _ {\theta} (q), E _ {\theta} (p) \right\rangle +$$ + +While neural Retrievers are effective with ample training data, the construction of the parametric index $E_{\theta}(\mathcal{D})$ requires embedding the entire dataset, which introduces significant computational costs and latency that hinder their widespread adoption. + +Neural retrievers can be further categorized into entangled retrievers (a.k.a. dense retrievers) and disentangled retrievers (a.k.a. sparse lexical retrievers), categories which we detail in Appendix A. Specifically, entangled retrievers utilize latent representations with dimensions such as 768, 1024, or 2048. In contrast, disentangled retrievers employ disentangled representations, with dimensions equal to vocabulary sizes, such as 30522 for BERT's vocabulary, where each dimension reflects the importance of each token. + +# 3 METHODOLOGY + +As an overview, Semi-parametric Disentangled Retrieval (S1DR) is a disentangled retrieval system that builds on the VDR architecture (Zhou et al., 2024), incorporating modifications in the learning objective and utilizing in-training retrieval for negative mining to enhance its effectiveness. At downstream, S1DR supports both embedding-based index and bag-of-tokens index. The primary goal of our work is to expand the functionality of the current retrieval system to better accommodate emerging scenarios. + +In the following sections, we delve into details of representation (§3.1), rational (§3.2), training objectives (§3.3), search pipelines (§3.4), and the application of in-training retrieval techniques (§3.5). + +![](images/9527d450c067d0342647bfd7acf93aa90c94e034e90d78c07ea9afc62430893f.jpg) +Figure 2: Left: Training frameworks of entangled retriever, disentangled retriever and our proposed semi-parametric disentangled retriever S1DR; Right: Different inference pipelines of S1DR. + +# 3.1 PARAMETRIC AND NON-PARAMETRIC REPRESENTATION + +Disentangled retrievers typically represent data in a language model vocabulary space, which can be interpreted as a set of tokens with weights. Our parametric representation, $V_{\theta}(x)$ , uses token weights learned by a neural encoder, whereas the non-parametric representation, $V_{\mathrm{BoT}}(x)$ , can be viewed as using unweighted tokens generated by a tokenizer. + +Parametric representation. We inherit the VDR encoder (Zhou et al., 2024), which extends the conventional MLMs architecture with three modifications: (i) replacing the softmax activation with elu1p to map dimensional values from $(0,1)$ to $(0, +\infty)$ ; (ii) applying max-pooling to aggregate token representations into a global representation; and (iii) employing top- $k$ sparsify $(S_{topk})$ to prune the less significant dimensional values to zero. These modifications can be expressed as follows: + +$$ +e l u 1 p (x) = \left\{ \begin{array}{l l} x + 1 & \text {i f} x > = 0 \\ e ^ {x} & \text {o t h e r w i s e} \end{array} \right. +$$ + +$$ +V _ {\theta} (x) = \mathrm {S} _ {t o p k} \circ \operatorname {M a x P o o l} \circ \left\{V _ {\mathrm {M L M H} _ {\theta} + \mathrm {e l u p}} \left(t _ {i} | x\right), \forall t _ {i} \in x \right\} +$$ + +Significantly, these modifications aggregate token representations into a global one, while preserving the property of assigning larger values to more relevant dimensions. + +Non-parametric representation. The non-parametric bag-of-tokens (BoT) representation for a sequence of tokens $x$ is defined as follows: + +$$ +V _ {\mathrm {B o T}} (x) = \operatorname {M a x P o o l} \circ \{V _ {\mathrm {B o T}} (t _ {i}), \forall t _ {i} \in x \}; \quad V _ {\mathrm {B o T}} (x) [ i ] = \left\{ \begin{array}{l l} 1 & \text {i f} V [ i ] \in x \\ 0 & \text {o t h e r w i s e} \end{array} \right. +$$ + +$V_{\mathrm{BoT}}(x)$ can be seen as the result of applying max pooling to the one-hot representations of all tokens in $x$ , assigning each $i$ -th dimension a value of 1 or 0, depending on whether the $i^{th}$ token in $V$ is present in $x$ . Compared to $V_{\mathrm{BM25}}(\cdot)$ , $V_{\mathrm{BoT}}(\cdot)$ is tokenizer-specific, with dimensionality on the scale of tens of thousands, and uses binary values that require less storage space, making it well-suited for tensorization and efficient GPU computation. + +# 3.2 RATIONALE OF SEMI-PARAMETRIC ALIGNMENT. + +In this section, we elaborate on the rationale behind the semi-parametric design. The semi-parametric alignment is designed to be consistent with mask language models (MLMs) (Devlin et al., 2018) pre-training objective. + +Mask language model pre-training. During pre-training, MLMs are optimized to predict masked tokens by leveraging the context. Specifically, given an input sequence of tokens $x = [t_1, t_2, \dots, M(t_i), \dots, t_n]$ with $t_i$ masked, the MLM uses its prediction head (MLMH) with a softmax function to produce the probability $V_{\mathrm{MLMH}_{\theta} + \mathrm{softmax}}(\mathrm{Mask}(t_i)|x)$ of the masked token $t_i$ over a + +vocabulary. The ground truth probability is the one-hot representation of the token $t_i$ . In this paper, we refer to this type of representation as the bag-of-tokens (BoT) representation, denote as $V_{\mathrm{BoT}}(t_i)$ . The mask token prediction task can be viewed as alignment between the vocabulary distribution of the masked token position with the one-hot representation $V_{\mathrm{BoT}}(t_i)$ in a masked setup: + +$$ +V _ {\mathrm {M L M H} _ {\theta} + \text {s o f t m a x}} (\operatorname {M a s k} (t _ {i}) | x) \xleftrightarrow {\text {a l i g n}} V _ {\mathrm {B o T}} (t _ {i}) \tag {1} +$$ + +As a result, the representation $V_{\mathrm{MLMH}_{\theta}}(t_i|x)$ tends to assign large values to the dimension corresponding to $t_i$ , or that are semantically related to $t_i$ based on the context $x$ . + +Semi-parametric alignment. The alignment between parametric and non-parametric representation can be expressed as follows: + +$$ +\mathrm {S} _ {t o p k} \circ \operatorname {M a x P o o l} \circ \left\{V _ {\mathrm {M L M H} _ {\theta} + \mathrm {e l u 1 p}} (t _ {i} | x), \forall t _ {i} \in x \right\} \xleftrightarrow {\text {a l i g n}} \mathrm {S} _ {t o p k} \circ \operatorname {M a x P o o l} \circ \left\{V _ {\mathrm {B o T}} (t _ {i}), \forall t _ {i} \in x \right\} +$$ + +The semi-parametric alignment is modeled after the MLM pre-training objective, as detailed in Equation 1, and expands by aligning multi-token representations between the query and passage. The consistency between upstream pre-training and downstream tuning supports the alignability of these two representations. + +# 3.3 SEMI-PARAMETRIC CONTRASTIVE LEARNING + +In a batch containing $N$ instances, each instance consists of a query $q_{i}$ , a positive passage $p_i$ , and a set of of negative passages. Our training objective is based on contrastive learning (Jaiswal et al., 2020), which aims to maximize the similarity of positive pairs $f(q_{i},p_{i})$ for all instances $i$ , while minimize the similarity of all negative pairs, denoted as $f(q_{i},p_{j})$ for all $j \neq i$ . The loss function is defined as follows: + +$$ +L(q,p) = -\sum_{i = 1}^{N}(\log \underbrace{e^{f(q_{i},p_{i})}}_{\substack{\sum_{\forall p\in B}e^{f(q_{i},p)}} + \log \underbrace{e^{f(p_{i},q_{i})}}_{\substack{\sum_{\forall q\in B}e^{f(p_{i},q)}}}) +$$ + +This results in a final loss that integrates both parametric and semi-parametric components: + +$$ +L _ {\text {p a r a}} (q, p) = L \left(V _ {\theta} (q), V _ {\theta} (p)\right) +$$ + +$$ +L _ {\text {s e m i - p a r a}} (q, p) = L \left(V _ {\theta} (q), V _ {\text {B o T}} (p)\right) / 2 + L \left(V _ {\text {B o T}} (q), V _ {\theta} (p)\right) / 2 +$$ + +$$ +L _ {\text {f i n a l}} (q, p) = L _ {\text {p a r a}} (q, p) + L _ {\text {s e m i - p a r a}} (q, p) +$$ + +The parametric contrastive loss $L_{p}$ aims to align the parametric representations of $q$ and $p$ , a common objective for retrieval training. The semi-parametric contrastive loss $L_{sp}$ ensures interaction between the non-parametric and parametric representations, which forms the foundation of our model to support a BoT index $V_{\mathrm{BoT}}(\mathcal{D})$ . + +# 3.4 SEARCH PIPELINES AND INDEX TYPES + +Our framework supports both a parametric embedding-based index and a non-parametric tokenization-based index. Below, we discuss search functions and the corresponding index type. + +Full parametric search $(\mathrm{SIDR}_{\mathrm{full}})$ utilizes a parametric index $V_{\theta}(\mathcal{D})$ , which relies on embeddings derived from a neural encoder for the datastore. The relevance is defined as: + +$$ +f _ {\theta} (q, \mathcal {D}) = \langle V _ {\theta} (q), V _ {\theta} (\mathcal {D}) \rangle +$$ + +This is the common indexing process for neural retrieval systems, which are effective but involve higher costs and longer latency for embedding the entire $\mathcal{D}$ to obtain the index $V_{\theta}(\mathcal{D})$ . + +Semi-parametric beta search $(\mathrm{SIDR}_{\beta})$ leverages a non-parametric index $V_{\mathrm{BoT}}(\mathcal{D})$ based on BoT representations of the datastore, which are constructed solely by a tokenizer. The relevance is defined as: + +$$ +f _ {\beta} (q, \mathcal {D}) = \left\langle V _ {\theta} (q), V _ {\mathrm {B o T}} (\mathcal {D}) \right\rangle +$$ + +Beta search applies BoT representations on the index side, eliminating the need for neural embeddings during index processing for large datastores, making it suitable for various applications. + +Late parametric with top-m re-rank $(\mathrm{S1DR}_{\beta}(m))$ is a search pipeline that starts search with a non-parametric index to retrieve top- $m$ passages, denote as $\mathcal{D}_m$ , and then embeds them for re-ranking: + +$$ +f _ {\beta} (q, \mathcal {D}) = \left\langle V _ {\theta} (q), V _ {\mathrm {B o T}} (\mathcal {D}) \right\rangle ; \quad f _ {\theta} (q, \mathcal {D} _ {m}) = \left\langle V _ {\theta} (q), V _ {\theta} (\mathcal {D} _ {m}) \right\rangle +$$ + +Late parametric retrieval requires a first-stage retriever to support a non-parametric index, followed by a second-stage bi-encoder retriever to re-rank and cache the passage embeddings. From an efficiency and cost perspective, the late parametric with top- $m$ re-rank only requires embedding at most $N_{q} \times m$ passages, where $N_{q}$ is the number of queries. It starts the search with a non-parametric index, distributing the embedding workload throughout the online search process, achieving a fast retrieval setup. When dealing with exploratory scenarios that have limited queries or extremely large datastores, this approach becomes more efficient, as $N_{q} \times m$ remains much smaller than $|\mathcal{D}|$ . + +# 3.5 IN-TRAINING RETRIEVAL FOR NEGATIVE SAMPLING + +While semi-parametric retrieval offers advantages for in-training retrieval by eliminating the need for re-indexing, it also has drawbacks, notably its limited effectiveness due to using non-parametric representations on index side. To enhance their performance, we integrate beta search in the training loop to dynamically source hard negative passages, leveraging the strengths of semi-parametric design to counterbalance their limitations. Specifically, during the training, SIDR employs beta search to retrieve the top- $m$ passages in real-time — using $V_{\theta}(q)$ to search on non-parametric index $V_{\mathrm{BoT}}(\mathcal{D})$ and get the top- $m$ results $\mathcal{D}_m$ . Subsequently, each passage in $\mathcal{D}_m$ is assessed whether it is negative based on exact matches with the answer strings. For each query, one negative is randomly selected from the identified negatives. This method is exclusively used for the Wikipedia benchmark, which provides answer strings to distinguish between negative and positive passages. + +While in-training retrieval is increasingly adopted to enhance retrieval training (Zhan et al., 2021; Xiong et al., 2020) and facilitate co-training retrievers with LLMs (Shi et al., 2023), previous approaches have necessitated periodic index refreshment in the training loop. In contrast, our approach uniquely leverages a fixed index $V_{\mathrm{BoT}}(\mathcal{D})$ , eliminating the need for re-indexing $\mathcal{D}$ . Our analysis shows that incorporating in-training retrieval with our non-parametric index does not add significant latency; however, a slight latency increase occurs due to the string matching process to identify negatives, which is discussed in Section 4.3. + +# 4 EXPERIMENTAL SETUP + +# 4.1 DATASETS + +Wiki21m benchmark. Following established benchmark in retrieval literature (Chen et al., 2017; Karpukhin et al., 2020), we train our model on the training splits of Natural Questions (NQ; Kwiatkowski et al., 2019), TriviaQA (TQA; Joshi et al., 2017), and WebQuestions (WQ; Berant et al., 2013) datasets, and evaluated it on their respective test splits. The retrieval corpus used is Wikipedia, which contains over 21 million 100-word passages. + +BEIR benchmark. We train our model on MS MARCO passage ranking dataset (Bajaj et al., 2016), which consists of approximately 8.8 million passages with around 500 thousand queries. The performance is assessed both in-domain on MS MARCO and in a zero-shot setting across 12 diverse datasets within the BEIR benchmark (Thakur et al., 2021). + +# 4.2 BASELINES + +Primary baselines. We primarily compare our model with several established retrieval baselines, selected due to their similar model sizes and training complexities, ensuring a comparable training cost. These include dense retrieval DPR, term-based retrieval BM25, and sparse lexical retrieval models such as SPLADE (Formal et al., 2021b), uniCOIL (Lin & Ma, 2021), and VDR (Zhou et al., 2024). Specifically, $\mathrm{VDR}_{\beta}$ refers to directly using the VDR models to perform beta search. + +Advanced baselines. We also introduce advanced retrieval systems for baselines, including ANCE (Xiong et al., 2020), LexMAE (Shen et al., 2022), SPLADE-v2 (Formal et al., 2021a), + +Contriever (Izacard et al., 2021), GTR (Ni et al., 2021), E5 (Wang et al., 2022), and Dragon (Lin et al., 2023a). These systems leverage larger foundational models (Ma et al., 2023; Ni et al., 2021), retrieval-oriented pre-training (Fan et al., 2022; Zhou et al., 2022), or knowledge distillation (Formal et al., 2022) to enhance performance. We have categorized them as advanced baselines due to their significantly higher training costs associated with the additional training techniques. Future work may explore their integration with our model to assess potential benefits. + +# 4.3 IMPLEMENTATION DETAILS + +Hyperparameters. For the NQ, TQA, and WQ datasets, our model is trained for 80 epochs, utilizing in-training retrieval for negative sampling. For the MS MARCO dataset, the training duration is set to 40 epochs. We utilize a batch size of 128 and an AdamW optimizer (Loshchilov & Hutter, 2018) with a learning rate set at $2 \times 10^{-5}$ . Our model uses a top- $k$ sparsification with $k = 768$ , matching the dimensionality of conventional dense retrieval embeddings. For computational devices, our systems are equipped with 4 NVIDIA A100 GPUs and Intel Xeon Platinum 8358 CPUs. + +Training cost. The training durations for DPR, VDR, and S1DR on the NQ dataset are 5, 8, and 9 hours respectively, with 80 epochs under similar conditions. For S1DR, the training time per epoch without in-training retrieval is 6 minutes, which is identical to VDR. This duration increases to 8 minutes per epoch when incorporating in-training retrieval. The additional time is primarily due to the string matching process required to identify negative samples from the retrieved top- $k$ passages. + +# 5 EXPERIMENTS + +# 5.1 MAIN RESULTS + +Table 1: Top-1/5/20 retrieval accuracy on test sets (i.e., percentage of questions for which the answers is found in the retrieved passages). Bold numbers indicate the best performance within each setting. + +
NQTQAWQ
top1top5top20top1top5top20top1top5top20
Parametric Index
DPR46.068.980.254.171.580.037.459.773.2
VDR43.868.079.952.971.379.337.158.772.5
SIDRfull49.169.380.756.273.080.540.261.073.2
Non-parametric Index
BM2522.743.662.948.266.476.419.542.662.8
VDRβ12.330.046.816.931.645.97.722.439.2
SIDRβ39.862.976.350.470.779.532.154.169.8
Late parametric with top-m re-rank
BM25+DPR (m=5)32.243.662.954.866.476.428.042.662.8
BM25+DPR (m=20)39.455.562.955.471.076.434.653.262.8
BM25+DPR (m=100)44.463.673.556.672.380.539.959.270.2
SIDRβ (m=5)44.960.676.454.970.779.638.054.169.8
SIDRβ (m=20)49.568.276.456.772.979.539.659.569.8
SIDRβ (m=100)50.370.780.656.873.381.341.562.073.5
+ +Wiki21m benchmark results. As shown in Table 1, when using a parametric index, $\mathrm{S1DR_{full}}$ outperforms DPR and VDR in top-1 retrieval accuracy by $2.6\%$ and $3.8\%$ , respectively. These results demonstrate that although our primary objective is to enable neural retrieval with support for non-parametric indexing, our modifications do not diminish effectiveness with an embedding-based index; in fact, they may even improve it. This enhancement also suggests that current benchmarks may favor lexical relevance, likely due to their construction relying on term-based retrieval methods. + +When utilizing a non-parametric index, $\mathrm{SIDR}_{\beta}$ significantly surpasses $\mathrm{VDR}_{\beta}$ and BM25 in top-1 accuracy by $28.5\%$ and $10.6\%$ , respectively. Unlike BM25, which relies on empirically derived heuristic term weights for indexing, $\mathrm{SIDR}_{\beta}$ employs binary values in a significantly smaller vocabulary space, facilitating tensorization on GPUs. With ample in-domain training data, $\mathrm{SIDR}_{\beta}$ significantly outperforms BM25, demonstrating the exceptional learnability and generalizability of neural retrievers in this context. + +Additionally, late parametric methods improve $\mathrm{SIDR}_{\beta}$ by enabling on-the-fly re-ranking of the top- $m$ passages. Our results show that by re-ranking the top-20 passages, $\mathrm{SIDR}_{\beta}$ ( $m = 20$ ) matches the performance of $\mathrm{SIDR}_{\mathrm{full}}$ , and by extending re-ranking to the top-100 passages, it surpasses all primary baselines. Beyond effectiveness, the most significant advantage of late parametric methods is their substantial reduction in computational costs. For example, in evaluations on the NQ test split with 3k queries, $\mathrm{SIDR}_{\mathrm{full}}$ requires embedding the entire $\mathcal{D}$ , which consists of 21 million passages. In contrast, $\mathrm{SIDR}_{\beta}$ ( $m = 100$ ) only needs to embed $N_{q} \times m$ passages, amounting to just $1\%$ of the passages in $\mathcal{D}$ , yet achieves superior effectiveness. This underscores the exceptional suitability of late parametric methods for exploration or evaluation scenarios. + +BEIR benchmark results. As shown in Table 2, $\mathrm{SIDR}_{\mathrm{full}}$ surpasses VDR, DPR, and other primary baselines in the BEIR benchmark when using either a parametric index or a non-parametric index with late parametric techniques, consistent with the findings from the Wiki21m benchmark. However, when relying solely on a non-parametric index, $\mathrm{SIDR}_{\beta}$ outperforms $\mathrm{VDR}_{\beta}$ and BM25 on in-domain datasets but falls behind BM25 on most out-of-domain datasets. We attribute this performance decline to three factors. First, due to the lack of answer strings to accurately identify negative passages in MS MARCO, we do not implement in-training retrieval during training on MS MARCO, which likely contributes to weaker performance. Second, as non-parametric indexes lack neural parameters, they are more sensitive to shifts in data distribution, which may lead to weaker effectiveness in out-of-domain scenarios. Lastly, many BEIR datasets exhibit a lexical bias due to their construction using BM25, as noted in the BEIR paper (Thakur et al., 2021), which inherently gives BM25 an advantage. + +Table 2: Retrieval performance on MS MARCO (MRR@10) and BEIR benchmark (NDCG@10). Bold numbers indicate the best performance within each setting. + +
MS MARCOClimate-FEVERDBPediaFEVERFiQAHotspotQANFCorpusNQSCIDOCsSciFactTREC-COVIDTouché-2020Avg.
Advanced Retrieval Baselines
LexMAE48.050.021.942.480.035.271.634.756.215.971.776.329.048.7
Splade-v243.347.923.543.578.633.668.433.452.115.869.371.027.247.0
Contriever-44.623.741.375.832.963.832.849.816.567.759.623.044.3
GTR-base42.051.124.134.766.034.953.530.849.514.960.053.920.541.2
E5-base43.151.415.441.058.236.463.336.162.919.073.179.628.347.1
Dragon39.348.922.241.778.135.664.832.953.115.467.574.024.946.6
ANCE33.841.519.828.166.929.545.623.744.612.250.765.428.438.0
Parametric Index
DPR30.240.816.230.463.823.745.226.143.210.947.460.122.135.8
UniCOIL32.935.515.030.272.327.064.032.536.213.967.459.725.939.4
SPLADE34.043.919.936.673.028.763.631.346.914.562.867.320.142.4
VDR34.348.617.639.074.028.865.533.047.215.367.367.829.844.5
SiDRfull34.253.017.939.371.529.865.433.047.715.166.268.029.744.7
Non-parametric Index
BM2518.731.521.331.375.323.660.332.532.915.866.565.636.741.1
VDRβ6.114.16.17.928.46.45.723.96.88.154.521.99.216.1
SiDRβ19.038.610.820.846.519.849.427.925.311.164.253.523.732.5
Late parametric with top-m re-rank
SiDRβ(m=10)26.344.012.124.957.322.855.430.233.112.265.554.925.236.5
SiDRβ(m=20)29.248.013.830.662.325.758.732.338.413.865.659.127.339.6
SiDRβ(m=100)32.951.516.637.869.229.363.333.244.714.865.765.929.043.4
+ +# 5.2 RETRIEVAL LATENCY + +We evaluated the latency of various retrieval systems across different stages using NQ test split and Wikipedia corpus, as shown in Table 3. The comparison assumes that both BM25 and SiDR indexes fit entirely into CPU/GPU memory. Further details can be found in Appendix B. + +Indexing stage. The indexing stage converts the textual corpus into a searchable format. Both $\mathrm{SIDR}_{\beta}$ and BM25 use tokenization-based index and can complete indexing within 1 hour on a CPU, much faster than the over 20 hours required on GPUs for embedding-based index. The indexing stage often accounts for a large portion of the overall time and cost in the retrieval pipeline. Our BoT index is efficient, more cost-effective and benefiting from parallelization, making it a flexible option for practical retrieval-based applications. + +. $\mathrm{E}_{\theta}(p)$ in search stage refers to the passage embedding used for late parametric re-ranking. + +Table 3: Latency at each stage of the retrieval pipeline. $\mathrm{T}\left( \cdot \right)$ : computations of tokenization; ${\mathrm{E}}_{\theta }\left( \cdot \right)$ : computation of neural model forward. †: Computations performed on a single GPU; times in parentheses indicate the latency if performed on a single CPU thread + +
ModelIndexingSearchTotal
T(D)Eθ(D)Eθ(q)T(q)f(q,D)Eθ(p)Total
BM250.6h//40s†(2m)/40s0.6h
DPR/20.3h†12s†(2m)/41ms†(2m)/12s20.3h
VDR/23.7h†15s†(2m)/130ms†(20m)/15s23.7h
SIDRfull/23.7h†15s†(2m)/130ms†(20m)/15s23.7h
SIDRβ0.5h/15s†(2m)/30ms†(3m)/15s0.5h
SIDRβ(m=20)0.5h/15s†(2m)/30ms†(3m)4m†4m0.6h
SIDRβ(m=100)0.5h/15s†(2m)/30ms†(3m)20m†20m0.9h
+ +Search stage. The search stage processes online incoming queries and retrieves relevant items from the indexed data. As shown in the table, $\mathrm{S1DR}_{\beta}$ achieves significantly higher efficiency compared to BM25 and performs on par with dense retrieval methods when utilizing GPU resources. This advantage arises because the BoT index $V_{\mathrm{BoT}}(\mathcal{D})$ has a fixed dimensionality, enabling tensorization for inner product calculations on the GPU. In contrast, BM25 term-based index $V_{\mathrm{BM25}}(\mathcal{D})$ operates with millions of dimensions and relies on an inverted index for efficiency. + +# 6 ANALYSIS + +We assess the impact of proposed components and various influencing factors, as detailed in Table 4. + +Impact of proposed components. Our ablation study confirms the significance of each component in our approach. Removing the semi-parametric loss (w/o SP objective) leads to a drop in accuracy of $5.3\%$ for $\mathrm{SIDR}_{\mathrm{full}}$ and a substantial $31.5\%$ for $\mathrm{SIDR}_{\beta}$ , rendering beta search non-functional. Moreover, excluding in-training retrieved negatives (w/o retrieved neg) results in a decrease in top-1 accuracy: $4.2\%$ for $\mathrm{SIDR}_{\mathrm{full}}$ and $7.5\%$ for $\mathrm{SIDR}_{\beta}$ . These results highlight the effectiveness of using beta search for in-training retrieval. Unlike static BM25 negatives, which quickly diminish in effectiveness as the model learns, beta search utilizes parametric queries that evolve with the model, continually ensuring that the negatives are challenging and relevant throughout the training process. + +Table 4: Ablation study of $\mathrm{S1DR_{full}}$ and $\mathrm{S1DR}_{\beta}$ on NQ dataset. + +
top1top5top20
Parametric Index
S1DRfull49.169.380.7
w/ retrieved neg (m=1)47.968.479.6
w/ retrieved neg (m=100)47.369.080.5
w/ retrieved neg (MARCO)39.763.977.5
w/ retrieved neg (WIKI 8m)48.369.180.6
w/o retrieved neg44.966.978.8
w/o neg30.257.475.1
w/o SP objective43.868.079.9
Non-parametric Index
S1DRβ39.862.976.3
w/ retrieved neg (m=1)41.262.376.4
w/ retrieved neg (m=100)37.362.476.5
w/ retrieved neg (MARCO)29.554.870.1
w/ retrieved neg (WIKI 8m)37.562.476.3
w/o retrieved neg32.356.072.1
w/o neg24.449.168.2
w/o SP objective12.330.046.8
w/ vary lenth37.561.276.1
+ +Effect of negative sample hardness. We explore how the difficulty of retrieved negatives affects model + +effectiveness. The parameter $m$ indicates the size of the passage pool from which negatives are identified and then randomly drawn, with lower $m$ values yielding harder negatives. While these harder negatives can improve contrastive learning, they also increase the risk of misclassifying weak positives as negatives. Our results (w/ retrieved neg $m = \{1,100\}$ ) indicate that adjusting $m$ to 1 or 100, compared to the baseline of 20, degrades the performance. Thus, an $m$ value of 20 provides the optimal balance, effectively challenging the model while reducing the likelihood of misclassification. + +Effect of negative sample source. Our results (w/ retrieved neg MARCO) indicate that switching the source of negative samples from the Wikipedia corpus to the MS MARCO with 8.8 million passages leads to a notable drop in performance. In a parallel experiment (w/ retrieved neg WIKI 8m) using a Wikipedia corpus of the same size, performance remained consistent with our baseline, indicating that corpus size is not the main factor behind the observed decline. Instead, the source of negatives plays a crucial role in performance. The disparity stems from differences in the writing styles and structures unique to each corpus (e.g., Wikipedia passages typically include a short title preceding the text), which cause the model to focus on superficial, corpus-specific features rather than developing a deeper understanding of the relevance. + +Impact of text length on non-parametric index. Unlike the BM25 term-based index, the BoT index lacks term weighting, meaning longer texts may activate more dimensions, resulting in higher inner product scores. To assess the impact of text length on the effectiveness of $\mathrm{S1DR}_{\beta}$ , we resegmented the Wikipedia corpus into passages ranging from 50 to 200 words, while maintaining the same overall number of passages. Our results (w/ vary lentgh) show that the top-1 accuracy of $\mathrm{S1DR}_{\beta}$ decreased slightly from $39.8\%$ to $37.5\%$ , indicating minimal impact on performance. This slight drop can be explained by the sub-linear growth in unique tokens as text length increases and the high sparsity of the representations, where increasing activations has little impact on relevance. + +Comparison of in-training retrieval. We compared in-training retrieval across different systems, as shown in Table 5. Compared to BM25, $\mathrm{S i D R}_{\beta}$ has up to $30\mathrm{x}$ lower latency when using GPU resources for large corpora. In contrast to dense retrieval methods like DPR, $\mathrm{S i D R}_{\beta}$ requires less GPU allocation and uses a fixed index, which eliminates the need for periodic re-indexing during the training loop and ensures that + +Table 5: In-training retrieval latency per batch, with the storage size and GPU memory allocation for corresponding index. + +
MethodLatencyStorageGPU
BM253s2.3GB/
DPR<1ms31.5GB31GB
S1DRβ<1ms2.7GB10GB
+ +the training objective is not compromised by a stale index. Additional details can be found in Appendix C. + +# 7 RELATED WORK + +Disentangled Retrieval Disentangled retrieval, also known as sparse lexical retrieval, develops sparse representations for queries and documents within a pre-defined vocabulary space, where each dimension reflecting the importance of a specific token. These methods have proven effective in text matching (Dai & Callan, 2020; Bai et al., 2020; Formal et al., 2021b; 2022; Ram et al., 2022) and have been utilized to enhance search efficiency in subsequent studies (Gao et al., 2021a; Shen et al., 2022; Lin et al., 2023b; Lin & Lin, 2023). Notably, several works like TILDE (Zhuang & Zuccon, 2021b;a), and SPARTA (Zhao et al., 2021) use bag-of-tokens query representations for efficient online query processing. These methods fall under the category of semi-parametric retrieval as they employ non-parametric representations on the query side. Complementing these efforts, our work focuses on addressing the challenges associated with the index side, which is inherently more complex due to the greater length and contextual depth of documents. We discuss the taxonomy of neural retrieval in more detail in Appendix A. + +In-training Retrieval Retrieving data in the training loop of retrieval models is an emerging yet challenging practice that serves several critical purposes. This includes acquiring negative samples for contrastive learning (Zhan et al., 2021; Robinson et al., 2021), sourcing relevant instances for data augmentation (Blattmann et al., 2022; Shi et al., 2023), and facilitating the training of retrieval-based language models (Asai et al., 2023) in an end-to-end manner. However, this process is complicated due to the need for frequent re-indexing of the corpus as the training of the retriever progresses. Recent research has explored strategies like asynchronous index updates (Guu et al., 2020; Xiong et al., 2020; Izacard et al., 2022b; Shi et al., 2023) or building temporary indexes on-the-fly from the current training batch (Zhong et al., 2022; Min et al., 2022). Our work proposes a semi-parametric framework which supports a non-parametric index, thereby avoiding these complications and streamlining the in-training retrieval practice. + +# 8 CONCLUSIONS + +In this paper, we introduce S1DR, a semi-parametric bi-encoder retrieval framework that supports both parametric and non-parametric indexes to address the emerging needs of retrieval-based applications. Unlike traditional neural retrieval methods that rely solely on embeddings as indexes, S1DR additionally incorporates a non-parametric bag-of-tokens index. The flexibility of S1DR makes it particularly well-suited for applications requiring efficient or low-cost indexing and facilitates co-training with a fixed index. + +# ACKNOWLEDGMENTS + +Lei Chen's work is partially supported by National Key Research and Development Program of China Grant No. 2023YFF0725100, National Science Foundation of China (NSFC) under Grant No. U22B2060, Guangdong-Hong Kong Technology Innovation Joint Funding Scheme Project No. 2024A0505040012, the Hong Kong RGC GRF Project 16213620, RIF Project R6020-19, AOE Project AoE/E-603/18, Theme-based project TRS T41-603/20R, CRF Project C2004-21G, Guangdong Province Science and Technology Plan Project 2023A0505030011, Guangzhou municipality big data intelligence key lab, 2023A03J0012, Hong Kong ITC ITF grants MHX/078/21 and PRP/004/22FX, Zhujiang scholar program 2021JC02X170, Microsoft Research Asia Collaborative Research Grant, HKUST-Webank joint research lab and 2023 HKUST Shenzhen-Hong Kong Collaborative Innovation Institute Green Sustainability Special Fund, from Shui On Xintiandi and the InnoSpace GBA. + +# REFERENCES + +Simran Arora, Patrick Lewis, Angela Fan, Jacob Kahn, and Christopher Ré. Reasoning over public and private data in retrieval-based systems. Transactions of the Association for Computational Linguistics, 11:902-921, 2023. +Akari Asai, Sewon Min, Zexuan Zhong, and Danqi Chen. Retrieval-based language models and applications. In Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 6: Tutorial Abstracts), pp. 41-46, 2023. +Yang Bai, Xiaoguang Li, Gang Wang, Chaoliang Zhang, Lifeng Shang, Jun Xu, Zhaowei Wang, Fangshan Wang, and Qun Liu. Sparterm: Learning term-based sparse representation for fast text retrieval. arXiv preprint arXiv:2010.00768, 2020. +Payal Bajaj, Daniel Campos, Nick Craswell, Li Deng, Jianfeng Gao, Xiaodong Liu, Rangan Majumder, Andrew McNamara, Bhaskar Mitra, Tri Nguyen, et al. Ms marco: A human generated machine reading comprehension dataset. arXiv preprint arXiv:1611.09268, 2016. +Jonathan Berant, Andrew Chou, Roy Frostig, and Percy Liang. Semantic parsing on Freebase from question-answer pairs. In Proceedings of the 2013 Conference on Empirical Methods in Natural Language Processing, pp. 1533-1544, Seattle, Washington, USA, October 2013. Association for Computational Linguistics. URL https://aclanthology.org/D13-1160. +Andreas Blattmann, Robin Rombach, Kaan Oktay, Jonas Müller, and Björn Ommer. Retrievalaugmented diffusion models. Advances in Neural Information Processing Systems, 35:15309-15324, 2022. +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. +Danqi Chen, Adam Fisch, Jason Weston, and Antoine Bordes. Reading wikipedia to answer open-domain questions. arXiv preprint arXiv:1704.00051, 2017. +Zhuyun Dai and Jamie Callan. Context-aware term weighting for first stage passage retrieval. In Proceedings of the 43rd International ACM SIGIR conference on research and development in Information Retrieval, pp. 1533-1536, 2020. +Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. arXiv preprint arXiv:1810.04805, 2018. +Manqing Dong, Feng Yuan, Lina Yao, Xiwei Xu, and Liming Zhu. Mamo: Memory-augmented meta-optimization for cold-start recommendation. In Proceedings of the 26th ACM SIGKDD international conference on knowledge discovery & data mining, pp. 688-697, 2020. +Yixing Fan, Xiaohui Xie, Yinqiong Cai, Jia Chen, Xinyu Ma, Xiangsheng Li, Ruqing Zhang, Jiafeng Guo, et al. Pre-training methods in information retrieval. Foundations and Trends® in Information Retrieval, 16(3):178-317, 2022. + +Thibault Formal, Carlos Lassance, Benjamin Piwowarski, and Stéphane Clinchant. Splade v2: Sparse lexical and expansion model for information retrieval. arXiv preprint arXiv:2109.10086, 2021a. +Thibault Formal, Benjamin Piwowarski, and Stéphane Clinchant. Splade: Sparse lexical and expansion model for first stage ranking. In Proceedings of the 44th International ACM SIGIR Conference on Research and Development in Information Retrieval, pp. 2288-2292, 2021b. +Thibault Formal, Carlos Lassance, Benjamin Piwowarski, and Stéphane Clinchant. From distillation to hard negative sampling: Making sparse neural ir models more effective. In Proceedings of the 45th International ACM SIGIR Conference on Research and Development in Information Retrieval, pp. 2353-2359, 2022. +William T Freeman, Thouis R Jones, and Egon C Pasztor. Example-based super-resolution. IEEE Computer graphics and Applications, 22(2):56-65, 2002. +Luyu Gao, Zhuyun Dai, and Jamie Callan. Coil: Revisit exact lexical match in information retrieval with contextualized inverted list. arXiv preprint arXiv:2104.07186, 2021a. +Luyu Gao, Zhuyun Dai, Tongfei Chen, Zhen Fan, Benjamin Van Durme, and Jamie Callan. Complement lexical retrieval model with semantic residual embeddings. In Advances in Information Retrieval: 43rd European Conference on IR Research, ECIR 2021, Virtual Event, March 28–April 1, 2021, Proceedings, Part I 43, pp. 146–160. Springer, 2021b. +Kelvin Guu, Kenton Lee, Zora Tung, Panupong Pasupat, and Mingwei Chang. Retrieval augmented language model pre-training. In International conference on machine learning, pp. 3929-3938. PMLR, 2020. +Jie Huang, Hanyin Shao, and Kevin Chen-Chuan Chang. Are large pre-trained language models leaking your personal information? arXiv preprint arXiv:2205.12628, 2022. +Gautier Izacard, Mathilde Caron, Lucas Hosseini, Sebastian Riedel, Piotr Bojanowski, Armand Joulin, and Edouard Grave. Unsupervised dense information retrieval with contrastive learning. arXiv preprint arXiv:2112.09118, 2021. +Gautier Izacard, Patrick Lewis, Maria Lomeli, Lucas Hosseini, Fabio Petroni, Timo Schick, Jane Dwivedi-Yu, Armand Joulin, Sebastian Riedel, and Edouard Grave. Atlas: Few-shot learning with retrieval augmented language models. arXiv preprint arXiv:2208.03299, 2022a. +Gautier Izacard, Patrick Lewis, Maria Lomeli, Lucas Hosseini, Fabio Petroni, Timo Schick, Jane Dwivedi-Yu, Armand Joulin, Sebastian Riedel, and Edouard Grave. Few-shot learning with retrieval augmented language models. arXiv preprint arXiv:2208.03299, 2022b. +Ashish Jaiswal, Ashwin Ramesh Babu, Mohammad Zaki Zadeh, Debapriya Banerjee, and Fillia Makedon. A survey on contrastive self-supervised learning. Technologies, 9(1):2, 2020. +Ziwei Ji, Nayeon Lee, Rita Frieske, Tiezheng Yu, Dan Su, Yan Xu, Etsuko Ishii, Ye Jin Bang, Andrea Madotto, and Pascale Fung. Survey of hallucination in natural language generation. ACM Computing Surveys, 55(12):1-38, 2023. +Mandar Joshi, Eunsol Choi, Daniel 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 (Volume 1: Long Papers), pp. 1601-1611, Vancouver, Canada, July 2017. Association for Computational Linguistics. doi: 10.18653/v1/P17-1147. URL https://aclanthology.org/P17-1147. +Vladimir Karpukhin, Barlas Oguz, Sewon Min, Patrick Lewis, Ledell Wu, Sergey Edunov, Danqi Chen, and Wen-tau Yih. Dense passage retrieval for open-domain question answering. In Bonnie Webber, Trevor Cohn, Yulan He, and Yang Liu (eds.), Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pp. 6769-6781, Online, November 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020.emnlp-main.550. URL https://aclanthology.org/2020.emnlp-main.550. +Oleksandr Kolomiyets and Marie-Francine Moens. A survey on question answering technology from an information retrieval perspective. Information Sciences, 181(24):5412-5434, 2011. + +Tom Kwiatkowski, Jennimaria Palomaki, Olivia Redfield, Michael Collins, Ankur Parikh, Chris Alberti, Danielle Epstein, Illia Polosukhin, Jacob Devlin, Kenton Lee, et al. Natural questions: a benchmark for question answering research. Transactions of the Association for Computational Linguistics, 7:453-466, 2019. +Jurek Leonhardt, Koustav Rudra, Megha Khosla, Abhijit Anand, and Avishek Anand. Efficient neural ranking using forward indexes. In Proceedings of the ACM Web Conference 2022, pp. 266-276, 2022. +Jimmy Lin and Xueguang Ma. A few brief notes on deepimpact, coil, and a conceptual framework for information retrieval techniques. arXiv preprint arXiv:2106.14807, 2021. +Jimmy Lin, Xueguang Ma, Sheng-Chieh Lin, Jheng-Hong Yang, Ronak Pradeep, and Rodrigo Nogueira. Pyserini: A python toolkit for reproducible information retrieval research with sparse and dense representations. In Proceedings of the 44th International ACM SIGIR Conference on Research and Development in Information Retrieval, pp. 2356-2362, 2021. +Sheng-Chieh Lin and Jimmy Lin. A dense representation framework for lexical and semantic matching. ACM Transactions on Information Systems, 41(4):1-29, 2023. +Sheng-Chieh Lin, Akari Asai, Minghan Li, Barlas Oguz, Jimmy Lin, Yashar Mehdad, Wen-tau Yih, and Xilun Chen. How to train your dragon: Diverse augmentation towards generalizable dense retrieval. arXiv preprint arXiv:2302.07452, 2023a. +Sheng-Chieh Lin, Minghan Li, and Jimmy Lin. Aggretriever: A simple approach to aggregate textual representations for robust dense passage retrieval. Transactions of the Association for Computational Linguistics, 11:436-452, 2023b. +Nelson F Liu, Kevin Lin, John Hewitt, Ashwin Paranjape, Michele Bevilacqua, Fabio Petroni, and Percy Liang. Lost in the middle: How language models use long contexts. Transactions of the Association for Computational Linguistics, 12:157-173, 2024a. +Xiao-Yang Liu, Guoxuan Wang, and Daochen Zha. Fingpt: Democratizing internet-scale data for financial large language models. arXiv preprint arXiv:2307.10485, 2023. +Zihan Liu, Wei Ping, Rajarshi Roy, Peng Xu, Chankyu Lee, Mohammad Shoeybi, and Bryan Catanzaro. Chatqa: Surpassing gpt-4 on conversational qa and rag. arXiv preprint arXiv:2401.10225, 2024b. +Alexander Long, Wei Yin, Thalaiyasingam Ajanthan, Vu Nguyen, Pulak Purkait, Ravi Garg, Alan Blair, Chunhua Shen, and Anton van den Hengel. Retrieval augmented classification for long-tail visual recognition. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 6959-6969, 2022. +Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization. In International Conference on Learning Representations, 2018. +Xueguang Ma, Liang Wang, Nan Yang, Furu Wei, and Jimmy Lin. Fine-tuning llama for multi-stage text retrieval. arXiv preprint arXiv:2310.08319, 2023. +Christopher D Manning. An introduction to information retrieval. Cambridge university press, 2009. +Ahtsham Manzoor and Dietmar Jannach. Towards retrieval-based conversational recommendation. Information Systems, 109:102083, 2022. +Grégoire Mialon, Roberto Dessi, Maria Lomeli, Christoforos Nalmpantis, Ram Pasunuru, Roberta Raileanu, Baptiste Rozière, Timo Schick, Jane Dwivedi-Yu, Asli Celikyilmaz, et al. Augmented language models: a survey. arXiv preprint arXiv:2302.07842, 2023. +Sewon Min, Weijia Shi, Mike Lewis, Xilun Chen, Wen-tau Yih, Hannaneh Hajishirzi, and Luke Zettlemoyer. Nonparametric masked language modeling. arXiv preprint arXiv:2212.01349, 2022. +Sewon Min, Suchin Gururangan, Eric Wallace, Hannaneh Hajishirzi, Noah A Smith, and Luke Zettlemoyer. Silo language models: Isolating legal risk in a nonparametric datastore. arXiv preprint arXiv:2308.04430, 2023. + +Jianmo Ni, Chen Qu, Jing Lu, Zhuyun Dai, Gustavo Hernández Ábrego, Ji Ma, Vincent Y Zhao, Yi Luan, Keith B Hall, Ming-Wei Chang, et al. Large dual encoders are generalizable retrievers. arXiv preprint arXiv:2112.07899, 2021. +Ori Ram, Liat Bezalel, Adi Zicher, Yonatan Belinkov, Jonathan Berant, and Amir Globerson. What are you token about? dense retrieval as distributions over the vocabulary. arXiv preprint arXiv:2212.10380, 2022. +Juan Ramos et al. Using tfidf to determine word relevance in document queries. In Proceedings of the first instructional conference on machine learning, volume 242, pp. 29-48. CiteSeer, 2003. +Stephen Robertson, Hugo Zaragoza, et al. The probabilistic relevance framework: Bm25 and beyond. Foundations and Trends® in Information Retrieval, 3(4):333-389, 2009. +Joshua David Robinson, Ching-Yao Chuang, Suvrit Sra, and Stefanie Jegelka. Contrastive learning with hard negative samples. In International Conference on Learning Representations, 2021. URL https://openreview.net/forum?id=CR1XOQ0UTh-. +Rulin Shao, Jacqueline He, Akari Asai, Weijia Shi, Tim Dettmers, Sewon Min, Luke Zettlemoyer, and Pang Wei Koh. Scaling retrieval-based language models with a trillion-token datastore. arXiv preprint arXiv:2407.12854, 2024. +Tao Shen, Xiubo Geng, Chongyang Tao, Can Xu, Xiaolong Huang, Binxing Jiao, Linjun Yang, and Daxin Jiang. Lexmae: Lexicon-bottlenecked pretraining for large-scale retrieval. arXiv preprint arXiv:2208.14754, 2022. +Weijia Shi, Sewon Min, Michihiro Yasunaga, Minjoon Seo, Rich James, Mike Lewis, Luke Zettle-moyer, and Wen-tau Yih. Replug: Retrieval-augmented black-box language models. arXiv preprint arXiv:2301.12652, 2023. +Kurt Shuster, Spencer Poff, Moya Chen, Douwe Kiela, and Jason Weston. Retrieval augmentation reduces hallucination in conversation. arXiv preprint arXiv:2104.07567, 2021. +Nandan Thakur, Nils Reimers, Andreas Rückle, Abhishek Srivastava, and Iryna Gurevych. Beir: A heterogeneous benchmark for zero-shot evaluation of information retrieval models. In Thirty-fifth Conference on Neural Information Processing Systems Datasets and Benchmarks Track (Round 2), 2021. +Cunxiang Wang, Xiaoze Liu, Yuanhao Yue, Xiangru Tang, Tianhang Zhang, Cheng Jiayang, Yunzhi Yao, Wenyang Gao, Xuming Hu, Zehan Qi, et al. Survey on factuality in large language models: Knowledge, retrieval and domain-specificity. arXiv preprint arXiv:2310.07521, 2023. +Lei Wang, Chen Ma, Xueyang Feng, Zeyu Zhang, Hao Yang, Jingsen Zhang, Zhiyuan Chen, Jiakai Tang, Xu Chen, Yankai Lin, et al. A survey on large language model based autonomous agents. Frontiers of Computer Science, 18(6):1-26, 2024. +Liang Wang, Nan Yang, Xiaolong Huang, Binxing Jiao, Linjun Yang, Daxin Jiang, Rangan Majumder, and Furu Wei. Text embeddings by weakly-supervised contrastive pre-training. arXiv preprint arXiv:2212.03533, 2022. +Lee Xiong, Chenyan Xiong, Ye Li, Kwok-Fung Tang, Jialin Liu, Paul Bennett, Junaid Ahmed, and Arnold Overwijk. Approximate nearest neighbor negative contrastive learning for dense text retrieval. arXiv preprint arXiv:2007.00808, 2020. +Ikuya Yamada, Akari Asai, and Hannaneh Hajishirzi. Efficient passage retrieval with hashing for open-domain question answering. arXiv preprint arXiv:2106.00882, 2021. +Wenhao Yu, Chenguang Zhu, Zaitang Li, Zhiting Hu, Qingyun Wang, Heng Ji, and Meng Jiang. A survey of knowledge-enhanced text generation. ACM Computing Surveys, 54(11s):1-38, 2022. +Jingtao Zhan, Jiaxin Mao, Yiqun Liu, Jiafeng Guo, Min Zhang, and Shaoping Ma. Optimizing dense retrieval model training with hard negatives. In Proceedings of the 44th International ACM SIGIR Conference on Research and Development in Information Retrieval, pp. 1503-1512, 2021. + +Yue Zhang, Yafu Li, Leyang Cui, Deng Cai, Lemao Liu, Tingchen Fu, Xinting Huang, Enbo Zhao, Yu Zhang, Yulong Chen, et al. Siren's song in the ai ocean: A survey on hallucination in large language models. arXiv preprint arXiv:2309.01219, 2023. +Tiancheng Zhao, Xiaopeng Lu, and Kyusong Lee. Sparta: Efficient open-domain question answering via sparse transformer matching retrieval. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pp. 565-575, 2021. +Zexuan Zhong, Tao Lei, and Danqi Chen. Training language models with memory augmentation. In Yoav Goldberg, Zornitsa Kozareva, and Yue Zhang (eds.), Proceedings of the 2022 Conference on Empirical Methods in Natural Language Processing, Abu Dhabi, United Arab Emirates, December 2022. Association for Computational Linguistics. doi: 10.18653/v1/2022.emnlp-main.382. URL https://aclanthology.org/2022.emnlp-main.382. +Jiawei Zhou, Xiaoguang Li, Lifeng Shang, Lan Luo, Ke Zhan, Enrui Hu, Xinyu Zhang, Hao Jiang, Zhao Cao, Fan Yu, et al. Hyperlink-induced pre-training for passage retrieval in open-domain question answering. arXiv preprint arXiv:2203.06942, 2022. +Jiawei Zhou, Xiaoguang Li, Lifeng Shang, Xin Jiang, Qun Liu, and Lei Chen. Retrieval-based disentangled representation learning with natural language supervision. In The Twelfth International Conference on Learning Representations, 2024. URL https://openreview.net/forum?id=ZlQRiFmq7Y. +Fengbin Zhu, Wenqiang Lei, Chao Wang, Jianming Zheng, Soujanya Poria, and Tat-Seng Chua. Retrieving and reading: A comprehensive survey on open-domain question answering. arXiv preprint arXiv:2101.00774, 2021. +Yutao Zhu, Huaying Yuan, Shuting Wang, Jiongnan Liu, Wenhan Liu, Chenlong Deng, Zhicheng Dou, and Ji-Rong Wen. Large language models for information retrieval: A survey. arXiv preprint arXiv:2308.07107, 2023. +Shengyao Zhuang and Guido Zuccon. Fast passage re-ranking with contextualized exact term matching and efficient passage expansion. arXiv preprint arXiv:2108.08513, 2021a. +Shengyao Zhuang and Guido Zuccon. Tilde: Term independent likelihood model for passage re-ranking. In Proceedings of the 44th International ACM SIGIR Conference on Research and Development in Information Retrieval, pp. 1483-1492, 2021b. + +# A TAXONOMY OF NEURAL RETRIEVAL + +In this section, we outline the taxonomy of existing neural retrievers, discussing distinctions such as disentangled versus entangled, dense versus sparse, and parametric versus semi-parametric. This classification aims to clarify the concepts discussed throughout our paper. + +Entangled vs. Disentangled Retriever differ in the type of representations they use for search: + +- Entangled retriever typically employs latent representations with dimensions such as 512, 768, 1024, or 2048 for inner-product search. These representations can be learned flexibly and effectively without prior knowledge, as they are entangled. An entangled retriever can also use sparse latent representations, such as the BPR method (Yamada et al., 2021), which employs a learned hash function on a 768-dimensional latent vector for efficient searching. +- Disentangled retriever, on the other hand, utilizes disentangled representations with much larger dimensionality, spanning from tens of thousands, representing the language model's vocabulary, to millions, typical of BM25 vocabulary. Each dimension corresponds to the importance of a specific token within the vocabulary. Disentangled retrieval methods rely on disentangled representations as a prior, which leads to desirable properties such as interpretability, controllability, robustness, and, as discussed in this paper, accelerated indexing. Previous work (Zhou et al., 2024; Formal et al., 2021a; Shen et al., 2022) has also suggested that using disentangled representations improves embedding quality, as foundational models are optimized in this disentangled representation space to predict mask tokens or next tokens, rather than in the entangled representation space. Note + +that disentangled retrievers can also use dense (fully activated) representations. For example, VDR (Zhou et al., 2024) utilizes disentangled representations that can be fully activated for search. + +Thus, the classification of entangled vs. disentangled is independent of whether the representation is dense or sparse. Generally, entangled retrieval methods tend to use dense representations, while disentangled retrieval methods often use sparse ones, but this is not a strict requirement. + +Dense vs. Sparse Retriever differ based on whether their representations are fully activated or have been sparsified. Typically, entangled representations are fully activated, while disentangled representations are often sparsified to reduce storage size and to facilitate the construction of an inverted index for efficient searching. Consequently, dense retrieval is commonly associated with entangled representations and sparse retrieval with disentangled ones. However, the relationship between entangled/disentangled and dense/sparse retrieval is not rigid. Exceptions exist where entangled representations can be sparsified (Yamada et al., 2021) and disentangled representations can be fully activated (Zhou et al., 2024). + +Full Parametric vs. Semi-parametric Retrieval These approaches differ based on the utilization of neural parameters for encoders. Full parametric retrieval systems employ neural parameters for both encoders. In contrast, semi-parametric retrieval systems use one neural encoder alongside one non-parametric encoder, typically involving tokenization-based representations. To our knowledge, existing semi-parametric systems predominantly engage in disentangled retrieval, as they all utilize tokenization-based non-parametric representations that operate on a vocabulary space. Notable examples include TILDE (Zhuang & Zuccon, 2021b), TILDE-v2 (Zhuang & Zuccon, 2021a), and SPARTA (Zhao et al., 2021), which implement tokenization-based representations on the query side for efficient online query processing. Our work, S1DR, represents a unique approach within this category, offering semi-parametric retrieval that utilizes binary bag-of-tokens representations on the index side for emerging scenarios. + +# B DETAILS OF LATENCY EVALUATION + +During the indexing stage, $E_{\theta}$ and $T$ operate with a batch size of 32 and a maximum text length of 256. In the search stage, the computation of $\mathrm{f}(q,\mathcal{D})$ includes both inner product calculation and sorting of the top- $k$ passages. Queries are processed in batches of 32, with passage embeddings stored in either CPU or GPU memory using half-precision floating-point (FP16) to optimize memory usage. Our analysis excludes the time spent on I/O and data type conversion between CPU and GPU, assuming sufficient processing resources are available. + +For BM25, we utilize Pyserini (Lin et al., 2021), a library based on a Java implementation developed around Lucene. For neural retrieval, our implementation is in Python, leveraging PyTorch's sparse module1 for efficient inner product computation, without building an inverted index. Timing measurements are performed by running each operation 10 times and reporting the average after excluding the maximum and minimum values. To avoid out-of-memory issues on our devices, we perform searches in batches on a 1-million document corpus and accumulate the latencies. Note that inverted indexes rely heavily on memory access and integer operations, which are generally inefficient on GPU architectures. + +# C IN-TRAINING RETRIEVAL DETAILS + +We conducted a simulation test to evaluate factors affecting in-training retrieval, summarized in Table 6. Initially, we built a binary token index with dimensions of $30\mathrm{k}$ and a sample size of $500\mathrm{m}$ , where each vector consists of 256 dimensional activated. We then varied the density of passage representations by adjusting the activation number from 256 to 512 and 1024. As the activation number increased, storage and GPU alloca + +
Latency (ms)Storage (GB)GPU (GB)
Index Density
a=2560.202.86.9
a=5120.214.923.5
a=10240.219.046.7
Query Batch Size
bs=320.20//
bs=1280.21//
bs=5120.24//
+ +Table 6: Retrieval latency, index storage size, and GPU allocation for $\mathrm{SIDR}_{\beta}$ . + +tion also increased, while latency remained largely unchanged. Additionally, we found query batch size had minimal impact on latency. + +# D ANALYSIS ON TERM WEIGHTING AND EXPANSION + +To systematically compare our method with BM25, we control for vocabulary differences by using BM25 with the same BERT-base-uncased vocabulary as ours. This ensures both methods share the same dimensionality for sparse representation, differing only in two key aspects: + +- Term expansion: BM25 uses only lexical tokens, while SiDR allows for term expansion. +- Term weighting: BM25 relies on statistical-based term weights, whereas SiDR learns contextualized weights. + +In this section, we empirically demonstrate how these factors – term expansion and term weighting – affect the outcome. Below, we introduce two additional representation forms: + +Lexical Parametric Representation $V_{\theta}^{lex}(x)$ This representation activates only the lexical tokens present in the input text $x$ . It leverages learned term weights but does not permit term expansion: + +$$ +V _ {\theta} ^ {l e x} (x) = V _ {\mathrm {B o T}} \circ V _ {\theta} (x) +$$ + +Binary Parametric Representation $V_{\theta}^{bin}(x)$ This representation activates the same number of tokens but assigns uniform weights (set to one), removing learned scalar term weighting. It allows term expansion but does not apply term weights: + +$$ +V _ {\theta} ^ {b i n} (x) = \operatorname {B i n a r i z e} \circ V _ {\theta} (x) +$$ + +where Binarize is a function mapping non-zero values to one. + +To independently assess the impact of term expansion and term weighting, we propose several variants of $\mathrm{SiDR}_{\mathrm{full}}$ : $\mathrm{SiDR}_{\mathrm{full}}$ (w/o weight at doc) and $\mathrm{SiDR}_{\mathrm{full}}$ (w/o expand at doc), which utilize $V_{\theta}^{\mathrm{bin}}(p)$ and $V_{\theta}^{\mathrm{lex}}(p)$ on the document side during inference. Additionally, we introduce variants of $\mathrm{SiDR}_{\beta}$ : $\mathrm{SiDR}_{\beta}$ (w/o weight at query) and $\mathrm{SiDR}_{\beta}$ (w/o expand at query), which employ $V_{\theta}^{\mathrm{bin}}(q)$ and $V_{\theta}^{\mathrm{lex}}(q)$ on the query side at inference. Furthermore, we propose $\mathrm{SiDR}_{\mathrm{full}}$ (w/o expand at doc, training), which is trained with $V_{\theta}(p)$ replaced by $V_{\theta}^{\mathrm{lex}}(p)$ to ensure consistency between training and inference phases. All these models are compared against BM25 that utilizes the same bert-base-uncased tokenization and vocabulary. This controls for vocabulary differences, isolating the effects of term selection and term weighting. We also include an extreme baseline that uses a bag-of-tokens representation for both the query and the passage, referred to as BoT overlap. + +Table 7: Ablation study on learned term weighting and term expansion, with results reported as top-1 accuracy on NQ test splits. + +
ModelQueryDocumentAccuracy
ExpandWeightExpandWeight
BM25 (bert-base-uncased)×✓×✓21.9
Ablation of SiDRfull on doc side
SiDRfull✓✓49.1
SiDRfull (w/o weight at doc)✓×33.1
SiDRfull (w/o expand at doc)✓✓×✓38.9
SiDRfull (w/o expand at doc, training)×✓43.1
SiDRbeta××39.8
Ablation of SiDRbeta on query side
SiDRbeta (w/o weight at query)✓×14.5
SiDRbeta (w/o expand at query)×✓××34.3
BoT overlap××14.2
+ +When using a parametric index, we conduct an ablation study on $\mathrm{SiDR}_{\mathrm{full}}$ to assess the impact of removing term weighting and term expansion on the document side. From top to bottom, we + +systematically remove term weight or expansion, simplifying the index of $\mathrm{SiDR}_{\mathrm{full}}$ to assess their individual contributions. Our results indicate that removing either term weight or term expansion leads to worse outcomes than removing both (i.e., $\mathrm{SiDR}_{\beta}$ ). This is because our training objective is specifically designed to align query embeddings with the BoT index, rather than these variations. Furthermore, we find that if the training is adjusted to accommodate these variations, such as document representations without term expansion, these variations can outperform the BoT index. This demonstrates that neural bi-encoders have great learning potential, with improvement stemming from not only the training itself but also how well the training aligns with inference. + +When using a bag-of-tokens index, we assess the impact of term weight and expansion on the query side. Starting from a baseline uses unweighted term overlap, referred to as "BoT overlap", applying BM25's term weights to both queries and documents yields a $7.7\%$ improvement. In comparison, our method's learned query term weights achieve a $20.1\%$ improvement, while learned term expansion provides minimal additional gain. Combining term weights and expansion on the query side results in a $25.6\%$ improvement, which is $\mathrm{SiDR}_{\beta}$ . + +In conclusion, when using an embedding index, we demonstrate that both learned term weighting and term expansion on the document side are crucial. Conversely, when using a bag-of-tokens index, the improvements primarily come from term weighting on the query side rather than expansion. Furthermore, ensuring consistency between training and inference representations is essential. A parametric index can underperform compared to non-parametric ones if the representations used during inference do not align with those used during training. + +# E COST-EFFECTIVENESS ANALYSIS + +Table 8: Additional late-parametric baselines and cost-effectiveness analysis performed on a retrieval task using 3.6k NQ test queries across a 21 million Wikipedia corpus. Costs are determined by the number of text chunks (including both queries and passages) that require embedding by neural encoders. Parentheses indicate the ratio of text chunks embedded to the total retrieval corpus. + +
PerformanceCost
Non-parametric Index
BM2522.70
S1DRβ39.83.6k (0.01%)
Late-parametric with top-100 rerank
BM25 + VDR41.6364k (1.73%)
BM25 + SiDR44.0364k (1.73%)
BM25 + Contriever39.3364k (1.73%)
BM25 + E5base50.4364k (1.73%)
SiDRβ (m=100)50.3364k (1.73%)
S1DRβ + VDR43.2367k (1.74%)
S1DRβ + Contriever42.9367k (1.74%)
S1DRβ + E5base57.7367k (1.74%)
Parametric Index
S1DRfull49.121m (100.01%)
Contriever41.521m (100.01%)
E5base57.921m (100.01%)
+ +Late parametric retrieval aims to provide a quick-start and low-cost search initialization through a non-parametric index, while simultaneously building a parametric index during the search service, eventually transitioning to a fully parametric index for searching. To fulfill this requirement, the first-stage utilizes a retriever that supports a non-parametric index, while the second-stage retriever can be any parametric bi-encoder. This method can be seen as a subset of hybrid retrieval systems (Leonhardt et al., 2022; Gao et al., 2021b), with specific choices constrained to the two stages. + +We introduce various combinations of BM25 and $\mathrm{SiDR}_{\beta}$ as the first-stage retriever, paired with more advanced retrievers in the second stage to demonstrate their effectiveness. The results of these combinations are presented in Table 8. Moreover, we assess the cost-effectiveness of these frameworks, particularly in scenarios where raw data has not been indexed. In such cases, the primary cost arises from the neural model's forward pass for text embedding. Therefore, we measure cost by counting the number of text chunks (both query and passage) that require embedding. + +For BM25, no neural embedding is required. While $\mathrm{SiDR}_{\beta}$ employs a bag-of-tokens index, waiving the indexing cost, it requires embedding 3.6k queries (0.01% of the corpus) to complete the retrieval task. Despite this, it offers a significant performance improvement of $17.1\%$ in accuracy over BM25. For various late parametric baselines, an additional embedding of 100 passages per query is needed — approximately $1.7\%$ of the corpus — yet this results in further improvements over BM25. Conversely, the conventional retrieval pipeline, which requires embedding the entire corpus to achieve performance comparable to that of late parametric models with top-100 reranking. This analysis shows that semi-parametric models provide a more cost-effective solution by balancing retrieval performance with computational efficiency. + +Among various late-parametric baselines, $\mathrm{SiDR}_{\beta}$ consistently outperforms BM25 as the first-stage retriever. However, this advantage requires embedding an additional 3.6k queries if other models are employed as the second-stage retriever. In exploring second-stage retrievers, we have tested state-of-the-art models like E5 and Contriever. Our results indicate that stronger retrievers lead to better overall late-parametric performance. Notably, in all our tests, $\mathrm{SiDR}_{\beta}$ combined with any second-stage model consistently outperforms BM25 paired with the same model. Furthermore, when $\mathrm{SiDR}_{\beta}$ serves as the first-stage retriever and re-ranks the top-100 passages, its performance is comparable to, and often exceeds, that of full parametric search with these retrievers. \ No newline at end of file diff --git a/ICLR/2025/Semi-Parametric Retrieval via Binary Bag-of-Tokens Index/images.zip b/ICLR/2025/Semi-Parametric Retrieval via Binary Bag-of-Tokens Index/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..9ba1b47d3a721ef7ef36c3cc9963bd6dd046b1b5 --- /dev/null +++ b/ICLR/2025/Semi-Parametric Retrieval via Binary Bag-of-Tokens Index/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6077902e3f6c34bc4e6690e61faf64fe0fa5c8750d6dfc5c35cfc32222a185f6 +size 585019 diff --git a/ICLR/2025/Semi-Parametric Retrieval via Binary Bag-of-Tokens Index/layout.json b/ICLR/2025/Semi-Parametric Retrieval via Binary Bag-of-Tokens Index/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..320fcebda50c52108dcad0a159aa04c0aef41cf8 --- /dev/null +++ b/ICLR/2025/Semi-Parametric Retrieval via Binary Bag-of-Tokens Index/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5eebf6a6f07b458d02ffbf296a16f175658020fb0c3e8d36cddd0a2b3be8ca10 +size 600189 diff --git a/ICLR/2025/Semi-Supervised CLIP Adaptation by Enforcing Semantic and Trapezoidal Consistency/d661ff34-1912-43de-b967-f82f47c5b127_content_list.json b/ICLR/2025/Semi-Supervised CLIP Adaptation by Enforcing Semantic and Trapezoidal Consistency/d661ff34-1912-43de-b967-f82f47c5b127_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..545119c276230d5ff62c353f4908835fd97dfae4 --- /dev/null +++ b/ICLR/2025/Semi-Supervised CLIP Adaptation by Enforcing Semantic and Trapezoidal Consistency/d661ff34-1912-43de-b967-f82f47c5b127_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:88c60b19eb22cc4f7f43d2f2aa221934bfbfe1295baea3fb9b9d59230bae52d8 +size 147148 diff --git a/ICLR/2025/Semi-Supervised CLIP Adaptation by Enforcing Semantic and Trapezoidal Consistency/d661ff34-1912-43de-b967-f82f47c5b127_model.json b/ICLR/2025/Semi-Supervised CLIP Adaptation by Enforcing Semantic and Trapezoidal Consistency/d661ff34-1912-43de-b967-f82f47c5b127_model.json new file mode 100644 index 0000000000000000000000000000000000000000..de57d0244531c42e23fa26ed2088ff3519d14962 --- /dev/null +++ b/ICLR/2025/Semi-Supervised CLIP Adaptation by Enforcing Semantic and Trapezoidal Consistency/d661ff34-1912-43de-b967-f82f47c5b127_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:10c9200f7652eab9089a363d4eccc38a023de2a4ab64552afa9bc4db6e25d3f3 +size 177461 diff --git a/ICLR/2025/Semi-Supervised CLIP Adaptation by Enforcing Semantic and Trapezoidal Consistency/d661ff34-1912-43de-b967-f82f47c5b127_origin.pdf b/ICLR/2025/Semi-Supervised CLIP Adaptation by Enforcing Semantic and Trapezoidal Consistency/d661ff34-1912-43de-b967-f82f47c5b127_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..0734ee799e926f7c3e8dce089875a84cc510a2ef --- /dev/null +++ b/ICLR/2025/Semi-Supervised CLIP Adaptation by Enforcing Semantic and Trapezoidal Consistency/d661ff34-1912-43de-b967-f82f47c5b127_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f9da3bc9d2cc76ca4197c67511a8c64dd8fec8951cf2dee58837d7e09f9b1292 +size 5869949 diff --git a/ICLR/2025/Semi-Supervised CLIP Adaptation by Enforcing Semantic and Trapezoidal Consistency/full.md b/ICLR/2025/Semi-Supervised CLIP Adaptation by Enforcing Semantic and Trapezoidal Consistency/full.md new file mode 100644 index 0000000000000000000000000000000000000000..5217a943d9504c2f4badda0029637df4fe5c3ad5 --- /dev/null +++ b/ICLR/2025/Semi-Supervised CLIP Adaptation by Enforcing Semantic and Trapezoidal Consistency/full.md @@ -0,0 +1,519 @@ +# SEMI-SUPERVISED CLIP ADAPTATION BY ENFORCING SEMANTIC AND TRAPEZOIDAL CONSISTENCY + +Kai Gan Bo Ye Min-Ling Zhang Tong Wei* + +$^{1}$ School of Computer Science and Engineering, Southeast University, Nanjing 210096, China + $^{2}$ Key Laboratory of Computer Network and Information Integration (Southeast University), Ministry of Education, China + +{gank, yeb, zhangml, weit}@seu.edu.cn + +# ABSTRACT + +Vision-language pre-training models, such as CLIP, have demonstrated strong capability in rapidly adapting to downstream tasks through fine-tuning, and have been widely applied across various tasks. However, when the downstream tasks are constrained by limited image-text paired data, CLIP struggles to effectively address the domain gap between the pre-training and the target tasks. To address this limitation, we propose a novel semi-supervised CLIP adaptation method coined SEMICLIP that leverages a small amount of image-text pairs alongside a large volume of images without text descriptions to enhance CLIP's cross-modal alignment. To effectively utilize unlabeled images, we introduce semantic concept mining to improve task-specific visual representations by matching images with relevant concepts mined from labeled data. Leveraging matched semantic concepts, we construct learnable surrogate captions for unlabeled images and optimize a trapezoidal consistency to regulate the geometric structure of image-text pairs in the representation space. Experimental results demonstrate that our approach significantly improves the adaptability of CLIP in target tasks with limited labeled data, achieving gains ranging from $1.72\% - 6.58\%$ for zero-shot classification accuracy and $2.32\% - 3.23\%$ for image-text retrieval performance on standard benchmarks. The source code is available at https://github.com/Gank0078/SemiCLIP. + +# 1 INTRODUCTION + +Vision-language pre-training has emerged as a prominent learning paradigm, especially CLIP (Radford et al., 2021), which has benefited various downstream tasks (Li et al., 2021c; Yao et al., 2021; Gao et al., 2022; Li et al., 2021a; Gan & Wei, 2024; Xia et al., 2024) due to its advanced capabilities in image-text semantic representation. However, when adapting CLIP to specific domains such as remote sensing (Arampacha et al., 2021) and medical imaging (Kim et al., 2023) with limited image-text pairs, the model fails to effectively mitigate the domain gap, resulting in unsatisfactory performance. Previous research has primarily concentrated on the development of large-scale pre-training datasets for each domain (Johnson et al., 2019; Yang et al., 2020; Schuhmann et al., 2022), necessitating significant human and time resources. Fortunately, in most scenarios, capturing devices can readily obtain a substantial number of domain-relevant images, prompting us to consider whether leveraging a large volume of unlabeled images can enhance the generalization capabilities of vision-language pre-training for specific downstream tasks. + +Semi-supervised learning (SSL) is a common way to leverage unlabeled data to improve generalization performance, and remarkable progress has been made in this research field (Sohn et al., 2020; Zhang et al., 2021; Ye et al., 2024; Chen et al., 2023). However, most existing SSL methods are designed for classification tasks and cannot be directly used in vision-language pre-training. Some research has explored the use of additional tools, such as object detectors (Li et al., 2021b; Wang et al., 2023a) and large language models (Yang et al., 2023; Mirza et al., 2024), to improve the multi-modal alignment of the CLIP model in cases where the quantity of image-text pairs is constrained. Recently, S-CLIP (Mo et al., 2023) proposes generating keyword-level and caption-level pseudo-labels for unlabeled + +![](images/2a4b2dbe30cacae3330e5f963be025d58049ce1d2b42abc9713977e01675ddcc.jpg) +Image caption : +(a) + +Eight storage tanks are surrounded by green meadows. + +Predicted concepts : + +tanks, storage, lawn, meadows + +Image caption : + +"Blue seriously stretchy dark wash mid-rise jegging." + +Predicted concepts : + +denim, jeggings, skinny, knee + +![](images/4e4d6cdc988319155b7d4c9291fd9a75f9f194e41c62e77e2edd99aff10328fb.jpg) +(b) +Figure 1: (1a) Relevant concepts predicted by the proposed semantic concepts mining module for unlabeled images. Notably, the true captions are missing in practice, and are placed in the figure merely as a reference; (1b) Illustration of our proposed trapezoidal consistency regularization. A learnable surrogate caption is constructed for each unlabeled image based on mined concepts. + +images to enable semi-supervised CLIP adaptation. The core idea is that the true caption of unlabeled images can be linearly reconstructed from the captions of labeled data within the same mini-batch. Although S-CLIP achieves significant performance improvements compared to the original CLIP, it can only leverage the relational information within the mini-batch and is still unable to make the most effective use of all the labeled data, resulting in unsatisfactory performance in real-world scenarios. + +This paper proposes a novel semi-supervised CLIP adaptation method, SEMICLIP. For semi-supervised CLIP training, labeled and unlabeled images should share the same task domain, which suggests that a large number of common concepts can be leveraged between them. Therefore, we propose mining a candidate concept database from labeled data, and training a classifier to match images and concepts. We also generate pseudo-labels for unlabeled images using the classifier and construct learnable surrogate captions to facilitate semi-supervised training. Overall, SEMICLIP follows the "supervised pre-training, semi-supervised fine-tuning" paradigm for SSL. + +During the supervised pre-training, SEMICLIP employs a semantic concepts mining module to extract candidate concepts from labeled data and learn to associate images with the concepts via a classification loss on top of the visual representations. SEMICLIP also optimizes the image-text contrastive loss for labeled data. Once the concepts mining module is trained, we can predict relevant concepts for unlabeled images and use them as pseudo-labels to fine-tune the task-specific visual representations. As illustrated in Figure 1a, the predicted concepts demonstrate a high correlation with images, even though some concepts may not appear in the true image captions. + +During the semi-supervised fine-tuning, we propose concept-level and caption-level consistency regularization to fully exploit unlabeled images. At the concept level, for unlabeled images, we optimize the model's predictions for strongly augmented images to remain consistent with those for weakly augmented images, thereby improving the model's generalization. At the caption level, we propose trapezoidal consistency to constrain the geometric relationships between image-text pairs in the representation space. + +As illustrated in Figure 1b, image-text pairs in labeled data form the upper base of the trapezoid, while unlabeled images and their corresponding surrogate captions constitute the lower base. The proposed trapezoidal consistency first includes a contrastive loss which seeks to minimize the length (distance) of the upper base (representing accurate image-text pairs), and another two squared losses to restrict the trapezoid to have equal-length legs and diagonals. However, the length of the lower base (representing less accurate pairs) is adaptively adjusted by the model, which allows the model to maintain robust alignment for reliable pairs, while giving flexibility to handle noise in the less reliable pairs, particularly when dealing with unlabeled images. Our main contributions can be summarized as follows: + +- We propose a novel semi-supervised CLIP adaptation method, SEMICLIP, which mines candidate semantic concepts from labeled data and learns to associate images with concepts, providing a new way of using unlabeled images in vision-language pre-training. + +- We propose the trapezoidal consistency, which uses prompts-driven templates and predicted concepts to construct surrogate captions for unlabeled images, and enhances the multi-modal alignment by exploiting the geometric structure of trapezoids in the representation space. +- Extensive experimental analyses show that SEMICLIP achieves state-of-the-art zero-shot and image-text retrieval performance on multiple benchmarks across various domains, e.g., SEMICLIP improves S-CLIP by over $3.75\%$ on average in zero-shot classification tasks. + +# 2 RELATED WORKS + +Vision-language pre-training (Radford et al., 2021; Jia et al., 2021; Pham et al., 2023; Huang et al., 2023) have demonstrated remarkable success in various downstream tasks through fine-tuning. Various multiple cross-modality loss functions have been introduced as training objectives, including image-text matching (Chen et al., 2020; Li et al., 2019; Lu et al., 2019; Tan & Bansal, 2019), masked language modeling (Dong et al., 2023; Bao et al., 2022; Wang et al., 2023b), masked image modeling (Zhou et al., 2020; Xie et al., 2022), and contrastive loss (Li et al., 2021a; 2020a;b). CLIP, as one of the most representative works, aims to achieve alignment between image and text representations by learning a joint embedding. CLIP demonstrates remarkable effectiveness in tasks such as zero-shot classification (Radford et al., 2021) image-text retrieval (Luo et al., 2022), few-shot learning (Liu et al., 2022), and long-tailed learning (Shi et al., 2024). + +Semi-supervised learning aims to improve the generalization performance by leveraging unlabeled data through entropy minimization (Grandvalet & Bengio, 2004), consistency regularization (Sohn et al., 2020), distribution alignment (Kim et al., 2020), and contrastive learning (Lee et al., 2022; Yang et al., 2022). Most of these methods focus on selecting reliable pseudo-labels throughout the training process. In particular, FixMatch (Sohn et al., 2020) selects pseudo-labels with confidence scores greater than a predetermined threshold (e.g., 0.95). However, for SSL problems in vision-language pre-training, the above methods cannot be directly applied due to the unique caption for each image. SEMICLIP mines semantic concepts from image captions in labeled data to construct "pseudo-labels" for unlabeled images, and the pseudo-label selection and consistency regularization can be applied. + +Training CLIP with limited image-text pairs has gained substantial attention for adapting CLIP to downstream tasks. For example, MedCLIP (Wang et al., 2022) replaces the InfoNCE loss (Oord et al., 2018) with a semantic matching loss grounded in medical knowledge to mitigate false negatives in contrastive learning. WFH (Wang et al., 2023a) generates visual hallucinations from textual inputs, which are subsequently paired with originally unpaired texts, facilitating more diverse interactions across modalities. SimVLM (Wang et al., 2021b) is trained with a prefix language modeling objective through exploiting large-scale weak supervision. However, these methods rely on additional information or models, such as class labels, pre-trained object detectors, and large language models. The method most related to our work is S-CLIP (Mo et al., 2023), which assigns pseudo-labels for unlabeled images by assuming that the true captions can be recovered by combining image captions in labeled data. Nevertheless, the performance of S-CLIP is far from satisfactory on large-scale datasets because S-CLIP finds the nearest neighbors of each unlabeled image within the current mini-batch to construct the caption, while the labeled data outside the batch is not effectively utilized. + +# 3 SEMICLIP: TOWARDS SEMI-SUPERVISED CLIP ADAPTATION + +In this section, we present the SEMICLIP approach which consists of three key modules, i.e., semantic concepts mining, concept-level semantic consistency, and caption-level trapezoidal consistency. + +# 3.1 PRELIMINARIES + +In general vision-language tasks (Radford et al., 2021; Jia et al., 2021), it is common to assume that there exists abundant paired images and texts $\mathcal{D}^l = \{(I_i,T_i)\}_{i = 1}^N$ for contrastive learning. However, in realistic scenarios, images can be readily captured, whereas obtaining the corresponding captions entails significant costs. Usually, we can access a substantial number of unlabeled images $\mathcal{D}^u = \{I_j\}_{j = 1}^M$ without captions, where $M\gg N$ . The most popular vision-language model CLIP (Radford et al., 2021) learns a joint embedding space that establishes a connection between images $I_{i}$ and texts $T_{i}$ . The training objective of CLIP is to maximize the cosine similarity between the embeddings of matching image-text pairs while minimizing the similarity between non-matching + +pairs. Specifically, CLIP consists of a visual encoder $f_{I}(\cdot)$ and a text encoder $f_{T}(\cdot)$ , so it can generate embeddings $I_{i}^{e} = f_{I}(I_{i})$ for images and $T_{i}^{e} = f_{T}(T_{i})$ for texts. Then the embeddings are normalized to the unit hypersphere. Specifically, the CLIP loss takes the following form: + +$$ +\mathcal {L} _ {\mathrm {C L I P}} = - \frac {1}{2 N} \sum_ {i = 1} ^ {N} \log \frac {\exp \left(\left\langle I _ {i} ^ {e} , T _ {i} ^ {e} \right\rangle / \tau\right)}{\sum_ {t = 1} ^ {N} \exp \left(\left\langle I _ {i} ^ {e} , T _ {t} ^ {e} \right\rangle / \tau\right)} + \log \frac {\exp \left(\left\langle I _ {i} ^ {e} , T _ {i} ^ {e} \right\rangle / \tau\right)}{\sum_ {t = 1} ^ {N} \exp \left(\left\langle I _ {t} ^ {e} , T _ {i} ^ {e} \right\rangle / \tau\right)} \tag {1} +$$ + +where $\langle \cdot, \cdot \rangle$ represents the cosine similarity for normalized embeddings and $\tau$ is a temperature scalar which is simply set to 1 in our experiments. After pre-training, CLIP can perform zero-shot classification by encoding class names as text with appropriate templates (e.g., "a photo of a {class name}") and computing the similarities between the test image embedding and each class embedding. CLIP predicts the class associated with the highest image-text similarity. + +# 3.2 SEMANTIC CONCEPTS MINING + +During the supervised pre-training, SEMICLIP performs Semantic Concepts Mining (SCM), which consists of mining semantic concepts from the available captions and leveraging labeled data for CLIP adaptation. Despite the limited information contained within the texts, it is highly likely that the concepts it encompasses are also present in unlabeled images. Thus, we first employ NLTK (Bird et al., 2009) to extract the corresponding nouns from the captions in labeled data. Considering the potential noise associated with certain nouns, we filter nouns to ensure their frequency exceeds a threshold of $\mu$ , which is set to 5 in our experiments. However, some nouns appear excessively often such as the word "Figure" in the SciCap dataset (Hsu et al., 2021) which contains numerous scientific figures. These overly frequent nouns (occurrence rate exceeds $30\%$ ) are not beneficial for improving performance in downstream tasks. After extraction, we recognize a total of $V$ noun entities $\{C_v\}_{v=1}^V$ which are regarded concepts exist within the domain corresponding to the task, and for each captioned image $I_i$ , we can identify its multi-concepts encoding $y_{I_i} \in \{0,1\}^V$ where positions are set to 1 if the image contains the concept. Notably, an image can associate with multiple concepts, hence the label encoding $y_{I_i}$ can consist of more than one entry of 1s. + +In semi-supervised classification tasks, models trained on labeled data can generate pseudo-labels for unlabeled data, where labels are similar to the concepts defined above. We thus inquire: Can the model exploit concepts in captioned images to annotate corresponding concepts in unlabeled images? For this purpose, we train a linear classifier $\psi$ with extracted concepts. Specifically, due to the rich semantic representation capabilities of the CLIP text encoder $f_{T}(\cdot)$ , we employ the template (e.g., "a photo includes {Concept}") integrating the extracted concepts to generate hand-crafted descriptions and compute their features $I_{C_1}^e,\ldots ,I_{C_V}^e$ which are then utilized to initialize the weights in $\psi$ . Subsequently, we optimize $\psi$ through a soft cross-entropy loss to match the labeled images with their corresponding concepts as follows: + +$$ +\mathcal {L} _ {\mathrm {S C M}} = - \sum_ {i = 1} ^ {N} \frac {y I _ {i}}{\left| y I _ {i} \right|} \log \psi \left(I _ {i} ^ {e}\right) \tag {2} +$$ + +where $|y_{I_i}| = \sum_{v=1}^{V} y_{I_i}(v)$ is utilized to normalize the $y_{I_i}$ so that it can conform to the properties of probabilities. Through minimizing Equation (2), $\psi$ can predict concepts for any domain-related unlabeled images. In this stage, SEMICLIP simultaneously minimizes Equation (1) and Equation (2), and in Figures 2a and 2b, we find that the alignment to concepts can facilitate the model's adaptation to the domain of training data, resulting in improved performance on downstream tasks compared to S-CLIP in some scenarios. The objective for supervised pre-training is $\mathcal{L} = \mathcal{L}_{\mathrm{CLIP}} + \mathcal{L}_{\mathrm{SCM}}$ . + +At the end of the training, we assign pseudo labels $\hat{y}_{I_j}$ which assign 1 to the positions with top- $k$ predicted confidence (Sohn et al., 2020) to unlabeled images leveraging $\psi$ to help understand the semantic information in unlabeled images and achieve further alignment in SSL fine-tuning. + +# 3.3 LEARNING FROM UNLABELLED IMAGES + +To further improve the CLIP model for the target task, we leverage unlabeled images and semantic concepts associated with them to conduct semi-supervised fine-tuning, which includes concept-level semantic consistency and caption-level trapezoidal consistency. + +# 3.3.1 CONCEPT-LEVEL SEMANTIC CONSISTENCY + +When we obtain pseudo labels for unlabeled images, an intuitive strategy in SSL is to train $\psi$ for further alignment between pseudo-concepts and unlabeled images. Popular SSL methods FixMatch (Sohn et al., 2020) and ReMixMatch (Berthelot et al., 2019) align the predictions of strongly augmented images (e.g., applying RandomAugment (Cubuk et al., 2020) to images) with those of weakly augmented images, which partially mitigates confirmation bias (Arazo et al., 2020; Wang et al., 2021a) in SSL tasks and contributes to performance improvement. It is noteworthy that strong data augmentation may hurt the performance (Mu et al., 2022) for vision-language pre-training due to the alterations in the color or position of objects within the images, resulting in a mismatch between the images and their corresponding captions. However, since the concepts we consider primarily consist of nouns that denote entities, which are not significantly affected by data augmentation, making them highly suitable for concept-level semantic consistency: + +$$ +\mathcal {L} _ {\mathrm {S C M}} ^ {u} = - \sum_ {j = 1} ^ {| \mathcal {D} ^ {u} |} \frac {\hat {y} I _ {j}}{| \hat {y} I _ {j} |} \log \psi \left(f _ {I} \left(\Omega \left(I _ {j}\right)\right)\right) \tag {3} +$$ + +where $\Omega(I_j)$ represents the specific strong augmentation scheme for $I_j$ . Incorporating concept-level semantic consistency improves the model's robustness to spurious feature patterns (Sohn et al., 2020; Wei & Gan, 2023) and augments the model's perceptual ability regarding concepts. We will elucidate the performance benefits of employing strong data augmentation as compared to weak data augmentation in Sec. 4.6. It is noteworthy that popular strategies for semi-supervised classification, such as strong data augmentation and confidence filtering (for $\hat{y}_{I_j}$ generation), are utilized within SEMICLIP, bridging the gap between SSL classification and semi-supervised CLIP adaptation. + +# 3.3.2 CAPTION-LEVEL TRAPEZOIDAL CONSISTENCY + +The concepts predicted by $\psi$ are highly relevant to the unlabeled images, revealing the information of entities contained in the images. However, relying solely on the concepts present in the image is insufficient to effectively summarize all the content contained within the image due to the absence of descriptive attributes for the concepts and their interrelations. Therefore, how to aggregate concepts appropriately constitutes a crucial challenge. + +Inspired by the remarkable performance of context optimization (Zhou et al., 2022b;a) for automated prompt engineering, we introduce learnable prompts which can integrate and link corresponding concepts in the images, striving to create meaningful connections between the various concepts. Specifically, we leverage the prompts-driven template $[V]_1[V]_2[V]_3[\text{Concept}]$ to describe each concept in the image, where $[V]_{1:3}$ represent learnable vectors that establish connections among various concepts through optimization during training. To expedite the model's training adaptation, we employ the token embeddings of "a photo includes" to initialize $[V]_{1:3}$ . Considering the presence of multiple concepts in each image, we concatenate their prompts to construct a surrogate caption: + +$$ +\hat {T} _ {j} = \left[ V \right] _ {1} ^ {(1)} \left[ V \right] _ {2} ^ {(1)} \left[ V \right] _ {3} ^ {(1)} \left[ C _ {s _ {1}} \right] \dots \left[ V \right] _ {1} ^ {(k)} \left[ V \right] _ {2} ^ {(k)} \left[ V \right] _ {3} ^ {(k)} \left[ C _ {s _ {k}} \right]. \tag {4} +$$ + +We select the top- $k$ concepts $(C_{s_{1:k}})$ extracted from $I_j$ with the highest classification confidence (Sohn et al., 2020) in $\psi(I_j^e)$ , where $s_{1:k}$ represent the indexes for top- $k$ concepts. + +Although learnable prompts allow us to generate more accurate surrogate captions for unlabeled images, these captions can be coarse-grained. Hence, we adopt caption-level trapezoidal consistency, which includes constraints for the upper base, legs, and diagonals of the trapezoid constructed through the labeled image-text pairs, unlabeled images, and surrogate captions. Specifically, we select a subset of unlabeled images $I^P$ with top- $P\%$ cosine similarity between images and their corresponding surrogate captions, denoted as $\mathcal{D}^P = \{I_j^P, \hat{T}_j\}_{j=1}^{M_P}$ , where $M_P = M * P\%$ represents the number of selected unlabeled images. Subsequently, we define $\widetilde{\mathcal{D}} = \mathcal{D}^l \cup \mathcal{D}^P = \{(\widetilde{I}_i, \widetilde{T}_i)\}_{i=1}^{N + M_P}$ and the trapezoidal consistency as follows: + +$$ +\mathcal {L} _ {\text {T r a p}} = \underbrace {\mathcal {L} _ {\text {C L I P}}} _ {\text {u p p e r b a s e}} + \frac {1}{| \widetilde {\mathcal {D}} |} \sum_ {i = 1} ^ {| \widetilde {\mathcal {D}} |} \sum_ {j = 1} ^ {| \widetilde {\mathcal {D}} |} \underbrace {(\langle \tilde {I} _ {i} ^ {e} , \tilde {T} _ {j} ^ {e} \rangle - \langle \tilde {I} _ {j} ^ {e} , \tilde {T} _ {i} ^ {e} \rangle) ^ {2}} _ {\text {d i a g o n a l s}} + \underbrace {(\langle \tilde {I} _ {i} ^ {e} , \tilde {I} _ {j} ^ {e} \rangle - \langle \tilde {T} _ {j} ^ {e} , \tilde {T} _ {i} ^ {e} \rangle) ^ {2}} _ {\text {l e g s}} \tag {5} +$$ + +The diagonal constraint ensures consistent similarity across multiple image-text pairs. Simultaneously, the equal length of legs constraint ensures that the similarity between images and the similarity between texts are treated equally in the feature space. + +To understand why trapezoidal consistency works for surrogate captions, we draw inspiration from two aspects: + +- As illustrated in Figure 1b, the consistency for diagonals constrains the distance between $I_{i}$ and $\hat{T}_{j}$ to be consistent with the distance between $I_{j}$ and $T_{i}$ . Similarly, The consistency for legs regulates the distance between $I_{i}$ and $I_{j}$ to align with the distance between $T_{i}$ and $\hat{T}_{j}$ . Equation (1) encourages $I_{i}$ and $T_{i}$ to be closer, leading to a corresponding decrease in the length of the upper base. The quadrilateral characterized by vertices $I_{i}, I_{j}, T_{i}$ , and $\hat{T}_{j}$ will be optimized toward an isosceles trapezoid, which does not need any distance constraints regarding the length of its lower base. This is equivalent to imposing no direct alignment constraint between $I_{j}$ and $\hat{T}_{j}$ , thereby mitigating the negative impact of inaccurate $\hat{T}_{j}$ . +- Despite the absence of direct alignment between $I_{j}$ and $\hat{T}_{j}$ , the trapezoid consistency allows both to interact with samples from within and outside the modality (Goel et al., 2022), ensuring coherence among samples within each modality and substantially enhancing the model's overall alignment ability. + +Overall, during semi-supervised fine-tuning, concept-level semantic consistency and caption-level trapezoidal consistency are jointly optimized by minimizing: $\mathcal{L} = \mathcal{L}_{\mathrm{SCM}}^u + \mathcal{L}_{\mathrm{Trap}}$ . + +# 4 EXPERIMENTS + +# 4.1 EXPERIMENT SETUP + +Datasets and Evaluation Metrics. We conduct extensive experiments on four publicly available datasets to evaluate the performance of SEMICLIP. Following previous method S-CLIP (Mo et al., 2023), the datasets include Remote sensing datasets (Yang & Newsam, 2010; Zhang et al., 2014; Lu et al., 2017), Fashion datasets (Han et al., 2017; Rostamzadeh et al., 2018; Vasileva et al., 2018), SciCap dataset (Hsu et al., 2021), and Simpsons dataset (Attia, 2018; Adler, 2023). Under the default setting, we subsample $10\%$ image-text pairs of the training dataset randomly as labeled data, leaving the rest as unlabeled data. The models are evaluated on zero-shot classification and image-text retrieval tasks, with performance measured by Top-1 classification accuracy $(\%)$ and recall at $k$ $(R@k)$ . Results are reported as the mean and standard deviation across three random seeds. + +Implementation details. We use the publicly available CLIP model (Ilharco et al., 2021) as our backbone. All experiments are conducted on four NVIDIA A6000 GPUs with a batch size of 64 per GPU. To maintain equitable memory usage in SSL, each mini-batch consists of 32 image-text pairs and 32 unpaired images. We utilize ViT-B-16 as the default vision encoder in our experiments, and experiments related to other vision encoders are shown in Appendix A.1. We train the model 25 epochs in the supervised pre-training, and 15 epochs for semi-supervised fine-tuning. We employ AdamW (Loshchilov, 2017) alongside a weight decay set at $5 \times 10^{-4}$ and apply the default cosine learning rate scheduling with warmup for the first 10 steps. The learning rate is set to $5 \times 10^{-5}$ for remote sensing and fashion datasets and $1 \times 10^{-6}$ for SciCap and Simpsons datasets. We establish default values of 30 for $P$ and 4 for $k$ . + +Competing Methods. We compare our method with the pre-trained CLIP, denoted as CLIP (original), and the CLIP model fine-tuned using only image-text pairs in labeled data, denoted as CLIP (fine-tuned). Oracle (fully supervised fine-tuned) is the supervised learning on all training data. We also compare SEMICLIP with another three semi-supervised CLIP adaptation approaches, i.e., Hard-PL, Soft-PL, and S-CLIP. More details about these methods can be found in Appendix B. + +# 4.2 REMOTE SENSING DATASETS + +Following the settings in Arampacha et al. (2021), we train vision-language models on a merged dataset, termed RS-ALL, which consists of RSICD (Lu et al., 2017), UCM (Yang & Newsam, 2010), and Sydney (Zhang et al., 2014). Considering the potentially broader domain distribution of unlabeled data, we not only utilize the default $90\%$ of RS-ALL designated as unlabeled data $(\mathrm{L} = \mathrm{U})$ , but also incorporate the RESISC45 dataset (Cheng et al., 2017) as unlabeled data $(\mathrm{L} \neq \mathrm{U})$ . + +Zero-shot classification. We utilize the validation sets from the classification variants of the RSICD and UCM datasets, referred to as RSICD-CLS and UCM-CLS, respectively. Furthermore, we + +
MethodDataRSICD-CLSUCM-CLSWHU-RS19RSSCN7AID
CLIP (original)-59.260.281.269.059.6
CLIP (fine-tuned)L75.7±2.280.1±6.892.2±1.570.7±5.579.8±3.8
Oracle (fully supervised fine-tuned)L+U87.5±1.867.9±2.394.2±1.575.7±2.989.3±1.2
Hard-PL (Lee et al., 2013)78.0±2.0 (+2.3)72.4±5.2 (-7.7)92.3±2.6 (+0.1)71.7±4.1 (+1.0)81.4±2.2 (+1.6)
Soft-PL (Assran et al., 2021)L=U81.7±0.6 (+6.0)78.9±5.2 (-1.2)95.3±0.8 (+3.1)72.0±2.5 (+1.3)85.8±1.6 (+6.0)
S-CLIP (Mo et al., 2023)81.4±1.8 (+5.7)81.3±3.4 (+1.2)95.9±1.8 (+3.7)75.1±2.0 (+4.4)86.4±1.7 (+6.6)
SEMICLIP (ours)83.8±1.0 (+8.1)85.6±3.4 (+5.5)96.6±1.2 (+4.4)75.3±1.9 (+4.6)87.4±0.5 (+7.6)
Hard-PL (Lee et al., 2013)79.9±2.5 (+4.2)76.2±1.9 (-3.9)91.0±2.3 (-1.2)71.4±2.2 (+0.7)82.4±2.0 (+2.6)
Soft-PL (Assran et al., 2021)L≠U78.3±3.8 (+2.6)78.3±3.4 (-1.8)95.3±1.3 (+3.1)73.8±2.7 (+3.1)82.7±3.7 (+2.9)
S-CLIP (Mo et al., 2023)78.3±3.2 (+2.6)79.5±4.9 (-0.6)93.8±1.5 (+1.6)73.9±5.0 (+3.2)84.9±3.3 (+5.1)
SEMICLIP (ours)84.1±0.5 (+8.4)85.4±2.8 (+5.3)96.5±1.7 (+4.3)72.9±3.5 (+2.2)86.2±1.0 (+6.4)
+ +Table 1: Zero-shot classification results on remote sensing datasets. We compare the original CLIP, supervised CLIP fine-tuned on labeled data (L), and semi-supervised methods that utilize unlabeled data sampled from the same $(\mathrm{L} = \mathrm{U})$ or different $(\mathrm{L}\neq \mathrm{U})$ distribution as the labeled data. Parentheses indicate the performance gap from the supervised CLIP, where values highlighted in green indicate gaps larger than one. The best results are in bold. + +
MethodDataImage→text R@5Text→image R@5
RSICDUCMSydneyRSICDUCMSydney
CLIP (original)-12.646.744.813.939.544.8
CLIP (fine-tuned)L25.7±2.355.2±0.846.6±3.024.9±0.656.3±1.649.4±2.0
CLIP (fine-tuned)L+U34.3±1.363.5±1.363.6±2.432.0±1.366.6±1.165.4±2.5
Hard-PL (Lee et al., 2013)27.3±1.154.8±1.652.3±3.624.2±1.354.6±1.055.2±6.9
Soft-PL (Assran et al., 2021)L=U27.3±0.954.8±2.252.3±2.026.1±1.755.6±4.056.3±5.3
S-CLIP (Mo et al., 2023)27.5±1.157.0±1.551.1±4.325.6±0.657.3±4.150.6±2.6
SEMICLIP (ours)27.6±1.659.2±2.253.4±4.626.4±0.458.4±2.458.0±2.0
Hard-PL (Lee et al., 2013)25.9±1.652.7±2.250.6±7.022.4±1.554.3±1.451.7±5.2
Soft-PL (Assran et al., 2021)L≠U27.4±1.654.1±2.451.1±1.024.4±0.754.4±2.452.3±5.3
S-CLIP (Mo et al., 2023)27.2±0.655.7±3.050.0±4.626.1±0.755.7±2.952.9±5.5
SEMICLIP (ours)28.5±0.259.5±3.654.6±3.626.3±0.459.5±1.358.6±4.6
+ +Table 2: Image-text retrieval results on remote sensing datasets, following the same setup of Table 1. + +assess the generalization capability of SEMICLIP on WHU-RS19 (Xia et al., 2009), RSSCN7 (Zou et al., 2015), and AID (Xia et al., 2017), which are not included in the training datasets. Results in Tab. 1 demonstrate the performance advantages of SEMICLIP. Compared with S-CLIP, SEMICLIP demonstrates an average performance gain of $1.72\%$ and $2.94\%$ for $\mathrm{L} = \mathrm{U}$ and $\mathrm{L} \neq \mathrm{U}$ settings, respectively. $\mathrm{L} \neq \mathrm{U}$ represents the scenarios that demand higher robustness of the model against unseen domains and domain shifts, where SEMICLIP achieves more significant performance gains compared to previous methods. Interestingly, our method even outperforms the oracle in some zero-shot settings, and we provide more detailed explanation of this phenomenon in Appendix E. + +Image-text retrieval. We evaluate the image $\rightarrow$ text and text $\rightarrow$ image retrieval performance on the validation sets of the RSICD, UCM, and Sydney datasets. Tab. 2 presents the R@5 results, where we can observe that the proposed SEMICLIP surpasses all competing methods across all settings, achieving average $4.48\%$ gain over fine-tuned CLIP. More results can be found in Appendix A.3. + +# 4.3 FASHION DATASETS + +We evaluate the models on the union of Fashion200k (Han et al., 2017), FashionGen (Rostamzadeh et al., 2018), and Polyvore Outfits (Vasileva et al., 2018) datasets. Given that each text caption can associate with multiple image views, we randomly select one image during each iteration. + +Zero-shot classification. The zero-shot classification performance is evaluated on the classification validation sets of Fashion200k, FashionGen, and Polyvore Outfits. It is worth noting that we considered two different class hierarchies, namely super-class and sub-class, in the Fashion200k and FashionGen datasets. The results in Tab. 3 indicate that SEMICLIP significantly outperforms S-CLIP, with an average gain of $12.15\%$ on sub-class in particular. We attribute this to the richness of the concepts extracted by SEMICLIP through semantic concepts mining, and the concepts may encompass + +
MethodFashion200kFashionGenPolyvore
Super-classSub-classSuper-classSub-classClass
CLIP (original)73.227.734.826.470.2
CLIP (fine-tuned)79.0±3.535.1±0.735.4±8.124.5±2.460.4±2.3
Oracle (fully supervised fine-tuned)88.6±1.345.3±4.853.3±2.545.5±7.376.3±8.8
Hard-PL (Lee et al., 2013)54.9±6.4 (-24.1)23.9±2.3 (-11.2)24.2±3.9 (-11.2)18.3±2.4 (-6.2)34.3±6.8 (-26.1)
Soft-PL (Assran et al., 2021)82.5±2.8 (+3.5)36.6±1.4 (+1.5)44.8±3.5 (+9.4)33.6±1.4 (+9.1)73.6±1.7 (+13.2)
S-CLIP (Mo et al., 2023)85.1±0.9 (+6.1)38.4±0.7 (+3.3)44.0±4.6 (+8.6)29.6±4.0 (+5.1)73.9±2.4 (+13.5)
SEMICLIP (ours)85.8±0.4 (+6.8)44.7±1.0 (+9.6)51.4±0.6 (+16.0)47.6±1.7 (+23.1)74.4±0.5 (+14.0)
+ +Table 3: Zero-shot classification results on fashion datasets. Parentheses indicate the performance gap from the supervised CLIP, where values highlighted in green indicate gaps larger than one. + +
MethodImage→text R@5Text→image R@5
Fashion200kFashionGenPolyvoreFashion200kFashionGenPolyvore
CLIP (original)12.523.524.312.327.727.4
CLIP (fine-tuned)13.7±0.432.1±0.216.3±0.513.5±0.231.9±0.216.2±0.3
Oracle (fully supervised fine-tuned)34.9±0.763.4±0.148.5±0.834.9±0.935.3±0.949.3±0.5
Hard-PL (Lee et al., 2013)12.6±0.726.8±0.714.9±0.814.5±0.830.2±0.417.3±0.9
Soft-PL (Assran et al., 2021)15.2±0.835.0±0.318.8±0.315.9±0.737.4±0.721.9±0.2
S-CLIP (Mo et al., 2023)16.9±0.437.9±0.422.6±0.417.4±0.340.9±0.424.2±0.5
SEMICLIP (ours)22.1±0.448.4±0.727.7±0.322.5±0.249.7±0.327.6±0.2
+ +Table 4: Image-text retrieval results on fashion datasets, following the same setup of Table 3. + +pass some fine-grained information. Coupled with subsequent concepts-level semantic consistency, SEMICLIP can significantly improve fine-grained classification performance. + +Image-text retrieval. We evaluate the image-text retrieval performance on the validation sets of three fashion datasets. We can observe that SEMICLIP outperforms S-CLIP by an average gain of $6.35\%$ in terms of R@5 in Tab. 4. Compared to results for remote sensing datasets, it is evident that SEMICLIP exhibits a more pronounced advantage, as the Fashion datasets present greater challenges with large-scale and diverse samples. Such settings are more representative of real-world scenarios. Methods like S-CLIP, which utilize nearest neighbor strategies for pseudo-labeling, often struggle to find suitable neighbors within a single batch. + +# 4.4 MORE DATASETS + +We conduct experiments on SciCap (Hsu et al., 2021) and Simpsons (Adler, 2023) datasets to further verify the performance superiority in image-text retrieval. + +SciCap. The images in SciCap belong to the scientific figures domain, which presents a significant challenge for the model. The results in Tab. 5 indicate that SEMICLIP improve the performance averaged $4.03\%$ compared to fine-tuned CLIP. This further confirms that SEMICLIP can enhance the performance of pre-trained models by leveraging a substantial amount of unlabeled data, even in challenging domain settings. + +Simpsons. Due to the Simpsons dataset only contains limited image-text pairs, we integrate unlabeled images from an additional dataset called Simpsons Characters (Attia, 2018). From Tab. 5, we can conclude that SEMICLIP achieves averaged $6.55\%$ and $6.95\%$ enhancement for R@1 and R@5 respectively compared to S-CLIP. The results demonstrate that even when image-text pairs are extremely scarce, SEMICLIP can still maintain a significant performance advantage. + +# 4.5 IN-DEPTH ANALYSIS FOR SEMICLIP + +In this section, we conduct extensive studies to demonstrate the effectiveness of SEMICLIP and analysis for the sensitivity of hyperparameters can be found in Appendix A.2. + +Extracted concepts. In Figure 1a, we provide examples illustrating the concepts extracted by the semantic concepts extractor for the unlabeled images. We note that some extracted concepts, like "tanks" and "jeggings", are indeed present in the corresponding real captions of the images. However, there are also concepts like "lawn" and "skinny" that do not appear in the captions, but these non + +
MethodSciCapSimpsons
Image→textText→imageImage→textText→image
R@1R@5R@1R@5R@1R@5R@1R@5
CLIP (original)8.313.88.814.213.235.510.532.9
CLIP (fine-tuned)11.0±0.619.0±0.811.1±0.918.1±0.019.3±2.048.2±6.014.5±0.045.6±2.0
Oracle (fully supervised fine-tuned)14.8±0.925.5±1.414.8±0.525.7±0.328.3±3.752.3±5.622.3±3.155.8±4.1
Hard-PL (Lee et al., 2013)11.2±0.218.9±0.212.2±0.120.1±0.116.7±2.742.1±5.315.4±4.243.9±3.3
Soft-PL (Assran et al., 2021)11.5±0.219.4±0.312.2±0.220.5±0.218.4±1.340.4±4.015.8±1.343.4±3.5
S-CLIP (Mo et al., 2023)11.6±0.520.6±0.512.6±0.421.1±0.415.4±2.043.9±5.517.5±1.547.4±6.8
SEMICLIP (ours)12.3±0.421.0±0.413.0±0.021.5±0.224.1±0.850.4±2.721.9±1.554.8±0.8
+ +Table 5: Image-text retrieval results on SciCap (scientific figures) and Simpsons (comics) datasets. We train the model on each dataset and evaluate on their validation sets. + +![](images/a25aaf30a017d04cee6226734765fe5a8fc9cb42ecc84f7a9cd7905169e7f5a6.jpg) +(a) + +![](images/102dbfe1266109a7affe515bbb3507105967764a688b411a3651e4baf705622f.jpg) +(b) +Figure 2: (2a) Gain of averaged zero-shot classification for S-CLIP and different stages in SEMICLIP. "SPT" and "SSFT" respectively denote supervised pre-training and semi-supervised fine-tuning; (2b) Gain of averaged image-text retrieval for S-CLIP and different stages in SEMICLIP; (2c) The cosine distance for image-text pairs. "Labeled pairs" and "Unlabeled w/ $\mathcal{L}_{\mathrm{Trap}}$ " denote the distance between images and captions in labeled data and the distance between unlabeled images and surrogate captions when training with $\mathcal{L}_{\mathrm{Trap}}$ . "Unlabeled w/ $\mathcal{L}_{\mathrm{CLIP}}$ " represent the distance when directly aligning unlabeled images and surrogate captions through CLIP loss. + +![](images/cfa14df59db2900fe3f6ec20f1c8f7bd986b31742c5c66ffb321817668be1b30.jpg) +(c) + +existent concepts closely align with the content of the images. This indicates that the classifier $\psi$ can effectively perceive the concepts in images, which is beneficial for generating surrogate captions. + +Gain of performance. Figures 2a and 2b illustrate the performance gains of S-CLIP and SEMICLIP at different stages compared to fine-tuned CLIP. It is evident that all three methods surpass fine-tuned CLIP to some extent, and SEMICLIP in semi-supervised fine-tuning shows a significant performance advantage over S-CLIP. Surprisingly, in SPT, SEMICLIP can completely outperform fine-tuned CLIP and even surpass S-CLIP in some settings, such as zero-shot and image-text retrieval performance in fashion datasets. This indicates that leveraging concepts extracted from captions and trained by Equation (2) can enhance the model's perceptual capability regarding concepts which lays a solid foundation for the subsequent semi-supervised fine-tuning. + +Structure of trapezoid. As described in Sec. 3.3.2, the Equation (5) will optimize the structure illustrated in Figure 1b to resemble an isosceles trapezoid. In Figure 2c, we present the frequency distribution of the cosine distances between labeled image-text pairs and the cosine distances between unlabeled images and surrogate captions. We observe that the distance between unlabeled images and surrogate captions is generally larger when we apply $\mathcal{L}_{\mathrm{Trap}}$ , indicating that the lower base is longer than the upper base. However, if CLIP loss is directly imposed on unlabeled images and surrogate captions, it causes their distances to become excessively close, resulting in a significant decline in zero-shot classification by $4.07\%$ on average. This indicates that the direct alignment of unlabeled images and surrogate captions suffers from performance degradation due to the noise present in surrogate captions, whereas trapezoidal consistency effectively mitigates this issue and significantly improves performance through interactions between samples from both image and text modalities. + +# 4.6 ABLATION ANALYSIS + +We tease apart the factors that contribute significantly to the success of SEMICLIP in Tab. 6. + +
AblationsRemote sensingFashion
ZSI2TT2IZSI2TT2I
SEMICLIP85.7±1.832.4±1.831.2±0.960.8±1.324.1±1.124.5±1.5
w/o Strong augmentation84.4±1.931.9±1.930.3±1.557.7±2.222.3±1.922.5±1.7
w/o CSC82.7±1.832.0±2.130.6±1.459.1±1.423.5±2.123.9±1.2
w/o Consistency for diagonals82.0±2.631.9±0.930.8±1.156.4±1.522.6±1.323.9±1.8
w/o Consistency for legs83.8±2.431.4±3.730.5±2.159.7±1.223.8±1.124.0±2.1
w/o CTC81.9±1.831.7±2.830.7±1.654.1±1.422.1±2.322.4±1.5
w/o Learnable prompts84.6±2.431.5±1.230.5±1.759.3±1.923.2±1.723.8±2.3
+ +Table 6: Ablation studies. We investigate the impact of the core components of the SEMICLIP on remote sensing and fashion datasets. "ZS", "I2T", "T2I" denote the averaged zero-shot classification, image $\rightarrow$ text retrieval and text $\rightarrow$ image retrieval performance. "CSC" and "CTC" represent the concept-level semantic consistency and caption-level trapezoidal consistency, respectively. + +Impact of strong data augmentation. We apply strong data augmentation to unlabeled images during the concept-level semantic consistency in Equation (3). Upon replacing strong augmentation with weak augmentation, we notice a significant performance decline across all settings, i.e., $3.1\%$ zero-shot accuracy drop in fashion datasets. It suggests that strong data augmentation significantly contributes to the improvement of zero-shot performance. + +Impact of concept-level semantic consistency (CSC). CSC is employed to further leverage extracted concepts to enhance the model's awareness of concepts in task-specific domains. The exclusion of CSC results in averaged $1.15\%$ performance drop. It is noteworthy that in some cases, the removal of strong augmentation leads to a more severe performance decline than the removal of CSC (e.g., the "ZS" in fashion). We believe this is due to the confirmation bias when applying weak augmentation for consistency, which can cause the model's biases to accumulate, severely impairing performance. + +Impact of consistency for the diagonals of trapezoid. The consistency for diagonals can symmetrize the similarity across two mismatched image-text pairs. When removing the consistency for diagonals, we observe a reduction in performance averaging $1.85\%$ . This suggests that cross-modal interaction and consistency constraints are beneficial for enhancing the model's alignment capabilities. + +Impact of consistency for the legs of trapezoid. SEMICLIP utilizes consistency for legs to enhance the intra-modality similarity. While the benefits derived from the consistency for legs are relatively small compared to the diagonals, with an average performance decrease of $0.92\%$ upon its removal, it nevertheless underscores the potential of constraints for legs to enhance overall performance by ensuring coherence among samples within each modality. + +Impact of caption-level trapezoidal consistency (CTC). The complete removal of CTC undoubtedly leads to a significant performance decline, with reductions of $5.25\%$ and $1.33\%$ observed on the zero-shot and image-text retrieval tasks, respectively. This highlights that CTC plays an important role in strengthening the interaction and alignment between samples. More importantly, it facilitates the integration of surrogate captions into the training, further leveraging unlabeled images to improve the performance and effectively mitigating noise potentially introduced by surrogate captions. + +Impact of learnable prompts in surrogate caption. In order to investigate the role of learnable prompts in constructing surrogate captions for unlabeled images, we detached the gradients and froze the prompts after initialization. Results reveal that applying learnable prompts can achieve an averaged $0.97\%$ improvement in model performance, which we believe stems from the dynamic adaptation of prompts that better aligns surrogate captions with task-specific domains. + +# 5 CONCLUSION + +This paper proposes a new semi-supervised CLIP adaptation method that effectively adapts CLIP to target tasks using only a small number of image-text pairs. The proposed trapezoidal consistency can effectively tackle inaccurate surrogate captions, achieving robust representation learning. Extensive experiments demonstrate that our method achieves state-of-the-art results in both zero-shot classification and image-text retrieval tasks. We believe that trapezoidal consistency has the potential to flexibly adapt to different multi-modal semi-supervised learning tasks. + +# ACKNOWLEDGMENTS + +This work was supported by the National Science Foundation of China (62206049, 62176055), Postgraduate Research&Practice Innovation Program of Jiangsu Province (KYCX25_0544), and the Big Data Computing Center of Southeast University. We would like to thank anonymous reviewers for their constructive suggestions. + +Ethics Statement. This research fully complies with the specified ethical standards. No human participants or sensitive data were used, and the datasets utilized are open and ethically sourced. The research methodology and results have been carefully evaluated to prevent any potential misuse, discrimination, or bias. All procedures align with legal, privacy, and security regulations. There are no conflicts of interest or external funding that could influence the study's findings. We have maintained transparency and integrity throughout the research process to ensure that the results are accurately and ethically represented. + +Reproducibility Statement. We have made significant efforts to ensure the reproducibility of our results. The source code used in our experiments is included in the supplementary materials, along with a detailed README file that provides step-by-step instructions and the necessary commands to reproduce the experiments. All the hyperparameters and experimental settings are specified in Sec. 4.1 to facilitate replication. + +# REFERENCES + +Doron Adler. Simpsons blip captions. https://huggingface.co/datasets/Norod78/simpsons-blip-captions, 2023. +Arto Arampacha, Vidhani Dev, Goutham Venkatesh, Bhaskar Mayank, Ghosh Ritobrata, and Pal Sujit. Fine tuning clip with remote sensing (satellite) images and captions. https://huggingface.co/blog/fine-tune-clip-rsicd, 2021. +Eric Arazo, Diego Ortego, Paul Albert, Noel E O'Connor, and Kevin McGuinness. Pseudo-labeling and confirmation bias in deep semi-supervised learning. In 2020 International joint conference on neural networks (IJCNN), pp. 1-8, 2020. +Mahmoud Assran, Mathilde Caron, Ishan Misra, Piotr Bojanowski, Armand Joulin, Nicolas Ballas, and Michael Rabbat. Semi-supervised learning of visual features by non-parametrically predicting view assignments with support samples. In ICCV, 2021. +Alexandre Attia. The simpsons characters data. https://www.kaggle.com/datasets/alexattia/the-simpsons-characters-dataset, 2018. +Hangbo Bao, Wenhui Wang, Li Dong, Qiang Liu, Owais Khan Mohammed, Kriti Aggarwal, Subhojit Som, Songhao Piao, and Furu Wei. Vlmo: Unified vision-language pre-training with mixture-of-modality-experts. Advances in Neural Information Processing Systems, 35:32897-32912, 2022. +David Berthelot, Nicholas Carlini, Ekin D Cubuk, Alex Kurakin, Kihyuk Sohn, Han Zhang, and Colin Raffel. Remixmatch: Semi-supervised learning with distribution alignment and augmentation anchoring. arXiv preprint arXiv:1911.09785, 2019. +Steven Bird, Ewan Klein, and Edward Loper. Natural language processing with Python: analyzing text with the natural language toolkit. 2009. +Hao Chen, Ran Tao, Yue Fan, Yidong Wang, Jindong Wang, Bernt Schiele, Xing Xie, Bhiksha Raj, and Marios Savvides. Softmatch: Addressing the quantity-quality trade-off in semi-supervised learning. arXiv preprint, 2023. +Yen-Chun Chen, Linjie Li, Licheng Yu, Ahmed El Kholy, Faisal Ahmed, Zhe Gan, Yu Cheng, and Jingjing Liu. Uniter: Universal image-text representation learning. In European conference on computer vision, pp. 104-120, 2020. + +Gong Cheng, Junwei Han, and Xiaogiang Lu. Remote sensing image scene classification: Benchmark and state of the art. Proceedings of the IEEE, 2017. +Ekin D Cubuk, Barret Zoph, Jonathon Shlens, and Quoc V Le. Randaugment: Practical automated data augmentation with a reduced search space. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition workshops, pp. 702-703, 2020. +Xiaoyi Dong, Jianmin Bao, Yinglin Zheng, Ting Zhang, Dongdong Chen, Hao Yang, Ming Zeng, Weiming Zhang, Lu Yuan, Dong Chen, et al. Maskclip: Masked self-distillation advances contrastive language-image pretraining. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 10995-11005, 2023. +Kai Gan and Tong Wei. Erasing the bias: Fine-tuning foundation models for semi-supervised learning. In *Forty-first International Conference on Machine Learning*, 2024. +Yuting Gao, Jinfeng Liu, Zihan Xu, Jun Zhang, Ke Li, Rongrong Ji, and Chunhua Shen. Pyramidclip: Hierarchical feature alignment for vision-language model pretraining. Advances in Neural Information Processing Systems, 35:35959-35970, 2022. +Shashank Goel, Hritik Bansal, Sumit Bhatia, Ryan Rossi, Vishwa Vinay, and Aditya Grover. Cyclip: Cyclic contrastive language-image pretraining. Advances in Neural Information Processing Systems, 35:6704-6719, 2022. +Yves Grandvalet and Yoshua Bengio. Semi-supervised learning by entropy minimization. Advances in Neural Information Processing Systems, 17, 2004. +Xintong Han, Zuxuan Wu, Phoenix X Huang, Xiao Zhang, Menglong Zhu, Yuan Li, Yang Zhao, and Larry S Davis. Automatic spatially-aware fashion concept discovery. In Proceedings of the IEEE International Conference on Computer Vision, pp. 1463-1471, 2017. +Ting-Yao Hsu, C Lee Giles, and Ting-Hao'Kenneth' Huang. Scicap: Generating captions for scientific figures. arXiv preprint arXiv:2110.11624, 2021. +Runhui Huang, Yanxin Long, Jianhua Han, Hang Xu, Xiwen Liang, Chunjing Xu, and Xiaodan Liang. Nlip: Noise-robust language-image pre-training. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 37, pp. 926-934, 2023. +Gabriel Ilharco, Mitchell Wortsman, Ross Wightman, Cade Gordon, Nicholas Carlini, Rohan Taori, Achal Dave, Vaishaal Shankar, Hongseok Namkoong, John Miller, Hannaneh Hajishirzi, Ali Farhadi, and Ludwig Schmidt. Openclip, 2021. +Chao Jia, Yinfei Yang, Ye Xia, Yi-Ting Chen, Zarana Parekh, Hieu Pham, Quoc Le, Yun-Hsuan Sung, Zhen Li, and Tom Duerig. Scaling up visual and vision-language representation learning with noisy text supervision. In International conference on machine learning, pp. 4904-4916, 2021. +Alistair EW Johnson, Tom J Pollard, Seth J Berkowitz, Nathaniel R Greenbaum, Matthew P Lungren, Chih-ying Deng, Roger G Mark, and Steven Horng. Mimic-cxr, a de-identified publicly available database of chest radiographs with free-text reports. Nature scientific data, 2019. +Jaehyung Kim, Youngbum Hur, Sejun Park, Eunho Yang, Sung Ju Hwang, and Jinwoo Shin. Distribution aligning refinery of pseudo-label for imbalanced semi-supervised learning. Advances in neural information processing systems, 33:14567-14579, 2020. +Younghyun Kim, Sangwoo Mo, Minkyu Kim, Kyungmin Lee, Jaeho Lee, and Jinwoo Shin. Biast-to-text: Debiasing unknown visual biases through language interpretation. arXiv preprint arXiv:2301.11104, 2023. +Dong-Hyun Lee et al. Pseudo-label: The simple and efficient semi-supervised learning method for deep neural networks. In Workshop on challenges in representation learning, ICML, 2013. +Doyup Lee, Sungwoong Kim, Ildoo Kim, Yeongjae Cheon, Minsu Cho, and Wook-Shin Han. Contrastive regularization for semi-supervised learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 3911-3920, 2022. + +Junnan Li, Ramprasaath Selvaraju, Akhilesh Gotmare, Shafiq Joty, Caiming Xiong, and Steven Chu Hong Hoi. Align before fuse: Vision and language representation learning with momentum distillation. Advances in Neural Information Processing Systems, 34:9694-9705, 2021a. +Liunian Harold Li, Mark Yatskar, Da Yin, Cho-Jui Hsieh, and Kai-Wei Chang. Visualbert: A simple and performant baseline for vision and language. arXiv preprint arXiv:1908.03557, 2019. +Lianian Harold Li, Haoxuan You, Zhecan Wang, Alireza Zareian, Shih-Fu Chang, and Kai-Wei Chang. Unsupervised vision-and-language pre-training without parallel images and captions. In NAACL, 2021b. +Wei Li, Can Gao, Guocheng Niu, Xinyan Xiao, Hao Liu, Jiachen Liu, Hua Wu, and Haifeng Wang. Unimo: Towards unified-modal understanding and generation via cross-modal contrastive learning. arXiv preprint arXiv:2012.15409, 2020a. +Xiujun Li, Xi Yin, Chunyuan Li, Pengchuan Zhang, Xiaowei Hu, Lei Zhang, Lijuan Wang, Houdong Hu, Li Dong, Furu Wei, et al. Oscar: Object-semantics aligned pre-training for vision-language tasks. In Computer Vision-ECCV 2020: 16th European Conference, pp. 121-137, 2020b. +Yangguang Li, Feng Liang, Lichen Zhao, Yufeng Cui, Wanli Ouyang, Jing Shao, Fengwei Yu, and Junjie Yan. Supervision exists everywhere: A data efficient contrastive language-image pre-training paradigm. arXiv preprint arXiv:2110.05208, 2021c. +Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dólar, and C Lawrence Zitnick. Microsoft coco: Common objects in context. In Computer Vision-ECCV 2014: 13th European Conference, Zurich, Switzerland, September 6-12, 2014, Proceedings, Part V 13, pp. 740-755. Springer, 2014. +Haokun Liu, Derek Tam, Mohammed Muqeeth, Jay Mohta, Tenghao Huang, Mohit Bansal, and Colin A Raffel. Few-shot parameter-efficient fine-tuning is better and cheaper than in-context learning. Advances in Neural Information Processing Systems, 35:1950-1965, 2022. +I Loshchilov. Decoupled weight decay regularization. arXiv preprint arXiv:1711.05101, 2017. +Jiasen Lu, Dhruv Batra, Devi Parikh, and Stefan Lee. Vilbert: Pretraining task-agnostic visiolinguistic representations for vision-and-language tasks. Advances in Neural Information Processing Systems, 32, 2019. +Xiaoqiang Lu, Binqiang Wang, Xiangtao Zheng, and Xuelong Li. Exploring models and data for remote sensing image caption generation. IEEE Transactions on Geoscience and Remote Sensing, 2017. +Huaishao Luo, Lei Ji, Ming Zhong, Yang Chen, Wen Lei, Nan Duan, and Tianrui Li. Clip4clip: An empirical study of clip for end to end video clip retrieval and captioning. Neurocomputing, 508: 293-304, 2022. +Muhammad Jehanzeb Mirza, Leonid Karlinsky, Wei Lin, Horst Possegger, Mateusz Kozinski, Rogerio Feris, and Horst Bischof. Lafter: Label-free tuning of zero-shot classifier using language and unlabeled image collections. Advances in Neural Information Processing Systems, 36, 2024. +Sangwoo Mo, Minkyu Kim, Kyungmin Lee, and Jinwoo Shin. S-clip: Semi-supervised vision-language learning using few specialist captions. Advances in Neural Information Processing Systems, 36:61187-61212, 2023. +Norman Mu, Alexander Kirillov, David Wagner, and Saining Xie. Slip: Self-supervision meets language-image pre-training. In European Conference on Computer Vision, pp. 529-544, 2022. +Aaron van den Oord, Yazhe Li, and Oriol Vinyals. Representation learning with contrastive predictive coding. arXiv preprint arXiv:1807.03748, 2018. +Hieu Pham, Zihang Dai, Golnaz Ghiasi, Kenji Kawaguchi, Hanxiao Liu, Adams Wei Yu, Jiahui Yu, Yi-Ting Chen, Minh-Thang Luong, Yonghui Wu, et al. Combined scaling for zero-shot transfer learning. Neurocomputing, 555:126658, 2023. + +Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, et al. Learning transferable visual models from natural language supervision. In International conference on machine learning, pp. 8748-8763, 2021. +Negar Rostamzadeh, Seyedarian Hosseini, Thomas Boquet, Wojciech Stokowiec, Ying Zhang, Christian Jauvin, and Chris Pal. Fashion-gen: The generative fashion dataset and challenge. arXiv preprint arXiv:1806.08317, 2018. +Christoph Schuhmann, Romain Beaumont, Richard Vencu, Cade Gordon, Ross Wightman, Mehdi Cherti, Theo Coombes, Aarush Katta, Clayton Mullis, Mitchell Wortsman, et al. Laion-5b: An open large-scale dataset for training next generation image-text models. arXiv preprint arXiv:2210.08402, 2022. +Jiang-Xin Shi, Tong Wei, Zhi Zhou, Jie-Jing Shao, Xin-Yan Han, and Yu-Feng Li. Long-tail learning with foundation model: Heavy fine-tuning hurts. In *Forty-first International Conference on Machine Learning*, 2024. +Kihyuk Sohn, David Berthelot, Nicholas Carlini, Zizhao Zhang, Han Zhang, Colin A Raffel, Ekin Dogus Cubuk, Alexey Kurakin, and Chun-Liang Li. Fixmatch: Simplifying semi-supervised learning with consistency and confidence. Advances in neural information processing systems, 33:596-608, 2020. +Hao Tan and Mohit Bansal. Lxmert: Learning cross-modality encoder representations from transformers. arXiv preprint arXiv:1908.07490, 2019. +Mariya I Vasileva, Bryan A Plummer, Krishna Dusad, Shreya Rajpal, Ranjitha Kumar, and David Forsyth. Learning type-aware embeddings for fashion compatibility. In Proceedings of the European Conference on Computer Vision, pp. 390-405, 2018. +Tzu-Jui Julius Wang, Jorma Laaksonen, Tomas Langer, Heikki Arponen, and Tom E Bishop. Learning by hallucinating: Vision-language pre-training with weak supervision. In WACV, 2023a. +Wenhui Wang, Hangbo Bao, Li Dong, Johan Bjorck, Zhiliang Peng, Qiang Liu, Kriti Aggarwal, Owais Khan Mohammed, Saksham Singhal, Subhojit Som, et al. Image as a foreign language: Beit pretraining for vision and vision-language tasks. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 19175-19186, 2023b. +Ximei Wang, Jinghan Gao, Mingsheng Long, and Jianmin Wang. Self-tuning for data-efficient deep learning. In International Conference on Machine Learning, pp. 10738-10748, 2021a. +Zifeng Wang, Zhenbang Wu, Dinesh Agarwal, and Jimeng Sun. Medclip: Contrastive learning from unpaired medical images and text. In EMNLP, 2022. +Zirui Wang, Jiahui Yu, Adams Wei Yu, Zihang Dai, Yulia Tsvetkov, and Yuan Cao. Simvlm: Simple visual language model pretraining with weak supervision. arXiv preprint arXiv:2108.10904, 2021b. +Tong Wei and Kai Gan. Towards realistic long-tailed semi-supervised learning: Consistency is all you need. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 3469-3478, 2023. +Gui-Song Xia, Wen Yang, Julie Delon, Yann Gousseau, Hong Sun, and Henri Maitre. Structural high-resolution satellite image indexing. 2009. +Gui-Song Xia, Jingwen Hu, Fan Hu, Baoguang Shi, Xiang Bai, Yanfei Zhong, Liangpei Zhang, and Xiaoqiang Lu. Aid: A benchmark data set for performance evaluation of aerial scene classification. IEEE Transactions on Geoscience and Remote Sensing, 2017. +Shiyu Xia, Jiaqi Lv, Ning Xu, and Xin Geng. Ambiguity-induced contrastive learning for instance-dependent partial label learning. In *IJCAI*, pp. 3615–3621, 2022. + +Shiyu Xia, Jiaqi Lv, Ning Xu, Gang Niu, and Xin Geng. Towards effective visual representations for partial-label learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 15589-15598, 2023. +Shiyu Xia, Yuankun Zu, Xu Yang, and Xin Geng. Initializing variable-sized vision transformers from learngene with learnable transformation. In The Thirty-eighth Annual Conference on Neural Information Processing Systems, 2024. +Zhenda Xie, Zheng Zhang, Yue Cao, Yutong Lin, Jianmin Bao, Zhuliang Yao, Qi Dai, and Han Hu. Simmim: A simple framework for masked image modeling. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 9653-9663, 2022. +Fan Yang, Kai Wu, Shuyi Zhang, Guannan Jiang, Yong Liu, Feng Zheng, Wei Zhang, Chengjie Wang, and Long Zeng. Class-aware contrastive semi-supervised learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 14421-14430, 2022. +Kaicheng Yang, Jiankang Deng, Xiang An, Jiawei Li, Ziyong Feng, Jia Guo, Jing Yang, and Tongliang Liu. Alip: Adaptive language-image pre-training with synthetic caption. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 2922-2931, 2023. +Xuewen Yang, Heming Zhang, Di Jin, Yingru Liu, Chi-Hao Wu, Jianchao Tan, Dongliang Xie, Jue Wang, and Xin Wang. Fashion captioning: Towards generating accurate descriptions with semantic rewards. In Proceedings of the European Conference on Computer Vision, 2020. +Yi Yang and Shawn Newsam. Bag-of-visual-words and spatial extensions for land-use classification. In SIGSPATIAL international conference on advances in geographic information systems, 2010. +Lewei Yao, Runhui Huang, Lu Hou, Guansong Lu, Minzhe Niu, Hang Xu, Xiaodan Liang, Zhenguo Li, Xin Jiang, and Chunjing Xu. Filip: Fine-grained interactive language-image pre-training. arXiv preprint arXiv:2111.07783, 2021. +Bo Ye, Kai Gan, Tong Wei, and Min-Ling Zhang. Bridging the gap: Learning pace synchronization for open-world semi-supervised learning. In Proceedings of the Thirty-Third International Joint Conference on Artificial Intelligence, IJCAI 2024, Jeju, South Korea, August 3-9, 2024, pp. 5362-5370. ijcai.org, 2024. +Bowen Zhang, Yidong Wang, Wenxin Hou, Hao Wu, Jindong Wang, Manabu Okumura, and Takahiro Shinozaki. Flexmatch: Boosting semi-supervised learning with curriculum pseudo labeling. NeurIPS, 34:18408-18419, 2021. +Fan Zhang, Bo Du, and Liangpei Zhang. Saliency-guided unsupervised feature learning for scene classification. IEEE Transactions on Geoscience and Remote Sensing, 2014. +Kaiyang Zhou, Jingkang Yang, Chen Change Loy, and Ziwei Liu. Conditional prompt learning for vision-language models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 16816-16825, 2022a. +Kaiyang Zhou, Jingkang Yang, Chen Change Loy, and Ziwei Liu. Learning to prompt for vision-language models. International Journal of Computer Vision, 130(9):2337-2348, 2022b. +Luowei Zhou, Hamid Palangi, Lei Zhang, Houdong Hu, Jason Corso, and Jianfeng Gao. Unified vision-language pre-training for image captioning and vqa. In Proceedings of the AAAI conference on artificial intelligence, volume 34, pp. 13041-13049, 2020. +Qin Zou, Lihao Ni, Tong Zhang, and Qian Wang. Deep learning based feature selection for remote sensing scene classification. IEEE Geoscience and Remote Sensing Letters, 2015. + +# A ADDITIONAL EXPERIMENTS + +# A.1 DIFFERENT NEURAL NETWORK ARCHITECTURES + +We conduct experiments to evaluate the performance of SEMICLIP in zero-shot classification and image-text retrieval with different neural network architectures. As shown in Tabs. 7 and 8, SEMICLIP achieves an average performance improvement of $3.52\%$ on zero-shot classification and $0.28\%$ on image-text retrieval compared to S-CLIP when adopting ResNet-50 as the backbone. In addition, SEMICLIP exhibits averaged performance advantage of $2.62\%$ , $4.20\%$ , and $1.10\%$ over S-CLIP in zero-shot classification, image $\rightarrow$ text retrieval, and text $\rightarrow$ image retrieval when implemented with the ViT-B-32 architecture. This indicates that SEMICLIP can achieve consistent and significant performance advantages for different neural network architectures and model sizes. + +
ModelMethodRSICD-CLSUCM-CLSWHU-RS19RSSCN7AID
ResNet-50CLIP (original)45.350.565.558.947.8
CLIP (fine-tuned)58.3±0.363.5±3.476.5±3.261.9±1.263.1±1.3
S-CLIP66.9±1.7 (+8.6)66.7±1.6 (+3.2)86.9±2.0 (+10.4)66.2±1.1 (+4.3)73.0±0.3 (+9.9)
SEMICLIP72.0±2.1 (+13.7)73.6±1.4 (+10.1)87.2±2.4 (+10.7)68.9±0.4 (+7.0)75.6±1.7 (+12.5)
ViT-B-32CLIP (original)56.258.576.362.355.6
CLIP (fine-tuned)73.6±3.179.0±4.491.1±1.370.4±3.179.6±2.5
S-CLIP78.5±0.5 (+4.9)77.4±4.4 (-1.6)94.9±0.5 (+3.8)71.1±2.6 (+0.7)84.2±1.6 (+4.6)
SEMICLIP81.3±0.5 (+7.7)84.3±3.9 (+5.3)95.2±0.8 (+4.1)73.0±0.6 (+2.6)85.4±0.3 (+5.8)
ViT-B-16CLIP (original)59.260.281.269.059.6
CLIP (fine-tuned)75.7±2.280.1±6.892.2±1.570.7±5.579.8±3.8
S-CLIP81.4±1.8 (+5.7)81.3±3.4 (+1.2)95.9±1.8 (+3.7)75.1±2.0 (+4.4)86.4±1.7 (+6.6)
SEMICLIP83.8±1.0 (+8.1)85.6±3.4 (+5.5)96.6±1.2 (+4.4)75.3±1.9 (+4.6)87.4±0.5 (+7.6)
+ +Table 7: Zero-shot classification results on remote sensing datasets using different neural architectures. Parentheses indicate the performance gap from the supervised CLIP, and bolds denote the best results within each architecture. + +# A.2 HYPERPARAMETER SENSITIVITY + +Despite the impressive performance attained by our method, the inclusion of some parameters leads us to question whether these outstanding outcomes are a result of parameter tuning. Figure 3 presents the results of the parameter sensitivity experiments for $P$ (top- $P\%$ unlabeled images and surrogate captions are selected for training), $k$ (number of selected concepts for each unlabeled image), and $\mu$ (frequency threshold for concepts initialization). We observe that variations in $P$ and $k$ do not result in significant fluctuations in performance. However, when $\mu$ exceeds 5, the performance for zero-shot exhibits a noticeable decline. We believe this is due to a larger $\mu$ filtering out too many concepts, resulting in an insufficient number of concepts available for further consistency, which ultimately impacts model performance. Nevertheless, considering the strong performance of SEMICLIP across the majority of sensitivity experiments, it can be concluded that the performance advantage stems from its thoughtful design rather than an extensive reliance on parameter tuning. + +![](images/bf523ebf94f375d6af6fd25cb5cb197f2e6ce74c6a22a294a1f3c4f3c21e554c.jpg) +Figure 3: The sensitivity of P (\%), $k$ , and $\mu$ on remote sensing datasets. "ZS", "I2T", "T2I" denote the averaged zero-shot classification, image $\rightarrow$ text retrieval and text $\rightarrow$ image retrieval performance across various hyperparameter settings. + +![](images/7a02e39bde0e33dff7e717314e4173f008ce64c5219fc3159af4fca82fdb766d.jpg) + +![](images/ab415333c53f81e96f5820b1907619a85d5ab06e8c256c094f01e2d76c952b3b.jpg) + +
ModelMethodImage→text R@5Text→image R@5
RSICDUCMSydneyRSICDUCMSydney
ResNet-50CLIP (original)9.434.336.210.124.851.7
CLIP (fine-tuned)15.4±1.741.3±1.847.1±6.515.1±1.040.9±1.656.1±2.4
S-CLIP18.4±0.645.7±1.450.0±3.016.8±1.243.5±1.555.1±2.0
SEMICLIP18.6±1.946.2±1.049.6±1.517.1±0.744.3±2.155.4±1.8
ViT-B-32CLIP (original)12.137.641.412.935.237.9
CLIP (fine-tuned)24.5±0.656.3±1.547.1±5.024.6±1.057.0±1.150.0±4.6
S-CLIP25.0±0.855.7±2.543.1±3.023.9±0.559.2±1.851.7±1.7
SEMICLIP26.7±1.160.8±1.848.9±5.525.3±1.060.0±3.152.8±2.6
ViT-B-16CLIP (original)12.646.744.813.939.544.8
CLIP (fine-tuned)25.7±2.355.2±0.846.6±3.024.9±0.656.3±1.649.4±2.0
S-CLIP27.5±1.157.0±1.551.1±4.325.6±0.657.3±4.150.6±2.6
SEMICLIP27.6±1.659.2±2.253.4±4.626.4±0.458.4±2.458.0±2.0
+ +Table 8: Image-text retrieval results on remote sensing datasets using different neural architecture. Bolds denote the best results within the same setups. + +
MethodDataImage→text R@1Text→image R@1
RSICDUCMSydneyRSICDUCMSydney
CLIP (original)-4.517.110.33.69.012.1
CLIP (fine-tuned)L10.6±1.218.9±2.720.7±0.07.3±0.714.9±0.512.6±1.0
Hard-PL (Lee et al., 2013)11.4±1.717.0±2.917.9±2.86.8±0.514.1±2.320.7±3.0
Soft-PL (Assran et al., 2021)L=U11.6±1.219.2±1.120.7±3.07.1±0.413.7±0.620.3±5.6
S-CLIP (Mo et al., 2023)11.4±0.319.5±1.317.8±2.67.1±0.814.0±1.416.7±1.0
SEMICLIP (ours)12.0±0.620.3±1.721.8±4.07.6±0.914.9±2.821.3±3.6
Hard-PL (Lee et al., 2013)11.1±1.517.1±2.419.0±3.46.1±0.216.0±1.516.7±5.3
Soft-PL (Assran et al., 2021)L≠U11.2±0.416.0±1.516.7±3.66.5±0.215.1±2.218.4±1.0
S-CLIP (Mo et al., 2023)10.9±0.618.9±1.520.4±2.27.2±0.616.5±1.214.9±2.6
SEMICLIP (ours)11.5±0.522.1±0.520.7±3.47.3±0.517.7±1.717.8±4.3
+ +Table 9: Image-text retrieval results of R@1 on remote sensing datasets, following the same setup of Table 1. Bolds denote the best results within the same setups. + +# A.3 RESULTS FOR R@1 + +Tabs. 9 and 10 illustrate the R@1 performance of image-text retrieval for remote sensing and fashion datasets. For remote sensing datasets, SEMICLIP achieves performance advantages of $1.42\%$ and $1.70\%$ over S-CLIP in image $\rightarrow$ text and text $\rightarrow$ image retrieval, respectively. Similarly, on the fashion datasets, SEMICLIP achieves performance gains of $4.33\%$ and $3.70\%$ for image $\rightarrow$ text and text $\rightarrow$ image retrieval. It is evident that SEMICLIP achieves a more significant advantage on fashion datasets than remote sensing datasets, which we attribute to the larger sample size and greater diversity of the fashion datasets. This diversity makes it difficult for S-CLIP to identify suitable neighboring samples to generate effective pseudo-labels. + +# A.4 RESULTS FOR SMALLER BATCH SIZE + +All experiments in our main paper are conducted on four NVIDIA A6000 GPUs with a batch size of 64 per GPU. Given the potential limitations of computational resources, we conducted experiments to evaluate SEMICLIP on a single GPU, where the batch size is only one-quarter of that used in previous experiments. Tab. 11 reveals that SEMICLIP demonstrates a significant performance advantage over S-CLIP, achieving an average improvement of $7.54\%$ in zero-shot classification. Notably, the performance of S-CLIP is even $1.72\%$ lower than that of fine-tuning CLIP with only labeled image-text pairs, indicating its inability to achieve satisfactory performance with a smaller batch size due to the reliance on neighboring information within the batch and motivation under the paradigm of partial label learning (Xia et al., 2022; 2023). In contrast, SEMICLIP is less affected by batch size, consistently demonstrating robust improvements in the model's alignment capabilities. + +
MethodImage→text R@1Text→image R@1
Fashion200kFashionGenPolyvoreFashion200kFashionGenPolyvore
CLIP (original)4.710.911.44.512.513.0
CLIP (fine-tuned)4.8±0.312.9±0.46.4±0.24.2±0.013.0±0.06.2±0.1
Hard-PL (Lee et al., 2013)4.8±0.211.1±0.26.5±0.35.1±0.513.7±0.47.8±0.3
Soft-PL (Assran et al., 2021)5.6±0.314.7±0.48.2±0.25.3±0.415.4±0.59.8±0.0
S-CLIP (Mo et al., 2023)6.6±0.316.7±0.410.4±0.26.1±0.218.9±0.210.9±0.4
SEMICLIP (ours)9.3±0.324.0±0.313.4±0.58.7±0.125.2±0.513.1±0.3
+ +Table 10: Image-text retrieval results of R@1 on fashion datasets, following the same setup of Table 3. Bolds denote the best results within the same setups. + +
MethodRSICD-CLSUCM-CLSWHU-RS19RSSCN7AID
CLIP (original)59.260.281.269.059.6
CLIP (fine-tuned)75.3±2.777.2±7.692.3±2.972.4±3.279.7±3.5
Hard-PL (Lee et al., 2013)78.5±3.3 (+3.2)70.1±4.7 (-7.1)91.6±0.4 (-0.7)62.4±4.8 (-10.0)82.2±2.9 (+2.5)
Soft-PL (Assran et al., 2021)77.8±3.4 (+2.5)71.2±3.7 (-6.0)94.3±1.0 (+2.0)64.9±5.5 (-7.5)82.6±1.6 (+2.9)
S-CLIP (Mo et al., 2023)74.2±1.6 (-1.1)69.7±3.0 (-7.5)93.3±1.5 (+1.0)71.3±1.7 (-1.1)79.8±1.6 (+0.1)
SEMICLIP (ours)83.5±0.8 (+8.2)87.5±3.8 (+10.3)95.1±1.1 (+2.8)72.5±3.1 (+0.1)87.4±1.0 (+7.7)
+ +Table 11: Zero-shot classification results for batch size 64 of a single GPU on remote sensing datasets. We compare the original CLIP, supervised CLIP fine-tuned on labeled data, and semi-supervised methods that utilize unlabeled data sampled from the same distribution as the labeled data. Parentheses indicate the performance gap from the supervised CLIP, where values highlighted in green indicate gaps larger than one. Bolds denote the best results within the same setups. + +# B COMPETING METHODS + +We denote the pre-trained CLIP as CLIP (original) and the model fine-tuned only on image-text pairs as CLIP (fine-tuned). Following S-CLIP, we compare SEMICLIP with extensions of SSL methods, including Hard-PL and Soft-PL. + +**Hard-PL.** For an unlabeled image $I_{j}$ , Hard-PL searches for the labeled image within the same batch that is most similar to $I_{j}$ in terms of image embeddings and aligns its corresponding text with $I_{j}$ through Equation (1). + +Soft-PL. Soft-PL employs soft nearest neighbor (Assran et al., 2021) to achieve alignment for unlabeled images. Unlike Hard-PL, Soft-PL takes into account the cosine similarities between unlabeled image $I_{j}$ and multiple nearest neighbors in labeled data, and applies the softmax function to obtain the soft pseudo-label which tends to have a value close to one for visually similar images. More details can be found in Assran et al. (2021); Mo et al. (2023). + +S-CLIP. S-CLIP (Mo et al., 2023) features two innovative pseudo-labeling strategies: the caption-level pseudo-label combines captions from paired images by solving an optimal transport problem, while the keyword-level pseudo-label is derived from the nearest paired image's caption, employing partial label learning. It assumes a set of candidate labels for supervision instead of exact labels, enhancing contrastive learning and the integration of the language modality. S-CLIP and SEMICLIP are designed to improve performance by effectively utilizing additional unpaired data during training. + +# C MORE EXPLANATION FOR CAPTION-LEVEL TRAPEZOIDAL CONSISTENCY + +Distinctions between CyCLIP and Caption-level Trapezoidal Consistency. Considering that there exists some resemblance between CyCLIP and caption-level trapezoidal consistency (CTC), we delineate their differences and contributions of CTC below: + +- CTC introduces CyCLIP into the semi-supervised learning scenario by utilizing unlabeled images and surrogate captions, thereby extending the applicability of CyCLIP beyond complete image-text pairs. +- We found that CTC can partially alleviate the impact of noise in the captions on training and provided a geometric explanation through trapezoidal geometric representation aspect. + +- CTC offers new insights for future work addressing less-than-ideal alignment in image-text pairs, which is a widespread issue in practical settings. + +Why is CTC effective? We explain the reasons why CTC is effective below: + +- Traditional contrastive learning methods, such as CLIP, aim to reduce the distance between matching image-text pairs when learning image-text representations. However, they do not impose constraints on the overall geometric structure of the data, which leads to inconsistent predictions between the image and text spaces, especially in semi-supervised scenarios with only a small number of image-text pairs. Trapezoidal consistency addresses this issue by introducing equal-length legs and diagonals consistency regularization terms. These regularizers constrain the similarity gaps between mismatched image-text pairs as well as image-image and text-text pairs, resulting in a more consistent and structured representation space, thereby improving prediction consistency. +- Trapezoidal consistency can ensure geometric alignment between image and text representations, allowing the model to make more consistent predictions when reasoning in both the image and text spaces. This means that the image and text representations learned by trapezoidal consistency can be more easily interchanged, leading to improved performance on downstream tasks. +- The rigid separation between the positive pairs and negative pairs enforced by the contrastive loss in CLIP may degrade performance when some pairs in the negative batch belong to a similar entity (Mu et al., 2022). Trapezoidal consistency poses constraints on the overall geometry of all the data pairs rather than forcing a rigid separation, which enables the interaction of information between intra-modal and cross-modal samples, even in data-scarce scenarios. + +# D MORE EXAMPLES FOR PREDICTED CONCEPTS + +Figure 4 presents additional examples of predicted concepts for unlabeled images on remote sensing and fashion datasets. We observe that although some concepts do not explicitly appear in the ground-truth captions, they are still highly semantically relevant to the unlabeled images, as illustrated by "stadium" in Figure 4a and "midi" in Figure 4d. The strong semantic alignment of the extracted concepts with the images provides a solid foundation for the subsequent concept-level semantic consistency and caption-level trapezoidal consistency in proposed SEMICLIP. + +# E WHY SEMICLIP CAN OUTPERFORM ORACLE IN SOME SETTINGS? + +Interestingly, we find that our method can outperforms the oracle in some zero-shot settings. We believe this is due to the severe imbalance in the proportions of the sub-datasets within the training sets, RS-ALL and Fashion. When training on the full dataset, sub-datasets with a smaller proportion, such as UCM in Tab. 1, perform poorly on their corresponding zero-shot test set(UCM-CLS), which resulted in a slightly lower overall performance. We find this to be an interesting phenomenon, and it warrants further research into how to mitigate the issue of imbalance in the proportions of the sub-datasets. + +The oracle outperforms SEMICLIP in retrieval performance, indicating that increasing the amount of labeled data will significantly improve retrieval performance. This also points to a potential direction for further improvement of SEMICLIP in the future. + +# F THE SIZE OF DATASETS + +For remote sensing datasets, the RSICD, UCM, and Sydney datasets contain 8734, 1680, and 497 image-text pairs, respectively. The three datasets constitute RS-ALL, and we randomly select $10\%$ of the image-text pairs from the training set as labeled data, with the remaining pairs treated as unlabeled. During the inference, the sizes for classification datasets are shown in Tab. 12. + +For fashion datasets, the Fashion200k, FashionGen, and Polyvore datasets contain 61753, 60147, and 71967 image-text pairs, respectively. The sizes for classification datasets are shown in Tab. 13. + +![](images/6bf62b8cc19c78c381aad040c96bd775374327c23f5f4d97b48e4b3b62b81005.jpg) +(a) + +Image caption: "Some sparse buildings and several ponds are in a resort area with many farmlands." + +Predicted concepts :resort, pond, lake, bareland + +![](images/1617e4cc2ebf5af8ed409773dd97090ea22de02b13a5223777cfd592349f1590.jpg) + +Image caption: "Many buildings and green plants are around a baseball field." + +Predicted concepts: stadium, playground, baseball, field + +![](images/09623161d8bcfbd549815ad5440db684e483098c05e92ca2198cbf162214ed09.jpg) +(c) + +Image caption: "Multicolor faux fur panel biker jacket." + +Predicted concepts: jacket, biker, fur, leather + +![](images/4ee99049188e9945edf997bc32c21a0217588fe1cbd1cbd5e70085571d0b49d3.jpg) +Figure 4: (4a and 4b) More examples for predicted concepts for unlabeled images in remote sensing datasets; (4c and 4d) More examples for predicted concepts for unlabeled images in fashion datasets. + +Image caption: "Black scoop neck silk blend lean tee." + +Predicted concepts: tee, neck, sleeve, blouse + +![](images/4e7e4409ea2ccd429a6d89bbc72554e52d0f71ff671ba98681fea42066bf3b72.jpg) +(b) + +Image caption: "Several boats are in a port near many red buildings." + +Predicted concepts: port, boats, wharf, buildings + +Image caption: "A green pond is surrounded by cropped meadow." + +Predicted concepts: pond, farmlands, pool, meadows + +![](images/3cc08c8b8b5482b6a95272c8fb50d30eb0a83c01f8d0450c52d1604f7c181a0c.jpg) +(d) + +Image caption : "Black women's dara skirt." + +Predicted concepts: women, skirt, midi, knit + +Image caption: "Gray erin wrapper sleeveless neck tie blouse." + +Predicted concepts: tie, blouse, neck, silk + +Table 12: The size of zero-shot classification datasets in the remote sensing domain. + +
RSICD-CLSUCM-CLSWHU-RS19RSSCN7AID
Number of images109421001005280010000
Number of classes312119730
+ +Table 13: The size of zero-shot classification datasets in the fashion domain. + +
Fashion200kFashionGenPolyvore
Super-classSub-classSuper-classSub-classClass
Number of images29,78532,52814,657
Number of classes5314812111
+ +For other datasets, SciCap contains 106934 image-text pairs and Simpsons only contains 720 pairs. + +# G THE COMPARISON WITH NLIP + +Due to concept labeler in Nlip (Huang et al., 2023) looks similar to semantic concepts mining, the differences are as follows: + +- We train a linear classifier to achieve better image-concept alignment in task-specific domain, while concept labeler in Huang et al. (2023) obtains concepts through image-concept retrieval, which may not enable effective retrieval in certain specialized domains due to the niche nature of some concepts. +- Concepts generated in Nlip are considered as conditional input to the cross-modal decoder, which requires a large amount of data for training, significantly increasing the overhead. However, SEMICLIP can be trained with only a small amount of labeled data, achieving significant improvements in model performance in semi-supervised settings. + +# H THE ANALYSIS OF PROMPTING STRATEGY + +We analyze the prompting strategy experimentally for a more in-depth investigation. + +Comparing performance with prompts at different positions. We conducted experiments on the effect of prompts at different positions, with all prompts initialized using a normal distribution for fair comparison. Overall, as shown in Tab. 14, the performance is slightly better when the prompts are positioned in the middle, which is why we use this approach in our experiments. + +Table 14: Effects of incorporating prompts at various positions. + +
PositionBeginningMiddleEnd
ZSI2TT2IZSI2TT2IZSI2TT2I
Accuracy or Recall84.232.230.984.932.330.684.431.730.3
+ +Different Prompts initialization. From the results in Tab. 15, we found that zero initialization performed poorly in zero-shot tasks, with $1.1\%$ lower performance compared to SEMICLIP, but showed no significant decline in retrieval performance. Normal initialization performs slightly worse than our proposed method in both zero-shot and retrieval tasks. Overall, SEMICLIP's initialization method achieves the most robust and stable performance. + +Table 15: Effects of incorporating prompts of different initialization. + +
InitializationZeroNormalSemiCLIP
ZSI2TT2IZSI2TT2IZSI2TT2I
Accuracy or Recall84.632.531.084.932.330.685.732.431.1
+ +Fixed vs learnable prompts. The results in Tab. 6 show that learnable prompts achieve an average performance advantage of $0.9\%$ over fixed prompts, which indicates that learnable prompts facilitate improved model adaptation to task-specific domains. + +# I EFFECTS OF DIFFERENT Labeled DATA PERCENTAGES + +The experimental results in Figure 5 show that SEMICLIP consistently outperforms S-CLIP across different label proportion settings. In settings with a low proportion of labeled data, the quality of extracted concepts is impacted. However, methods like S-CLIP, which rely on labeled data to construct neighbor labels, will experience a more significant performance drop in such scenarios. The above experiments demonstrate the robustness of the proposed training framework under different proportions of labeled data. + +![](images/f017651723df362b77ed9d364800826c88a5af3f9f4042830c43f7306ef4728e.jpg) +Figure 5: Ablation study regarding different percentages of labeled data. + +![](images/a672cd225e6fa4dd607cb38913bbe9cf8acea378b3b8753a952ee04828521903.jpg) + +![](images/8fad1bb945b30324a778b396d07c3ecdff419997b61939f70686d41dc3823ddb.jpg) + +# J EXPERIMENTS ON GENERAL BENCHMARKS + +To evaluate the performance of SEMICLIP on general benchmarks, we conducted comparative experiments on the COCO (Lin et al., 2014) dataset. The results in Tab. 16 indicate that SEMICLIP + +
Method1% labeled10% labeled
Image→textText→imageImage→textText→image
R@1R@5R@1R@5R@1R@5R@1R@5
CLIP (fine-tuned)33.7±1.360.2±0.933.6±1.160.5±2.035.6±1.265.0±2.836.9±1.565.0±1.3
S-CLIP (Mo et al., 2023)29.5±1.854.8±0.927.8±1.453.8±1.133.2±1.260.6±3.131.7±1.659.1±1.0
SEMICLIP (ours)37.8±1.264.4±3.137.6±1.265.7±3.841.4±1.370.3±1.242.6±2.969.8±2.4
+ +Table 16: The retrieval performance on COCO. + +can achieve significant performance improvements on general benchmark over CLIP (fine-tuned) and S-CLIP. It is worth noting that S-CLIP's performance shows an average decrease of $4.5\%$ compared to CLIP (fine-tuned), aligning with the paper's claim (Mo et al., 2023) that S-CLIP experiences performance drops when trained on a small number of image-text pairs in common datasets like COCO. However, the superior performance of our proposed SEMICLIP is unaffected by the different types of datasets, achieving significant improvements on both commonly used datasets and task-specific datasets. \ No newline at end of file diff --git a/ICLR/2025/Semi-Supervised CLIP Adaptation by Enforcing Semantic and Trapezoidal Consistency/images.zip b/ICLR/2025/Semi-Supervised CLIP Adaptation by Enforcing Semantic and Trapezoidal Consistency/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..4671b8bfb2dd3b0ed9dda2dbcd2654df54d6087b --- /dev/null +++ b/ICLR/2025/Semi-Supervised CLIP Adaptation by Enforcing Semantic and Trapezoidal Consistency/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6d71021f8b3c455067cde2eb1d96ccea76ae81ef143661234c3324ae22cca505 +size 993590 diff --git a/ICLR/2025/Semi-Supervised CLIP Adaptation by Enforcing Semantic and Trapezoidal Consistency/layout.json b/ICLR/2025/Semi-Supervised CLIP Adaptation by Enforcing Semantic and Trapezoidal Consistency/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..ff698c474c9d5076cd960ed85133bb28292c2155 --- /dev/null +++ b/ICLR/2025/Semi-Supervised CLIP Adaptation by Enforcing Semantic and Trapezoidal Consistency/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d4b8e6d9ed0b94974a1f96c819d32d4e4165023161446830be6eac93aa7bc9aa +size 682867 diff --git a/ICLR/2025/Semi-Supervised Vision-Centric 3D Occupancy World Model for Autonomous Driving/6195a461-6509-48d5-9136-f76008d5522b_content_list.json b/ICLR/2025/Semi-Supervised Vision-Centric 3D Occupancy World Model for Autonomous Driving/6195a461-6509-48d5-9136-f76008d5522b_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..2cc1819618a9b13aacc4a936aa56e8aea189da0d --- /dev/null +++ b/ICLR/2025/Semi-Supervised Vision-Centric 3D Occupancy World Model for Autonomous Driving/6195a461-6509-48d5-9136-f76008d5522b_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1883f564937746d0c410f9f49cb0e5af3bb9076bf06ce0a53509d0872ba731f3 +size 112201 diff --git a/ICLR/2025/Semi-Supervised Vision-Centric 3D Occupancy World Model for Autonomous Driving/6195a461-6509-48d5-9136-f76008d5522b_model.json b/ICLR/2025/Semi-Supervised Vision-Centric 3D Occupancy World Model for Autonomous Driving/6195a461-6509-48d5-9136-f76008d5522b_model.json new file mode 100644 index 0000000000000000000000000000000000000000..79686d06c70d20bb96807b75f5b3a36141315e00 --- /dev/null +++ b/ICLR/2025/Semi-Supervised Vision-Centric 3D Occupancy World Model for Autonomous Driving/6195a461-6509-48d5-9136-f76008d5522b_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1e89d0708aaf4abbc104e26af61926880787838cbefaa0d9d6d206da978c1189 +size 131310 diff --git a/ICLR/2025/Semi-Supervised Vision-Centric 3D Occupancy World Model for Autonomous Driving/6195a461-6509-48d5-9136-f76008d5522b_origin.pdf b/ICLR/2025/Semi-Supervised Vision-Centric 3D Occupancy World Model for Autonomous Driving/6195a461-6509-48d5-9136-f76008d5522b_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..6709af5b6fe3c49fb513c2617a0046bdff599223 --- /dev/null +++ b/ICLR/2025/Semi-Supervised Vision-Centric 3D Occupancy World Model for Autonomous Driving/6195a461-6509-48d5-9136-f76008d5522b_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d2bbd9a221362792a149d311b849bc75b536f0413ffcc7ce42f0b9449ae3a091 +size 6036735 diff --git a/ICLR/2025/Semi-Supervised Vision-Centric 3D Occupancy World Model for Autonomous Driving/full.md b/ICLR/2025/Semi-Supervised Vision-Centric 3D Occupancy World Model for Autonomous Driving/full.md new file mode 100644 index 0000000000000000000000000000000000000000..543964fcc242d70b0abadd57df1d7661a0b83b66 --- /dev/null +++ b/ICLR/2025/Semi-Supervised Vision-Centric 3D Occupancy World Model for Autonomous Driving/full.md @@ -0,0 +1,361 @@ +# SEMI-SUPERVISED VISION-CENTRIC 3D OCCUPANCY WORLD MODEL FOR AUTONOMOUS DRIVING + +Xiang Li, Pengfei Li, Yupeng Zheng, Wei Sun, Yan Wang*, Yilun Chen* + +Institute for AI Industry Research (AIR), Tsinghua University + +l-x21@mails.tsinghua.edu.cn; wangyan@air.tsinghua.edu.cn + +# ABSTRACT + +Understanding world dynamics is crucial for planning in autonomous driving. Recent methods attempt to achieve this by learning a 3D occupancy world model that forecasts future surrounding scenes based on current observation. However, 3D occupancy labels are still required to produce promising results. Considering the high annotation cost for 3D outdoor scenes, we propose a semi-supervised vision-centric 3D occupancy world model, PreWorld, to leverage the potential of 2D labels through a novel two-stage training paradigm: the self-supervised pretraining stage and the fully-supervised fine-tuning stage. Specifically, during the pre-training stage, we utilize an attribute projection head to generate different attribute fields of a scene (e.g., RGB, density, semantic), thus enabling temporal supervision from 2D labels via volume rendering techniques. Furthermore, we introduce a simple yet effective state-conditioned forecasting module to recursively forecast future occupancy and ego trajectory in a direct manner. Extensive experiments on the nuScenes dataset validate the effectiveness and scalability of our method, and demonstrate that PreWorld achieves competitive performance across 3D occupancy prediction, 4D occupancy forecasting and motion planning tasks. $^1$ + +![](images/196976447f50119bf7b1ee99929c7abecbbb008bb5b1b6a92660d81568a1219a.jpg) +Figure 1: (a) Self-Supervised 3D Occupancy Model can be trained using solely 2D labels as supervision. However, it lacks the capability to forecast future occupancy. In contrast, (b) Fully-Supervised 3D Occupancy World Model can forecast future occupancy, but it relies on 3D occupancy labels for meaningful results due to its indirect architecture, which employs a frozen 3D occupancy model. To tackle these challenges, our (c) Semi-Supervised 3D Occupancy World Model, featuring 2D rendering supervision and an end-to-end architecture, can forecast future occupancy straightly from image inputs while taking advantage of 2D labels. + +# 1 INTRODUCTION + +3D scene understanding forms the cornerstone of autonomous driving, exerting a direct influence on downstream tasks such as planning and navigation. Among various 3D scene understanding tasks (Wang et al., 2022; Li et al., 2022a; Wei et al., 2023; Jin et al., 2024), 3D Occupancy Prediction plays a crucial role in autonomous systems. Its objective is to predict the semantic occupancy of each voxel throughout the entire scene from limited observation. To this end, some previous methods (Liong et al., 2020; Cheng et al., 2021; Xia et al., 2023) prioritize LiDAR as input modality due to its robust performance in capturing accurate geometric information. Nevertheless, they are often considered hardware-expensive. Consequently, there has been a shift towards vision-centric solutions in recent years (Zhang et al., 2023c; Li et al., 2023a; Zheng et al., 2024). + +Despite significant advancements in aforementioned methods, they primarily focus on enhancing better perception of the current scene. For advanced collision avoidance and route planning, autonomous vehicles need to not only comprehend the current scene but also forecast the evolution of future scenes based on the understanding of world dynamics. Therefore, 4D Occupancy Forecasting has been introduced to forecast future 3D occupancy given historical observations. Recent works have aimed to achieve this by learning a 3D occupancy world model (Zheng et al., 2023; Wei et al., 2024). However, when processing image inputs, these methods follow an circuitous path, as shown in Fig 1 (b). Typically, a pre-trained 3D occupancy model is employed to obtain current occupancy, which is then fed into a forecasting module to generate future occupancy. The forecasting module includes a tokenizer that encodes occupancy into discrete tokens, an autoregressive architecture to generate future tokens, and a decoder to obtain future occupancy. Information loss is prone to occur in such repeated encoding and decoding processes. Hence, existing methods heavily rely on 3D occupancy labels as supervision to produce meaningful results, leading to notable annotation costs. + +In contrast to 3D occupancy labels, 2D labels are relatively easier to acquire. Recently, employing purely 2D labels for self-supervised learning has shown some promising results in 3D occupancy prediction task, as illustrated in Fig 1 (a). By utilizing volumetric rendering, RenderOcc (Pan et al., 2024) employs 2D depth maps and semantic labels to train the model. Methods like SelfOcc (Huang et al., 2024) and OccNerf (Zhang et al., 2023a) take a step further, using only image sequences as supervision. However, there have not been similar attempts in 4D occupancy forecasting task. + +Based on the above observations, we propose PreWorld, a semi-supervised vision-centric 3D occupancy world model, designed to fulfill the utility of 2D labels during training, while achieving competitive performance across both 3D occupancy prediction and 4D occupancy forecasting tasks, as shown in Fig 1 (c). To this end, we propose a novel two-stage training paradigm: the self-supervised pre-training stage and the fully-supervised fine-tuning stage. Inspired by RenderOcc, during the pre-training stage, we introduce an attribute projection head to obtain diverse attribute fields of current and future scenes (e.g., RGB, density, semantic), facilitating temporal supervision through 2D labels using volume rendering techniques. Moreover, we propose a simple yet effective state-conditioned forecasting module, which allows us to simultaneously optimize occupancy network and forecasting module, and directly forecast future 3D occupancy based on multi-view image inputs in an end-to-end manner, thus avoiding possible information loss. + +To demonstrate the effectiveness of PreWorld, we conduct extensive experiments on the widely used Occ3D-nuScenes benchmark (Tian et al., 2024) and compare with recent methods using both 2D and/or 3D supervision. Experimental results indicate that our approach can yield competitive performance across multiple tasks. For 3D occupancy prediction, PreWorld outperforms the previous best method OccFlowNet (Boeder et al., 2024) with an mIoU of 34.69 over 33.86. For 4D occupancy forecasting, PreWorld sets the new SOTA performance, outperforming existing methods OccWorld (Zheng et al., 2023) and OccLLaMA (Wei et al., 2024). For motion planning, PreWorld yields comparable and often better results than other vision-centric methods (Hu et al., 2022; Jiang et al., 2023; Tong et al., 2023). Furthermore, we validate the scalability of our two-stage training paradigm, showcasing its potential for large-scale training. + +Our main contributions are as follows: + +- A semi-supervised vision-centric 3D occupancy world model, PreWorld, which takes advantage of both 2D labels and 3D occupancy labels during training. + +- A novel two-stage training paradigm, the effectiveness and scalability of which has been validated by extensive experiments. +- A simple yet effective state-conditioned forecasting module, enabling simultaneous optimization with occupancy network and direct future forecasting based on visual inputs. +- Extensive experiments compared to SOTA method, demonstrating that our method achieves competitive performance across multiple tasks, including 3D occupancy prediction, 4D occupancy forecasting and motion planning. + +# 2 RELATED WORK + +# 2.1 3D OCCUPANCY PREDICTION + +Due to its vital application in autonomous driving, 3D occupancy prediction has attracted considerable attention. According to the input modality, existing methods can be broadly categorized into LiDAR-based and vision-centric methods. While LiDAR-based methods excel in capturing geometric details (Tang et al., 2020; Ye et al., 2021; 2023), vision-centric methods have garnered growing interest in recent years due to their rich semantic information, cost-effectiveness, and ease of deployment (Philion & Fidler, 2020; Liu et al., 2023; Ma et al., 2024). However, these methods focus solely on understanding the current scene while ignoring the forecasting of future scene changes. Therefore in this paper, we follow the approach of OccWorld (Zheng et al., 2023) and endeavor to address both of these tasks in a unified manner. + +# 2.2 WORLD MODELS FOR AUTONOMOUS DRIVING + +The objective of world models is to forecast future scenes based on action and past observations (Ha & Schmidhuber, 2018). In autonomous driving, world models can be utilized to generate synthetic data and aid in decision making. Some previous approaches (Hu et al., 2023a; Gao et al., 2023; Wang et al., 2024) aim to generate image sequences of outdoor driving scenarios using large pretrained generative models. However, relying on 2D images as scene representations leads to the lack of structural information. Some works (Khurana et al., 2022; 2023; Zhang et al., 2023b) tend to generate 3D point clouds, which on the other hand, fail to capture the semantic of the scene. + +Recent attempts have emerged to generate 3D occupancy representations, which combine an understanding of both semantic and geometric information. The pioneering OccWorld (Zheng et al., 2023) introduces the 3D occupancy world model that, employing an autoregressive architecture, can forecast future occupancy based on current observation. Taking it a step further, OccLLaMA (Wei et al., 2024) integrates occupancy, action, and language, enabling 3D occupancy world model to possess reasoning capabilities. However, when it comes to vision-centric approaches, they both adopt an indirect path, requiring the usage of pre-trained 3D occupancy models for current occupancy prediction, succeeded by an arduous encoding-decoding process to forecast future occupancy. This manner poses challenges in model training, thus necessitating 3D occupancy labels as supervision to yield effective results. Considering this, we explore a straightforward way to directly forecast future occupancy using image inputs. + +# 2.3 SELF-SUPERVISED 3D OCCUPANCY PREDICTION + +While 3D occupancy provides rich structural information for training, it necessitates expensive and laborious annotation processes. In contrast, 2D labels are more readily obtainable, presenting an opportunity for self-supervised 3D occupancy prediction. Recently, some works have explored using Neural Radiance Fields (NeRFs) (Mildenhall et al., 2021) to perform volume rendering of scenes, thereby enabling 2D supervision for the model. RenderOcc (Pan et al., 2024) tends to use 2D depth maps and semantic labels for training. Despite significant performance gaps compared to existing methods, SelfOcc (Huang et al., 2024) and OccNeRF (Zhang et al., 2023a) have made meaningful attempts, aiming to solely utilize image sequences for self-supervised learning. + +On the contrary, self-supervised approaches have not yet been observed in the realm of 4D occupancy forecasting tasks. Although OccWorld (Zheng et al., 2023) offers a self-supervised setting, it merely relies on an existing self-supervised 3D occupancy model to produce current occupancy + +![](images/f6624c91ed2fc87aa386c75a1543853a8b58861a25ac54573f404afb63542d80.jpg) +Figure 2: The architecture of our proposed PreWorld. Firstly, volume features are extracted from multi-view images with an occupancy network. Subsequently, a state-conditioned forecasting module is employed to recursively forecast future volume features using historical features. In the self-supervised pre-training stage, volume features are projected into various attribute fields and supervised by 2D labels through volume rendering techniques. In the fully-supervised fine-tuning stage, the attribute projection head no longer participates in the computations, occupancy predictions are directly obtained via an occupancy head and supervised by 3D occupancy labels. + +without engaging in novel endeavors, and it also suffers from subpar performance. Different from OccWorld, we attempt to directly supervise future scenes using 2D labels, thereby optimizing our performance in both 3D occupancy prediction and 4D occupancy forecasting tasks simultaneously. + +# 3 METHOD + +# 3.1 REVISITING 4D OCCPUANCY FORECASTING + +For the vehicle at timestamp $T$ , vision-centric 3D occupancy prediction task takes $N$ views of images $S_{T} = \{I^{1}, I^{2}, \dots, I^{N}\}$ as input and predicts current 3D occupancy $\hat{Y}_{T} \in \mathbb{R}^{X \times Y \times Z \times C}$ as output, where $(X, Y, Z)$ denote the resolution of the 3D volume and $C$ represents the number of semantic categories, including non-occupied (Huang et al., 2023; Zhang et al., 2023c; Liu et al., 2023; Pan et al., 2024). A 3D occupancy model $\mathbb{O}$ typically comprises an occupancy network $\mathcal{N}$ and an occupancy head $\mathcal{H}$ . The process of occupancy prediction can be formulated as: + +$$ +F _ {T} = \mathcal {N} \left(S _ {T}\right), \hat {Y} _ {T} = \mathcal {H} \left(F _ {T}\right), \tag {1} +$$ + +where $\mathcal{N}$ extracts 3D volume features $F_{T} \in \mathbb{R}^{X \times Y \times Z \times D}$ from 2D image inputs ( $D$ denotes the dimension of volume features), and $\mathcal{H}$ serves as a decoder to convert $F_{T}$ into 3D occupancy. + +Vision-centric 4D occupancy forecasting task, on the other hand, utilizes an image sequence of past $k$ frames $\{S_T,S_{T - 1},\dots ,S_{T - k}\}$ as input, aiming at forecasting 3D occupancy of future $f$ frames (Zheng et al., 2023; Wei et al., 2024). A 3D occupancy world model $\mathbb{W}$ attempt to achieve this by adopting an auto-regressive manner: + +$$ +\hat {Y} _ {T + 1} = \mathbb {W} \left(S _ {T}, S _ {T - 1}, \dots , S _ {T - k}\right). \tag {2} +$$ + +To this end, $\mathbb{W}$ employs an available 3D occupancy model $\mathbb{O}$ to predict 3D occupancy of past $k$ frames $\{\hat{Y}_T,\dots,\hat{Y}_{T-k}\}$ , and leverages a scene tokenizer $\mathcal{T}$ , an autoregressive architecture $\mathcal{A}$ and a decoder $\mathcal{D}$ to forecast future 3D occupancy. After obtaining historical occupancy, $\mathbb{W}$ encodes 3D occupancy into discrete tokens $\{z_T,\dots,z_{T-k}\}$ through $\mathcal{T}$ . Subsequently, $\mathcal{A}$ is utilized to forecast future token $z_{T+1}$ based on these tokens, which is then input into $\mathcal{D}$ to generate future occupancy $\hat{Y}_{T+1}$ . Formally, the process of occupancy forecasting can be formulated as follows: + +$$ +\hat {Y} _ {T}, \dots , \hat {Y} _ {T - k} = \mathbb {O} (S _ {T}), \dots , \mathbb {O} (S _ {T - k}), +$$ + +$$ +z _ {T}, \dots , z _ {T - k} = \mathcal {T} \left(\hat {Y} _ {T}\right), \dots , \mathcal {T} \left(\hat {Y} _ {T - k}\right), \tag {3} +$$ + +$$ +z _ {T + 1} = \mathcal {A} (z _ {T}, \dots , z _ {T - k}), \hat {Y} _ {T + 1} = \mathcal {D} (z _ {T + 1}). +$$ + +Here, we need to mention that $\mathbb{O}$ is pre-trained and frozen during training. For example, OccWorld (Zheng et al., 2023) utilizes TPVFormer (Huang et al., 2023) as $\mathbb{O}$ , while OccLLaMA (Wei et al., 2024) chooses FB-OCC (Li et al., 2023c). + +# 3.2 STATE-CONDITIONED FORECASTING MODULE + +Different from these approaches, we tend to a more straightforward path, which enables us to optimize 3D occupancy model and forecasting module simultaneously. Specially, we employ a state-conditioned forecasting module $\mathcal{F}$ instead of the combination of $\mathcal{T},\mathcal{A}$ and $\mathcal{D}$ , as illustrated in Fig 3. We formulate our approach of occupancy forecasting as follows: + +$$ +\tilde {F} _ {T} = \mathcal {N} (S _ {T}, S _ {T - 1},..., S _ {T - k}), \tilde {F} _ {T + 1} = \mathcal {F} (\tilde {F} _ {T}), \hat {Y} _ {T + 1} = \mathcal {H} (\tilde {F} _ {T + 1}), \tag {4} +$$ + +where we leverages $\mathcal{N}$ to extract volume features $\tilde{F}_T$ from temporal images, $\mathcal{F}$ to directly forecast future volume features $\tilde{F}_{T + 1}$ and $\mathcal{H}$ to transform $\tilde{F}_{T + 1}$ into future occupancy $\hat{Y}_{T + 1}$ . + +![](images/f84f686c5443f59b9c084c7d73f0cb9e4f73533ffb7415d1d10c48f54fa725cc.jpg) +Figure 3: The proposed state-conditioned forecasting module is simply composed of two MLPs. Ego states can be optionally integrated into the network, as denoted by the dashed arrows. + +Without loss of generality, our forecasting module is simply composed of two MLPs. We demonstrate that even without intricate design, this simple architecture can still achieve comparable and even superior results to state-of-the-art methods. This design showcases that previous practice of solely optimizing the forecasting module during training has its limitations. By simultaneously optimizing the occupancy network and forecasting module, 3D occupancy world models can achieve stronger performance. Additionally, our module can optionally incorporate ego-state information such as speed, acceleration and historical trajectories into the network. In Section 4.3, we demonstrate that this approach can further enhance the forecasting capabilities of the model. + +Furthermore, this architecture brings an additional benefit for us. Given that previous forecasting modules encode scenes into discrete tokens, they cannot directly supervise future predictions with 2D labels via volume rendering, as done by self-supervised 3D occupancy models (Zhang et al., 2023a; Huang et al., 2024). Since our module preserves the volume features of future scenes, it provides an opportunity to train 3D occupancy world models in a self-supervised manner. + +# 3.3 TEMPORAL 2D RENDERING SELF-SUPERVISION + +Attribute Projection. Inspired by Pan et al. (2024), we transform the temporal volume feature sequence of current and future $f$ frames $\{\tilde{F}\}_{t} = \{\tilde{F}_T, \tilde{F}_{T+1}, \dots, \tilde{F}_{T+f}\}$ into temporal attribute fields $\{\tilde{A}\}_{t}$ through an attribute projection head $\mathcal{P}$ : + +$$ +\{\tilde {A} \} _ {t} = \{(\tilde {\sigma}, \tilde {s}, \tilde {c}) \} _ {t} = \mathcal {P} (\{\tilde {F} \} _ {t}), \tag {5} +$$ + +where $\tilde{\sigma} \in \mathbb{R}^{X \times Y \times Z \times 1}$ , $\tilde{s} \in \mathbb{R}^{X \times Y \times Z \times D}$ and $\tilde{c} \in \mathbb{R}^{X \times Y \times Z \times 3}$ denote the density, semantic and RGB fields of the 3D volume, respectively. In implementation, $\mathcal{P}$ comprises several MLPs, which is validated to be a simple yet effective method (Boeder et al., 2024). + +Ray Generation. Given the intrinsic and extrinsic parameters of camera $j$ at timestamp $i$ , we can extract a set of 3D rays $\{r\}_i^j$ , where each ray $r$ originates from camera $j$ and corresponds to a pixel of the image $I_i^j$ . Additionally, we can utilize ego pose matrices to transform rays from adjacent $n$ frames to current frame, enabling better capture of surrounding information. These rays collectively constitute the set $\{r\}_i$ utilized for supervising $\tilde{A}_i = (\tilde{\sigma}_i, \tilde{s}_i, \tilde{c}_i)$ . + +Volume Rendering. For each $r \in \{r\}_i$ , we sample $M$ points $\{u_m\}_{m=1}^M$ along the ray. Then the rendering weight $w(u_m)$ of each sampled point $u_m$ can be computed by: + +$$ +T \left(u _ {m}\right) = \exp \left(- \sum_ {p = 1} ^ {m - 1} \tilde {\sigma} _ {i} \left(u _ {p}\right) \delta_ {p}\right), w \left(u _ {m}\right) = T \left(u _ {m}\right) \left(1 - \exp \left(- \tilde {\sigma} _ {i} \left(u _ {m}\right) \delta_ {m}\right)\right), \tag {6} +$$ + +where $T(u_{m})$ denotes the accumulated transmittance until $u_{m}$ , and $\delta_{m} = u_{m + 1} - u_{m}$ denotes the interval between adjacent sampled points. Finally, the 2D rendered depth, semantic and RGB predictions $(\hat{d}_i^{2D}(r),\hat{s}_i^{2D}(r),\hat{c}_i^{2D}(r))$ can be computed by cumulatively summing the products of the values corresponding to each point along the ray and their respective rendering weights: + +$$ +\hat {d} _ {i} ^ {2 D} (r) = \sum_ {m = 1} ^ {M} w (u _ {m}) u _ {m}, \hat {s} _ {i} ^ {2 D} (r) = \sum_ {m = 1} ^ {M} w (u _ {m}) \tilde {s} _ {i} (u _ {m}), \hat {c} _ {i} ^ {2 D} (r) = \sum_ {m = 1} ^ {M} w (u _ {m}) \tilde {c} _ {i} (u _ {m}). \qquad (7) +$$ + +Temporal 2D Rendering Supervision. After acquiring 2D rendered predictions $(\hat{d}_i^{2D},\hat{s}_i^{2D},\hat{c}_i^{2D})$ with 3D ray set $\{r\}_{i}$ , the temporal 2D rendering loss can be formulated as: + +$$ +\mathcal {L} _ {2 D} = \sum_ {i = T} ^ {T + f} \lambda_ {d e p} \mathcal {L} _ {d e p} \left(d _ {i} ^ {2 D}, \hat {d} _ {i} ^ {2 D}\right) + \lambda_ {s e m} \mathcal {L} _ {s e m} \left(s _ {i} ^ {2 D}, \hat {s} _ {i} ^ {2 D}\right) + \lambda_ {R G B} \mathcal {L} _ {R G B} \left(c _ {i} ^ {2 D}, \hat {c} _ {i} ^ {2 D}\right), \tag {8} +$$ + +where $(d_i^{2D}, s_i^{2D}, c_i^{2D})$ represents 2D depth map, semantic label and RGB of corresponding pixels. + +# 3.4 TWO-STAGE TRAINING PARADIGM + +Training Scheme. As illustrated in Fig 2, our training scheme for PreWorld includes two stages: In the self-supervised pre-training stage, as illustrated in Section 3.3, we employs the attribute projection head $\mathcal{P}$ to enable temporal supervision with 2D labels. This approach allows us to leverage the abundant and easily obtainable 2D labels, while preemptively optimizing both the occupancy network $\mathcal{N}$ and forecasting module $\mathcal{F}$ . In the subsequent fine-tuning stage, we utilize a occupancy head $\mathcal{H}$ to produce occupancy results and use 3D occupancy labels for further optimization. + +Training Loss. For pre-training stage, we employ temporal 2D rendering loss $\mathcal{L}_{2D}$ as formulated in Eq. 8. Specially, we utilize SILog loss and cross-entropy loss from Pan et al. (2024) as $\mathcal{L}_{dep}$ and $\mathcal{L}_{sem}$ , respectively, and use L1 loss as $\mathcal{L}_{RGB}$ . For fine-tuning stage, we employ focal loss $\mathcal{L}_f$ , lovasz-softmax loss $\mathcal{L}_l$ and scene-class affinity loss $\mathcal{L}_{scal}^{sem}$ and $\mathcal{L}_{scal}^{geo}$ , following the practice of Li et al. (2023c). Therefore, the total loss function for fine-tuning stage can be represented as follows: + +$$ +\mathcal {L} _ {3 D} = \lambda_ {f} \mathcal {L} _ {f} + \lambda_ {l} \mathcal {L} _ {l} + \lambda_ {\text {s c a l}} ^ {\text {s e m}} \mathcal {L} _ {\text {s c a l}} ^ {\text {s e m}} + \lambda_ {\text {s c a l}} ^ {\text {g e o}} \mathcal {L} _ {\text {s c a l}} ^ {\text {g e o}}. \tag {9} +$$ + +# 4 EXPERIMENTS + +# 4.1 EXPERIMENT SETTINGS + +Dataset and Metrics. Our experiments are conducted on the Occ3D-nuScenes benchmark (Tian et al., 2024), which provides dense semantic occupancy annotations for the widely used nuScenes dataset (Caesar et al., 2020). Each annotation covers a range of $[-40\sim 40m, -40\sim 40m, -1\sim 5.4m]$ around the ego vehicle. The ground-truth semantic occupancy is represented as $200\times 200\times 16$ 3D voxel grids with $0.4\mathrm{m}$ resolution. Each voxel is annotated with 18 classes (17 semantic classes and 1 free). The official split for training and validation sets is employed. Following common practices, we use mIoU and IoU as the evaluation metric for 3D occupancy prediction and 4D occupancy forecasting tasks, and use L2 error and collision rate for motion planning task. + +Implementation Details. We use the identical network architecture for all the three tasks, yet for the non-temporal 3D occupancy prediction task, we omit temporal supervision and losses accordingly. We adopt BEVStereo (Li et al., 2023b) as the occupancy network $\mathcal{N}$ , only replacing its detection head with the occupancy head $\mathcal{H}$ from FB-OCC Li et al. (2023c) to produce occupancy prediction. For training, we set the batch size to 16, use Adam as the optimizer, and train with a + +Table 1: 3D occupancy prediction performance on the Occ3D-nuScenes dataset. GT represents the type of labels used during training. The best and second-best performances are represented by bold and underline respectively. + +
MethodGTothersbarrierbicyclebuscarcons. vehmotorcyclepedestriantraffic conetrailertruckdri. surother flatsidewalkterrainmammadevegetationmIoU (%)
SelfOcc (Huang et al., 2024)2D0.000.150.665.4612.540.000.802.100.000.008.2555.490.0026.3026.5414.225.609.30
OccNeRF (Zhang et al., 2023a)2D0.000.830.825.1312.493.500.233.101.840.523.9052.620.0020.8124.7518.4513.199.53
RenderOcc (Pan et al., 2024)2D5.6927.5614.3619.9120.5611.9612.4212.1414.3420.8118.9468.8533.3542.0143.9417.3622.6123.93
OccFlowNet (Boeder et al., 2024)2D1.6027.5026.0034.0032.0020.4025.9018.6020.2026.0028.7062.0027.2037.8039.5029.0026.8028.42
MonoScene (Cao & De Charette, 2022)3D1.757.234.264.939.385.673.983.015.904.457.1714.916.327.927.431.017.656.06
TPVFormer (Huang et al., 2023)3D7.2238.9013.6740.7845.9017.2319.9918.8514.3026.6934.1755.6535.4737.5530.7019.4016.7827.83
BEVDet (Huang et al., 2021)3D4.3930.310.2332.2634.4712.9710.3410.366.268.9323.6552.2724.6126.0622.3115.0415.1019.38
OccFormer (Zhang et al., 2023c)3D5.9430.2912.3234.4039.1714.4416.4517.229.2713.9026.3650.9930.9634.6622.736.766.9721.93
BEVFormer (Li et al., 2022b)3D5.8537.8317.8740.4442.437.3623.8821.8120.9822.3830.7055.3528.3636.0028.0620.0417.6926.88
RenderOcc (Pan et al., 2024)2D+3D4.8431.7210.7227.6726.4513.8718.2017.6717.8421.1923.2563.2036.4246.2144.2619.5820.7226.11
CTF-Occ (Tian et al., 2024)3D8.0939.3320.5638.2942.2416.9324.5222.7221.0522.9831.1153.3333.8437.9833.2320.7918.0028.53
SparseOcc (Liu et al., 2023)3D----------------30.90
OccFlowNet (Boeder et al., 2024)2D+3D8.0037.6026.0042.1042.5021.6029.2022.3025.7029.7034.4064.9037.2044.3043.2034.3032.5033.86
PreWorld (Ours) + Pre-training3D10.8344.1326.3542.1646.1522.9228.8626.8926.4428.2934.4365.6735.9141.0937.4130.1629.5433.95
2D+3D11.8145.0126.2943.3247.7124.2331.2927.4127.6830.6235.6463.7137.2741.2037.5429.3629.7034.69
+ +learning rate of $1 \times 10^{-4}$ . All the hyperparameters $\lambda$ in the loss functions have been set to 1.0. For 3D occupancy prediction task, PreWorld undergoes 6 epochs in self-supervised pre-training stage and 12 epochs in fully-supervised fine-tuning stage. For 4D occupancy forecasting and motion planning task, PreWorld undergoes 8 epochs in self-supervised pre-training stage and 18 epochs in fully-supervised fine-tuning stage. All experiments are conducted on 8 NVIDIA A100 GPUs. + +# 4.2 RESULTS AND ANALYSIS + +Table 2: 4D occupancy forecasting performance on the Occ3D-nuScenes dataset. The latest vision-centric approaches of OccWorld (Zheng et al., 2023) and OccLLaMA (Wei et al., 2024) are taken as baselines for fair comparison. Aux. Sup. represents auxiliary supervision apart from the ego trajectory. Avg. represents the average performance of that in 1s, 2s, and 3s. The best and second-best performances are represented by bold and underline respectively. + +
MethodAux. Sup.mIoU (%) ↑IoU (%) ↑
1s2s3sAvg.1s2s3sAvg.
OccWorld-SNone0.280.260.240.265.055.014.955.00
OccWorld-TSemantic LiDAR4.683.362.633.569.328.237.478.34
OccWorld-D3D Occ11.558.106.228.6218.9016.2614.4316.53
OccLLaMA-F3D Occ10.348.666.988.6625.8123.1919.9722.99
PreWorld (Ours) + Pre-training3D Occ11.698.726.779.0623.0120.7918.8420.88
2D Labels & 3D Occ12.279.247.159.5523.6221.6219.6321.62
+ +3D Occupancy Prediction. We first compare the 3D occupancy prediction performance of our PreWorld model with the latest methods on the Occ3D-nuScenes dataset. As shown in Table 1, PreWorld achieves an mIoU of 34.69, surpassing the previous state-of-the-art method, OcFlowNet (Boeder et al., 2024), which has an mIoU of 33.86, as well as other methods using 2D, 3D, or combined supervision. This highlights the effectiveness of PreWorld in perceiving the current scene. Additionally, the proposed 2D pre-training stage boosts performance by $0.74\mathrm{mIoU}$ , with improvements observed across nearly all categories, both static and dynamic. These results underscore the importance of the proposed 2D pre-training stage for enhanced scene understanding. + +In Figure 4, we further compare the qualitative results of PreWorld with the latest fully-supervised method SparseOcc (Liu et al., 2023) and self-supervised method RenderOcc (Pan et al., 2024). RenderOcc can project scene voxels onto multi-view images to obtain comprehensive supervision from various ray directions, thus capturing abundant geometric and semantic information from 2D labels. However, as shown in the last column, it struggles in predicting unseen regions and understanding the overall scene structure. On the other hand, SparseOcc excels in predicting scene structures. Yet owing to insufficient supervision for small objects and long-tailed objects from 3D occupancy labels, it often encounters information loss when predicting objects like poles and motorcycles, as + +![](images/fe2f9b83f28048fc237689b1488f7f0d0def1852e0cb9cdad40d35ac870144c8.jpg) +Figure 4: Qualitative results of 3D occupancy prediction on the Occ3D-nuScenes validation set. The holistic structure and fine-grained details of the scene are highlighted by orange boxes and red boxes respectively. Compared with existing fully-supervised methods and self-supervised methods, PreWorld can obtain better scene structure and capture finer local details. + +Table 3: Motion planning performance on the Occ3D-nuScenes dataset. The latest vision-centric approaches of OccWorld (Zheng et al., 2023) and OccLLaMA (Wei et al., 2024) are taken as baselines for fair comparison. $\dagger$ represents training and inference with ego state information introduced. The best and second-best performances are represented by bold and underline respectively. + +
MethodAux. Sup.L2 (m) ↓Collision Rate (%) ↓
1s2s3sAvg.1s2s3sAvg.
ST-P3 (Hu et al., 2022)Map & Box & Depth1.332.112.902.110.230.621.270.71
UniAD (Hu et al., 2023b)Map & Box & Motion & Track & 3D Occ0.480.961.651.030.050.170.710.31
VAD (Jiang et al., 2023)Map & Box & Motion0.541.151.981.220.040.391.170.53
OccNet (Tong et al., 2023)Map & Box & 3D Occ1.292.132.992.140.210.591.370.72
OccWorld-S†None0.671.693.131.830.191.284.592.02
OccWorld-T†Semantic LiDAR0.541.362.661.520.120.401.590.70
OccWorld-D†3D Occ0.521.272.411.400.120.402.080.87
OccLLaMA-F†3D Occ0.381.072.151.200.060.391.650.70
PreWorld (Ours) + Pre-training3D Occ0.491.222.321.340.190.572.651.14
2D Label & 3D Occ0.411.162.321.300.500.882.421.27
PreWorld (Ours)† + Pre-training†3D Occ0.220.310.410.310.360.520.730.54
2D Label & 3D Occ0.220.300.400.310.210.660.710.53
+ +shown in the second and the last row. In contrast, our model is initially pre-trained with 2D labels, thereby gaining a sufficient understanding of the scene geometry and semantics. In the fine-tuning stage, the model is further optimized using 3D occupancy labels, enabling PreWorld to better predict scene structures. Consequently, PreWorld performs comparably to SparseOcc in holistic structure predictions but exhibits a clear advantage in predicting fine-grained local details, underscoring the superiority of our training paradigm. + +4D Occupancy Forecasting. Table 2 presents the 4D occupancy forecasting performance of PreWorld compared to existing baseline models, OccWorld(Zheng et al., 2023) and OccLLaMA(Wei et al., 2024). When using only 3D occupancy supervision, our method achieves the highest mIoU over the future 3-second interval, outperforming the baselines. This demonstrates the effectiveness of our cooperative training approach for both occupancy feature extraction and forecasting modules + +in an end-to-end manner. Similar to the results for 3D occupancy prediction, incorporating the 2D pre-training stage further improves both mIoU and IoU across all future timestamps. This highlights how pre-training provides valuable geometric and semantic auxiliary information from dense 2D image representations. Given that 2D labels are more readily available than costly 3D occupancy annotations, the performance boost from the two-stage training paradigm of PreWorld is noteworthy. + +Motion Planning. The motion planning results are further compared in Table 3. Without incorporating ego-state information, our model performs comparably to occupancy world models and even some well-designed planning models. When ego-state information is utilized following the same configuration as OccWorld and OccLLaMA (indicated in gray), our method achieves SOTA performance with significant improvements, further enhanced by the pre-training stage. Since PreWorld follows a direct training paradigm, taking the original images as input and producing planning results, the impact of ego-state is notably different from that in world model baselines. We attribute this difference to the "shortcut" effect observed in prior work (Zhai et al., 2023; Li et al., 2024). We leave the detailed analysis of the relationship between input ego-state, forecasted occupancy, and planning outcomes for future investigation. + +# 4.3 ABLATION STUDY + +
RGBDepthSemanticmIoU (%)↑
33.95
✓34.11 (+0.16)
✓✓34.43 (+0.48)
✓✓✓34.69 (+0.74)
+ +Table 5: Ablation study of different data scale utilized in pre-training and fine-tuning stage. +Table 4: Ablation study of different supervision attributes utilized in pre-training stage. + +
Fine-tuningPre-trainingmIoU (%) ↑
150 Scenes× 700 Scenes18.66 25.02 (+6.36)
450 Scenes× 700 Scenes31.99 33.37 (+1.38)
700 Scenes× 450 Scenes 700 Scenes33.95 34.28 (+0.33) 34.69 (+0.74)
+ +Effectiveness of Pre-training. The effectiveness of different supervision attributes of the 2D pretraining stage is analyzed in this section. As noted earlier, the benefits of pre-training are consistent across both 3D occupancy prediction and 4D occupancy forecasting. Therefore, to conserve computational resources, we perform ablation experiments on the 3D occupancy prediction task. Table 4 shows that as RGB, depth, and semantic attributes are progressively added during the pre-training stage, the final mIoU results steadily improve. This demonstrates the effectiveness of the three 2D supervision attributes, with even the simplest RGB attribute providing a boost in performance. + +Scalability of Pre-training. To validate the scalability of our approach, we conduct ablation studies on the data scale used in both pre-training and fine-tuning stages, as shown in Table 5. Firstly, the introduction of the pre-training stage consistently improves performance across all fine-tuning data scales, where larger pre-training scale leads to better results. Secondly, when the fine-tuning dataset is small (150 scenes), which means costly 3D occupancy labels are limited, the pre-training stage significantly boosts the mIoU from 18.66 to 25.02. Thirdly, with pre-training, the model finetuned on a smaller dataset (450 scenes) achieves comparable performance to a model without pretraining but fine-tuned on a larger dataset (700 scenes), with mIoU of 33.37 and 33.95, respectively. These results highlight the effectiveness and scalability of our two-stage training paradigm. + +Model Components. We perform ablation studies on the effectiveness of various components in our approach for 4D occupancy forecasting, as shown in Table 6. For comparison, we first present a Copy&Paste baseline, which simply copies the current occupancy prediction results of our best 3D occupancy prediction model and calculates the mIoU between these results and the ground truth of the future frames. This serves as a lower bound for PreWorld, showcasing the performance of a model without any future forecasting capabilities. The results in row 1 and row 2 demonstrate that our proposed forecasting module has effectively equipped the model with future forecasting capabilities. By introducing this straightforward design, the model can produce non-trivial results + +Table 6: Ablation study of different components in our approach. The Copy&Paste employs our best model for 3D occupancy prediction task. Ego denotes using ego-state information during training. SSP denotes self-supervised pre-training for model. TS denotes trajectory supervision. + +
MethodEgoSSPTSmIoU (%) ↑IoU (%) ↑
1s2s3sAvg.1s2s3sAvg.
Copy&Paste9.767.376.237.7920.4417.7316.2018.12
PreWorld11.127.735.898.25 (+0.46)22.9120.3117.8420.35 (+2.23)
✓11.178.546.838.85 (+1.06)23.2720.8318.5120.87 (+2.75)
✓✓11.698.726.779.06 (+1.27)23.0120.7918.8420.88 (+2.76)
✓✓11.589.147.349.35 (+1.56)23.2721.4119.4921.39 (+3.27)
✓✓✓12.279.247.159.55 (+1.76)23.6221.6219.6321.62 (+3.50)
+ +Table 7: Ablation study of joint training. All results in the table are obtained utilizing ego-state information. Traj, 2D and 3D denote ego trajectory, 2D labels and 3D occupancy labels, respectively. + +
SupervisionL2 (m) ↓Avg.Collision Rate (%) ↓
Traj2D3D1s2s3s1s2s3sAvg.
✓0.200.340.800.450.500.620.900.67
✓✓0.220.310.410.310.360.520.730.54
✓✓✓0.220.300.400.310.210.660.710.53
+ +and achieve significant performance enhancements, particularly evident in the IoU metric. Additionally, incorporating ego-state information and employing self-supervised pre-training further enhance both mIoU and IoU, as shown in row 3 and row 5. These findings underscore the importance and contribution of each component in our approach. + +Joint Training. We further demonstrate the effectiveness of joint training. As shown in the row 4 and row 6 of Table 6, when simultaneously optimizing both 4D occupancy forecasting and motion planning tasks, the forecasting capabilities of PreWorld are further enhanced. The introduction of trajectory supervision has improved model performance regardless of the utilization of self-supervised pre-training, with an increase from 8.85 and 9.35 to 9.06 and 9.55 in mIoU, respectively. Furthermore, joint training has also enhanced the planning capabilities of our model. As shown in Table 7, compared to the model supervised solely by ego trajectory, model supervised using both ego trajectory and 3D occupancy labels exhibits a significant improvement in both L2 error and collision rates, while the introduction of 2D labels further elevates the model performance. These results collectively demonstrate that jointly training 4D occupancy forecasting and motion planning tasks, as opposed to training them separately, provides additional performance benefits for the model. + +# 5 CONCLUSION + +In this paper, we propose PreWorld, a semi-supervised vision-centric 3D occupancy world model for autonomous driving. We propose a novel two-stage training paradigm that allows our method to leverage abundant and easily accessible 2D labels for self-supervised pre-training. In the subsequent fine-tuning stage, the model is further optimized using 3D occupancy labels. Furthermore, we introduce a simple yet effective state-conditioned forecasting module, which addresses the challenge faced by existing methods in simultaneously optimizing the occupancy network and forecasting module. This module reduces information loss during training, while enabling the model to directly forecast future scenes and ego trajectory based on visual inputs. Through extensive experiments, we demonstrate the robustness of PreWorld across 3D occupancy prediction, 4D occupancy forecasting and motion planning tasks. Particularly, we validate the effectiveness and scalability of our training paradigm, outlining a viable path for scalable model training in autonomous driving scenarios. + +# ACKNOWLEDGMENTS + +This project is supported by National Science and Technology Major Project (2022ZD0115502), Lenovo Research, and Wuxi Research Institute of Applied Technologies, Tsinghua University under Grant 20242001120. + +# REFERENCES + +Simon Boeder, Fabian Gigengack, and Benjamin Risse. Occflownet: Towards self-supervised occupancy estimation via differentiable rendering and occupancy flow. arXiv preprint arXiv:2402.12792, 2024. +Holger Caesar, Varun Bankiti, Alex H Lang, Sourabh Vora, Venice Erin Liong, Qiang Xu, Anush Krishnan, Yu Pan, Giancarlo Baldan, and Oscar Beijbom. nuscenes: A multimodal dataset for autonomous driving. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 11621-11631, 2020. +Anh-Quan Cao and Raoul De Charette. Monoscene: Monocular 3d semantic scene completion. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 3991-4001, 2022. +Ran Cheng, Ryan Razani, Ehsan Taghavi, Enxu Li, and Bingbing Liu. 2-s3net: Attentive feature fusion with adaptive feature selection for sparse semantic segmentation network. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 12547-12556, 2021. +Ruiyuan Gao, Kai Chen, Enze Xie, Lanqing Hong, Zhenguo Li, Dit-Yan Yeung, and Qiang Xu. Magicdrive: Street view generation with diverse 3d geometry control. arXiv preprint arXiv:2310.02601, 2023. +David Ha and Jürgen Schmidhuber. World models. arXiv preprint arXiv:1803.10122, 2018. +Anthony Hu, Lloyd Russell, Hudson Yeo, Zak Murez, George Fedoseev, Alex Kendall, Jamie Shotton, and Gianluca Corrado. Gaia-1: A generative world model for autonomous driving. arXiv preprint arXiv:2309.17080, 2023a. +Shengchao Hu, Li Chen, Penghao Wu, Hongyang Li, Junchi Yan, and Dacheng Tao. St-p3: End-to-end vision-based autonomous driving via spatial-temporal feature learning. In European Conference on Computer Vision, pp. 533-549. Springer, 2022. +Yihan Hu, Jiazhi Yang, Li Chen, Keyu Li, Chonghao Sima, Xizhou Zhu, Siqi Chai, Senyao Du, Tianwei Lin, Wenhai Wang, et al. Planning-oriented autonomous driving. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 17853-17862, 2023b. +Junjie Huang, Guan Huang, Zheng Zhu, Yun Ye, and Dalong Du. Bevdet: High-performance multicamera 3d object detection in bird-eye-view. arXiv preprint arXiv:2112.11790, 2021. +Yuanhui Huang, Wenzhao Zheng, Yunpeng Zhang, Jie Zhou, and Jiwen Lu. Tri-perspective view for vision-based 3d semantic occupancy prediction. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 9223-9232, 2023. +Yuanhui Huang, Wenzhao Zheng, Borui Zhang, Jie Zhou, and Jiwen Lu. Selfocc: Self-supervised vision-based 3d occupancy prediction. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 19946-19956, 2024. +Bo Jiang, Shaoyu Chen, Qing Xu, Bencheng Liao, Jiajie Chen, Helong Zhou, Qian Zhang, Wenyu Liu, Chang Huang, and Xinggang Wang. Vad: Vectorized scene representation for efficient autonomous driving. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 8340-8350, 2023. +Bu Jin, Yupeng Zheng, Pengfei Li, Weize Li, Yuhang Zheng, Sujie Hu, Xinyu Liu, Jinwei Zhu, Zhijie Yan, Haiyang Sun, et al. Tod3cap: Towards 3d dense captioning in outdoor scenes. In European Conference on Computer Vision, pp. 367-384. Springer, 2024. + +Tarasha Khurana, Peiyun Hu, Achal Dave, Jason Ziglar, David Held, and Deva Ramanan. Differentiable raycasting for self-supervised occupancy forecasting. In European Conference on Computer Vision, pp. 353-369. Springer, 2022. +Tarasha Khurana, Peiyun Hu, David Held, and Deva Ramanan. Point cloud forecasting as a proxy for 4d occupancy forecasting. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 1116-1124, 2023. +Qi Li, Yue Wang, Yilun Wang, and Hang Zhao. Hdmapnet: An online hd map construction and evaluation framework. In 2022 International Conference on Robotics and Automation (ICRA), pp. 4628-4634. IEEE, 2022a. +Yiming Li, Zhiding Yu, Christopher Choy, Chaowei Xiao, Jose M Alvarez, Sanja Fidler, Chen Feng, and Anima Anandkumar. Voxformer: Sparse voxel transformer for camera-based 3d semantic scene completion. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 9087-9098, 2023a. +Yinhao Li, Han Bao, Zheng Ge, Jinrong Yang, Jianjian Sun, and Zeming Li. Bevstereo: Enhancing depth estimation in multi-view 3d object detection with temporal stereo. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 37, pp. 1486-1494, 2023b. +Zhiqi Li, Wenhai Wang, Hongyang Li, Enze Xie, Chonghao Sima, Tong Lu, Yu Qiao, and Jifeng Dai. Bevformer: Learning bird's-eye-view representation from multi-camera images via spatiotemporal transformers. In European conference on computer vision, pp. 1-18. Springer, 2022b. +Zhiqi Li, Zhiding Yu, David Austin, Mingsheng Fang, Shiyi Lan, Jan Kautz, and Jose M Alvarez. Fb-occ: 3d occupancy prediction based on forward-backward view transformation. arXiv preprint arXiv:2307.01492, 2023c. +Zhiqi Li, Zhiding Yu, Shiyi Lan, Jiahan Li, Jan Kautz, Tong Lu, and Jose M Alvarez. Is ego status all you need for open-loop end-to-end autonomous driving? In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 14864-14873, 2024. +Venice Erin Liong, Thi Ngoc Tho Nguyen, Sergi Widjaja, Dhananjai Sharma, and Zhuang Jie Chong. Amvnet: Assertion-based multi-view fusion network for lidar semantic segmentation. arXiv preprint arXiv:2012.04934, 2020. +Haisong Liu, Haiguang Wang, Yang Chen, Zetong Yang, Jia Zeng, Li Chen, and Limin Wang. Fully sparse 3d panoptic occupancy prediction. arXiv preprint arXiv:2312.17118, 2023. +Qihang Ma, Xin Tan, Yanyun Qu, Lizhuang Ma, Zhizhong Zhang, and Yuan Xie. Cotr: Compact occupancy transformer for vision-based 3d occupancy prediction. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 19936-19945, 2024. +Ben Mildenhall, Pratul P Srinivasan, Matthew Tancik, Jonathan T Barron, Ravi Ramamoorthi, and Ren Ng. Nerf: Representing scenes as neural radiance fields for view synthesis. Communications of the ACM, 65(1):99-106, 2021. +Mingjie Pan, Jiaming Liu, Renrui Zhang, Peixiang Huang, Xiaqi Li, Hongwei Xie, Bing Wang, Li Liu, and Shanghang Zhang. Renderocc: Vision-centric 3d occupancy prediction with 2d rendering supervision. In 2024 IEEE International Conference on Robotics and Automation (ICRA), pp. 12404-12411. IEEE, 2024. +Jonah Philion and Sanja Fidler. Lift, splat, shoot: Encoding images from arbitrary camera rigs by implicitly unprojecting to 3d. In Computer Vision-ECCV 2020: 16th European Conference, Glasgow, UK, August 23-28, 2020, Proceedings, Part XIV 16, pp. 194-210. Springer, 2020. +Haotian Tang, Zhijian Liu, Shengyu Zhao, Yujun Lin, Ji Lin, Hanrui Wang, and Song Han. Searching efficient 3d architectures with sparse point-voxel convolution. In European conference on computer vision, pp. 685–702. Springer, 2020. +Xiaoyu Tian, Tao Jiang, Longfei Yun, Yucheng Mao, Huitong Yang, Yue Wang, Yilun Wang, and Hang Zhao. Occ3d: A large-scale 3d occupancy prediction benchmark for autonomous driving. Advances in Neural Information Processing Systems, 36, 2024. + +Wenwen Tong, Chonghao Sima, Tai Wang, Li Chen, Silei Wu, Hanming Deng, Yi Gu, Lewei Lu, Ping Luo, Dahua Lin, et al. Scene as occupancy. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 8406-8415, 2023. +Yue Wang, Vitor Campagnolo Guizilini, Tianyuan Zhang, Yilun Wang, Hang Zhao, and Justin Solomon. Detr3d: 3d object detection from multi-view images via 3d-to-2d queries. In Conference on Robot Learning, pp. 180–191. PMLR, 2022. +Yuqi Wang, Jiawei He, Lue Fan, Hongxin Li, Yuntao Chen, and Zhaoxiang Zhang. Driving into the future: Multiview visual forecasting and planning with world model for autonomous driving. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 14749-14759, 2024. +Julong Wei, Shanshuai Yuan, Pengfei Li, Qingda Hu, Zhongxue Gan, and Wenchao Ding. Occlama: An occupancy-language-action generative world model for autonomous driving. arXiv preprint arXiv:2409.03272, 2024. +Yi Wei, Linqing Zhao, Wenzhao Zheng, Zheng Zhu, Jie Zhou, and Jiwen Lu. Surroundocc: Multicamera 3d occupancy prediction for autonomous driving. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 21729-21740, 2023. +Zhaoyang Xia, Youquan Liu, Xin Li, Xinge Zhu, Yuexin Ma, Yikang Li, Yuenan Hou, and Yu Qiao. Scpnet: Semantic scene completion on point cloud. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 17642-17651, 2023. +Dongqiangzi Ye, Zixiang Zhou, Weijia Chen, Yufei Xie, Yu Wang, Panqu Wang, and Hassan Foroosh. Lidarmultinet: Towards a unified multi-task network for lidar perception. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 37, pp. 3231-3240, 2023. +Maosheng Ye, Rui Wan, Shuangjie Xu, Tongyi Cao, and Qifeng Chen. Drinet++: Efficient voxels-as-point cloud segmentation. arXiv preprint arXiv:2111.08318, 2021. +Jiang-Tian Zhai, Ze Feng, Jinhao Du, Yongqiang Mao, Jiang-Jiang Liu, Zichang Tan, Yifu Zhang, Xiaqing Ye, and Jingdong Wang. Rethinking the open-loop evaluation of end-to-end autonomous driving in nuscenes. arXiv preprint arXiv:2305.10430, 2023. +Chubin Zhang, Juncheng Yan, Yi Wei, Jiaxin Li, Li Liu, Yansong Tang, Yueqi Duan, and Jiwen Lu. Occnerf: Self-supervised multi-camera occupancy prediction with neural radiance fields. arXiv preprint arXiv:2312.09243, 2023a. +Lunjun Zhang, Yuwen Xiong, Ze Yang, Sergio Casas, Rui Hu, and Raquel Urtasun. Learning unsupervised world models for autonomous driving via discrete diffusion. arXiv preprint arXiv:2311.01017, 2023b. +Yunpeng Zhang, Zheng Zhu, and Dalong Du. Occformer: Dual-path transformer for vision-based 3d semantic occupancy prediction. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 9433-9443, 2023c. +Wenzhao Zheng, Weiliang Chen, Yuanhui Huang, Borui Zhang, Yueqi Duan, and Jiwen Lu. Occworld: Learning a 3d occupancy world model for autonomous driving. arXiv preprint arXiv:2311.16038, 2023. +Yupeng Zheng, Xiang Li, Pengfei Li, Yuhang Zheng, Bu Jin, Chengliang Zhong, Xiaoxiao Long, Hao Zhao, and Qichao Zhang. Monoocc: Digging into monocular semantic occupancy prediction. arXiv preprint arXiv:2403.08766, 2024. + +# A MORE EVALUATIONS + +# A.1 3D OCCUPANCY PREDICTION WITH RAYIOU + +To address the inconsistent depth penalty issue within the mIoU metric, SparseOcc (Liu et al., 2023) introduces a novel metric, RayIoU, designed to enhance the evaluation of 3D occupancy model performance. In order to demonstrate the robustness of our approach as a 3D occupancy model across various metrics, we opt to evaluate PreWorld on the 3D occupancy prediction task using RayIoU as metric, and compare the results with existing methods in this section. + +Table 8: 3D occupancy prediction performance on the Occ3D-nuScenes dataset. We use RayIoU as the evaluation metric (Liu et al., 2023). The best and second-best performances are represented by bold and underline respectively. + +
MethodRayIoURayIoU1m, 2m, 4m
BEVFormer(4f)32.426.132.938.0
RenderOcc19.513.419.625.5
SimpleOcc22.517.022.727.9
BEVDet-Occ (2f)29.623.630.035.1
BEVDet-Occ-Long (8f)32.626.633.138.2
OccFlowNet32.625.633.338.8
FB-OCC (16f)33.526.734.139.7
SparseOcc (8f)34.028.034.739.4
SparseOcc (16f)36.130.236.841.2
PreWorld (Ours)36.430.037.241.9
+ Pre-training38.732.539.644.0
+ +As shown in Table 8, PreWorld achieves a RayIoU of 38.7, outperforming the previous SOTA method SparseOcc (Liu et al., 2023) by 2.6 RayIoU. Comparing to purely 3D occupancy supervision, the proposed self-supervised pre-training stage provides a significant boost in RayIoU from 36.4 to 38.7, which reaffirms the effectiveness of our two-stage training paradigm for PreWorld. Altogether, Table 1 and 8 showcases the strong performance of PreWorld across various metrics. + +More importantly, the introduction of RayIoU explains the reason why our PreWorld does not outperform the baseline in certain categories. As shown in Table 1, these situations are predominantly focused on large static categories. For instance, in categories like manmade and sidewalk, the performance of PreWorld is surpassed by RenderOcc (Pan et al., 2024). SparseOcc points out that common practice in mIoU computation involves the utilization of visible masks, which only accounts for voxels within the visible region, without penalizing predictions outside this area. Consequently, many models can achieve higher mIoU scores by predicting thicker surfaces for large static categories. As demonstrated in the last column of Figure 4, RenderOcc, despite lacking an understanding of the overall scene structure, manages to attain higher scores in these categories through this strategy. + +On the contrary, due to RayIoU considering the distance between voxels and the ego vehicle during computation, the model cannot gain an advantage by predicting thicker surfaces under this evaluation metric. Therefore, we believe that RayIoU is a more reasonable metric for comparing model performance in predicting large static categories. As shown in Table 8, when using RayIoU as the evaluation metric, the scores of both RenderOcc and OccFlowNet (Boeder et al., 2024) have decreased. While OccFlowNet outperforms SparseOcc in the mIoU metric with 33.86 over 30.90, its performance notably lags behind SparseOcc in terms of RayIoU. These results indicate that the performance of our PreWorld is not inferior in some categories; rather, our model tends to generate more reasonable predictions, which can be reflected in the RayIoU metric. + +Likewise, we can explain why pre-training leads to a decline in model performance in certain categories. It can be observed that these instances also primarily focus on large static categories. For example, after pre-training, there is a significant mIoU performance decline in the driveable surface category. Based on the previous analysis, we showcase the RayIoU performance for the models on large static categories with and without pre-training. + +Table 9: Detailed 3D occupancy prediction performance of the large static categories on the Occ3D-nuScenes dataset. We use RayIoU as the evaluation metric (Liu et al., 2023). GT represents the type of labels used during training. The best performances are represented by bold. + +
MetricMethodGTRayIoUbarrierDri. Surother flatsidewalkterrainmannmadevegetation
RayIoU1mPreWorld3D30.039.456.424.225.523.832.923.2
+ Pre-training2D+3D32.540.157.829.827.227.335.125.9
RayIoU2mPreWorld3D37.244.664.429.230.731.343.436.0
+ Pre-training2D+3D39.645.465.934.332.734.644.737.8
RayIoU4mPreWorld3D41.946.672.433.235.638.149.747.3
+ Pre-training2D+3D44.047.474.338.337.741.150.547.2
+ +As shown in Table 9, the pre-trained model surpasses the model without pre-training on almost all large static categories across all thresholds. The results under the RayIoU metric indicate that pretraining steers the model towards predicting more plausible scene structures, rather than leading to performance decline. In conclusion, we believe that the results under RayIoU metric validate the effectiveness of pre-training and better showcase the robust prediction capabilities of our PreWorld. + +# A.2 HOW PRE-TRAINING WORKS? + +Due to time constraints, when conducting experiments on smaller datasets in Table 4, models fine-tuned on 150 scenes and 450 scenes are trained for 24 and 18 epochs, respectively, while the model on the full dataset is trained for 12 epochs. Considering the ratio of data reduction to extended training time, we believe that we do not allocate sufficient additional training time for experiments on the smaller datasets. Therefore in this section, to delve into how pre-training benefits the model, we extend the training duration across various settings to obtain more comprehensive experimental results, as presented in Table 10. + +Table 10: The extended ablation study of different data scale utilized in pre-training and fine-tuning stage. The best performances are represented by bold. + +
Fine-tuningPre-trainingEpoch
121824364860
150 Scenes×11.1813.8518.6629.3030.2630.00
700 Scenes13.0121.8325.0231.6531.5630.98
450 Scenes×25.5431.9932.8933.32--
700 Scenes29.5233.3734.1934.08--
700 Scenes×33.9533.99----
450 Scenes34.2834.15----
700 Scenes34.6934.89----
+ +As shown in the results, we believe that pre-training has benefited the model in two key aspects: on one hand, pre-training accelerates the convergence of the model; on the other hand, pre-training continues to enhance the model performance after convergence, thereby improving the data efficiency. Taking models fine-tuned on 150 scenes as an example, it can be observed that during the first 24 epochs, employing pre-training accelerates the convergence. Subsequently, both models have converged, with the pre-trained model still maintaining an advantage in prediction performance. + +Furthermore, it can be observed that pre-training leads to a $0.87\mathrm{mIoU}$ improvement for the model fine-tuned on 450 scenes, while it results in a $0.90\mathrm{mIoU}$ improvement for the model fine-tuned on 700 scenes. We believe this situation is still related to the reasons analyzed in Section A.1, that is, for large static categories, existing evaluation metric does not adequately reflect the actual performance of the model. Therefore, we have detailed the corresponding mIoU for large static categories and small objects in Table 11. + +Table 11: Detailed 3D occupancy prediction performance of different data scale utilized in pretraining and fine-tuning stage. + +
Fine-tuningPre-trainingmIoU
OverallLarge StaticSmall
150 Scenes×700 Scenes30.2631.65 (+1.39)35.8237.18 (+1.36)24.0825.50 (+1.42)
450 Scenes×700 Scenes33.3234.19 (+0.87)38.4039.04 (+0.64)26.2927.44 (+1.15)
700 Scenes×700 Scenes33.9934.89 (+0.90)39.8340.72 (+0.89)26.9827.96 (+0.98)
+ +It can be observed that the mIoU for large categories does not always effectively reflect the performance improvement of the model. For the model fine-tuned with 450 scenes, pre-training leads to a 0.64 increase in mIoU for large categories, while the model fine-tuned with 700 scenes sees an increase of 0.89. In contrast, the increase in mIoU for small objects can better reflect the effectiveness of pre-training, aligning with the expectations: 2D pre-training yields more significant performance improvements for smaller 3D fine-tuning datasets. In order to better showcase the effectiveness of pre-training, we use RayIoU as the evaluation metric, and the results obtained are as follows: + +Table 12: Detailed 3D occupancy prediction performance of different data scale utilized in pre-training and fine-tuning stage. We use RayIoU as the evaluation metric (Liu et al., 2023). + +
Fine-tuningPre-trainingRayIoULarge Static RayIoU
Overall1m2m4m
150 Scenes×700 Scenes29.533.4 (+3.9)32.536.6 (+4.1)26.230.232.937.038.542.5
450 Scenes×700 Scenes35.137.8 (+2.7)37.940.2 (+2.3)31.533.138.340.644.046.8
700 Scenes×700 Scenes36.839.0 (+2.2)39.541.4 (+1.9)32.434.739.941.946.247.6
+ +As shown in Table 12, when using RayIoU as the evaluation metric, the improvements in overall RayIoU and RayIoU for large categories follow a similar trend, indicating that as the scale of the 3D fine-tuning dataset increases, the benefits of 2D pre-training do indeed gradually diminish. + +# A.3 SELF-SUPERVISED 4D OCCUPANCY FORECASTING AND MOTION PLANNING + +Instead of generating occupancy predictions through the occupancy head $\mathcal{H}$ , we support an alternative approach by utilizing the attribute projection head $\mathcal{P}$ . Specially, by setting a threshold value $\tau$ for the 3D volume density field $\tilde{\sigma}$ of the scene, we can determinate whether a voxel is occupied. Subsequently, the semantic occupancy of the voxel $v_{k}$ can be formulated as: + +$$ +\hat {Y} \left(v _ {k}\right) = \operatorname {a r g m a x} \left(\tilde {s} \left(v _ {k}\right)\right), \text {i f} \tilde {\sigma} \left(v _ {k}\right) \geq \tau , \tag {10} +$$ + +where $\tilde{s}$ denotes the semantic field of the scene, and we regard $v_{k}$ as non-occupied if $\tilde{\sigma} (v_k) < \tau$ + +In this manner, we can also obtain occupancy predictions during the pre-training stage. In other words, PreWorld is capable of engaging in self-supervised tasks as well. Therefore, to validate its performance as a self-supervised 3D occupancy world model, we compare it against state-of-the-art self-supervised methods on both 4D occupancy forecasting and motion planning tasks on the Occ3D-nuScenes dataset (Tian et al., 2024), denoting as PreWorld-S. + +4D Occupancy Forecasting. Table 13 presents the 4D occupancy forecasting performance of PreWorld-S compared to previous self-supervised approach of OccWorld (Zheng et al., 2023). In comparison to OccWorld-S, our approach yields significant outcomes. The IoU over the future 3-second interval nearly doubles, while the average future mIoU demonstrates an remarkable increase of over $1300\%$ , soaring from 0.26 to 3.78. These results highlight the superiority of our method + +in self-supervised learning and open up more possibilities for future research on the architecture of self-supervised 3D occupancy world models. + +Table 13: Self-supervised 4D occupancy forecasting performance on the Occ3D-nuScenes dataset. We take the self-supervised vision-centric approach of OccWorld (Zheng et al., 2023) as baseline for fair comparison. Aux. Sup. represents auxiliary supervision apart from the ego trajectory. Avg. represents the average performance of that in 1s, 2s, and 3s. The best and second-best performances are represented by bold and underline respectively. + +
MethodAux. Sup.mIoU (%) ↑Avg.IoU (%) ↑
1s2s3s1s2s3sAvg.
OccWorld-SNone0.280.260.240.265.055.014.955.00
PreWorld-S (Ours)2D Labels4.363.723.273.789.499.178.909.19
+ +Table 14: Self-supervised motion planning performance on the Occ3D-nuScenes dataset. We take the self-supervised vision-centric approach of OccWorld (Zheng et al., 2023) as baseline for fair comparison. $\dagger$ represents training and inference with ego state information introduced. The bestperformances are represented by bold. + +
MethodAux. Sup.L2(m) (%) ↓Collision Rate (%) ↓
1s2s3sAvg.1s2s3sAvg.
OccWorld-S†None0.671.693.131.830.191.284.592.02
PreWorld-S (Ours)2D Labels0.661.492.601.580.571.262.231.35
PreWorld-S (Ours)†2D Labels0.200.611.570.790.570.641.420.88
+ +Motion Planning. As illustrated in Table 14, PreWorld-S significantly surpasses OccWorld-S on both metrics even without the incorporation of ego-state information. When ego-state information is introduced (indicated in gray), the performance of our self-supervised approach has received a notable enhancement, yielding results comparable to or outperforming those fully-supervised methods such as OccWorld-D. These findings once again demonstrate the effectiveness of our approach. + +# B MORE VISUALIZATIONS + +We provide additional visualized comparison in this section. + +Fig 5 shows more qualitative results of 3D occupancy prediction task compared with the latest fully-supervised method SparseOcc (Liu et al., 2023) and self-supervised method RenderOcc (Pan et al., 2024), further substantiating the robustness of our PreWorld model and the effectiveness of our novel two-stage training paradigm. The red boxes highlight fine-grained details of the 3D occupancy predictions and the ground truth, while the orange boxes mark holistic structure of an area within the scene. Compared to prior approaches, PreWorld demonstrates superior performance in preserving the structural information of the scene and capturing fine-grained details. In contrast, RenderOcc struggles with comprehending the scene structure accurately and exhibits inaccurate predictions for unsupervised occluded regions. SparseOcc, on the other hand, fails to effectively predict small objects like poles and long-tailed objects like construction vehicles, resulting in detail loss. These findings are consistent with the observations in the main text. + +In Fig 6, we further provide a detailed showcase of the prediction results for both visible and occluded regions. Consistent with the quantitative analysis in Section A.1, it can be observed that RenderOcc (Pan et al., 2024) tends to predict thicker surfaces for large static categories. However, while this approach may lead to higher mIoU scores, its predictions for occluded regions are chaotic, indicating a lack of true understanding of the scene structure. On the contrary, our PreWorld makes more cautious predictions for occluded regions, demonstrating a more comprehensive understanding of the holistic scene structure. + +![](images/b6ecef68c9f472bb47b5e6b272fe8873ec60e6ac5b826be7bf7bb14d97f97d9c.jpg) +Figure 5: More qualitative results of 3D occupancy prediction on the Occ3D-nuScenes validation set. The holistic structure and fine-grained details of the scene are highlighted by orange boxes and red boxes respectively. + +![](images/cc7e54b0f7ee0486a95114ed11600f417593ae34607af2d266ee9769978fa084.jpg) +Figure 6: More qualitative results of 3D occupancy prediction on the Occ3D-nuScenes validation set. The shaded area represents occluded regions where the voxels are not included in the evaluation. In contrast to RenderOcc, our PreWorld makes more cautious predictions for occluded regions, tending to preserve the overall structure of the scene. \ No newline at end of file diff --git a/ICLR/2025/Semi-Supervised Vision-Centric 3D Occupancy World Model for Autonomous Driving/images.zip b/ICLR/2025/Semi-Supervised Vision-Centric 3D Occupancy World Model for Autonomous Driving/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..d6331ff1cffac7c93cd4bd365e4a6c6e31c20eb9 --- /dev/null +++ b/ICLR/2025/Semi-Supervised Vision-Centric 3D Occupancy World Model for Autonomous Driving/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:40172ecdb36c81cdbc47bb59f0074dba5316b0e572064752d9f0bfec0968c8d8 +size 1304723 diff --git a/ICLR/2025/Semi-Supervised Vision-Centric 3D Occupancy World Model for Autonomous Driving/layout.json b/ICLR/2025/Semi-Supervised Vision-Centric 3D Occupancy World Model for Autonomous Driving/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..b0d5caeb602b6c409bc4e79c47a803fc10d5a08f --- /dev/null +++ b/ICLR/2025/Semi-Supervised Vision-Centric 3D Occupancy World Model for Autonomous Driving/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:387b5cd0970e04dbfd5fc120d440235b49ace9b5e0ac28e0ec93025629f599cf +size 470662 diff --git a/ICLR/2025/Semialgebraic Neural Networks_ From roots to representations/e61a0a42-1b0c-457f-92b6-da69b05c5d7c_content_list.json b/ICLR/2025/Semialgebraic Neural Networks_ From roots to representations/e61a0a42-1b0c-457f-92b6-da69b05c5d7c_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..83fa3481d629b48c9552d7fd9dc5f0bdc28395aa --- /dev/null +++ b/ICLR/2025/Semialgebraic Neural Networks_ From roots to representations/e61a0a42-1b0c-457f-92b6-da69b05c5d7c_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6925d7b197c6624255aeecb6d92fab36c9acf8d2f62773c039b3c46931422311 +size 258423 diff --git a/ICLR/2025/Semialgebraic Neural Networks_ From roots to representations/e61a0a42-1b0c-457f-92b6-da69b05c5d7c_model.json b/ICLR/2025/Semialgebraic Neural Networks_ From roots to representations/e61a0a42-1b0c-457f-92b6-da69b05c5d7c_model.json new file mode 100644 index 0000000000000000000000000000000000000000..479c592ca27c6c85d57d2356d61b0972d9d2e042 --- /dev/null +++ b/ICLR/2025/Semialgebraic Neural Networks_ From roots to representations/e61a0a42-1b0c-457f-92b6-da69b05c5d7c_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:667046f4848747bdb44fd7908f497fbb75fdbb8724c3bb00800483c64f14d7fc +size 302403 diff --git a/ICLR/2025/Semialgebraic Neural Networks_ From roots to representations/e61a0a42-1b0c-457f-92b6-da69b05c5d7c_origin.pdf b/ICLR/2025/Semialgebraic Neural Networks_ From roots to representations/e61a0a42-1b0c-457f-92b6-da69b05c5d7c_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..1e73eaefca65fa8a94a0b202f9dde19dc4877711 --- /dev/null +++ b/ICLR/2025/Semialgebraic Neural Networks_ From roots to representations/e61a0a42-1b0c-457f-92b6-da69b05c5d7c_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1379d792803b2333ce490b06cbbbc3ac368765fdc34e2a090f97708254e820c0 +size 1338084 diff --git a/ICLR/2025/Semialgebraic Neural Networks_ From roots to representations/full.md b/ICLR/2025/Semialgebraic Neural Networks_ From roots to representations/full.md new file mode 100644 index 0000000000000000000000000000000000000000..16a53a5e96bb01f5222c0fd1779f8b403db52038 --- /dev/null +++ b/ICLR/2025/Semialgebraic Neural Networks_ From roots to representations/full.md @@ -0,0 +1,1481 @@ +# SEMIALGEBRAIC NEURAL NETWORKS: FROM ROOTS TO REPRESENTATIONS + +S. David Mis + +Rice University + +dmis@rice.edu + +Matti Lassas + +University of Helsinki + +matti.lassas@helsinki.fi + +Maarten V. de Hoop + +Rice University + +mdehoop@rice.edu + +# ABSTRACT + +Many numerical algorithms in scientific computing—particularly in areas like numerical linear algebra, PDE simulation, and inverse problems—produce outputs that can be represented by semialgebraic functions; that is, the graph of the computed function can be described by finitely many polynomial equalities and inequalities. In this work, we introduce Semialgebraic Neural Networks (SANNs), a neural network architecture capable of representing any bounded semialgebraic function, and computing such functions up to the accuracy of a numerical ODE solver chosen by the programmer. Conceptually, we encode the graph of the learned function as the kernel of a piecewise polynomial selected from a class of functions whose roots can be evaluated using a particular homotopy continuation method. We show by construction that the SANN architecture is able to execute this continuation method, thus evaluating the learned semialgebraic function. Furthermore, the architecture can exactly represent even discontinuous semialgebraic functions by executing a continuation method on each connected component of the target function. Lastly, we provide example applications of these networks and show they can be trained with traditional deep-learning techniques. + +# 1 INTRODUCTION + +Many classical numerical algorithms compute semialgebraic functions—functions whose graphs are defined by finitely many polynomial equalities and inequalities. Such functions include anything computable using finitely many real variables and finitely many operations addition, subtraction, multiplication, division, extraction of roots, and branching if statements with polynomial decision boundaries. Familiar primitives from numerical linear algebra, such as solving linear systems, Schur complements, and extraction of real eigenvalues are also semialgebraic, as are the solution operators of optimization problems with polynomial objective functions and constraints (Press et al., 2007). Polynomial functions of $n$ -th roots $\sqrt[n]{\cdot}$ are widely used in computation of eigenvalues of nonsymmetric matrices and in the perturbation theory of eigenvalues of linear operators (Kato, 1995). Also, Finite Element approximations of partial differential equations lead to solving linear systems whose solutions are semialgebraic functions (Beltzer, 1990). Due to their ubiquity, it is likely that the space of semialgebraic functions provides good inductive bias for operator learning with neural networks. This ansatz leads to our central question: Is it possible to design a neural network architecture capable of exactly representing any semialgebraic function? + +In this paper, we combine techniques from classical numerical analysis, namely polynomial homotopy continuation methods for root finding, with ReLU activation functions to create neural networks capable of exactly representing any bounded semialgebraic function. The starting point for our idea is the observation that, under mild conditions, the graph of a semialgebraic function $F$ given by the relation $F(x) = y$ can be encoded as the kernel of a continuous piecewise polynomial $G$ , i.e., the set of $(x,y)$ where $G(x,y) = 0$ (Section 2). Therefore, in principle, we can use a neural network combining polynomials and ReLU activations to learn $G$ , then append a root-finding procedure such as Newton's method to compute $F(x) = \operatorname{root}(G(x,\cdot)) = y$ in a manner similar to Bai et al. (2019). However, this straightforward approach has numerous practical difficulties: there is no guarantee such a neural network would have a root $y$ for every $x$ , roots may not be unique, the root-finding procedure may never converge, etc. To remedy these issues, we take inspiration from homotopy continuation methods for root finding. We construct a function $H(x,y,s)$ that continuously deforms + +from a simple function $G_0$ to the target function $G$ : + +$$ +H (x, y, 0) = G _ {0} (x, y) \quad H (x, y, 1) = G (x, y). \tag {1} +$$ + +We use $H$ to find a root of $G$ by starting at a root of the simpler function $G_{0}$ at $s = 0$ , then slowly increasing $s$ and tracking the motion of the root. In classical homotopy continuation methods, this procedure is carried out by numerically solving an ODE initial value problem describing the motion of $y$ as a function of $s$ . With a properly constructed $H$ , this procedure is powerful enough to compute the roots of $G$ , even if $G_{0}$ bears little resemblance to $G$ (Theorem 37). + +Instead of using a neural network to compute $G$ directly, our Semialgebraic Neural Networks (SANNs) compute the vector field of an ODE system arising from a homotopy continuation method to find a root of $G$ (Section 3). We then integrate across the interval $s \in [0,1]$ using an off-the-shelf ODE solver. This approach is powerful enough to represent all bounded semialgebraic functions in the sense that $F(x)$ is the exact solution to the ODE initial value problem (Section 4). This approach always has a well-defined output, avoids costly explicit root-finding procedures, and has fixed evaluation time when using a non-adaptive ODE solver. To our knowledge, we present the first neural networks capable of computing arbitrary bounded semialgebraic functions on high-dimensional data. + +# 1.1 RELATED WORK + +Implicit deep learning. SANNs fall within the general framework of "implicit deep learning" (El Ghaoui et al., 2021; Kolter et al., 2020), particularly as popularized by Neural ODEs (Chen et al., 2019) and Deep Equilibrium Models (Bai et al., 2019). In particular, SANNs can be trained using the adjoint sensitivity method (Pontryagin et al., 1962) in a manner similar to Neural ODEs. Unlike Neural ODEs, where the ODE is fixed (based on network weights) and the initial value is based on the network input $x$ , SANNs instead define a family of ODEs parameterized by $x$ and the initial value is fixed. Importantly, Neural ODEs compute diffeomorphisms (Dupont et al., 2019), while SANNs compute bounded semialgebraic functions, which may not be continuous or differentiable everywhere. Compared to Deep Equilibrium Models, the SANN architecture does not include an explicit root-finding or fixed-point computation step; instead SANNs directly parameterize a homotopy continuation method for root-finding. + +Semialgebraic machine learning. There are many neural network architectures designed to represent important subsets of semialgebraic functions. For example, polynomials and piecewise polynomials are computed by de Hoop et al. (2022); Chrysos et al. (2021); Oh et al. (2003), and certain rational functions are computed by Boullé et al. (2020). We are unaware of prior neural networks designed to represent the entire class of bounded semialgebraic functions as a whole. An exciting complementary approach to semialgebraic approximation has been developed by Marx et al. (2021), where they encode semialgebraic functions as the optima of functions constructed from Christoffel-Darboux polynomials. Their approach is developed within the framework of classical approximation theory and data analysis rather than neural networks. + +# 1.2 OUR CONTRIBUTION + +We introduce the SANN architecture and provide an exact characterization of the functions it represents. Our key contributions are as follows: + +Definition of SANNs: We present the SANN architecture (Algorithm 1), a new object grounded in classical homotopy continuation methods for root-finding, that is capable of exactly representing any bounded semialgebraic function. + +Exact characterization of expressivity: We rigorously characterize the expressivity of SANNs (Section 4), proving their ability to represent all continuous bounded semialgebraic functions via a homotopy continuation argument (Section 4.1). + +Extension to discontinuous functions: Building on the homotopy continuation framework, we extend our results to show that SANNs can also represent discontinuous bounded semialgebraic functions through constructive proofs (Section 4.2). + +We also argue SANNs are naturally suited to a wide variety of difficult problems, with applications to solving linear systems (Section 5), nonlinear inverse problems (Section F), general optimization + +![](images/de8a9a3830c8b77e18b429579a02c764ab5c24e87dc00235ae5f941c7966928e.jpg) +Figure 1: Computing the Heaviside step function $F$ (plotted in red) using a homotopy method. The graph of $F$ is a subset of the kernel of a higher-dimensional piecewise polynomial $G$ . In the upper row, we plot the surface of a homotopy $H$ such that $H(x,y,0) = 0$ is trivial to solve (upper left), and $H(x,y,1) = G$ (upper right). The kernel of $H$ is shown with a green line (red points are also on top of the green line). The bottom row shows the projection of $H$ onto $xy$ -plane. We compute $F(x) = y$ by following the kernel of $H$ from time $t = 0$ to $t = 1$ , keeping $x$ fixed. Although the kernel of $G$ contains points outside the graph of $F$ (the visible parts of the green lines), these points are never encountered when computing $F$ by following the homotopy. This process captures the discontinuity exactly, including the isolated point at $(0,0)$ . + +problems (Section G.1), and transformers (Section G.3). We also demonstrate through numerical experiments that SANNs can be trained using standard techniques (Sections 5.2 and F.1), and discuss future research directions (Section 6). + +# 2 BACKGROUND + +# 2.1 INF-SUP DEFINABLE PIECEWISE POLYNOMIALS + +Our networks are constructed from the piecewise polynomials formed by combining polynomials with ReLU activations. Using these components, we can represent the pointwise minimum and maximum of any finite collection of polynomials. In mathematical literature, such structures are referred to as lattices. Instead of "min" and "max," the terms "inf" and "sup" are traditionally used in lattice theory; since our constructions rely heavily on lattice theory, we adopt this terminology here. Notably, we do not use the word "lattice" to refer to a grid-like structure (e.g., $\mathbb{Z}^d$ ), but rather a set of functions that is closed under the "min" and "max" operations. + +We begin by defining the class of functions that form the backbone of our constructions. The notation $\mathbb{R}[x_1, \ldots, x_m]$ refers to the set of polynomials of variables $x_1, \ldots, x_m$ with coefficients from $\mathbb{R}$ . + +Definition 1 (Inf-sup definable piecewise polynomials). Let $D \subseteq \mathbb{R}^m$ . $ISD(D)$ is the lattice generated by the polynomials $\mathbb{R}[x_1, \ldots, x_m]$ , viewed as functions $D \to \mathbb{R}$ , together with the min and max operations. The vectors of $nISD(D)$ functions are denoted $ISD(D, \mathbb{R}^n)$ . For any non-negative integer $k$ , $ISD^k(D, \mathbb{R}^n)$ are the $k$ -times differentiable functions in $ISD(D, \mathbb{R}^n)$ . + +The shorthand " $f$ is $ISD$ " means $f\in ISD(D,\mathbb{R}^n)$ for some appropriate $D$ and $n$ . Our nomenclature is taken from Mahé (1984) and Mahé (2007). + +Summarizing, the components $f_{k}$ of a function $f\in ISD(D,\mathbb{R}^n)$ , $D\subset \mathbb{R}^{m}$ can be written as + +$$ +f_{k}(x) = \max_{i = 1,\ldots ,I}\min_{j = 1,\ldots ,J}\Bigg(\sum_{\alpha_{1},\alpha_{2},\ldots ,\alpha_{m} = 0}^{N}a_{k,i,j,\alpha_{1},\ldots ,\alpha_{m}}x_{1}^{\alpha_{1}}x_{2}^{\alpha_{2}}\ldots x_{m}^{\alpha_{m}}\Bigg),\quad x = (x_{1},x_{2},\ldots ,x_{m}). +$$ + +Later, when we consider $f_{k}$ as a layer of a neural network, the coefficients $a_{k,i,j,\alpha_1,\dots,\alpha_m}$ are used as the parameters which are optimized in training process. + +Since the min and max operations can be written using the ReLU function, all ISD functions can be written as a feed forward neural network where in the first hidden layer one has several different polynomial activation functions followed by fully connected ReLU layers. Furthermore, Henriksen & Isbell (1962) showed $ISD(D,\mathbb{R}^k)$ forms a ring, so the sum and product of any ISD function is itself ISD (see Theorem 22 in Appendix A). Thus $ISD(D,\mathbb{R}^k)$ are precisely the functions $D\to \mathbb{R}^k$ that can be represented using finitely many, arbitrarily interleaved vector additions, Hadamard products, scalar multiplications and ReLU activations on variables from $D$ . + +We focus our attention on ISD functions since these are the piecewise polynomials computable using neural networks that combine polynomials and ReLU activations. There are many ways to construct such networks; we provide an example based on Operator Recurrent Neural Networks (de Hoop et al., 2022) in Appendix B, along with proofs of the expressivity of that architecture. Our approach can be adapted to analyze the expressivity of other polynomial networks with ReLU activations as well, such as those proposed by Chrysos et al. (2021). + +It is currently unknown whether every continuous real piecewise polynomial is ISD; this is the famous Pierce-Birkhoff conjecture (Bochnak & Efroymson, 1980; Madden, 2011). ISD functions suffice for our purpose to build semialgebraic neural networks, regardless whether the Pierce-Birkhoff conjecture ultimately holds or not. + +Definition 2 (Locally ISD functions). A function $f: \mathbb{R}^m \to \mathbb{R}^n$ is locally ISD, denoted $f \in ISD_{loc}(\mathbb{R}^m, \mathbb{R}^n)$ , if for every bounded $D \subset \mathbb{R}^m$ , $f|_D \in ISD(D, \mathbb{R}^n)$ . + +Appendix A contains additional background information on lattice theory. + +# 2.2 SEMIALGEBRAIC GEOMETRY + +We now present the basic properties of semialgebraic sets relevant to SANNs. A more thorough introduction to semialgebraic geometry can be found in the first chapters of Bochnak et al. (1998). + +Definition 3 (Basic semialgebraic set). A set $D \subset \mathbb{R}^m$ is a basic semialgebraic set if there exists $J_1, J_2 \in \mathbb{N}$ and finite sets of polynomials $P = \{p_i\}_{i=1}^{J_1}$ , $Q = \{q_i\}_{i=1}^{J_2} \subset \mathbb{R}[x_1, \ldots, x_m]$ such that + +$$ +D = \{x \in \mathbb {R} ^ {m} \mid p (x) = 0, q (x) < 0 \text {f o r a l l} p \in P, q \in Q \}. +$$ + +Definition 4 (Semialgebraic set). A set $D \subset \mathbb{R}^m$ is a semialgebraic set if it is the union of finitely many basic semialgebraic sets. + +Finite unions, finite intersections, complements, projections, closures, and interiors of semialgebraic sets are all semialgebraic themselves, a result of the famous Tarski-Seidenberg theorem (Tarski, 1951; Seidenberg, 1954) (on the formulation of the Tarski-Seidenberg theorem we use in this paper, see Appendix E.9). Furthermore, every closed semialgebraic set can be defined using only non-strict inequalities (Lojasiewicz, 1964). + +Definition 5 (Semialgebraic function). $f: \mathbb{R}^m \to \mathbb{R}^n$ is a semialgebraic function if its graph is a semialgebraic subset of $\mathbb{R}^m \times \mathbb{R}^n$ . + +Special cases of semialgebraic functions include (piecewise) polynomials and (piecewise) rational functions, among others. For example, the graph of $x \mapsto 1 / x$ is the set $\{(x,y) \in \mathbb{R}^2 \mid xy = 1\}$ . + +Example 6. Consider the semialgebraic function $F: \mathbb{R} \to \mathbb{R}$ below. + +$$ +F (x) = \left\{ \begin{array}{l l} (x + 1) ^ {2} + \frac {1}{2}, & x < - 1 \\ \sqrt {1 - x ^ {2}} & x \in [ 0, 1 ] \\ \frac {1}{x} - 1 & x > 1. \end{array} \right. +$$ + +![](images/59ce77bc1a93d849934bc497dd087793eab87de6d5eef1ecb3389020d9baf7ef.jpg) + +$F$ is a polynomial when $x < 1$ , a rational function when $x > 1$ , and neither when $x \in [0,1]$ . It has a single discontinuity at $x = -1$ , and its graph is not closed there. It is unbounded as $x \to -\infty$ , but becomes bounded whenever the domain is restricted from below. + +# 2.3 SEMIALGEBRAIC FUNCTIONS AS KERNELS OF ISD FUNCTIONS + +In this subsection, we show how to represent semialgebraic sets as the kernel of ISD functions. This is a semialgebraic analogue to the standard technique in differential geometry of constructing smooth manifolds from the level sets of smooth functions (Lee, 2013). Proofs for Proposition 7 and Corollary 8 as well as additional commentary and an illustration can be found in Appendix C. + +Proposition 7. $S \subset \mathbb{R}^m$ is a closed semialgebraic set if and only if there exists $f \in ISD^{1}(\mathbb{R}^{m},\mathbb{R}_{\geq 0})$ such that $\ker (f) = S$ , where $\ker (f) \coloneqq \{x \in \mathbb{R}^m : f(x) = 0\}$ . + +We extend the above theorem to graphs of vector-valued semialgebraic functions with closed graphs. + +Corollary 8. $F:\mathbb{R}^m\to \mathbb{R}^n$ is a semialgebraic function with closed graph if and only if there exists $aG\in ISD^{1}(\mathbb{R}^{m}\times \mathbb{R}^{n},\mathbb{R}_{\geq 0}^{n})$ such that $\ker (G) = gr(F)$ , where $gr(F)\coloneqq \{(x,F(x))\} \subset \mathbb{R}^m\times \mathbb{R}^n$ is the graph of $F$ . + +Corollary 8 makes it computationally possible to find points of the graph of the semialgebraic function $F$ by using a SANN related to an ISD function $G$ , as we will see in Section 4. + +# 3 SEMIALGEBRAIC NEURAL NETWORKS + +# 3.1 ISD NETWORKS + +SANNs are built from auxiliary networks capable of computing ISD functions; we call such networks "ISD networks". As discussed in Section 2, there are various ways to design such networks. An example architecture and its expressivity theorems are provided in Appendix B. + +To streamline notation, we define a class of ISD functions that will be used frequently: + +$$ +\text {D e f i n i t i o n 9 .} I S D \operatorname {n e t} (m, n, k) := I S D (\mathbb {R} ^ {m} \times \mathbb {R} ^ {n + k} \times \mathbb {R}, \mathbb {R} ^ {(n + k) \times (n + k)} \times \mathbb {R} ^ {n + k}) +$$ + +A function in $ISDnet(m,n,k)$ accepts three parameters $x \in \mathbb{R}^m$ , $z \in \mathbb{R}^{n+k}$ , and $s \in \mathbb{R}$ , and it returns a matrix $M \in \mathbb{R}^{(n+k) \times (n+k)}$ and vector $b \in \mathbb{R}^{(n+k)}$ . We further decompose $z = (y,t)$ where $y \in \mathbb{R}^n$ is the output of the computed semialgebraic function and $t \in \mathbb{R}^k$ are auxiliary "time" variables needed for the homotopy continuation constructions in Section 4. Including these auxiliary variables is analogous to "lifting" (i.e. increasing the width) common in many architectures. Such lifting is required for narrow ReLU networks to be universal approximators in the infinite-layer limit (Lu et al., 2017). A similar strategy is used in Dupont et al. (2019) to augment Neural ODEs. + +We require only $k = 1$ in our constructions, but it is easy to extend the arguments to $k > 1$ . Larger values of $k$ may have practical benefits not captured by the characterization of the range of SANNs presented here, and we leave that investigation for future work. + +# 3.2 SANN ARCHITECTURE + +We define SANNs to be functions of the form $f_{\mathcal{N},c_{\max}}:x\mapsto \Pi z_N$ , where $\mathcal{N}\in ISDnet(m,n,k)$ , $N\in \mathbb{N}$ , $c_{\mathrm{max}} > 0$ , $x\in \mathbb{R}^m$ , and $z_{N}$ is obtained by an approximation of the solution of an ordinary differential equation, that is, by setting $z_0 = 0$ and defining for $j = 0,1,\ldots ,N - 1$ + +$$ +z _ {j + 1} = \text {O D E - s t e p} \left(\dot {z} _ {j}, z _ {j}, \frac {j}{N}\right) := z _ {j} + \frac {1}{N} \dot {z} _ {j} \tag {2} +$$ + +where + +$$ +\dot {z} _ {j} = \operatorname {c l a m p - s o l} \left(M \left(x, z _ {j}, \frac {j}{N}\right), b \left(x, z _ {j}, \frac {j}{N}\right)\right). \tag {3} +$$ + +Matrix $M(x,z,s)$ and vector $b(x,z,s)$ are the output of an ISD network $\mathcal{N}(x,z,s)$ . The function clamp-sol is defined + +$$ +\operatorname {c l a m p - s o l} (M, b) := \left\{ \begin{array}{l l} \operatorname {c l a m p} \left(M ^ {- 1} b, - c _ {\max }, c _ {\max }\right) & \text {i f M i s i n v e r t i b l e} \\ 0 & \text {o t h e r w i s e .} \end{array} \right. \tag {4} +$$ + +![](images/f37fe66164b470cdf0105d96655007fb47c097a7413c62407a27c34c213e560b.jpg) +Figure 2: Architecture diagram for a SANN. The SANN outputs $y$ as a semialgebraic function of input $x$ . Vectors $z_{j}$ are the current values of an ODE at timestep $j$ . The time-derivative $\dot{z}_j$ is computed using a neural network $\mathcal{N}$ capable of computing ISD piecewise polynomials. $\mathcal{N}$ accepts the current ODE state $(z_{j},j / N)$ , as well as recurrent input $x$ . The output of $\mathcal{N}$ is a matrix $M$ and vector $b$ , from which $\dot{z}_j$ is computed using clamp-sol $(M,b)$ $(\dot{z}_i = M^{-1}b$ in the common case). ODE-step is a single update of a numerical ODE solver. Finally, $\Pi$ is a projection operation such that $y$ is the first $n$ components of $z$ . + +The function "clamp" operates component-wise on each element of a vector, and is defined + +$$ +\operatorname {c l a m p} (a, \text {l o w}, \text {h i g h}) := \left\{ \begin{array}{l l} a, & a \in [ \text {l o w}, \text {h i g h} ] \\ \text {l o w}, & a < \text {l o w} \\ \text {h i g h} & a > \text {h i g h}. \end{array} \right. \tag {5} +$$ + +These functions guarantee the iteration (3) is well-defined even when $\mathcal{N}$ produces singular or nearly-singular output matrices $M$ . Lastly, $\Pi$ projects onto the first $n$ components of its input. + +The iteration (3) is the Euler finite-difference scheme that approximates the solution of the ODE + +$$ +\dot {z} (s) = \operatorname {c l a m p - s o l} (M (x, z (s), s), b (x, z (s), s)), \tag {6} +$$ + +$$ +z (0) = 0. \tag {7} +$$ + +As $N\to \infty$ , the output of the finite difference scheme converges to the solution of the ODE. These limit functions are of the form $f_{\mathcal{N},c_{\mathrm{max}}}^{lim}:x\mapsto \Pi z(1)$ that are defined by the ODE (6)-(7). We call these functions as the limit functions of SANNs and denote those by $SANN^{lim}(\mathcal{N},\cdot ,c_{\mathrm{max}})$ . We note that the forward-Euler definition for ODE-step used in (2) can be replaced with other numerical solvers, such as Runge-Kutta methods. + +# 3.3 SANN ARCHITECTURE: ALGORITHMIC PRESENTATION + +The above definition of the SANN architecture is amenable to mathematical analysis. Algorithm 1 is an alternative presentation that closely reflects how a SANN may be implemented in a functional programming style. It is completely equivalent to the description above. + +Algorithm 1 Evaluating a SANN +```txt +Require: $\mathcal{N}\in ISDnet(m,n,k)$ $x\in \mathbb{R}^m$ $c_{\mathrm{max}}\in \mathbb{R}_{\geq 0}$ +1: function SANN(N, x, cmax) +2: function $\dot{z} (z,s)$ +3: $(M,b)\gets \mathcal{N}(x,z,s)$ +4: if M is singular then +5: return 0 +6: else +7: return clamp(M-1b,-cmax,cmax) +8: $(y,t)\gets \mathrm{ODESolve}(\dot{z},(0,0))$ +9: return y +``` + +In Algorithm 1, ODESolve $(\dot{z}, z(0))$ outputs $z_N$ according to the finite difference scheme in formulas (2), or another numerical solver chosen by the programmer. This interface reflects popular libraries for numerically solving ODEs, e.g. Malengier et al. (2018); Kidger (2021). + +Remark. Our expressivity proofs below refer to the true solution $z(1)$ to the ODE (6)-(7) rather than the numerical solution $z_{N}$ . The numerical ODE solver may introduce approximation error into SANNs, even for semialgebraic functions, but this approximation error is of a fundamentally different character than that which normally arises in neural networks, and the mitigation strategies will be different for SANNs. For example, increasing the number of steps $N$ will decrease the approximation error without increasing the number of parameters in the network. On the other hand, increasing the number of parameters in $\mathcal{N}$ does not decrease the approximation error, as it generally would for other architectures. Furthermore, SANNs may be constructed using other numerical strategies besides the finite-difference scheme (2). Changing this scheme does not affect our expressivity proofs in this paper, but there may be other implications in practice. + +# 3.4 TRAINING + +In the supervised learning regime, we are given training data $\{(x^{(\ell)},y^{(\ell)}):\ell = 1,2,\ldots ,L\}$ $y^{(\ell)} = F(x^{(\ell)})$ where $F$ is the target semialgebraic function. The output of a SANN with input $x$ is $y_{N}(x)\coloneqq \Pi z_{N}$ and the intermediate update directions given in equation (3) are $\dot{y}_j(x)\coloneqq \Pi \dot{z}_j$ . In our experiments, we found it helpful to include a "direction loss" term to train each $y_{j}$ for $j = 1,\dots ,N$ .. + +$$ +\mathcal {L} _ {\text {d i r e c t i o n}} \left(x ^ {(\ell)}\right) := \frac {1}{N} \sum_ {j = 1} ^ {N} \left\| y ^ {(\ell)} - \left(y _ {j} \left(x ^ {(\ell)}\right) + \left(1 - \frac {j}{N}\right) \dot {y} _ {j} \left(x ^ {(\ell)}\right)\right) \right\| ^ {2}, \tag {8} +$$ + +$$ +\mathcal {L} _ {\text {a c c u r a c y}} \left(x ^ {(\ell)}\right) := \left\| y ^ {(\ell)} - y _ {N} \left(x ^ {(\ell)}\right) \right\| ^ {2}, \quad \mathcal {L} _ {\text {t o t a l}} := \sum_ {\ell = 1} ^ {L} \mathcal {L} _ {\text {a c c u r a c y}} \left(x ^ {(\ell)}\right) + \lambda \mathcal {L} _ {\text {d i r e c t i o n}} \left(x ^ {(\ell)}\right) \tag {9} +$$ + +where $\lambda > 0$ is a small, suitably chosen parameter, e.g. $\lambda = 10^{-2}$ . $\mathcal{L}_{\mathrm{direction}}$ reflects the accuracy loss if the direction vector $\dot{y}_j$ were held constant for the remainder of the numerical integration. + +# 4 EXPRESSIVITY OF SANNS + +In this section, we show that SANNs are capable of exactly representing any bounded semialgebraic function. We start by showing that every continuous semialgebraic function can be evaluated by a particular homotopy continuation method that is computable by iteratively solving the ODE (6)-(7) with different parameter functions $\mathcal{N}$ . We then extend this result to cover discontinuous semialgebraic functions by first separating each connected component of the graph, applying results for the continuous case to obtain homotopies that represent each piece, then glueing these homotopies together in a manner consistent with ODE (6)-(7) to obtain the SANN. Additional details, including background in semialgebraic geometry and full proofs of the theorems we present here, are in Appendices D and E. + +# 4.1 CONTINUOUS SEMIALGEBRAIC FUNCTIONS + +This section introduces a family of homotopies $H_{x,a}$ from which we can construct a continuation method to evaluate the roots of ISD functions. + +Let $u_{F} < u_{H}$ be positive real numbers and $U_{F} = (-u_{F}, u_{F})^{n}$ . Consider the family of homotopies $H_{x,a}: \mathbb{R}^n \times \mathbb{R} \to \mathbb{R}^n$ , parameterized by $(x, a) \in \mathbb{R}^m \times U_F$ , defined + +$$ +H _ {x, a} (y, t) := (1 - t) (y - a) + t \left(g (x, y) + G (x, y)\right) \tag {10} +$$ + +where $g\in ISD_{loc}^{1}(\mathbb{R}^{m}\times \mathbb{R}^{n},\mathbb{R}_{\geq 0}^{n})$ and $G\in ISD^{1}(\mathbb{R}^{m}\times \mathbb{R}^{n},\mathbb{R}^{n})$ . Each $H_{x,a}$ is constructed from ring operations on locally ISD functions, so it is locally ISD itself. + +We always evaluate $H_{x,a}$ keeping $x$ fixed; to simplify notation, let $g_x \coloneqq g(x,\cdot)$ and $G_x \coloneqq G(x,\cdot)$ . + +For our construction to work, we require $g_x$ to be 0 on $U_F$ and grow quickly outside $U_F$ . Specifically, for every $x \in \mathbb{R}^m$ , we require $G_x = o(g_x)$ and $\mathrm{id}_y = o(g_x)$ , where we have used Landau "little-o" notation; e.g. $G_x = o(g_x)$ means $\lim_{\| y \| \to +\infty} \frac{G_x(y)}{g_x(y)} = 0$ . + +The next lemma shows how to construct $g_{x}$ based only on $U_{F}$ . + +Lemma 10. There exists $g \in ISD_{loc}^{1}(\mathbb{R}^{m} \times \mathbb{R}^{n}, \mathbb{R}^{n})$ such that $g_{x} \equiv 0$ on $U_{F}$ and for every $G \in ISD^{1}(\mathbb{R}^{m} \times \mathbb{R}^{n}, \mathbb{R}^{n})$ , we have $G_{x} = o(g_{x})$ . + +Proof. Let $u_0 = u_F$ , $u_j = u_{j-1} + 1$ , $U_j = (-u_j, u_j)^n$ for $j \in \mathbb{N}$ . Notice $\mathbb{R}^n = \bigcup_{j=1}^\infty U_j$ . Define $g$ piecewise as follows: + +$$ +g (x, y) = \left\{ \begin{array}{l l} 0 & y \in U _ {F} \\ \sum_ {j = 1} ^ {J} (\operatorname {R e L U} (\operatorname {s i g n} (y) y - u _ {j - 1} \mathbf {1})) ^ {j + 1} & y \in U _ {J} \backslash U _ {J - 1}, \text {f o r e a c h} J \in \mathbb {N}. \end{array} \right. \tag {11} +$$ + +(The exponent $j + 1$ denotes repeated component-wise multiplication.) This $g$ is not ISD since it is defined over infinitely many regions, but it is locally ISD. Furthermore, the local degree of $g$ increases without bound as $\| y \| \to \infty$ , so $g$ eventually dominates any polynomial. Thus $G_x = o(g_x)$ for any ISD $G$ . Finally, it is straightforward to verify $g$ is continuously differentiable. + +The next theorem shows the family of homotopies in equation (10) is capable of representing any continuous bounded semialgebraic function $F$ for almost every choice of $a$ ; more precisely every $a$ except possibly on a semialgebraic set of dimension less than $n$ (c.f. the Transversality theorem in D.1). The requirement that $F$ be bounded is always satisfied when the domain of continuous $F$ is compact, which is a common and reasonable assumption in the context of machine learning with finite training data. The proof of Theorem 11 is in appendix E. + +Theorem 11. Let $F: \mathbb{R}^m \to U_F$ be a given continuous semialgebraic function. For every $x \in \mathbb{R}^m$ there exists $H_{x,a}$ with the form (10) such that for almost every $a \in U_F$ , the following hold: + +1. There exists $y \in ISD([0,1],\mathbb{R}^n), t \in ISD([0,1],\mathbb{R})$ , such that $t(0) = 0$ , $t(1) = 1$ , and $(y(s),t(s)) \in \ker (H_{x,a})$ for all $s \in [0,1]$ . +2. The kernel of $H_{x,a}(\cdot, 1)$ is the singleton $\{F(x)\}$ . + +Theorem 11 is used as follows: When $t = 0$ the function $y \mapsto H_{x,a}(y,0)$ has the root $a$ . We apply the curve-tracing algorithm by solving the ODE (30)-(33) (see Appendix D.3) for the function $H_{x,a}$ to find roots of the functions $H_{x,a}(\cdot ,t)$ with $t\in [0,1]$ . The root of $H_{x,a}(\cdot ,1)$ gives $y = F(x)$ . + +Conclusion 1 guarantees the homotopy $H_{x,a}(y,t)$ can be solved to time $t = 1$ for almost every choice of $a$ ; SANNs correspond to the choice $a = 0$ . Conclusion 2 guarantees this solution is indeed the desired value $F(x)$ . + +To prove that SANNs can represent any continuous semialgebraic function, we need only show that the ODE (6)-(7) defining SANNs can recapitulate the ODE (30)-(33) defining the $H_{x,a}$ homotopy continuation method. A full proof is in Appendix E. + +Theorem 12. Let $F:\mathbb{R}^m\to U_F$ be a given continuous semialgebraic function. Then there exists $\mathcal{N}\in ISDnet(m,n,1)$ and $c_{\mathrm{max}} > 0$ such that $\mathsf{SANN}^{lim}(\mathcal{N},\cdot ,c_{\mathrm{max}}) = F$ + +# 4.2 DISCONTINUOUS SEMIALGEBRAIC FUNCTIONS + +Discontinuities can arise in the ODE (6)-(7) since the value of $\dot{z} = M^{-1}b$ can be discontinuous across a boundary where $M$ is singular. Consider the simple example + +$$ +M = \left[ \operatorname {a b s} (x) \right] \quad b = [ x ] \quad \dot {z} = \operatorname {c l a m p - s o l} (M, b) = \left\{ \begin{array}{l l} - 1 & x < 0 \\ 1 & x > 0, \end{array} \right. \tag {12} +$$ + +where the clamp-sol operation is defined with $c_{max} = 2$ . We exploit this behavior to show via construction that SANNs can exactly represent even discontinuous semialgebraic functions. + +Theorem 13. Let $F:\mathbb{R}^m\to \mathbb{R}^n$ be a (possibly discontinuous) bounded semialgebraic function. Then there exists $\mathcal{N}\in ISDnet(m,n,1)$ and $c_{\mathrm{max}}\in \mathbb{R}_{\geq 0}$ such that SANNlim $(\mathcal{N},\cdot ,c_{\mathrm{max}}) = F$ + +Every semialgebraic set has finitely many semialgebraic connected components, so every semialgebraic function is piecewise continuous on finitely many pieces. Our approach is to first show how we are able to represent the characteristic function of semialgebraic sets using the ODE (6)-(7). From these, we can represent a semialgebraic decomposition of the domain $\mathbb{R}^m$ , and apply the continuous homotopy arguments above on each continuous region. We finally glue everything together in a way consistent with solving the ODE (6)-(7). The full proof is in Appendix E. + +# 5 NUMERICAL EXAMPLE: SOLVING LINEAR SYSTEMS + +In this section, we give an example of a numerical algorithm that can be exactly represented by a SANN. Specifically, we construct a SANN that exactly computes (to machine precision) the solution to a linear system $Xy = b$ , something that is not possible for standard neural network architectures. The parameters for this exact reconstruction are chosen by hand; we also show that SANNs can be trained from data using traditional techniques to perform comparably to feed-forward networks. + +We focus on the Jacobi iteration method for solving dense linear systems $Xy = g$ . Split $X$ into its diagonal part $D$ , upper-triangular part $U$ , and lower-triangular part $L$ . + +$$ +X = \left[ \begin{array}{c c c} d _ {1} & & U \\ & \ddots & \\ L & & d _ {n} \end{array} \right], \quad D = \operatorname {d i a g} \left(d _ {1}, d _ {2}, \dots , d _ {n}\right). \tag {13} +$$ + +From any initial guess $y_0$ , the Jacobi iteration method computes the iteration $y_j$ using + +$$ +y _ {j + 1} = D ^ {- 1} \left(g - (L + U) y _ {j}\right). \tag {14} +$$ + +Adding $y_{j} - y_{j}$ to the right side and simplifying yields + +$$ +y _ {j + 1} = y _ {j} + D ^ {- 1} \left(g - X y _ {j}\right). \tag {15} +$$ + +The sequence of iterates $(y_{1},y_{2},\ldots)$ computed in this way converges to the exact solution $y^{*} = X^{-1}b$ when the spectral radius of $D^{-1}(L + U)$ is less than 1. It is exactly of the form (2), and thus computable by a SANN with an appropriate ISD network $\mathcal{N}$ . + +An additional numerical example addressing a nonlinear inverse problem for electrical resistor networks is in Appendix F. The problem is to find the values of an unknown resistivity function on a graph from the voltage-to-current measurements on a subset of the nodes of the graph. This problem is encountered in Electrical Impedance Tomography (Borcea, 2002), a medical imaging modality, and its mathematical treatment is based on a Finite Element approximation of a partial differential equation (Lassas et al., 2015). + +# 5.1 EXACT INVERSION USING A HAND-CRAFTED NETWORK + +To demonstrate the new possibilities afforded by the expressive power of SANNs, we manually configured the parameters of a SANN to replicate the classical Jacobi iteration for solving linear systems. With this setup, the SANN is able to solve the system to machine precision—something standard feed-forward networks, which compute only piecewise-linear functions, cannot achieve. + +Figure 3 shows the error of $y_{j} = \Pi z_{j}$ decrease to machine precision for several inputs $(X, g)$ + +![](images/edbf74eba4964a64ff96d18095cc62b5cb928b43337f1a0244bdd9cba7e0630e.jpg) +Figure 3: Trajectories of a SANN that solves linear systems to machine precision. Given a matrix $X \in \mathbb{R}^{50 \times 50}$ and vector $b \in \mathbb{R}^{50}$ , the network produces a vector $y \in \mathbb{R}^{50}$ such that $Xy = b$ . Each line shows the trajectory of the output $y$ for a given input pair $(X, g)$ as the SANN's ODE is iteratively solved. At each timestep, the network performs a single Jacobi iteration update. The output of the network exactly matches the output of 100 steps of Jacobi iteration. + +# 5.2 RESULTS OF TRAINING + +To demonstrate the feasibility of training SANNs, we trained a SANN to solve $10 \times 10$ linear systems; given matrix $X \in \mathbb{R}^{10 \times 10}$ and vector $g \in \mathbb{R}^{10}$ , find vector $y \in \mathbb{R}^{10}$ such that $Xy = g$ . + +The SANN uses a 2-layer Matrix-Recurrent Neural Network (see appendix B) as the underlying ISD network $\mathcal{N}$ . We used Adam optimizer to minimize the loss $\mathcal{L}_{\mathrm{total}}$ from equation (8). + +To benchmark SANNs against standard techniques, we trained a two-layer feed-forward neural network with a comparable number of parameters on the same task. Table 1 summarizes the results. In this experiment, the SANN achieved marginally better accuracy with slightly fewer parameters. + +
# parametersValidation accuracy ||Xy - g||2
Feed forward network306, 1400.166
SANN291, 7200.101
+ +Table 1: Results of training a SANN and feed-forward neural network to solve linear systems. Given a $10 \times 10$ matrix $X$ and and vector $g$ , the networks output $y$ such that $X y \approx g$ . + +While we refrain from claiming significant numerical advantages for SANNs at this stage, the results underscore the feasibility of training these architectures. + +The input matrices $X$ were sampled from a distribution of strictly diagonally dominant matrices, ensuring that a SANN theoretically exists that can solve for $y$ to machine precision (as in the hand-crafted example from the previous subsection). However, further research is needed to determine how to effectively optimize network parameters to achieve such precision. + +# 6 DISCUSSION AND FUTURE WORK + +We consider the SANN architecture presented in this paper to be the most general form of a new family of neural networks designed to compute semialgebraic functions. In practice, this architecture can be restricted in various ways to improve performance on specific tasks. This is analogous to convolutional neural networks (CNNs), which are a subset of standard feed-forward neural networks. While CNNs have far fewer parameters and cannot compute arbitrary piecewise-linear functions, they excel at tasks involving translational symmetry (e.g., image classification). Similarly, in future work, we aim to identify and develop specialized variants of the SANN architecture that compute subsets of semialgebraic functions tailored to particular tasks. + +One interesting modification is to change line 3 of Algorithm 1 to have the ISD network $\mathcal{N}$ output an $LU$ factorization of $M$ rather than $M$ itself. This change would increase the speed of the networks since solving two triangular systems $LUz = b$ is significantly faster than solving a general linear system $Mz = b$ . Furthermore, we could create a continuous variant of SANNs by requiring the diagonal elements of $L$ and $U$ to be positive and bounded away from 0. Such changes likely have many practical advantages; however, our expressivity proofs would no longer directly apply. Not every ISD matrix $M$ has an $LU$ decomposition in terms of ISD $L$ and $U$ , and it is not clear whether this would be sufficient to apply our homotopy continuation arguments. Regardless, these modified SANNs compute a large class of semialgebraic functions not possible for most other architectures. + +Efficient training of SANNs remains an open challenge. It is currently feasible to train SANNs using established techniques such as backpropagation when explicit time-stepping is used to evaluate the network's ODE (as we have done here). The adjoint sensitivity method (Pontryagin et al., 1962) can be used when other ODE solvers are employed, as in Neural ODEs (Chen et al., 2019). However, the unique structure of the SANN architecture offers opportunities for novel training strategies. New approaches are needed to take full advantage of the expressive power of SANNs. + +# 7 CONCLUSION + +We have presented new representation theorems for semialgebraic functions along with a novel neural network architecture capable of representing all bounded semialgebraic functions. Our methods are inspired by homotopy continuation methods for root finding, and the architecture is simple to implement using existing machine learning tools. We believe our SANNs build a new bridge between semialgebraic geometry (also called "real algebraic geometry") and machine learning, opening new avenues for both theoretical exploration and practical applications. + +# ACKNOWLEDGMENTS + +The authors thank the anonymous ICLR reviewers for helpful comments on an earlier version of this manuscript. M. V. de Hoop and S. D. Mis acknowledge the support of the Simons Foundation under the $\mathrm{MATH} + \mathrm{X}$ Program, the Department of Energy under grant DE-SC0020345, the Occidental Petroleum Corporation and the corporate members of the Geo-Mathematical Imaging Group at Rice University. M. Lassas was partially supported by a AdG project 101097198 of the European Research Council, Centre of Excellence of Research Council of Finland and the FAME flagship of the Research Council of Finland (grant 359186). Views and opinions expressed are those of the authors only and do not necessarily reflect those of the funding agencies or the EU. Neither the European Union nor the granting authority can be held responsible for them. + +# REFERENCES + +Ralph Abraham and Joel Robbin. Transversal Mappings and Flows. W. A. Benjamin, Inc., 1967. +Shaojie Bai, J. Zico Kolter, and Vladlen Koltun. Deep Equilibrium Models. Advances in neural information processing systems, Oct 2019. +Randall Balestriero and Richard G. Baraniuk. Mad Max: Affine Spline Insights Into Deep Learning. Proceedings of the IEEE, 109(5):704-727, 2021. doi: 10.1109/jproc.2020.3042100. +A. I. Beltzer. Variational and finite element methods. Springer-Verlag, Berlin, 1990. ISBN 3-540-51598-4. doi: 10.1007/978-3-642-83914-6. A symbolic computation approach. +Garrett Birkhoff. Lattice Theory. Number 25 in Colloquium Publications / American Mathematical Society. American Mathematical Society, Providence, RI, 2 edition, 1948. +Garrett Birkhoff and R.S. Pierce. Lattice-ordered Rings. Anais da Academia Brasileira de Ciencias., 28:41-69, 1956. +Jacek Bochnak and Gustave Efroymson. Real algebraic geometry and the 17th Hilbert problem. Mathematische Annalen, 251(3):213-241, Oct 1980. ISSN 0025-5831, 1432-1807. doi: 10.1007/bf01428942. +Jacek Bochnak, Michel Coste, and Marie-Francoise Roy. Real Algebraic Geometry. Springer, 1 edition, 1998. ISBN 3-540-64663-9. +Helmut Bölskei, Philipp Grohs, Gitta Kutyniok, and Philipp Petersen. Optimal Approximation with Sparsely Connected Deep Neural Networks, may 2018. +Liliana Borcea. Electrical impedance tomography. Inverse Problems, 18(6):R99-r136, 2002. ISSN 0266-5611. doi: 10.1088/0266-5611/18/6/201. +Nicolas Boulle, Yuji Nakatsukasa, and Alex Townsend. Rational neural networks, Sep 2020. +Iacopo Cappellini, Laura Campiglia, Lucia Zamidei, and Guglielmo Consales. Electrical impedance tomography (eit) to optimize ventilatory management in critically ill patients: A report of two cases. Anesthesia Research, 1(1):3-7, 2024. ISSN 2813-5806. doi: 10.3390/anesthres1010002. +Ricky T. Q. Chen, Yulia Rubanova, Jesse Bettencourt, and David Duvenaud. Neural Ordinary Differential Equations, Dec 2019. +Tianran Chen and Tien-Yien Li. Homotopy continuation method for solving systems of nonlinear and polynomial equations. Communications in Information and Systems, 15(2):119-307, 2015. +Grigorios Chrysos, Stylianos Moschoglou, Giorgos Bouritsas, Jiankang Deng, Yannis Panagakis, and Stefanos Zafeiriou. Deep Polynomial Neural Networks. IEEE Transactions on Pattern Analysis and Machine Intelligence, 44(8):4021-4034, 2021. doi: 10.1109/tpami.2021.3058891. +Edward Curtis and James Morrow. Inverse Problems for Electrical Networks. World Scientific Publishing Company, 2000. + +Maarten V de Hoop, Matti Lassas, and Christopher A Wong. Deep learning architectures for nonlinear operator functions and nonlinear inverse problems. Mathematical Statistics and Learning, 4(1):1-86, 2022. +Stanislas Ducotterd, Alexis Goujon, Pakshal Bohra, Dimitris Perdios, Sebastian Neumayer, and Michael Unser. Improving lipschitz-constrained neural networks by learning activation functions. Journal of Machine Learning Research, 25(65):1-30, 2024. +Emilien Dupont, Arnaud Doucet, and Yee Whye Teh. Augmented Neural ODEs, Oct 2019. +Laurent El Ghaoui, Fangda Gu, Bertrand Travacca, Armin Askari, and Alicia Tsai. Implicit Deep Learning. SIAM Journal on Mathematics of Data Science, 3(3):930-958, Jan 2021. ISSN 2577-0187. doi: 10.1137/20m1358517. +Feng-Lei Fan, Jinjun Xiong, Mengzhou Li, and Ge Wang. On Interpretability of Artificial Neural Networks: A Survey. IEEE Transactions on Radiation and Plasma Medical Sciences, 5(6):741-760, Nov 2021. ISSN 2469-7311, 2469-7303. doi: 10.1109/trpms.2021.3066428. +Stefan Forcey. Circular planar electrical networks, Split systems, and Phylogenetic networks. SIAM Journal on Applied Algebra and Geometry, 7(1):49-76, 2023. +Takashi Furuya, Maarten V. de Hoop, and Gabriel Peyre. Transformers are Universal In-context Learners, Oct 2024. +A. W. Hager and D. G. Johnson. Some comments and examples on generation of (hyper-)archimedean l-groups and f-rings. Annales de la Faculté des sciences de Toulouse : Mathématiques, 19(S1):75-100, Aug 2010. ISSN 2258-7519. doi: 10.5802/afst.1276. +Melvin Henriksen and John Isbell. Lattice-ordered rings and function rings. Pacific Journal of Mathematics, 12(2):533-565, Jun 1962. ISSN 0030-8730, 0030-8730. doi: 10.2140/pjm.1962.12.533. +Tosio Kato. *Perturbation theory for linear operators*. Classics in Mathematics. Springer-Verlag, Berlin, 1995. ISBN 3-540-58661-x. Reprint of the 1980 edition. +Patrick Kidger. On Neural Differential Equations. PhD thesis, University of Oxford, 2021. +Zico Kolter, David Duvenaud, and Matt Johnson. Deep Implicit Layers - Neural ODEs, Deep Equilibrum Models, and Beyond. http://implicit-layers-tutorial.org/, 2020. +Steven G. Krantz and Harold R. Parks. The Implicit Function Theorem. Birkhäuser Boston, Boston, MA, 2003. ISBN 978-1-4612-0059-8. doi: 10.1007/978-1-4612-0059-8. +K. Kurdyka, P. Orro, and S. Simon. Semialgebraic Sard Theorem for Generalized Critical Values. Journal of Differential Geometry, 56(1), Sep 2000. ISSN 0022-040x. doi: 10.4310/jdg/1090347525. +Matti Lassas, Mikko Salo, and Leo Tzou. Inverse problems and invisibility cloaking for FEM models and resistor networks. Math. Models Methods Appl. Sci., 25(2):309-342, 2015. ISSN 0218-2025. doi: 10.1142/s0218202515500116. +Jean Bernard Lasserre. An Introduction to Polynomial and Semi-Algebraic Optimization. Cambridge University Press, 1 edition, Feb 2015. ISBN 978-1-107-63069-7 978-1-107-44722-6 978-1-107-06057-9. doi: 10.1017/cbo9781107447226. +John M. Lee. Introduction to Smooth Manifolds. Number 218 in Graduate Texts in Mathematics. Springer, New York; London, 2nd ed edition, 2013. ISBN 978-1-4419-9981-8 978-1-4419-9982-5. +Stanislaw Lojasiewicz. Ensembles Semi-analytiques, 1964. +Zhou Lu, Hongming Pu, Feicheng Wang, Zhiqiang Hu, and Liwei Wang. The expressive power of neural networks: A view from the width. Advances in neural information processing systems, 30, 2017. + +James J. Madden. Henriksen and Isbell on f-rings. Topology and its Applications, 158(14):1768-1773, Sep 2011. ISSN 01668641. doi: 10.1016/j.topol.2011.06.011. +Louis Mahe. On the Pierce-Birkhoff conjecture in three variables. Journal of Pure and Applied Algebra, 211(2):459-470, Nov 2007. ISSN 00224049. doi: 10.1016/j.jpaa.2007.01.012. +Louis Mahe. On the Pierce-Birkhoff conjecture. Rocky Mountain Journal of Mathematics, 14(4), Dec 1984. ISSN 0035-7596. doi: 10.1216/rmj-1984-14-4-983. +Benny Malengier, Pavol Kishon, James Tocknell, Claas Abert, Florian Bruckner, and Marc-Antonio Bisotti. ODES: A high level interface to ODE and DAE solvers. The Journal of Open Source Software, 3(22):165, Feb 2018. doi: 10.21105/joss.00165. +Swann Marx, Edouard Pauwels, Tillmann Weisser, Didier Henrion, and Jean Bernard Lasserre. Semi-algebraic approximation using Christoffel-Darboux kernel. Constructive Approximation, pp. 1-39, 2021. +Guido Montúfar, Razvan Pascanu, Kyunghyun Cho, and Yoshua Bengio. On the Number of Linear Regions of Deep Neural Networks, Jun 2014. +Sung-Kwun Oh, Witold Pedrycz, and Byoung-Jun Park. Polynomial neural networks architecture: Analysis and design. Computers & Electrical Engineering, 29(6):703-725, Aug 2003. ISSN 00457906. doi: 10.1016/s0045-7906(02)00045-9. +Philipp Petersen, Mones Raslan, and Felix Voigtlaender. Topological properties of the set of functions generated by neural networks of fixed size. Found. Comput. Math., 21(2):375-444, 2021. ISSN 1615-3375. doi: 10.1007/s10208-020-09461-0. +Lev Semenovich Pontryagin, EF Mishchenko, VG Boltyanskii, and RV Gamkrelidze. The Mathematical Theory of Optimal Processes. John Wiley & Sons, 1962. +William H. Press, Saul A. Teukolsky, William T. Vetterling, and Brian P. Flannery. Numerical recipes. Cambridge University Press, Cambridge, third edition, 2007. ISBN 978-0-521-88068-8. The art of scientific computing. +A. Seidenberg. A New Decision Method for Elementary Algebra. The Annals of Mathematics, 60 (2):365, Sep 1954. ISSN 0003486x. doi: 10.2307/1969640. +Endre Süli and D. F. Mayers. An Introduction to Numerical Analysis. Cambridge University Press, Cambridge; New York, 2003. ISBN 978-0-521-81026-5 978-0-521-00794-8. +Alfred Tarski. A Decision Method for Elementary Algebra and Geometry. University of California Press, 1951. +Dinesh Valluri and Rory Campbell. On the Space of Coefficients of a Feedforward Neural Network. In 2023 International Joint Conference on Neural Networks (IJCNN), pp. 1-7, Gold Coast, Australia, Jun 2023. IEEE. ISBN 978-1-66548-867-9. doi: 10.1109/ijcnn54540.2023.10191403. +Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention Is All You Need, Aug 2023. +Zichao Wang, Randall Balestriero, and Richard Baraniuk. A Max-affine Spline Perspective Of Recurrent Neural Networks. In International Conference on Learning Representations, 2019. + +# A LATTICE-ORDERED RINGS OF PIECEWISE POLYNOMIALS + +This appendix introduces the classical theory of "lattice-ordered" and "function" rings, culminating in a statement of Henricksen's and Isbell's theorem for generating $f$ -rings from subrings. This is the key lemma in our proof that the space of functions computable by MRNNs is closed under ring and lattice operations—vector addition, Hadamard product, min and max. + +We use the following standard conventions: Group operations are denoted “+”, and ring multiplication operations are denoted “*”. When there is no ambiguity, the ring multiplication operation + +$f*g$ may be written $fg$ . If $R$ is a given ring, the polynomial ring in $n$ variables with coefficients in $R$ is denoted $R[X_1,\ldots ,X_n]$ . Direct products are denoted “ $\times$ ”, and we reserve $\otimes$ for Kronecker products of matrices. Lattice operations are denoted $\wedge$ for “ $\inf$ ” (“meet”) and $\vee$ for “ $\sup$ ” (“join”). We use the shorthand $f^{+}:= f\lor 0$ , $f^{-}:= (-f)\lor 0$ , and $|f|:= f\lor (-f)$ . In this paper, + +$$ +f \vee g = \max (f, g), \quad \text {a n d} \quad f \wedge g = \min (f, g), +$$ + +although in general there are other choices for the lattice operations. Observe also that + +$$ +f \vee g = f + \operatorname {R e L U} (g - f), \quad \text {a n d} \quad f \wedge g = f - \operatorname {R e L U} (f - g). +$$ + +Furthermore, $f \leq g$ means $f \wedge g = f$ and $f \vee g = g$ , while the obvious dual statement holds for $f \geq g$ . + +In the terminology of neural networks, $f^{+}$ is precisely $\mathrm{ReLU}(f)$ when the lattice is built over $\mathbb{R}^n$ and the meet/join operations are component-wise min/max. + +Definition 14 ( $\ell$ -rings). An $\ell$ -ring (short for "lattice-ordered ring") is a tuple $(R, +, *, \wedge, \vee)$ that is a ring with operations $+$ , $*$ , a lattice with operations $\wedge$ , $\vee$ , and the following compatibility conditions are satisfied: + +$$ +f \leq g \Rightarrow h + f \leq h + g \text {f o r a l l} f, g, h \in R, \tag {16} +$$ + +$$ +f \geq 0 \text {a n d} g \geq 0 \Rightarrow f g \geq 0. \tag {17} +$$ + +We will often refer to an $\ell$ -ring $(R, +, *, \wedge, \vee)$ simply by its underlying set $R$ . + +An $\ell$ -ring homomorphism preserves both ring an lattice operations. + +Remark. The original masters did not require $\ell$ -rings to have commutative addition (i.e. be an Abelian groups) or have multiplicative identities. These generalizations are not important to us here, and what we call " $\ell$ -ring" is often called " $\ell$ -ring with unity" in the literature. All our $\ell$ -rings are abelian groups and have multiplicative identity. + +Every $\ell$ -ring is a distributive lattice1 (Birkhoff, 1948); that is, + +$$ +f \vee (g \wedge h) = (f \vee g) \wedge (f \vee h) \quad \text {a n d} \quad f \wedge (g \vee h) = (f \wedge g) \vee (f \wedge h) +$$ + +hold for all $f, g, h \in R$ . In particular, every lattice polynomial can be written in the form + +$$ +\bigwedge_ {i \in I} \bigvee_ {j \in J _ {i}} f _ {j} +$$ + +with $I,J_{i}\subset \mathbb{N}$ and $f_{j}\in R$ + +Garrett Birkhoff demonstrated $\ell$ -rings can have surprising pathologies; for example, he constructed an $\ell$ -ring whose multiplicative identity was both negative and a square (Birkhoff & Pierce, 1956). The following definition introduces an additional compatibility condition that prevents the most troublesome pathologies. + +Definition 15. An $f$ -ring (short for "function ring") is a $\ell$ -ring where + +$$ +\text {I f} f, g, h \geq 0 \text {a n d} g \wedge h = 0, \text {t h e n} f g \wedge h = 0 \text {a n d} g f \wedge h = 0. \tag {18} +$$ + +Condition (18) can be equivalently stated (Madden, 2011) + +$$ +f ^ {+} g ^ {+} \wedge f ^ {-} = 0 \quad \text {a n d} \quad g ^ {+} f ^ {+} \wedge f ^ {-} = 0 \quad \text {f o r a l l} f, g \in R. +$$ + +Lemma 16. If $R$ is an $\ell$ -ring (resp. $f$ -ring) and $D$ is any set, then functions $F = \{f : D \to R\}$ form an $\ell$ -ring (resp. $f$ -ring) using the operations defined to turn every evaluation map $\phi_x(f) := f(x)$ , $x \in D$ , into an $\ell$ -ring homomorphism (stated simply, these are the "component-wise" operations). + +Proof. For brevity, we forego the verification of the ring and lattice axioms and focus on the compatibility conditions. The first will be treated in detail for illustration, the other two will be more succinct. Let $f, g, h \in F$ . + +- Condition (16): Suppose $f \leq g$ , which means $f(x) \leq g(x)$ for all $x \in D$ : + +$$ +f (x) = (f \wedge g) (x) = \phi_ {x} (f \wedge g) = \phi_ {x} (f) \wedge \phi_ {x} (g) = f (x) \wedge g (x). +$$ + +Since $R$ is $\ell$ -ring, $a + f(x) \leq a + g(x)$ for all $a \in R$ and $x \in D$ . In particular, $h(x) + f(x) \leq h(x) + g(x)$ , and thus + +$$ +\begin{array}{l} \phi_ {x} (h + f) = h (x) + f (x) = \left(h (x) + f (x)\right) \wedge \left(h (x) + g (x)\right) = \\ \phi_ {x} (h + f) \wedge \phi_ {x} (h + g) = \phi_ {x} \big ((h + f) \wedge (h + g) \big) \\ \end{array} +$$ + +Since $\wedge$ in $F$ is defined precisely to turn every $\phi_x$ into a homomorphism, we conclude $h + f = (h + f) \wedge (h + g)$ . + +- Condition (17): Suppose $f, g \geq 0$ , meaning $f(x), g(x) \geq 0$ for all $x \in D$ . Then $f(x)g(x) \geq 0$ since $R$ is an $\ell$ -ring. + +For the last condition, we now suppose $R$ is an $f$ -ring. + +- Condition (18): Suppose $f, g, h \geq 0$ and $f \wedge h = 0$ , meaning $f(x), g(x), h(x) \geq 0$ and $f(x) \wedge h(x) = 0$ for all $x \in D$ . Then + +$$ +(f g \wedge h) (x) = f (x) g (x) \wedge h (x) = 0 +$$ + +since $R$ is an $f$ -ring, and we conclude $fg \wedge h = 0$ . Likewise $gf \wedge h = 0$ . + +![](images/3b4a00c7c80fdbd9e1eef41e966d060606d5c14426c236234d034e09a52c8d34.jpg) + +Example 17. Continuous real-valued functions with component-wise $+ / * / \min / \max$ operations form an $f$ -ring. + +Lemma 18. The direct product of $\ell$ -rings (resp. $f$ -rings) is an $\ell$ -ring (resp. $f$ -ring). + +Proof. The direct product of two $\ell$ -rings or $f$ -rings is clearly both a ring and a lattice, and the relevant compatibility conditions hold in the product since they hold in each component. + +In particular, vector-valued functions $D \to \mathbb{R}^n$ form an $f$ -ring when each component forms an $f$ -ring. + +Lemma 19. If $R$ is an $\ell$ -ring (resp. $f$ -ring) and $R_1 \subseteq R$ is both a subring and sublattice, then $R_1$ is also an $\ell$ -ring (resp. $f$ -ring). + +Proof. We need only verify the compatibility conditions (16), (17) and (18). But since these conditions hold in $R$ , they clearly hold in $R_{1}$ as well. + +The requirement that $R_{1} \subseteq R$ form a sublattice in addition to a subring (rather than just a subring) is a small oversight in (Birkhoff & Pierce, 1956). For example, polynomials form a subring of the $f$ -ring of continuous real functions, but they are not a lattice ( $x$ and $-x$ are both polynomials, but $x \vee -x = |x|$ is not), so polynomials do not themselves form an $f$ -ring. Indeed, this fact will be relevant below to us below. + +Definition 20 (Totally ordered $\ell$ ring). An $\ell$ -ring $R$ is totally ordered if both $f \wedge g$ and $f \vee g$ are in $\{f, g\}$ for all $f, g \in R$ . + +In other words, the lattice of a totally ordered ring induces a total order relation. + +Lemma 21. Every totally ordered ring $R$ is an $f$ -ring. + +Proof. Given $f, g, h \in R$ such that $f, g, h \geq 0$ and $g \wedge h = 0$ , we need to show $fg \wedge h = 0$ and $gf \wedge h = 0$ . Since $R$ is totally ordered, $g \wedge h = 0$ implies either $g = 0$ or $h = 0$ . + +- Case $g = 0$ : We have $fg = gf = 0$ and $fg \wedge h = 0 \wedge h = 0$ since $h \geq 0$ . Identical logic shows $gf \wedge h = 0$ . + +- Case $h = 0$ : From the $\ell$ -ring compatibility condition (17), $fg \geq 0$ and $gf \geq 0$ . Thus $fg \wedge h = fg \wedge 0 = 0$ , likewise $gf \wedge h = gf \wedge 0 = 0$ . + +![](images/fc909424f43dc02255df06ae9982a17593331ece8fd0bac1dbf72e1a6bcbaecd.jpg) + +We can now state the key theorem of this section, which will allow us to generate $f$ -rings of neural networks by bootstrapping from a subring. + +Theorem 22 (Henricksen and Isbell). If $R$ is an $f$ -ring and $R_1 \subset R$ is a subring (not necessarily a sublattice), then the lattice generated by $R_1$ is a subring of $R$ . + +This theorem first appeared in Henriksen & Isbell (1962). The proof is surprisingly non-trivial, and while the key insights were provided by Henriksen and Isbell, they left the proof as an exercise to the reader. The first full proof appears to have been recorded in Hager & Johnson (2010). + +# A.1 INF-SUP DEFINABLE PIECEWISE POLYNOMIALS AND THE PIERCE-BIRKHOFF CONJECTURE + +Definition 23 (Piecewise polynomial). Let $k, n, J \in \mathbb{N}$ , and $D \subset \mathbb{R}^n$ . Then $f: D \to \mathbb{R}$ is piecewise polynomial, or $f \in PWP(D)$ , if there exists a collection of semialgebraic sets $\{S_i\}_{i=1}^J$ such that $D \subset \bigcup_{i=1}^J S_i$ , and a collection of polynomials $\{p_i\}_{i=1}^J \subset \mathbb{R}[X_1, \ldots, X_n]$ such that $f|_{S_i} = p_i$ for all $i = 1, \ldots, J$ . + +A vector-valued function $f: D \to \mathbb{R}^k$ is piecewise polynomial, or $f \in PWP(D, \mathbb{R}^k)$ , if every component function is piecewise polynomial. + +A piecewise polynomial is continuous if and only if there exists a collection of closed semialgebraic sets $\{S_i\}_{i=1}^J$ satisfying Definition 23. + +Lemma 24. Let $n \in \mathbb{N}$ , and $D \subset \mathbb{R}^n$ . Then $PWP(D)$ equipped with component-wise operations is an $f$ -ring. + +Proof. We need only show $PWP(D)$ is both a subring and sublattice of the $f$ -ring of functions $D \to \mathbb{R}$ , then the conclusion follows from Lemma 16. But it is elementary to verify the pointwise sum, product, min and max of two piecewise polynomials is also a pointwise polynomial. + +Corollary 25. Let $k, n \in \mathbb{N}$ , and $D \subset \mathbb{R}^n$ . Then $PWP(D, \mathbb{R}^k)$ is an $f$ -ring. + +Proof. $PWP(D, \mathbb{R}^k)$ is a direct product of $PWP(D, \mathbb{R})$ , so the conclusion follows from Lemma 18. + +We apply Theorem 22 to the subring of $PWP(D,\mathbb{R}^k)$ consisting of the polynomials $D\to \mathbb{R}^k$ + +We obtain the following important theorem: + +Theorem 26. $ISD(\mathbb{R}^n)$ is an $f$ -ring for any $n \in \mathbb{N}$ . + +Both $PWP(\mathbb{R}^n)$ and $ISD(\mathbb{R}^n)$ are $f$ -rings, and clearly $ISD(\mathbb{R}^n) \subseteq PWP(\mathbb{R}^n)$ . Whether the opposite inclusion holds is the famous Pierce-Birkhoff conjecture. + +Conjecture 27 (Pierce-Birkhoff). $ISD(\mathbb{R}^n) = PWP(\mathbb{R}^n)$ . + +If the Pierce-Birkhoff conjecture holds, then every piecewise polynomial $g$ can be written + +$$ +g = \min_{i\in I}\max_{j\in J_{i}}f_{ij} +$$ + +for some polynomials $f_{ij}$ and finite indexing sets $I, J_i$ . + +The case $n = 2$ was proved by Jacek Bochnak and Gustave Efroymson (Bochnak et al., 1998), and then again by Louis Mahe (Mahé, 1984). Mahe has also shown that the conjecture holds when $n = 3$ up to arbitrarily small neighborhoods of finitely many points. See Madden (2011) for further discussion of the Pierce-Birkhoff conjecture and related problems. + +Later, we will show that the neural network architecture introduced in the next section can exactly compute any continuous piecewise polynomial if and only if the Pierce-Birkhoff conjecture holds. + +# B MATRIX-RECURRENT NEURAL NETWORKS + +Semialgebraic Neural Networks (SANNs) are built on top of a related architecture called Matrix-Recurrent Neural Networks (MRNNs), a type of polynomial network with ReLU activations. This chapter introduces MRNNs and exactly characterize their range as inf-sup definable (ISD) piecewise polynomials. Our analysis of the expressivity of MRNNs is inspired by Balestriero & Baraniuk (2021). + +# B.1 ARCHITECTURE + +A standard feed-forward neural network is a function $f: \mathbb{R}^n \to \mathbb{R}^k$ defined as an alternating composition of affine transformations and nonlinear activation functions $\sigma$ : + +$$ +h _ {0} = x \tag {19} +$$ + +$$ +h _ {\ell} = \sigma \left(b _ {\ell} + A _ {\ell} h _ {\ell - 1}\right) \quad \text {f o r} \ell = 1, \dots , L - 1 \tag {20} +$$ + +$$ +f (x) = b _ {L} + A _ {L} h _ {L - 1}. \tag {21} +$$ + +Perhaps the most popular activation functions used in practice are variations of the rectified linear unit (ReLU) $\sigma(x) = \max(0, x)$ . This activation results in networks whose ranges are conceptually simple; they are multivariate linear splines. Although such networks can uniformly approximate any continuous function, they are extremely limited in the types of functions that can be represented exactly. For example, the product of two linear splines is in general not a linear spline itself, so computing such a function by a neural network will require a number of weights proportional to the desired accuracy of the approximation. + +In this work, we study a type of Operator Recurrent Neural Network (ORNN) (de Hoop et al., 2022) where the input to the network is a matrix $X \in \mathbb{R}^{n \times m}$ and the output is a vector $f(X) \in \mathbb{R}^{k_{\mathrm{out}}}$ . To emphasize that our results hold specifically for matrix inputs rather than general operators, we call this subset of ORNN's the Matrix Recurrent Neural Networks (MRNNs). The architecture of an $L$ -layer MRNN is defined + +$$ +h _ {0} = 0 \tag {22} +$$ + +$$ +h _ {\ell} = b _ {\ell , 0} + A _ {\ell , 0} h _ {\ell - 1} + B _ {\ell , 0} (I \otimes X) h _ {\ell - 1} + +$$ + +$$ +\sigma \left(b _ {\ell , 1} + A _ {\ell , 1} h _ {\ell - 1} + B _ {\ell , 1} (I \otimes X) h _ {\ell - 1}\right) \quad \text {f o r} \ell = 1, \dots , L \tag {23} +$$ + +$$ +f (X) = h _ {L} \tag {24} +$$ + +where $(I\otimes X)$ denotes a Kronecker product with an identity matrix $I$ whose size may vary in each layer. Notice in particular that the input matrix $X$ is inserted multiplicatively into each layer. Our definition of an MRNN matches the original definition of a width-expanded ORNN with matrix input presented in de Hoop et al. (2022). As noted in that paper, the restriction on $h_0$ does not affect the range of $f$ since $h_1$ will invariably equal $b_{1,0}$ , which is learned. + +We formally define the space of functions representable by an MRNN. + +Definition 28 (MRNN). Let $k, L \in \mathbb{N}$ , and $D$ be a subset of $\mathbb{R}^{m \times n}$ . Then $f: D \to \mathbb{R}^k$ is in $MRNN_L(D, \mathbb{R}^k)$ if $f$ can be computed via equations (22-24). + +When the number of layers in a network is not specified, we define + +$$ +M R N N (D, \mathbb {R} ^ {k}) = \bigcup_ {L = 0} ^ {\infty} M R N N _ {L} (D, \mathbb {R} ^ {k}). +$$ + +In contrast to standard ReLU networks, we will show that MRNNs form a ring of piecewise polynomial functions. The kernels of these functions—that is, the set of points $X$ such that $f(X)$ vanishes—form semialgebraic sets in $\mathbb{R}^{m \times n}$ . + +# B.2 RANGE + +Numerous authors have observed that linear ReLU networks compute multivariate linear splines, where each linear region is a polyhedron defined by the combination of active neurons—that is, + +where $b_{\ell} + A_{\ell}h_{\ell -1}\geq 0$ (see, for example, Montúfar et al. (2014) and Wang et al. (2019)). Likewise, de Hoop et al. (2022) showed that MRNNs (or rather ORNNS in general) compute piecewise polynomials, where the semialgebraic decomposition of the domain is similarly defined by the combination of active neurons + +$$ +b _ {\ell , 1} + A _ {\ell , 1} h _ {\ell - 1} + B _ {\ell , 1} (I \otimes X) h _ {\ell - 1} \geq 0, \quad \ell = 1, \dots , L +$$ + +at each point. Thus $MRNN(\mathbb{R}^{n \times m}, \mathbb{R}^k)$ is isomorphic to a subset of $PWP(\mathbb{R}^{nm}, \mathbb{R}^k)$ . The converse question, whether every piecewise polynomial is computable by an MRNN, was not addressed. In this subsection, we refine their observation to show that MRNNs compute precisely the ISD functions. + +Let $\mathrm{vec}:\mathbb{R}^{n\times m}\to \mathbb{R}^{nm}$ be the column-major matrix vectorization operator. It is clearly bijective, and its inverse is the matrixization operator denoted $\mathrm{vec}^{-1}$ . We first show every ISD function can be computed by and MRNN. + +Lemma 29. Let $m, n \in \mathbb{N}$ . For every $f \in ISD(\mathbb{R}^{mn})$ , there exists $\mathcal{N} \in MRNN(\mathbb{R}^{m \times n})$ such that $f = \mathcal{N} \circ \mathrm{vec}^{-1}$ . + +Proof. By definition of $ISD(\mathbb{R}^{mn})$ , $f$ is a lattice polynomial $q$ of some $\{p_1, \ldots, p_J\} \subset \mathbb{R}[X_1, \ldots, X_{mn}]$ . An easy construction shows there exists networks $\mathcal{N}_1, \ldots, \mathcal{N}_J$ computing the polynomials $\mathcal{N}_j = p_j \circ \mathrm{vec}^{-1}$ . Another easy construction shows that $MRNN(\mathbb{R}^{m \times n})$ is closed under the lattice operations, so the lattice polynomial $q$ can be computed by a network. In particular, $\mathcal{N} = q(\mathcal{N}_1, \ldots, \mathcal{N}_J)$ is the desired network. + +We now generalize the previous lemma to vector-valued functions. + +Lemma 30. Let $m, n, k \in \mathbb{N}$ . For every $f \in ISD(\mathbb{R}^{mn}, \mathbb{R}^k)$ , there exists $\mathcal{N} \in MRNN(\mathbb{R}^{m \times n}, \mathbb{R}^k)$ such that $f = \mathcal{N} \circ \mathrm{vec}^{-1}$ . + +Proof. $ISD(\mathbb{R}^{mn}, \mathbb{R}^k)$ is the $k$ -times direct product of $ISD(\mathbb{R}^{mn})$ , so $f = f_1 \times \dots \times f_k$ for some $f_1, \ldots, f_k \in ISD(\mathbb{R}^{mn})$ . By the previous lemma, there exist $\mathcal{N}_1, \ldots, \mathcal{N}_k \in MRNN(\mathbb{R}^{m \times n})$ such that $f_j = \mathcal{N}_j \circ \mathrm{vec}^{-1}$ for $j = 1, \ldots, k$ . Since $MRNN(\mathbb{R}^{m \times n}, \mathbb{R}^k)$ is the $k$ -times direct product of $MRNN(\mathbb{R}^{m \times n})$ , $\mathcal{N} = \mathcal{N}_1 \times \dots \times \mathcal{N}_k$ is the desired network. + +The next two lemmas prove the dual inclusion—every MRNN is indeed ISD. + +Lemma 31. Let $m, n \in \mathbb{N}$ . For every $\mathcal{N} \in MRNN(\mathbb{R}^{m \times n})$ , there exists $f \in ISD(\mathbb{R}^{mn})$ such that $\mathcal{N} = f \circ \mathrm{vec}$ . + +Proof. Fix a network computing $\mathcal{N}$ , and use induction on the number of layers $L$ . The base case $L = 0$ is trivial since a 0 layer network is a constant. Assume the condition holds for $L - 1$ layers, and consider the final layer in the network computing $\mathcal{N}(X)$ : + +$$ +\begin{array}{l} h _ {L} = b _ {L, 0} + A _ {L, 0} h _ {L - 1} + B _ {L, 0} (I \otimes X) h _ {L - 1} + \\ \sigma \left(b _ {L, 1} + A _ {L, 1} h _ {L - 1} + B _ {L, 1} (I \otimes X) h _ {L - 1}\right). \tag {25} \\ \end{array} +$$ + +Notice $h_{L-1}$ is a vector-valued function of $X$ and can be decomposed into its component functions + +$$ +h _ {L - 1} = g _ {1} \times \dots \times g _ {N} +$$ + +for some $N \in \mathbb{N}$ corresponding to the width of this layer. For every $j = 1, \dots, N$ , $g_{j}(X)$ is computed by an $L - 1$ network, so the inductive hypothesis states there exists $f_{j} \in ISD(\mathbb{R}^{mn})$ such that $g_{j} = f_{j} \circ \mathrm{vec}$ . We now rewrite each term of equation (25) using these $f_{j}$ . Let $i \in \{0, 1\}$ . + +- The constant terms $b_{L,i} \in \mathbb{R}$ are clearly isomorphic to constant functions in $ISD(\mathbb{R}^{mn})$ . +- The linear terms $A_{L,i}h_{L - 1}$ are linear combinations of $f_{1},\ldots ,f_{N}\in ISD(\mathbb{R}^{mn})$ . Since $ISD(\mathbb{R}^{mn})$ is an $f$ -ring (Theorem 26), there exists $f_{A,i}\in ISD(\mathbb{R}^{mn})$ such that $f_{A,i} = (A_{L,i}h_{L - 1})\circ \mathrm{vec}$ . + +- For the quadratic terms, note $(I \otimes X) \in \mathbb{R}^{rm \times N}$ . The $k$ 'th component of $(I \otimes X)h_{L - 1}$ equals + +$$ +\sum_ {\alpha = 1} ^ {m} X _ {(k \% n, \alpha)} g _ {(\lfloor k / n \rfloor + \alpha)} = \left(\sum_ {\alpha = 1} ^ {m} X _ {(k \% n, \alpha)} f _ {(\lfloor k / n \rfloor + \alpha)}\right) \circ \operatorname {v e c} (X) \tag {26} +$$ + +where $\%$ denotes modular division, $\lfloor \cdot \rfloor$ is the floor operation, and $X_{(a,b)}$ is entry $a,b$ of matrix $X$ . In particular, each term in the sum on the right-hand-side is the product of a monomial and an ISD function, so + +$$ +f_{B,i,k}:= \sum_{\alpha = 1}^{m}X_{(k\% n,\alpha)}f_{(\lfloor k / n\rfloor +\alpha)} +$$ + +is in $ISD(\mathbb{R}^{mn})$ for $k = 1, \ldots, rm$ . The full quadratic terms $B_{L,i}(I \otimes X)h_{L-1}$ are thus isomorphic to linear combinations of ISD functions $f_{B,i,1}, \ldots, f_{B,i,rm}$ , so there exists $f_{B,i} \in ISD(\mathbb{R}^{mn})$ such that $f_{B,i} = (B_{L,i}(I \otimes X)h_{L-1}) \circ \mathrm{vec}$ . + +We can thus rewrite (25) in the equivalent form + +$$ +h _ {L} = \left[ b _ {L, 0} + f _ {A, 0} + f _ {B, 0} + \sigma \left(b _ {L, 1} + f _ {A, 1} + f _ {B, 1}\right) \right] \circ \operatorname {v e c}. \tag {27} +$$ + +The term in square brackets is constructed from elements of the $f$ -ring $ISD(\mathbb{R}^{mn})$ using only addition and the lattice operation $\sigma = \max \{0, \cdot\}$ , so it is itself in $ISD(\mathbb{R}^{mn})$ and the lemma is proved. + +Lemma 32. Let $m, n, k \in \mathbb{N}$ . For every $\mathcal{N} \in MRNN(\mathbb{R}^{m \times n}, \mathbb{R}^k)$ , there exists $f \in ISD(\mathbb{R}^{mn}, \mathbb{R}^k)$ such that $\mathcal{N} = f \circ \mathrm{vec}$ . + +Proof. We pass through the direct products in an identical manner to the proof of Lemma 30. + +![](images/3603c8927d35597db515f1f846e398cc00a71ceb87f8be235223e720f886ccd8.jpg) + +Combining Lemmas Lemma 30 and Lemma 32 let us conclude $MRNN(\mathbb{R}^{n \times m}, \mathbb{R}^k)$ is isomorphic to $ISD(\mathbb{R}^{nm}, \mathbb{R}^k)$ ; that is, there exists a bijective ring-homomorphism between them. Informally, the two rings are identical up to a relabeling of the elements. + +Theorem 33. For all $n, m, k \in \mathbb{N}$ , the rings $MRNN(\mathbb{R}^{n \times m}, \mathbb{R}^k)$ and $ISD(\mathbb{R}^{nm}, \mathbb{R}^k)$ are homeomorphic, that is, + +$$ +M R N N (\mathbb {R} ^ {n \times m}, \mathbb {R} ^ {k}) \cong I S D (\mathbb {R} ^ {n m}, \mathbb {R} ^ {k}). +$$ + +Theorems 33 and 22 allow us to conclude that $MRNN(\mathbb{R}^{n \times m}, \mathbb{R}^k)$ forms a unital, associative algebra over $\mathbb{R}$ ; that is, every scalar multiple, sum, and Hadamard product of a MRNNs is computable by an MRNN. Associativity and existence of a multiplicative identity, as well as the ability to compute scalar multiples and sums are obvious and hold for linear ReLU networks as well. What distinguishes MRNNs from linear ReLU networks is the ability to compute Hadamard products. We require this property to build SANNs capable of computing any semialgebraic function. + +While the proofs above are not explicitly constructive, they can be made constructive using the identities in Henriksen & Isbell (1962) or Hager & Johnson (2010). Unfortunately, representing the Hadamard product of two MRNNs as an MRNN requires exponentially many parameters, which limits the practical usefulness of a direct application of these constructions in code. + +In their original paper introducing the architecture, de Hoop et al. (2022) note that the range of an MRNN is a multivariate piecewise polynomial; we have refined this result to show that MRNNs are ISD. We now ask the natural question, is every piecewise polynomial representable by an MRNN? As noted previously, this question is the famous Pierce-Birkhoff conjecture, a long-standing open problem in real algebraic geometry. MRNNs can represent every piecewise polynomials if and only if the Pierce-Birkhoff conjecture is true. + +# C SEMIALGEBRAIC FUNCTIONS AS KERNELS OF ISD FUNCTIONS + +This appendix contains proofs of Proposition 7 and Corollary 8 from the main text. + +Proposition 7. $S \subset \mathbb{R}^m$ is a closed semialgebraic set if and only if there exists $f \in ISD^{1}(\mathbb{R}^{m},\mathbb{R}_{\geq 0})$ such that $\ker(f) = S$ . + +![](images/b2e6716a3c970065cee584408ee922af67c9118db990ed7a4472f8b14e431688.jpg) +Figure 4: Encoding the graph of a semialgebraic function (red line) $F(x) = |x|$ as the kernel of a continuously differentiable piecewise polynomial (purple and yellow surface) + +$$ +G (x, y) = \big ((x + y) (x - y) \big) ^ {2} + \max (0, - y) ^ {2}. +$$ + +Proof. Clearly the kernel of a piecewise polynomial $f$ is a closed semialgebraic set, so we focus on the converse. + +First, suppose $S$ is a closed basic semialgebraic set described by the system + +$$ +p _ {1} (x), \dots , p _ {J _ {1}} (x) = 0 \text {a n d} q _ {1} (x), \dots , q _ {J _ {2}} (x) \geq 0. +$$ + +The desired ISD piecewise polynomial is + +$$ +f (x) = \sum_ {i = 1} ^ {J _ {1}} p _ {i} ^ {2} (x) + \sum_ {i = 1} ^ {J _ {2}} \left(\max \{0, - q _ {i} (x) \}\right) ^ {2}. +$$ + +Each term $p_i^2 (x)$ (resp. $\max \{0, - q_i(x)\} ^2$ ) is zero precisely when the corresponding condition $p_i(x) = 0$ (resp. $q_{i}(x)\geq 0$ ) is satisfied. Also, the function $q\mapsto \max \{0,q\}^{2}$ is in $C^1$ and has the continuous derivative $q\mapsto 2\max \{0,q\}$ . Moreover, each term is non-negative, so the sum is non-negative and zero if and only if every term is zero, meaning every condition is satisfied simultaneously. Finally, $f$ is ISD since it is constructed using the ISD lattice-ring operations on polynomials (see Appendix A), and it is $C^1$ since each term in the sum is $C^1$ . + +Now let $S$ be an arbitrary closed semialgebraic set; i.e., the union of basic semialgebraic sets. We may take the basic sets to be closed, since + +$$ +\operatorname {c l} \left(\bigcup_ {i = 1} ^ {n} s _ {i}\right) = \bigcup_ {i = 1} ^ {n} \operatorname {c l} (s _ {i}) +$$ + +for finitely many sets $s_1, \ldots, s_n$ . Since, $\ker(fg) = \ker(f) \cup \ker(g)$ for any real-valued functions $f$ and $g$ , the desired ISD function can be constructed as the product of piecewise polynomials corresponding to each closed basic semialgebraic set. + +Corollary 8. $F:\mathbb{R}^m\to \mathbb{R}^n$ is a semialgebraic function with closed graph if and only if there exists $aG\in ISD^{1}(\mathbb{R}^{m}\times \mathbb{R}^{n},\mathbb{R}_{\geq 0}^{n})$ such that $\ker (G) = gr(F)$ , where $gr(F)\coloneqq \{(x,F(x))\} \subset \mathbb{R}^m\times \mathbb{R}^n$ is the graph of $F$ . + +Proof. If $F$ is semialgebraic and has a closed graph, then Proposition 7 guarantees there exists a $C^1$ ISD piecewise polynomial $g:\mathbb{R}^m\times \mathbb{R}^n\to \mathbb{R}_{\geq 0}$ such that $\mathrm{gr}(F) = \ker (g)$ . An $\mathbb{R}^n$ -valued function $G$ can be obtained by defining each component function to be $g$ . + +Now suppose for a given $F$ , there exists an ISD $G$ such that $\ker(G) = \operatorname{gr}(F)$ . Then $\operatorname{gr}(F)$ is closed since kernels of continuous functions are closed, and $F$ is a semialgebraic function since $\ker(G)$ is clearly a semialgebraic set. + +Remark. The hypothesis in Corollary 8 that $F$ has a closed graph covers all continuous semialgebraic functions, as well as some unbounded discontinuous functions like + +$$ +y = \left\{ \begin{array}{l l} 0, & x \leq 0 \\ 1 / x, & x > 0. \end{array} \right. \tag {28} +$$ + +For an example of a semialgebraic function whose graph is not closed, consider the characteristic function of $(0, +\infty)$ : + +$$ +y = \left\{ \begin{array}{l l} 0, & x \leq 0 \\ 1, & x > 0. \end{array} \right. \tag {29} +$$ + +The graph does not contain the limit point $(0,1)$ . + +# D HOMOTOPY CONTINUATION METHODS + +This appendix contains additional background material on homotopy continuation methods for root finding. Subsection D.1 states semialgebraic variants of two important theorems from geometry that are the foundation for our proofs. Subsection D.2 gives sufficient conditions for the existence of a homotopy $H$ whose kernel can be traced from time 0 to time 1 in order to evaluate the roots of a given function. Finally, D.3 builds the system of ODEs that is solved in order to execute the homotopy continuation method, and we prove this ODE system can be represented by a SANN. + +# D.1 SEMIALGEBRAIC SARD'S AND TRANVERSALITY THEOREMS + +We present semialgebraic variations on two classic theorems from differential topology. + +Theorem 34 (Semialgebraic Sard's theorem). The set of critical values of a continuously differentiable semialgebraic function has measure zero. + +In the "textbook" Sard's theorem, the smoothness requirements on the function depend on the dimension of the range (Abraham & Robbin, 1967). In contrast, for semialgebraic functions continuous differentiability is sufficient for the theorem to hold. A proof can be found in Kurdyka et al. (2000). + +Next, we use the previous theorem to adapt the Thom transversality theorem to $C^1$ semialgebraic functions. + +Theorem 35 (Semialgebraic transversality theorem). If $F: X \times A \to Y$ is continuously differentiable semialgebraic function and 0 is a regular value of $F$ , then 0 is a regular value of $F(\cdot, a)$ for almost every $a \in A$ . + +A proof can be found in (Abraham & Robbin, 1967), substituting the semialgebraic Sard's theorem for Smale's theorem as required. + +# D.2 HOMOTOPY EXISTENCE + +We now state a standard result in the theory of homotopy continuation for solving nonlinear equations. Theorem 37 is adapted from Krantz & Parks (2003) with small modifications using the theorems from Appendix D.1 to specialize to $ISD^{1}$ and avoid any $C^\infty$ assumptions. It provides sufficient conditions under which we are guaranteed to be able to evaluate a homotopy from $t = 0$ until $t = 1$ . + +Definition 36 (Regular value). Let $U \subset \mathbb{R}^m$ be open. Given $f: U \to \mathbb{R}^n$ , $y \in \mathbb{R}^n$ is a regular value of $f$ if the Jacobian matrix $Df(x)$ has rank $n$ for all $x \in f^{-1}(y)$ . + +In particular, 0 is a regular value of $f: \mathbb{R}^n \to \mathbb{R}^n$ if and only if the Jacobian matrix is nonsingular for every $x \in \ker(f)$ . + +Theorem 37. Let $U_{H}$ be a bounded open subset of $\mathbb{R}^n$ , and $H \in ISD^{1}(\mathbb{R}^{n} \times \mathbb{R}, \mathbb{R}^{n})$ . Further suppose + +A.1 $H(\cdot, 0) = 0$ has a unique solution $y_0$ in $U_H$ . That is, $\ker H(\cdot, 0) \cap U_H = \{y_0\}$ . +A.2 The connected component of $\ker H$ containing $(y_0, 0)$ does not intersect $\partial U_H \times [0,1]$ . + +A.3 0 is a regular value of $H$ . + +A.4 $\partial_1H(y_0,0)$ is nonsingular. + +Then there exists $t \in ISD([0,1],\mathbb{R})$ , $y \in ISD([0,1],\mathbb{R}^n)$ such that $t(0) = 0$ , $t(1) = 1$ , and $(y(s),t(s)) \in \ker(H)$ for all $s \in [0,1]$ . + +# D.3 CURVE TRACING + +Let $z(s) \coloneqq (y(s), t(s))$ , and $H \in ISD^{1}(\mathbb{R}^{n} \times \mathbb{R}, \mathbb{R}^{n})$ satisfy the hypotheses of Theorem 37. Then $(y, 1) \in \ker H$ can be computed by solving the ODE initial-value problem defined by the "arc-length parameterization" (Chen & Li, 2015): + +$$ +D H (z) \cdot \dot {z} = 0 \tag {30} +$$ + +$$ +\operatorname {s g n} \det \left[ \begin{array}{c} D H (z) \\ \dot {z} \end{array} \right] = \sigma_ {0} \tag {31} +$$ + +$$ +\| \dot {z} \| = \beta \tag {32} +$$ + +$$ +z (0) = \left(y _ {0}, 0\right). \tag {33} +$$ + +where $\sigma_0$ is the sign of the determinant of that matrix at $z(0)$ and $\beta > 0$ is a constant chosen so that $t(1) = 1$ . + +With proper choice of $\mathcal{N}$ and $c_{\mathrm{max}}$ , the curve-tracing ODE system (30)-(33) can be written in the form of the ODE system (6)-(7) that define SANNs. At time $s = 0$ , write + +$$ +D H \left(y _ {0}, 0\right) = \left[ \begin{array}{l l} \widehat {M} & \widehat {b} \end{array} \right]. \tag {34} +$$ + +That is, $\widehat{M}$ is the $n\times n$ submatrix of $DH(y_0,0)$ that does not contain the rightmost columns $\widehat{b}$ . By assumption A.4, $\widehat{M}$ is invertible. Thus a vector $\dot{z}$ satisfying (30)-(33) can be obtained by solving + +$$ +M \dot {z} := \left[ \begin{array}{c c} \widehat {M} & 0 \\ 0 & \alpha \end{array} \right] \dot {z} = \left[ \begin{array}{c} \widehat {b} \\ 1 \end{array} \right] =: b \tag {35} +$$ + +where $\alpha$ is a constant chosen to satisfy (31) and (32). The $M$ and $b$ defined above appear in the ODE (6)-(7). Thus we have shown for $H$ satisfying the hypotheses of Theorem 37, $y_0 = 0$ , and large enough $c_{\mathrm{max}}$ , there is an $\mathcal{N} \in ISDnet(m,n,k)$ such that the integral curve traced in solving the ODE (6)-(7) is "correct" at time $s = 0$ ; i.e. it is tangent to the integral curve defined by $\dot{z}$ solving the IVP (30)-(33). + +For time $s > 0$ , we are no longer guaranteed that the first $n$ columns of $DH$ form an invertible submatrix. However, by assumption A.3, $DH$ always has rank $n$ , so every $s$ belongs to some interval where we can choose a column of $DH$ to be $\widehat{b}$ , and the remaining columns to be $\widehat{M}$ . The computations in each of these intervals can be glued together in a way consistent with the ODE (6)-(7) used to compute the entire integral curve. The details can be found in the proof of Theorem 12 in Appendix E. + +# E SANN EXPRESSIVITY PROOFS + +In this appendix, we prove via construction that SANNs are able to represent both continuous and discontinuous bounded semialgebraic functions $F$ . + +# E.1 NOTATION + +The theorems in this section require us to show the existence of ISD $\mathcal{N}$ generating certain initial value problems for (6)-(7). In Algorithm 1, $\dot{z}$ implicitly depends on the inputs $\mathcal{N}$ , $c_{\max}$ , and $x$ , and ODESolve always runs from time $s = 0$ to $s = 1$ . For this section, we make the dependence on all variables explicit by using the signature + +$$ +\mathsf {O D E S o l v e} (\mathcal {N}, c _ {\max }, x, (y _ {0}, t _ {0}, s _ {0}), s _ {\text {f i n a l}}) +$$ + +where $\mathcal{N} \in ISDnet(m,n,1)$ is the trainable ISD network, $c_{\max} \in \mathbb{R}_{\geq 0}$ bounds the output of the SANN, $x \in \mathbb{R}^m$ is the input to the SANN, $(y_0,t_0,s_0) \in \mathbb{R}^n \times \mathbb{R} \times \mathbb{R}$ is the initial condition, and $s_{\mathrm{final}} \in \mathbb{R}$ is the final time. We assume that ODESolve exactly solves the ODE system defined by $\dot{z}$ in Algorithm 1 from time $s = s_0$ to time $s = s_{\mathrm{final}}$ . To avoid repetition, $\mathcal{N}$ , $c_{\max}$ , $x$ , $y_0,t_0,s_0$ , and $s_{\mathrm{final}}$ will always be in their respective spaces above. Furthermore, for $\mathcal{N}_{\alpha}$ with any subscript $\alpha$ , we use $M_{\alpha}$ and $b_{\alpha}$ to be the associated projections as in line 3 of Algorithm 1. + +We use $\Pi_{n + 1}$ to denote the projection operator selecting $t_\mathrm{out}$ from $(y_{\mathrm{out}},t_{\mathrm{out}})$ . + +# E.2 GLUEING + +We require two different ways to combine ISD networks $\mathcal{N}_1$ and $\mathcal{N}_2$ . For "s-glueing," we build $\mathcal{N}_3$ that first imitates $\mathcal{N}_1$ on an interval $s \in [s_0, s_{1/2}]$ , then behaves as $\mathcal{N}_2$ when $s \in [s_{1/2}, s_{\text{final}}]$ . We require an additional lemma that modifies $\mathcal{N}_1$ and $\mathcal{N}_2$ to guarantee $\dot{y}, \dot{t}$ can be forced to be 0 in an open set around $s_{1/2}$ without affecting the output of ODESolve. We accomplish this with an ISD change of variables. + +For "t-glueing," we build $\mathcal{N}_3$ to interpolate between $\mathcal{N}_1$ and $\mathcal{N}_2$ in disjoint closed $t$ intervals $[t_0, t_1]$ and $[t_2, t_3]$ . We use $t$ -glueing when we can guarantee the integral curve traced by ODESolve will never enter the region $(t_1, t_2)$ , so the value of $\mathcal{N}_3$ may be arbitrary here. We are free to use this interval to interpolate between $\mathcal{N}_1$ and $\mathcal{N}_2$ . + +Our first lemma allows a particular change of variables for $s$ -gluing. + +Lemma 38 (Change-of-variables). Given $\mathcal{N}_1, c_1, y_0, t_0$ , and $s_0 < s_1 < s_2 < s_{final}$ , there exists $\mathcal{N}_2, c_2$ such that for all $x$ , + +$$ +O D E S o l v e \left(\mathcal {N} _ {1}, c _ {1}, x, \left(y _ {0}, t _ {0}, s _ {0}\right), s _ {\text {f i n a l}}\right) = O D E S o l v e \left(\mathcal {N} _ {2}, c _ {2}, x, \left(y _ {0}, t _ {0}, s _ {0}\right), s _ {\text {f i n a l}}\right) \tag {36} +$$ + +and + +$$ +b _ {2} (x, y, t, s) = 0 \quad \text {w h e n} s \notin [ s _ {1}, s _ {2} ]. \tag {37} +$$ + +Proof. Let $v: \mathbb{R} \to \mathbb{R}$ be defined + +$$ +v (s) = \left\{ \begin{array}{l l} s _ {0} & s < s _ {1} \\ u (s) & s \in [ s _ {1}, s _ {2} ] \\ s _ {\text {f i n a l}} & s > s _ {2} \end{array} \right. \tag {38} +$$ + +where $u$ is the Hermite interpolant (Suli & Mayers, 2003) such that + +$$ +u \left(s _ {1}\right) = s _ {0} \quad \dot {u} \left(s _ {1}\right) = 0 \tag {39} +$$ + +$$ +u \left(s _ {2}\right) = s _ {\text {f i n a l}} \quad \dot {u} \left(s _ {2}\right) = 0. \tag {40} +$$ + +$v$ is continuously differentiable and $\dot{v} \in ISD(\mathbb{R})$ , $\dot{v}(s) = 0$ for all $s \notin [s_1, s_2]$ . Since $s \mapsto \dot{v}(s)b(x, z(s))$ is the product of ISD functions, it is itself ISD. Likewise the composition of an ISD function with a polynomial is ISD. Thus we can define + +$$ +M _ {2} (x, y, t, s) = M _ {1} (x, y (v (s)), t (v (s)), v (s)) \tag {41} +$$ + +$$ +b _ {2} (x, y, t, s) = \dot {v} (s) b _ {1} (x, y (v (s)), t (v (s)), v (s)). \tag {42} +$$ + +Simple calculus verifies conclusion (36), and conclusion (37) holds since $\dot{v}(s) = 0$ outside $[s_1, s_2]$ . + +Lemma 39 (s-glueing). Given $\mathcal{N}_1, \mathcal{N}_2, c_1, c_2, y_0, t_0, s_0 < s_1 < s_{final}$ , let + +$$ +\left(y _ {\text {o u t}} (x), t _ {\text {o u t}} (x)\right) = O D E S o l v e \left(\mathcal {N} _ {1}, c _ {1}, x, \left(y _ {0}, t _ {0}, s _ {0}\right), s _ {1}\right). \tag {43} +$$ + +There exists $\mathcal{N}_3$ , $c_3$ such that for all $x$ , + +$$ +\mathcal {O D E S o l v e} \left(\mathcal {N} _ {3}, c _ {3}, x, \left(y _ {0}, t _ {0}, s _ {0}\right), s _ {\text {f i n a l}}\right) = \mathcal {O D E S o l v e} \left(\mathcal {N} _ {2}, c _ {2}, x, \left(y _ {\text {o u t}} (x), t _ {\text {o u t}} (x), s _ {1}\right), s _ {\text {f i n a l}}\right). \tag {44} +$$ + +Proof. Choose $\epsilon > 0$ such that $s_0 < s_1 - \epsilon < s_1 + \epsilon < s_{\mathrm{final}}$ , and apply Lemma 38 to $\mathcal{N}_1$ and $\mathcal{N}_2$ so that both $b_1$ and $b_2$ are identically 0 in the region $(s_1 - \epsilon, s_1 + \epsilon)$ . No matter the value of $M_1$ and $M_2$ , both $\dot{y}$ and $\dot{t}$ are identically 0 here. Let $\lambda(s) = (s - (s_1 - \epsilon)) / (2\epsilon)$ . Define + +$$ +M _ {3} (x, y, t, s) = \left\{ \begin{array}{l l} M _ {1} (x, y, t, s) & s \leq s _ {1} - \epsilon \\ (1 - \lambda (s)) M _ {1} (x, y, t, s) + \lambda (s) M _ {2} (x, y, t, s) & s \in (s _ {1} - \epsilon , s _ {1} + \epsilon) \\ M _ {2} (x, y, t, s) & s \geq s _ {1} + \epsilon \end{array} \right. \tag {45} +$$ + +and + +$$ +b _ {3} (x, y, t, s) = \left\{ \begin{array}{l l} b _ {1} (x, y, t, s) & s \leq s _ {1} \\ b _ {2} (x, y, t, s) & s > s _ {1}. \end{array} \right. \tag {46} +$$ + +$M_3$ is clearly continuous, and $b_{3}$ is continuous since $b_{1}$ and $b_{2}$ are both 0 when $s = s_1$ . The constructed $\mathcal{N}_3$ is ISD and satisfies conclusion (44). + +Remark. Strictly speaking, we have not written $M_3$ and $b_3$ in ISD form in the proof above, but this is not difficult to remedy. For example, we could use + +$$ +\lambda (s) := \min \left(\max \left(\left(s - \left(s _ {1} - \epsilon\right)\right) / (2 \epsilon), 0\right), 1\right), \tag {47} +$$ + +then define + +$$ +M _ {3} = (1 - \lambda (s)) M _ {1} + \lambda (s) M _ {2} \tag {48} +$$ + +$$ +b _ {3} = (1 - \lambda (s)) b _ {1} + \lambda (s) b _ {2} \tag {49} +$$ + +over the entire domain. + +Lemma 40 (t-glueing). Given $\mathcal{N}_1, \mathcal{N}_2, c_1, c_2, y_1, y_2, t_1, t_2, s_0, s_{\text{final}}$ , let + +$$ +\mathcal {T} _ {j} := \left\{\Pi_ {n + 1} O D E S o l v e \left(\mathcal {N} _ {j}, c _ {j}, x, \left(y _ {j}, t _ {j}, s _ {0}\right), s\right) \mid s \in \left[ s _ {0}, s _ {\text {f i n a l}} \right], x \in \mathbb {R} ^ {m} \right\}. \tag {50} +$$ + +Suppose $\mathcal{T}_1\cap \mathcal{T}_2 = \emptyset$ . Then there exists $\mathcal{N}_3,c_3$ such that + +$$ +O D E S o l v e \left(\mathcal {N} _ {3}, c _ {3}, x, \left(y _ {j}, t _ {j}, s _ {0}\right), s _ {\text {f i n a l}}\right) = O D E S o l v e \left(\mathcal {N} _ {j}, c _ {j}, x, \left(y _ {j}, t _ {j}, s _ {0}\right), s _ {\text {f i n a l}}\right) \tag {51} +$$ + +for $j = 1,2$ and $x\in \mathbb{R}^m$ + +Proof. Sets $\mathcal{T}_j$ contain the integral curves for the $t$ output of ODESolve, so they are connected and closed. Since they are disjoint, we can assume WLOG max $\mathcal{T}_1 < \min \mathcal{T}_2$ . Then there exists $t_{\mathrm{mid}}, \epsilon \in \mathbb{R}$ such that + +$$ +\max \mathcal {T} _ {1} < t _ {\text {m i d}} - \epsilon < t _ {\text {m i d}} + \epsilon < \min \mathcal {T} _ {2}. \tag {52} +$$ + +The integral curves traced by ODESolve do not enter the $t$ -region $(t_{\mathrm{mid}} - \epsilon, t_{\mathrm{mid}} + \epsilon)$ , so we are free to define $\mathcal{N}_3$ to interpolate between $\mathcal{N}_1$ and $\mathcal{N}_2$ there. Let $\lambda(t) = (t - (t_{\mathrm{mid}} - \epsilon)) / (2\epsilon)$ . Define + +$$ +M _ {3} = \left\{ \begin{array}{l l} M _ {1} & t \leq t _ {\text {m i d}} - \epsilon \\ \lambda (t) M _ {1} + (1 - \lambda (t)) M _ {2} & t \in \left(t _ {\text {m i d}} - \epsilon , t _ {\text {m i d}} + \epsilon\right) \\ M _ {2} & t \geq t _ {\text {m i d}} - \epsilon \end{array} \right. \tag {53} +$$ + +$$ +b _ {3} = \left\{ \begin{array}{l l} b _ {1} & t \leq t _ {\text {m i d}} - \epsilon \\ \lambda (t) b _ {1} + (1 - \lambda (t)) b _ {2} & t \in \left(t _ {\text {m i d}} - \epsilon , t _ {\text {m i d}} + \epsilon\right) \\ b _ {2} & t \geq t _ {\text {m i d}} - \epsilon \end{array} \right. \tag {54} +$$ + +$$ +c _ {3} = \max \left\{c _ {1}, c _ {2} \right\}. \tag {55} +$$ + +# E.3 PROOF OF THEOREM 11 + +Theorem 11. Let $F: \mathbb{R}^m \to U_F$ be a given continuous semialgebraic function. For every $x \in \mathbb{R}^m$ there exists $H_{x,a}$ with the form (10) such that for almost every $a \in U_F$ , the following hold: + +1. There exists $y \in ISD([0,1],\mathbb{R}^n), t \in ISD([0,1],\mathbb{R})$ , such that $t(0) = 0$ , $t(1) = 1$ , and $(y(s), t(s)) \in \ker(H_{x,a})$ for all $s \in [0,1]$ . + +# 2. The kernel of $H_{x,a}(\cdot, 1)$ is the singleton $\{F(x)\}$ . + +Proof. To specify $H_{x,a}$ , we need to choose $g$ and $G$ . Let $g$ be constructed according to Lemma 10. Let $G$ be constructed such that $\ker G = \operatorname{gr}(F)$ using Corollary 8. + +For conclusion 1, we will use Theorem 37. We first specify a bounded, open $U_H \subset \mathbb{R}^n$ containing $U_F$ with an additional property that is relevant for A.2. Let $\mathcal{C}$ denote the connected component of $\ker(H_{x,a})$ containing $(y_0, 0)$ (i.e., the curve to be traced), and assume for the moment A.3 (which does not depend on choice of $U_H$ ) has been verified. Then for almost every $a$ , there exists $t_0 \in (0, 1)$ such that $\mathcal{C} \cap (\mathbb{R}^n \times [0, t_0]) = \mathcal{C} \cap (U_F \times [0, t_0])$ ; in other words, the curve remains in $U_F$ until at least time $t_0$ . Now, using Lemma 10, we conclude there exists a bounded open $U_H$ containing $U_F$ such that $H_{x,a}(t, y) > 0$ for all $(y, t) \in U_H^c \times [t_0, 1]$ . + +We now consider each hypothesis of Theorem 37 in turn: + +A.1 The unique solution to $H_{x,a}(y,0) = y - a = 0$ is $y_0 = a$ . +A.2 From the construction of $U_{H}$ above, the curve $\mathcal{C}$ does not intersect $\partial U_{H}$ during the interval $t \in [0, t_0]$ , and the entire kernel of $H_{x,a}$ is disjoint from $\partial U_{H}$ for $t > t_0$ . +A.3 We will show that 0 is a regular value of $H_{x,a}$ for almost every $a$ using the Semialgebraic Transversality Theorem (see Theorem 35 in appendix D.1). Consider $\tilde{H}_x:\mathbb{R}^n\times \mathbb{R}\times \mathbb{R}^n\to \mathbb{R}^n$ obtained from $H_{x,a}$ by treating $a$ as a variable: $\tilde{H}_x(y,t,a)\coloneqq H_{x,a}(y,t)$ . Then + +$$ +\partial_ {3} \tilde {H} _ {x} = - (1 - t) I _ {n}, +$$ + +which is invertible for $t \neq 1$ , so 0 is a regular value of $\tilde{H}$ . Apply the Theorem 35 to $\tilde{H}_x$ to conclude 0 is a regular value of $H_{x,a}$ for almost every $a$ . + +A.4 $(y_0, 0)$ is in the region $U_F \times U_F$ , so $\partial_1 H_{x,a}(y_0, 0) = I_n$ , which is nonsingular. + +For conclusion 2, we have shown in A.2 that $y(1) \in U_F$ where $g$ vanishes, so $H_{x,a}(y(1),1) = G(x,y(1))$ . The conclusion follows since $\ker G = \operatorname{gr}(F)$ . + +# E.4 PROOF OF THEOREM 12 + +Theorem 12. Let $F: \mathbb{R}^m \to U_F$ be a given continuous semialgebraic function. Then there exists $\mathcal{N} \in ISDnet(m, n, 1)$ and $c_{\max} > 0$ such that $SANN^{lim}(\mathcal{N}, \cdot, c_{\max}) = F$ . + +Proof. In Section D.3, we showed how to construct $\mathcal{N}_0 \in ISDnet(m,n,1)$ to compute the required integral curve using Algorithm 1 at time $s = 0$ . $\mathcal{N}_0$ can be chosen in this manner to compute the integral curve until some time $s_1 > 0$ , when $\widehat{M}(s_1)$ , the first $n$ columns of $DH(y(s_1),t(s_1))$ , no longer form an invertible submatrix. However, by assumption A.3, we can choose a different invertible submatrix and left-over column, say $\widehat{M}_1$ and $\widehat{b}_1$ . By the continuity of $DH$ , $\widehat{M}_1$ is invertible over some interval $s \in (s_{1/2},s_2)$ with $0 < s_{1/2} < s_1 < s_2$ . Using the same approach, we can construct $\mathcal{N}_1 \in ISDnet(m,n,1)$ to compute the integral curve over $s \in (s_{1/2},s_2)$ . We can now $s$ -glue $\mathcal{N}_0$ and $\mathcal{N}_1$ (Lemma 39) to construct $\mathcal{N}$ computing the integral curve across $s \in [0,s_2)$ . + +All that remains it to prove this procedure can be repeated until time $s = 1$ is reached. Due to the clamping in line 7 of Algorithm 1, $z$ remains in $[-c_{\max}, c_{\max}]^{n+1}$ for time $s \in [0,1]$ . Since $\mathcal{N} \in ISDnet(m,n,1)$ is a piecewise polynomial, it is Lipschitz on the compact domain $\{x\} \times [-c_{\max}, c_{\max}]$ , which means there exists $\epsilon > 0$ such that for each step $\tau$ of the $s$ -gluing procedure above, we can choose $s_{\tau+1}$ such that $s_{\tau} + \epsilon < s_{\tau+1}$ , and the conclusion follows. + +# E.5 DISCONTINUOUS FUNCTIONS + +We are now ready to directly tackle discontinuous semialgebraic functions. Our strategy is to split the computation into two distinct phases. + +1. First, we utilize the fact that $\dot{z}$ can be discontinuous across a boundary where $M$ is singular to separate the domain $\mathbb{R}^m$ into the connected components of the graph of $F$ . Every point in the $j$ 'th connected component is mapped to $(y_{\mathrm{out}}, t_{\mathrm{out}}) = (0, j)$ . +2. Then, using the homotopy continuation arguments from Section 4.1, we construct continuous ISD phase vector fields that map from $(0,j)$ to $(F(x),t_{\mathrm{out}})$ , which was desired. + +Furthermore, we carefully construct each piece of the computation to lie in disjoint $(t,s)$ -space, so they can be glued together in a way consistent with a single continuous ISD network $\mathcal{N}$ . This $\mathcal{N}$ computes $F$ while solving the ODE (6)-(7). Ensuring that the required $\mathcal{N}$ is indeed an ISD network (rather than an arbitrary continuous one) is one of the primary challenges in these constructions. + +# E.6 CHARACTERISTIC FUNCTIONS + +Given $S \subseteq \mathbb{R}^m$ , a function $\chi_S : \mathbb{R}^m \to \mathbb{R}$ is the characteristic function of a set $S$ if $\chi_S(x) = 1$ for $x \in S$ , and $\chi_S(x) = 0$ otherwise. We now show that SANNs can represent characteristic functions on semialgebraic sets. + +Lemma 41 (Scalar multiplication). Given $\mathcal{N}$ , $c_{\mathrm{max}}$ , $y_0$ , $t_0$ , $s_0$ , $s_{\mathrm{final}}$ and $\alpha \in \mathbb{R}$ , there exists $\mathcal{N}_1 \in ISDnet(m, n, 1)$ such that for all $x$ , + +$$ +O D E S o l v e \left(\mathcal {N} _ {1}, c _ {1}, x, \left(y _ {0}, t _ {0}, s _ {0}\right), s _ {\text {f i n a l}}\right) = \alpha O D E S o l v e \left(\mathcal {N}, c _ {\max }, x, \left(y _ {0}, t _ {0}, s _ {0}\right), s _ {\text {f i n a l}}\right) \tag {56} +$$ + +where $c_{1} = \alpha c_{\mathrm{max}}$ + +Proof. When $\alpha = 0$ , we simply use $M_1 = M$ , $b_1 = 0$ . Otherwise, we dilate and scale the phase vector field by $\alpha$ , which we accomplish by setting + +$$ +M _ {1} (x, y, t, s) = M \left(x, \alpha^ {- 1} y, \alpha^ {- 1} t, s\right) \tag {57} +$$ + +$$ +b _ {1} (x, y, t, s) = \alpha b \left(x, \alpha^ {- 1} y, \alpha^ {- 1} t, s\right). \tag {58} +$$ + +![](images/208ad4ed09d924766a17d5ef53c7e91b5f912e7fdf87e2f2278ce0938a2a4b0e.jpg) + +Lemma 42 (Changing $s$ bounds $s_{\mathrm{final}}$ ). Given $\mathcal{N}_1, c_1, y_0, t_0, s_0, s'_0, s_{\mathrm{final}}, s'_\mathrm{final}$ , there exists $\mathcal{N}_2$ and $c_2$ such that for all $x$ , + +$$ +O D E S o l v e \left(\mathcal {N} _ {2}, c _ {2}, x, \left(y _ {0}, t _ {0}, s _ {0} ^ {\prime}\right), s _ {\text {f i n a l}} ^ {\prime}\right) = O D E S o l v e \left(\mathcal {N} _ {1}, c _ {1}, x, \left(y _ {0}, t _ {0}, s _ {0}\right), s _ {\text {f i n a l}}\right). \tag {59} +$$ + +Proof. Let $\lambda(s) = (s_{\mathrm{final}}' - s) / (s_{\mathrm{final}}' - s_0')$ and $\alpha = (s_{\mathrm{final}} - s_0) / (s_{\mathrm{final}}' - s_0')$ . Dilate, scale, and translate the phase vector field: + +$$ +M _ {2} (x, y, t, s) = M _ {1} (x, y, t, s _ {0} + \lambda (s) \left(s _ {\text {f i n a l}} - s _ {0}\right)) \tag {60} +$$ + +$$ +b _ {2} (x, y, t, s) = \alpha b _ {1} (x, y, t, s _ {0} + \lambda (s) \left(s _ {\text {f i n a l}} - s _ {0}\right)). \tag {61} +$$ + +Set $c_{2} = \alpha c_{1}$ + +Lemma 43 (Shifting initial conditions). Given $\mathcal{N}_1$ , $c_1$ , $y_0$ , $y_0'$ , $t_0$ , $t_0'$ , $s_0$ , and $s_{final}$ , there exists $\mathcal{N}_2$ such that for all $x$ , + +$$ +O D E S o l v e \left(\mathcal {N} _ {2}, c _ {1}, x, \left(y _ {0} ^ {\prime}, t _ {0} ^ {\prime}, s _ {0}\right), s _ {f i n a l}\right) = \left(y _ {0} ^ {\prime}, t _ {0} ^ {\prime}\right) + O D E S o l v e \left(\mathcal {N} _ {1}, c _ {1}, x, \left(y _ {0}, t _ {0}, s _ {0}\right), s _ {f i n a l}\right). \tag {62} +$$ + +Proof. Let $\delta y = y_0' - y_0$ and $\delta t = t_0' - t_0$ . + +$$ +M _ {2} (x, y, t, s) = M _ {1} (x, y - \delta y, t - \delta t, s) \tag {63} +$$ + +$$ +b _ {2} (x, y, t, s) = b _ {1} (x, y - \delta y, t - \delta t, s). \tag {64} +$$ + +![](images/68456b380ad202575615fcbc56102e00aa52919d097f7b450cebcc154e3ec70c.jpg) + +The next lemma allows for a limited form of addition in the $t$ output. + +Lemma 44 (Addition in $t$ ). Given $\mathcal{N}_1, \mathcal{N}_2, c_1, c_2, y_0, t_0, s_0, s_{final}$ , suppose the image of + +$$ +x \mapsto \Pi_ {n + 1} O D E S o l v e \left(\mathcal {N} _ {1}, c _ {1}, x, \left(y _ {0}, t _ {0}, s _ {0}\right), s _ {\text {f i n a l}}\right) \tag {65} +$$ + +has only finitely many points $(t_{out}^{1},\ldots ,t_{out}^{J})$ . Further suppose + +$$ +\operatorname {d i a m} \left\{\Pi_ {n + 1} \text {O D E S o l v e} \left(\mathcal {N} _ {2}, c _ {2}, x, \left(y _ {0}, t _ {0}, s _ {0}\right), s\right) \mid s \in \left(s _ {0}, s _ {\text {f i n a l}}\right) \right\} < \frac {1}{2} \min _ {i, j} \left| t _ {\text {o u t}} ^ {i} - t _ {\text {o u t}} ^ {j} \right|. \tag {66} +$$ + +Then there exists $\mathcal{N}_3$ , $c_3$ such that + +$$ +\Pi_ {n + 1} O D E S o l v e \left(\mathcal {N} _ {3}, c _ {3}, x, \left(y _ {0}, t _ {0}, s _ {0}\right), s _ {\text {f i n a l}}\right) = \tag {67} +$$ + +$$ +\Pi_ {n + 1} \left(O D E S o l v e \left(\mathcal {N} _ {1}, c _ {1}, x, \left(y _ {0}, t _ {0}, s _ {0}\right), s _ {\text {f i n a l}}\right) + O D E S o l v e \left(\mathcal {N} _ {2}, c _ {2}, x, \left(y _ {0}, t _ {0}, s _ {0}\right), s _ {\text {f i n a l}}\right)\right). \tag {68} +$$ + +Proof. Let $s_{1/2} = s_0 + (s_{\text{final}} - s_0) / 2$ . From Lemma 42, there exists $\mathcal{N}_1'$ and $c_1'$ such that + +$$ +\mathrm {O D E S o l v e} \left(\mathcal {N} _ {1} ^ {\prime}, c _ {1} ^ {\prime}, x, \left(y _ {0}, t _ {0}, s _ {0}\right), s _ {1 / 2}\right) = \mathrm {O D E S o l v e} \left(\mathcal {N} _ {1}, c _ {1}, x, \left(y _ {0}, t _ {0}, s _ {0}\right), s _ {\text {f i n a l}}\right). \tag {69} +$$ + +Likewise, from Lemmas 42 and 43, for each $j = 1, \dots, J$ , there exists $\mathcal{N}_2^j$ and $c_2^j$ such that + +$$ +\mathrm {O D E S o l v e} \left(\mathcal {N} _ {2} ^ {j}, c _ {2} ^ {j}, x, \left(y _ {\text {o u t}} ^ {j}, t _ {\text {o u t}} ^ {j}, s _ {1 / 2}\right), s _ {\text {f i n a l}}\right) = \tag {70} +$$ + +$$ +\left(y _ {\text {o u t}} ^ {j}, t _ {\text {o u t}} ^ {j}\right) + \mathrm {O D E S o l v e} \left(\mathcal {N} _ {2}, c _ {2}, x, \left(y _ {0}, t _ {0}, s _ {0}\right), s _ {\text {f i n a l}}\right). \tag {71} +$$ + +Hypothesis 66 guarantees the sets + +$$ +\left. \right.\left\{\Pi_ {n + 1} \mathrm {O D E S o l v e} \left(\mathcal {N} _ {2} ^ {j}, c _ {2} ^ {j}, x, \left(y _ {\text {o u t}} ^ {j}, t _ {\text {o u t}} ^ {j}, s _ {1 / 2}\right), s\right) \mid s \in \left[ s _ {1 / 2}, s _ {\text {f i n a l}} \right]\right\} \tag {72} +$$ + +are pairwise disjoint for each $j$ , so the $\mathcal{N}_2^j$ can be $t$ -glued (Lemma 40) into a single $\mathcal{N}_3^{\prime}$ such that + +$$ +\mathrm {O D E S o l v e} \left(\mathcal {N} _ {3} ^ {\prime}, c _ {3} ^ {\prime}, x, \left(y _ {\text {o u t}} ^ {j}, t _ {\text {o u t}} ^ {j}, s _ {1 / 2}\right), s _ {\text {f i n a l}}\right) = \left(y _ {\text {o u t}} ^ {j}, t _ {\text {o u t}} ^ {j}\right) + \mathrm {O D E S o l v e} \left(\mathcal {N} _ {2}, c _ {2}, x, \left(y _ {0}, t _ {0}, s _ {0}\right), s _ {\text {f i n a l}}\right) \tag {73} +$$ + +for $j = 1, \dots, J$ . Finally, using Lemma 39, $s$ -glue $\mathcal{N}_1'$ and $\mathcal{N}_3'$ at $s = s_{1/2}$ to obtain the desired $\mathcal{N}_3$ . + +We are now ready to construct SANNs that represent characteristic functions of arbitrary semialgebraic sets. + +Proposition 45. Let $S \subset \mathbb{R}^m$ be a semialgebraic set. Then there exists $\mathcal{N}$ and $C \in \mathbb{N}$ such that for all $c \geq C$ , + +$$ +\mathcal {O D E S o l v e} (\mathcal {N}, c, x, (0, 0, 0), 1) = (0, \chi_ {S} (x)). \tag {74} +$$ + +Proof. First, suppose $S$ is open. Then $S^c$ is a closed semialgebraic set, and from Proposition 7 we conclude there exists $g \in ISD(\mathbb{R}^m, \mathbb{R}_{\geq 0})$ such that $\ker(g) = S^c$ . Define + +$$ +M (x, y, t, s) = g (x) I \tag {75} +$$ + +$$ +b (x, y, t, s) = g (x) (0, 1). \tag {76} +$$ + +$M$ is singular iff $x \in \ker(g)$ , so $\dot{z}$ always returns 0 in this case. Otherwise, $(\dot{y}, \dot{t}) = M^{-1}b = (0,1)$ . Integrating from time $s_0 = 0$ to $s_{\mathrm{final}} = 1$ yields + +$$ +\mathrm {O D E S o l v e} (\mathcal {N}, c, x, (0, 0, 0), 1) = \left\{ \begin{array}{l l} (0, 1), & x \notin \ker g \\ (0, 0), & \text {o t h e r w i s e ,} \end{array} \right. \tag {77} +$$ + +which proves the proposition for open $S$ . + +For closed $S$ , recall $S^c$ is open and $\chi_S = 1 - \chi_S^c$ , so Lemmas 41 and 44 yield the result. + +Next, assume we can represent the characteristic function for $S_{1}$ and $S_{2}$ . We will show how to represent the characteristic function of their intersection; equivalently, we show how to represent $\chi_{S_1\cap S_2^c}$ . Let $\mathcal{N}_j$ be such that + +$$ +\mathrm {O D E S o l v e} \left(\mathcal {N} _ {j}, c, x, (0, 0, 0), 1\right) = \left(0, \chi_ {S _ {j}} (x)\right) \tag {78} +$$ + +for $j = 1,2$ . Using Lemma 42, there exists $\mathcal{N}_1'$ such that + +$$ +\mathrm {O D E S o l v e} \left(\mathcal {N} _ {1} ^ {\prime}, c, x, (0, 0, 0), 1 / 2\right) = (0, \chi_ {S _ {1}} (x)). \tag {79} +$$ + +Using Lemmas 42, 43, and 41, there exists $\mathcal{N}_2^{\prime}$ such that + +$$ +\mathrm {O D E S o l v e} \left(\mathcal {N} _ {2} ^ {\prime}, c, x, (0, 1, 1 / 2), 1\right) = (0, 1) - \left(0, \chi_ {S _ {2}} (x)\right). \tag {80} +$$ + +Now $t$ -glue $\mathcal{N}_2'$ with a trivial ISD network so that + +$$ +\mathrm {O D E S o l v e} \left(\mathcal {N} _ {2} ^ {\prime}, c, x, (0, 0, 1 / 2), 1\right) = (0, 0), \tag {81} +$$ + +and $s$ -glue $\mathcal{N}_1'$ with $\mathcal{N}_2'$ at $s = 1/2$ to obtain the desired network. + +We can now handle the case of an arbitrary semialgebraic set $S$ . The key is to exploit the "cylindrical decomposition" of $S$ : every semialgebraic set in $\mathbb{R}^m$ is the union of finitely many disjoint sets homeomorphic to $(-1,1)^d$ , $d \leq m$ (Bochnak et al., 1998). In particular, it is the union of finitely many disjoint locally closed sets. Since locally closed sets are the intersection of an open and a closed set, we have already shown how to represent their characteristic functions with SANNs. Furthermore, since these locally compact sets are disjoint, the characteristic function of their union can be represented by summing the individual characteristic functions with $s$ -gluing. + +Remark. Note that, although $M = g(x)I$ is in some sense "nearly singular" close to the kernel of $g$ , it is still in fact an orthogonal matrix. No numerical instabilities arise from the conditioning of $M$ when solving $M\dot{z} = b$ . + +# E.7 PROOF OF THEOREM 13 + +Theorem 13. Let $F: \mathbb{R}^m \to \mathbb{R}^n$ be a (possibly discontinuous) bounded semialgebraic function. Then there exists $\mathcal{N} \in ISDnet(m, n, 1)$ and $c_{\max} \in \mathbb{R}_{\geq 0}$ such that $SANN^{lim}(\mathcal{N}, \cdot, c_{\max}) = F$ . + +Proof. Every semialgebraic function has finitely many connected components (Bochnak et al., 1998), so let $\{S_j\}_{j=1}^K$ be a semialgebraic decomposition of $\mathbb{R}^m$ such that $F$ is continuous on each $S_i$ . + +Using Proposition 45, we can construct scaled characteristic functions on each connected component, and using Lemmas 41 and 44, we scale and add these functions to obtain $\mathcal{N}_0$ , $c_0$ such that + +$$ +\mathrm {O D E S o l v e} \left(\mathcal {N} _ {0}, c _ {0}, x, (0, 0, 0), 1 / 2\right) = (0, 3 j) \text {w h e r e} x \in S _ {j}. \tag {82} +$$ + +Using Theorem 12, let $\mathcal{N}_j, c_j$ be such that + +$$ +S A N N \left(\mathcal {N} _ {j}, \cdot , c _ {j}\right) | _ {S _ {j}} = F | _ {S _ {j}} \tag {83} +$$ + +for each $j = 1, \ldots, K$ . Furthermore, by the construction in the proof of that theorem, $\mathcal{N}_i$ can be chosen such that $t(0) = 0$ and $t(1) = 1$ . In particular, + +$$ +\mathrm {O D E S o l v e} \left(\mathcal {N} _ {j}, c _ {j}, x, (0, 0, 0), 1\right) = \left(F \mid_ {S _ {j}} (x), 1\right) \text {w h e n} x \in S _ {j}. \tag {84} +$$ + +Using Lemma 42, modify each $\mathcal{N}_i$ , $c_{i}$ , so that integration occurs in the interval $s\in [1 / 2,1]$ . Furthermore, using Lemma 43, modify each $\mathcal{N}_i$ , $c_{i}$ to begin integration at $(0,3j)$ . Finally, $t$ -glue these modified $\mathcal{N}_j$ , and $s$ -glue the result to $\mathcal{N}_0$ at $s = 1 / 2$ . + +# E.8 SEMIALGEBRAIC FUNCTIONS WITH UNBOUNDED IMAGE + +Parameter $c_{\mathrm{max}}$ provides an upper bound on the $\ell_{\infty}$ -norm of the output of SANN, so the image of every SANN-representable function is bounded. However, the same is not true for all semialgebraic functions, even those with compact domain, such as $F(x): [-1, 1] \to \mathbb{R}$ defined by + +$$ +F (x) = \left\{ \begin{array}{l l} 1 / x, & x \neq 0, \\ 0 & x = 0. \end{array} \right. \tag {85} +$$ + +Such functions can not be represented by SANNs. + +# E.9 SANNS ALWAYS COMPUTE SEMIALGEBRAIC FUNCTIONS + +In our considerations, we use the Tarski-Seidenberg theorem, which has several equivalent formulations. We use the following: + +Theorem 46 (Tarski-Seidenberg). When $X \subset \mathbb{R}^n \times \mathbb{R}^k$ is a semialgebraic set and $\pi : \mathbb{R}^n \times \mathbb{R}^k \to \mathbb{R}^n$ is the projection map $\pi(x', x'') = x'$ , then the set $\pi(X)$ is a semialgebraic set in $\mathbb{R}^n$ . + +So far, we have shown that SANNs are able to represent any bounded semialgebraic function. For completeness, we now prove a partial converse; that is, SANNs always compute semialgebraic functions provided the numerical ODE solver is semialgebraic. Common ODE solvers, such as Euler and Runge-Kutta methods, are semialgebraic. The proposition below focuses specifically on the case of Forward Euler timestepper given in Section 3.2, but it can be easily modified for other methods. + +Proposition 47. For all $\mathcal{N} \in \text{ISDnet}(m, n, k)$ , $x \in \mathbb{R}^m$ , and $c_{\max} > 0$ , the function $f_{\mathcal{N}, c_{\max}}: x \mapsto \Pi z_N$ , where $z_N$ is given by the iteration (2), is semialgebraic. + +Proof. The operation iteration steps $(x, j, z_{j}) \mapsto z_{j + 1}$ are a composition of ISD-function and the function $(M, b) \mapsto (\operatorname{det}(M), M_{c}, b)$ , where $M_{c}$ is the co-factor matrix of $M$ , the function + +$$ +(\det (M), M _ {c}, b) \mapsto (\mathbf {1} _ {\det (M) > 0} + \mathbf {1} _ {\det (M) < 0}) (\det (M)) ^ {- 1} M _ {c} b) +$$ + +that implements Cramer's rule, and another ISD-function given by the time-step formula + +$$ +\left(z _ {j}, \dot {z} _ {j}\right)\rightarrow z _ {j} + \frac {1}{N} \dot {z} _ {j}. +$$ + +This makes the function $x \mapsto z_N$ semialgebraic; including the projection $\Pi_n$ results in a semialgebraic function due to the Tarski-Seidenberg theorem. + +# F NUMERICAL EXAMPLE: INVERSE PROBLEM FOR ELECTRICAL RESISTOR NETWORKS + +This section demonstrates the feasibility of training SANNs to solve a difficult non-linear inverse problem. + +Suppose we are given an electrical network $\Gamma = (V, E)$ with vertices $V$ and edges $E \subset V \times V$ . Physically, an electrical network is a system of connected resistors, and it is modeled by a graph where every edge is a resistor. An inverse problem for an electrical network is to find one or all graphs and resistors on the edges when the outcome of all possible voltage and current measurements in some of vertices of the graph (called the boundary nodes) are given, see Figure 5. + +We partition $V$ into boundary nodes $V_{B}$ and interior nodes $V_{I}$ . Let $\gamma : E \to \mathbb{R}_{\geq 0}$ be the edge conductivities. The network response matrix (i.e. Dirichlet-to-Neumann map) $\Lambda \in \mathbb{R}^{|V_B| \times |V_B|}$ computes the current at the boundary nodes resulting from applying voltages on $V_{B}$ . Our task is to recover the conductivities $\gamma$ from measurements $\Lambda$ of voltage-response on the boundary. See Curtis & Morrow (2000) for a thorough treatment of this inverse problem, and Forcey (2023) for recent developments. + +Equivalently, we wish to recover the Kirchhoff matrix $K \in \mathbb{R}^{|V| \times |V|}$ where + +$$ +K _ {i j} = \left\{ \begin{array}{l l} \gamma (i, j) & \text {i f} (i, j) \in E \\ - \sum_ {k \neq i} \gamma (i, k) & \text {i f} i = j \\ 0 & \text {o t h e r w i s e .} \end{array} \right. \tag {86} +$$ + +$K$ is a symmetric matrix with conductivities on off-diagonals and that satisfies Kirchhoff's Law—the sum of entries in each row is 0. Curtis & Morrow (2000) showed that $\Lambda$ is the Schur complement of a particular submatrix of the Kirchhoff matrix. Precisely, we write + +$$ +K = \left[ \begin{array}{l l} A & B \\ B ^ {T} & D \end{array} \right] \tag {87} +$$ + +where $A$ corresponds to boundary nodes $V_{B}$ and $D$ corresponds to interior nodes $I$ . If we let $\mathcal{K}(\Gamma)\subset \mathbb{R}^{|V|\times |V|}$ denote the set of valid Kirchhoff matrices on $\Gamma$ (a semialgebraic set), then the forward map (mapping a graph and the values of the resistors to the values of the measurements) is the semialgebraic function $F:\mathcal{K}(\Gamma)\to \mathbb{R}^{|V_B|\times |V_B|}$ defined + +$$ +F (K) := A - B D ^ {- 1} B ^ {T} = \Lambda \tag {88} +$$ + +The inverse problem is to recover an element of the preimage $F^{-1}(\{\Lambda\})$ . Since preimages of semialgebraic sets (in this case the single point $\{\Lambda\}$ ) of semialgebraic functions $(F)$ are themselves semialgebraic (Bochnak et al., 1998), we conclude $F^{-1}(\{\Lambda\})$ is a semialgebraic set. + +In certain special network topologies, such as for rectangular networks (Figure 5), the preimage of $F^{-1}(\{\Lambda\})$ is a singleton, that is, the values $\gamma(i,j)$ , $(i,j) \in E$ of the resistors on the graph $(V,E)$ are uniquely determined by the voltage-to-current map $\Lambda$ (Curtis & Morrow, 2000). + +![](images/d0f70b6f25d6b342897cef952603f91e6dca1d1e49916d6897ac6cd548c86ae1.jpg) +Figure 5: A $3 \times 3$ rectangular electrical network. Each edge in the graph represents a resistor with unknown conductance. + +This inverse problem has had a wide impact in several fields. In medical imaging it has led to new imaging modalities, for example, in monitoring lung function. Recently, EIT is used in monitoring the lungs of the COVID-19 patients, see Cappellini et al. (2024). + +# F.1 NUMERICAL RESULTS FROM TRAINING. + +We demonstrate the feasibility of training SANNs to perform non-trivial tasks using the network EIT problem as an example. Specifically, given a voltage-response map $\Lambda$ for a $2\times 2$ rectangular electrical network, the task is to recover the non-zero, off-diagonal entries of the Kirchhoff matrix $K$ . We trained a 4-layer SANN to minimize the loss $\mathcal{L}_{\mathrm{total}}$ from equation (9). We compare this against a feed-forward neural network trained to minimize $\mathcal{L}_{\mathrm{accuracy}}$ from equation (9) on the same data. Both networks were trained using the Adam optimizer. We also compare against a known reconstruction algorithm from Curtis & Morrow (2000) that is exact for noiseless data. The results are shown in Table 2 below. Let us shortly discuss these results: The Curtis and Morrow (C&M) algorithm is an analytical method that solves the problem using the theory of planar graphs, and therefore it is provably correct for all inputs, including inputs outside the training data used for the other algorithms, such as exceptional resistor networks with very small or large resistors. However, the algorithm is very sensitive to noise. The algorithm based on a feed forward network is used in our tests as a black-box algorithm and it works well with noisy data. The SANN is between these two algorithms—it is explainable in the sense that SANN can represent the rational matrix functions, and it works moderately well with noisy data. We note that in the numerical tests the training of SANNs was not fine tuned and by improving the training methods, it is possible that the results could be improved. + +As in the linear inverse problem example from Section 5.2, a trained SANN performs comparably to a standard feed-forward neural network of the same size, demonstrating the feasibility of training these networks. We do not claim to demonstrate numerical advantages of SANNs at this stage; further research is necessary to develop new techniques that fully leverage their expressive power. + +Both networks outperform the C&M algorithm on noisy input data. The C&M algorithm reconstructs conductances edge-by-edge, starting from the boundary and working inward; this causes + +
# parametersRelative error (noiseless)Relative error (1% noise))
Feed forward network17,7120.01570.0180
SANN17,6400.02340.0273
C&M—2.49e-070.0469
+ +Table 2: Results of training neural networks from data to solve the network EIT problem on $2 \times 2$ rectangular electrical networks. The last row (C&M) shows the reconstruction algorithm from Curtis & Morrow (2000). + +errors to accumulate rapidly for interior edges. In contrast, neural networks incorporate learned prior knowledge of the expected distribution of conductances, making them more robust to noisy measurements within the data distribution. + +# F.2 CONTINUOUS EIT PROBLEM (PDES) + +The inverse problem for electrical networks described above is a discrete version of the medical imaging problem encountered in Electrical Impedance Tomography (Borcea, 2002), an inverse problem for finite element models for the (anisotropic) conductivity equation. If $\Omega \subset \mathbb{R}^2$ is the interior of a simple polygon, and if one is given a triangulation of $\overline{\Omega}$ , then the Finite Element Method (FEM) model for the Dirichlet problem for an elliptic partial differential equation, + +$$ +\nabla \cdot (\sigma (x) \nabla u (x)) = 0, \quad x \in \Omega , \quad u | _ {\partial \Omega} = F, \tag {89} +$$ + +for a given matrix or scalar valued conductivity function $\sigma (x)$ , is the matrix equation + +$$ +\left( \begin{array}{c c} I _ {B} & 0 \\ L ^ {\prime} & L ^ {\prime \prime} \end{array} \right) u = \left( \begin{array}{c} f \\ 0 \end{array} \right) +$$ + +where $u = (u_{1}\dots u_{N})^{t}$ corresponds to values of the FEM solution at the vertices of the triangulation, $f = (f_{1}\dots f_{B})^{t}$ corresponds to the boundary value $f$ at the boundary vertices, and the matrix $(L^{\prime}L^{\prime \prime})$ depends on $\sigma$ and the triangulation and has rows whose elements add up to zero. + +If one considers the triangulation of $\overline{\Omega}$ as a graph, and if to each edge of the graph one assigns a resistor with a given conductivity, then the Dirichlet problem for this resistor network is to find a solution $u = (u_{1} \cdots u_{N})^{t}$ , corresponding to voltages at each vertex, of the matrix equation + +$$ +\left( \begin{array}{c c} I _ {B} & 0 \\ K ^ {\prime} & K ^ {\prime \prime} \end{array} \right) u = \left( \begin{array}{c} f \\ 0 \end{array} \right) \tag {90} +$$ + +where $f = (f_{1}\dots f_{B})^{t}$ corresponds to voltages at the boundary vertices. Also here, the rows of the matrix $(K^{\prime}K^{\prime \prime})$ , which depends on the resistors, add up to zero. + +Thus, formally, the FEM model for an elliptic partial differential equation and resistor networks lead to the same kind of equation, see Lassas et al. (2015) for details. + +Electrical Impedance Tomography (EIT) is a method proposed for medical and industrial imaging, where the objective is to determine the electrical conductivity or impedance in a medium by making voltage to current measurements on its boundary (Borcea, 2002). It has led to new imaging modalities, for example the Pulmovista500 device by Draeger AG & Co. used to monitor lung function. Recently, EIT is being used to monitor the lungs of COVID-19 patients (Cappellini et al., 2024). + +The boundary measurements are modeled by the Dirichlet-to-Neumann map $\Lambda_{a}$ , which maps the boundary value $f$ of the electric voltage to the electric current through the boundary (i.e., the conormal derivative) $\Lambda_{a}(f) = \nu \cdot \sigma u|_{\partial \Omega}$ . + +In FEM, let $\Omega$ be the interior of a simple polygon, and fix a triangulation of $\overline{\Omega}$ with vertices $\{x_1,\ldots ,x_N\}$ of which $\{x_{1},\dots,x_{B}\}$ lie on $\partial \Omega$ . Let $A(\Omega)$ be the set of continuous functions $\overline{\Omega}\to \mathbb{R}$ which are affine on each triangle. If $v_{k}$ is the unique function in $A(\Omega)$ which is 1 at $x_{k}$ and 0 at all the other vertices, then $A(\Omega) = \{\sum_{k = 1}^{N}c_{k}v_{k};c_{k}\in \mathbb{C}\}$ . + +There is a voltage-to-current map $\Lambda_{\sigma}^{\mathrm{FEM}}$ related to the FEM model that is a discrete version of the Dirichlet-to-Neumann map. To define this map, let us consider the space $A(\partial \Omega) = A(\Omega)|_{\partial \Omega} =$ + +$\{\sum_{j=1}^{B} c_j v_j |_{\partial \Omega}; c_j \in \mathbb{R}\}$ , and a quadratic form $Q_\sigma$ on $A(\partial \Omega)$ that is given for $f \in A(\partial \Omega)$ by + +$$ +Q _ {\sigma} (f, f) = \min _ {u} \int_ {\Omega} \sigma (x) \nabla u (x) \cdot \nabla u (x) d x, +$$ + +where the minimum is taken over $u \in A(\Omega)$ satisfying the boundary condition $u|_{\partial \Omega} = f$ . The voltage-to-current map $\Lambda_{\sigma}^{\mathrm{FEM}}$ is a symmetric matrix $\Lambda_{\sigma}^{\mathrm{FEM}}: \mathbb{R}^{B} \to \mathbb{R}^{B}$ determined by the formula + +$$ +\vec {f} \cdot \Lambda_ {\sigma} ^ {\mathrm {F E M}} \vec {f} = Q _ {\sigma} (f, f) +$$ + +where $f = \sum_{j=1}^{B} f_j v_j|_{\partial \Omega}$ is the boundary current corresponding to a vector $\vec{f} = (f_j)_{j=1}^B$ . + +The solution of the matrix equation (90) can be found using Cramer's formula as a meromorphic function. This implies that there is a SANN that solves the FEM approximation problem (90) for the partial differential equation (89) and another SANN that represents the voltage-to-current map. + +# G ADDITIONAL APPLICATIONS + +# G.1 SEMIALGEBRAIC OPTIMIZATION + +Consider the general class of optimization problems + +$$ +f (\theta) = \underset {\theta^ {*}} {\operatorname {a r g i n f}} \quad g \left(\theta^ {*}, \theta\right) \quad \text {s u b j e c t t o t h e c o n d i t i o n} \theta^ {*} \in S (\theta) \subset \mathbb {R} ^ {n} \tag {91} +$$ + +where $\theta \in \mathbb{R}^m$ , and both $g: \mathbb{R}^n \times \mathbb{R}^m \to \mathbb{R}$ and $S: \mathbb{R}^m \to \mathcal{P}(\mathbb{R}^n)$ are semialgebraic functions. Here, $\mathcal{P}(\mathbb{R}^n) := \{x \mid x \subset \mathbb{R}^n\}$ is the power set of $\mathbb{R}^n$ , and $S(\theta)$ is a semialgebraic constraint set that is allowed to vary based on $\theta$ . Using the Tarski-Seidenberg theorem, we can show that $f$ is a (possibly set-valued) semialgebraic function. Indeed, the graph of $f$ is + +$$ +\left. \left\{\left(\theta , \Pi_ {n} \partial \left(\overline {{\operatorname {e p i} (g)}} \cap (\mathcal {S} (\theta) \times \mathbb {R} ^ {m} \times \mathbb {R})\right)\right) \mid \theta \in \mathbb {R} ^ {m} \right\} \right. \tag {92} +$$ + +where $\Pi_n$ projects onto the first $n$ coordinates, $\partial$ is the boundary operation, and $\overline{\mathrm{epi}(g)}$ is the closure of the epigraph $\mathrm{epi}(g) = \{(\theta^*,\theta ,t)\in (\mathbb{R}^n\times \mathbb{R}^m\times \mathbb{R})\mid t\geq g(\theta^*,\theta)\}$ of $g$ . Since this is a semialgebraic set, $f$ is a semialgebraic function. If we impose the additional assumption that $f$ is bounded (which holds if $S$ is bounded, for example), then by Theorem 13 it can be represented by a SANN. + +Remark. Optimization problem (91) includes as special cases polynomial optimization and quadratic/linear/mixed-integer programming. It is at least NP-hard; there is no general polynomial-time algorithm to compute $f$ from a description of $g$ and $S$ (Lasserre, 2015). + +Many interesting problems can be formulated in terms of (91). Below, we give a new potential application using SANNs as a hypernetwork to sparsify ReLU networks. + +# G.2 SANNS AS HYPERNETWORKS + +In this section, we demonstrate how SANNs can be used as hypernetworks to optimize various properties of target ReLU networks. + +To connect the general class of optimization problems (91) to hypernetworks, suppose we have a fixed target architecture $\mathcal{N}_{\mathrm{target}}$ with trained weights $\theta \in \mathbb{R}^m$ . Let $S(\theta) \subset \mathbb{R}^m$ be the set of all weights generating equivalent networks (Petersen et al., 2021); i.e. every choice of weights from $S(\theta)$ produces the same input-output pairs as $\theta$ when used in architecture $\mathcal{N}_{\mathrm{target}}$ . When $\mathcal{N}_{\mathrm{target}}$ is a feed-forward ReLU network, $S(\theta)$ is a semialgebraic set (Valluri & Campbell, 2023). + +Now, different choices of objective function $g$ optimize various properties of the target network. For example, when $g$ counts the number of non-zero elements of $\theta^{*}$ (the "L0 norm"), $f$ returns the sparsest-possible equivalent network. Using sparse $\theta^{*}$ is both more memory-efficient (Bölskei et al., 2018) and interpretable (Fan et al., 2021) than using $\theta$ . Likewise, $f$ can return a "nearly-equivalent" network with small Lipschitz constant by relaxing $S$ and using $g$ that computes the Lipschitz constant of $\mathcal{N}_{\mathrm{target}}$ with weights $\theta^{*}$ . Reducing the Lipschitz constant of the target network improves its robustness, interpretability, and generalization performance (see Ducotterd et al. (2024) and references therein). + +# G.3 SEMIALGEBRAIC TRANSFORMER + +In this section, we demonstrate how a variation of the transformer architecture (Vaswani et al., 2023) is expressible as a SANN. Our presentation of the transformer architecture is inspired by Furuya et al. (2024). + +We start with the SoftMax attention mechanism at the heart of the transformer architecture. SoftMax: $\mathbb{R}^{n\times n}\to \mathbb{R}_{+}^{n\times n}$ operates row-wise on its input matrix: + +$$ +\operatorname {S o f t M a x} (X) _ {i, j} := \frac {\exp \left(X _ {i , j}\right)}{\sum_ {\ell = 1} ^ {n} \exp \left(X _ {i , \ell}\right)}. \tag {93} +$$ + +SoftMax is a continuous approximation to the row-wise function $\arg \max : \mathbb{R}^n \to \mathbb{R}^n$ + +$$ +\left(\arg \max x\right) _ {i} := \left\{ \begin{array}{l l} 1 / s & \text {i f} x _ {i} \geq x _ {j} \text {f o r a l l} j = 1 \dots n, \\ 0 & \text {o t h e r w i s e .} \end{array} \right. \tag {94} +$$ + +where $s$ is the number of indices $j$ such that $x_{j} = \max x$ . It is not a semialgebraic function since $\exp : \mathbb{R} \to \mathbb{R}$ is not semialgebraic; however, for our purposes we can use the following piecewise-rational function $\operatorname{saxp} : \mathbb{R} \to \mathbb{R}$ instead: + +$$ +\operatorname {s a x p} (x) = \left\{ \begin{array}{l l} x ^ {2} + x + 1 & x \geq 0 \\ 1 / \left(x ^ {2} - x + 1\right) & x < 0. \end{array} \right. \tag {95} +$$ + +saxp shares the following properties with exp: + +- $\operatorname{Im}(\operatorname{saxp}) = \operatorname{Im}(\exp) = (0, +\infty)$ +- $\operatorname{saxp}(0) = \exp(0)$ and $\operatorname{saxp}'(0) = \exp'(0)$ +- $\lim_{x\to -\infty}\operatorname {saxp}(x) = 0$ , and $\lim_{x\to +\infty}\operatorname {saxp}(x) = +\infty$ + +![](images/71977d9bef4036043006380626f52cb8487c1a6672733cc9eb15e23d368082a4.jpg) +Figure 6: saxp (black) is a semialgebraic approximation to exp (red). It is simple, accurate near 0, and has the correct asymptotic behavior as $x \to \pm \infty$ . + +saxp is a good approximation of exp near 0, but $\mathrm{saxp} = o(\exp)$ as $x \to \infty$ . In fact this is true for every semialgebraic function since every semialgebraic function is bounded above by a polynomial (Bochnak & Efroymson, 1980). This is not a concern for our transformers since layer normalization will keep the input to saxp near 0. + +By using saxp in place of exp in equation (93), we define SArgMax ("Semialgebraic ArgMax"): + +$$ +\operatorname {S A r g M a x} (X) _ {i, j} := \frac {\operatorname {s a x p} \left(X _ {i , j}\right)}{\sum_ {\ell = 1} ^ {n} \operatorname {s a x p} \left(X _ {i , \ell}\right)}. \tag {96} +$$ + +Like SoftMax, every entry of $\operatorname{SArgMax}(X)$ lies in the interval $(0,1)$ , and every row sums to 1. This yields the semialgebraic attention mechanism + +$$ +\operatorname {A t t} _ {\theta^ {h}} (X) := V X \operatorname {S A r g M a x} \left(X ^ {T} Q ^ {T} K X / \sqrt {k}\right) \tag {97} +$$ + +where $\theta^h \coloneqq (K, Q, V) \in \mathbb{R}^{k \times d_{\mathrm{in}}} \times \mathbb{R}^{k \times d_{\mathrm{in}}} \times \mathbb{R}^{d_{\mathrm{head}} \times d_{\mathrm{in}}}$ ("Key", "Query", and "Value") are learnable parameters. A multi-head attention mechanism with a skip connection is simply a linear combination of attention blocks: + +$$ +\operatorname {M A t t} _ {\theta} (X) := X + \sum_ {h = 1} ^ {H} W ^ {h} \operatorname {A t t} _ {\theta^ {h}} (X) \tag {98} +$$ + +where $\theta \coloneqq (W^h,\theta^h),h = 1,\ldots H$ are the learnable parameters specific to each attention head. + +Transformers are constructed by composing multi-head attention, MLP, and layer normalization blocks. MLP blocks with ReLU activation are simply + +$$ +\mathrm {M L P} _ {\theta} (X) := \operatorname {R e L U} (W X + B) \tag {99} +$$ + +with parameters $\theta := (W, B)$ . Row-wise layer normalization is + +$$ +\operatorname {L a y e r N o r m} (X) _ {i, j} := \frac {X _ {i , j} - \mu_ {i}}{\sigma_ {i}} \quad \text {w h e r e} \tag {100} +$$ + +$$ +\mu_ {i} := \frac {1}{n} \sum_ {\ell = 1} ^ {n} X _ {i, \ell} \tag {101} +$$ + +$$ +\sigma_ {i} := \sqrt {\frac {1}{n} \sum_ {\ell = 1} ^ {n} \left(X _ {i , \ell} - \mu_ {i}\right) ^ {2}}. \tag {102} +$$ + +Recall that every function defined piecewise on a semialgebraic decomposition of $\mathbb{R}^m$ using only addition, subtraction, multiplication, division, and extraction of roots is a semialgebraic function. From this, it is clear that MAtt, MLP, and LayerNorm in equations (98), (99), and (100) are semialgebraic. Furthermore, they are all continuous, so they are bounded when their domain is restricted to be compact, such as after a tokenization step. Finally, note that the composition of semialgebraic functions is itself a semialgebraic function. + +Transformers with semialgebraic attention are built as compositions of equations (98), (99), and (100), so they are bounded semialgebraic functions and thus representable by a SANN by Theorem 13. + +We emphasize that our only change to the transformer was to replace exp with the semialgebraic approximation saxp. This modified transformer is naturally expressible as a SANN without further modification of our architecture. \ No newline at end of file diff --git a/ICLR/2025/Semialgebraic Neural Networks_ From roots to representations/images.zip b/ICLR/2025/Semialgebraic Neural Networks_ From roots to representations/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..9d15e66e1a70f1e99e50e7525eb101da4f653887 --- /dev/null +++ b/ICLR/2025/Semialgebraic Neural Networks_ From roots to representations/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:18631bec3d6e0bba111e4a3a56647110ed18587448445d12c8fb1d7f26e1d204 +size 980133 diff --git a/ICLR/2025/Semialgebraic Neural Networks_ From roots to representations/layout.json b/ICLR/2025/Semialgebraic Neural Networks_ From roots to representations/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..459d32d22eaf856712be66f8175d4ef28f0017b5 --- /dev/null +++ b/ICLR/2025/Semialgebraic Neural Networks_ From roots to representations/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:586109a64140a432d8a7b85282b5dbc080863bac7b3059690f5b02faa0ed1db8 +size 2067169 diff --git a/ICLR/2025/Sensitivity Verification for Additive Decision Tree Ensembles/3456244d-f724-430f-84cd-17e7954fa8f1_content_list.json b/ICLR/2025/Sensitivity Verification for Additive Decision Tree Ensembles/3456244d-f724-430f-84cd-17e7954fa8f1_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..2f700daf4ffa89af82672d4b4524a35d550003a5 --- /dev/null +++ b/ICLR/2025/Sensitivity Verification for Additive Decision Tree Ensembles/3456244d-f724-430f-84cd-17e7954fa8f1_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d6f49ce3966a5fe3b8820d59ed6ccdfb49f3e39df9d3e36744eadb95d3bdc1df +size 100324 diff --git a/ICLR/2025/Sensitivity Verification for Additive Decision Tree Ensembles/3456244d-f724-430f-84cd-17e7954fa8f1_model.json b/ICLR/2025/Sensitivity Verification for Additive Decision Tree Ensembles/3456244d-f724-430f-84cd-17e7954fa8f1_model.json new file mode 100644 index 0000000000000000000000000000000000000000..45ee3f3a961873eac796d82001e13dd3a225c945 --- /dev/null +++ b/ICLR/2025/Sensitivity Verification for Additive Decision Tree Ensembles/3456244d-f724-430f-84cd-17e7954fa8f1_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e7668aff0df2ac1eae69059881fed8e62b31573a1536a057216ab6b7e4c812b0 +size 116965 diff --git a/ICLR/2025/Sensitivity Verification for Additive Decision Tree Ensembles/3456244d-f724-430f-84cd-17e7954fa8f1_origin.pdf b/ICLR/2025/Sensitivity Verification for Additive Decision Tree Ensembles/3456244d-f724-430f-84cd-17e7954fa8f1_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..c18578a0565074a7773f5d0050b090207b7a708a --- /dev/null +++ b/ICLR/2025/Sensitivity Verification for Additive Decision Tree Ensembles/3456244d-f724-430f-84cd-17e7954fa8f1_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1c28f7533ab326aace29279a9e656d9e8a565a68d53cac2fc108fa3decd85b60 +size 323084 diff --git a/ICLR/2025/Sensitivity Verification for Additive Decision Tree Ensembles/full.md b/ICLR/2025/Sensitivity Verification for Additive Decision Tree Ensembles/full.md new file mode 100644 index 0000000000000000000000000000000000000000..104de65a6c3124b900069f51795841f28bb4dbcb --- /dev/null +++ b/ICLR/2025/Sensitivity Verification for Additive Decision Tree Ensembles/full.md @@ -0,0 +1,319 @@ +# SENSITIVITY VERIFICATION FOR ADDITIVE DECISION TREE ENSEMBLES + +Arhaan Ahmad, Tanay V. Tayal, Ashutosh Gupta & S. Akshay + +Department of Computer Science and Engineering, + +Indian Institute of Technology Bombay, + +Mumbai, India. + +{arhaan, tanaytayal, akg, akshayss}@cse.iitb.ac.in + +# ABSTRACT + +Tree ensemble models, such as Gradient Boosted Decision Trees (GBDTs) and random forests, are widely popular models for a variety of machine learning tasks. The power of these models comes from the ensemble of decision trees, which makes analysis of such models significantly harder than for single trees. As a result, recent work has focused on developing exact and approximate techniques for questions such as robustness verification, fairness and explainability for such models of tree ensembles. + +In this paper, we focus on a specific problem of feature sensitivity for additive decision tree ensembles and build a formal verification framework for it, where we also take into account the confidence of the tree ensemble in its output. We start by showing theoretical (NP-)hardness of the problem and explain how it relates to other verification problems. Next, we provide a novel encoding of the problem using pseudo-Boolean constraints. Based on this encoding, we develop a tunable algorithm to perform sensitivity analysis, which can trade off precision for running time. We implement our algorithm and study its performance on a suite of GBDT benchmarks from the literature. Our experiments show the practical utility of our approach and its improved performance compared to existing approaches. + +# 1 INTRODUCTION + +Tree ensemble models, such as gradient boosted decision trees (Friedman, 2001) and random forests (Breiman, 2001), are now widely used for machine learning tasks in domains ranging from banking applications (Madaan et al., 2021) to computer vision (Criminisi & Shotton, 2013) to transportation (Podgorelec et al., 2002). The power of these models comes from the ensembling or boosting, which is known to empirically improve performance, unlike single decision trees, which are explainable and simple to understand but unwieldy to model complex behaviour. XGBoost (Chen & Guestrin, 2016), one such popular tree ensemble learning algorithm, shows remarkable performance with tree ensembles of size 100, where each tree has depth at most 5 or 6. Of course, the tradeoff with such modelling power is that it becomes difficult to predict and analyze these models, i.e., to ensure that they are reliable, robust, and behave as expected. This has led to a rich line of work in the last decade on formalizing and verifying different properties of tree ensembles. + +The first such property is robustness checking which asks whether there are adversarial input perturbations that could lead to misclassification. This problem has been addressed by several works over the past 5 years including Chen et al. (2019b); Einziger et al. (2019); Devos et al. (2021), using different techniques ranging from optimization/MILP-based (Kantchelian et al., 2016) to SMT-solver based approaches (Ignatiev et al., 2020a). Using SMT-solvers allows one to give guarantees of soundness and completeness, which is highly desirable when dealing with reliability issues but is often less scalable than purely optimization-based approaches. The literature also distinguishes between local (checking robustness around a given input) and global robustness (checking for all inputs) where the universal quantifier makes the latter problem significantly harder (Chen et al., 2019b; Leino et al., 2021). Many techniques also apply approximations (Devos et al., 2021) or look at subclasses (Andriushchenko & Hein, 2019). Indeed, this is unsurprising since in Kantchelian et al. (2016), it was shown that a very simple related problem is already NP-hard. + +Another property of interest is the sensitivity of a subset of inputs or features. A model is sensitive to a set of features if by keeping other features fixed and changing those features, the output of the model changes. In practice, models which are sensitive to a very small subset of features are prone to adversarial attacks. This question has also been seen as a way to formalize fairness (e.g., Dwork et al. (2012)) or causal discrimination (e.g., Galhotra et al. (2017)): sensitive features can be seen as protected, and changing the decision based only on these features can be seen as being unfair. This formulation was also adopted in Calzavara et al. (2023), where an approximation algorithm was provided for the same problem. Further, the generic tool Devos et al. (2021) solves verification questions including sensitivity/fairness, but provides approximate answers using optimization. A formal methods approach towards the problem is also provided in Ignatiev et al. (2020a), where the authors show how the fairness problem can be modelled as a global robustness query and hence relate the above problems. Another related approach in Tornblom & Nadjm-Tehrani (2020) used abstract interpretation techniques for verifying tree ensembles. + +In this paper, we launch a deeper investigation into the sensitivity problem for decision tree ensemble models, both from theoretical and practical perspectives. We start by observing that in most models and benchmarks, we are only interested in checking the sensitivity of a fixed few or even just one input feature. So the first question we ask is whether the problem remains hard even for a bounded number of features being changed. Second, if we look at tree ensemble training algorithms, like XGBoost, we observe that the decisions done at leaves, though binary, are derived from real number values, obtained from confidence. This leads us to ask if we can use these numbers as parameters to obtain a parametric notion of sensitivity, which can quantify "how sensitive features are" instead of just saying if they are sensitive or not. Third, we observe that existing encodings of the sensitivity problem either use one extreme of Boolean reasoning (e.g., SMT solvers in Ignatiev et al. (2020a)) or the other extreme of purely optimization-based reasoning (e.g., MILP solvers in Kantchelian et al. (2016)). Can we use other forms of powerful reasoning, such as pseudo-Boolean solvers, that have shown to be effective in other problems (Mexi et al., 2023) for the sensitivity problem? This forms the third question that we try to address in this work. + +Surprisingly, we show that even for a single feature, the sensitivity problem remains NP-hard. To show this, we provide a novel reduction from 3CNF-SAT which in fact shows that the problem is NP-hard even when restricted to decision tree ensembles with trees of depth at most 3. Next, we introduce a threshold parameter $p$ to define the class change confidence for the sensitivity problem. In other words, if the output of the classifier is above $p$ threshold, we say that the decision is 1 and if the output the classifier is below $1 - p$ , we say that decision is 0. This gives a natural tunable version of the sensitivity problem. Using this, we formulate the sensitivity problem as pseudo-Boolean constraints. Our novelty in the encoding includes a new encoding of trees as pseudo-Boolean constraints, which is rather different from the encoding of trees done in Ignatiev et al. (2020a) for the robustness verification problem. Using this novel encoding we model our property so that we can take advantage of recent advances in pseudo-Boolean solving towards this problem. We then perform experiments to illustrate that our algorithm has an order of magnitude better performance than the state-of-the-art. In sum, our contributions are the following: + +1. We formulate a parametric and bounded version sensitivity problem for additive decision tree ensembles and show that it is NP-complete. +2. We develop a novel encoding of this problem using pseudo-Boolean constraints. +3. We implement our algorithm and show that it outperforms state-of-the-art publicly available tools in a suite of benchmarks. + +We highlight that our hardness results and encoding ideas work for any tree ensemble which aggregates the trees by summing up the individual tree outputs (these are sometimes called additive tree ensembles, see e.g., Devos et al. (2021)). Such models include GBDTs and random forests which follow an additive predictive model. In particular, our results are independent of the way by which the tree ensemble was trained (e.g., gradient boosting, etc.). + +Other Related Work In addition to the work mentioned above, there are a few other lines of related work. SMT solvers and solver-based approaches and non-trivial encodings have been widely used for certifying robustness in neural networks and detailed frameworks such as DeepPoly (Singh et al., 2019) and $\alpha, \beta$ -Crown (Zhang et al., 2018; 2022) and some of these could also be related + +to sensitivity verification. However, there is comparatively less work on using these approaches for decision tree ensembles, beyond the works mentioned in the introduction. Another rich line of related work is to train robust tree ensembles. Calzavara et al. (2020), for instance, trains trees to make them more evasion aware while Chen et al. (2019a) provides a training method that makes the trees more robust. Our current focus is on verifying sensitivity but it would also be interesting to extend this to training insensitive models of tree ensembles. Finally, there is a relation between notions of explainability such as contrastive explainability and abductive explainability (Ignatiev et al., 2020b) and sensitivity or fairness. However, there is a marked difference as we focus on global sensitivity based on given features, while explainability refers to the change of class with respect to or around an input. However, global notions of contrastive explainability could perhaps be related to our approach. As explained above, our approach works for random forests as well. A caveat is that the classical definition of random forests (Breiman, 2001) computes the final answer by max-pooling rather than summing up. We believe that our theoretical results and encodings can also be extended to the max-pool setting, but we leave this for future work. On the other hand, some famous implementations, such as Scikit-Learn (Pedregosa et al., 2011), do use a weighted average of the individual tree predictions to make the final decisions, which can be incorporated into our approach. + +# 2 PRELIMINARIES + +In the classification setting, given an input space $\mathcal{X} \subseteq \mathbb{R}^d$ defined over $d$ -dimensional space of features $\mathcal{F}$ , and an output space $\mathcal{Y}$ , which is a discrete subset of $\mathbb{R}$ , there exists a unknown function $h: \mathcal{X} \to \mathcal{Y}$ that maps each element of $\mathcal{X}$ to its corresponding correct output in $\mathcal{Y}$ . A classifier is a function from $\mathcal{X}$ to $\mathcal{Y}$ which approximates $h$ by learning from data. Decision trees and tree ensembles are well-known models used to define classifiers. + +Decision Trees A decision tree $T$ is either a leaf $n$ with label $n. \text{val} \in \mathbb{R}$ or an internal node $n$ with two children $n. \text{yes}$ and $n. \text{no}$ decision trees, and a guard $n. g$ , which is a Boolean formula involving the input features. Typically, the Boolean formula is a linear inequality of the form $f < v$ , where $f$ is a feature and $v$ is a real constant. Given an input $x \in \mathcal{X}$ , the (binary) decision tree evaluates it top-down from the root, by evaluating the Boolean formulae in the guards to determine the child to go to, and finally reach a leaf, where it returns the output value of the leaf encountered. For instance, guard $g = f < v$ , $g(x)$ is true if $x_f < v$ , where $x = (x_f)_{f \in \mathcal{F}}$ . This defines the output or outcome $T(x)$ of tree $T$ on input $x \in \mathcal{X}$ as follows: $T(x) = T. \text{val}$ , if $T$ is a leaf, else, it is recursively evaluated, i.e., if $T. g(x)$ is true, it is $T. \text{yes}(x)$ and if $T. g(x)$ is false, it is $T. \text{no}(x)$ . + +Decision Tree Ensembles Rather than relying on a single tree to approximate the underlying function, decision tree ensembles utilize multiple trees, each learning different parts of the problem and then aggregating them to produce a single output. There are many different methods to train decision tree ensembles, and in this paper, we focus on XGBoost (Chen & Guestrin, 2016), a popular gradient-boosting algorithm. Formally, an ensemble model $c = \{T_1,\dots,T_m\}$ is a set of decision trees. The ensemble model sums up the results of the member trees. We define the outcome of the ensemble model $c$ as $c(x) = \sum_{i = 1}^{m}T_{i}(x)$ . We will often refer to this value as the model's raw output. Note that the decision tree ensembles we consider in this paper are always additive (even if we do not explicitly mention it), i.e., they aggregate the trees by summing up the results of individual trees. + +Tree Ensemble Classifiers For classification tasks in many real-world applications, the output space $\mathcal{V}$ is finite, meaning that the set of possible outputs, commonly known as labels in this scenario, is discretized. A tree ensemble classifier $c$ is a decision tree ensemble with an output space $\mathcal{V} = \{0,1,\dots k - 1\}$ where $k$ is the total number of distinct classes. The output of the tree ensemble classifier is acquired by first calculating the raw output of the tree ensemble model $c(x)\in \mathbb{R}$ and then mapping $c(x)$ to its label from $\mathcal{V}$ . We denote the output of the model as $c_{\mathrm{label}}:\mathcal{X}\to \mathcal{Y}$ . + +A binary tree ensemble classifier is a decision tree ensemble with an output space of size 2. To map the raw output to a binary output, i.e., in $\{0,1\}$ , one way is to set the output to 1 if $c(x) \geq 0$ and 0 otherwise. However, widely used training methodologies (for instance, the XGBoost algorithm introduced in Chen & Guestrin (2016)) require us to calculate an intermediate value by applying + +the sigmoid function to the raw output. This can also be interpreted as a measure of the confidence of the model, and is of interest to us. Let $c(x)$ be the raw output of the ensemble for input $x$ . To map this to a probability space [0, 1], the sigmoid function is applied on $c(x)$ making the new output: $\sigma(c(x)) = \frac{1}{1 + e^{-c(x)}}$ . This transformation gives us $\sigma(c(x))$ , which represents the probability that the input $x$ belongs to the positive class (1). The closer $\sigma(c(x))$ is to 1, the higher the likelihood that $x$ is a positive example, and vice versa. To calculate the final output ( $c_{\text{label}}$ ), if the output of the sigmoid function is greater than or equal to 0.5, we assign it to the class (1), and if the output is less than 0.5, we assign it to the class (0). + +# 3 THE SENSITIVITY PROBLEM: MODELING AND HARDNESS + +We now define the sensitivity problem for tree ensembles. For an input $x \in \mathcal{X}$ and set of features $F \subseteq \mathcal{F}$ , let $x_{F}$ denote the projection of $x$ onto $F$ . When $F = \{f\}$ , we use $x_{f}$ to denote the scalar. + +Definition 3.1. Given a tree ensemble classifier $c: \mathcal{X} \longrightarrow \mathcal{Y}$ , and a set of features $F \subseteq \mathcal{F}$ , $c$ is said to be $F$ -sensitive, if we can find two inputs $x, x' \in \mathcal{X}$ such that $x_{\mathcal{F} \setminus F} = x'_{\mathcal{F} \setminus F}$ and $c_{\mathrm{label}}(x) \neq c_{\mathrm{label}}(x')$ . The sensitivity problem asks whether a given tree ensemble classifier is $F$ -sensitive to a given set of features $F$ . + +One issue with the above definition is that it just requires the two witness inputs to be classified differently but does not take into account their distance from the decision boundary (of the classifier). As explained earlier, classifier learning algorithms, in fact, provide this information. Consider the example in Figure 1, where we have a two-tree $T_{1}, T_{2}$ ensemble $c$ that is trained to be a recommendation system for television shows. The input contains three features $f_{1}, f_{2}$ and $f_{3}$ that may take values between 0 and 30 with $\mathcal{V} = \{0,1\}$ . It is easy to see that $\alpha_{1} = (6,2,14)$ and $\alpha_{2} = (6,2,17)$ are two inputs that vary only on feature $f_{3}$ but have $c(\alpha_{1}) = 0.1 - 1.2 = -1.1$ while $c(\alpha_{2}) = 0.7$ , i.e., $c_{\mathrm{label}}(\alpha_1)\neq c_{\mathrm{label}}(\alpha_2)$ . However, the pair $\beta_{1} = (6,4,14)$ and $\beta_{2} = (8,4,14)$ varies only in feature $f_{1}$ and again has $c_{\mathrm{label}}(\beta_1)\neq c_{\mathrm{label}}(\beta_2)$ , but we notice that $c(\beta_1) = 10.1$ and $c(\beta_2) = -9.9$ . In a practical scenario, one may argue that $(\beta_{1},\beta_{2})$ is a much more interesting pair of inputs since it takes an almost sure positive prediction to a quite sure negative prediction, which can potentially be very harmful compared to an unsure prediction getting flipped. + +![](images/91604b5925937edcd160abdc5fbe3396895377c016e18865102f263be5a7b6e2.jpg) +Figure 1: A tree ensemble with two trees $T_{1}, T_{2}$ having real-valued (raw) outputs on its leaves. + +![](images/76c7dec5958a27e85f49c47c535684f0c6fd9e8122222b16a1b980509b9808df.jpg) + +This motivates a more nuanced definition that is parametrized by the difference using the sigmoid function $\sigma$ that we want to see in the inputs that witness the change in classification with respect to the sensitive features. + +Definition 3.2. Given a tree ensemble classifier $c: \mathcal{X} \longrightarrow \mathcal{Y}$ , a set of sensitive features $F \subseteq \mathcal{F}$ and a parameter $p \geq 0$ , $c$ is said to be $(p, F)$ -sensitive, if we can find two inputs $x, x' \in \mathcal{X}$ such that $x_{\mathcal{F} \setminus F} = x'_{\mathcal{F} \setminus F}$ and $\sigma(c(x)) \geq 0.5 + p$ , $\sigma(c(x')) \leq 0.5 - p$ . The $(p, F)$ -sensitivity problem asks if a given tree ensemble is $(p, F)$ -sensitive with respect to a given set of sensitive features $F$ . + +It is easy to see that the $F$ -sensitivity problem is a special case of the $(p,F)$ -sensitivity problem. Hence, for our hardness results, we will focus on the $F$ -sensitivity problem. However, for our + +encoding and algorithm in the next section, as well as experimental results later, we will use $(p,F)$ -sensitivity. + +Sensitivity checking for single tree decision models is known to be in polynomial time (Chen et al., 2019b), but as we show next, this is not the case for general decision tree ensembles. We consider three variants of the problem, based on the size of the set of sensitive features $F$ : (i) $|F| = 1$ or the single feature sensitivity problem, (ii) $|F| = k$ for any fixed constant $k$ which we call the $k$ -sized subset feature sensitivity problem and (iii) $|F| = |\mathcal{F}|$ , the all-feature sensitivity problem. Note that the single feature sensitivity is the same as 1-subset feature sensitivity. Second, the $k$ -sized subset feature sensitivity problem is only defined if the number of features in the problem instance i.e., $|\mathcal{F}| \geq k$ . Finally, the all-feature sensitivity cannot be seen as a specific instance of the $k$ -sized subset sensitivity problem since in the latter, $k$ is a part of the input, while in the former, it is not. + +We will now show that all three variants are NP-hard. We start by showing the NP-hardness of the single feature sensitivity problem and obtain the others as corollaries. Before going into our proof, we recall that the robustness verification problem for decision tree ensembles was shown to be NP-hard using a reduction from the so-called evasion problem for decision tree ensembles, which was shown to be NP-hard in Kantchelian et al. (2016) (where, evasion for a given tree ensemble model $c$ , asks whether there exists an $x \in \mathcal{X}$ such that $c(x) > 0$ ). However, while evasiveness can potentially be used to show hardness for the all-feature sensitivity problem, it cannot be easily lifted to show single or fixed subset feature hardness. Instead, we come up with a novel and direct reduction from the 3CNF-SAT problem to show that single feature sensitivity is already NP-hard. + +Theorem 1. The single feature sensitivity problem, i.e., checking whether a given tree ensemble classifier is $F$ -sensitive for $|F| = 1$ , is NP-hard. + +Proof. We will show a reduction from 3CNF-SAT, the classical NP-hard question, which asks, given a Boolean formula in conjunctive normal form (CNF) with 3 variables per clause, whether it is satisfiable. Given an instance $\varphi$ of 3CNF-SAT, let $cl(\varphi)$ be the set of clauses $\{cl_1, cl_2, \ldots, cl_m\}$ , with $m = |cl(\varphi)|$ and let $var(\varphi)$ denote the set of variables $\{v_1, v_2, \ldots, v_n\}$ , with $n = |var(\varphi)|$ . Then from $\varphi$ we start by creating the formula $\varphi' = \varphi \wedge (v_{n+1} \vee v_{n+1} \vee v_{n+1})$ which is also a 3CNF formula with a new variable $v_{n+1}$ and a new clause $cl_{m+1} = (v_{n+1} \vee v_{n+1} \vee v_{n+1})$ . Observe that $\varphi$ is satisfiable, i.e., there exists an input $x \in \{0, 1\}^n$ that satisfies $\varphi$ iff $\varphi'$ is satisfiable, i.e., there exists an input $x' \in \{0, 1\}^{n+1}$ that satisfies $\varphi'$ . We will now show a reduction to the (single feature) sensitivity problem. That is, we will construct a decision tree ensemble $c$ with depth 3, such that $c$ is 1-feature sensitive iff $\varphi'$ is satisfiable. + +In formula $\varphi'$ , for every clause $cl_i$ , we create a depth-3 decision tree $T_i$ as depicted in Figure 2, where $m + 1 = |cl(\varphi')|$ . That is, for each literal (i.e., $v_i$ or $\neg v_i$ ) in the clause, we add a "true" branch with output $\frac{1}{|cl(\varphi')|}$ , and a "false" branch where we either continue to next literal or return $-1$ if there are no more literals left in the clause. This is a slight abuse of notation as our definition earlier had guards of the form $f < v$ , but this can easily be adapted. Now, for each literal, if it occurs positively as $v_i$ (resp. negatively as $\neg v_i$ ), the true (resp. false) branch outputs $\frac{1}{|cl(\varphi')|}$ . We form the decision tree ensemble $c$ using the above decision trees with trees enumerated $T_i$ for $i \in \{1, 2, \ldots, m + 1 = |cl(\varphi')|\}$ . Note that in this case, the domain of $c$ , i.e., $\mathcal{X} = \{0, 1\}^{n + 1}$ . + +![](images/c4b79387e191577195aca0a86e5363ec544d0e2cf67a31163b4ab3c337ef1f88.jpg) +(a): Clause $v_{1}\lor v_{2}\lor v_{3}$ + +![](images/1fdf553ad5164e1f6c42d966df9785cf2912454be2288f8b10adb66aa03704d4.jpg) +(b): Clause $v_{1}\lor \neg v_{2}\lor \neg v_{3}$ +Figure 2: Given a formula $\psi$ with $|cl(\psi)|$ clauses, each clause is replaced by a tree above. + +Lemma 1. For all $x\in \{0,1\}^{n + 1}$ we have $c_{\mathrm{label}}(x) = 1$ iff $\varphi^{\prime}(x) = 1$ , i.e., $x$ satisfies/models $\varphi^{\prime}$ . + +Proof of Lemma 1. There are two possible scenarios for an input $x$ : + +- The input satisfies the 3CNF formula $\varphi'$ , i.e., $\varphi'(x) = 1$ . In this case, each of the $m + 1$ clauses is satisfied in the input, and thus, for all trees $T_i$ we have $T_i(x) = \frac{1}{m + 1}$ . Thus, $\sum_{i=1}^{m+1} T_i(x) = 1 > 0 \Rightarrow c_{\mathrm{label}}(x) = 1$ . +- The input does not satisfy the 3CNF formula $\varphi'$ . Thus, a clause exists that is not satisfied by the input. Let that clause be $cl_j$ . By the construction of $c$ , for the corresponding tree, $T_j(x) = -1$ and for all $i \neq j$ , $T_i(x) \leq \frac{1}{m+1}$ . Thus, $\sum_{i=1}^{m+1} T_i(x) \leq -1 + \frac{m}{m+1} = \frac{-1}{m+1} < 0 \implies c_{\mathrm{label}}(x) = 0$ . + +Now, we use the above lemma to prove hardness of sensitivity. More precisely, we will check sensitivity with respect to the single Boolean variable $v_{n+1}$ . Call the set of all features $\mathcal{F}$ and the set for sensitivity checking $F = \{v_{n+1}\}$ . To complete the proof, we will show that $c$ is $F$ -sensitive iff $\varphi'$ is satisfiable. + +In one direction, if $c$ is $F$ -sensitive, by definition, there exist $x, x' \in \{0,1\}^{n+1}$ , with $x_{\perp F} = x'_{\perp F}$ such that $c_{\mathrm{label}}(x) = 1$ and $c_{\mathrm{label}}(x') = 0$ . Thus, we immediately infer that there exists $x$ such that $c_{\mathrm{label}}(x) = 1$ , which by the above lemma means that $x$ satisfies $\varphi'$ and hence $\varphi'$ is satisfiable. In the other direction, if $c$ is not $F$ -sensitive. Then for all $x_{\perp F} \in \{0,1\}^n$ , for all possible choices of $x_F, x'_F$ , we must have $c_{\mathrm{label}}(x_{\perp F}, x_F) = c_{\mathrm{label}}(x_{\perp F}, x'_F)$ . But now, if we consider $x_F = 0$ , then the decision tree $T_{m+1}$ will evaluate to -1 since $cl_{m+1}[v_{n+1} \mapsto 0] = 0$ . As a result, we can conclude that for any $x_{\perp F} \in \{0,1\}^n$ , we have $\sum_{i=1}^{m+1} T_i(x_{\perp F}, 0) \leq -1 + \frac{m}{m+1} < 0$ and so $c_{\mathrm{label}}(x_{\perp F}, 0) = 0$ . Thus, for any $x_F \in \{0,1\}$ , $c_{\mathrm{label}}(x_{\perp F}, x_F) = 0$ , which implies that for all $x \in \{0,1\}^{n+1}$ , $c_{\mathrm{label}}(x) = 0$ . Again, appealing to Lemma 1 above, we can conclude that $\varphi'$ is not satisfiable. + +Thus, we have reduced the problem of finding satisfiability of $\varphi^{\prime}$ to that of checking sensitivity for a feature set of size 1, and hence, the latter problem is NP-hard. + +We can now infer some interesting corollaries. First, we observe that the above proof can be lifted from single feature sensitivity to $k$ -sized subset feature sensitivity for any fixed $k$ . Given an arbitrary instance of the single feature sensitivity problem, we can construct an instance of a $k$ -sized subset feature sensitivity (for $|F| = k$ ) by introducing $k - 1$ new dummy variables to the problem. These dummy variables are part of our input to sensitivity checking, but they do not affect the tree's output in any way (formally, one way to do this is to have decision tree stumps on these variables that output zero irrespective of the variables' values). Thus, checking for sensitivity for $k$ -sized subset of features will be equivalent to checking for sensitivity for just the first feature in the original instance and hence, checking sensitivity with respect to a given fixed size of the subset of features is also NP-hard. + +Corollary 1. For any fixed constant $k$ , the $k$ -sized subset feature sensitivity problem for decision tree ensembles is NP-hard. + +The above argument holds for any $k$ -sized sensitive feature set. But this does not immediately imply that it can be lifted to the case where all features are sensitive, i.e., $|F| = |\mathcal{F}|$ . Indeed, one could imagine that the all-feature sensitivity problem could be easier. However, by modifying the proof above, we can show that this problem is also NP-hard. As the proof is very similar, we leave its details to Appendix A. + +Corollary 2. The all-feature sensitivity problem for decision tree ensembles is NP-hard. + +Finally, an important remark is that our NP-hardness proof requires trees in the ensembles that have depth 3. This leaves open the intriguing question of whether the (single/k-sized subset/all) sensitivity problem is NP-hard for tree ensembles where the depth of each tree is at most 2. Unfortunately, our + +proofs cannot be extended to this case since they rely on the hardness of 3CNF-SAT, which requires 3 variables per clause, which we translate to depth 3 trees. However, 2CNF-SAT is poly-time solvable and hence not useful for showing hardness. We expect that a different technique/reduction/encoding will be needed to resolve this question, and we will leave this for future work. We also note that if we fix the number of trees and vary the depth, or if we fix the depth and vary the number of trees, NP-hardness follows, while if we fix both the number of trees and depth, then the problem is easy. + +Above, we considered hardness results. On the other hand, for all the problems mentioned above, we can obtain NP upper bounds. To see this, note that given a candidate solution i.e., values of inputs $x$ and $x'$ that only differ on the set of sensitive features $F$ , we can evaluate the decision tree top-down and check whether it is a valid solution or not, i.e., the decision for $x$ differs from the decision for $x'$ . Thus, both $F$ -sensitivity and $(p, F)$ -sensitivity problems are in NP hence they are NP-complete. + +# 4 ENCODING THE SENSITIVITY PROBLEM + +In this section, we will consider encoding the problem of sensitivity of binary tree ensemble classifier $c$ into solving a set of pseudo-Boolean constraints (Boros & Hammer, 2002), which are arithmetic constraints containing only Boolean variables. + +First, we observe that the general $p$ -sensitivity problem in Definition 3.2 can be written as the problem of the search of the $p$ -sensitive pairs of inputs $x, x'$ for the set of features $F$ as follows + +$$ +\exists x, x ^ {\prime}, \left(\bigwedge_ {f ^ {\prime} \in \mathcal {F} \backslash F} x _ {f ^ {\prime}} = x _ {f ^ {\prime}} ^ {\prime}\right) \wedge \sigma (c (x)) \geq 0. 5 + p \wedge \sigma (c (x ^ {\prime})) \leq 0. 5 - p +$$ + +Since the output of the classifiers is via the sigmoid function, we compute the inverse of the function to compute the required gap between the inputs of the sigmoid function. Let $\delta = \sigma^{-1}(0.5 + p) = \log \left(\frac{0.5 + p}{0.5 - p}\right)$ , where $\sigma^{-1}$ is the inverse of sigmoid. Let $c$ be a decision tree ensemble with $m$ trees $T_{1},\ldots ,T_{m}$ . The problem translates into + +$$ +\exists x, x ^ {\prime}, \left(\bigwedge_ {f ^ {\prime} \in \mathcal {F} \backslash F} x _ {f ^ {\prime}} = x _ {f ^ {\prime}} ^ {\prime}\right) \wedge \sum_ {i = 1} ^ {m} T _ {i} (x) \geq \delta \wedge \sum_ {i = 1} ^ {m} T _ {i} \left(x ^ {\prime}\right) \leq - \delta +$$ + +Let us start encoding the above constraints using a pseudo-Boolean encoding. + +Encoding inputs The range of feature $f$ is $[-\infty, \infty]$ . However, $c$ naturally divides the input into segments, which we define as follows. Let $G_f$ be the set of all guards on feature $f$ in $c$ . Let the set of thresholds be $C_f = \{v | f < v \in G_f\}$ sorted in ascending order and let $k_f = |C_f|$ . The range of $f$ is divided in $k_f + 1$ segments by $C_f$ . We can encode the segments using $k_f$ bits. For $0 \leq j < |C_f|$ , let bit $b_{1fj}$ indicate that feature $f$ is less than $C_f[j]$ in input $x$ and let bit $b_{2fj}$ indicate that feature $f$ is less than $C_f[j]$ in input $x'$ . We need to include constraints which encode that the boundaries are in increasing order, as follows + +$$ +b _ {q f j} \Rightarrow b _ {q f (j + 1)} \tag {1} +$$ + +We also need to say for each $f \notin F$ , $x$ and $x'$ will agree. Therefore, for each $j \in \{1 \dots k_f\}$ , we add + +$$ +b _ {1 f j} = b _ {2 f j} \tag {2} +$$ + +Encoding tree We need to encode the structure of the trees in constraints. Let $t_{qin}$ indicate that the node $n \in T_i$ is visited when evaluating $T_i(x_q)$ . Let the root node of $T_i$ be denoted by $r_i$ . Since the roots of all the trees are necessarily visited, the following bits are always true + +$$ +t _ {q i r _ {i}} \tag {3} +$$ + +For each internal node $n \in T_i$ , let $(f < v) = n.g$ such that $C_f[j] = v$ for some $j$ . We need to say that if $n$ is visited, and $(f < v)$ is true, then $n.yes$ is visited otherwise, $n.no$ is visited. + +$$ +\left(t _ {q i n} \wedge b _ {q f j} \Rightarrow t _ {q i (n. y e s)}\right) \wedge \left(t _ {q i n} \wedge \neg b _ {q f j} \Rightarrow t _ {q i (n. n o)}\right) \tag {4} +$$ + +For each tree $T_{i}$ , we may also optionally add the following constraints to help the solver to know that, at most one leaf of $T_{i}$ can be visited by the input. We denote the set of leaf nodes for a tree $T_{i}$ by $T_{i}$ . Leaves + +$$ +\sum_ {n \in T _ {i}. l e a v e s} t _ {q i n} = 1 \tag {5} +$$ + +Encoding output We now need to encode the condition that the sum of the tree outputs is greater than $\delta$ for $x$ and less than $-\delta$ for $x'$ . Remember that the label of a leaf $n \in T_i$ is a real value with infinite precision. We discretize this real value into steps of size $1 / \alpha$ , where $\alpha$ is the precision factor in our encoding. For the encoding of $x$ , we multiply the leaf value $n.\text{val}$ by $\alpha$ and take the ceiling of the result. This constant integer is then multiplied by the corresponding $t_{1in}$ . The ceiling operation increases the sum, which is then compared to the bounds derived from the floor of $\alpha \delta$ . Similarly, we impose constraints for the output of $x'$ . + +$$ +\left(\sum_ {i = 1} ^ {m} \sum_ {n \in T _ {i}. l e a v e s} t _ {1 i n} \lceil \alpha t. v a l \rceil\right) \geq \lfloor \alpha \delta \rfloor \wedge \left(\sum_ {i = 1} ^ {m} \sum_ {n \in T _ {i}. l e a v e s} t _ {2 i n} \lfloor \alpha t. v a l \rfloor\right) \leq \lceil - \alpha \delta \rceil \tag {6} +$$ + +The above equations are the set of pseudo-Boolean constraints. + +Our encoding of the problem differs significantly from the one presented in Ignatiev et al. (2020a), which is a direct SMT encoding of trees and their verification query. The problem we address is similar to the knapsack problem, and an appropriate encoding for it seems to be through pseudo-Boolean constraints. Encoding the problem as SMT constraints, as done by Ignatiev et al. (2020a), may result in a loss of structural information, preventing the solver from fully leveraging the pseudo-Boolean nature of the constraints. We solve these constraints using a pseudo-Boolean solver to check for $p$ -sensitivity. We have the following guarantees for the result that we obtain. + +Theorem 2 (Completeness and $\alpha$ -soundness). 1. If conjunction $(1) \land (2) \land (3) \land (4) \land (5) \land (6)$ is unsatisfiable then the classifier $c$ is not $(p, F)$ -sensitive. + +2. Otherwise, there is a counterexample pair $(x,x^{\prime})$ such that $c(x)\geq \delta -\frac{m + 1}{\alpha}$ and $c(x^{\prime})\leq -\delta +\frac{m + 1}{\alpha}$ , where $\delta = \log \left(\frac{0.5 + p}{0.5 - p}\right)$ and $\alpha$ is the precision parameter of our analysis. + +Proof sketch. Since the floor and ceiling operations are in conservative directions, 1 is true. In case of satisfiable constraints, there will be exactly $m$ bits that are 1 in the sum in (6). The pre-sigmoid output in the reported counterexamples will be closer to zero by amount $(m + 1) / \alpha$ in $\delta$ , due to $m$ ceiling/floor operations on the left-hand side of the inequalities and one ceiling/floor operation on the right-hand side in (6). Therefore, 2 holds. + +As we increase $\alpha$ , the precision of our counterexamples improves. Thus, we can prove the following corollary, which states that if $\alpha$ is sufficiently large, the counterexamples will be precise. + +Corollary 3. There exists an $\alpha$ such that every counterexample pair $(x, x')$ satisfying the above pseudo-Boolean formula will satisfy $\sigma(c(x)) \geq 0.5 + p$ and $\sigma(c(x')) \leq 0.5 - p$ . + +Proof Sketch. In the non-approximated constraint $\sum_{i=1}^{m} \sum_{n \in T_i \cdot \text{leaves}} t_{1i} \cdot t \cdot \text{val} > \delta$ , consider the difference between $\delta$ and the sum closest to, but less than $\delta$ . If this difference is larger than $(m + 1) / \alpha$ , then there can be no extra counterexamples due to the imprecision of the encoding by Theorem 2. + +# 5 EXPERIMENTS + +In this section, we present our tool, $\mathrm{SENSPB}^2$ , which implements the above method for $p$ -sensitivity checking. The tool is developed in Python and utilizes Z3 (de Moura & Bjørner, 2008) as its backend pseudo-Boolean solver. We also tried a dedicated pseudo-Boolean solver (Elffers & Nordström, 2018), but its performance was similar, so we kept to Z3. Our tool accepts as input a binary classifier + +
Benchmark NameDetailsSENSPB time taken (s)SMT
#TreesDepth#FeatMinMaxAverage
Breast cancer robust45112.722.812.762.76
Breast cancer unrobust46112.752.822.82.8
Diabetes robust205933.23.023.443
Diabetes unrobust20593.4235.857.2
Cod-rna unrobust80487.212.98.3106
Binary MNIST robust50678414.615.314.9TO
Higgs unrobust100828130TO1188TO
IJCNN robust6082316TO330.7TO
Synthetic 11006105.365.855.57TO
Synthetic 212561066.356.2TO
Synthetic 31506107.098.197.36TO
Synthetic 41756106.256.576.37TO
Synthetic 52006104.40124.5116.48TO
+ +Table 1: Times taken for verifying or countering sensitivity of all singular feature sets. The Min, Max and Averages in SENSPB times are taken by running the tool with different features of the benchmark tree ensembles as the sensitive feature. More information on these experiments is available in Appendix B. + +XGBoost model, a set of features for which sensitivity is being assessed, the parameter $p$ , and a precision parameter $\alpha$ . If the model is not sensitive, the tool outputs "pass". Otherwise, it returns a pair of inputs that demonstrate $p$ -sensitivity on the specified features. + +To assess our method, we begin by running our tool on a set of XGBoost models from Chen et al. (2019b). Additionally, to evaluate the performance of our tool, we train XGBoost models with varying numbers of ensemble trees on 100,000 randomly generated data samples. We did not run experiments for (additive) Random Forests separately since, from the point of view of our encoding, they are equivalent to GBDT models. We ran the experiments on an Ubuntu machine with 20 1.3GHz cores, which has 64GB RAM. + +There have been several tools (Devos et al., 2021; Tornblom & Nadjm-Tehrani, 2020; Chen et al., 2019b; Ignatiev et al., 2020a; Calzavara et al., 2023; Kantchelian et al., 2016) that implement different variants of verification for tree ensembles. In our experiment, we compare SENSPB with the closest approach in VERITAS (Devos et al., 2021) and an SMT-based approach presented in Ignatiev et al. (2020a). We used our own implementation of the SMT-based approach with Z3 (de Moura & Bjørner, 2008) as the SMT solver. We did not compare with Calzavara et al. (2023) as it only supports random forest trees and we were unable to make it work with XGBoost models. Finally, we did not include a comparison with Kantchelian et al. (2016) since VERITAS has already demonstrated superior performance over this tool, albeit for the problem of local robustness verification. + +We ran SENSPB on the benchmarks, and the results are presented in Table 1. For each benchmark ensemble, in one experiment we pick a feature $f$ and run SENSPB on the ensemble to check whether the classifier is $p$ -sensitive to $f$ . We repeat this experiment over all possible $f$ , and the maximum, minimum and average time taken by us for termination is reported. We set a timeout of 1 hour for each experiment. In our experiments, we have set gap $p = 0.15$ and precision $\alpha = 10 \times |\# \text{Trees}|$ . For the SMT solver-based approach, our experimental setup is the same as SENSPB and we report the average time taken. More experiments can be found in Appendix C. + +VERITAS does not solve the sensitivity problem directly. We instead ask VERITAS to maximise the difference between the outputs produced by two inputs which differ only in a feature. We define the bounds found by VERITAS being "better than" the ones found by SENSPB if the difference in the upper and lower bounds found by VERITAS is greater than $2p$ . Note that this is a very relaxed definition since the bounds found by VERITAS might have a larger spread but might still be lying in the same output class. Since we can stop VERITAS anytime and observe the best solution found till then, we considered two kinds of experiments for fine-grained comparisons between the performance of SENSPB and VERITAS. + +
Benchmark NameTime Taken (in seconds)Accuracy comparison
SENSPBVERITAS1x2x5x3600
Breast cancer robust2.72.581.82%81.82%81.82%81.82%
Breast cancer unrobust2.72.5345.45 %45.45%45.45%45.45%
Diabetes robust3.03.277.78%77.78%77.78%77.78%
Diabetes unrobust5.9198.155.56%66.67%77.78%88.89%
Cod-rna unrobust8.3346.20.00%0%25.00%37.50%
Binary-mnist robust14.9TOTOTOTOTO
Higgs unrobust1188TOTOTOTOTO
IJCNN unrobust330OOMTOTO0%OOM
+ +Table 2: 1) Runtime Comparison by letting VERITAS run on benchmarks with a timeout of 3600s. 2) Accuracy analysis of VERITAS with the timeouts set to different values, depending on the time it took SENSPB. The percentages recorded represent that fraction of features where VERITAS gave better than or equivalent results as compared to SENSPB. For Time Analysis, TO implies that VERITAS timed out without reaching an optimal difference, while in the Accuracy measurements, TO means that VERITAS timed out without producing a single valid solution. + +Firstly, we asked if we fix a timeout of 3600s, how does the performance of VERITAS compare with SENSPB, i.e., how long does it take VERITAS to reach an optimal solution? The results are present in the Time Analysis part of Table 2. For the Binary MNIST robust and the Higgs unrobust benchmark ensembles, VERITAS always times out without producing a single solution. For IJCNN robust, VERITAS runs out of memory after roughly 900s. + +Secondly, we asked if we ran VERITAS for the time relative to the time taken by SENSPB, what would be the relative performance? Let the time taken by SENSPB be $x$ . We run VERITAS for sensitivity analysis, one feature at a time, with the following timeouts: $x$ , $2x$ , $5x$ and 3600. We look at the bound produced by VERITAS at the end of the timeout and compare this bound to the bound found by SENSPB. In the accuracy comparison section of Table 2, we report the percentage of features in which VERITAS performed better than or equivalent to SENSPB. As expected, on increasing the time given to VERITAS, it starts performing better on more and more features, e.g., Diabetes unrobust and Cod-rna unrobust. However, even on running VERITAS for 3600s, there are many features in which SENSPB performs better. As noted earlier, for our three largest benchmarks, VERITAS does not produce a single solution in the time given. + +Our experiments clearly demonstrate that our pseudo-Boolean encoding significantly outperforms both the standard encoding and output configuration-based approaches by an order of magnitude. Given that the problem is NP-hard, SMT-based approaches are likely to surpass output configuration-based methods unless those methods are highly optimized. An SMT solver typically uses CDCL along with Simplex to solve the problem but may not fully exploit the specialized nature of our problem, particularly the limited role of arithmetic during bit summation at the output. As a result, pseudo-Boolean solvers specifically designed for such problems are expected to deliver the best performance. Our encoding allows us to not only use pseudo-Boolean solvers but also provide new sets of benchmarks for the solvers. The availability of the benchmarks would likely improve the performances of the solvers. + +# 6 CONCLUSION + +In this paper, we investigated the sensitivity problem in two variants, the exact and a parametrized version. We presented new hardness proofs as well as an efficient encoding into pseudo-Boolean constraints. Our implementation allowed us to exploit the recent advances in pseudo-Boolean solvers to solve the $p$ -sensitivity problem. We successfully addressed XGBoost models of practical sizes, including scores of features, hundreds of trees, and a depth of 6-8. We believe that our work, especially the pseudo-Boolean encoding, opens a new direction for scalable solutions for sensitivity and general verification problems for tree ensembles. For instance, an immediate extension would be to consider other tree ensemble models, such as random forests. Another natural future direction is also towards the question of multiclass labels, e.g., as done in Devos et al. (2024) for robustness verification. + +# ACKNOWLEDGEMENTS + +We acknowledge the SBI Foundation Hub for Data Science & Analytics, IIT Bombay for supporting the work done in this project. + +# REFERENCES + +Maksym Andriushchenko and Matthias Hein. Provably robust boosted decision stumps and trees against adversarial attacks. In Hanna M. Wallach, Hugo Larochelle, Alina Beygelzimer, Florence d'Alché-Buc, Emily B. Fox, and Roman Garnett (eds.), Advances in Neural Information Processing Systems 32: Annual Conference on Neural Information Processing Systems 2019, NeurIPS 2019, December 8-14, 2019, Vancouver, BC, Canada, pp. 12997-13008, 2019. URL https://proceedings.neurips.cc/paper/2019/ hash/4206e38996fae4028a26d43b24f68d32-Abstract.html. +Endre Boros and Peter L. Hammer. Pseudo-boolean optimization. Discrete Applied Mathematics, 123(1):155-225, 2002. ISSN 0166-218X. doi: https://doi.org/10.1016/S0166-218X(01)00341-9. URL https://www.sciencedirect.com/science/article/pii/S0166218X01003419. +Leo Breiman. Random forests. Mach. Learn., 45(1):5-32, 2001. doi: 10.1023/A:1010933404324. URL https://doi.org/10.1023/A:1010933404324. +S. Calzavara, L. Cazzaro, C. Lucchese, and F. Marcuzzi. Explainable global fairness verification of tree-based classifiers. In 2023 IEEE Conference on Secure and Trustworthy Machine Learning (SaTML), pp. 1-17, Los Alamitos, CA, USA, feb 2023. IEEE Computer Society. doi: 10.1109/SaTML54575.2023.00011. URL https://doi.ieeecomputersociety.org/10.1109/SaTML54575.2023.00011. +Stefano Calzavara, Claudio Lucchese, Gabriele Tolomei, Seyum Assefa Abebe, and Salvatore Orlando. Treant: training evasion-aware decision trees. Data Min. Knowl. Discov., 34(5): 1390-1420, September 2020. ISSN 1384-5810. doi: 10.1007/s10618-020-00694-9. URL https://doi.org/10.1007/s10618-020-00694-9. +Hongge Chen, Huan Zhang, Duane S. Boning, and Cho-Jui Hsieh. Robust decision trees against adversarial examples. In Kamalika Chaudhuri and Ruslan Salakhutdinov (eds.), Proceedings of the 36th International Conference on Machine Learning, ICML 2019, 9-15 June 2019, Long Beach, California, USA, volume 97 of Proceedings of Machine Learning Research, pp. 1122-1131. PMLR, 2019a. URL http://proceedings.mlr.press/v97/chen19m.html. +Hongge Chen, Huan Zhang, Si Si, Yang Li, Duane S. Boning, and Cho-Jui Hsieh. Robustness verification of tree-based models. In Hanna M. Wallach, Hugo Larochelle, Alina Beygelzimer, Florence d'Alché-Buc, Emily B. Fox, and Roman Garnett (eds.), Advances in Neural Information Processing Systems 32: Annual Conference on Neural Information Processing Systems 2019, NeurIPS 2019, December 8-14, 2019, Vancouver, BC, Canada, pp. 12317-12328, 2019b. URL https://proceedings.neurips.cc/paper/2019/ hash/cd9508fdaa5c1390e9cc329001cf1459-Abstract.html. +Tianqi Chen and Carlos Guestrin. Xgboost: A scalable tree boosting system. In Balaji Krishnapuram, Mohak Shah, Alexander J. Smola, Charu C. Aggarwal, Dou Shen, and Rajeev Rastogi (eds.), Proceedings of the 22nd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, San Francisco, CA, USA, August 13-17, 2016, pp. 785-794. ACM, 2016. doi: 10.1145/2939672.2939785. URL https://doi.org/10.1145/2939672.2939785. +Antonio Criminisi and Jamie Shotton. Decision forests for computer vision and medical image analysis. Springer Science & Business Media, 2013. +Leonardo de Moura and Nikolaj Björner. Z3: an efficient smt solver. volume 4963, pp. 337-340, 04 2008. ISBN 978-3-540-78799-0. doi: 10.1007/978-3-540-78800-3_24. + +Laurens Devos, Wannes Meert, and Jesse Davis. Versatile verification of tree ensembles. In Marina Meila and Tong Zhang (eds.), Proceedings of the 38th International Conference on Machine Learning, ICML 2021, 18-24 July 2021, Virtual Event, volume 139 of Proceedings of Machine Learning Research, pp. 2654-2664. PMLR, 2021. URL http://proceedings.mlrpress/v139/devos21a.html. +Laurens Devos, Lorenzo Cascioli, and Jesse Davis. Robustness verification of multi-class tree ensembles. Proceedings of the AAAI Conference on Artificial Intelligence, 38(19):21019-21028, Mar. 2024. doi: 10.1609/aaai.v38i19.30093. URL https://ojs.aaaai.org/index.php/AAAI/article/view/30093. +Cynthia Dwork, Moritz Hardt, Toniann Pitassi, Omer Reingold, and Richard S. Zemel. Fairness through awareness. In Shafi Goldwasser (ed.), Innovations in Theoretical Computer Science 2012, Cambridge, MA, USA, January 8-10, 2012, pp. 214-226. ACM, 2012. doi: 10.1145/2090236.2090255. URL https://doi.org/10.1145/2090236.2090255. +Gil Einziger, Maayan Goldstein, Yaniv Sa'ar, and Itai Segall. Verifying robustness of gradient boosted models. In The Thirty-Third AAAI Conference on Artificial Intelligence, AAAI 2019, The Thirty-First Innovative Applications of Artificial Intelligence Conference, IAAI 2019, The Ninth AAAI Symposium on Educational Advances in Artificial Intelligence, EAAI 2019, Honolulu, Hawaii, USA, January 27 - February 1, 2019, pp. 2446-2453. AAAI Press, 2019. doi: 10.1609/AAAI.V33I01.33012446. URL https://doi.org/10.1609/aaai.v33i01.33012446. +Jan Elffers and Jakob Nordström. Divide and conquer: Towards faster pseudo-boolean solving. In Jérôme Lang (ed.), Proceedings of the Twenty-Seventh International Joint Conference on Artificial Intelligence, IJCAI 2018, July 13-19, 2018, Stockholm, Sweden, pp. 1291-1299. ijcai.org, 2018. doi: 10.24963/IJCAI.2018/180. URL https://doi.org/10.24963/ijcai.2018/180. +Jerome H. Friedman. Greedy function approximation: A gradient boosting machine. The Annals of Statistics, 29(5):1189 - 1232, 2001. doi: 10.1214/aos/1013203451. URL https://doi.org/10.1214/aos/1013203451. +Sainyam Galhotra, Yuriy Brun, and Alexandra Meliou. Fairness testing: Testing software for discrimination. CoRR, abs/1709.03221, 2017. URL http://arxiv.org/abs/1709.03221. +Alexey Ignatiev, Martin C. Cooper, Mohamed Siala, Emmanuel Hebrard, and João Marques-Silva. Towards formal fairness in machine learning. In Helmut Simonis (ed.), Principles and Practice of Constraint Programming - 26th International Conference, CP 2020, Louvain-la-Neuve, Belgium, September 7-11, 2020, Proceedings, volume 12333 of Lecture Notes in Computer Science, pp. 846-867. Springer, 2020a. doi: 10.1007/978-3-030-58475-7\_49. URL https://doi.org/10.1007/978-3-030-58475-7_49. +Alexey Ignatiev, Nina Narodytska, Nicholas Asher, and João Marques-Silva. From contrastive to abductive explanations and back again. In Matteo Baldoni and Stefania Bandini (eds.), AIxA 2020 - Advances in Artificial Intelligence - XIXth International Conference of the Italian Association for Artificial Intelligence, Virtual Event, November 25-27, 2020, Revised Selected Papers, volume 12414 of Lecture Notes in Computer Science, pp. 335-355. Springer, 2020b. doi: 10.1007/978-3-030-77091-4\21. URL https://doi.org/10.1007/978-3-030-77091-4_21. +Alex Kantchelian, J. D. Tygar, and Anthony D. Joseph. Evasion and hardening of tree ensemble classifiers. In Maria-Florina Balcan and Kilian Q. Weinberger (eds.), Proceedings of the 33nd International Conference on Machine Learning, ICML 2016, New York City, NY, USA, June 19-24, 2016, volume 48 of JMLR Workshop and Conference Proceedings, pp. 2387-2396. JMLR.org, 2016. URL http://proceedings.mlr.press/v48/kantchelian16.html. +Klas Leino, Zifan Wang, and Matt Fredrikson. Globally-robust neural networks. In Marina Meila and Tong Zhang (eds.), Proceedings of the 38th International Conference on Machine Learning, ICML 2021, 18-24 July 2021, Virtual Event, volume 139 of Proceedings of Machine Learning Research, pp. 6212-6222. PMLR, 2021. URL http://proceedings.mlr.press/v139/leino21a.html. + +Mehul Madaan, Aniket Kumar, Chirag Keshri, Rachna Jain, and Preeti Nagrath. Loan default prediction using decision trees and random forest: A comparative study. IOP Conference Series: Materials Science and Engineering, 1022:012042, 01 2021. doi: 10.1088/1757-899X/1022/1/012042. +Gioni Mexi, Timo Berthold, Ambros M. Gleixner, and Jakob Nordström. Improving conflict analysis in MIP solvers by pseudo-boolean reasoning. In Roland H. C. Yap (ed.), 29th International Conference on Principles and Practice of Constraint Programming, CP 2023, August 27-31, 2023, Toronto, Canada, volume 280 of LIPIcs, pp. 27:1-27:19. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 2023. doi: 10.4230/LIPICS.CP.2023.27. URL https://doi.org/10.4230/LIPICS.CP.2023.27. +F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer, R. Weiss, V. Dubourg, J. Vanderplas, A. Passos, D. Cournapeau, M. Brucher, M. Perrot, and E. Duchesnay. Scikit-learn: Machine learning in Python. Journal of Machine Learning Research, 12:2825–2830, 2011. +Vili Podgorelec, Peter Kokol, Bruno Stiglic, and Ivan Rozman. Decision trees: an overview and their use in medicine. Journal of medical systems, 26:445-463, 2002. +Gagandeep Singh, Timon Gehr, Markus Puschel, and Martin T. Vechev. An abstract domain for certifying neural networks. Proc. ACM Program. Lang., 3(POPL):41:1-41:30, 2019. doi: 10. 1145/3290354. URL https://doi.org/10.1145/3290354. +John Tornblom and Simin Nadjm-Tehrani. Formal verification of input-output mappings of tree ensembles. Science of Computer Programming, 194:102450, 2020. ISSN 0167-6423. doi: https://doi.org/10.1016/j.scico.2020.102450. URL https://www.sciencedirect.com/science/article/pii/S0167642320300605. +Huan Zhang, Tsui-Wei Weng, Pin-Yu Chen, Cho-Jui Hsieh, and Luca Daniel. Efficient neural network robustness certification with general activation functions. In Samy Bengio, Hanna M. Wallach, Hugo Larochelle, Kristen Grauman, Nicolò Cesa-Bianchi, and Roman Garnett (eds.), Advances in Neural Information Processing Systems 31: Annual Conference on Neural Information Processing Systems 2018, NeurIPS 2018, December 3-8, 2018, Montréal, Canada, pp. 4944-4953, 2018. URL https://proceedings.neurips.cc/paper/2018/bitstream/d04863f100d59b3eb688a11f95b0ae60-Abstract.html. +Huan Zhang, Shiqi Wang, Kaidi Xu, Linyi Li, Bo Li, Suman Jana, Cho-Jui Hsieh, and J. Zico Kolter. General cutting planes for bound-propagation-based neural network verification. In Sanmi Koyejo, S. Mohamed, A. Agarwal, Danielle Belgrave, K. Cho, and A. Oh (eds.), Advances in Neural Information Processing Systems 35: Annual Conference on Neural Information Processing Systems 2022, NeurIPS 2022, New Orleans, LA, USA, November 28 - December 9, 2022, 2022. URL http://papers.nips.cc/paper_files/paper/2022/bit/0b06c8673ebb453e5e468f7743d8f54e-Abstract-Conference.html. + +# A ADDITIONAL THEORETICAL RESULTS + +# A.1 PROOF FOR COROLLARY 2 + +The proof of Theorem 1 can be directly lifted with some minor changes to prove Corollary 2. Instead of checking sensitivity for $F = \{v_{n + 1}\}$ , we check sensitivity for $F = \mathcal{F}$ in the same setting. The first direction holds with the same argument as before. The reverse direction also holds with the same argument with the following changes. + +$x_{\perp F}$ is empty +$x_{F}\in \{0,1\}^{n + 1}$ instead of $\{0,1\}$ + +However, for the sake of completeness, we give the full proof below. + +Proof. As before, we show a reduction from 3CNF-SAT. Given an instance $\varphi$ of 3CNF-SAT, let $cl(\varphi)$ be the set of clauses $\{cl_1, cl_2, \ldots, cl_m\}$ , with $m = |cl(\varphi)|$ and let $var(\varphi)$ denote the set of variables $\{v_1, v_2, \ldots, v_n\}$ , with $n = |\text{var}(\varphi)|$ . Then from $\varphi$ we start by creating the formula $\varphi' = \varphi \wedge (v_{n+1} \vee v_{n+1} \vee v_{n+1})$ which is also a 3CNF formula with a new variable $v_{n+1}$ and a new clause $cl_{m+1} = (v_{n+1} \vee v_{n+1} \vee v_{n+1})$ . Observe that $\varphi$ is satisfiable, i.e., there exists an input $x \in \{0,1\}^n$ that satisfies $\varphi$ iff $\varphi'$ is satisfiable, i.e., there exists an input $x' \in \{0,1\}^{n+1}$ that satisfies $\varphi'$ . We will now show a reduction to the (single feature) sensitivity problem. That is, we will construct a decision tree ensemble $c$ with depth 3, such that $c$ is 1-feature sensitive iff $\varphi'$ is satisfiable. + +In formula $\varphi'$ , for every clause $cl_i$ , we create a depth-3 decision tree $T_i$ as depicted in Figure 2, where $m + 1 = |cl(\varphi')|$ . That is, for each literal (i.e., $v_i$ or $\neg v_i$ ) in the clause, we add a "true" branch with output $\frac{1}{|cl(\varphi')|}$ , and a "false" branch where we either continue to next literal or return $-1$ if there are no more literals left in the clause. For each literal, if it occurs positively as $v_i$ (resp. negatively as $\neg v_i$ ), the true (resp. false) branch outputs $\frac{1}{|cl(\varphi')|}$ . We form the decision tree ensemble $c$ using the above decision trees with trees enumerated $T_i$ for $i \in \{1, 2, \ldots, m + 1 = |cl(\varphi')|\}$ . Note that in this case, the domain of $c$ , i.e., $\mathcal{X} = \{0, 1\}^{n+1}$ . Remember that Lemma 1 says that for all $x \in \{0, 1\}^{n+1}$ we have $c(x) = 1$ iff $\varphi'(x) = 1$ , i.e., $x$ satisfies models $\varphi'$ . + +Now, we use Lemma 1 to prove the hardness of sensitivity. More precisely, we will check sensitivity with respect to the singleton Boolean variable $v_{n+1}$ . Call the set of all features $\mathcal{F}$ and the set for sensitivity checking $F = \mathcal{F}$ . To complete the proof, we will show that $c$ is $F$ -sensitive iff $\varphi'$ is satisfiable. + +In one direction, if $c$ is $F$ -sensitive, by definition, there exist $x, x' \in \{0,1\}^{n+1}$ , such that $c(x) = 1$ and $c(x') = 0$ . Thus, we immediately infer that there exists $x$ such that $c(x) = 1$ , which by Lemma 1 means that $x$ satisfies $\varphi'$ and hence $\varphi'$ is satisfiable. In the other direction, if $c$ is not $F$ -sensitive. Then for all possible choices of $x_{F}, x_{F}'$ , we must have $c(x_{F}) = c(x_{F}')$ . But now, if we consider $x_{v_{n+1}} = 0$ , then the decision tree $T_{m+1}$ will evaluate to $-1$ since $cl_{m+1}[v_{n+1} \mapsto 0] = 0$ . As a result, we can conclude that for any $x_{F \setminus \{v_{n+1}\}} \in \{0,1\}^{n}$ , we have $\sum_{1}^{m+1} T_{i}(x_{F \setminus \{v_{n+1}\}}, 0) \leq -1 + \frac{m}{m+1} < 0$ and so $c(x_{F \setminus \{v_{n+1}\}}, 0) = 0$ . Thus, for any $x_{F} \in \{0,1\}^{n+1}$ , $c(x_{F}) = 0$ , which implies that for all $x \in \{0,1\}^{n+1}$ , $c(x) = 0$ . Again, appealing to Lemma 1, we can conclude that $\varphi'$ is not satisfiable. + +Thus, we have reduced finding satisfiability of $\varphi^{\prime}$ to checking sensitivity for the whole input feature set, and hence, the latter problem is NP-hard. + +![](images/a64abf2a2d8e952baef3693cd3a3eaa6763a09b0f2acab32d107a4975bc01958.jpg) + +An interesting question that arises from the above proof is the requirement of the new clause $cl_{m+1}$ . What we require is an input which does not satisfy $\varphi'$ . If there is no such input, then even when the decision tree ensemble is insensitive to the set $F$ , the 3CNF formula $\varphi'$ can be satisfiable. Thus, to ensure such an input exists, we add the clause $cl_{m+1}$ . + +# A.2 HARDNESS OF THE DIFFERENTIATING INPUT PROBLEM + +From the same construction of trees in Theorem 1, we can show that a novel yet interesting problem, which we call the differentiating input problem, is also NP-hard. + +Definition A.1. Given two tree ensemble classifiers $c: \mathcal{X} \longrightarrow \mathcal{Y}$ and $c': \mathcal{X} \longrightarrow \mathcal{Y}$ , we say $x \in \mathcal{X}$ is a differentiating input for them if $c(x) \neq c'(x)$ . Given two tree ensemble classifiers $c, c': \mathcal{X} \longrightarrow \mathcal{Y}$ , the differentiating input problem asks if there exists a differentiating input, i.e., $\exists x \in \mathcal{X}, c(x) \neq c'(x)$ . + +Corollary 4. The differentiating input problem for decision tree ensembles is NP-Hard. + +Proof. We will show a reduction from 3CNF-SAT to this problem. Given an arbitrary 3CNF-SAT problem, we can create a decision tree classifier that solves this problem. Given an instance $\varphi$ of 3CNF-SAT, let $cl(\varphi)$ be the set of clauses $\{cl_1, cl_2, \ldots, cl_m\}$ , with $m = |cl(\varphi)|$ . Then, for each clause $cl_i = l_1 \lor l_2 \lor l_3$ in the 3CNF-SAT problem, create a decision tree, $T_i$ such that $T_i(x) = \frac{1}{m}$ if $x$ satisfies the clause and $T_i(x) = -1$ otherwise. Two examples for the same are shown in Figure 2(a) and 2(b). The ensemble $c = \{T_1, T_2, \dots, T_m\}$ outputs a positive class (+1) if and only if the 3CNF-SAT formula was satisfiable as shown in the proof of Theorem 1. + +Finally, we create another tree ensemble $c'$ , which always returns a negative class(-1). Thus, asking whether there is a differentiating input for these tree ensembles is equivalent to asking whether the 3CNF-SAT formula was satisfiable, thus completing the hardness proof. + +# B MORE INFORMATION ON THE EXPERIMENTS + +The following table gives the fraction of all the features to which the benchmark trees are singularly sensitive. + +
Benchmark NameNumber of Features Ran OnPercentage of Sensitive Features
Breast cancer robust1118.2
Breast cancer unrobust1136.4
Diabetes robust944.4
Diabetes unrobust980
Cod-rna unrobust8100
Binary mnist robust100
Higgs unrobust10100
IJCNN robust23100
+ +Table 3: Percentage of Sensitive Features + +# C ADDITIONAL EXPERIMENTS + +We run experiments to understand the effects of changing $p$ and $\alpha$ (separately) on the running time of our algorithm. For these, we work only on the IJCNN robust benchmark, which has 60 trees, with a maximum depth of 80 and 23 features and is a good representative of the kind of ensembles we aim to verify. While changing $p$ , we keep the value of $\alpha$ fixed to the value we used in the main experiments (i.e. $10 \times |\# \text{Trees}|$ ). Likewise, while varying $\alpha$ , we keep $p$ fixed to 0.15. These results are present in Tables 4 and 5. We also give a table detailing the fraction of features where SENSPB performs better than VERITAS, see Table 6. + +
pTime (s)
0.115.8
0.1516
0.217.0
0.41100.0
0.45923.4
+ +Table 4: Effect of changing gap + +
αTime (s)
10016.26
20015.79
50015.79
70016.17
100015.67
150022.39
200019.01
500019.63
10000016.58
100000016.71
+ +Table 5: Effect of changing precision + +
Benchmark NameVERITAS better%SENSPB better
Breast cancer robust81.82%18.18%
Breast cancer unrobust45.45 %54.55%
Diabetes robust77.78%22.2%
Diabetes unrobust55.56%44.44%
Cod-rna unrobust0.00%100%
Binary-mnist robustTO100%
Higgs unrobustTO100%
IJCNN unrobustTO100%
+ +Table 6: Comparison between the features where VERITAS finds a better bound than SENSPB. We first run SENSPB and then run VERITAS for the same amount of time. We look at the best results produced by VERITAS in this time limit and use that value for the comparison. \ No newline at end of file diff --git a/ICLR/2025/Sensitivity Verification for Additive Decision Tree Ensembles/images.zip b/ICLR/2025/Sensitivity Verification for Additive Decision Tree Ensembles/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..f58574aaecb4c6174a1cc52151d786fdcc87fe4f --- /dev/null +++ b/ICLR/2025/Sensitivity Verification for Additive Decision Tree Ensembles/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d7f4cf358cedcd27342903354d240b2e35e8ec092f514c0d4d4c8dfd2d0bd2f1 +size 338960 diff --git a/ICLR/2025/Sensitivity Verification for Additive Decision Tree Ensembles/layout.json b/ICLR/2025/Sensitivity Verification for Additive Decision Tree Ensembles/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..925f236f80aca9ea953ab6632efc69855d73bedd --- /dev/null +++ b/ICLR/2025/Sensitivity Verification for Additive Decision Tree Ensembles/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:68a324ee7f263b134a56e6fe8ed9a11b69d47abc85b8391edeab88185e3f7a2c +size 721405 diff --git a/ICLR/2025/Sensitivity-Constrained Fourier Neural Operators for Forward and Inverse Problems in Parametric Differential Equations/7a2cb213-f5be-4b58-82d8-7d2062e59145_content_list.json b/ICLR/2025/Sensitivity-Constrained Fourier Neural Operators for Forward and Inverse Problems in Parametric Differential Equations/7a2cb213-f5be-4b58-82d8-7d2062e59145_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..73a6ca49023d79a452cbe5f40cf3b2436e9d8224 --- /dev/null +++ b/ICLR/2025/Sensitivity-Constrained Fourier Neural Operators for Forward and Inverse Problems in Parametric Differential Equations/7a2cb213-f5be-4b58-82d8-7d2062e59145_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2308a8b8eb8b56d0e4bd83bbd8c87f9d75f29ac3ab09fedcaff49ad704d7f0d2 +size 136573 diff --git a/ICLR/2025/Sensitivity-Constrained Fourier Neural Operators for Forward and Inverse Problems in Parametric Differential Equations/7a2cb213-f5be-4b58-82d8-7d2062e59145_model.json b/ICLR/2025/Sensitivity-Constrained Fourier Neural Operators for Forward and Inverse Problems in Parametric Differential Equations/7a2cb213-f5be-4b58-82d8-7d2062e59145_model.json new file mode 100644 index 0000000000000000000000000000000000000000..f239205f65185286ae37447dd1e3ed5b6a0cadde --- /dev/null +++ b/ICLR/2025/Sensitivity-Constrained Fourier Neural Operators for Forward and Inverse Problems in Parametric Differential Equations/7a2cb213-f5be-4b58-82d8-7d2062e59145_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ff4ca62ace89fbd49398cc5afa56c3b3a564ae5ac3d4ae4c3f6018e899e56bd8 +size 158440 diff --git a/ICLR/2025/Sensitivity-Constrained Fourier Neural Operators for Forward and Inverse Problems in Parametric Differential Equations/7a2cb213-f5be-4b58-82d8-7d2062e59145_origin.pdf b/ICLR/2025/Sensitivity-Constrained Fourier Neural Operators for Forward and Inverse Problems in Parametric Differential Equations/7a2cb213-f5be-4b58-82d8-7d2062e59145_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..7ad561174c6198548ae911942fe6f5f1f069e05a --- /dev/null +++ b/ICLR/2025/Sensitivity-Constrained Fourier Neural Operators for Forward and Inverse Problems in Parametric Differential Equations/7a2cb213-f5be-4b58-82d8-7d2062e59145_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:205f584edbe6b671e83dbaf9c1051227cbf054b468be93f4ec0b6ebb475d2bdd +size 3227375 diff --git a/ICLR/2025/Sensitivity-Constrained Fourier Neural Operators for Forward and Inverse Problems in Parametric Differential Equations/full.md b/ICLR/2025/Sensitivity-Constrained Fourier Neural Operators for Forward and Inverse Problems in Parametric Differential Equations/full.md new file mode 100644 index 0000000000000000000000000000000000000000..6fa62b440e54f3c261d75f1a08c79c35242b48da --- /dev/null +++ b/ICLR/2025/Sensitivity-Constrained Fourier Neural Operators for Forward and Inverse Problems in Parametric Differential Equations/full.md @@ -0,0 +1,533 @@ +# SENSITIVITY-CONSTRAINED FOURIER NEURAL OPERATORS FOR FORWARD AND INVERSE PROBLEMS IN PARAMETRIC DIFFERENTIAL EQUATIONS + +Abdolmehdi Behroozi & Chaopeng Shen * + +Department of Civil and Environmental Engineering +Penn State University + +University Park, PA 16802-1408, USA + +{amb10399, cxs1024}@psu.edu + +Daniel Kifer + +School of Electrical Engineering and Computer Science Penn State University + +University Park, PA 16802-1408, USA + +duk17@psu.edu + +# ABSTRACT + +Parametric differential equations of the form $\frac{\partial u}{\partial t} = f(u, x, t, p)$ are fundamental in science and engineering. While deep learning frameworks like the Fourier Neural Operator (FNO) efficiently approximate differential equation solutions, they struggle with inverse problems, sensitivity calculations $\frac{\partial u}{\partial p}$ , and concept drift. We address these challenges by introducing a novel sensitivity loss regularizer, demonstrated through Sensitivity-Constrained Fourier Neural Operators (SC-FNO). Our approach maintains high accuracy for solution paths and outperforms both standard FNO and FNO with Physics-Informed Neural Network regularization. SC-FNO exhibits superior performance in parameter inversion tasks, accommodates more complex parameter spaces (tested with up to 82 parameters), reduces training data requirements, and decreases training time while maintaining accuracy. These improvements apply across various differential equations and neural operators, enhancing their reliability without significant computational overhead ( $30\% - 130\%$ extra training time per epoch). Models and selected experiment code are available at: https://github.com/AMBehroozi/SC_Neural_Operators. + +# 1 INTRODUCTION + +Ordinary and Partial Differential Equations (ODEs and PDEs), which contain physically meaningful parameters $\mathbf{p}$ , form the foundation of most modern engineering systems across diverse fields such as fluid mechanics, medicine design, molecular dynamics, relativistic physics, climate, and environmental sciences (Palais & Palais, 2009). These physical parameters $\mathbf{p}$ , whether describing fixed or evolving system properties (Feng et al., 2022), physiological constants (Reichert & Omlin, 1997), environmental characteristics (Tartakovsky et al., 2020), or serving as simplifications for subgrid-scale processes (Yuval & O'Gorman, 2020; Watt-Meyer et al., 2024), significantly influence the behavior of the equations. Neural Operators are neural networks whose inputs are initial conditions and physical parameters, and whose output is a function $\mathbf{u}$ , also known as a solution path, that approximates the solution to the ODE/PDE. When the values of $\mathbf{p}$ are known, neural operators can be used for simulations (predicting system state $\mathbf{u}(t)$ at time $t$ ). However, in many cases, there is uncertainty about the values of $\mathbf{p}$ , so they must be estimated from observations of $\mathbf{u}$ . This is known as (parameter) inversion. The estimated $\mathbf{p}$ can then be used to simulate $\mathbf{u}$ beyond existing observations, or they may themselves be quantities of interest to scientists. Other potential uses of neural operators include sensitivity analysis (i.e., estimating $\partial \mathbf{u} / \partial \mathbf{p}$ ) and applying them in situations not covered by training data. Even state-of-the-art neural operators struggle with these applications and this paper presents a method to address this problem. + +Fourier Neural Operators (FNOs). Introduced in 2021, FNOs (Li et al., 2021; 2024) leverage the linear nature of differential operators in Fourier space, delivering orders of magnitude of computational efficiencies compared to traditional numerical solvers. They are currently the most popular type of neural operator. FNOs are known for their meshless—or discretization-invariant—characteristics, + +and some versions eliminate the need for time-stepping, allowing them to output solutions at any spatiotemporal resolution. FNOs achieve these improvements over prior surrogate models (Audet et al., 2000; Alizadeh et al., 2020) by utilizing representations in the frequency domain to efficiently learn time trajectories of the evolution of initial conditions. Learning the trajectories in time domain would necessitate large amounts of weights and extensive training data. + +While this method offers significant efficiency, prediction accuracy may decline for predictions far into the future (Grady et al., 2023), prompting the use of additional constraints in some models (Jiang et al., 2023; Bonev et al., 2023). FNO is so far mostly used in forward simulations and research; the critical issues of parameter inversion have received much less attention by neural operator research and estimating the parameter sensitivity $\partial \mathbf{u} / \partial \mathbf{p}$ has not been studied for neural operators (to the best of our knowledge). Li et al. (2021) evaluate the use of FNO to run the differential equation backward in time to recover initial conditions; although they name it Bayesian inversion, they did not recover physical parameters. In follow-up work, (Li et al., 2023) also observed the problems of using FNO for parameter inversion and proposed to add physics-informed neural network (PINN) regularization to training. While it improves over vanilla FNO, we show that our approach can outperform FNO+PINN by up to $30\%$ . Furthermore, FNO+PINN still produces inaccurate sensitivity estimates. An alternative to neural operators is learning direct inverse mapping (Vadeboncoeur et al., 2023; Li et al., 2023), but then one still needs separate techniques for estimating solution paths and sensitivities. In contrast, SC-FNO addresses all of these issues in one (convenient) framework. + +Sensitivity awareness allows a model to adapt its predictions to different scenarios and respond to input and parameter changes, thus reducing overfitting and improving robustness. In practical applications, the ability to predict these Jacobians of the outputs with respect to physical parameters $\mathbf{p}$ can also have significant value. In engineering design and control systems, knowing the sensitivity of performance outputs relative to design parameters helps in optimizing design and improving performance. Similarly, in financial modeling or resource management, sensitivity information allows for better risk assessment and resource allocation decisions. Gradient-based optimization or data assimilation (Barker et al., 2004), of course, is critically guided by gradients. In scenario analysis, parameters or inputs are perturbed, often beyond the observed ranges, to assess the responses. Without correctly capturing the sensitivity, the responses could be erroneous (Saltelli et al., 2019). + +Gradient Computation for PDE Solvers: Gradient, or sensitivity computations, are widely used in the analysis of partial differential equations (PDEs). Traditionally, methods like finite differences can approximate gradients using existing numerical solvers and they remain relevant. Now we also have the option of using automatic differentiation (AD) offered by differentiable-programming platforms such as PyTorch, TensorFlow, Julia, or JAX, which enable efficient computation of gradients of outputs with respect to inputs. While the main purpose of implementing solvers on these platforms is often to train process-based equations together ("end-to-end") with NNs so that missing relationships can be learned along with partial knowledge (Innes et al., 2019; Shen et al., 2023; Zhu et al., 2023; Schoenholz & Cubuk, 2020; Tsai et al., 2021), these solvers can indeed provide rapid calculation of gradients as a byproduct. Gradients can be also computed by adjoint methods, either "discretize-then-optimize"(Onken & Ruthotto, 2020; Song et al., 2024a) or "optimize-then-discretize" (Chen et al., 2018). Differentiable PDE solvers are rapidly increasing across numerous domains, demonstrating highly competitive performance, especially in data-scarce (Feng et al., 2023) or unseen extreme (Song et al., 2024b) scenarios. Our work is compatible with either finite differences or AD. In this context, our work introduces a novel methodology that seamlessly integrates sensitivity analysis directly into the Fourier Neural Operator framework, significantly enhancing the operator's capability to tackle both forward and inverse problems. Notable studies such as Gradient enhanced neural networks Liu & Batill (2000) and Sobolev training Czarnecki et al. (2017) have explored the utilization of derivative information to improve neural network training, but they focused on low-dimensional approximation of derivatives. Our proposed Sensitivity-Constrained Fourier Neural Operator (SC-FNO) overcomes the problems with the estimation of parametric sensitivity, allowing better inversion while maintaining FNO-level computational efficiency for solving differential equations. The SC-FNO can provide highly accurate parameter sensitivities with less training data, ensuring that solution accuracy is maintained even under input perturbations and even concept drift (physical parameters in testing exceed ranges encountered during training). Although we focus attention on FNOs here, our experiments show the approach generalizes to many other neural operators (see Appendix D.1). + +# 2 METHODOLOGY + +Training data for Neural Operators are obtained by running physics-based model simulations multiple times with different initial conditions and physical parameters. We note that for differentiable physics-based models, the sensitivities $\partial \mathbf{u} / \partial \mathbf{p}$ can also be computed. For non-differentiable models, they can be approximated with finite differences. The training of SC-FNO uses a loss function $L_{u}$ over the solution paths (as with FNO) and also adds a loss $L_{s}$ over the parameter sensitivities. One can optionally add a PINN equation loss $L_{Eq}$ (resulting in SC-FNO-PINN). This framework can be used with other neural operators as well (see Appendix D.1). + +# 2.1 SC-FNO: ENHANCING FNO WITH SENSITIVITY + +Original Fourier Neural Operators (Li et al., 2021): FNOs represent a class of learning architectures designed to model mappings between infinite-dimensional function spaces, thereby providing efficient solutions to complex parametric PDEs. Mathematically, FNOs operate within a defined domain $\mathbf{D} \subset \mathbf{R}^d$ . The function spaces, denoted as $\mathbf{A}(\mathbf{D}; \mathbf{R}^{d_a})$ for inputs and $\mathbf{U}(\mathbf{D}; \mathbf{R}^{d_u})$ for outputs, encapsulate the functional domains of the inputs and outputs respectively. The goal of an FNO is to approximate the operator $\mathbf{G}: \mathbf{A} \times \Theta \rightarrow \mathbf{U}$ , which ideally maps each input function $\mathbf{a}_j$ in $\mathbf{A}$ to an output function $\mathbf{u}_j$ in $\mathbf{U}$ . Formally, the FNO framework is expressed as: + +$$ +\widetilde {\mathbf {G}}: \mathbf {A} \times \boldsymbol {\Theta} \rightarrow \mathbf {U}, \tag {1} +$$ + +where $\Theta$ represents the space of parameters that the FNO optimizes to reduce the discrepancy between predicted and true outputs. The Fourier transformation, essential in the operation of FNOs, is applied to transform function data into the frequency domain, facilitating the application of linear operators: + +$$ +(\mathbf {F} \mathbf {f}) _ {j} (\mathbf {k}) = \int_ {\mathbf {D}} \mathbf {f} _ {j} (\mathbf {x}) e ^ {- 2 \pi i \langle \mathbf {x}, \mathbf {k} \rangle} d \mathbf {x} \quad \text {a n d} \quad (\mathbf {F} ^ {- 1} \mathbf {f}) _ {j} (\mathbf {x}) = \int_ {\mathbf {D}} \mathbf {f} _ {j} (\mathbf {k}) e ^ {2 \pi i \langle \mathbf {x}, \mathbf {k} \rangle} d \mathbf {k}. \tag {2} +$$ + +This representation utilizes the convolution theorem to model complex nonlinear behaviors efficiently: + +$$ +\mathbf {K} (\phi) \mathbf {v} _ {t} (\mathbf {x}) = \mathbf {F} ^ {- 1} \left(\mathbf {R} _ {\phi} \cdot \left(\mathbf {F} \mathbf {v} _ {t}\right)\right) (\mathbf {x}), \tag {3} +$$ + +where $\mathbf{R}_{\phi}$ represents a learnable parameterized function within the Fourier domain, allowing FNOs to encode and decode information effectively. While FNOs offer significant computational advantages, they necessitate extensive training data (Kovachki et al., 2021; Li et al., 2021). Moreover, generalizing beyond the training datasets remains a challenge. + +Our Contribution: We introduce sensitivity-based loss terms to Neural Operators, resulting in a novel framework we call Sensitivity-Constrained Neural Operators (SC-NO) (Figure A.7 in Appendix A). For clarity, we demonstrate this concept primarily through its application to Fourier Neural Operators (FNO), yielding SC-FNO. However, we also show that the framework is generalizable to various types of neural operators, such as Wavelet Neural Operators (Tripura & Chakraborty, 2023), Multiwavelet Neural Operators (Gupta et al., 2021), and DeepONets (Wang et al., 2021) (descriptions and results are in Appendix D.1). The current neural operator training never harnessed sensitivity information (such as Jacobians) and never explicitly guaranteed how the inputs should be used in the model. However, our approach leverages either finite difference or a differentiable solver to compute these sensitivities. This development improves the robustness of prediction of both $\mathbf{u}$ and $\partial \mathbf{u} / \partial \mathbf{p}$ by ensuring that input variables are utilized correctly by the FNO — we dictate the sensitivity of the predicted outcomes with respect to input parameters and initial conditions, while in the future boundary conditions can also be incorporated. The model is expressed concisely as: + +$$ +\mathbf {u} (\mathbf {x}, t) = \mathcal {F} _ {\mathrm {S C - F N O}} \left(\mathbf {u} _ {0}, \mathbf {x}, t, \mathbf {p}\right), \tag {4} +$$ + +where $\mathcal{F}_{\mathrm{SC - FNO}}$ denotes the SC-FNO mapping, $\mathbf{u}_0$ are the initial conditions, $\mathbf{x}$ represents spatial coordinates, $t$ is time. The output $\mathbf{u}$ is governed by the differential equation: + +$$ +\frac {\partial \mathbf {u}}{\partial t} = f (\mathbf {u}, \mathbf {x}, t, \mathbf {p}), \tag {5} +$$ + +with $f$ defining the dynamics of the system. In this formulation, $\mathbf{p}$ encapsulates parameters that critically modulate, influence, or characterize the system, including physical constants, material + +properties, or scale-dependent parameterizations. SC-FNO incorporates a sensitivity loss to enforce the accuracy of the predicted sensitivities (Jacobian) against those computed from the differentiable numerical solver. The SC-FNO model computes the solution $\mathbf{u}$ across all time and space in a single execution. The mathematical definition of sensitivity loss $L_{s}$ is as follows: + +$$ +L _ {\mathrm {s}} = \frac {1}{M} \sum_ {j = 1} ^ {M} \left\| \frac {\partial \hat {\mathbf {u}} \left(\mathbf {x} _ {j} , t _ {j} ; \mathbf {p}\right)}{\partial \mathbf {p}} - \frac {\partial \mathbf {u} \left(\mathbf {x} _ {j} , t _ {j} ; \mathbf {p}\right)}{\partial \mathbf {p}} \right\| ^ {2}. \tag {6} +$$ + +where $\mathbf{x}_j$ and $t_j$ represent the spatial and temporal coordinates of the sampled points at which the Jacobians are evaluated. $\partial \hat{\mathbf{u}} / \partial \mathbf{p}$ is the Jacobian of the predicted outputs with respect to the input parameters, obtained through AD applied to the SC-FNO. $\partial \mathbf{u} / \partial \mathbf{p}$ is the true Jacobian derived from precise differentiable numerical solvers or known analytical solutions. $M$ denotes the number of evaluation points across the domain, including points used to impose boundary and initial conditions. + +# 2.2 THE PINN-LOSS EQUATION AS AN OPTIONAL REGULARIZER + +Physics-Informed Neural Networks (PINNs) regularize the gradients of the neural networks using the governing differential equations at collocation points and boundary conditions Raissi et al. (2019); Karniadakis et al. (2021); He et al. (2022). The core PDE constraint in PINNs is represented as: + +$$ +\mathcal {N} [ \mathbf {u} (\mathbf {x}, t); \mathbf {p} ] = 0 +$$ + +The PINN loss function, $L_{\mathrm{Eq}}$ , incorporates the discrepancy from the PDE with terms for initial and boundary conditions ( $L_{\mathrm{IC}}$ and $L_{\mathrm{BC}}$ ): + +$$ +L _ {\mathrm {E q}} = L _ {\mathrm {P D E}} + \alpha \left(L _ {\mathrm {I C}} + L _ {\mathrm {B C}}\right) = \frac {1}{N} \sum_ {i = 1} ^ {N} | \mathcal {N} [ \mathbf {u} (\mathbf {x} _ {i}, t _ {i}); \mathbf {p} ] | ^ {2} + \alpha \left(L _ {\mathrm {I C}} + L _ {\mathrm {B C}}\right), +$$ + +where $\alpha$ is a weighting factor, and $N$ denotes the number of collocation points in the computational domain. PINNs trained for specific conditions often cannot predict general evolutionary trajectories or guarantee accurate parameter sensitivity Jin et al. (2021); Ren et al. (2022). Additionally, PINNs can be computationally slower than traditional numerical solvers. In this work, we evaluate the ability of PINN-type loss to improve prediction accuracy along with sensitivities. In a broadened sense, SC-FNO can be considered a novel type of PINN as it also regularizes the gradient of the neural networks, but their procedures are fundamentally different. PINNs do not have access to this sensitivity, as usual PDEs do not contain $\partial \mathbf{u} / \partial \mathbf{p}$ . SC-FNO prepares gradient data to supervise $\partial \mathbf{u} / \partial \mathbf{p}$ but do not require optimization during forward simulation, whereas PINNs rely on collocation points for equation-based loss optimization to supervise $(\partial \mathbf{u} / \partial \mathbf{x}, \partial \mathbf{u} / \partial \mathbf{t})$ , but not $\partial \mathbf{u} / \partial \mathbf{p}$ . SC-FNO is designed to serve as an efficient forward simulator that can handle various changes in high dimensional input, which can also help with inversion tasks. + +# 2.3 GRADIENT COMPUTATION METHODS FOR DIFFERENTIAL EQUATIONS + +To prepare training and validation datasets containing true solution paths along with their sensitivity (gradients with respect to parameters), we developed and implemented two distinct approaches: + +1. A differentiable numerical solver based on the torchdiffreq package. We extended this ODE-oriented framework to handle PDEs by reformulating them in the form $\frac{du}{dt} = \mathrm{RHS}(\mathbf{x})$ , where $\mathrm{RHS}(\mathbf{x})$ encapsulates terms related to spatial derivatives. This solver leverages PyTorch's AD capability, although adjoint methods can also be used. The computation time for preparing datasets with and without Jacobian computation is presented in Table D.12. +2. Finite difference methods for gradient computation with a traditional solver. The method approximates gradients by solving the PDE multiple times with slightly perturbed parameter values and computing the differences between the solutions. This process offers a nonintrusive means of gradient estimation for any existing numerical solvers. + +We implemented efficient functions to compute the sensitivities. These solution paths and sensitivities are computed once and archived for later use, though they could also be generated on the fly if desired. This represents a one-time cost per equation, and since input impacts are resolved upfront, no repeated preparation is needed for different parameters. We assessed the effectiveness of both gradient computation methods and compared their accuracies. + +# 2.4 IMPLEMENTATION DETAILS + +The SC-FNO architecture processes parameters $(\mathbf{p})$ alongside spatial coordinates and initial conditions through the lifting layer as function inputs. This layer reshapes and repeats parameters to match the problem's spatial-temporal dimensions, then concatenates them with other inputs before neural network processing. Notably, both FNO and SC-FNO share identical neural network architectures and inputs, differing only in their loss configurations. After computing true gradients $(\partial \mathbf{u} / \partial \mathbf{p})$ once during dataset preparation (Section 2.3), our training procedure contains several efficiency-focused steps. Instead of computing gradients at all points, we randomly select a subset of spatial-temporal points in each epoch ( $n < N$ spatial points $\times t < T$ time points) where $n < N$ and $t < T$ . The neural operator's predicted gradients at these points are computed using AD and compared with the pre-computed true gradients. This sampling varies between epochs to eventually cover the full solution space. This procedure eliminates the need for additional solver runs during training while maintaining effective sensitivity supervision. Each minibatch requires only one forward pass before applying AD, adding minimal computational overhead. The pre-computed gradients are stored and reused throughout training, making the approach efficient as parameter dimensionality increases. + +# 3 EXPERIMENTS + +We evaluated four different configurations of the FNO models, each defined by a unique combination of loss functions. The first configuration uses only the data loss $L_{\mathrm{u}}$ (FNO), which matches predicted state variables with the solution paths; The second, $L_{\mathrm{u}} + L_{\mathrm{Eq}}$ (FNO-PINN), incorporates the equation loss; The third, $L_{\mathrm{u}} + L_{\mathrm{Eq}} + L_{s}$ (SC-FNO-PINN), combining both sensitivity and equation losses; and finally, $L_{\mathrm{u}} + L_{s}$ (SC-FNO), which adds only sensitivity loss to data loss. Pseudocodes for these models can be found in the Appendix A. We evaluated the competing methods on the following well-known differential equations. + +ODE1: Composite Harmonic Oscillator and ODE2: Duffing Oscillator Equation each operate within a temporal domain of $t \in [0, 1]$ , where was discretized into $N = 100$ equal time steps. Our goal was to learn the operator that maps the first $M$ time steps of solutions $u$ , alongside parameters $\mathbf{p}$ , to the solutions at the next $N - M$ subsequent time steps, formulated as $u : [0 : M] \cup \mathbf{p} \to u : [M : N]$ . + +PDE1: Generalized Nonlinear Damped Wave Equation is explored within both a temporal domain $t \in [0, 1]$ and a spatial domain $x \in [0, 1]$ . The temporal domain was discretized into $N = 30$ equal time steps and the spatial domain was discretized into $S_x = 20$ . We aim to learn the operator that maps from the first $M$ initial time steps of $u$ , alongside parameters $\mathbf{p}$ , to the next $N - M$ subsequent time steps, expressed as $u : [0, S_x]^1 \times [0, M] \cup \mathbf{p} \to u : [0, S_x]^1 \times [M, N]$ . + +PDE2: Forced Burgers' Equation is analyzed across a time interval $t \in [0, \pi]$ and a spatial domain $x \in [0, 1]$ . The temporal domain is segmented into $N = 30$ equal parts, and the spatial domain into $S_x = 40$ parts. The aim is to identify the operator that maps the first $M$ time steps of $u$ , in conjunction with parameters $\mathbf{p}$ , to the remaining $N - M$ time steps, formulated as $u : [0, S_x]^1 \times [0, M] \cup \mathbf{p} \to u : [0, S_x]^1 \times [M, N]$ . + +PDE3: Stream Function-Vorticity Formulation of the Navier-Stokes Equations spans the temporal domain $t \in [0, 3]$ and spatial domains $x, y \in [0, 1]$ . The spatial domain and the temporal domain are [0, 1] and [0, 3], respectively. The 2D spatial domain was discretized into $S_x = S_y = 64$ equal spatial divisions. Here, our goal is to learn an operator that takes initial conditions of $u$ along with parameters $\mathbf{p}$ , and directly maps them to the solution of vorticity at the final time step $t = 3s$ , formulated as $u: [0, S_x] \times [0, S_y] \times [t = 0(s)] \cup \mathbf{p} \to u: [0, S_x] \times [0, S_y] \times [t = 3(s)]$ . + +PDE4: Allen-Cahn equation is analyzed within temporal domain $t \in [0,1.0]$ and spatial domain $x \in [0,1]$ , discretized into $N = 30$ and $S_{x} = 40$ parts respectively. We aim to learn the operator that maps from first $M$ time steps of $u$ and parameters $\mathbf{p}$ to the next $N - M$ time steps, formulated as $u:[0,S_x]^1 \times [0,M] \cup \mathbf{p} \to u:[0,S_x]^1 \times [M,N]$ . + +Detailed specifications of the differential equations and the ranges of their parameters are provided in Table B.6 in Appendix B. The architectural details, hyperparameters and training time information are comprehensively presented in Tables C.7 and C.8 in Appendix C. + +In the following, we first demonstrate the superior performance of SC-FNO in inversion (or optimization) tasks compared to FNO alone. Then we explain such outperformance using several experiments: we show how trained FNOs alone captured the gradients poorly and thus fared worse than SC-FNOs when inputs are perturbed, which often occurs during inversion. Then, we show + +that SC-FNO requires fewer training samples to reach higher quality, particularly when the input dimension is higher. Finally, we show that finite difference can also be functional. Experiments were run with various neural operators and PDEs to ensure the generality of the conclusions. + +# 3.1 PARAMETER INVERSION FROM SOLUTION PATHS + +Parameter inversion with PDEs plays a pivotal role in system identification, calibration, and optimization, and serves as a primary area benefiting from the efficiency of surrogate models. Our inversion experiments utilized FNO and SC-FNO surrogate models, which were trained and rigorously evaluated on synthetic datasets as described in Section 3.2 for PDE1-PDE3. These datasets, containing $2 \times 10^{3}$ training samples, were generated using the differentiable numerical solver. They feature randomly generated initial conditions and parameter values, alongside their corresponding solutions at multiple time points (Table B.6 in Appendix B) and Jacobians. We used $70\%$ of the data for training, $15\%$ for validation, and $15\%$ for testing, and ensured that the validation and test sets contained parameter values not encountered during training. The first experiment inverted the models to infer the $\alpha$ parameter alone while treating others as known. We then used backpropagation to optimize the parameter by minimizing the discrepancy between the synthetic data and PDE solutions. The second task simultaneously inverted all parameters of either PDE1 or PDE2. SC-FNO demonstrates notably superior performance over FNO and FNO-PINN in simple inversion tasks, achieving nearly perfect inversion while the latter two showed significantly more scattering (Figure 1). In the single-parameter inversion, SC-FNO ( $R^2 = 0.998$ ) achieves less than 1/5 and 1/4 the relative $\mathbf{L}^2$ inversion errors of FNO ( $R^2 = 0.905$ ) and FNO-PINN, respectively (Figure 1a). Multi-parameter inversion incurs larger uncertainty and greater contrasts — SC-FNO has 1/6 and 1/2.8 the relative $\mathbf{L}^2$ inversion errors of FNO and FNO-PINN, respectively (Figures 1b and 2). Retrieving $\alpha$ in the multi-parameter case results in large heteroscedastic scattering with FNO ( $R^2 = 0.635$ ), whereas SC-FNO remains highly accurate (Figure 1b). For PDE2 with four parameters, SC-FNO's $R^2$ values are above 0.96, while those of FNO hover around 0.85. For PDE1 with five parameters, SC-FNO maintains $R^2$ above 0.94 for all parameters, while those of FNO drop below 0.64, suggesting overfitting and a breakdown of the surrogate model. Similar contrasts are found with PDE3 (Navier Stokes) (Figure D.10 in Appendix D). This performance gap may widen further with increased parameter dimensions. FNO-PINN's relative $\mathbf{L}^2$ is half of that of FNO (Figures 1 and 2) but still 3x-5x that of SC-FNO. Additional scatter plots for parameter inversion are available in Figures D.8 and D.9 in Appendix D. The introduction of the sensitivity loss lead to consistent enhancements across other neural operators like WNO, MWNO, and DeepONet, with uniform conclusions reflected in Table D.11 in Appendix D. These enhancements are larger than the differences between different neural operators. By training on both solution data and their gradients, SC-FNO builds a more robust internal representation of the PDE dynamics, particularly regarding the roles of inputs. The next sections explore in more depth the advantages of gradient-aware surrogate models. + +![](images/c09893f3dfeefb93f850cf7af2a58ba1c05f7315da65d9dd5ab543a6b616b867.jpg) +Figure 1: Inversion of the parameter $\alpha$ in PDE1 using FNO and SC-FNO models (a) single parameter inversion, (b) simultaneous multi-parameter inversion. + +![](images/6a482bde3af42534952b522b8f750c2b7fb044810d01560ffb70f219984cb981.jpg) + +![](images/6155c42720e3f3c63c7d578ba5dc9c1ec5b146c852322d10744bed779dcd26d6.jpg) +Figure 2: Simultaneous multi-parameter inversion accuracy for PDEs 1 and 2 using FNO and SC-FNO. + +# 3.2 SURROGATE MODEL QUALITY AND ROBUSTNESS TO INPUT PERTURBATION + +Surrogate quality assessments indicate that the superior inversion performance of SC-FNO, even with so few parameters, can be attributed to the model's unique ability to accurately capture parameter sensitivities and its robustness to input perturbations. As discussed earlier, the surrogate models were trained on identical input and output datasets uniformly prepared for each differential equation, but only SC-FNO or SC-FNO-PINN used parameter sensitivities. We first evaluated the models on test datasets with parameters ranging from [a, b], the same as the training data, as detailed in Table B.6 in Appendix B. Subsequently, to assess the models' generalizability, we perturbed the parameters beyond their original ranges by applying various perturbation percentages, $\lambda$ , resulting in a parameter range of ([b, $(1 + \lambda)\mathbf{b}]$ ). By systematically increasing $\lambda$ , we evaluated the models' performance at various levels of extrapolation beyond the training dataset. + +Table 1: Error metrics for PDE1 (5 parameters) and PDE2 (4 parameters) with $2 \times 10^{3}$ training samples. Both have low dimensional parameters. (a) PDE1 + +
ValueMetricOriginal range of parametersPerturbed range (λ : 0.4)
FNOSC-FNOSC-FNO-PINNFNO-PINNFNOSC-FNOSC-FNO-PINNFNO-PINN
u(t)R20.9860.9830.9890.9780.5290.9120.9280.620
Relative L20.01460.01750.01120.02200.47160.08820.07210.3805
∂u/∂cR20.7230.9240.9430.8010.5150.9010.9150.605
Relative L20.27720.07610.05770.19920.48550.09930.08510.3953
∂u/∂αR20.7410.9250.9450.8050.5220.9080.9240.615
Relative L20.25900.07500.05520.19550.47800.09240.07670.3852
∂u/∂βR20.7630.9300.9560.8170.5300.9140.9300.622
Relative L20.23700.07000.04410.18340.47080.08620.07320.3781
∂u/∂γR20.7720.9310.9550.8150.5390.9200.9360.630
Relative L20.22830.06960.04510.18580.46100.08010.06440.3706
∂u/∂ωR20.7810.9320.9630.8250.5450.9240.9370.632
Relative L20.21900.06820.03750.17520.45570.07610.06330.3687
+ +(b) PDE2 + +
ValueMetricOriginal range of parametersPerturbed range (λ : 0.4)
FNOSC-FNOSC-FNO-PINNFNO-PINNFNOSC-FNOSC-FNO-PINNFNO-PINN
u(t)R20.9970.9970.9950.9950.7340.9330.9230.802
Relative L20.00290.00160.00650.00730.03250.01120.01240.0287
∂u/∂αR20.2060.9870.9070.1370.1520.9040.8300.113
Relative L20.20920.01350.08130.85451.12360.07550.09870.9865
∂u/∂γR20.4230.9860.9910.5190.3110.9030.9040.429
Relative L20.85420.05400.05230.75660.98750.07670.07550.8244
∂u/∂δR20.8210.9120.9570.8710.6040.8350.8760.719
Relative L20.12450.07560.05670.10230.25440.10230.08880.1567
∂u/∂ωR20.3210.9820.9120.4270.2360.9120.8340.353
Relative L20.88560.05670.07890.78991.02440.07220.09440.8878
+ +For PDEs, when the test data originate from the same parameter ranges as the training data (Table B.6 in Appendix B), the solution paths are of high quality, but FNO learns sensitivities significantly poorer than those of SC-FNO (Table 1 left half). While the metrics for $u$ are similarly high among all models, the $R^2$ values for FNO gradients range only from 0.72 to 0.78 (relative $L^2$ : 0.28 to 0.22) for PDE1 and from 0.21 to 0.82 (relative $L^2$ : 0.21 to 0.12) for PDE2. In contrast, SC-FNO and SC-FNOPINN consistently achieve $R^2$ values of 0.92-0.93 (relative $L^2$ : 0.08-0.07) for PDE1 and 0.91-0.99 (relative $L^2$ : 0.09-0.1) for PDE2. The inclusion of a PINN-type equation loss ( $L_{Eq}$ ) in FNO-PINN provides only minor benefits for $\frac{\partial\mathbf{u}}{\partial\mathbf{p}}$ , with $R^2$ values remaining below 0.52 (relative $L^2$ : >0.48) for most gradients in PDE2. These improvements are not comparable to those achieved by SC-FNO and SC-FNOPINN, highlighting the predominant impact of $L_s$ terms. ODEs show a similar pattern where SC-FNO has much better sensitivity accuracy for both parameters (Appendix Table D.14) and initial conditions ( $\gamma$ in Table D.14a and $\zeta$ in Table D.14b). In some sample test predictions (Figure 3a-d), surprisingly large and unphysical oscillations are observed in FNO-predicted sensitivities. These simple cases were designed to show that a surrogate model accurately predicting $u$ may fail to capture the dependence of solution paths on the inputs, leading to large inversion errors. + +This pattern is reliably repeated for more challenging PDEs with a small number of parameters, e.g., for PDE3 (Navier Stokes, 2 parameters), where models lacking the sensitivity loss well predicts + +Table 2: Error metrics for PDE3 with $1 \times 10^{3}$ training Samples. Both have + +
Methodω∂ω/∂α∂ω/∂β
Relative L2R2Relative L2R2Relative L2R2
FNO0.03120.9970.72300.0360.96420.036
SC-FNO0.03450.9940.01120.9860.01320.987
+ +vorticity but falter in capturing the sensitivities (Table 2), missing both fine-scale features and large-scale patterns (Figure 6). In contrast, SC-FNO accurately recreates patterns and even fine-scale details. In the case of PDE4 (Allen-Cahn), a challenging test case due to its bifurcation nature where small parameter changes can cause abrupt phase transitions in solutions, SC-FNO exhibits mildly better $u$ solution accuracy than FNO (Table 3). More noticeably, SC-FNO generates 1/25 the Jacobian error as FNO, even with reduced samples near critical parameter values where solution behavior changes sharply. Given the diverse dynamics in the equations tested, the general incapability of FNO to capture sensitivity is evident. Note that SC-FNO does not entail excessive additional training cost (Table C.8). We also tested a broad range of other neural operators, all of which exhibited markedly improved sensitivities upon introducing the sensitivity loss (Appendix Table D.9). The difficulty FNO has in capturing parameter gradients leads to prominently degraded performance under input perturbations, though SC-FNO remains robust and reliable. The $R^2$ for the solution $\mathbf{u}$ at $40\%$ perturbation decreases precipitously to 0.529 (relative $L^2$ : 0.471) for PDE1 and 0.734 (relative $L^2$ : 0.266) for PDE2, compared to 0.912 (relative $L^2$ : 0.088, 1/5 that of FNO's) and 0.933 (relative $L^2$ : 0.067, 1/4 that of FNO's) for SC-FNO, respectively (Table 1). As the perturbation ratio increases for PDE1, a stark decline in $R^2$ is observed for FNO, in contrast to the relatively stable SC-FNO (Figure 5). We argue that the large perturbation-induced error is a primary reason for FNO's poor performance in inversion tasks, during which the search algorithm ventures into under-sampled regions of the parameter space, consistent with the arguments in Li et al. (2023). At an accuracy level of $R^2 = 0.529$ (relative $L^2$ : 0.471) (as illustrated in Figure 1b by the scatter plot), the surrogate model loses its ability to guide the inversion. Even without straying beyond the training parameter range, a mere change in the pattern of inter-parameter correlations could cause a departure from the training conditions (concept drift). While increasing training data can help, it becomes exponentially more difficult to adequately cover the parameter space for FNO as the input dimension increases. This challenge is highlighted by the contrasts observed between Figures 1a and 1b, as well as between Figures 2a and 2b. Additionally, SC-FNO-PINN only shows a slight benefit in $L^2$ over SC-FNO in all of these tests (Table 1). The minimal impact of the equation loss is both surprising and previously unexamined. This ineffectiveness likely stems from the absence of terms related to (time-integrated) $\partial \mathbf{u} / \partial \mathbf{p}$ in the differential equations, which leaves this sensitivity unconstrained even though $\mathbf{p}$ is in the equation. For coupled optimization tasks, it is imperative that surrogate models not only reflect the physical phenomena accurately but also adapt to new, unobserved conditions. SC-FNO thus provides an effective alternative solution. + +![](images/13c2d404f2c1f8021f84f31447b749a7d1bd25a918accfcf2429fd710e3b539c.jpg) + +![](images/fb16f821e47e5f03e9a409f99b2d4c2df940ebaf07d7cab2853df88d47deef44.jpg) + +![](images/952c6da83c86ba773292003b20c57bb483a733aa28c13d556b6faa7ed7a99ea5.jpg) + +![](images/4ec7214f9a57ee486d03cca4f27aa186eb71822dd70c95340bf95c44094f4557.jpg) + +Figure 3: Sample prediction of models for ODEs and PDE1 and PDE2. +![](images/ad3ea42f27bfab820455ec45f4908a4bceaa1ea2a16c7b4e50527bf1628dfda9.jpg) +True Value FNO FNO-PINN SC-FNO-PINN SC-FNO + +![](images/a3553e86c39dc92d34a89947d06652f97bf4e47aaff440703d4170e7bccbe2a3.jpg) + +![](images/89bf1313b6b297a3db2bfc3da757377a08a9b44b809cbd38b66314d2bc181ffa.jpg) + +![](images/f3a907193bcc0f8ed16c5ddc33542edfcb24a387192a5507559a6e906bd0bb1c.jpg) + +# 3.3 MODEL PERFORMANCE ACROSS VARYING TRAINING DATA VOLUMES + +We explored how different models respond to varying amounts of training data. Specifically, we aimed to investigate how the integration of different loss terms affects both the accuracy and the + +![](images/a0d6226f04c8fb5ca5372ee2b5abeb9cc62ab6ed9e79755231c34e1193acc849.jpg) +Figure 4: Models' performance on PDE1 across training sample sizes, (a) $\frac{\partial u}{\partial\omega}$ (b) $u(t)$ . + +![](images/5f13e8855de85bd2f0952beaf42aa193f170a168f6eedfe8493def19f55f8bc3.jpg) +Figure 5: Performance of models for PDE1 for perturbed datasets, (a) Standardized $\frac{\partial\hat{\mathbf{u}}}{\partial\mathbf{p}}$ and (b) $u(t)$ . + +![](images/94607774d4b953d71e2e56494973629bd24d7bfa47fd1d8d716d4dd16f5ff146.jpg) + +![](images/0514ba421dd1a4caf427abc71835caeb0e40d28b4f2aed759280caec5df2426f.jpg) + +![](images/8cd57224f4ac707163dea8ce067015cdadc014ea96e4d311c56314ad946896f8.jpg) +Figure 6: Sample prediction of models for PDE 3 + +generalization capabilities of the models under limited training data scenarios. The remaining portion of the dataset, not used for training, served to test and measure the models' performance. + +Table 3: Performance comparison for PDE4 + +
MetricsN=500N=100
FNOSC-FNOFNOSC-FNO
State Value Metrics
R20.9990.9990.9970.998
Relative L20.01100.00810.02050.0151
Mean Jacobian Metrics
R2-3.110.998-5.83730.993
Relative L20.52120.02070.58300.0486
+ +Table 4: Performance comparison for zoned PDE2 + +
MetricsN=500N=100
FNOSC-FNOFNOSC-FNO
State Value Metrics
R20.9600.9970.9270.996
Relative L20.02820.00730.03870.0087
Mean Jacobian Metrics
R2-8.3320.949-14.0120.927
Relative L21.96270.17702.46230.2134
+ +The experiment demonstrates that FNO performance can rapidly degrade as the volume of training data decreases, whereas SC-FNO can maintain higher accuracy and continue to function effectively as a surrogate model (Figure 4). While all models exhibit a decrease in $R^2$ scores for both state values $u(t)$ and gradients $\frac{\partial\hat{u}}{\partial\mathbf{p}}$ as training sizes diminish, SC-FNO and SC-FNO-PINN show a notably slower rate of decline. With only 500 training samples, FNO's $R^2$ dropped to 0.8, displaying an acceleration in degradation, while SC-FNO maintained an $R^2$ around 0.9, comparable to FNO's performance with 1,000 training samples. This advantage is attributed to the use of higher-order (gradient) information, which, similar to traditional numerical methods such as spline interpolation or second-order finite differences, typically results in a better rate of error convergence. This sensitivity to the volume of training data contributed to FNO's poor performance in inversion tasks (Section 3.1), indicating that dense training data is necessary throughout the parameter search space to ensure accuracy. In practical applications where comprehensive datasets are unattainable, the ability to maintain high model performance with fewer examples is invaluable. + +# 3.4 HANDLING FUNCTIONAL AND HIGH-DIMENSIONAL PARAMETER SPACE + +All previous examples have small numbers of scalar parameters. To evaluate the models' effectiveness with higher parameter dimensions, we modified PDE2 (Burger's equation) with zoned parameters. We divided the spatial domain into $S = 40$ segments with different advection $\alpha$ and forcing amplitude $\delta$ in each zone, along with global parameters $\gamma$ and $\omega$ , resulting in $2S + 2 = 82$ total parameters. Maintaining the settings from Section 3.2, models were trained with different sample sizes. SC-FNO's advantages become immediately prominent from this higher dimensional case, even for the solution path $\mathbf{u}$ itself. At 500 samples, SC-FNO has only 1/4 the relative $L^2$ error (0.0073) as FNO (0.0282, Table 4) while requiring moderately more training time (Appendix Table C.8). With $N = 100$ samples, SC-FNO maintains the low error (relative $L^2 = 0.0087$ ) while FNO degrades significantly (relative $L^2 = 0.039$ ). In fact, SC-FNO with 100 samples has less than 1/3 of the relative $L^2$ error of FNO with 500 samples, and also requires less time to train. SC-FNO's level of accuracy seems + +elusive for FNO, which sees $\mathrm{L}^2$ error decreasing by only $28\%$ as $N$ increases from 100 to 500, and thus we argue SC-FNO lifts the performance ceiling. The contrast is more dramatic for Jacobian predictions (SC-FNO: relative $\mathrm{L}^2 = 0.213$ ; FNO: relative $\mathrm{L}^2 = 2.46$ ), which, as discussed earlier, has strong implications for the success of inversion and generalizability. These results highlight SC-FNO's capability to handle high-dimensional parameter spaces efficiently, maintaining accuracy even with limited training data. We can reasonably hypothesize that drastically increasing the number of parameters will further highlight SC-FNO's unique capability, which we reserve for future work. + +# 3.5 DIFFERENT GRADIENT CALCULATION METHODS + +We tested gradients derived from both a differentiable solver with automatic differentiation (AD) and a fourth-order finite difference solver (FD) using a traditional solver against the analytical solution for gradients of ODE1. The results of this verification are presented in Table D.13 in Appendix D.3. Following this validation, we used these methods to generate solution paths and sensitivities for training and testing surrogate models. We trained SC-FNOs using $70\%$ of the produced data, dividing the remainder into $15\%$ each for validation and testing. The validation and testing datasets included parameter values not featured in the training data, testing the models' generalization capabilities. SC-FNOs trained with either AD- or FD-generated gradients proved effective, producing accurate predictions for both solutions and their gradients, as shown in Table 5. These models both achieved $\mathrm{R}^2 > 0.95$ (relative $\mathrm{L}^2 < 0.05$ ) for solution paths and $\mathrm{R}^2 > 0.9$ (relative $\mathrm{L}^2 < 0.1$ ) for sensitivities. While AD provides higher accuracy and efficiency (Table D.13), FD remains effective and applicable to any existing model code. This makes SC-FNO versatile while maintaining computational efficiency comparable to traditional methods. + +Table 5: Performance comparison of SC-FNO and SC-FNO-PINN using AD and FD solvers. + +
ValueMetricODE1PDE1
SC-FNO (AD)SC-FNO (FD)SC-FNO- PINN(AD)SC-FNO- PINN(FD)SC-FNO (AD)SC-FNO (FD)SC-FNO- PINN(AD)SC-FNO- PINN(FD)
uR20.9910.9680.9940.9830.9830.9630.9890.978
Relative L20.0090.0320.0060.0170.0170.0370.0110.022
Avg. ∂u/∂PR20.9960.9870.9950.9830.9280.9130.9520.932
Relative L20.0040.0130.0050.0170.0720.0870.0480.068
+ +# 3.6 FURTHER DISCUSSION AND CONCLUSION + +This work has demonstrated the powerful regularizing effect of sensitivities. The effectiveness of SC-FNO stems from the explicit governance of input influence through time-integrated parameter sensitivities $(\partial u / \partial p)$ . Unlike PINNs, which supervise spatial-temporal derivatives $(\partial u / \partial x, \partial u / \partial t)$ through equation-based loss optimization, SC-FNO directly constrains parameter sensitivities typically absent in PDE formulations, using forward numerical models with differentiable solvers to prepare sensitivity data. This fundamental difference enhances model interpretability and reliability, making SC-FNO more suitable for coupled inversion or optimization tasks. Especially when input parameters have a higher dimension, SC-FNO can reduce training data demand, maintain robustness and generalizability, elevate the performance ceiling of neural operators, and even reduce training time. Our innovations include employing differentiable numerical solvers—and alternatively, finite differences—for computing (almost) exact gradients. Although differentiable programming is gaining traction in various domains (Shen et al., 2023; Song et al., 2024a; Aboelyazeed et al., 2023), few studies have leveraged computed gradients beyond backpropagation. We have used these gradients to supervise FNOs, calculating second-order gradients during training. The additional computational cost remains affordable—training the FNO on PDE1 used 722 MB while training SC-FNO required 764 MB. We argue that sensitivity regularization and time-step-free methods like FNO complement each other exceptionally well. SC-FNO's programmatic differentiability allows its seamless integration with neural networks (NNs), speeding up hybrid NN-based learning and optimization. Accurate gradients are crucial for the effective training of coupled NNs, thus opening up new avenues in the field of AI-enhanced solutions to differential equations. + +# ACKNOWLEDGEMENTS + +This work was primarily supported by subaward A23-0249-S001 from the Cooperative Institute for Research to Operations in Hydrology (CIROH) through the National Oceanic and Atmospheric Administration (NOAA) Cooperative Agreement (grant no. NA22NWS4320003). The statements, findings, conclusions, and recommendations are those of the authors and do not necessarily reflect the view of NOAA. It was also partially supported by the U.S. Department of Energy, Office of Science, under award no. DE-SC0021979. Chaopeng Shen has financial interests in HydroSapient, Inc., a company that could potentially benefit from the results of this research. This interest has been reviewed by The Pennsylvania State University in accordance with its conflict of interest policy to ensure the objectivity and integrity of the research. The other authors have no competing interests to declare. + +# REFERENCES + +Doaa Aboelyazed, Chonggang Xu, Forrest Hoffman, Jiangtao Liu, Alex Jones, Chris Rackauckas, Kathryn Lawson, and Chaopeng Shen. A differentiable, physics-informed ecosystem modeling and learning framework for large-scale inverse problems: demonstration with photosynthesis simulations. Biogeosciences, 20(13):2671-2692, 2023. doi: 10.5194/bg-20-2671-2023. URL https://bg.copernicus.org/articles/20/2671/2023/. +Reza Alizadeh, Janet K Allen, and Farrokh Mistree. Managing computational complexity using surrogate models: a critical review. Research in Engineering Design, 31(3):275-298, 2020. +Charles Audet, J Denni, Douglas Moore, Andrew Booker, and Paul Frank. A surrogate-model-based method for constrained optimization. In 8th symposium on multidisciplinary analysis and optimization, pp. 4891, 2000. +D. M. Barker, W. Huang, Y-R. Guo, A. J. Bourgeois, and Q. N. Xiao. A three-dimensional variational data assimilation system for mm5: Implementation and initial results. Monthly Weather Review, 132(4):897 - 914, 2004. doi: 10.1175/1520-0493(2004)132<0897:ATVDAS> 2.0.CO;2. URL https://journals.ametsoc.org/view/journals/mwre/132/4/1520-0493_2004_132_0897_atvdas_2.0.co_2.xml. +Boris Bonev, Thorsten Kurth, Christian Hundt, Jaideep Pathak, Maximilian Baust, Karthik Kashinath, and Anima Anandkumar. Spherical Fourier neural operators: Learning stable dynamics on the sphere. In Proceedings of the 40th International Conference on Machine Learning, volume 202 of ICML'23, pp. 2806-2823, Honolulu, Hawaii, USA, July 2023. JMLR.org. doi: 10.5555/3618408.3618525. +Ricky T. Q. Chen, Yulia Rubanova, Jesse Bettencourt, and David Duvenaud. Neural ordinary differential equations. In Proceedings of the 32nd International Conference on Neural Information Processing Systems, NIPS'18, pp. 6572-6583, Montreal, Canada, December 2018. Curran Associates Inc. +Wojciech M Czarnecki, Simon Osindero, Max Jaderberg, Grzegorz Swirszcz, and Razvan Pascanu. Sobolev training for neural networks. Advances in neural information processing systems, 30, 2017. +Dapeng Feng, Jiangtao Liu, Kathryn Lawson, and Chaopeng Shen. Differentiable, learnable, regionalized process-based models with multiphysical outputs can approach state-of-the-art hydrologic prediction accuracy. Water Resources Research, 58(10):e2022WR032404, 2022. ISSN 1944-7973. doi: 10.1029/2022WR032404. +Dapeng Feng, Hylke Beck, Kathryn Lawson, and Chaopeng Shen. The suitability of differentiable, physics-informed machine learning hydrologic models for ungauged regions and climate change impact assessment. Hydrology and Earth System Sciences, 27(12):2357-2373, June 2023. ISSN 1027-5606. doi: 10.5194/hess-27-2357-2023. +Thomas J Grady, Ravi Khan, Mathias Louboutin, Ziyi Yin, Philipp A Witte, Ravi Chandra, et al. Model-parallel fourier neural operators as learned surrogates for large-scale parametric pdes. Computational Geosciences, 178:105402, 2023. doi: 10.1016/j.cageo.2023.105402. + +Gaurav Gupta, Xiongye Xiao, and Paul Bogdan. Multiwavelet-based Operator Learning for Differential Equations. In Advances in Neural Information Processing Systems, November 2021. +QiZhi He, Panos Stinis, and Alexandre M. Tartakovsky. Physics-constrained deep neural network method for estimating parameters in a redox flow battery. Journal of Power Sources, 528:231147, April 2022. ISSN 0378-7753. doi: 10.1016/j.jpowsour.2022.231147. +Mike Innes, Alan Edelman, Keno Fischer, Chris Rackauckas, Elliot Saba, Viral B. Shah, and Will Tebbutt. A Differentiable Programming System to Bridge Machine Learning and Scientific Computing, July 2019. +Peishi Jiang, Zhao Yang, Jiali Wang, Chenfu Huang, Pengfei Xue, T. C. Chakraborty, Xingyuan Chen, and Yun Qian. Efficient Super-Resolution of Near-Surface Climate Modeling Using the Fourier Neural Operator. Journal of Advances in Modeling Earth Systems, 15(7):e2023MS003800, 2023. ISSN 1942-2466. doi: 10.1029/2023MS003800. +Xiaowei Jin, Shengze Cai, Hui Li, and George Em Karniadakis. NSFnets (Navier-Stokes flow nets): Physics-informed neural networks for the incompressible Navier-Stokes equations. Journal of Computational Physics, 426:109951, February 2021. ISSN 0021-9991. doi: 10.1016/j.jcp.2020.109951. +George Em Karniadakis, Ioannis G. Kevrekidis, Lu Lu, Paris Perdikaris, Sifan Wang, and Liu Yang. Physics-informed machine learning. Nature Reviews Physics, 3(6):422-440, June 2021. ISSN 2522-5820. doi: 10.1038/s42254-021-00314-5. +Nikola B Kovachki, Zongyi Li, Burigede Liu, Kamyar Azizzadenesheli, Kaushik Bhattacharya, Andrew Stuart, et al. Neural operator: Learning maps between function spaces. ArXiv Preprint ArXiv:210808481, 2021. +Zongyi Li, Nikola Kovachki, Kamyar Azizzadenesheli, Burigede Liu, Kaushik Bhattacharya, Andrew Stuart, and Anima Anandkumar. Fourier Neural Operator for Parametric Partial Differential Equations, May 2021. +Zongyi Li, Hongkai Zheng, Nikola Kovachki, David Jin, Haoxuan Chen, Burigede Liu, Kamyar Azizzadenesheli, and Anima Anandkumar. Physics-informed neural operator for learning partial differential equations, 2023. +Zongyi Li, Hongkai Zheng, Nikola Kovachki, David Jin, Haoxuan Chen, Burigede Liu, Kamyar Azizzadenesheli, and Anima Anandkumar. Physics-Informed Neural Operator for Learning Partial Differential Equations. ACM / IMS Journal of Data Science, February 2024. doi: 10.1145/3648506. +Lukas Liebel and Marco Körner. Auxiliary tasks in multi-task learning. arXiv preprint arXiv:1805.06334, 2018. +Weiyu Liu and S Batill. Gradient-enhanced neural network response surface approximations. In 8th Symposium on Multidisciplinary Analysis and Optimization, pp. 4923, 2000. +Derek Onken and Lars Ruthotto. Discretize-Optimize vs. Optimize-Discretize for Time-Series Regression and Continuous Normalizing Flows, July 2020. +Richard S Palais and Robert Andrew Palais. Differential equations, mechanics, and computation, volume 51. American Mathematical Soc., 2009. +M. Raissi, P. Perdikaris, and G. E. Karniadakis. Physics-informed neural networks: A deep learning framework for solving forward and inverse problems involving nonlinear partial differential equations. Journal of Computational Physics, 378:686-707, 2019. ISSN 0021-9991. doi: 10/gfzbvx. +Peter Reichert and Martin Omlin. On the usefulness of overparameterized ecological models. Ecological Modelling, 95(2):289-299, February 1997. ISSN 0304-3800. doi: 10.1016/S0304-3800(96)00043-9. + +Pu Ren, Chengping Rao, Yang Liu, Jian-Xun Wang, and Hao Sun. PhyCRNet: Physics-informed convolutional-recurrent network for solving spatiotemporal PDEs. Computer Methods in Applied Mechanics and Engineering, 389:114399, February 2022. ISSN 0045-7825. doi: 10.1016/j.cma.2021.114399. +Andrea Saltelli, Ksenia Aleksankina, William Becker, Pamela Fennell, Federico Ferretti, Niels Holst, Sushan Li, and Qiongli Wu. Why so many published sensitivity analyses are false: A systematic review of sensitivity analysis practices. *Environmental modelling & software*, 114:29-39, 2019. +Samuel Schoenholz and Ekin Dogus Cubuk. JAX MD: A Framework for Differentiable Physics. In Advances in Neural Information Processing Systems, volume 33, pp. 11428-11441. Curran Associates, Inc., 2020. +Chaopeng Shen, Alison P. Appling, Pierre Gentine, Toshiyuki Bandai, Hoshin Gupta, Alexandre Tartakovsky, Marco Baity-Jesi, Fabrizio Fenicia, Daniel Kifer, Li Li, Xiaofeng Liu, Wei Ren, Yi Zheng, Ciaran J. Harman, Martyn Clark, Matthew Farthing, Dapeng Feng, Praveen Kumar, Doaa Aboelyazed, Farshid Rahmani, Yalan Song, Hylke E. Beck, Tadd Bindas, Dipankar Dwivedi, Kuai Fang, Marvin Höge, Chris Rackauckas, Binayak Mohanty, Tirthankar Roy, Chonggang Xu, and Kathryn Lawson. Differentiable modelling to unify machine learning and physical models for geosciences. Nature Reviews Earth & Environment, 4(8):552-567, August 2023. ISSN 2662-138X. doi: 10.1038/s43017-023-00450-9. +Yalan Song, Wouter Knoben, Martyn Clark, Dapeng Feng, Kathryn Lawson, Kamlesh Sawadekar, and Chaopeng Shen. When ancient numerical demons meet physics-informed machine learning: adjoint-based gradients for implicit differentiable modeling. Hydrology and Earth System Sciences, 28(13):3051-3077, 2024a. doi: 10.5194/hess-28-3051-2024. URL https://hess.copernicus.org/articles/28/3051/2024/. +Yalan Song, Kamlesh Sawadekar, Jonathan M Frame, Ming Pan, Martyn Clark, Wouter JM Knoben, Andrew W Wood, Trupesh Patel, and Chaopeng Shen. Improving physics-informed, differentiable hydrologic models for capturing unseen extreme events. ESS Open Archive, 2024b. doi: 10.22541/essoar.172304428.82707157/v1. URL https://doi.org/10.22541/essoar.172304428.82707157/v1. +A. M. Tartakovsky, C. Ortiz Marrero, Paris Perdikaris, G. D. Tartakovsky, and D. Barajas-Solano. Physics-informed deep neural networks for learning parameters and constitutive relationships in subsurface flow problems. Water Resources Research, 56(5):e2019WR026731, 2020. ISSN 1944-7973. doi: 10.1029/2019wr026731. +Tapas Tripura and Souvik Chakraborty. Wavelet Neural Operator for solving parametric partial differential equations in computational mechanics problems. Computer Methods in Applied Mechanics and Engineering, 404:115783, February 2023. ISSN 0045-7825. doi: 10.1016/j.cma.2022.115783. +Wen-Ping Tsai, Dapeng Feng, Ming Pan, Hylke Beck, Kathryn Lawson, Yuan Yang, Jiangtao Liu, and Chaopeng Shen. From calibration to parameter learning: Harnessing the scaling effects of big data in geoscientific modeling. Nature Communications, 12(1):5988, October 2021. ISSN 2041-1723. doi: 10.1038/s41467-021-26107-z. +Arnaud Vadeboncoeur, Ömer Deniz Akyildiz, Ieva Kazlauskaite, Mark Girolami, and Fehmi Cirak. Fully probabilistic deep models for forward and inverse problems in parametric pdes. Journal of Computational Physics, 491:112369, 2023. ISSN 0021-9991. doi: https://doi.org/10.1016/j.jcp.2023.112369. URL https://www.sciencedirect.com/science/article/pii/S0021999123004643. +Sifan Wang, Hanwen Wang, and Paris Perdikaris. Learning the solution operator of parametric partial differential equations with physics-informed deeponets. Science advances, 7(40):eabi8605, 2021. +Oliver Watt-Meyer, Noah D. Brenowitz, Spencer K. Clark, Brian Henn, Anna Kwa, Jeremy McGibbon, W. Andre Perkins, Lucas Harris, and Christopher S. Bretherton. Neural Network Parameterization of Subgrid-Scale Physics From a Realistic Geography Global Storm-Resolving Simulation. Journal of Advances in Modeling Earth Systems, 16(2):e2023MS003668, 2024. ISSN 1942-2466. doi: 10.1029/2023MS003668. + +Janni Yuval and Paul A. O'Gorman. Stable machine-learning parameterization of subgrid processes for climate modeling at a range of resolutions. Nature Communications, 11(1):3295, July 2020. ISSN 2041-1723. doi: 10.1038/s41467-020-17142-3. +Shang Zhu, Bharath Ramsundar, Emil Annevelink, Hongyi Lin, Adarsh Dave, Pin-Wen Guan, Kevin Gering, and Venkatasubramanian Viswanathan. Differentiable Modeling and Optimization of Battery Electrolyte Mixtures Using Geometric Deep Learning, November 2023. + +# APPENDIX + +# A SC-FNO ARCHITECTURE AND SENSITIVITY INTEGRATION + +Figure A.7 illustrates the schematic of the SC-FNO model architecture. In this framework, this variation of the Fourier Neural Operator (FNO) integrates various inputs: parameters $(\mathbf{P})$ that influence the differential equation, spatial and temporal coordinates $(X : [x, y, t])$ , and the function $a(x)$ , which may represent different initial conditions. This setup enables comprehensive learning and adaptation across different scenarios by leveraging both automatic differentiation for optimization and multiple loss components tailored to the specific dynamics and constraints of the system. Furthermore, in our framework, the FNO can be regularized by both a PINN-style differential equation $(L_{Eq})$ as well as the sensitivities (gradients of the solution path of a differential equation with respect to parameters contributing to the diff equation). These regularization terms ensure that the model adheres to the underlying physical laws that reflect how the solution path is determined by a parameter and how it changes when a parameter changes. + +![](images/1b33464f641d37f63b6fc186a2b7c79cffb9f53c97a5621574b88302a9e12351.jpg) +Figure A.7: Schematic of SC-FNO architecture. + +Pseudocode for different FNO models, each with various loss configuration settings, are presented as follows. This section aims to highlight how different loss functions can be integrated and optimized within these models to enhance their predictive accuracy and performance. + +Algorithm 1 FNO Training Loop with $L_{u}$ Loss Over Epochs +```latex +1: Initialize FNO model +2: for epoch = 1 to max_epochs do +3: Shuffle training data +4: for each batch P, $\mathbf{u}_{\mathrm{true}}$ in training data do +5: Predict state values using FNO: $\hat{\mathbf{u}} \gets \mathrm{FNO}(\mathbf{P})$ +6: Calculate loss: $L_{u} = \mathrm{loss}(\hat{\mathbf{u}}, \mathbf{u}_{\mathrm{true}})$ +7: Backpropagate loss and update FNO model +8: end for +9: Evaluate on validation set +10: Record training and validation loss +11: end for +``` + +Algorithm 2 SC-FNO Training Loop with $L_{u}$ and $L_{s}$ Loss Over Epochs +1: Initialize FNO model +2: for epoch = 1 to max_epochs do +3: Shuffle training data +4: for each batch $\mathbf{P}$ , $\mathbf{u}_{\mathrm{true}}$ , $\frac{\partial\mathbf{u}_{\mathrm{true}}}{\partial\mathbf{P}}$ in training data do +5: Predict state values using FNO: $\hat{\mathbf{u}} \gets \mathrm{FNO}(\mathbf{P})$ +6: Calculate primary loss: $L_{u} = \mathrm{loss}(\hat{\mathbf{u}}, \mathbf{u}_{\mathrm{true}})$ +7: Predict Jacobian of state values using Auto Diff (AD): $\hat{\mathbf{J}} \gets \frac{\partial\hat{\mathbf{u}}}{\partial\mathbf{P}}$ +8: Calculate sensitivity loss: $L_{s} = \mathrm{loss}(\hat{\mathbf{J}}, \frac{\partial\mathbf{u}_{\mathrm{true}}}{\partial\mathbf{P}})$ +9: Calculate total loss: $L_{\mathrm{total}} = c_{1} \cdot L_{u} + c_{2} \cdot L_{s}$ +10: Backpropagate total loss and update FNO model +11: end for +12: Evaluate on validation set +13: Record training and validation loss +14: end for + $\triangleright c_{1}$ and $c_{2}$ are learnable coefficients + +Algorithm 3 SC-FNO-PINN Training Loop with $L_{u}$ , $L_{s}$ , and $L_{eq}$ Loss Over Epochs +1: Initialize FNO model +2: for epoch = 1 to max_epochs do +3: Shuffle training data +4: for each batch $\mathbf{P}$ , $\mathbf{u}_{\mathrm{true}}$ , $\frac{\partial\mathbf{u}_{\mathrm{true}}}{\partial\mathbf{P}}$ in training data do +5: Predict state values using FNO: $\hat{\mathbf{u}} \gets \mathrm{FNO}(\mathbf{P})$ +6: Calculate primary loss: $L_{u} = \text{loss}(\hat{\mathbf{u}}, \mathbf{u}_{\mathrm{true}})$ +7: Predict Jacobian of state values using Auto Diff (AD): $\hat{\mathbf{J}} \gets \frac{\partial\hat{\mathbf{u}}}{\partial\mathbf{P}}$ +8: Calculate sensitivity loss: $L_{s} = \text{loss}(\hat{\mathbf{J}}, \frac{\partial\mathbf{u}_{\mathrm{true}}}{\partial\mathbf{P}})$ +9: Calculate equation loss: $L_{eq} = \text{residual}(\hat{\mathbf{u}})$ +10: Calculate total loss: $L_{\mathrm{total}} = c_{1} \cdot L_{u} + c_{2} \cdot L_{s} + c_{3} \cdot L_{eq}$ +11: Backpropagate total loss and update FNO model +12: end for +13: Evaluate on validation set +14: Record training and validation loss +15: end for + $\triangleright c_{1}, c_{2}$ , and $c_{3}$ are learnable coefficients Liebel & Körner (2018) + +# B DIFFERENTIAL EQUATION DETAILS + +In this section, the differential equations investigated in the work are detailed. This includes their mathematical formulations, initial conditions, parameter setups. + +ODE1: Composite Harmonic Oscillator We chose this ODE because it has an analytical solution, allowing us to validate our differential equation solvers and sensitivity computations. The ODE is defined as: + +$$ +\frac {d u}{d t} = \alpha \sin (\alpha \pi t) + \beta \cos (\beta \pi t) \tag {7} +$$ + +with the initial condition $u(0) = \sin(\gamma \pi)$ . This oscillator's behavior is modulated by the parameters $\alpha$ , $\beta$ , and $\gamma$ , affecting the frequency and amplitude of oscillations within the temporal domain $t \in [0,1]$ . The analytical solution for $\mathbf{u}(t)$ is: + +$$ +u (t) = - \frac {1}{\pi} \cos (\alpha \pi t) + \frac {1}{\pi} \sin (\beta \pi t) + \sin (\gamma \pi) + \frac {1}{\pi} \tag {8} +$$ + +The sensitivities of u with respect to each parameter are: + +$$ +\frac {\partial u}{\partial \alpha} = t \sin (\alpha \pi t) \tag {9} +$$ + +$$ +\frac {\partial u}{\partial \beta} = t \cos (\beta \pi t) \tag {10} +$$ + +$$ +\frac {\partial u}{\partial \gamma} = \pi \cos (\gamma \pi) \tag {11} +$$ + +These analytical solutions provide a benchmark against which we can compare the accuracy of our numerical solvers and sensitivity computations. + +# ODE2: Duffing Oscillator Equation + +$$ +\ddot {x} + \delta \dot {x} + \alpha t + \beta t ^ {3} = \gamma \cos (\omega t), \tag {12} +$$ + +with initial conditions $x(0) = \epsilon, \dot{x}(0) = \zeta$ . This equation describes a non-linear oscillator where damping $\delta$ , stiffness $\alpha$ , non-linear stiffness $\beta$ , driving amplitude $\gamma$ , and frequency $\omega$ play crucial roles. + +# PDE1: Generalized Nonlinear Damped Wave Equation + +$$ +\frac {\partial^ {2} u}{\partial t ^ {2}} = c ^ {2} \frac {\partial^ {2} u}{\partial x ^ {2}} + \alpha \frac {\partial u}{\partial t} + \beta u + \gamma \sin (\omega u), \tag {13} +$$ + +with initial conditions $u(x,0) = u_0$ , $\frac{\partial u}{\partial t}(x,0) = u_0'$ . This PDE extends over a spatial domain $x \in [0,1]$ and temporal domain $t \in [0,1]$ , exploring wave propagation influenced by damping $\alpha$ , stiffness $\beta$ , and external forcing $\gamma$ and $\omega$ . + +# PDE2: Forced Burgers' Equation + +$$ +\frac {1}{\pi} \frac {\partial u}{\partial t} + \alpha u \frac {\partial u}{\partial x} = \gamma \frac {\partial^ {2} u}{\partial x ^ {2}} + \delta \sin (\omega t), \tag {14} +$$ + +This equation is set within a spatial domain $x \in [0, 1.0]$ and a temporal domain $t \in [0, \pi]$ . It models fluid dynamics phenomena such as velocity $u(x, t)$ , incorporating effects of advection $\alpha$ , viscosity $\gamma$ , and external periodic forcing characterized by amplitude $\delta$ and frequency $\omega$ . The initial state of the system is defined as follows: + +$$ +u (x, 0) = u _ {0} (x) = \left(e ^ {- \frac {(x - x _ {0}) ^ {2}}{2 \sigma^ {2}}} + \sin (0. 5 \pi x)\right), \tag {15} +$$ + +where the Gaussian pulse is centered at $x_0 = 0.5$ with a width $\sigma = 0.3$ , combined with a sinusoidal component. The model employs periodic boundary conditions, ensuring that $u(0,t) = u(1.0,t)$ + +throughout the simulation, facilitating the study of continuous and cyclic phenomena in a finite spatial interval. + +# PDE3: Stream Function-Vorticity Formulation of the Navier-Stokes Equations + +$$ +\frac {\partial \omega}{\partial t} + \psi_ {y} \frac {\partial \omega}{\partial x} - \psi_ {x} \frac {\partial \omega}{\partial y} = \frac {1}{R e} \left(\frac {\partial^ {2} \omega}{\partial x ^ {2}} + \frac {\partial^ {2} \omega}{\partial y ^ {2}}\right), \tag {16} +$$ + +$$ +\frac {\partial^ {2} \psi}{\partial x ^ {2}} + \frac {\partial^ {2} \psi}{\partial y ^ {2}} = - \omega , \tag {17} +$$ + +with initial condition $\omega (x,y,0) = f(x,y;\alpha ,\beta)$ where: + +$$ +f (x, y; \alpha , \beta) = \sin (\alpha x) \cos (\beta y) + \cos (\alpha y) \sin (\beta x) + \sin (\alpha x + \beta y) \cos (\alpha y - \beta x), \tag {18} +$$ + +covering the spatial domain $x, y \in [0,1]$ and temporal domain $tin[0,3]$ . The Reynolds Number $Re$ for the Navier-Stokes equations is set to 1000 to simulate realistic fluid dynamics. This equation captures the dynamics of fluid flow, with initial vorticity distribution determined by parameters $\alpha$ and $\beta$ . + +# PDE4: Allen-Cahn equation + +$$ +\frac {\partial u}{\partial t} = \epsilon \frac {\partial^ {2} u}{\partial x ^ {2}} + \alpha u - \beta u ^ {3}, \tag {19} +$$ + +with initial condition $u(x,0) = c \tanh(\omega x)$ and periodic boundary conditions. This PDE, known for exhibiting rich bifurcation behavior, explores phase transition phenomena influenced by diffusion coefficient $\epsilon$ , linear term $\alpha$ , cubic term $\beta$ , and initial condition parameters $c$ and $\omega$ . The equation's solutions can undergo sharp qualitative changes with small parameter variations, making it an excellent test case for sensitivity analysis. + +The parameter ranges used in our simulations are detailed in Table B.6. Parameters for these simul + +Table B.6: Parameter values for different ODE and PDE cases. + +
CasecαβγδωεζM
ODE 1-[1, 3][1, 3][0, 1]----10
ODE 2-[0.02, 0.06][0.01, 0.03][20, 60][0.5, 1.5][0.2, 0.6][0.0, 0.2][0.0, 0.2]10
PDE 1[0.0, 0.25][0.0, 0.1][0.0, 0.25][0.0, 0.25]-[0.0, 0.25]--5
PDE 2-[0.1, 1.0]-[0.025, 0.25][0.1, 0.5][0.01, 0.1]--5
PDE 3-[π, 5π][π, 5π]-----1
PDE 4[0.1,0.9][0.01,1.0][0.01,1.0]--[5.0, 10.0][0.01,1.0]-5
+ +relations were randomly generated using a uniform distribution. The uniform distribution is denoted by $\mathcal{U}(a,b)$ , where $a$ is the lower bound and $b$ is the upper bound of the distribution. This means that any value within the range $[a,b]$ has an equal probability of being selected. The uniform distribution was chosen to ensure a balanced representation of parameter values across the entire specified range, without favoring any particular subset of values. This approach allows for a comprehensive exploration of the parameter space, providing a robust test of our models across a wide range of potential input conditions. + +# C FNOS HYPERPARAMETERS + +Table C.7 presents the hyperparameters used for training the FNO models for each case study. In the network architecture, "Mode" refers to the Fourier modes used in the neural network's layers for each dimension (t, x, and y), while "Width" denotes the number of channels or features in the hidden layers of the neural network. The learning rate and number of epochs used for training are also provided for each case. Additionally, Table C.8 compares training times per epoch for different model configurations and batch sizes. + +Table C.7: Hyperparameters for FNOs + +
CaseMode for tMode for xMode for yWidthNumber of Fourier LayersLearning RateNumber of EpochsNumber of Learnable Parameters
ODE 188-2040.00150017921
ODE 288-2040.00150017921
PDE 188-2040.001500107897
PDE 28882040.001500107897
PDE 3-882040.001500209397
PDE 48882040.001500107897
+ +Table C.8: Comparison of model configurations and training time + +
CaseBatch sizeNumber of physical parameters (p)Number of training samplesAverage training time per epoch (s)
FNOSC-FNOFNO-PINNSC-FNO-PINN
ODE116320001.101.941.532.46
ODE216720001.582.131.762.86
PDE145200035.2453.3252.1382.13
PDE244200032.6644.9239.1173.06
PDE2 (Zoned)1821005.377.23--
PDE2 (Zoned)1825008.0911.23--
PDE342100047.16109.43--
PDE41510011.5419.12--
+ +# D ADDITIONAL RESULTS + +# D.1 PERFORMANCE COMPARISON OF NEURAL OPERATORS + +This appendix section presents a comprehensive comparison of the performance of various neural operators, both in their original form and with our proposed sensitivity-constrained framework. We evaluate these operators on four different systems, PDE1 and PDE2. The following tables provide quantitative results for Fourier Neural Operators (FNO), Wavelet Neural Operators (WNO), Multiwavelet Neural Operators (MWNO), and DeepONets, along with their sensitivity-constrained counterparts. + +Table D.9: ${R}^{2}$ for PDE1 with $2 \times {10}^{3}$ training samples. + +
ValueFNOSC-FNOWNOSC-WNOMWNOSC-MWNODeepONetSC-DeepONet
u(t)0.9860.9830.9810.9890.9780.9520.9740.954
∂u/∂c0.7230.9240.6610.9190.5960.9390.1170.508
∂u/∂α0.7410.9250.4020.9230.0900.9160.1100.243
∂u/∂β0.7630.9300.9210.9140.8630.9150.7780.827
∂u/∂γ0.7720.9310.5720.8340.5310.6590.4830.572
∂u/∂ω0.7810.9320.6140.8230.5580.6840.4970.531
+ +Table D.10: $R^2$ for PDE2 with $2 \times 10^{3}$ training samples. + +
ValueFNOSC-FNOWNOSC-WNOMWNOSC-MWNODeepONetSC-DeepONet
u(t)0.9970.9970.9810.9790.9890.9710.9900.985
∂u/∂α0.2060.9870.4220.6350.5580.8210.3440.882
∂u/∂γ0.4230.9860.4320.5620.3870.9050.5110.873
∂u/∂δ0.8210.9120.8650.8940.5010.9320.4450.958
∂u/∂ω0.3210.9820.4250.5420.2140.9520.3630.806
+ +# D.2 ADDITIONAL RESULTS FOR THE INVERSION EXPERIMENTS + +Figures D.8, D.9 and D.10 showcase parameter inversion results for parameters for PDE1, PDE2, and PDE3, respectively. SC-FNO works significantly better than either FNO or FNO-PINN. Table D.11 shows the comparison between various neural operators and their sensitivity-constrained (SC-) versions in simultaneous parameter inversion. Note the uniform pattern that the sensitivity-constrained versions have much higher inversion accuracy. Furthermore, the differences between different neural operators are smaller than the difference between the versions with and without the sensitivity constraint. + +Table D.11: Multi-parameter inversion accuracy for PDEs 1 and 2 with and without gradient supervision. +(a)PDE1 + +
ParameterFourier Neural OperatorsOther Neural Operators
FNOSC-FNOWithout gradient supervision.With gradient supervision.
R2Relative L2R2Relative L2WNOMWNODeepONetSC-WNOSC-MWNOSC-DeepONet
c0.6570.2120.9870.0350.6360.6140.5380.9840.9810.977
α0.6420.2220.9860.0360.6210.5980.5190.9840.9800.977
β0.7530.1830.9740.0420.7380.7230.6680.9690.9630.956
γ0.8040.1650.9850.0370.7920.7800.7360.9820.9780.975
ω0.7500.1860.9160.0750.7350.7190.6630.9010.8790.859
+ +(b) PDE2 + +
ParameterFourier Neural OperatorsOther Neural Operators
FNOSC-FNOWithout Grad. Sup.With Grad. Sup.
R2Relative L2R2Relative L2WNOMWNODeepONetSC-WNOSC-MWNOSC-DeepONet
α0.9540.0780.9820.0450.9510.9490.9380.9790.9740.970
γ0.9250.0820.9670.0220.9210.9160.8990.9610.9530.945
δ0.8420.1450.9700.0510.8320.8220.7870.9640.9560.949
ω0.8950.1180.9860.0420.8890.8380.8590.9830.9730.976
+ +![](images/cd04e5d9db0805b6ec180155c6799594eff6018b054887afca3b9fcaf454df68.jpg) + +![](images/494800ce0b3e71d37eac0dcca05b97d07ddc5e1a5d7bfd46ba89054cb7e277a8.jpg) + +![](images/a98bb2c935345db56456500a5c34130e572fc5de53b981ccecb157a706207f6c.jpg) +(a) $c$ parameter +(c) $\gamma$ parameter + +![](images/ca272ce9888a73c52a3483b6ecc6b7ba0ec161fc475f0c28c4c01eb308745d67.jpg) +(b) $\beta$ parameter +(d) $\omega$ parameter + +![](images/dfe68b290d10db537cd1193da39ebe909f79aa5a11d1a635c2bbbecb7d3ec2e6.jpg) +Figure D.8: Individual parameter results for PDE1 in simultaneous multi-parameter recovery, comparing FNO and SC-FNO performance. ( $\alpha$ has been presented in Figure 1b) + +![](images/787a4f761e099567b3736b8d76f1f7cfc4e7cd08d5d525f8c4e088cb4a3bd06d.jpg) + +![](images/60fdcee807df7e1cc1dc2b8ac10a0bbcf1bad3b5c0b75acc9ec5135bb57de306.jpg) +(a) $\alpha$ parameter +(c) $\delta$ parameter +Figure D.9: Individual parameter results for PDE2 in simultaneous multi-parameter recovery, comparing FNO and SC-FNO performance. + +![](images/9a1ed2c2286482c817582d43290f66c89153ec42a933da5b69db6b1608d7f287.jpg) +(b) $\gamma$ parameter +(d) $\omega$ parameter + +# D.3 VERIFICATION OF DIFFERENTIABLE AND FINITE DIFFERENCE SOLVERS + +Table D.13 presents a comparison of $R^2$ values for both the solution path u(t) and the gradients of u with respect to different parameters obtained from both differentiable solver (AD) and 4th order finite difference solver (FD). The table includes runtime measurements for generating $2 \times 10^{3}$ samples using both solvers, providing insight into their computational efficiency. These measurements were obtained using a machine equipped with a V100 GPU and four Intel Xeon processors, offering a standardized comparison of computational cost (The Wall Clock Times) between the two solvers. + +![](images/62a579211a8d4c99ad003d4e99d04e7f0e0d8a43fda41989bd7b7263ca5b53ef.jpg) +Figure D.10: Inversion of the parameter $\alpha$ in PDE3 using FNO and SC-FNO models. + +Table D.12: Computation time for preparing datasets using AD solver with and without Jacobian + +
CaseNumber of input parameter (P)Computation time (s)
With jacobianWithout jacobian
PDE151.8520.932
PDE241.3870.796
PDE326.2052.762
+ +Table D.13: Error metrics and runtime comparison for training data preparation with AD and FD solvers on ODE1 + +
ValueFD solverAD solver
\( R^2 \)Runtime\( R^2 \)Runtime
u0.98720.9981
\( \frac{\partial u}{\partial\alpha} \)0.97121907.32 s0.9906252.54 s
\( \frac{\partial u}{\partial\beta} \)0.98850.9989
\( \frac{\partial u}{\partial\gamma} \)0.96180.9890
+ +# D.4 SURROGATE MODEL QUALITY FOR THE ORDINARY DIFFERENTIAL EQUATIONS (ODES). + +Table D.14: Test $R^2$ values and Relative $\mathbf{L}^2$ for the solution paths $u$ and sensitivities $(\frac{\partial u}{\partial p})$ of the surrogate models for ODE1 and ODE2 with $2\times 10^{3}$ training samples. The train and test parameters are in the same range. ODEs are simpler to capture by surrogate models than PDEs. + +(a) ODE1 + +
ValueMetricFNOSC-FNOSC-FNO-PINNFNO-PINN
u(t)R²0.9960.9910.9940.991
Relative L²0.0040.0090.0060.009
∂u/∂αR²0.3270.9940.9920.318
Relative L²0.6730.0060.0080.682
∂u/∂βR²0.4150.9950.9950.462
Relative L²0.5850.0050.0050.538
∂u/∂γR²0.0280.9980.9980.131
Relative L²0.9720.0020.0020.869
+ +(b) ODE2 + +
ValueMetricFNOSC-FNOSC-FNO-PINNFNO-PINN
u(t)R²0.9980.9950.9970.997
Relative L²0.0020.0050.0030.003
∂u/∂xR²0.1620.9970.9980.152
Relative L²0.8380.0030.0020.848
∂u/∂δR²0.9560.9970.9980.951
Relative L²0.0440.0030.0020.049
∂u/∂ζR²0.1350.9960.9970.147
Relative L²0.8650.0040.0030.853
\ No newline at end of file diff --git a/ICLR/2025/Sensitivity-Constrained Fourier Neural Operators for Forward and Inverse Problems in Parametric Differential Equations/images.zip b/ICLR/2025/Sensitivity-Constrained Fourier Neural Operators for Forward and Inverse Problems in Parametric Differential Equations/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..dd8d0964aaa312f7bb2b2d229aeb4befda3b6798 --- /dev/null +++ b/ICLR/2025/Sensitivity-Constrained Fourier Neural Operators for Forward and Inverse Problems in Parametric Differential Equations/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:abf400cf83aeb09c5d717c0fe7d15514a2385ce34005ecaaaf8b7acd48957451 +size 950015 diff --git a/ICLR/2025/Sensitivity-Constrained Fourier Neural Operators for Forward and Inverse Problems in Parametric Differential Equations/layout.json b/ICLR/2025/Sensitivity-Constrained Fourier Neural Operators for Forward and Inverse Problems in Parametric Differential Equations/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..f046577c160ca321532852c198558d85d934cb98 --- /dev/null +++ b/ICLR/2025/Sensitivity-Constrained Fourier Neural Operators for Forward and Inverse Problems in Parametric Differential Equations/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:df834fcaf7ba674ecc9e9f137292b604d6d7aeff522da5620b0980016474a0d2 +size 754792 diff --git a/ICLR/2025/Sensor-Invariant Tactile Representation/a3112a35-18b4-4f36-a8f4-a4939fcd0dba_content_list.json b/ICLR/2025/Sensor-Invariant Tactile Representation/a3112a35-18b4-4f36-a8f4-a4939fcd0dba_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..1b9ca074e68954fb87bb1587192a080a6d3d001a --- /dev/null +++ b/ICLR/2025/Sensor-Invariant Tactile Representation/a3112a35-18b4-4f36-a8f4-a4939fcd0dba_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9cac132960a7d100c19d89a39ae448b846b7e201fe47a420b37afcf3c259a56f +size 109209 diff --git a/ICLR/2025/Sensor-Invariant Tactile Representation/a3112a35-18b4-4f36-a8f4-a4939fcd0dba_model.json b/ICLR/2025/Sensor-Invariant Tactile Representation/a3112a35-18b4-4f36-a8f4-a4939fcd0dba_model.json new file mode 100644 index 0000000000000000000000000000000000000000..d577167864cbc18a39cf1b44e2e0e6b09149206d --- /dev/null +++ b/ICLR/2025/Sensor-Invariant Tactile Representation/a3112a35-18b4-4f36-a8f4-a4939fcd0dba_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1311598f70df7c003f87cd5230d0837611f6c9835e1f03847de936cf081cbe7f +size 135862 diff --git a/ICLR/2025/Sensor-Invariant Tactile Representation/a3112a35-18b4-4f36-a8f4-a4939fcd0dba_origin.pdf b/ICLR/2025/Sensor-Invariant Tactile Representation/a3112a35-18b4-4f36-a8f4-a4939fcd0dba_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..7b575739bb30952ea33ffaf766cd1eb82590e0ee --- /dev/null +++ b/ICLR/2025/Sensor-Invariant Tactile Representation/a3112a35-18b4-4f36-a8f4-a4939fcd0dba_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8e95e1d52b96e8982aa57fb6262b44d2bf6ce20549e2d02eefee9b6f2e813912 +size 36151622 diff --git a/ICLR/2025/Sensor-Invariant Tactile Representation/full.md b/ICLR/2025/Sensor-Invariant Tactile Representation/full.md new file mode 100644 index 0000000000000000000000000000000000000000..888f18fae90046f7ee1acc584bf4478c679fe776 --- /dev/null +++ b/ICLR/2025/Sensor-Invariant Tactile Representation/full.md @@ -0,0 +1,465 @@ +# SENSOR-INVARIANT TACTILE REPRESENTATION + +Harsh Gupta* Yuchen Mo* Shengmiao Jin Wenzhen Yuan + +University of Illinois Urbana-Champaign + +{hgupt3,yuchenm7}@illinois.edu + +# ABSTRACT + +High-resolution tactile sensors have become critical for embodied perception and robotic manipulation. However, a key challenge in the field is the lack of transferability between sensors due to design and manufacturing variations, which result in significant differences in tactile signals. This limitation hinders the ability to transfer models or knowledge learned from one sensor to another. To address this, we introduce a novel method to extract Sensor-Invariant Tactile Representations (SITR), enabling zero-shot transfer across optical tactile sensors. Our approach utilizes a transformer-based architecture trained on a diverse dataset of simulated sensor designs, allowing generalizability to new sensors in the real world with minimal calibration. Experimental results demonstrate our method's effectiveness across various tactile sensing applications, facilitating data and model transferability for future advancements in the field. + +![](images/cd10a27575209eb84e2a6d21fc1c6d6bde5822cbf5e8d803d2797482acc9c624.jpg) +Real object + +![](images/7a01f36350b8cf578d6fed2a9c5e689c99e4b45fae0fa1f5b0ce74af2ca83b16.jpg) +GelSight Mini + +![](images/f17cc2cd1ecf319392ff0271f3958067b60039f1bd3c9848cc5883e4a4297059.jpg) +GelSight Mini v1 + +![](images/c6febc9b01f9b29277dc74419e39332e57b1f854f5eebc860f4bc83f26c63c87.jpg) +GelSight Mini v2 + +![](images/9893e8b7515b5795490f37bd7fb671b1c96ce99d1a44aa30fd3d83051816f359.jpg) +DIGIT + +![](images/0fb42c15139a2647d8e039887894ee4aa6f0261fece011f0213dc8c1e56bb2cc.jpg) +GelSight Hex + +![](images/a57ad2756702a4441126e695a3f90ad9f6d0ca5c85b342fab8a8779319289ab1.jpg) +GelSight Wedge + +![](images/b872359683ca316e912481e94b989b2f4f7cbf6e0813304ef42d4eb5c9443458.jpg) +Figure 1: Vision-based tactile sensors vary in both optical design and physical properties. Even with the same contact object, a screw, the tactile images produced by each sensor differ significantly. These variations highlight the challenge of transferring models from one sensor to another. + +![](images/ed8a875018783995f226fda6156eadc2eebe09fea8db219f8296b339c696d08a.jpg) + +![](images/f5894956f97d68e92c1a9d779ffd916cff9d8e65a582a44300ea7336ce971899.jpg) + +![](images/ea4928a501587abe9b1e46be8a51d0139f2bae690b16188184ba98b4e44abad3.jpg) + +![](images/c22554ddc4da9ecbe1804bd59a5d0b9186720def89ccd80966d356384610d19e.jpg) + +# 1 INTRODUCTION + +Tactile sensing is a crucial modality for intelligent systems to perceive the physical world. Among the various tactile technologies, the GelSight sensor (Yuan et al., 2017a) and its variants (Wang et al., 2021; GelSight, 2024; Zhao & Adelson, 2023) have recently emerged as one of the most influential tactile technologies, offering rich and detailed information on contact surfaces. GelSight captures fine contact geometries through an optical system that transforms tactile data into visual images. This enables robots to precisely detect object shapes, recognize materials, and perform fine-grained manipulations with a high degree of accuracy (Yuan et al., 2018; Dong et al., 2019; Hogan et al., 2020; Ota et al., 2023; Yang et al., 2023; Shirai et al., 2023). + +Despite their advantages, GelSight-like sensors, and vision-based tactile sensing in a more general sense, still face a key challenge: sensor variance. Differences in the optical design or manufacturing process can result in significant discrepancies in sensor output. Consequently, machine learning models trained on data from one sensor often fail to generalize to other sensors. This challenge is further compounded by the high cost and effort of collecting tactile datasets, creating a major barrier to sensor transferability in tactile perception. + +In this paper, we address the challenge of data transferability between GelSight sensors by tackling sensor variance arising from optical design and manufacturing differences. The key issue lies in enabling generalization to new sensors as the domain gap between individual sensors is substantial and unpredictable. Previous methods, such as Yuan et al. (2018); Calandra et al. (2018), attempted to improve generalization by using multiple GelSight sensors to gather diverse tactile datasets, but this approach offered limited gains. More recently, T3 (Zhao et al., 2024) sought to improve transferability by pre-training a transformer model across multiple sensors and tasks. However, their reliance on category-specific encoders limited the ability of their model to generalize to unseen sensors. + +In contrast, we propose that achieving sensor transferability requires learning effective sensor-invariant representations by ensuring the model is trained on sufficiently diverse sensor variations. We introduce a novel framework for generating sensor-invariant feature representations from high-resolution tactile readings, enabling zero-shot transfer to unseen sensors across multiple downstream tasks. Our framework incorporates three core innovations: + +1. We utilize a small set of easy-to-acquire calibration images to characterize individual sensors. We then use a transformer model as the encoder to effectively combine the calibration images with the tactile reading. +2. We employ supervised contrastive learning (SCL) (Khosla et al., 2020) to emphasize the geometric aspects of tactile data, encouraging the clustering of similar contact geometries across multiple sensors. This training is further supervised by measuring geometric accuracy. +3. We develop a large-scale synthetic dataset using a physics-based simulator that models sensor optical systems, capturing variations in both sensor characteristics and contact geometries. This dataset, consisting of 1M examples across 100 sensor configurations, provides the diversity necessary for robust model training using precise ground truth of the contact geometries. + +Our motivation comes from the belief that contact geometry is one of the most critical features for most tactile-driven tasks, including shape recognition, texture classification, and contact localization. By focusing on geometric accuracy and using calibration to remove sensor-specific variations, we ensure the development of robust, sensor-invariant representations. Leveraging physics-based simulations allows us to efficiently generate diverse tactile datasets, reducing the time and cost of real-world data collection. + +We evaluate the generalizability of our method across various downstream tasks using multiple real-world GelSight sensors. Our results demonstrate that models trained on one sensor can be seamlessly transferred to others in a zero-shot manner, significantly outperforming existing approaches. This framework paves the way for easier transferability of machine learning models and datasets between different sensors, thereby enhancing the future development of the tactile-sensing community. + +# 2 RELATED WORKS + +In the realm of vision-based tactile images, the application of computer vision models and algorithms has become common practice due to the visual nature of the data these sensors capture (Dong et al., 2021; Li et al., 2019; Calandra et al., 2018). Researchers have adapted mature representation learning methods from the vision community to tactile images. One popular approach is contrastive learning. Both tactile and visual-tactile representations have been explored for specific tasks (Yuan et al., 2017b; Yang et al., 2022; Tian et al., 2020; Kerr et al., 2022; Guzey et al., 2023; Grill et al., 2020; Zambelli et al., 2021). Another technical approach is based on auto-encoding representation. Cao et al. (2023) and Xu et al. (2024) leveraged Masked Auto-Encoder (MAE) to learn tactile representations. + +However, many works that directly apply existing representation learning methods to the tactile modality ignore the significant domain gap seen between sensors. Representations trained on one sensor may work well on the exact same sensor or the same type, but the domain gap between different sensors makes models based on such representation fail to generalize to other sensors. To address this, Zhao et al. (2024) trained individual encoder-decoder pairs for different sensor-task combinations, focusing on learning the shared features and improving fine-tuned performance on + +new sensor-task combinations. Yang et al. (2024) sought to address this by proposing a general-purpose multimodal representation for vision-based tactile sensors. By integrating multiple tactile datasets into a large language model (LLM) framework and encoding sensor types as tokens, they try to inform the LLM explicitly of the domain gap among different types of sensors. Higuera et al. (2024) introduced a family of self-supervised models for vision-based tactile sensing that learns general-purpose representations by leveraging masking and self-distillation pretraining across multiple sensors. They aim to improve tactile perception and downstream task performance under a limited labeled data budget. However, these methods often depend on large datasets and treat sensor types as fixed categories, failing to account for variations within the same sensor type and lacking the flexibility to generalize zero-shot to unseen sensors. + +Our framework introduces a novel combination of geometry-preserving supervision, supervised contrastive learning, and sensor-specific calibration images. The calibration images capture sensor-specific domain features, such as optical properties unique to each sensor, which help the encoder adapt to these characteristics. By accounting for subtle variations both within the same sensor type and across different types, our method enhances zero-shot generalization across tactile tasks and demonstrates strong transferability to new sensors. + +# 3 SENSOR-INVARIANT REPRESENTATION LEARNING + +![](images/3a29eca71bf410fa6b327270753ca3d51b4443f1736c879525be5eac9ae52181.jpg) +Figure 2: Our sensor-invariant representation learning framework. Each tactile image $x$ is paired with a set of calibration images $c$ . We patchify and linearly project $x$ and $c$ to tokens. Additionally, the $c$ patches are region-wise stacked before projection. We concatenate the input tokens with a class token $z$ and pass it through a transformer encoder. The class token $z$ is trained with SCL, while patch tokens are supervised by normal map reconstruction loss. We highlight in grey the concatenation of the output class token and patch tokens as our Sensor-Invariant Tactile Representation (SITR) for downstream tasks. + +In this section, we introduce our framework for training Sensor-Invariant Tactile Representation (SITR). We explain how calibration images capture sensor-specific information and use normal maps to preserve contact features. We introduce our implementation of SCL to align tactile features across sensor domains. We provide details on the role of calibration in Section 3.1, followed by the network architecture and training process in Section 3.2. + +# 3.1 CALIBRATION IMAGES FOR TACTILE SENSORS + +GelSight-like sensors map RGB values at each pixel to the local surface gradient, enabling the reconstruction of the contact surface. However, these sensors exhibit variations in physical properties that + +introduce sensor-specific artifacts in tactile images. A widely adopted calibration technique involves pressing a ball of known radius onto the sensor pad at various points. The tactile images captured during this process, combined with the known geometry of the ball, establish the correspondence between RGB changes and the local surface gradient at different locations. This method generates a sensor-specific look-up table. While traditional techniques assume pixel-invariant projection for simplicity, neural networks can further learn precise and pixel-dependent projections. + +In the pre-training stage of SITR we adopt these steps to inform the model of sensor characteristics. We include a cube in our calibration to inform SITR about how the gel deforms around edges and corners. Thus, we press two objects—a 4mm diameter ball and a cube corner—at nine locations each, roughly arranged in a $3 \times 3$ grid pattern across the sensor surface as seen in Fig. 3. These calibration images guide the encoder to identify and factor out sensor-specific features. + +Formally, given a tactile image $x_{i} \in \mathbb{R}^{H \times W \times C}$ , we select $K$ calibration images $c_{i,k} \in \mathbb{R}^{H \times W \times C}$ where $(H,W)$ is the resolution of the original image and $C$ is the number of channels. To efficiently encode multiple calibration images we reshape $c_{i,k}$ into the form $c_{i} \in \mathbb{R}^{H \times W \times KC}$ , in effect stacking the patches. We then linearly project $x_{i}$ and $c_{i}$ into a sequence of $N$ flattened 2D patches $x_{p} \in \mathbb{R}^{N \times P^{2}C}$ and $c_{p} \in \mathbb{R}^{N \times P^{2}C}$ similar to a standard ViT, where $N = HW / P^{2}$ . The resulting token sequences from $x_{p}, c_{p}$ , and a class token $z_{i}$ are concatenated as input to the transformer encoder. + +![](images/7b27b462b3b126f9d4f45f4e2fcc1a4d20bcd9af23bf4b5199d74bd87cc86a07.jpg) +Figure 3: Calibration images used in SITR, obtained by pressing two objects—a $4\mathrm{mm}$ ball and a cube corner—at nine different locations each in a $3\times 3$ grid. + +# 3.2 NETWORK ARCHITECTURE + +Input: We use the tactile image and a set of calibration images for the sensor as inputs for the network. We subtract the sensor background from all the input images to get the pixel-wise color change as described in Section 3.1. Following the process described in Vision Transformer (ViT) (Dosovitskiy et al., 2021) and Section 3.1, we linearly project the input and calibration images to tokens. Note that calibration images need only be tokenized once per sensor. + +Encoder: We modify a ViT to process both image and calibration tokens. Adapted from ViT, we add positional encoding to them based on their 2D coordinates and then pass them into the encoder. We apply two supervision signals to train this encoder. One is the pixel-wise normal map reconstruction loss for the output patch tokens, and an additional contrastive loss for the class token. + +Normal map reconstruction: During the SITR pre-training phase, we apply a lightweight decoder to reconstruct the contact surface as a normal map from the encoder output. Normal maps record the orientation of each 3D point on the contact surface. This feature is invariant to the variance across different sensors, contains rich geometry information for downstream tasks, and is viable for many GelSight-like vision-based tactile sensors. Therefore, we apply a pixel-wise MSE loss $\mathcal{L}_{\mathrm{normal}}$ between predicted normal map $\hat{n}$ and ground truth normal map $n$ . + +Supervised contrastive learning: SCL is an extension of contrastive learning that leverages label information to learn more effective representations. Traditional contrastive learning aims to pull together similar samples and push apart dissimilar ones in the embedding space, typically relying on data augmentations to create positive pairs. SCL enhances this approach by utilizing class labels to define similarity, allowing for more semantically meaningful contrasts. + +We employ SCL to create sensor-invariant representations from our labeled simulated tactile dataset. We label positive pairs from tactile images with the same contact geometry across multiple sensors, while negative pairs are labeled from images of different contact geometries or locations. In our batched implementation, we include two views for each sample: tactile images of the same contact captured by two different sensors. This approach allows us to learn discriminative features for downstream tasks while being robust to variations in sensor characteristics. + +Formally, given a batch of $N$ samples, let class token $z_{i}\in \mathbb{R}^{d}$ represent the encoded feature vector for sample $i$ , where $d$ is the dimension of the embedding space. Let $y_{i}$ denote its corresponding + +contact label. Let $A(i)$ denote the set of all samples in the batch except for sample $i$ itself. For each anchor sample $i$ , we define the set of positive samples as $P(i) = p \in A(i): y_p = y_i$ , with $|P(i)|$ being its cardinality. The supervised contrastive loss for a batch of samples is then formulated as + +$$ +\mathcal {L} _ {\mathrm {S C L}} = \sum_ {i \in I} \frac {- 1}{| P (i) |} \sum_ {p \in P (i)} \log \frac {\exp \left(\frac {z _ {i} \cdot z _ {p}}{\tau}\right)}{\sum_ {a \in A (i)} \exp \left(\frac {z _ {i} \cdot z _ {a}}{\tau}\right)} +$$ + +where $\tau$ is a temperature parameter that scales the similarity values to control the concentration of the distribution. + +In summary, the total loss for SITR is defined as $\mathcal{L} = \lambda_{\mathrm{normal}} \cdot \mathcal{L}_{\mathrm{normal}} + \lambda_{\mathrm{SCL}} \cdot \mathcal{L}_{\mathrm{SCL}}$ where $\lambda_{\mathrm{normal}}$ and $\lambda_{\mathrm{SCL}}$ are loss weighting hyperparameters. Refer to Section A.1 for more implementation details. + +# 4 DATASETS + +We collect three datasets for model training and evaluation. The first dataset contains purely synthetic data and is used to train the encoder for SITR. The other two datasets are collected across 7 real sensors on two specific tactile applications: object classification and contact localization. These two datasets are used to evaluate the zero-shot transferability of SITR for downstream tasks. + +# 4.1 SIMULATED TACTILE DATASET + +We construct a large-scale synthetic dataset that spans a wide range of tactile sensor configurations, providing tactile signals of contact geometries along with their corresponding normal maps. The sensor's configuration is defined by its optical design, such as the location and optical properties of the lights, cameras, and reflective surfaces. These attributes quantify the major variances seen in real tactile sensors. The core idea is to train SITR with a large distribution of simulated sensors so SITR can generalize to, and be aligned across, real-world sensors. This dataset is designed to be sensor-aligned, where each contact geometry is sampled across all sensor configurations for SCL. + +We use Physics-based Rendering (PBR) (Pharr et al., 2023) to simulate GelSight sensors (Agarwal et al., 2021) and implement the algorithm in Blender. PBR simulates the camera images by tracing the path of light rays traveling in the scene and how they interact with optical components. Therefore, the technology models the physical behavior of the optical system and can simulate a GelSight sensor's reading with parameterized optical settings. We design the simulator platform to customize the sensors by modulating the locations and characteristics of each optical component. Fig. 4 illustrates an example setup where three light sources surround a deformable surface. A camera positioned above captures the change of color on the surface caused by object contact. + +![](images/9bf52e94b6aab558456cf7d3955b8073087f1c103b83f6837e82295df5a76fd7.jpg) +Figure 4: Demonstration of our physics-based rendering (PBR) model to simulate GelSight sensors. We parameterize the sensor's optical design in the environment. + +Sensor variation: To mimic the variance across real-world tactile sensors, we identify key parameters that highlight the differences between real-world tactile sensors. Specifically, we look at the differences among GelSight Mini (GelSight, 2024), GelSight Hex (Yuan et al., 2017a), GelSight Wedge (Wang et al., 2021), GelSlim 3.0 (Taylor et al., 2022), GelSight Finray (Liu & Adelson, 2022), and DIGIT (Lambeta et al., 2020). This includes light properties (shape, orientation, angle, color), gel properties (stiffness, specularity), and camera properties (FOV, sensing area). In total, we generate 100 unique simulated sensor configurations. More details on the sensor configurations and examples of rendered images for the same contact object can be found in Section A.2. For each sensor, we also collect a set of calibration images as described in Section 3.1. We introduce random variability in the calibration positions to make the training more robust to the real-world setting. + +Object diversity: To enable SITR to generalize across diverse contact geometries, we utilize 50 high-resolution 3D meshes of common household objects. These meshes include tools, kitchenware, toys, and clothing items, which are often used in robotics research. During simulation, the objects are randomly scaled, rotated, and placed at varying locations on the gel pad. For each contact geometry, we render tactile images using all sensor configurations and pair them with ground-truth surface normal maps. We generate a total of 10K contact configurations through this process. + +With 10K unique contact configurations across 100 different sensor configurations, we pre-train SITR encoder solely using our 1M synthetic dataset. + +# 4.2 REAL-WORLD TACTILE DATASET + +We collect real-world datasets for training and evaluating downstream tasks across different baselines. Compared to the synthetic dataset we used for SITR encoder pre-training phase, we keep SITR encoder frozen and train only the corresponding task-specific decoder head for downstream tasks. We use seven different sensors for our datasets: four GelSight Minis (GelSight, 2024) with varying sensor bodies and in-house gel pad modifications, GelSight Hex (Yuan et al., 2017a), GelSight Wedge (Wang et al., 2021), and DIGIT (Lambeta et al., 2020). + +For the classification task, we select 16 objects and press them against the sensor in various poses and depths, recording 1K tactile images for each object. We repeat this process for all 16 objects across the 7 sensors, resulting in a dataset with 112K tactile images, with 16K samples per sensor. Section A.3 shows that tactile signals vary even when using the same object across different sensor configurations. + +For the pose estimation task, we modify an Ender-3 Pro 3D printer by replacing its extruder with 3D-printed indenters and mount the tactile sensors onto the print bed. This setup provides the accurate ground truth pose of each contact, including metric $x$ , $y$ , and $z$ values. During the data collection process, we press indentors at various locations and depths on the sensor surface. We collected 1K samples per indentor for 6 different indentors across 4 sensors. This results in a dataset of 24K tactile images with precise pose labels, with 6K samples per sensor. More details can be found in Section A.4. + +# 5 EXPERIMENTS + +In this section, we show several experiments to evaluate the zero-shot transferability of our model to different real sensors. We evaluate model performance on three downstream tasks: shape reconstruction, object classification, and contact localization. + +# 5.1 EXPERIMENT SETTING + +We conduct experiments with multiple real tactile sensors that can be divided into two groups: + +- Intra-sensor set: GelSight Mini 1 to 4 of different gel pads. These sensors have the same optical design, i.e., placement of camera and light sources, but differ in brightness and color of tactile signals due to manufacturing differences and choice of coating materials. +- Inter-sensor set: GelSight Mini 1, GelSight Wedge, GelSight Hex, and DIGIT. These sensors are designed with very different optical structures and, therefore, generate tactile signals that are significantly different from each other. + +For each downstream task, we freeze the SITR encoder and only train the downstream task-specific decoder on a single sensor. We evaluate this model using the rest of the sensors in the set. Formally, let $S = \{S_1, S_2, \dots, S_n\}$ be the set of sensors. Let $A_{ij}$ represent the performance (e.g., classification accuracy or pose estimation error) when trained on $S_i$ and evaluated on $S_j$ . The transfer performance across all sensors in the set is computed as + +$$ +\text{Transfer Performance} = \frac{1}{n(n - 1)}\sum_{i = 1}^{n}\sum_{\substack{j = 1\\ j\neq i}}^{n}A_{ij} +$$ + +We also compute the score when training and testing on the same sensor $i = j$ acting as an upper bound of the performance: No Transfer Performance $= \frac{1}{n}\sum_{i = 1}^{n}A_{ii}$ . + +Baseline: We compare our SITR with ViTs that are either trained from scratch or fine-tuned from ImageNet weights to show the effectiveness of our method. As there is no previous work that directly focuses on transferable tactile representations, we also compare against T3 (Zhao et al., 2024) and UniT (Xu et al., 2024). T3 focuses on improving few-shot fine-tuning results across different sensors and has the potential for zero-shot transfer. UniT learns dense representations for various downstream tasks and shows preliminary results on transferring among GelSight Mini sensors. We evaluate their available models for our experiments to compare the transferability of these representations. Additionally, we ablate the method used in T3 (MAE) and UniT (VQGAN) when trained on our synthetic dataset to test the effectiveness of our architecture in Section A.6. We describe model configurations and decoders for each task in Section A.1. + +# 5.2 ZERO-SHOT TRANSFER FOR SHAPE RECONSTRUCTION + +![](images/3a9d1ab206349c951ccc6a77f6f54909dc0b9234aff8e65366642607df0c2a15.jpg) +Figure 5: Reconstruction examples for various sensors. The top row shows input tactile images, the middle row presents 3D reconstructions, and the bottom row shows the contact objects. Simulated sensors (Simulation 1 and 2) are in the training set, while real sensors (GelSight Mini, DIGIT, Hex, Wedge) are not. + +We qualitatively evaluate how SITR preserves geometry and texture information by reconstructing the contact height map. As shown in Fig. 5, we reconstruct normal maps for objects in our real-world classification dataset and integrate them to generate their corresponding height maps. These 3D reconstructions capture fine-grained geometry and texture details of the contact surface. Though, these reconstructions are naturally constrained by the resolution and sensitivity limitations of the sensors. Despite these limitations, the preservation of dense surface features demonstrates the robustness of SITR in accurately modeling the contact geometry across varying sensor inputs. + +# 5.3 OBJECT CLASSIFICATION + +We compare SITR with baselines using our real-world classification dataset from Section 4.2 and report top-1 accuracy. We freeze our SITR encoder and train the downstream classifier using cross-entropy loss. For T3, we use their released GelSight Mini encoder weights for intra-sensor experiments. Since T3 does not provide encoder weights for GelSight Hex or DIGIT, we report intersensor results only for the GelSight Wedge and Mini. Note that T3's encoders were trained on marked sensors, so the results in our unmarked evaluations may not reflect their full potential. UniT demonstrates transferability only within GelSight Minis, so we exclude it from inter-sensor experiments. We train a UniT encoder on our unmarked real-world dataset and evaluate its intra-sensor transfer performance. + +As shown in Table 1, SITR outperforms all baselines by a large margin regarding classification accuracy when transferred across sensors. Note that most models perform well under the no-transfer setting, but fail to generalize when tested on a different sensor. This indicates that baselines can understand tactile features learned in the same domain, but SITR can capture meaningful features that are robust to changes in the sensor domain. We also find that the ViT pre-trained on ImageNet + +
MethodIntra-sensor set ↑Inter-sensor set ↑Wedge-Mini ↑No transfer ↑
ViT-Base Scratch36.90 ± 22.1924.02 ± 14.8352.56 ± 4.9596.76 ± 1.41
ViT-Base Pre-trained73.22 ± 22.4248.10 ± 22.8276.28 ± 17.0699.01 ± 1.14
ViT-Large Pre-trained78.38 ± 17.7954.34 ± 23.0479.04 ± 16.4499.44 ± 0.43
T3-Medium38.66 ± 20.63—17.02 ± 8.5593.77 ± 2.87
UniT46.39 ± 23.30——92.53 ± 4.19
SITR (Ours)90.23 ± 8.1681.94 ± 12.9290.80 ± 2.8599.72 ± 0.22
+ +Table 1: Results of object classification accuracy on 16 classes for model transfer and no-transfer performance. We report the mean and standard deviation of transfer accuracy percent among the sensor sets specified. Random guess classification accuracy corresponds to $6.67\%$ . + +performs better than that trained from scratch, which indicates the effectiveness of pre-training on the image domain. + +Moving to feature-level analysis, Fig. 6 presents the t-SNE visualization of the SITR features for the contacts in our real-world classification dataset. The visualization illustrates that the use of contrastive learning significantly improves feature clustering, bringing together samples of the same object across different sensors. This indicates that SITR successfully aligns the tactile signals from different sensors, highlighting its capacity to eliminate sensor-variant features. + +![](images/6e4d59d88a00cb50671e6954d15f293cf60d20374bea1bf98d0d0b96de311824.jpg) +Figure 6: t-SNE visualization of the feature space. We qualitatively show that our contrastive loss term helps cluster those similar contacts from different sensors together. + +![](images/56e96c5afd285d1084c05662035314c458b93ca5c1a3f638a987863951aa05f2.jpg) +Screw (Side) +Toy Avocado +$\bullet$ Lego Brick +Power Cable +$\bullet$ Microphone Net +USB (Side) +GelSight Mini +O DIGIT +GelSight Hex +GelSight Wedge + +However, the results also reveal some challenges. The features from the DIGIT sensor are somewhat more difficult to cluster with those from other sensors. This is better demonstrated in our detailed transfer results in Sec. A.5.1, where we see relatively worse classification transferability to and from the DIGIT sensor. We attribute this to DIGIT's distinct optical design, which differs from the GelSight designs in our simulation dataset. We believe the result will be improved in the future if we extend our synthetic dataset to cover optical designs similar to the DIGIT sensor. + +# 5.4 POSE ESTIMATION + +In this task, we try to estimate the 3-DoF $(x,y,z)$ position change of the object in contact using an initial and final tactile image. We separately feed 2 tactile images of the same object into the frozen SITR encoder, concatenate their features, and train a decoder to learn the pose change with mean square error (MSE) loss. For baseline models, we use similar pipelines as detailed in Section A.1. We evaluate this task on the inter-sensor set to see how each model handles differences in scale across sensors. Each sensor in this set has a different physical design, meaning they capture tactile signals at varying scales. Variations in object size may create significant challenges for zero-shot transfer tasks like pose estimation. + +As shown in Table 2, SITR demonstrates strong performance on the pose estimation when tested on a different sensor, reducing the RMSE by about $50\%$ compared to baselines. Remarkably, all models have similar RMSE errors for the no-transfer setting. This may suggest sub-millimeter inaccuracies present in our data collection process. Nonetheless, the no-transfer setting serves as the upper bound + +
MethodInter-sensor set ↓Wedge-Mini ↓No transfer ↓
ViT-Base Scratch1.63 ± 0.201.69 ± 0.130.56 ± 0.02
ViT-Base Pre-trained1.58 ± 0.221.65 ± 0.130.49 ± 0.01
ViT-Large Pre-trained1.49 ± 0.251.45 ± 0.010.50 ± 0.02
T3-Medium— —1.7 ± 0.070.51 ± 0.02
SITR (Ours)0.80 ± 0.210.62 ± 0.110.51 ± 0.01
+ +Table 2: Results of pose estimation with 6 objects. We report the mean and standard deviation of transfer pose estimation root mean square error (RMSE) in $mm$ among the sensor sets specified. Random guess pose estimation RMSE corresponds to $2.52mm$ . + +for our transfer setting. We also find that compared to ViT trained from scratch, the ViT pre-trained on ImageNet only marginally improves this task. This indicates that features learned from natural images may not transfer adequately to the tactile domain for accurate regression tasks like pose estimation. + +# 6 ABLATIONS + +# 6.1 NUMBER AND TYPE OF CALIBRATION IMAGES + +![](images/e36161f492a6e2472d17f15593bf13fc7d1f70256409580dd2c1df804cc216c3.jpg) +Effect of number of calibration images on + +![](images/47091672dcd6bebc0ef6aeaad781df2df09d50dc60e080f3596e0169f931dd05.jpg) +Figure 7: Ablation study on the number and type of calibration images used in SITR, showing their effect on (i) Classification accuracy for inter-sensor transfer, (ii) Classification accuracy for intrasensor transfer, and (iii) Pose estimation error for inter-sensor transfer. + +![](images/bf90e5362c291ae822ec6cfa73a87626c6666856fcfa0fce6a1e2117daddeab4.jpg) + +We conduct an ablation study to investigate the impact of the number and type of calibration images on the performance of SITR. In the standard SITR setup, we press two objects—a ball and a cube corner—at nine locations roughly arranged in a $3 \times 3$ grid pattern across the sensor surface. To explore variations, we retrained SITR using different subsets of these calibration images and evaluated performance across all downstream tasks. + +We test on five calibration configurations: No calibration images (0); Ball pressed at 4 corners (4); Ball pressed in a $3 \times 3$ grid (9); Ball and cube pressed at 4 corners ( $8^{*}$ ); Ball and cube pressed in a $3 \times 3$ grid, which is the standard setup ( $18^{*}$ ). Fig. 7 illustrates how different numbers and types of calibration images impact SITR's performance. We observe that increasing the number of calibration images increases performance across all tasks. However, the performance gains diminish as more images of the same object are added (as seen in the progression from cases (0) to (4) to (9)). Introducing a second calibration object with a distinct geometry, such as the cube (cases (4) to ( $8^{*}$ ), results in a larger performance boost compared to simply adding more images of the same object (cases (4) to (9)). The effect of calibration images is particularly notable in the inter-sensor setting, where we see upwards of a $20\%$ increase in classification accuracy from case (0) to ( $18^{*}$ ). We choose case ( $18^{*}$ ) for SITR since increasing the number of calibration images does not incur additional inference costs, as calibration tokens are computed only once per sensor. + +# 6.2 CONTRASTIVE LOSS AND TEMPERATURE + +We conduct an ablation study to assess the effect of SCL and varying contrastive temperatures $\tau$ on SITR's performance. Specifically, we compared models with and without the SCL term and tested + +![](images/77b941dc4d26dd3b0f3acbdde6784a5f52e2d214e7e7ef6ff5bfcc1f965310f0.jpg) +Effect of contrastive learning temperature on + +![](images/4d88c1eee91743ac0e45cb06aae054ac6c1208612204ee6a82df21c220ed3774.jpg) +(ii) Classification, Inter-sensor $\uparrow$ +Figure 8: Ablation study examining the impact of SCL and varying contrastive temperature $\tau$ on SITR's performance. Subplots (i) and (ii) show classification accuracy in inter-sensor and intrasensor settings, respectively, while (iii) shows the effect on pose estimation RMSE. + +![](images/cca90170bfbb457020b00a6a4ef8cce548298017ddb3806162bff6be1a1fa203.jpg) +(iii) Pose estimation, Inter-sensor $\downarrow$ + +five contrastive temperatures: 0.25, 0.10, 0.07, 0.03, and 0.01. No SCL corresponds to using only the normal map reconstruction loss during pre-training. Results in Fig. 8 show that a contrastive temperature of 0.07 achieves the best classification performance in the intra-sensor setting, while 0.03 performs best for the inter-sensor setting. Lower or higher temperatures lead to reduced performance in both cases. For the pose estimation task, the addition of SCL has a negligible impact on the RMSE. These results suggest that contrastive learning helps align features across sensors in classification tasks. However, in the pose estimation task, the model's performance is more dependent on the fine-grained geometry information from the contact surface. For SITR, we choose a temperature of 0.07 for its strong performance in the classification task. + +# 7 DISCUSSION + +Our qualitative and quantitative results indicate that SITR can generalize across sensors while preserving key geometric and texture features from tactile interactions. Our model has been largely trained and evaluated on optical tactile sensors with flat gel pads within the GelSight family. Despite this, SITR can be adapted to a broader range of sensors. Our PBR environment can be easily expanded to accommodate new parameters to explore distinct optical properties in flat tactile sensors. For more complex optical sensors like GelSight Svelte (Zhao & Adelson, 2023) or DIGIT 360 (Lambeta et al., 2024), adaptation remains feasible using an appropriate PBR model and contact surface mapping. + +One future direction of our framework is to generalize to traditional array-based tactile sensors. The challenge lies in bridging the signal modalities of low-resolution normal force distribution to the high-resolution contact geometry from GelSight sensors. One possible approach is to downsample vision-based tactile sensors' depth maps to approximate low-resolution tactile signals while establishing a meaningful invariant relationship between depth and force. While this approach provides a step towards a unified tactile modality, its effectiveness in maintaining transferability requires further validation and exploration. + +Another direction of future work is incorporating marker-based tactile information to SITR. Many variations of GelSight are equipped with markers—distinct patterns embedded within the gel surface—that provide force and torque information. Currently, these markers are reconstructed using simple computer vision techniques to generate a marker motion field. We believe that unifying marker motion fields between sensors may be possible with adaptations to calibration in SITR. This extension would broaden the applicability of our model to a wider range of tactile sensing tasks. + +# 8 CONCLUSION + +In this paper, we introduced SITR, a tactile representation that transfers across various vision-based tactile sensors in a zero-shot manner. We build large-scale, sensor-aligned datasets using synthetic and real-world data, and propose a method to train SITR to capture dense, sensor-invariant features. Our experimental results demonstrate that SITR outperforms baseline models and other related tactile representations in different downstream tasks, showcasing robust transferability and effectiveness. SITR represents a step towards a unified approach to tactile sensing, where models can generalize seamlessly across different sensor types, facilitating advancements in robotic and tactile research. + +# ACKNOWLEDGMENTS + +The authors would like to thank Amin Mirzaee and Ruohan Zhang for their help with hardware design and prototyping. The authors thank Ruihan Gao for her assistance with revising the paper. We thank Arpit Agarwal for his insightful discussions on tactile simulation. This work was supported in part by the NSF award #2024882, the Indira Gunda Saladi Engineering Research Prize, and the Illinois Office of Undergraduate Research. + +# REFERENCES + +Arpit Agarwal, Timothy Man, and Wenzhen Yuan. Simulation of vision-based tactile sensors using physics based rendering. In 2021 IEEE International Conference on Robotics and Automation (ICRA), pp. 1-7, 2021. doi: 10.1109/ICRA48506.2021.9561122. +Roberto Calandra, Andrew Owens, Dinesh Jayaraman, Justin Lin, Wenzhen Yuan, Jitendra Malik, Edward H Adelson, and Sergey Levine. More than a feeling: Learning to grasp and regrasp using vision and touch. IEEE Robotics and Automation Letters, 3(4):3300-3307, 2018. +Guanqun Cao, Jiaqi Jiang, Danushka Bollegala, and Shan Luo. Learn from incomplete tactile data: Tactile representation learning with masked autoencoders. In 2023 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS), pp. 10800-10805. IEEE, 2023. +Siyuan Dong, Daolin Ma, Elliott Donlon, and Alberto Rodriguez. Maintaining grasps within slipping bounds by monitoring incipient slip. 2019 International Conference on Robotics and Automation (ICRA), May 2019. doi: 10.1109/icra.2019.8793538. +Siyuan Dong, Devesh K Jha, Diego Romeres, Sangwoon Kim, Daniel Nikovski, and Alberto Rodriguez. Tactile-rl for insertion: Generalization to objects of unknown geometry. In 2021 IEEE International Conference on Robotics and Automation (ICRA), pp. 6437-6443. IEEE, 2021. +Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, Jakob Uszkoreit, and Neil Houlsby. An image is worth 16x16 words: Transformers for image recognition at scale, 2021. URL https://arxiv.org/abs/2010.11929. +Inc GelSight. Gelsight mini, 2024. https://www.gelsight.com/gelsightmini/ [Accessed: 2024-10-01]. +Jean-Bastien Grill, Florian Strub, Florent Alché, Corentin Tallec, Pierre Richemond, Elena Buchatskaya, Carl Doersch, Bernardo Avila Pires, Zhaohan Guo, Mohammad Gheshlaghi Azar, et al. Bootstrap your own latent-a new approach to self-supervised learning. Advances in neural information processing systems, 33:21271-21284, 2020. +Irmak Guzey, Ben Evans, Soumith Chintala, and Lerrel Pinto. Dexterity from touch: Self-supervised pre-training of tactile representations with robotic play. arXiv preprint arXiv:2303.12076, 2023. +Carolina Higuera, Akash Sharma, Chaithanya Krishna Bodduluri, Taosha Fan, Patrick Lancaster, Mrinal Kalakrishnan, Michael Kaess, Byron Boots, Mike Lambeta, Tingfan Wu, and Mustafa Mukadam. Sparsh: Self-supervised touch representations for vision-based tactile sensing, 2024. URL https://arxiv.org/abs/2410.24090. +Francois R Hogan, Jose Ballester, Siyuan Dong, and Alberto Rodriguez. Tactile dexterity: Manipulation primitives with tactile feedback. In 2020 IEEE international conference on robotics and automation (ICRA), pp. 8863-8869. IEEE, 2020. +Justin Kerr, Huang Huang, Albert Wilcox, Ryan Hoque, Jeffrey Ichnowski, Roberto Calandra, and Ken Goldberg. Self-supervised visuo-tactile pretraining to locate and follow garment features. arXiv preprint arXiv:2209.13042, 2022. +Prannay Khosla, Piotr Teterwak, Chen Wang, Aaron Sarna, Yonglong Tian, Phillip Isola, Aaron Maschinot, Ce Liu, and Dilip Krishnan. Supervised contrastive learning. Advances in neural information processing systems, 33:18661-18673, 2020. + +Mike Lambeta, Po-Wei Chou, Stephen Tian, Brian Yang, Benjamin Maloon, Victoria Rose Most, Dave Stroud, Raymond Santos, Ahmad Byagowi, Gregg Kammerer, et al. Digit: A novel design for a low-cost compact high-resolution tactile sensor with application to in-hand manipulation. IEEE Robotics and Automation Letters, 5(3):3838-3845, 2020. +Mike Lambeta, Tingfan Wu, Ali Sengul, Victoria Rose Most, Nolan Black, Kevin Sawyer, Romeo Mercado, Haozhi Qi, Alexander Sohn, Byron Taylor, Norb Tydingco, Gregg Kammerer, Dave Stroud, Jake Khatha, Kurt Jenkins, Kyle Most, Neal Stein, Ricardo Chavira, Thomas Craven-Bartle, Eric Sanchez, Yitian Ding, Jitendra Malik, and Roberto Calandra. Digitizing touch with an artificial multimodal fingertip, 2024. URL https://arxiv.org/abs/2411.02479. +Yunzhu Li, Jun-Yan Zhu, Russ Tedrake, and Antonio Torralba. Connecting touch and vision via cross-modal prediction. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 10609-10618, 2019. +Sandra Q Liu and Edward H Adelson. Gelsight fin ray: Incorporating tactile sensing into a soft compliant robotic gripper. In 2022 IEEE 5th International Conference on Soft Robotics (RoboSoft), pp. 925-931. IEEE, 2022. +Kei Ota, Siddarth Jain, Mengchao Zhang, and DeVesh K Jha. Tactile pose feedback for closed-loop manipulation tasks. In Robotics: Science and Systems workshop, 2023. +Matt Pharr, Wenzel Jakob, and Greg Humphreys. Physically based rendering: From theory to implementation. MIT Press, 2023. +Yuki Shirai, Devesh K Jha, Arvind U Raghunathan, and Dennis Hong. Tactile tool manipulation. arXiv preprint arXiv:2301.06698, 2023. +Ian H Taylor, Siyuan Dong, and Alberto Rodriguez. Gelslim 3.0: High-resolution measurement of shape, force and slip in a compact tactile-sensing finger. In 2022 International Conference on Robotics and Automation (ICRA), pp. 10781-10787. IEEE, 2022. +Yonglong Tian, Dilip Krishnan, and Phillip Isola. Contrastive multiview coding. In Computer Vision-ECCV 2020: 16th European Conference, Glasgow, UK, August 23-28, 2020, Proceedings, Part XI 16, pp. 776-794. Springer, 2020. +Shaoxiong Wang, Yu She, Branden Romero, and Edward Adelson. Gelsight wedge: Measuring high-resolution 3d contact geometry with a compact robot finger. In 2021 IEEE International Conference on Robotics and Automation (ICRA), pp. 6468-6475. IEEE, 2021. +Zhengtong Xu, Raghava Uppuluri, Xinwei Zhang, Cael Fitch, Philip Glen Crandall, Wan Shou, Dongyi Wang, and Yu She. Unit: Unified tactile representation for robot learning. arXiv preprint arXiv:2408.06481, 2024. +Fengyu Yang, Chenyang Ma, Jiacheng Zhang, Jing Zhu, Wenzhen Yuan, and Andrew Owens. Touch and go: Learning from human-collected vision and touch. arXiv preprint arXiv:2211.12498, 2022. +Fengyu Yang, Chao Feng, Ziyang Chen, Hyoungseob Park, Daniel Wang, Yiming Dou, Ziyao Zeng, Xien Chen, Rit Gangopadhyay, Andrew Owens, et al. Binding touch to everything: Learning unified multimodal tactile representations. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 26340-26353, 2024. +Wenyan Yang, Alexandre Angleraud, Roel S Pieters, Joni Pajarinen, and Joni-Kristian Kämäräinen. Seq2seq imitation learning for tactile feedback-based manipulation. arXiv preprint arXiv:2303.02646, 2023. +Wenzhen Yuan, Siyuan Dong, and Edward H Adelson. Gelsight: High-resolution robot tactile sensors for estimating geometry and force. Sensors, 17(12):2762, 2017a. +Wenzhen Yuan, Shaoxiong Wang, Siyuan Dong, and Edward Adelson. Connecting look and feel: Associating the visual and tactile properties of physical materials. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 5580-5588, 2017b. + +Wenzhen Yuan, Yuchen Mo, Shaoxiong Wang, and Edward H. Adelson. Active clothing material perception using tactile sensing and deep learning. In 2018 IEEE International Conference on Robotics and Automation (ICRA), pp. 4842-4849, 2018. doi: 10.1109/ICRA.2018.8461164. +Martina Zambelli, Yusuf Aytar, Francesco Visin, Yuxiang Zhou, and Raia Hadsell. Learning rich touch representations through cross-modal self-supervision. In Conference on Robot Learning, pp. 1415-1425. PMLR, 2021. +Jialiang Zhao and Edward H Adelson. Gelsight svelte: A human finger-shaped single-camera tactile robot finger with large sensing coverage and proprioceptive sensing. In 2023 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS), pp. 8979-8984. IEEE, 2023. +Jialiang Zhao, Yuxiang Ma, Lirui Wang, and Edward H Adelson. Transferable tactile transformers for representation learning across diverse sensors and tasks. arXiv preprint arXiv:2406.13640, 2024. + +# A APPENDIX + +# A.1 IMPLEMENTATION DETAILS + +This section outlines the detailed implementation steps, including pre-processing, architecture, training settings, and decoder choices for all models. + +# A.1.1 PRE-PROCESSING + +For SITR, we apply the following pre-processing steps across real and simulated sensors: + +1. All input images are resized to $224 \times 224$ . For the GelSight Wedge sensor, an affine transformation is applied to correct distortions in the tactile images. +2. Batched data augmentations are applied during training to both the tactile input and calibration images, including color jitter and Gaussian blur. +3. Background subtraction is performed on each image to isolate the tactile signal. All images are then normalized based on the mean and standard deviation calculated from the simulated dataset. + +# A.1.2 ARCHITECTURE + +Encoders: Table 3 shows the number of parameters used in each encoder. + +
ModelNumber of Parameters
ViT-Base86M
ViT-Large307M
T3-Medium173M
UniT25M
SITR (Ours)96M
+ +Table 3: Comparison of model parameters. + +Our SITR model is derived from the ViT-Base architecture. The key modification is in the patch embedding, where we tokenize the tactile input and calibration images separately and add a positional embedding before passing them through the transformer. + +SITR Training Decoders: During the pre-training phase for SITR, we use two decoders: + +- Normal Map Reconstruction Decoder: We apply a simple linear projection to the output tactile image tokens from SITR. We reshape and unpatchify the output to create a feature image map. We supervise with MSE loss $\lambda_{\mathrm{normal}}$ against the ground truth normal map. +- Class Token Decoder: The class token is passed through a linear projection to a 128-dimensional embedding. We then supervise this embedding with SCL loss $\lambda_{\mathrm{SCL}}$ . +- Loss Terms The total loss during training is a weighted sum of these two loss terms: $\mathcal{L} = \lambda_{\mathrm{normal}} \cdot \mathcal{L}_{\mathrm{normal}} + \lambda_{\mathrm{SCL}} \cdot \mathcal{L}_{\mathrm{SCL}}$ . We set both loss weighting hyperparameters $\lambda_{\mathrm{normal}}$ and $\lambda_{\mathrm{SCL}}$ to 1. + +Downstream Task Decoders: We try several decoders for downstream tasks for each baseline and task and report the best-performing ones here. + +1. Classification Decoders We use Cross Entropy Loss for this task. + +- SITR: We unpatchify the output tokens $x_{i}$ to a feature map and pass it through a ResNet-18 network. The resulting feature vector is concatenated with the class token $z_{i}$ . We then apply a 3-layer MLP decoder with dimensions [256, 128, 16]. The SITR encoder is frozen during this process. + +- ViT: For all ViT encoders, we linearly project the class token to an output of 16 dimensions. We also find that unfreezing the ViT pre-trained weights during training improves performance. +- T3: We unpatchify the output tokens to a feature map and pass it through a ResNet-18 network with an output dimension of 16. The T3 encoder is frozen for this process. +- UniT: We directly apply their proposed pooling and MLP decoder blocks to an output dimension of 16. We find that unfreezing the UniT encoder provides better results. + +# 2. Pose Estimation Decoders We use MSE loss for this task. + +- SITR: We pass 2 tactile images $x_{1}$ and $x_{2}$ into the network separately. We unpatchify the output tokens from $x_{1}$ and $x_{2}$ and concatenate their feature maps. We pass the concatenated feature maps into a modified ResNet-18 with a 6-channel input. We then linearly project the resulting feature vector to an output dimension of 3. The SITR encoder is frozen during this process. +- ViT: For all ViT encoders, we pass 2 tactile images $x_{1}$ and $x_{2}$ into a modified ViT network allowing 6 channel input. We then linearly project the resulting class token to an output dimension of 3. We unfreeze the ViTs when training. +- T3: We follow the same procedure described in SITR's pose estimation decoder. 2 tactile images $x_{1}$ and $x_{2}$ are passed into the network separately. We unpatchify the output tokens from $x_{1}$ and $x_{2}$ and concatenate their feature maps. We pass this feature into a modified ResNet-18 and linearly project the resulting feature vector to an output dimension of 3. We keep the T3 encoder frozen during this training process. + +A.2 SIMULATED DATASET + +
ParameterLower boundUpper boundLower bound vis.Upper bound vis.Lower bound env.Upper bound env.
Light shapepointarea
Light orientationsidescorners
Light angle5°30°
Light colorrandrand
Gel stiffnesslowhigh
Gel specularitylowhigh
Camera FOV40°90°
Sensing area4cm216cm2
+ +Table 4: Visualization of parameter bounds in the simulated dataset. + +As discussed in Section 4.1, we construct a large-scale simulated dataset that includes a wide range of tactile sensor configurations. Figure 9 illustrates a sample of tactile images from different simulated sensor configurations and contact geometry within the dataset. The samples can be retrieved from our dataset with the sensor IDs and contact IDs provided. + +![](images/43d8beee460d9f6e5000f5a10a0640519cd7ad3ab5b48365604e52fa98639223.jpg) +Figure 9: Samples from the simulation dataset. + +# A.3 CLASSIFICATION DATASET SAMPLES + +Figure 10 and 11 show the real-world classification dataset that we used to generate the result discussed in Section 5.3. Each row corresponds to a different object class, and each column represents a different sensor. + +![](images/b35ee03e92ed503515a0b9661b68e3b237dc3936c5ebcc81afc380534ac6b145.jpg) +Figure 10: Samples from the classification dataset. (Part 1) + +![](images/e2c33702ddc9adaf5b7f114644f19b4615ef5d9680d928d7425e2ba809336fb7.jpg) +Figure 11: Samples from the classification dataset. (Part 2) + +# A.4 POSE ESTIMATION DATASET SAMPLES + +Figure 12 shows the real-world classification dataset that we used to generate the result discussed in Section 5.4. Each row corresponds to a different object class, and each column represents a different sensor. + +![](images/21ec8621b357d4124194b257e9119f44e932b1949a80748e9119cf8375326e94.jpg) +Figure 12: Samples from pose estimation dataset. + +Figure 13 shows the modified Ender-3 3D printer. We mount indentors and collect the pose estimation dataset for multiple sensors. + +![](images/88dad91bef23556ecf0217be5cd1df2615a56b2f9345ae7d2ec10ca68176abce.jpg) +Figure 13: Modified Ender-3 Pro 3D printer + +# A.5 TRANSFERABILITY DETAILS + +In this section, we present the full results of the sensor transfer downstream experiments. Details of experiments can be found in Section 5.3 and 5.4. Figure 14 and 15 show the classification results and Figure 16 shows pose estimation results. + +# A.5.1 CLASSIFICATION + +![](images/170e48639fd07dae16a83cb3d379d62c8984baf1e4a23392eb87ac0505d3fc58.jpg) +(a) ViT-Base Scratch Intra-sensor + +![](images/1f6da677ffab9697f89ae6b80d53b40376f2b9ff40ee43554e48d6f3c290db57.jpg) +(b) ViT-Base Scratched Inter-sensor + +![](images/0a9f0ade3617b1cccd80aae430c33696fc194c2078a8c8f317984372b5bee152.jpg) +(c) ViT-Base Pre-trained Intra-sensor + +![](images/11604772c4c104bd670a8d7c2a2a63a66d8f10d03a5d8a4db00d0485d18aa7ef.jpg) +(d) ViT-Base Pre-trained Inter-sensor + +![](images/fed9c55926dced27200e65d3b6bd73614d95359d8808f74e66f469bc4ab66707.jpg) +(e) ViT-Large Pre-trained Intra-sensor +Figure 14: Transferability on classification tasks. (Part 1) + +![](images/80eb2116999ca9e223baf425379e4d479868f5cc518bb46178f9e82c066b3986.jpg) +(f) ViT-Large Pre-trained Inter-sensor + +![](images/971a4756305c977181542e998e5baa3a8f26f62c3f99a276a0693cee1c98c9fd.jpg) +(a) T3 Intra-sensor + +![](images/2506765c132f24ee3128ab5de31d8e75a35ad3f17987e9934af41167b0cea69d.jpg) +(b) T3 Inter-sensor + +![](images/eb06e52c3f72d44fa990f43f468bf2dd71d5b3baebd751410ada38d39d558a81.jpg) +(c) UniT Intra-sensor + +![](images/61c9541489af141d07ad5b0bb03c54003bd489205d41a4316ba14780447fc457.jpg) +(d) SITR Intra-sensor +Figure 15: Transferability on classification tasks. (Part 2) + +![](images/115a44daa689215eb84b5e93a673d6406ed71cd0ec9ab5ccb1dacf859606436e.jpg) +(e) SITR Inter-sensor + +# A.5.2 POSE ESTIMATION + +![](images/79eaec7aefa21c7449764fdb227e5f73d29779c1911ef15f23d0c7a71efd8eaa.jpg) +(a) ViT-Base Scratch Inter-sensor + +![](images/768deace2ed4cc0ea1cf5d1f14760aa4f94f4b17ed3720780b36f0a039d5191d.jpg) +(b) ViT-Base Pre-trained Inter-sensor + +![](images/f887e072822718a334e64a844e1bffd0bba8848da6c2335d7080e6e59b8c0b32.jpg) +(c) ViT-Large Pre-trained Inter-sensor + +![](images/a86dd4081bee74ba3d28b7ad14b5075427d2aca66edd367d5171870eed0d9b52.jpg) +(d) T3 Inter-sensor + +![](images/716fb11cd2ffb091ec639641ef613d88cc7ba4ab5f9a67151c994745a2f576b5.jpg) +(e) SITR Inter-sensor +Figure 16: Transferability on pose estimation tasks. + +# A.6 ADDITIONAL ABLATIONS + +This section presents ablation experiments to evaluate the impact of loss terms, alternative supervision signals, and dataset size on SITR's performance. + +# A.6.1 CONTRIBUTION OF LOSS TERMS + +We conduct an ablation study to evaluate the contributions of the normal map loss and SCL loss to SITR's performance. As shown in Table 5, either loss term independently serves as an effective supervision signal. However, their combination yields the strongest results. This evaluation is conducted on the dataset visualized in Figure 6, further highlighting how these two loss terms synergize to improve representation learning. + +
MethodClassification (%)
Normal loss only84.21 ± 14.01
SCL loss only78.86 ± 18.72
Normal + SCL losses91.43 ± 9.88
+ +# A.6.2 CHOICE OF SUPERVISION SIGNAL + +There are alternative supervisions to our normal map, such as using MAE or VQGAN to reconstruct tactile images, as employed in T3 and UniT. To evaluate the effectiveness of SITR, we adapt these supervisions to train representations using our simulated dataset. We evaluate the models' transferability as described in Section 5.3 and Section 5.4. SITR consistently outperforms MAE and VQGAN, highlighting the benefits of SITR's architecture and training pipeline. + +Table 5: Ablation study showing the impact of different loss terms on classification accuracy transferability. + +
MethodClassification (%)Pose estimation (mm)
Intra-sensor set ↑Inter-sensor set ↑Inter-sensor set ↓
MAE45.81 ± 21.4426.46 ± 19.541.13 ± 0.19
VQGAN59.41 ± 19.5031.02 ± 22.011.18 ± 0.14
SITR (Ours)90.23 ± 8.1681.94 ± 12.920.80 ± 0.21
+ +# A.6.3 EFFECT OF SIMULATION DATASET SIZE + +We evaluate how the size of the simulation dataset and the variety of sensor configurations impact classification transfer performance on inter-set classification. Table 7 shows that increasing the number of samples per sensor and the number of sensor variations lead to increases in performance. This demonstrates the benefit of a diverse and large-scale training dataset. + +Table 6: Comparison of MAE, VQGAN, and SITR performance on intra-sensor and inter-sensor classification tasks (\%) and inter-sensor pose estimation (mm) + +
Sensor VariationsSamples per sensor
1K5K10K
1045.82 ± 21.1257.00 ± 21.5561.44 ± 22.81
5055.86 ± 25.0468.55 ± 11.9676.78 ± 13.91
10062.85 ± 16.4573.71 ± 14.2781.94 ± 12.92
+ +Table 7: Transfer classification accuracy (%) on the inter-set dataset across different sensor variations and samples per sensor. \ No newline at end of file diff --git a/ICLR/2025/Sensor-Invariant Tactile Representation/images.zip b/ICLR/2025/Sensor-Invariant Tactile Representation/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..05c606aef4b5492132439015538a38477096d95f --- /dev/null +++ b/ICLR/2025/Sensor-Invariant Tactile Representation/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ea57a1fed4a266332e55ba00a0f4ab2d21cfbd2d4acdcf13a370f7bc1d2bdb01 +size 1410526 diff --git a/ICLR/2025/Sensor-Invariant Tactile Representation/layout.json b/ICLR/2025/Sensor-Invariant Tactile Representation/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..bb9b515d4f5a9765fff15b75d397a8b95ec40210 --- /dev/null +++ b/ICLR/2025/Sensor-Invariant Tactile Representation/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c351fdce082dee10fc9682c5fba027f8fcd02b35bf3927efb0207a5c747381d2 +size 581040 diff --git a/ICLR/2025/Separation Power of Equivariant Neural Networks/aa88d010-a9b2-49c3-af65-2d41268dd4b8_content_list.json b/ICLR/2025/Separation Power of Equivariant Neural Networks/aa88d010-a9b2-49c3-af65-2d41268dd4b8_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..b8474a31ffc1a51a66dc7365a46b7621fd3a64a7 --- /dev/null +++ b/ICLR/2025/Separation Power of Equivariant Neural Networks/aa88d010-a9b2-49c3-af65-2d41268dd4b8_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cd7315f217e9ab1dda30ee00a0bcdb7c39499b562f9af3a0ff02cc244a77c384 +size 276366 diff --git a/ICLR/2025/Separation Power of Equivariant Neural Networks/aa88d010-a9b2-49c3-af65-2d41268dd4b8_model.json b/ICLR/2025/Separation Power of Equivariant Neural Networks/aa88d010-a9b2-49c3-af65-2d41268dd4b8_model.json new file mode 100644 index 0000000000000000000000000000000000000000..2625c5804a00f5805c9f98247f537c03d2b24e44 --- /dev/null +++ b/ICLR/2025/Separation Power of Equivariant Neural Networks/aa88d010-a9b2-49c3-af65-2d41268dd4b8_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d8b94e8f661848ae162ba7af6aaeb0c42d0d49623fcadcd90bc0641d6d199f22 +size 318876 diff --git a/ICLR/2025/Separation Power of Equivariant Neural Networks/aa88d010-a9b2-49c3-af65-2d41268dd4b8_origin.pdf b/ICLR/2025/Separation Power of Equivariant Neural Networks/aa88d010-a9b2-49c3-af65-2d41268dd4b8_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..804e2fadc62c1f36d099a48083b0390d2ae653ad --- /dev/null +++ b/ICLR/2025/Separation Power of Equivariant Neural Networks/aa88d010-a9b2-49c3-af65-2d41268dd4b8_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:75c59652f0a66890ceb0d4827f97f1e2f867d434e7da67eccacf1e8060323fde +size 494311 diff --git a/ICLR/2025/Separation Power of Equivariant Neural Networks/full.md b/ICLR/2025/Separation Power of Equivariant Neural Networks/full.md new file mode 100644 index 0000000000000000000000000000000000000000..6ecc44aa2198e91291c3d70963b90907f90343ff --- /dev/null +++ b/ICLR/2025/Separation Power of Equivariant Neural Networks/full.md @@ -0,0 +1,1602 @@ +# SEPARATION POWER OF EQUIVARIANT NEURAL NETWORKS + +Marco Pacini $^{1,2}$ Xiaowen Dong $^{3}$ Bruno Lepri $^{2}$ Gabriele Santin $^{4}$ + +1University of Trento, 2Fondazione Bruno Kessler, 3University of Oxford, 4University of Venice + +# ABSTRACT + +The separation power of a machine learning model refers to its ability to distinguish between different inputs and is often used as a proxy for its expressivity. Indeed, knowing the separation power of a family of models is a necessary condition to obtain fine-grained universality results. In this paper, we analyze the separation power of equivariant neural networks, such as convolutional and permutation-invariant networks. We first present a complete characterization of inputs indistinguishable by models derived by a given architecture. From this results, we derive how separability is influenced by hyperparameters and architectural choices—such as activation functions, depth, hidden layer width, and representation types. Notably, all non-polynomial activations, including ReLU and sigmoid, are equivalent in expressivity and reach maximum separation power. Depth improves separation power up to a threshold, after which further increases have no effect. Adding invariant features to hidden representations does not impact separation power. Finally, block decomposition of hidden representations affects separability, with minimal components forming a hierarchy in separation power that provides a straightforward method for comparing the separation power of models. + +# 1 INTRODUCTION + +Alongside the proliferation and success of equivariant models (Wood & Shawe-Taylor, 1996; Cohen, 2021; Maron et al., 2018), there has been a growing interest in understanding the fundamental reasons behind their performances, and in assessing their expressive power (Maron et al., 2019a; Yarotsky, 2018). For traditional deep learning approaches, this expressive power is usually quantified in terms of universality (E, 2019), or their ability to approximate any element of a given class of functions to arbitrary precision. However, universality is not directly applicable to neural networks that incorporates invariances of the data (Bronstein et al., 2021), since they necessarily act by identifying pairs of inputs that are equivalent under the given set of transformations. This feature creates a complex interaction between the network's ability to discriminate different input data, and the invariant or equivariant structure that they are trying to preserve. Assessing expressivity thus requires first a fine-grained analysis of the separation power of these families of neural networks, namely their capacity of distinguishing distinct inputs, which is a necessary condition for the universality of the models (Joshi et al., 2023). + +In the graph learning community, which is a paramount domain where invariant and equivariant models are studied (Maron et al., 2018; Puny et al., 2023; Bevilacqua et al., 2022), networks are required to be invariant or equivariant under the group of permutations of the graph's nodes. In this domain, the primary methods for comparing separation power are the Weisfeiler-Leman (WL) isomorphism test (Weisfeiler & Leman, 1968) and homomorphism counting (Lovasz, 2012). Significant attention has been devoted to studying this property for graph learning models such as Graph Neural Networks (GNNs) (Scarselli et al., 2009; Gori et al., 2005; Kipf & Welling, 2017), Invariant Graph Networks (IGNs) (Maron et al., 2018; 2020), and subgraph GNNs (Alsentzer et al., 2020; Bevilacqua et al., 2022). However, the WL test and homomorphism counting, along with their variants, have severe limitations imposed by their combinatorial nature. In particular, recent research (Joshi et al., 2023) has highlighted the necessity of developing expressivity measures applicable to models that process data beyond relational structures, such as geometric graphs. + +In this paper we contribute to this effort by studying the separation power of a more general class of equivariant neural networks, which are not covered by previous results but are of significant practical interest. Namely, we focus on the family of neural networks with regular convolutions (Cohen & Welling, 2016a), i.e., networks with non-polynomial continuous point-wise activations, finite-dimensional representations, and equivariance with respect to the action of finite groups acting on representations as permutations. This class is rich enough to comprise many models of common interest, such as IGNs (Maron et al., 2018), Circular Convolutional Neural Networks (Circular CNNs) (Ravanbakhsh, 2020), and Icosahedral CNNs (Cohen et al., 2019), even if the proposed approach is not able to address some relevant equivariant models such as Clebsh-Gordan or polynomial approaches (Kondor et al., 2018; Puny et al., 2023). + +Specifically, we precisely describe the set of input pairs identified by relevant families of neural networks. In contrast, other approaches, limited to IGNs and graph processing, provide only upper bounds on expressiveness (Geerts, 2020) or lower bounds that require networks with large hidden feature widths (Maron et al., 2019a). Additionally, we show how hyperparameter and architectural choices impact the separation power of equivariant neural network models, both in general settings and in specific cases of practical interest. + +To study the separation power of relevant classes of equivariant networks, we show that the set of identified points corresponds to the set of common zeros of a modified set of networks (Section 5.1). We characterize the set of input pairs identified by these families of neural networks by introducing an explicit formula which, remarkably, is recursive over the networks depth (Section 5.2). This result provides important insights into how different hyperparameters and architectural choices impact the design of practical equivariant neural network models. In particular, we prove that any non-polynomial activation is equivalent in separation power, achieving the maximum separability for networks with a fixed architecture (Section 5.3). We show that increasing depth enhances separation up to a certain depth, where separation power stabilizes (Section 5.4). Furthermore, we prove that the multiplicity of the blocks in hidden representations or, equivalently, the width of invariant hidden features does not affect the separation power of the networks (Section 5.5). We demonstrate that the separation power of different block types forms a hierarchy, corresponding to the partial ordering of sub-groups of the symmetry group with respect to which the model is equivariant (Section 5.6). We illustrate how these general results apply to practical models (Section 6). Specifically, we strengthen existing results by showing that a much broader class of IGNs matches the separation power of WL (Section 6.1). Then, we demonstrate that the separation power of circular CNNs depends on the filter size (Section 6.2). + +All proofs are provided in the Appendix. + +Contributions. Our contributions can be summarized as follows: (i) We address the separation power of equivariant neural networks by fully characterizing the set of points identified by networks with a fixed architecture (Proposition 2 and Theorem 1). (ii) We prove that any continuous, real, element-wise, non-polynomial activation is equivalent in separation power, achieving the maximum separability for networks with a fixed architecture (Theorem 2). (iii) We show that increasing depth enhances separation power up to a specific threshold, beyond which it stabilizes (Theorem 3). (iv) We illustrate how block decomposition of layers influences separability (Theorem 4) and how separation power is independent of invariant hidden features (Remark 1). Notably, this result implies that any $k$ -IGN matches the separation power of $k$ -WL, improving upon previous results that required IGNs to have large hidden feature widths Maron et al. (2019a). (v) Finally, we show that the minimal components from this decomposition form a hierarchy in separation power (Theorem 5). + +# 2 RELATED WORK + +Recently, equivariant deep learning models have gained popularity (Cohen & Welling, 2014; 2016a;b), being successful in diverse fields such as computer graphics (Qi et al., 2017), galaxy morphology prediction (Dieleman et al., 2015), computational biology (Joshi et al., 2024), and computational chemistry (Chanussot et al., 2021). In the case of permutation equivariance, often required in graph learning, the WL test has been adopted as the fundamental tool to measure the expressivity of GNNs (Xu et al., 2019; Morris et al., 2019) and has been used to derive upper bounds (Geerts et al., 2021) and lower bounds (Maron et al., 2019a) on the expressiveness of IGNs and GNNs (Geerts & Reutter, + +2022). Recently, homomorphism counting has been proposed as a more fine-grained measure of expressivity for GNNs (Zhang et al., 2024), capable of assessing the separation power of subgraph GNNs and their variants (Alsentzer et al., 2020; Frasca et al., 2022; Bevilacqua et al., 2022). Other works that are related to the study of neural network separability include specific universality results for equivariant networks (Maron et al., 2019b; Yarotsky, 2018; Zhou, 2020; Ravanbakhsh, 2020; Keriven & Peyré, 2019; Dym & Maron, 2020). Instead, Joshi et al. (2023) addresses the problem of separability by generalizing the WL test from combinatorial structures to geometric graphs. In this paper, we shift from graph and relational domains to the continuous domain, where WL-based approaches are inapplicable, and extend the study of separation power to a broader class of equivariant neural networks not explored in previous research but essential for practical applications. Specifically, we examine neural networks utilizing regular $G$ -convolutions (Cohen & Welling, 2016a). This class encompasses several widely used models, such as IGNs (Maron et al., 2018), Circular CNNs (Ravanbakhsh, 2020), and Icosahedral CNNs (Cohen et al., 2019). + +# 3 THE RELEVANCE OF SEPARABILITY + +# 3.1 SEPARATION-CONSTRAINED UNIVERSALITY + +The universality property of neural networks enables them to approximate any continuous function with arbitrary precision, meaning there exists a sequence of networks that converges pointwise to each continuous function. Equivariant neural networks are designed to handle target functions with specific structures, represented by transformations that recognize equivalent inputs. However, this characteristic necessitates a deeper examination of their separation power. The separation power $\rho(\mathcal{N})$ of a subset $\mathcal{N} \subseteq \mathcal{C}(X,Y)$ of continuous functions between topological spaces $X$ and $Y$ is defined as follows. + +Definition 1. A function $f: X \to Y$ is said to separate two points $\alpha, \beta \in X$ if $f(\alpha) \neq f(\beta)$ . A family of functions $\mathcal{N}$ from $X$ to $Y$ separates $\alpha, \beta \in X$ if there exists a function $f \in \mathcal{N}$ that separates $\alpha$ and $\beta$ . If a function or a family of functions fails to separate two points, we say that it identifies them. The set of pairs of points that are identified by $\mathcal{N}$ defines an equivalence relation + +$$ +\rho (\mathcal {N}) = \left\{(\alpha , \beta) \in X \times X \mid f (\alpha) = f (\beta) \text {f o r e a c h} f \in \mathcal {N} \right\}. \tag {1} +$$ + +When working with spaces of neural networks, which we refer to as neural spaces for brevity, their separation power transfers to the class of functions they can approximate, as shown by the following fact. + +Fact. Let $(f_n)_{n \in \mathbb{N}}$ be a sequence of functions in $\mathcal{N}$ that converges pointwise to $f$ . If $\alpha, \beta \in X$ such that $f_n(\alpha) = f_n(\beta)$ for all $n \in \mathbb{N}$ , then $f(\alpha) = f(\beta)$ . + +In particular, $\mathcal{N}$ cannot approximate with arbitrary precision functions beyond ones respecting $\rho(\mathcal{N})$ , namely, $\mathcal{C}_{\rho(\mathcal{N})}(X,Y) = \{f \in \mathcal{C}(X,Y) \mid f(\alpha) = f(\beta) \forall (\alpha,\beta) \in \rho(\mathcal{N})\}$ . Understanding however if the entire set $\mathcal{C}_{\rho(\mathcal{N})}(X,Y)$ can be approximated leads to the study of separation-constrained universality. + +Notably, Maron et al. (2019b) and Ravanbakhsh (2020) illustrate this phenomenon in the context of equivariant neural networks, which are proven to approximate any continuous equivariant function. However, their constructions involve intermediate representations of impractically large dimensions. In contrast, Geerts (2020) and Maron et al. (2019a) show that permutation equivariant networks commonly used in practice can approximate continuous permutation equivariant functions whose separation power is equivalent to the WL test. + +In this work, we address the problem of characterizing $\rho(\mathcal{N})$ for relevant families of equivariant neural networks, as it is necessary, though not sufficient, to understand separation-constrained universality. Specifically, we focus on how hyperparameter and architecture choices influence separability, as we will discuss in Section 3.2. + +# 3.2 THE EFFECT OF HYPERPARAMETERS ON SEPARABILITY AND UNIVERSALITY + +From a practical viewpoint it is fundamental to understand the hyperparameters and architecture choices that affect the separation or approximation power of families of neural networks. For example, + +IGN's separation and approximation power are influenced by two hyperparameters $(k, w)$ , where $k$ represents the network's relational order and $w$ denotes the width of the final multi-layer perceptron. Informally, Maron et al. (2019b) showed that $\mathrm{IGN} = \cup_{k, w} k - \mathrm{IGN}_w$ is universal for continuous equivariant functions, while Geerts (2020) proved that $k$ -IGN = $\cup_{w} k$ -IGN $_w$ is universal only within the class of equivariant functions in $\mathcal{C}_{k\text{-WL}}(X, Y)$ , the set of continuous equivariant functions with the same separation power as $k$ -WL. This example highlights that, in a general equivariant setting, two types of hyperparameters and architecture choices may exist: (i) those like $k$ , which regulate the separation power and, hence, have a huge impact on approximation power, but also have a significant impact on the required computational resources, and (ii) hyperparameters like $w$ , which do not affect separability but may impact separation-constrained approximation, often with a limited impact on computational resources. In our work, we aim to identify which hyperparameters and architecture choices control separation power, determining which belong to the first category and which may fall into the second. + +# 4 PRELIMINARIES + +# 4.1 GROUPS AND EQUIVARIANCE + +We aim to define functions that are symmetric with respect to specific transformations. Groups, which are particularly useful for computation and technical manipulation, consist of transformations that fulfill certain criteria: the elements can be combined, each element has an inverse, and there is a neutral element with respect to composition. While group theory efficiently studies symmetries and transformations from a purely algebraic perspective, it needs to be adapted to the linear algebra framework required for defining neural networks. Representation theory acts as a dictionary for translating between these two languages, showing how abstract groups can be mapped to sets of matrices that themselves form groups. For an overview, see Appendix A or Fulton & Harris (2004) for a more complete reference. We will primarily focus on permutation representations. Before defining them, we need to introduce additional notation. Let $X$ be a finite set and $G$ a finite group acting on it. Let $\mathbb{R}^X$ denote the set of real-valued functions defined on $X$ . For each $x \in X$ , let $e_x \in \mathbb{R}^X$ be the function that takes the value 1 at $x$ and 0 everywhere else, and note that the set $\{e_x\}_{x \in X}$ forms a basis for $\mathbb{R}^X$ . A permutation representation of $G$ is a linear action of $G$ on $V = \mathbb{R}^X$ such that for each $g \in G$ and $x \in X$ , we have $g(e_x) = e_{gx}$ . Letting $V$ and $W$ be permutation representations of $G$ , we say that a function $\phi : V \to W$ is $G$ -equivariant if $\phi(gv) = g\phi(v)$ for each $v \in V$ and $g \in G$ . We denote by $\operatorname{Hom}(V, W)$ the set of linear maps between $V$ and $W$ , and by $\operatorname{Hom}_G(V, W)$ the subset of $G$ -equivariant linear maps. Similarly, we refer to the set of affine maps between $V$ and $W$ as $\operatorname{Aff}(V, W)$ , and the set of $G$ -equivariant affine maps as $\operatorname{Aff}_G(V, W)$ . Note that $\operatorname{Hom}(V, W)$ , $\operatorname{Aff}(V, W)$ , and their equivariant counterparts are real vector spaces with respect to addition and scalar multiplication. Moreover, Pacini et al. (2024) prove that a map $f \in \operatorname{Aff}(V, W)$ can be uniquely decomposed as $\tau_v \circ \phi$ for some $v \in V$ and $\phi \in \operatorname{Hom}(V, W)$ and it is equivariant if and only if its linear part $\phi$ is equivariant and $v \in W^G = \{v \in W | gv = v \forall g \in G\}$ , the set of $G$ -invariant vectors in $W$ . Thus, we have relevant linear morphisms $\lambda : \operatorname{Aff}_G(V, W) \to \operatorname{Hom}_G(V, W)$ , which projects an affine map onto its linear part, and $\tau : \operatorname{Aff}_G(V, W) \to W^G$ , which projects an affine map onto its translational part. + +# 4.2 EQUIVARIANT NEURAL NETWORKS + +With all the necessary definitions in place, we can now introduce the notion of equivariant neural network. Our study will focus on neural networks that are equivariant with respect to finite groups, have arbitrary point-wise continuous activation functions, and whose representations are permutation representations. + +Definition 2 (Point-wise Activation). Let $\mathbb{R}^X$ be a permutation representation of a group $G$ , and let $\sigma : \mathbb{R} \to \mathbb{R}$ . We define the point-wise activation induced by $\sigma$ as the function $\tilde{\sigma} : \mathbb{R}^X \to \mathbb{R}^X$ such that $\tilde{\sigma} (\sum_{x \in X} \alpha_x e_x) = \sum_{x \in X} \sigma (\alpha_x) e_x$ . We will often abuse notation and refer to $\sigma$ as the activation function as well. + +Definition 3 (Neural Networks and Neural Spaces). Let $G$ be a group and $V_{0},\ldots ,V_{d}$ be permutation representations of $G$ , and let $M_{i}$ be subsets of $\mathrm{Aff}_G(V_{i - 1},V_i)$ for $i = 1,\dots ,d$ . Given $d\geq 2$ , the + +neural space with layers in $M_1, \ldots, M_d$ and activation $\sigma$ is the recursively defined set + +$$ +\mathcal {N} _ {\sigma} (M _ {1}, \ldots , M _ {d}) = \left\{\phi^ {d} \circ \tilde {\sigma} \circ \eta^ {d - 1} \mid \phi^ {d} \in M _ {d}, \eta^ {d - 1} \in \mathcal {N} _ {\sigma} (M _ {1}, \ldots , M _ {d - 1}) \right\}, +$$ + +where $\mathcal{N}_{\sigma}(M_1) = M_1$ . A neural network with layers $M_1, \ldots, M_d$ and activation $\sigma$ is an element $\eta^d \in \mathcal{N}_{\sigma}(M_1, \ldots, M_d)$ . When $M_i = \operatorname{Aff}_G(V_{i-1}, V_i)$ for each $i = 1, \ldots, d$ , we simply write $\mathcal{N}_{\sigma}(V_0, \ldots, V_d)$ instead of $\mathcal{N}_{\sigma}(M_1, \ldots, M_d)$ . + +In Definition 3, we do not impose any additional structure on $M_{i}$ beyond it being a subset of $\operatorname{Aff}_G(V_{i-1}, V_i)$ , although we will primarily consider $M_{i}$ to be a vector subspace. + +We now provide examples of relevant models that align with Definition 3. + +Example 1 (Equivariant Neural Networks). Let $G$ be a group, $V_{i} = \mathbb{R}^{X_{i}}$ be permutation representations of $G$ , and $M_{i} = \mathrm{Aff}_{G}(V_{i - 1},V_{i})$ the full space of equivariant affine maps from $V_{i - 1}$ to $V_{i}$ for each $i = 1,\ldots ,d$ . The neural space $\mathcal{N}_{\sigma}(M_1,\dots ,M_d)$ , or equivalently $\mathcal{N}_{\sigma}(V_0,\dots ,V_d)$ , is the usual space of equivariant neural networks with depth $d$ and representation spaces $V_{i}$ for each $i = 0,\dots ,d$ . + +As discussed in Section 4.1, equivariant affine maps $\mathrm{Aff}_G(V,W)$ can be decomposed into a linear part in $\mathrm{Hom}_G(V,W)$ and a translational part in the invariant subspace $W^G$ , the set of $G$ -invariant vectors of $W$ . In our setting, the symmetry group $G$ is finite, and $W$ is a permutation representation, with its invariant part $W^G$ characterized by the following result. + +Proposition 1. Let $\mathbb{R}^X$ be a permutation representation of $G$ with orbit decomposition $X_1 \sqcup \dots \sqcup X_n$ (see Definition 7 in Appendix A.3), let $Y \subseteq X$ . Define $\mathbb{1}_Y = \sum_{y \in Y} e_y \in \mathbb{R}^X$ . The invariant subspace of $\mathbb{R}^X = \mathbb{R}^{X_1} \oplus \dots \oplus \mathbb{R}^{X_n}$ , consisting of vectors fixed by the action of $G$ , is generated by the basis $\mathbb{1}_{X_1}, \ldots, \mathbb{1}_{X_n}$ . + +With this further characterization, we present detailed examples of equivariant affine maps and neural spaces relevant to machine learning applications, showing how common models can be expressed within this formalism. Furthermore, we will revisit these neural spaces in Section 6, highlighting specific properties related to their separation power. + +Example 2 (Invariant Graph Networks). Invariant Graph Networks of order 2 (2-IGNs) (Maron et al., 2018) are neural network models that ensure equivariance with respect to node ordering, making them particularly effective for graph processing tasks. They process graphs encoded as adjacency matrices $A$ in $\mathbb{R}^{n \times n \times f}$ , where the first two dimensions encode the relational structure, and the third dimension corresponds to the features. In our setting, these matrices are defined as elements in $\mathbb{R}^X \otimes \mathbb{R}^f$ where $X = [n] \times [n]$ and $\mathbb{R}^f$ is the invariant feature space. Each element $\sigma \in G = S_n$ acts on $X$ as $\sigma(i,j) = (\sigma(i), \sigma(j))$ for each $(i,j) \in X$ and trivially on $\mathbb{R}^f$ . To achieve permutation equivariance, the layers of 2-IGNs are maps in $\mathrm{Aff}_{S_n}(\mathbb{R}^X \otimes \mathbb{R}^{f_i - 1}, \mathbb{R}^X \otimes \mathbb{R}^{f_i})$ , and thus their associated neural spaces are $\mathcal{N}_{\sigma}(\mathbb{R}^X \otimes \mathbb{R}^{f_0}, \ldots, \mathbb{R}^X \otimes \mathbb{R}^{f_d})$ . Proposition 10 in Appendix A.4 implies that understanding the structure of $\mathrm{Aff}_{S_n}(\mathbb{R}^X \otimes \mathbb{R}^{f_{i - 1}}, \mathbb{R}^X \otimes \mathbb{R}^{f_i})$ reduces to understanding the structure of $\mathrm{Aff}_{S_n}(\mathbb{R}^X, \mathbb{R}^X)$ , which is completely characterized in Maron et al. (2018) and Pearce-Crump (2023), which states that $\dim \mathrm{Hom}_{S_n}(\mathbb{R}^X, \mathbb{R}^X) = 15$ for $n > 3$ and, in accordance with Proposition 1, bias terms can be described by noting that $X = [n] \times [n]$ splits into two orbits, $X_1 = \{(i,i) | i \in [n]\}$ and $X_2 = \{(i,j) | i \neq j\}$ . Identifying $\mathbb{R}^{[n] \times [n]} = \mathbb{R}^n \otimes \mathbb{R}^n \cong \mathbb{R}^{n \times n}$ , elements in $\mathbb{R}^{X_1}$ correspond to diagonal matrices in $\mathbb{R}^{n \times n}$ , while elements in $\mathbb{R}^{X_2}$ are off-diagonal matrices. In particular, invariant vectors in $\mathbb{R}^{X_1}$ are linear combinations of + +$$ +\mathbb {1} _ {X _ {1}} = \left[ \begin{array}{l l l} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{array} \right] \quad a n d \quad \mathbb {1} _ {X _ {2}} = \left[ \begin{array}{l l l} 0 & 1 & 1 \\ 1 & 0 & 1 \\ 1 & 1 & 0 \end{array} \right]. +$$ + +Then, + +$$ +\operatorname {A f f} _ {S _ {n}} (\mathbb {R} ^ {X}, \mathbb {R} ^ {X}) = \left\{A \mapsto \sum_ {i = 1} ^ {1 5} x _ {i} \phi^ {i} (A) + y _ {1} \mathbb {1} _ {X _ {1}} + y _ {2} \mathbb {1} _ {X _ {2}} \mid x _ {1}, \dots , x _ {1 5}, y _ {1}, y _ {2} \in \mathbb {R} \right\}, +$$ + +where $\phi^1, \ldots, \phi^{15}$ forms a basis of $\mathrm{Hom}_{S_n}(\mathbb{R}^X, \mathbb{R}^X)$ . Furthermore, Maron et al. (2019b) show that 2-IGNs can be generalized to $k$ -IGNs, which employ hidden representation of high order, namely elements in $\mathbb{R}^{[n]^k} \otimes \mathbb{R}^{f_i}$ . + +Example 3 (Circular Convolutional Neural Networks). Circular convolutional filters can be described in the context of permutation representations, as we will demonstrate using the 1-dimensional case for simplicity. Let $X = [n]$ with the cyclic group $G = \mathbb{Z}_n$ acting on it in the standard way, and identify $\mathbb{R}^{[n]} = \mathbb{R}^n$ . Linear maps in $\mathrm{Hom}_{\mathbb{Z}_n}(\mathbb{R}^n,\mathbb{R}^n)$ are circulant matrices $C(x)$ associated with a vector $x = (x_{1},\ldots ,x_{n})\in \mathbb{R}^{n}$ (Davis, 1979). Hence, the linear part and the translational part of a map in $\mathrm{Aff}_{\mathbb{Z}_n}(\mathbb{R}^n,\mathbb{R}^n)$ are written as follows: + +$$ +C (x) = \left[ \begin{array}{c c c c c} x _ {1} & x _ {n} & x _ {n - 1} & \dots & x _ {2} \\ x _ {2} & x _ {1} & x _ {n} & \dots & x _ {3} \\ x _ {3} & x _ {2} & x _ {1} & \dots & x _ {4} \\ \vdots & \vdots & \vdots & \ddots & \vdots \\ x _ {n} & x _ {n - 1} & x _ {n - 2} & \dots & x _ {1} \end{array} \right] a n d y \mathbb {1} _ {X} = y \mathbb {1} _ {[ n ]} = y \left[ \begin{array}{c} 1 \\ \vdots \\ 1 \end{array} \right]. +$$ + +Note that $C(x) = \sum_{i=1}^{n} x_i C(e_i)$ , where $e_1, \ldots, e_n$ is the canonical basis of $\mathbb{R}^n$ . Therefore, since convolutional filters with limited support are more commonly used in practice, it is appropriate to restrict our choice of layers to maps within + +$$ +M ^ {k} = \left\{v \mapsto \sum_ {i = 1} ^ {k} x _ {i} C (e _ {i}) v + y \mathbb {1} _ {[ n ]} \mid x _ {1}, \dots , x _ {k}, y \in \mathbb {R} \right\}, +$$ + +which are the 1-dimensional counterpart of the $k \times k$ 2D convolutional filters widely used in computer vision. In this case, the corresponding neural space will be $\mathcal{N}_{\sigma}(M^{k_1}, \ldots, M^{k_d})$ for appropriate choices of filter sizes $1 \leq k_1, \ldots, k_d \leq n$ . + +To generalize previous examples, we now assume that the layer spaces $M$ , which are subspaces of $\mathrm{Aff}_G(V,\mathbb{R}^X)$ , can be written as + +$$ +M = \left\{v \mapsto \sum_ {i = 1} ^ {k} x _ {i} \phi^ {i} (v) + \sum_ {P \in \mathcal {P}} y _ {P} \mathbb {1} _ {P} \mid x _ {1}, \dots , x _ {k}, y _ {P} \in \mathbb {R} \text {f o r a l l} P \in \mathcal {P} \right\}, +$$ + +where $\phi^1, \ldots, \phi^k$ generate a subspace of $\mathrm{Hom}_G(V, \mathbb{R}^X)$ , and $\mathcal{P}$ is a partition of $X$ , that may either combine several orbits from the orbit partition $X = X_1 \sqcup \dots \sqcup X_n$ into larger subsets, or coincide with the orbit partition itself. For further technical details, we refer the interested reader to Definition 12 in Appendix B.1. + +Now that we have described the structure of layer spaces in detail and explained why neural spaces constructed from these layer spaces more accurately reflect specific architectures used in practice, we can proceed to study the separation power of these neural spaces. + +# 5 MAIN RESULTS + +We begin by describing and formulating the twin network trick in Section 5.1, which serves as the primary tool for converting a separation problem into a zero locus problem, to be addressed informally in Section 5.2. In the subsequent sections, we will explore the implications of this result and how it can be applied to effectively compare the separation power of different neural spaces. + +# 5.1 THE TWIN NETWORK TRICK + +In this section, we introduce the twin network trick, which transforms a network separation problem into a zero locus problem for neural networks. This allows us to apply the recursive techniques for solving zero locus problems developed in Section 5.2. Specifically, a zero locus problem involves identifying all points that are mapped to zero by all networks within a given neural space. + +More precisely, the identification equivalence relation in (1) can be reformulated as the following zero locus problem: $(\alpha ,\beta)\in \rho (\mathcal{N}_{\sigma}(M_1,\ldots ,M_d))$ if and only if + +$$ +\eta (\alpha) - \eta (\beta) = 0 \forall \eta \in \mathcal {N} _ {\sigma} (M _ {1}, \dots , M _ {d}). \tag {2} +$$ + +We observe that (2) reduces to a zero locus problem involving twin networks. The twin network $\overline{\eta}:V\oplus V\to W$ , where $\overline{\eta} (\alpha ,\beta) = \eta (\alpha) - \eta (\beta)$ is itself a neural network with the same depth as $\eta$ but with a different architecture. Namely, $\overline{\eta}\in \mathcal{N}_{\sigma}(\overline{M}_1,\dots ,\overline{M}_{d - 1},M_d^{\prime})$ where we define $M_d^\prime = \{(\alpha ,\beta)\mapsto \phi (\alpha) - \phi (\beta)\mid \phi \in M_d\}$ and $\overline{M}_i = \left\{\overline{\phi}:(\alpha ,\beta)\mapsto (\phi (\alpha),\phi (\beta))\mid \phi \in M_i\right\}$ . Thanks to the definition of the twin network, we can restate the identification problem in Equation 2 as an equivalent zero locus problem, where we aim to find all $\overline{\beta}$ in $V\oplus V$ that satisfy $\overline{\eta} (\overline{\beta}) = 0\forall \overline{\eta}\in \mathcal{N}_{\sigma}(\overline{M}_1,\ldots ,\overline{M}_{d - 1},M_d^{\prime}).$ + +In summary, these observations can be synthesized into the following proposition, which directly links the identification relation to a zero locus. + +![](images/d8c885aedf8b480e82b711ff126d4ec74e092a857be9050316b01445afd9e60d.jpg) +Figure 1: The twin network trick illustrated. Evaluating two copies of $\eta$ on $\alpha$ and $\beta$ , and subtracting the resulting outputs, is equivalent to evaluating the twin network $\overline{\eta}$ on $(\alpha, \beta)$ . + +Proposition 2. For a family $\mathcal{F}$ of functions between a set $V$ and a vector space $W$ , let + +$$ +\mathcal {I} (\mathcal {F}) = \left\{\beta \in V \mid \eta (\beta) = 0 \forall \eta \in \mathcal {F} \right\}. +$$ + +be the zero locus of $\mathcal{F}$ . Then, for any neural space $\mathcal{N}_{\sigma}(M_1,\ldots ,M_d)$ , we have + +$$ +\rho \left(\mathcal {N} _ {\sigma} \left(M _ {1}, \dots , M _ {d}\right)\right) = \mathcal {I} \left(\mathcal {N} _ {\sigma} \left(\bar {M} _ {1}, \dots , \bar {M} _ {d - 1}, M _ {d} ^ {\prime}\right)\right). +$$ + +Our task, then, is to determine the zero locus corresponding to the neural space of twin networks. + +# 5.2 THE CHARACTERIZATION THEOREM + +In the previous sections, thanks to Proposition 2, we have translated the problem of computing the identification relation $\rho(\mathcal{N}_{\sigma}(M_1, \ldots, M_d))$ into the problem of computing the zero locus $\mathcal{I}(\mathcal{N}_{\sigma}(\overline{M}_1, \ldots, \overline{M}_{d-1}, M_d'))$ . More generally, this zero locus can be determined using the recursive formula proposed in Theorem 1. For brevity, we provide an informal version here, and refer the interested reader to Theorem 7 in Appendix B.1 for the complete version. + +We begin by recalling and defining the necessary notation to state Theorem 1. Let $M_{i}$ be vector subspaces of $\mathrm{Aff}_G(\mathbb{R}^{X_{i-1}}, \mathbb{R}^{X_i})$ for $i = 1, \ldots, d$ . Recall that $\lambda(M_d)$ denotes the linear part of $M_d$ , and let $\phi^{d,1}, \ldots, \phi^{d,s_d}$ be linear maps spanning $\lambda(M_d)$ , and recall that $\tau(M_d) = \langle \mathbb{1}_P \rangle_{P \in \mathcal{P}}$ for some partition $\mathcal{P}$ of $X_d$ . Let $\mathcal{Q}$ be another partition of $X_d$ ; if $\mathcal{Q}$ is finer than $\mathcal{P}$ we indicate this relationship as $\mathcal{Q} \leq \mathcal{P}$ . Furthermore, for each $h = 1, \ldots, s_d$ and $k \in X_d$ define the family of partitions of $X_d$ + +$$ +\Psi_ {h, k} = \left\{\mathcal {Q} \leq \mathcal {P} \mid \sum_ {i \in P} \phi_ {k i} ^ {d, h} = 0, \forall P \in \mathcal {Q} \right\}. +$$ + +Let $\pi_i: \mathbb{R}^{X_{d-1}} \to \mathbb{R}$ denote the projection onto the $i$ -th component of $\mathbb{R}^{X_{d-1}}$ for each $i$ in $X_{d-1}$ . For each $i, j \in X_{d-1}$ , define the set $(M_{d-1})_{ij} = \{\phi': x \mapsto \pi_i \phi(x) - \pi_j \phi(x) | \phi \in M\}$ which represents scalar-valued layers obtained as the differences between the $i$ -th and $j$ -th part of the $(d-1)$ -th layer. + +Theorem 1 (Informal). Using the notation defined above, if $\sigma$ is a non-polynomial continuous activation function, the following formula, recursive with respect to the depth $d$ , holds + +$$ +\mathcal {I} \left(\mathcal {N} _ {\sigma} \left(M _ {1}, \dots , M _ {d}\right)\right) = \bigcap_ {h, k} \bigcup_ {\mathcal {Q} \in \Psi_ {h, k}} \bigcap_ {\substack {P \in \mathcal {Q} \\ i, j \in P}} \mathcal {I} \left(\mathcal {N} _ {\sigma} \left(M _ {1}, \dots , M _ {d - 2}, \left(M _ {d - 1}\right) _ {i j}\right)\right). \tag{3} +$$ + +The theorem shows that the zero locus of a neural space of depth $d$ can be recursively computed as a combination of unions and intersections of the zero loci of neural spaces of depth $d - 1$ . At depth 1, the neural space reduces to a subspace of affine maps, and finding its zero locus corresponds to solving a system of linear equations. Although the actual execution of Formula 3 requires superpolynomial time, this recursive approach is particularly useful for deriving key properties of the identification relation, such as the role of activations, depth, and hidden features on the separation power, as detailed in the following sections. + +# 5.3 THE ROLE OF ACTIVATIONS + +The following result shows that the choice of the activation function—and its properties, such as injectivity or monotonicity—is irrelevant to separability, as long as the activation is non-polynomial. + +Theorem 2. Let $\sigma$ and $\tau$ be two continuous activation functions, with $\sigma$ being non-polynomial. Then + +$$ +\rho \left(\mathcal {N} _ {\sigma} \left(M _ {1}, \dots , M _ {d}\right)\right) \subseteq \rho \left(\mathcal {N} _ {\tau} \left(M _ {1}, \dots , M _ {d}\right)\right). +$$ + +If $\tau$ is also non-polynomial, equality holds. Thus, non-polynomial activations not only yield equivalent separability but also achieve maximal separation power. + +Proof outline. The inclusion follows by reconstructing the steps of in the proof of Theorem 1 and applying the first part of Theorem 9. To prove the equality in the case $\tau$ is also non-polynomial, we reduce to solve the equivalent zero-locus problem thanks to Proposition 2. We proceed by induction on $d$ to show that non-polynomial activation functions do not affect the zero-locus. For the base case $d = 1$ , we have $\mathcal{I}(\mathcal{N}_{\sigma}(M_1)) = \mathcal{I}(M_1)$ , which is independent of $\sigma$ . Now, assume as the inductive hypothesis that $\mathcal{I}(\mathcal{N}_{\sigma}(M_1,\ldots ,M_{d - 1}))$ is independent of $\sigma$ for any sequence $M_1,\dots ,M_{d - 1}$ . Additionally, by definition, $h,k$ and $\Psi_{h,k}$ are also independent of $\sigma$ , which proves that none of the terms in the right-hand side of (3) depend on $\sigma$ , thereby completing the proof. + +While non-polynomiality is sufficient for maximal separation, some polynomial activations may also achieve maximal separation power. Identifying these polynomials—or simply some of their properties, such as their degree—remains a complex mathematical problem. For more details, see Kiss & Laczkovich (2014). + +# 5.4 THE ROLE OF DEPTH + +Depth is a key hyperparameter influencing the separation power of neural spaces. Theorem 3 shows that, while adding layers of the same type can initially enhance separation power, this effect stabilizes after a finite number of layers. + +Theorem 3. Let $M_i$ be a subspace of $\mathrm{Aff}_G(V_{i-1}, V_i)$ for each $i = 1, \ldots, d$ . Suppose that $V_{h-1} = V_h$ for some integer $1 \leq h \leq d$ and that $id_{V_h} \in M_h$ . If $\sigma$ is a continuous non-polynomial activation function, then for $m \leq n$ , + +$$ +\begin{array}{l} \rho (\mathcal{N}_{\sigma}(M_{1},\ldots ,M_{h - 1},\underbrace{M_{h},\ldots,M_{h}}_{n t i m e s},M_{h + 1},\ldots ,M_{d}))\subseteq \\ \subseteq \rho (\mathcal {N} _ {\sigma} (M _ {1}, \ldots , M _ {h - 1}, \underbrace {M _ {h} , \ldots , M _ {h}} _ {m t i m e s}, M _ {h + 1}, \ldots , M _ {d})), \\ \end{array} +$$ + +but there exists a repetition threshold $R$ such that for all $n, m \geq R$ the inclusion becomes an equality. + +Proof outline. To prove the first part of the statement, it suffices to show the inclusion for $n = 1$ and $m = 2$ . Moreover, Theorem 2 implies that it is sufficient to prove this inclusion for a single non-polynomial $\sigma$ . Therefore, let $\sigma$ be the ReLU activation function, noting that in this case $\sigma \circ \sigma = \sigma$ ; equivalently $\tilde{\sigma} = \tilde{\sigma} \circ \tilde{\sigma} = \tilde{\sigma} \circ id_{\mathbb{R}^n x_i} \circ \tilde{\sigma}$ . Thus, each neural network $\phi_d \circ \tilde{\sigma} \circ \dots \circ \tilde{\sigma} \circ \phi_1$ in $\mathcal{N}_{\sigma}(M_1, \ldots, M_h, \ldots, M_d)$ can be written as $\phi_d \circ \dots \circ \tilde{\sigma} \circ id_{\mathbb{R}^n x_i} \circ \tilde{\sigma} \circ \dots \circ \tilde{\sigma} \circ \phi_1$ , which is an element of $\mathcal{N}_{\sigma}(M_1, \ldots, M_h, M_h, \ldots, M_d)$ , thereby proving the desired inclusion by applying Lemma 5. The stabilization property can be proved by reducing to the equivalent zero-locus problem and observing that descending sequences of finite intersections and unions of a finite number of sets, as given by Theorem 1, stabilize thanks to Lemma 2. + +The repetition threshold may vary depending on the model and representation. For example, $k$ -IGNs, being equivalent to $k$ -WL, have a repetition threshold proportional to that of $k$ -WL itself (Maron et al., 2019a; Geerts, 2020). In contrast, the following proposition shows an example of stabilization after just one repetition. + +Proposition 3. When the hidden representation spaces are regular representations, stabilization occurs after one layer repetition. Namely, $\rho (\mathcal{N}_{\sigma}(V,\mathbb{R}^{G},\ldots ,\mathbb{R}^{G},\mathbb{R}^{G / H})) = \rho (\mathcal{N}_{\sigma}(V,\mathbb{R}^{G},\mathbb{R}^{G / H}))$ + +# 5.5 THE ROLE OF INTERMEDIATE REPRESENTATIONS + +In this section, we show that if a representation, $V$ can be decomposed as $V' \oplus V''$ , then the separation power of neural spaces with hidden representation $V$ reduces to the combined separation power of two distinct neural spaces with hidden representations $V'$ and $V''$ . In this section, we present Theorem 4, an additional application of Theorem 1, which demonstrates that the identification equivalence relation for neural spaces defined on $V$ is the intersection of those for neural spaces defined on $V'$ and $V''$ . This implies that by decomposing each hidden representation $V$ into a sum of minimal factors, the study of the separation power of general neural spaces can be reduced to analyzing those defined on minimal representations, as will be explored in Section 5.6. + +Theorem 4. Let $\sigma : \mathbb{R} \to \mathbb{R}$ be a continuous non-polynomial activation function, and let $V_0, \ldots, V_d$ be permutation representations with $V_i = V_i' \oplus V_i''$ for some $0 \leq i \leq d$ . Then, + +$$ +\rho \left(\mathcal {N} _ {\sigma} \left(V _ {0}, \dots , V _ {d}\right)\right) = \rho \left(\mathcal {N} _ {\sigma} \left(V _ {0}, \dots , V _ {i} ^ {\prime}, \dots , V _ {d}\right)\right) \cap \rho \left(\mathcal {N} _ {\sigma} \left(V _ {0}, \dots , V _ {i} ^ {\prime \prime}, \dots , V _ {d}\right)\right). +$$ + +Remark 1. Note that if $V_{i}^{\prime} = V_{i}^{\prime \prime}$ , we have + +$$ +\rho \left(\mathcal {N} _ {\sigma} \left(V _ {0}, \dots , V _ {i} ^ {\prime} \oplus V _ {i} ^ {\prime \prime}, \dots , V _ {d}\right)\right) = \rho \left(\mathcal {N} _ {\sigma} \left(V _ {0}, \dots , V _ {i} ^ {\prime}, \dots , V _ {d}\right)\right). \tag {4} +$$ + +As a result, + +$$ +\rho \left(\mathcal {N} _ {\sigma} \left(V _ {0}, \dots , V _ {i} \otimes \mathbb {R} ^ {f}, \dots , V _ {d}\right)\right) = \rho \left(\mathcal {N} _ {\sigma} \left(V _ {0}, \dots , V _ {i}, \dots , V _ {d}\right)\right), +$$ + +since $V_{i} \otimes \mathbb{R}^{f} \cong V_{i}^{\oplus f}$ . Thus, the separability is independent of multiplicity and invariant features in intermediate representations. + +# 5.6 THE ROLE OF REPRESENTATION TYPE + +Thanks to Theorem 4, we can focus on studying the separation power of neural spaces defined on minimal representations. These minimal representations are of the form $\mathbb{R}^X$ , where the group $G$ acts transitively on $X$ . That is, for any pair of points $x, y \in X$ , there exists an element $g \in G$ such that $gx = y$ . Basic group theory (Fulton & Harris, 2004) shows that a set with a transitive action is in bijective correspondence with right cosets $G / H$ for some subgroup $H < G$ , see Definition 6 in Appendix A.2. Informally, the following theorem allows us to compare representations induced by transitive actions arising from certain subgroups. + +Theorem 5. Let $K < H < G$ be finite groups. We have + +$$ +\rho \left(\mathcal {N} _ {\sigma} (V, \dots , \mathbb {R} ^ {G / K}, \dots , W)\right) \subseteq \rho \left(\mathcal {N} _ {\sigma} (V, \dots , \mathbb {R} ^ {G / H}, \dots , W)\right). +$$ + +Proof outline. The proof consists in showing that $\mathbb{R}^{G / H}$ is a sub-representation of $\mathbb{R}^{G / K}$ , and proving that this induces an embedding of $\mathcal{N}_{\sigma}(V,\ldots ,\mathbb{R}^{G / H},\ldots ,W)$ into $\mathcal{N}_{\sigma}(V,\ldots ,\mathbb{R}^{G / K},\ldots ,W)$ . Consequently, the result follows directly from Lemma 5. + +Theorem 5 implies that neural spaces with minimal representations in one layer, namely $\{\mathcal{N}_{\sigma}(V,\ldots ,\mathbb{R}^{G / H},\ldots ,W)\}_{H < G}$ , form a separation power hierarchy corresponding to the hierarchy of subgroups of $G$ . In particular, if $H = G$ , the corresponding representation $\mathbb{R}^{G / G}$ has minimal separation power. Furthermore, notice that $\mathbb{R}^{G / G} \cong \mathbb{R}$ is the trivial representation, and this means that invariant layers have the lowest separation power. On the other hand, if $H = \{e\}$ is the group containing only the identity element, the corresponding representation $\mathbb{R}^{G / \{e\}}$ has maximal separation power, since $\{e\}$ is contained in every subgroup of $G$ . As $\mathbb{R}^{G / \{e\}} \cong \mathbb{R}^{G}$ is the regular representation, this implies that the regular representation achieves the maximum separation power. In general, if $K < H$ , then $\dim \mathbb{R}^{G / H} < \dim \mathbb{R}^{G / K}$ . Hence, improving separability requires working in a larger space, which, aside from ad-hoc optimizations, leads to additional computational cost. In particular, by applying Theorem 1, we can prove the following proposition. + +Proposition 4. The neural space $\mathcal{N}_{\sigma}(V,\mathbb{R}^{G},\mathbb{R}^{G / H})$ of equivariant shallow networks with regular hidden representations identifies inputs if and only if they belong to the same $H$ -orbit, i.e., $(\beta ,\beta^{\prime})\in \rho (\mathcal{N}_{\sigma}(V,\mathbb{R}^{G},\mathbb{R}^{G / H}))$ if and only if there exists some $h\in H$ such that $h\beta = \beta^{\prime}$ . + +This is consistent with the results in Ravanbakhsh et al., which demonstrate that shallow networks with hidden representation blocks isomorphic to $\mathbb{R}^G$ are universal. This universality implies maximal separation power, as stated in Theorem 16 of Joshi et al. (2023). + +# 6 IMPLICATIONS ON PRACTICAL MODELS + +# 6.1 INVARIANT GRAPH NETWORKS + +Theorem 1 in (Maron et al., 2019a) and Theorem 2 in (Geerts, 2020) together imply the following fundamental result for the theory of IGNs. + +Proposition 5. There exist $d > 0$ and a large $F > 0$ such that for hidden feature dimensions $f_{1},\ldots ,f_{d} > F$ , the neural space $\mathcal{N}_{\sigma}((\mathbb{R}^{n})^{\otimes 2}\otimes \mathbb{R}^{f_{0}},(\mathbb{R}^{n})^{\otimes k}\otimes \mathbb{R}^{f_{1}},\ldots ,(\mathbb{R}^{n})^{\otimes k}\otimes \mathbb{R}^{f_{d}},\mathbb{R})$ matches the separation power of $k$ -WL. + +However, Remark 1 shows that the dimension of hidden invariant features does not affect separation power, strengthening Proposition 5 in the following corollary. + +Corollary 1. There exist $d > 0$ such that for any hidden feature dimensions $f_{1},\ldots ,f_{d} > 0$ , the neural space $\mathcal{N}_{\sigma}((\mathbb{R}^{n})^{\otimes 2}\otimes \mathbb{R}^{f_{0}},(\mathbb{R}^{n})^{\otimes k}\otimes \mathbb{R}^{f_{1}},\ldots ,(\mathbb{R}^{n})^{\otimes k}\otimes \mathbb{R}^{f_{d}},\mathbb{R})$ matches the separation power of $k$ -WL. + +# 6.2 CONVOLUTIONAL NEURAL NETWORKS + +The separation power of circular CNNs is influenced by the width of the filter's support. + +Proposition 6. Let $M^k$ be the layer space for circular convolutions with filter size $k$ , as defined in Example 3. Consider the neural space $k$ -CNN $= \mathcal{N}_{\sigma}(M^{k},\mathrm{Aff}_{\mathbb{Z}_{n}}(\mathbb{R}^{n},\mathbb{R}))$ . This is the space associated with shallow convolutional networks, where the first layer consists of one filter of size $k$ followed by an output invariant layer. For $n > 2$ , we have: + +$$ +\rho (n - C N N) \subsetneq \rho (1 - C N N), \quad a n d \quad \rho (n - C N N) \subseteq \dots \subseteq \rho (2 - C N N) \subseteq \rho (1 - C N N). +$$ + +# 7 LIMITATIONS + +The primary limitations of the proposed framework lie within its initial assumptions. Specifically, it only applies to permutation representations and cannot extend to other important equivariant models, such as Clebsch-Gordan or polynomial approaches (Kondor et al., 2018; Puny et al., 2023). While the techniques used to prove Theorem 1 could be applied, the functional equation (12) necessary for the proof is substantially different, and no actionable solution is known up to our knowledge. Solving these equations would improve our understanding of the separation power in these models. The second key assumption is that we consider only intermediate layers with bias, which is standard in many practical models. In cases where bias terms are absent, such as in some GNN models, our model can only provide a bound on the separation power. Indeed, these models can be reformulated as IGNs (Maron et al., 2018), which belong to a broader neural space with bias terms, allowing us to analyze their separation power. Our final assumption involves the use of non-polynomial activation functions, commonly employed with examples like ReLU, tanh, and sigmoid. While non-polynomiality is sufficient for separation, some polynomial activations may also achieve maximal separation power. However, identifying these specific polynomials presents a complex mathematical challenge. For further details, we refer readers to (Kiss & Laczkovich, 2014). + +# 8 CONCLUSIONS + +The proposed results enhance our understanding of which target functions can be approximated with arbitrary precision by functions in neural network spaces relevant to practical applications. In particular, these target functions must satisfy the identification relation of neural networks spaces, which can now be computed using Theorem 1. This result helps us classify hyperparameters and architectural choices into two categories: those that directly influence separation power, significantly impacting both approximation ability and computational cost, and those that do not affect separation power but may influence approximation in a separation-constrained setting, potentially with minimal computational cost. Specifically, we prove that all non-polynomial activations provide maximum separation power, depth enhances separation up to a stabilization point, and hidden feature width has no effect on separation power. Lastly, we show how these insights can be applied to practical models, such as IGNs and standard CNNs. + +# 9 ACKNOLEDGEMENTS + +Bruno Lepri acknowledges the support of the PNRR project FAIR - Future AI Research (PE00000013), under the NRRP MUR program funded by the NextGenerationEU and the support of the European Union's Horizon Europe research and innovation program under grant agreement No. 101120237 (ELIAS). + +# REFERENCES + +Emily Alsentzer, Samuel G. Finlayson, Michelle M. Li, and Marinka Zitnik. Subgraph Neural Networks. In Advances in Neural Information Processing Systems, 2022. +Beatrice Bevilacqua, Fabrizio Frasca, Derek Lim, Balasubramaniam Srinivasan, Chen Cai, Gopinath Balamurugan, Michael M. Bronstein, and Haggai Maron. Equivariant Subgraph Aggregation Networks. In International Conference of Learning Representations, 2022. +Michael M. Bronstein, Joan Bruna, Taco Cohen, and Petar Velicković. Geometric Deep Learning: Grids, Groups, Graphs, Geodesics, and Gauges. arXiv:2104.13478 [cs, stat], 2021. URL http://arxiv.org/abs/2104.13478. +Lowik Chanussot, Abhishek Das, Siddharth Goyal, Thibaut Lavril, Muhammed Shuaibi, Morgane Riviere, Kevin Tran, Javier Heras-Domingo, Caleb Ho, Weihua Hu, Aini Palizhati, Anuroop Sriram, Brandon Wood, Junwooong Yoon, Devi Parikh, C. Lawrence Zitnick, and Zachary Ulissi. Open Catalyst 2020 (OC20) Dataset and Community Challenges. ACS Catalysis, 2021. +Taco Cohen. Equivariant convolutional networks. PhD Thesis, 2021. +Taco Cohen and Max Welling. Learning the Irreducible Representations of Commutative Lie Groups. In Proceedings of the 31st International Conference on Machine Learning, PMLR, 2014. +Taco Cohen and Max Welling. Group Equivariant Convolutional Networks. In Proceedings of The 33rd International Conference on Machine Learning, PMLR, 2016a. +Taco S. Cohen and Max Welling. Steerable CNNs. In International Conference on Learning Representations, 2016b. +Taco S. Cohen, Maurice Weiler, Berkay Kicanaoglu, and Max Welling. Gauge Equivariant Convolutional Networks and the Icosahedral CNN, 2019. In Proceedings of The 36th International Conference on Machine Learning, PMLR, 2019. +Philip J. Davis. Circulant Matrices. Wiley, 1979. +Sander Dieleman, Kyle W. Willett, and Joni Dambre. Rotation-invariant convolutional neural networks for galaxy morphology prediction. Monthly Notices of the Royal Astronomical Society, 2015. +Nadav Dym and Haggai Maron. On the Universality of Rotation Equivariant Point Cloud Networks. In International Conference on Learning Representations, 2020. +Weinan E. Machine Learning: Mathematical Theory and Scientific Applications. Notices of the American Mathematical Society, 2019. +Fabrizio Frasca, Beatrice Bevilacqua, Michael M. Bronstein, and Haggai Maron. Understanding and Extending Subgraph GNNs by Rethinking Their Symmetries. In Advances in Neural Information Processing Systems, 2022. +William Fulton and Joe Harris. Representation Theory. Graduate Texts in Mathematics, Springer, 2004. +Floris Geerts. The expressive power of kth-order invariant graph networks. arXiv:2007.12035 [cs, math, stat], 2020. URL http://arxiv.org/abs/2007.12035. +Floris Geerts and Juan L Reutter. Expressiveness and Approximation Properties of Graph Neural Networks. In International Conference on Learning Representations, 2020. + +Floris Geerts, Thomas Muñoz, Cristian Riveros, and Domagoj Vrgoc. Expressive Power of Linear Algebra Query Languages. In Proceedings of the 40th ACM SIGMOD-SIGACT-SIGAI Symposium on Principles of Database Systems, 2021. +M. Gori, G. Monfardini, and F. Scarselli. A new model for learning in graph domains. In Proceedings 2005 IEEE International Joint Conference on Neural Networks, 2005., 2005. +Chaitanya K. Joshi, Cristian Bodnar, Simon V. Mathis, Taco Cohen, and Pietro Lio. On the Expressive Power of Geometric Graph Neural Networks. In International Conference of Learning Representations, 2023. +Chaitanya K. Joshi, Arian R. Jamasb, Ramon Viñas, Charles Harris, Simon V. Mathis, Alex Morehead, and Pietro Lio. gRNAde: Geometric Deep Learning for 3D RNA inverse design. Methods Mol. Biol. 2025. +Palaniappan Kannappan. Functional Equations and Inequalities with Applications, Springer, 2009. +Nicolas Keriven and Gabriel Peyre. Universal Invariant and Equivariant Graph Neural Networks. In Advances in Neural Information Processing Systems, 2019. +Thomas N. Kipf and Max Welling. Semi-Supervised Classification with Graph Convolutional Networks. In International Conference of Learning Representations, 2017. +Gergely Kiss. Linear functional equations, PhD Thesis, 2014. +Risi Kondor and Shubhendu Trivedi. On the Generalization of Equivalence and Convolution in Neural Networks to the Action of Compact Groups. In Proceedings of the 35th International Conference on Machine Learning, PMLR, 2018. +Risi Kondor, Zhen Lin, and Shubhendu Trivedi. Clebsch-Gordan Nets: a Fully Fourier Space Spherical Convolutional Neural Network, November 2018. In Advances in Neural Information Processing Systems, 2018. +László Lovász. Large Networks and Graph Limits. American Mathematical Society, 2012. +Haggai Maron, Heli Ben-Hamu, Nadav Shamir, and Yaron Lipman. Invariant and Equivariant Graph Networks. In International Conference on Learning Representations, 2018. +Haggai Maron, Heli Ben-Hamu, Hadar Serviansky, and Yaron Lipman. Provably Powerful Graph Networks. In International Conference of Learning Representations, 2019a. +Haggai Maron, Ethan Fetaya, Nimrod Segol, and Yaron Lipman. On the Universality of Invariant Networks. In Proceedings of the 36th International Conference on Machine Learning, PMLR, 2019b. +Haggai Maron, Or Litany, Gal Chechik, and Ethan Fetaya. On Learning Sets of Symmetric Elements. In Proceedings of the 37th International Conference on Machine Learning, PMLR, 2020. +Christopher Morris, Martin Ritzert, Matthias Fey, William L. Hamilton, Jan Eric Lenssen, Gaurav Rattan, and Martin Grohe. Weisfeiler and Leman Go Neural: Higher-Order Graph Neural Networks. In Proceedings of the AAAI Conference on Artificial Intelligence, 2019. +Marco Pacini, Xiaowen Dong, Bruno Lepri, and Gabriele Santin. A Characterization Theorem for Equivariant Networks with Point-wise Activations. In International Conference of Learning Representations, 2024. +Edward Pearce-Crump. Connecting Permutation Equivariant Neural Networks and Partition Diagrams. arXiv:2212.08648 [cs, math, stat], 2023. URL http://arxiv.org/abs/2212.08648. +Omri Puny, Derek Lim, Bobak T. Kiani, Haggai Maron, and Yaron Lipman. Equivariant Polynomials for Graph Neural Networks. In Proceedings of the 40th International Conference on Machine Learning, PMLR, 2023. + +Charles R. Qi, Su, Hao, Mo, Kaichun, and Guibas, Leonidas J. PointNet: Deep Learning on Point Sets for 3D Classification and Segmentation. In 2017 IEEE Conference on Computer Vision and Pattern Recognition (CVPR). +Siamak Ravanbakhsh. Universal Equivariant Multilayer Perceptrons. In Proceedings of the 37th International Conference on Machine Learning, PMLR, 2020. +Siamak Ravanbakhsh, Jeff Schneider, and Barnabás Póczos. Equivariance Through Parameter-Sharing. In Proceedings of the 34th International Conference on Machine Learning, PMLR, 2017. +Franco Scarselli, Marco Gori, Ah Chung Tsoi, Markus Hagenbuchner, and Gabriele Monfardini. The graph neural network model. IEEE Transactions on Neural Networks, 2009. +B Yu Weisfeiler and A A Leman. The Reduction of a Graph to Canonical Form and the Algebra Which Appears Therein. 1968. +Jeffrey Wood and John Shawe-Taylor. Representation theory and invariant neural networks. Discrete Applied Mathematics, 1996. +Keyulu Xu, Weihua Hu, Jure Leskovec, and Stefanie Jegelka. How Powerful are Graph Neural Networks? In International Conference of Learning Representations, 2019. +Dmitry Yarotsky. Universal approximations of invariant maps by neural networks. In Constructive Approximation, 2022. +Bohang Zhang, Jingchu Gai, Yiheng Du, Qiwei Ye, Di He, and Liwei Wang. Beyond Weisfeiler-Lehman: A Quantitative Framework for GNN Expressiveness. In International Conference of Learning Representations, 2024. +Ding-Xuan Zhou. Universality of deep convolutional neural networks. In Applied and Computational Harmonic Analysis, 2020. + +# A PRELIMINARIES + +# A.1 SPACES OF AFFINE TRANSFORMATIONS + +Let $V$ and $W$ be vector spaces, we denote by $\operatorname{Hom}(V, W)$ the set of linear maps between $V$ and $W$ , and $\operatorname{Aff}(V, W)$ the set of affine maps between $V$ and $W$ . Note that both $\operatorname{Hom}(V, W)$ and $\operatorname{Aff}(V, W)$ are real vector spaces with respect to addition and scalar multiplication. For each $v \in W$ define $\tau_v: W \to W$ such as $\tau_v(w) = w + v$ for each $w$ in $W$ . Each affine map $f: V \to W$ has a unique decomposition $\phi = \tau_v \circ \phi$ , where $\phi$ is a linear map and $\tau_v$ is a translation by a vector $v \in W$ . Previous observations imply that the map + +$$ +\theta : \begin{array}{c} \operatorname {H o m} (V, W) \oplus W \to \operatorname {A f f} (V, W) \\ (\phi , v) \mapsto \tau_ {v} \phi \end{array} +$$ + +is an isomorphism of vector spaces. Define $T_W = \{\tau_v \mid v \in W\}$ , as clearly $T_W \cong W$ , we will often abuse notation identifying $T_W$ with $W$ . Then, we can define the maps + +$$ +\lambda : \begin{array}{c} \operatorname {A f f} (V, W) \to \operatorname {H o m} (V, W) \\ f \mapsto f - f (0) \end{array} \quad \text {a n d} \quad \tau : \begin{array}{c} \operatorname {A f f} (V, W) \to W \\ f \mapsto f (0). \end{array} +$$ + +We call $\lambda(f)$ the linear part of $f$ for each $f \in \operatorname{Aff}(V, W)$ and $\tau(f)$ the translational part of $f$ for each affine map. + +Proposition 7. Maps $\lambda$ and $\tau$ are linear and surjective. + +Proof. The projection on the linear part $\lambda$ is linear since for each $\alpha, \beta \in \mathbb{R}$ and $f, g \in \operatorname{Aff}(V, W)$ + +$$ +\begin{array}{l} \lambda (\alpha f + \beta g) = (\alpha f + \beta g) - (\alpha f + \beta g) (0) = \alpha f + \beta g - \alpha f (0) - \beta g (0) = \\ \alpha (f - f (0)) - \beta (g - g (0)) = \alpha \lambda (f) + \beta \lambda (g). \\ \end{array} +$$ + +Furthermore, $\lambda$ is surjective since for each $\phi \in \mathrm{Hom}(V,W)$ , we have that $\lambda (\phi) = \phi -\phi (0) = \phi$ . The projection on the translational part $\tau$ is linear since for each $\alpha ,\beta \in \mathbb{R}$ and $f,g\in \operatorname {Aff}(V,W)$ + +$$ +\tau (\alpha f + \beta g) = (\alpha f + \beta g) (0) = \alpha f (0) + \beta g (0) = \alpha \tau (f) + \beta \tau (g). +$$ + +Map $\tau$ is also surjective since fix $f\in \mathrm{Hom}(V,W)$ and notice that $\tau (\tau_v f) = v$ and $\tau_v f\in \operatorname {Aff}(V,W)$ for each $v\in W$ + +In general, we will be interested in vector sub-spaces $M$ of $\operatorname{Aff}(V,W)$ . A simple way to construct $M$ is to identify sub-spaces of interest $L$ in $\operatorname{Hom}(V,W)$ and subspaces $T$ of $T_{W} \cong W$ and define $M = \theta(L \oplus T)$ . We will be interested only in sub-spaces which are possible to construct in this way. Nevertheless, it is worth noticing there exist sub-spaces of $\operatorname{Aff}(V,W)$ that are not isomorphic through $\theta$ to directed sums of linear and translation parts. An example is given by the space $M = \{\tau_{\alpha v} \circ \alpha \phi \mid \alpha \in \mathbb{R}\}$ . Notice that $\lambda(M) = \{\alpha \phi \mid \alpha \in \mathbb{R}\}$ , $\tau(M) = \{\alpha v \mid \alpha \in \mathbb{R}\}$ , and $\dim M = \lambda(M) = \tau(M) = 1$ . If $M = \theta(\lambda(M) \oplus \tau(M))$ , we should have $1 = \dim M = \dim \lambda(M) + \dim \tau(M) = 2$ , which is not possible. Spaces that can be decomposed as $M = \theta(L \oplus T)$ have the following useful property. + +Proposition 8. Let $M$ be a subspace of $\operatorname{Aff}(V, W)$ , where there exist a subspace $L$ of $\operatorname{Hom}(V, W)$ and a subspace $T$ of $W$ such that $M = \theta(L \oplus T)$ . Let $\phi_1, \ldots, \phi_s$ be a basis for $L$ and $v_1, \ldots, v_n$ a basis for $T$ . Then, each $f$ in $M$ can be written as + +$$ +f: \beta \mapsto \sum_ {i = 1} ^ {s} x _ {i} \phi_ {i} (\beta) + \sum_ {j = 1} ^ {n} y _ {j} v _ {j}, +$$ + +for unique parameters $x_{i}$ and $y_{j}$ for each $i = 1, \ldots, s$ and $j = 1, \ldots, n$ . + +# A.2 GROUP THEORY + +Definition 4. A group is a pair $(G,\cdot)$ where $G$ is a set and $\cdot : G \times G \to G$ is a function satisfying the following axioms. + +- Associativity: for each $g, h, k \in G$ we have $(g \cdot h) \cdot k = g \cdot (h \cdot k)$ . + +- Identity: there exists an element $e \in G$ such that $g \cdot e = e \cdot g = g$ for each $g \in G$ . +- Inverse Element: for each element $g \in G$ , there exists an element $g^{-1} \in G$ such that $g \cdot g^{-1} = g^{-1} \cdot g = e$ . + +A group is finite if it contains a finite number of elements. A group is abelian or commutative if $gh = hg$ for each $g, h \in G$ . + +Example 4. Here we present some fundamental examples of groups. + +- Let $X$ be a set and define the set of permutation of $X$ as + +$$ +\mathcal {S} _ {X} = \{f: X \to X \mid f i s b i j e c t i v e \}. +$$ + +With the composition operation form the symmetric group or the permutation group of $X$ . Particular attention is devoted to the case $X = [n]$ , we write $S_{n} = S_{X}$ and it called symmetric group or the permutation group of $n$ elements. + +- Let $\mathbb{Z}_n$ be the group of integers modulo $n$ with the addition operation, they are called finite cyclic groups of order $n$ . +- Given two groups $G$ and $H$ , the direct product $G \times H$ of them is still a group. The set of the elements is the Cartesian product of $G$ and $H$ while the sum is defined as + +$$ +\left(g _ {1}, h _ {1}\right) \cdot_ {G \times H} \left(g _ {2}, h _ {2}\right) = \left(g _ {1} \cdot_ {G} g _ {2}, h _ {1} \cdot_ {H} h _ {2}\right). +$$ + +Now, we introduce the notion of group homomorphism, a transformation between groups which preserves the operation. + +Definition 5. A group homomorphism is a map + +$$ +\phi : G \to H +$$ + +between $G$ and $H$ groups such that, for each $g,h\in G$ + +$$ +\phi (g \cdot h) = \phi (g) \cdot \phi (h). +$$ + +Definition 6 (Cosets). Let $G$ be a group and $H$ be a subgroup of $G$ . The set of left cosets of $G$ by $H$ is the set $G / H = \{gH \mid g \in G\}$ , where $gH = \{gh \mid h \in H\}$ are the left cosets of $H$ . Similarly, we define the set of right cosets as $H \backslash G = \{Hg \mid g \in G\}$ . Let $K$ be a second subgroup of $G$ , we define the double coset of $H$ and $K$ with respect to an element $g \in G$ as the set $HgK = \{hkg \mid h \in H, k \in K\}$ . The set of double cosets is denoted as $H \backslash G / K$ . + +Example 5. Relevant examples of left cosets include the following: + +1. Consider $G = \mathbb{Z}$ and the subgroup $H = n\mathbb{Z}$ of integers multiples of $n$ . The quotient $G / H$ is a group and is isomorphic to the cyclic group of $n$ elements, $\mathbb{Z}_n$ . +2. Consider $G = S_3$ , the symmetric group on three elements, and the subgroup $H = \{(1), (12)\}$ . The quotient $G / H$ is a group and is isomorphic to $S_2$ , symmetric group on two elements. +3. Consider $G = S_{n}$ , the symmetric group on $n$ elements, and the subgroup $H = A_{n}$ , the alternating group on $n$ elements. The quotient $G / H$ is a group and is isomorphic to $\mathbb{Z}_2$ . + +# A.3 GROUP ACTIONS AND EQUIVARIANT MAPS + +Let $G$ be a group and $X$ be a set. An action of the group $G$ on the set $X$ is a function + +$$ +\Phi : G \times X \to X, +$$ + +usually written as $\phi_g(x) = \Phi(g, x)$ for each $g$ in $G$ and $x$ in $X$ , such that: + +- For the identity element $e$ in $G$ , the identity condition $\phi_e = id_X$ holds. +- For all $g, h \in G$ , the compatibility condition $\phi_g \circ \phi_h = \phi_{gh}$ holds. + +In this context, we often write $g \cdot x$ or simply $gx$ instead of $\phi_g(x)$ . A $G$ -set is a set $X$ equipped with a group action of $G$ . This means that there is a well-defined action $: G \times X \to X$ satisfying the properties of a group action as described above. Throughout the following sections, it will often be convenient to decompose $G$ -sets into a disjoint union of subsets, each minimal (in a sense specified in Definition 7) and equipped with a compatible $G$ -action. + +Definition 7. Let $G$ be a group acting on a set $X$ . An orbit in $X$ is a subset $Y \subseteq X$ such that for each $x \in Y$ , we have $Y = \{g \cdot x \mid g \in G\}$ . The set $X$ can be decomposed into a disjoint union of orbits under the action of $G$ . This is called the orbit decomposition of $X$ , and if $X$ is finite, the decomposition can be written as + +$$ +X = X _ {1} \sqcup \dots \sqcup X _ {n}, +$$ + +where $X_{1},\ldots ,X_{n}$ are the distinct orbits of $X$ + +Another fundamental concept for our treatment is that of a function between $G$ -sets that preserves actions, which is more formally specified in Definition 8. + +Definition 8. Let $X$ and $Y$ be two $G$ -sets, a map $f: X \to Y$ is $G$ -equivariant if + +$$ +g \cdot f (x) = f (g \cdot x) +$$ + +for each $x$ in $X$ . + +# A.4 GROUP REPRESENTATIONS AND EQUIVARIANT AFFINE TRANSFORMATIONS + +Let $G$ be a group and $V$ be a vector space over a field $\mathbb{R}$ . A $G$ -action $\Phi : G \times V \to V$ on $V$ is $G$ -representation if $\phi_g$ is linear for each $g$ in $G$ . Or equivalently, + +$$ +\phi \colon \begin{array}{c} G \to \operatorname {G L} (V) \\ g \mapsto \phi_ {g} \end{array} +$$ + +where $\mathrm{GL}(V)$ is the general linear group of $V$ , consisting of all invertible linear transformations on $V$ . We will usually identify the entire $\Phi : G \times V \to V$ action with $V$ itself and write $gv = \Phi(g, v)$ . + +Let $V$ and $W$ be two $G$ -representations, we will indicate the set of equivariant linear maps between $V$ and $W$ as $\operatorname{Hom}_G(V, W)$ and as $\operatorname{Aff}_G(V, W)$ the set of equivariant affine maps. Note that $\operatorname{Hom}_G(V, W)$ is a vector space. Indeed, $0 \in \operatorname{Hom}_G(V, W)$ and for each $f, g \in \operatorname{Hom}_G(V, W)$ and each $\alpha, \beta \in \mathbb{R}$ , $\alpha f + \beta g \in \operatorname{Hom}_G(V, W)$ . The same is true for $\operatorname{Aff}_G(V, W)$ . + +Let $V$ be a $G$ -representation, we define the set of invariant vectors $V^{G} = \{v \in V \mid gv = v \forall g \in G\}$ . + +In Section A.1 we studied the properties of vector subspaces of affine transformations between vector spaces. Here we are now interested in studying subspaces of equivariant affine transformations. To better understand the structure of such spaces it is necessary to remind Theorem 8 in Pacini et al. (2024). + +Theorem 6. An map $\phi = \tau_w\circ f$ belongs to $\operatorname{Aff}_G(V,W)$ if and if $f\in \operatorname{Hom}_G(V,W)$ and $v$ is invariant. + +We can define restrictions of maps $\theta_G, \lambda_G$ , and $\tau_G$ as follows + +$$ +\theta_ {G} \colon \begin{array}{c} \operatorname {H o m} _ {G} (V, W) \oplus W ^ {G} \to \operatorname {A f f} _ {G} (V, W) \\ (\phi , v) \mapsto \tau_ {v} \phi \end{array} +$$ + +$$ +\lambda_ {G}: \begin{array}{c} \operatorname {A f f} _ {G} (V, W) \to \operatorname {H o m} _ {G} (V, W) \\ f \mapsto f - f (0) \end{array} \quad \text {a n d} \quad \tau_ {G}: \begin{array}{c} \operatorname {A f f} _ {G} (V, W) \to W ^ {G} \\ f \mapsto f (0). \end{array} +$$ + +Theorem 6 implies that $\theta_G$ is an isomorphism and a similar proof to the one of Proposition 7 shows that both $\lambda_G$ and $\tau_G$ are linear, equivariant, and surjective. When it will be clear we are working in the equivariant setting, we will drop the subscript and just write $\theta$ , $\lambda$ , and $\tau$ . + +In the main text we will often use the following results. + +Proposition 9. Let $V_{1}, V_{2}$ , and $V$ be $G$ -representations. Then, + +$$ +\operatorname {H o m} _ {G} \left(V _ {1} \oplus V _ {2}, V\right) = \operatorname {H o m} _ {G} \left(V _ {1}, V\right) \oplus \operatorname {H o m} _ {G} \left(V _ {2}, V\right) +$$ + +and + +$$ +\operatorname {H o m} _ {G} (V, V _ {1} \oplus V _ {2}) = \operatorname {H o m} _ {G} (V, V _ {1}) \oplus \operatorname {H o m} _ {G} (V, V _ {2}). +$$ + +Proposition 10. Let $V$ and $W$ be $G$ -representations, and let $G$ act trivially on $\mathbb{R}^n$ and $\mathbb{R}^m$ . Then, + +$$ +\operatorname {H o m} _ {G} (V \otimes \mathbb {R} ^ {n}, W \otimes \mathbb {R} ^ {m}) \cong \operatorname {H o m} _ {G} (V, W) \otimes \operatorname {H o m} (\mathbb {R} ^ {n}, \mathbb {R} ^ {m}), +$$ + +and + +$$ +(V \otimes \mathbb {R} ^ {n}) ^ {G} \cong V ^ {G} \otimes \mathbb {R} ^ {n}. +$$ + +In other words, recalling that $\mathrm{Aff}_G(V,W)\cong \mathrm{Hom}_G(V,W)\oplus W^G$ and since $\mathrm{Hom}(\mathbb{R}^n,\mathbb{R}^m)\cong \mathbb{R}^{n\times m}$ is the set of $n\times m$ matrices over $\mathbb{R}$ , understanding the structure of $\mathrm{Aff}_G(V\otimes \mathbb{R}^n,W\otimes \mathbb{R}^m)$ reduces to understanding the structure of $\mathrm{Aff}_G(V,W)$ . + +# A.5 ON PERMUTATION REPRESENTATIONS + +The followings are easy and known results from the theory of permutation representations. + +We recall the definition of permutation representations as stated in Section 4.1. + +Definition 9. Let $X$ be a finite set and $G$ a finite group acting on it. A permutation representation of $G$ is a representation of $G$ on $\mathbb{R}^X$ such that $g(e_x) = e_{gx}$ for each $g \in G$ and $x \in X$ . + +Proposition 11. Let $X$ and $Y$ be two $G$ -sets. We have the two following $G$ -representations isomorphisms + +$$ +\mathbb {R} ^ {X \sqcup Y} \cong \mathbb {R} ^ {X} \oplus \mathbb {R} ^ {Y} a n d \mathbb {R} ^ {X \times Y} \cong \mathbb {R} ^ {X} \otimes \mathbb {R} ^ {Y}, +$$ + +where $X \sqcup Y$ indicate the disjoint union of the sets $X$ and $Y$ . + +Example 6. Let $S = [n]$ and let $S_{n}$ act on $S$ in the standard way and note that $\mathbb{R}^S \cong \mathbb{R}^n$ as representations. From Proposition 11, we obtain that tensors of order 2 are $\mathbb{R}^n \otimes \mathbb{R}^n = \mathbb{R}^{S \times S} = \mathbb{R}^{n \times n}$ . Let $\Delta = \{(i,i) \mid i \in S\}$ and $\overline{\Delta} = \{(i,j) \in S \mid i \neq j\}$ , note that $S \times S = \Delta \sqcup \overline{\Delta}$ and that $S_{n}$ acts transitively on both $\Delta$ and $\overline{\Delta}$ . Therefore, $\mathbb{R}^n \otimes \mathbb{R}^n \cong \mathbb{R}^{S \times S} \cong \mathbb{R}^\Delta \oplus \mathbb{R}^\overline{\Delta}$ . + +We say that a group $G$ acts transitively on a set $X$ if this action has only one orbit, namely $Gx = X$ for each $x \in X$ . If $X = X_{1} \sqcup \dots \sqcup X_{n}$ is the orbit decomposition of $X$ , then $\mathbb{R}^{X} \cong \mathbb{R}^{X_{1}} \oplus \dots \oplus \mathbb{R}^{X_{n}}$ . + +As the bias terms of equivariant layers are vectors invariant under the action of permutation representations, it is important to characterize the invariant part of a permutation representation. Before proceeding, it is necessary to state the following result. + +Proposition 12. If $G$ is a finite group acting transitively on a finite set $X$ , then there exists a subgroup $H < G$ and a $G$ -set bijection between $X$ and $G / H$ . + +Proposition 12 implies that we can restrict our study to representations of the form $\mathbb{R}^{G / H}$ for some subgroup $H$ of $G$ . With this result, we can now proceed to prove Proposition 1. Let $G$ be a group and $X$ be a finite set with action of $G$ . For $Y \subseteq X$ , recall that $\mathbb{1}_Y = \sum_{y \in Y} e_y$ . + +Proof of Proposition 1. The Reynolds operator + +$$ +\begin{array}{c} V \longrightarrow V ^ {G} \\ \mathcal {R}: \quad v \mapsto \sum_ {g \in G} g v \end{array} +$$ + +projects each $G$ -representation $V$ on its invariant subspace $V^G$ . In the case $V = \mathbb{R}^{G / H}$ , $e_{kH}$ is an element of the canonical base of $\mathbb{R}^{G / H}$ , + +$$ +\mathcal {R} \left(e _ {k H}\right) = \sum_ {g \in G} g e _ {k H} = \sum_ {g \in G} e _ {g k H} = | H | \sum_ {g H \in G / H} e _ {g H} = | H | \mathbb {1} _ {G / H}. +$$ + +The final observation follows from Proposition 11. + +![](images/a7003c24db76a168445dce142c90ea1177cad4ac000ce63285d37bf0f1aefa00.jpg) + +Propositions 11 and 9 together imply that characterizing equivariant maps between permutation representations reduces to characterizing equivariant maps between representations induced by transitive actions on finite sets, or equivalently, left cosets by Proposition 12. We address this in Proposition 14. To prove this result, we first define the concept of right multiplication in Definition 10 and then prove Proposition 13, which characterizes equivariant maps between regular representations. + +Definition 10. For each $g \in G$ define the right-multiplication + +$$ +\mathcal {R} _ {g}: \begin{array}{l l} & \mathbb {R} ^ {G} \longrightarrow \mathbb {R} ^ {G} \\ & e _ {h} \mapsto e _ {h g ^ {- 1}}. \end{array} +$$ + +Proposition 13. Right actions are a basis for the space of equivariant endomorphisms of the regular representation. In other words, $\{\mathcal{R}_g\}_{g\in G}$ is a basis for $\mathrm{Hom}_G(\mathbb{R}^G,\mathbb{R}^G)$ . + +Proof. Each linear application $\phi \in \mathrm{Hom}(\mathbb{R}^G, \mathbb{R}^G)$ is defined by the values $\phi(e_g)$ for each $g \in G$ by linear extension. If $\phi$ is $G$ -equivariant, it is defined just by its value on $e_e$ . Indeed, $\phi(e_g) = \phi(ge_e) = g\phi(e_e)$ for each $g \in G$ . Note that $\mathcal{R}_g$ is linear as the right action of $g$ on $\mathbb{R}^G$ is linear and $\mathcal{R}_g(e_h) = e_{hg^{-1}} = e_hg^{-1}$ . It is also equivariant, indeed $\mathcal{R}_g(hv) = hvg^{-1} = h\mathcal{R}_g(v)$ for each $v \in \mathbb{R}^G$ and $h \in G$ . Furthermore, $\mathcal{R}_{g^{-1}}(e_e) = e_g$ for each $g \in G$ and therefore they generate $\mathrm{Hom}_G(\mathbb{R}^G, \mathbb{R}^G)$ . + +Suppose that there exist values $a_{g} \in \mathbb{R}$ for each $g \in G$ such that $\sum_{g \in G} a_{g} \mathcal{R}_{g} = 0$ , then + +$$ +0 = \sum_ {g \in G} a _ {g} \mathcal {R} _ {g} \left(e _ {e}\right) = \sum_ {g \in G} a _ {g} e _ {g ^ {- 1}}. +$$ + +Since elements $e_g$ are linearly independent, $a_g = 0$ for each $g \in G$ . Hence, $\mathcal{R}_g$ are linearly independent and form a basis for $\mathrm{Hom}_G(\mathbb{R}^G, \mathbb{R}^G)$ . + +Now we would like to have a result similar to Proposition 13 but for morphisms between $G / K$ and $G / H$ . To do this we need to define the following injection + +$$ +\mathbb {R} ^ {G / H} \to \mathbb {R} ^ {G} +$$ + +$$ +\iota_ {G / H}: e _ {g H} \mapsto \frac {1}{| H |} \sum_ {h \in H} e _ {g h}, +$$ + +and projection + +$$ +\pi_ {G / H}: \begin{array}{c} \mathbb {R} ^ {G} \to \mathbb {R} ^ {G / H} \\ e _ {g} \mapsto e _ {g H}. \end{array} +$$ + +For an arbitrary representation $V$ , we define two surjective maps + +$$ +\iota_ {G / K} ^ {*}: \begin{array}{c} \operatorname {H o m} _ {G} (\mathbb {R} ^ {G}, V) \twoheadrightarrow \operatorname {H o m} _ {G} (\mathbb {R} ^ {G / K}, V) \\ \phi \mapsto \phi \circ \iota_ {G / K}, \end{array} +$$ + +and + +$$ +\pi_ {G / H *} \colon \begin{array}{c} \operatorname {H o m} _ {G} (V, \mathbb {R} ^ {G}) \to \operatorname {H o m} _ {G} (V, \mathbb {R} ^ {G / H}) \\ \phi \mapsto \pi_ {G / H} \circ \phi . \end{array} +$$ + +We can now generalize the concept of right multiplication to the general case of transitive actions, a concept necessary for stating Proposition 14, which we will then prove by following the approach used in the proof of Proposition 13. + +Definition 11. Define $\mathcal{R}_{HgK} = \alpha \mathcal{R}_g$ where the map $\alpha = \pi_{G / H*} \circ \iota_{G / K}^*$ is defined from $\mathrm{Hom}_G(\mathbb{R}^G, \mathbb{R}^G)$ to $\mathrm{Hom}_G(\mathbb{R}^{G / K}, \mathbb{R}^{G / H})$ . + +Proposition 14. The map $\mathcal{R}_{HgK}$ is well-defined and the set $\{\mathcal{R}_{HgK}\}_{HgK\in H\backslash G / K}$ is a basis for $\mathrm{Hom}_G(\mathbb{R}^{G / K},\mathbb{R}^{G / H})$ . Finally, + +$$ +\Big (\mathcal {R} _ {H g K} (e _ {k K}) \Big) _ {s H} = \left\{ \begin{array}{l l} \frac {1}{| K |} & \text {i f s H \subseteq k K g ^ {- 1} H}, \\ 0 & \text {o t h e r w i s e}. \end{array} \right. +$$ + +Proof. To prove that $\mathcal{R}_{HgK}$ is well-defined, we need to prove that $\alpha \mathcal{R}_g = \alpha \mathcal{R}_{hgk}$ for each $h\in H$ and $k\in K$ . Indeed, + +$$ +\begin{array}{l} \pi_ {G / H} \mathcal {R} _ {h g k} \iota_ {G / K} (e _ {s K}) = \frac {1}{| K |} \sum_ {t \in K} e _ {s t k ^ {- 1} g ^ {- 1} h ^ {- 1} H} = \\ \frac {1}{| K |} \sum_ {t \in K} e _ {s t k ^ {- 1} g ^ {- 1} h ^ {- 1} H} = \frac {1}{| K |} \sum_ {t \in K} e _ {s t g ^ {- 1} H} = \pi_ {G / H} \mathcal {R} _ {g} \iota_ {G / K} (e _ {s K}), \\ \end{array} +$$ + +where the penultimate equality is true because $h^{-1}H = H$ and variable change $t\mapsto tk^{-1}$ in the sum. + +By Proposition 13 the set $\{\mathcal{R}_g\}_{g\in G}$ is a basis for $\mathrm{Hom}_G(\mathbb{R}^G,\mathbb{R}^G)$ . By the previous observation we have shown that the image of $\{\mathcal{R}_g\}_{g\in G}$ under $\alpha$ is $\{\mathcal{R}_{HgK}\}_{HgK\in H\backslash G / K}$ . As $\alpha$ is a surjection, $\{\mathcal{R}_{HgK}\}_{HgK\in H\backslash G / K}$ generates $\mathrm{Hom}_G(\mathbb{R}^{G / K},\mathbb{R}^{G / H})$ . + +Proving linear independence is similar to the proof of linear independence in Proposition 13. Indeed, let $a_{HgK} \in \mathbb{R}$ for each $HgK \in H\backslash G / K$ such that + +$$ +\sum_ {H g K \in H \backslash G / K} a _ {H g K} \mathcal {R} _ {H g K} = 0. +$$ + +Hence, + +$$ +0 = \sum_ {H g K \in H \backslash G / K} a _ {H g K} \mathcal {R} _ {H g K} (e _ {K}) = \sum_ {H g K \in H \backslash G / K} \frac {1}{| K |} a _ {H g K} \sum_ {t \in K} e _ {t g ^ {- 1} H}. +$$ + +Note that sets $\{tg^{-1}H\}_{t\in K}$ are pairwise disjoint with $g$ varying between representatives of $HgK$ . This means that the respective vectors $\sum_{t\in K}e_{tg^{-1}H}$ are linearly independent, hence each $a_{HgK} = 0$ . This proves that the maps $\mathcal{R}_{HgK}$ are linearly independent. Finally, observing that + +$$ +\mathcal {R} _ {H g K} (e _ {k K}) = \frac {1}{| K |} \sum_ {t \in K} e _ {k t g ^ {- 1} H}, +$$ + +it is clear that + +$$ +\Big (\mathcal {R} _ {H g K} (e _ {k K}) \Big) _ {s H} = \left\{ \begin{array}{l l} \frac {1}{| K |} & \text {i f s H \subseteq k K g ^ {- 1} H ,} \\ 0 & \text {o t h e r w i s e .} \end{array} \right. +$$ + +Remark 2. In our case of interest, in which $G$ is a finite group, the map $v \mapsto v \cdot w$ is equivalent at convolving $v$ by $w$ . Proposition 14 is just a restatement and integration of Theorem 1 in Kondor & Trivedi (2018) in the restricted case of homogeneous spaces of finite groups. + +# B MAIN RESULTS + +# B.1 THE CHARACTERIZATION THEOREM + +To formally state and prove Theorem 1, we need to understand how bias terms in neural spaces transform under the twin network trick. Note that, in general, we have $\tau(\overline{\mathrm{Aff}_G(V,W)}) \subsetneq \tau(\mathrm{Aff}_G(V \oplus V, W \oplus W))$ , as illustrated by the following Example 7. + +Example 7 (Twin Layers in 2-IGNs). Let us consider IGN layers. In this case, $V = W = \mathbb{R}^{X}$ . The twin layer takes and has values in $\mathbb{R}^X \oplus \mathbb{R}^X \cong \mathbb{R}^{X \sqcup X'}$ where $X'$ is a disjoint copy of $X$ . Hence, the twin IGN layer is an affine function $\mathbb{R}^{X \sqcup X'} \to \mathbb{R}^{X \sqcup X'}$ defined as follows: + +$$ +(A, B) \mapsto (L (A), L (B)) + y _ {1} \mathbb {1} _ {X _ {1}} + y _ {2} \mathbb {1} _ {X _ {2}} + y _ {1} \mathbb {1} _ {X _ {1} ^ {\prime}} + y _ {2} \mathbb {1} _ {X _ {2} ^ {\prime}}, \tag {5} +$$ + +where $X_1'$ and $X_2'$ are the copies of $X_1$ and $X_2$ in $X'$ , respectively. Note that they share the same parameter for $\mathbb{1}_{X_1}$ and $\mathbb{1}_{X_1'}$ and for $\mathbb{1}_{X_2}$ and $\mathbb{1}_{X_2'}$ , while the translational part of $\mathrm{Aff}_{S_n}(\mathbb{R}^{X \sqcup X'}, \mathbb{R}^{X \sqcup X'})$ is $y_1\mathbb{1}_{X_1} + y_2\mathbb{1}_{X_2} + y_1'\mathbb{1}_{X_1'} + y_2'\mathbb{1}_{X_2'}$ . Alternatively, we have + +$$ +\dim \tau (\overline {{\mathrm {A f f} _ {S _ {n}} (\mathbb {R} ^ {X} , \mathbb {R} ^ {X})}}) = 2 a n d \dim \tau (\mathrm {A f f} _ {S _ {n}} (\mathbb {R} ^ {X \sqcup X ^ {\prime}}, \mathbb {R} ^ {X \sqcup X ^ {\prime}})) = 4. +$$ + +Hence, + +$$ +\tau \left(\overline {{\operatorname {A f f} _ {S _ {n}} \left(\mathbb {R} ^ {X} , \mathbb {R} ^ {X}\right)}}\right) \subsetneq \tau \left(\operatorname {A f f} _ {S _ {n}} \left(\mathbb {R} ^ {X \sqcup X ^ {\prime}}, \mathbb {R} ^ {X \sqcup X ^ {\prime}}\right)\right). +$$ + +Example 7 shows that we need a definition of bias that can describe the bias terms in (5). This will be provided in Definition 12. + +Definition 12 (Complete Bias). We say that the subspace $M$ of $\operatorname{Aff}_G(V, \mathbb{R}^X)$ has complete bias if $\lambda(M) \oplus \tau(M) \cong M$ through $\theta$ and $\tau(M) = \langle \mathbb{1}_P \rangle_{P \in \mathcal{P}}$ , where $\mathcal{P}$ is a partition of $X$ . In this case, we say that the bias of $M$ is subordinate to the partition $\mathcal{P}$ . In the opposite case, we say that $M$ has incomplete bias. In particular, we say that $M$ has null bias if its translational part $\tau(M)$ is zero; in other words, $M$ is simply a subspace of $\operatorname{Hom}_G(V, \mathbb{R}^X)$ and $M = \lambda(M)$ . + +The following observations are necessary to justify this definition. + +Remark 3. Note that each subspace $M$ of $\operatorname{Aff}_G(V, \mathbb{R}^X)$ such that $M = \lambda(M) \oplus \tau(M)$ and $\tau(M) = \tau(\operatorname{Aff}_G(V, \mathbb{R}^X))$ has complete bias. Indeed, in this case we have $\mathcal{P} = \{X_1, \ldots, X_n\}$ , the $G$ -orbit decomposition of $X$ and + +$$ +\tau (M) = \langle \mathbb {1} _ {X _ {i}} \rangle_ {X _ {i} \in \mathcal {P}} +$$ + +as proven in Proposition 1. Therefore, all examples in Section 4.2 have complete bias. + +Remark 4. Note that each subspace $M$ of $\mathrm{Aff}_G(V,\mathbb{R}^X)$ has complete bias if and only if there exist $\phi_1,\ldots ,\phi_s$ in $\mathrm{Hom}_G(V,\mathbb{R}^X)$ and a partition $\mathcal{P}$ of $X$ such that each map in $M$ can be written as + +$$ +\beta \mapsto x _ {1} \phi_ {1} (\beta) + \dots + x _ {s} \phi_ {s} (\beta) + \sum_ {Y \in \mathcal {P}} y _ {P} \mathbb {1} _ {Y} \tag {6} +$$ + +where $x_{i}$ and $y_{P}$ are real parameters for each $i = 1, \dots, s$ and each $P$ in $\mathcal{P}$ . + +Proposition 15. Let $M_1, \ldots, M_{d-1}$ be subspaces with complete bias, then the space of twin networks + +$$ +\mathcal {N} _ {\sigma} (\overline {{M}} _ {1}, \dots , \overline {{M}} _ {d - 1}, M _ {d} ^ {\prime}) +$$ + +has intermediate layers with complete bias and output layer with null bias. + +The proof of Proposition 15 relies on Proposition 16 and Lemma 1 which will be stated shortly. + +Definition 13. Let $X$ be a finite set, we define the duplicate set of $X$ as the set $X \sqcup X'$ where $X'$ is a disjoint copy of $X$ . Let $\mathcal{P}$ be a partition of $X$ , we define the duplicate partition of $\mathcal{P}$ as the partition $\mathcal{P}'$ of the duplicate of $X$ such that $\mathcal{P}' = \{Y \sqcup Y' \mid Y \in \mathcal{P}\}$ . For each $y \in Y$ , we will usually indicate the respective element in $Y'$ as $y'$ , although when it will be clear from the context we may abuse notation and call both $y$ . + +Proposition 16. If $M$ is a sub-vector space of $\mathrm{Aff}_G(V,\mathbb{R}^X)$ with complete bias subordinate to partition $\mathcal{P}$ then the twin space $\overline{M}$ is a subspace of $\mathrm{Aff}_G(V\oplus V,\mathbb{R}^X\oplus \mathbb{R}^X)\cong \mathrm{Aff}_G(V\oplus V,\mathbb{R}^{X\sqcup X'})$ and has complete bias subordinate to the duplicate partition of $\mathcal{P}$ . In particular, $\dim \tau (\overline{M}) = \dim \tau (M)$ and $\dim \tau (\mathrm{Aff}_G(V\oplus V,\mathbb{R}^X\oplus \mathbb{R}^X)) = 2\dim \tau (\mathrm{Aff}_G(V,\mathbb{R}^X)) = 2\dim \tau (\overline{\mathrm{Aff}_G(V,\mathbb{R}^X)})$ . + +Proof. Trivially, if $M = \lambda(M) \oplus \tau(M)$ , then $\overline{M} = \lambda(\overline{M}) \oplus \tau(\overline{M})$ . Noticing that $\zeta: \mathbb{R}^X \oplus \mathbb{R}^X \cong \mathbb{R}^{X \sqcup X'}$ such that $\zeta((e_x, 0)) = e_x$ and $\zeta((0, e_x)) = e_{x'}$ is an isomorphism. First we show that $\operatorname{Aff}_G(V \oplus V, \mathbb{R}^X \oplus \mathbb{R}^X) \cong \operatorname{Aff}_G(V \oplus V, \mathbb{R}^{X \sqcup X'})$ . If $M$ has complete bias subordinate to $\mathcal{P}$ then $\tau(M) = \langle \mathbb{1}_Y \rangle_{Y \in \mathcal{P}}$ and each $v \in \tau(M)$ can be written as $v = \sum_{Y \in \mathcal{P}} a_Y \mathbb{1}_Y$ for some $(a_Y)_Y \in \mathbb{R}^\mathcal{P}$ . Remember that $\tau(M) = \{\phi(0) | \phi \in M\}$ , then + +$$ +\tau (\bar {M}) = \left\{\left(\phi (0), \phi (0)\right) \mid \phi \in M \right\} = \left\{\left(v, v\right) \mid v \in \tau (M) \right\} = +$$ + +$$ +\left\{\left(\sum_ {Y \in \mathcal {P}} a _ {Y} \mathbb {1} _ {Y}, \sum_ {Y \in \mathcal {P}} a _ {Y} \mathbb {1} _ {Y}\right) \mid (a _ {Y}) _ {Y} \in \mathbb {R} ^ {\mathcal {P}} \right\}. +$$ + +By the isomorphism $\zeta : \mathbb{R}^X \oplus \mathbb{R}^X \cong \mathbb{R}^{X \sqcup X'}$ , we can write $\zeta(\sum_{Y \in \mathcal{P}} a_Y \mathbb{1}_Y, \sum_{Y \in \mathcal{P}} a_Y \mathbb{1}_Y) = \sum_{Y \in \mathcal{P}} a_Y \mathbb{1}_{Y \sqcup Y'}$ . + +Lemma 1. The output space of a twin network $M'$ always has null bias, independently of the bias space $\tau(M)$ . + +Proof. Let $\phi : v \mapsto f(v) + y$ be an affine map in $M < \operatorname{Aff}_G(V, W)$ . Then the output layer of the twin network is + +$$ +\phi^ {\prime} (v, w) = \phi (v) - \phi (w) = f (v) + y - f (w) - y = f (v) - f (w), +$$ + +which is always a linear map in $\mathrm{Aff}_G(V\oplus V,W)$ . Equivalently, $\tau (M^{\prime}) = 0$ + +Proof of Proposition 15. Apply Proposition 16 to $M_1, \ldots, M_{d-1}$ and Lemma 1 to $M_d$ . + +![](images/1807225f9e9008dc54de25bbcf481297c30c1e78a2d192a685a38828dfa01512.jpg) + +Together Remark 3 and Proposition 15 show that we only need to solve zero locus problems for networks with complete bias in the intermediate layers and null bias in the final layer. We are now able to give the complete and formal statement and proof of Theorem 1. + +Theorem 7. Let $M_1, \ldots, M_{d-1}$ have complete bias and let $M_d$ have null bias. Let $\phi^{d,1}, \ldots, \phi^{d,s_d}$ be a set of generators of $M_d < \operatorname{Aff}_G(\mathbb{R}^{X_d}, \mathbb{R}^{X_{d+1}})$ , and let the bias of $M_{d-1}$ be subordinate to the partition $\mathcal{P}$ . Furthermore, for each $h = 1, \ldots, s_d$ and each $k \in X_{d+1}$ define + +$$ +\Psi_ {h, k} = \left\{\mathcal {Q} \leq \mathcal {P} \mid \sum_ {i \in P} \phi_ {k i} ^ {d, h} = 0, \forall P \in \mathcal {Q} \right\}. +$$ + +If $\sigma$ is a non-polynomial activation function, then we have the following recursive formula with respect to network depth + +$$ +\mathcal{I}(\mathcal{N}_{\sigma}(M_{1},\ldots ,M_{d})) = \bigcap_{h,k}\bigcup_{\mathcal{Q}\in \Psi_{h,k}}\bigcap_{\substack{P\in \mathcal{Q}\\ i,j\in P}}\mathcal{I}(\mathcal{N}_{\sigma}(M_{1},\ldots ,M_{d - 2},(M_{d - 1})_{ij})), +$$ + +where $(M_{d - 1})_{ij} = \{\phi^{\prime}:x\mapsto \pi_i\phi (x) - \pi_j\phi (x)|\phi \in \lambda (M_{d - 1})\}$ , $\pi_i:\mathbb{R}^X\to \mathbb{R}$ is the projection on the $i$ th component of $\mathbb{R}^X$ for each $i$ in $X$ , and $\lambda (M_{d - 1})$ is the linear part of $M_{d - 1}$ . + +Proof. Denote $\mathcal{F}_d = \{\phi^{d,1},\dots ,\phi^{d,s_d}\}$ . We can restrict to compute $\mathcal{I}(\mathcal{N}_{\sigma}(M_1,\ldots ,M_{d - 1},\mathcal{F}_d))$ since, by Lemma 7, we know + +$$ +\mathcal {I} (\mathcal {N} _ {\sigma} (M _ {1}, \dots , M _ {d})) = \mathcal {I} (\mathcal {N} _ {\sigma} (M _ {1}, \dots , M _ {d - 1}, \mathcal {F} _ {d})). +$$ + +Each $d$ -layer neural network $\eta^{d,h}$ in $\mathcal{N}_{\sigma}(M_1,\ldots ,M_{d - 1},\mathcal{F}_d)$ can be written, for each input $\beta$ , as + +$$ +\eta^ {d, h} (\beta) = \phi^ {d, h} \tilde {\sigma} \left(\eta^ {d - 1} (\beta) + y\right) \quad \left(\forall h = 1, \dots , s _ {d}\right) \tag {7} +$$ + +where + +- The map $\phi^{d,h}$ is the $h$ -th element in $\mathcal{F}_d$ and is linear since $M_d$ has null bias. +- The the map $\eta^{d - 1}$ is $(d - 1)$ -layer network belonging to $\mathcal{N}_{\sigma}(M_1,\dots ,M_{d - 2},\lambda (M_{d - 1}))$ +- The vector $y$ is a bias term in the translational part of $M_{d - 1}$ , namely the invariant sub-space of $\mathbb{R}^{X_d}$ , and has complete bias subordinate to a partition $\mathcal{Q}$ . Hence, + +$$ +y = \sum_ {P \in \mathcal {Q}} y _ {P} \mathbb {1} _ {P}. \tag {8} +$$ + +In a similar fashion, define $\eta^{d - 1,t}$ in $\mathcal{N}(M_1,\ldots ,M_{d - 1},\lambda (M_{d - 2}))$ for each $t = 1,\dots ,s_{d - 1}$ and some $s_{d - 1}\geq 1$ . Note that, due to Remark 4, + +$$ +\eta^ {d - 1} = \sum_ {t = 1} ^ {s _ {d - 1}} x _ {t} \eta^ {d - 1, t} \tag {9} +$$ + +for some $x_{1},\ldots ,x_{s_{d - 1}}\in \mathbb{R}$ . Therefore, by substituting both (8) and (9) into (7), we get + +$$ +\eta^ {d, h} (\beta) = \phi^ {d, h} \tilde {\sigma} \left(\sum_ {t = 1} ^ {s _ {d - 1}} x _ {t} \eta^ {d - 1, t} (\beta) + y\right). \tag {10} +$$ + +Recall that $\phi^{d,h}$ is a linear map from $\mathbb{R}^{X_d}$ to $\mathbb{R}^{X_{d + 1}}$ , defined by the elements $\phi_{ki}^{d,h} = \phi_k^{d,h}(e_i)$ for each input entry $i\in X_d$ and output entry $k\in X_{d + 1}$ . + +With this notation, we can express (10) in coordinates as follows + +$$ +\eta_ {k} ^ {d, h} (\beta) = \sum_ {i \in X _ {d}} \phi_ {k i} ^ {d, h} \sigma \left(\sum_ {t = 1} ^ {s _ {d - 1}} x _ {t} \eta_ {i} ^ {d - 1, t} (\beta) + y _ {i}\right). \tag {11} +$$ + +For each $i \in X_d$ , let $P$ be the unique element in $\mathcal{Q}$ containing $i$ . Then $y_i = y_P$ , where $y_i$ is the coefficient defined in (11), and $y_P$ is the one defined in (8). + +Hence, we can write (11) as follows + +$$ +\eta_{k}^{d,h}(\beta) = \sum_{\substack{P\in \mathcal{Q}\\ i\in P}}\phi_{ki}^{d,h}\sigma \left(\sum_{t = 1}^{s_{d - 1}}x_{t}\eta_{i}^{d - 1,t}(\beta) + y_{P}\right) +$$ + +for each output entry $k$ in $\mathbb{R}^{X_{d + 1}}$ . + +Thus, an element $\beta$ belongs to $\mathcal{I}(\mathcal{N}_{\sigma}(M_1,\ldots ,M_{d - 1},\mathcal{F}_d))$ if and only if + +$$ +\sum_ {\substack {P \in \mathcal {Q} \\ i \in P}} \phi_ {k i} ^ {d, h} \sigma \left(\sum_ {t = 1} ^ {s _ {d - 1}} x _ {t} \eta_ {i} ^ {d - 1, t} (\beta) + y _ {P}\right) = 0 \tag{12} +$$ + +for each $x_{t},y_{P},h,k,$ and $\eta^{d - 1,t}$ + +Assuming that $\sigma$ is non-polynomial and setting $a_{i} = \phi_{ki}^{d,h}$ and $b_{i} = (\eta_{i}^{d - 1,t}(\beta))_{t}$ , the second part of Theorem 9 implies that $(\eta_i^{d - 1,t}(\beta))_{i,t}$ solves (12) for specific $h$ and $k$ if and only if + +$$ +(\eta_{i}^{d - 1,t}(\beta))_{i}\in \bigcup_{\mathcal{Q}\in \Psi_{h,k}}\bigcap_{\substack{P\in \mathcal{Q}\\ i,j\in P}}\left\{(\eta_{i}^{d - 1,t}(\gamma))_{i}\mid \eta_{i}^{d - 1,t}(\gamma) - \eta_{j}^{d - 1,t}(\gamma) = 0\right\} . +$$ + +Note that $\beta$ satisfies (12) for specific $h$ and $k$ if and only if $(\eta^{d - 1,t}(\beta))_{i,t}$ satisfies it. Hence, + +$$ +\beta \in \bigcup_ {\mathcal {Q} \in \Psi_ {h, k}} \bigcap_ {\substack {P \in \mathcal {Q} \\ i, j \in P}} \left\{\gamma \mid \eta_ {i} ^ {d - 1, t} (\gamma) - \eta_ {j} ^ {d - 1, t} (\gamma) = 0 \forall t \right\}. \tag{13} +$$ + +By the definition of $(M_{d - 1})_{ij}$ , we get + +$$ +\mathcal {I} \left(\mathcal {N} _ {\sigma} \left(M _ {1}, \dots , M _ {d - 2}, \left(M _ {d - 1}\right) _ {i j}\right)\right) = \left\{\beta \mid \eta_ {i} ^ {d - 1, t} (\beta) - \eta_ {j} ^ {d - 1, t} (\beta) = 0 \right\}. +$$ + +Therefore, $\beta$ satisfies (12) for specific $h$ and $k$ if and only if + +$$ +\beta \in \bigcup_{\mathcal{Q}\in \Psi_{h,k}}\bigcap_{\substack{P\in \mathcal{Q}\\ i,j\in P}}\mathcal{I}(\mathcal{N}_{\sigma}(M_{1},\ldots ,M_{d - 2},(M_{d - 1})_{ij})). +$$ + +Since $\beta$ has to satisfy (12) for each $h$ and $k$ , we finally get + +$$ +\mathcal{I}(\mathcal{N}_{\sigma}(M_{1},\ldots ,M_{d})) = \bigcap_{h,k}\bigcup_{\mathcal{Q}\in \Psi_{h,k}}\bigcap_{\substack{P\in \mathcal{Q}\\ i,j\in P}}\mathcal{I}(\mathcal{N}_{\sigma}(M_{1},\ldots ,M_{d - 2},(M_{d - 1})_{ij})). +$$ + +![](images/607311207dfd90940da3c7fb7052a884f798d439018f89443c614869f83e0254.jpg) + +Remark 5. Theorem 1 could actually be stated with different activation functions for each layer, as long as they are all non-polynomial. However, for readability and simplicity, we have presented the results using a single activation function. + +Remark 6. Here, we demonstrate that the complete bias assumption is necessary for all non-polynomial activations to achieve maximal separation power. Specifically, let us examine the separation power of the set of shallow neural networks where all representation spaces are one-dimensional and the hidden layer has a null, and therefore incomplete, bias term. The main concern is the separability of opposite inputs $\beta$ and $-\beta$ . This reduces to study the identification equation + +$$ +y \sigma (\beta x) = y \sigma (- \beta x) +$$ + +for each $x, y \in \mathbb{R}$ . Any even function $\sigma$ , including non-polynomial ones, solves this equation but does not achieve maximal separation power, which could be reached by adding a bias term, as shown in Theorem 2. + +# B.2 THE ROLE OF ACTIVATIONS + +Proof of Theorem 2. We prove that non-polynomial activation functions have equivalent separation power by induction on $d$ . + +If $d = 1$ then $\mathcal{I}(\mathcal{N}_{\sigma}(M_1)) = \mathcal{I}(M_1)$ which does not depend on $\sigma$ . + +Now suppose that $\mathcal{I}(\mathcal{N}_{\sigma}(M_1,\ldots ,M_{d - 1}))$ does not depend on $\sigma$ for each sequence $M_1,\dots ,M_{d - 1}$ . Then, observing (3) + +$$ +\mathcal{I}(\mathcal{N}_{\sigma}(M_{1},\ldots ,M_{d})) = \bigcap_{h,k}\bigcup_{\mathcal{P}\in \Psi_{h,k}}\bigcap_{\substack{P\in \mathcal{P}\\ i,j\in P}}\mathcal{I}(\mathcal{N}_{\sigma}(M_{1},\ldots ,M_{d - 2},(M_{d - 1})_{ij})), +$$ + +we note that $\mathcal{I}(\mathcal{N}_{\sigma}(M_1,\ldots ,M_d))$ is independent of $\sigma$ as indices such as $h,k$ and $i,j$ are independent of $\sigma$ , as well as $\mathcal{I}(\mathcal{N}_{\sigma}(M_1,\dots,M_{d - 2},(M_{d - 1})_{ij}))$ is by inductive hypothesis. + +Finally, the first part of Theorem 2 follows directly from the proof of Theorem 1 and the last part of Theorem 9. + +# B.3 THE ROLE OF DEPTH + +Proof of Theorem 3. To prove the first part of the statement, by Lemma 5, it suffices to show that + +$$ +\mathcal {N} _ {\sigma} \left(M _ {1}, \dots , M _ {i}, \dots , M _ {d}\right) \subseteq \mathcal {N} _ {\sigma} \left(M _ {1}, \dots , \underbrace {M _ {i} , \dots , M _ {i}} _ {n - t i m e s}, \dots , M _ {d}\right). \tag {14} +$$ + +for each $n\geq 1$ + +Moreover, Theorem 2 implies that is enough to prove this inclusion for a fixed non-polynomial $\sigma$ ; then Theorem 3 will hold for any other non-polynomial activation as well. Therefore, let $\sigma$ be the ReLU activation function, noting that in this case $\sigma \circ \sigma = \sigma$ . + +In particular, + +$$ +\tilde {\sigma} = \underbrace {\tilde {\sigma} \circ \tilde {\sigma} \circ \cdots \circ \tilde {\sigma}} _ {n \text {- t i m e s}} = \underbrace {\tilde {\sigma} \circ i d _ {\mathbb {R} ^ {X _ {i}}} \circ \tilde {\sigma} \circ \cdots \circ \tilde {\sigma} \circ i d _ {\mathbb {R} ^ {X _ {i}}}} _ {n \text {- t i m e s}}, +$$ + +for each $n\geq 1$ + +Thus, each neural network $\phi_d\circ \tilde{\sigma}\circ \dots \circ \tilde{\sigma}\circ \phi_1$ in $\mathcal{N}_{\sigma}(M_1,\ldots ,M_i,\ldots ,M_d)$ can be written as + +$$ +\phi_ {d} \circ \tilde {\sigma} \circ \dots \circ \tilde {\sigma} \circ \phi_ {i + 1} \circ \underbrace {\tilde {\sigma} \circ i d _ {\mathbb {R} ^ {X _ {i}}} \circ \tilde {\sigma} \circ \cdots \circ \tilde {\sigma} \circ i d _ {\mathbb {R} ^ {X _ {i}}}} _ {n \text {- t i m e s}} \circ \tilde {\sigma} \circ \phi_ {i - 1} \circ \dots \circ \tilde {\sigma} \circ \phi_ {1} +$$ + +which is an element of $\mathcal{N}_{\sigma}(M_1, \ldots, \underbrace{M_i, \ldots, M_i}_{n\text{-times}}, \ldots, M_d)$ , thereby proving (14). + +The final step is to prove the stabilization property. This is achieved by recalling that, by Proposition 2 and Theorem 1, + +$$ +\mathcal {I} \left(\mathcal {N} _ {\sigma} \left(\bar {M} _ {1}, \dots , \bar {M} _ {d - 1}, M _ {d} ^ {\prime}\right)\right) = \bigcap_ {h, k} \bigcup_ {\mathcal {P} \in \Psi_ {h, k}} \bigcap_ {\substack {P \in \mathcal {P} \\ i, j \in P}} \mathcal {I} \left(\mathcal {N} _ {\sigma} \left(\bar {M} _ {1}, \dots , \bar {M} _ {d - 2}, \left(M _ {d - 1}\right) _ {i j}\right)\right). \tag{15} +$$ + +Define + +$$ +C _ {n} = \mathcal {I} (\mathcal {N} _ {\sigma} (\overline {{M}} _ {1}, \ldots , \underbrace {M _ {i} , \ldots , M _ {i}} _ {n \text {t i m e s}}, \ldots , M _ {d} ^ {\prime})) +$$ + +for each $n \in \mathbb{N}$ . Recursively applying (15), both $C_n$ and $C_m$ can be represented as unions and intersections of elements in the finite set + +$$ +\mathcal {C} = \left\{\mathcal {I} \left(\mathcal {N} _ {\sigma} \left(\bar {M} _ {1}, \dots , \bar {M} _ {i - 1}, \left(\bar {M} _ {i}\right) _ {h k}\right)\right) \right\} _ {h, k \in X _ {i}}. +$$ + +We can reformulate the descending sequence (14) as follows + +$$ +\dots \subseteq C _ {n} \subseteq C _ {n - 1} \subseteq \dots \subseteq C _ {1} +$$ + +which stabilizes due to Lemma 2. + +![](images/648cb76775d02d690244fb31d691455a5cce5941266dc6eaf2287d0ea155be55.jpg) + +Lemma 2. Let $\mathcal{C} = \{C_1, \ldots, C_d\}$ be a finite collection of sets. The following statements are true: + +- Let $\mathcal{C}_{\cup} = \{C_{i_1} \cup \dots \cup C_{i_r} \mid 1 \leq i_1, \ldots, i_r \leq d, r \in \mathbb{N}\}$ be the collection of unions of a finite number of sets in $\mathcal{C}$ . Then $\mathcal{C}_{\cup}$ is finite. +- Let $\mathcal{C}_{\cap} = \{C_{i_1}\cap \dots \cap C_{i_r}\mid 1\leq i_1,\ldots ,i_r\leq d,r\in \mathbb{N}\}$ be the collection of intersections of a finite number of sets in $\mathcal{C}$ . Then $\mathcal{C}_{\cap}$ is finite. +- Let $\tilde{\mathcal{C}}$ the smaller collection containing $\mathcal{C}$ which is closed by intersection and union. Then $\tilde{\mathcal{C}} = (\mathcal{C}_{\cap})_{\cup} = (\mathcal{C}_{\cup})_{\cap}$ and, in particular, is finite. + +In particular, ascending and descending sequences of inclusions in $\tilde{\mathcal{C}}$ stabilize. + +Proof. To prove the first point, it is sufficient to note that duplicates in the expression $C_{i_1} \cup \dots \cup C_{i_r}$ can be removed. Therefore, the cardinality of $\mathcal{C}_{\cup}$ is bounded by the number of possible tuples $i_1, \ldots, i_r$ which are $2^d$ . The proof of the second point is analogous. + +By the distributive property of intersections with respect to unions we obtain that each element in $\tilde{C}$ can be written as + +$$ +\left(C _ {i _ {1, 1}} \cap \dots \cap C _ {i _ {1, d _ {1}}}\right) \cup \dots \cup \left(C _ {i _ {r, 1}} \cap \dots \cap C _ {i _ {r, d _ {r}}}\right). +$$ + +Hence, $\tilde{\mathcal{C}} = (\mathcal{C}_{\cap})_{\cup}$ . Similarly, using the distributive property of unions with respect to intersections, we get $\tilde{\mathcal{C}} = (\mathcal{C}_{\cup})_{\cap}$ . In particular, $\tilde{\mathcal{C}}$ is finite as $\mathcal{C}_{\cup}$ and, hence, $(\mathcal{C}_{\cup})_{\cap}$ are finite. + +The repetition threshold may vary depending on the model and representation. For example, $k$ -IGNs, being equivalent to $k$ -WL, have a repetition threshold proportional to that of $k$ -WL itself (Maron et al., 2019a; Geerts, 2020). In contrast, the Proposition 3 demonstrates an example of stabilization after just one repetition. + +Proof of Proposition 3. From previous observations, we know that + +$$ +\rho \left(\mathcal {N} _ {\sigma} \left(V, \mathbb {R} ^ {G}, \dots , \mathbb {R} ^ {G}, \mathbb {R} ^ {G / H}\right)\right) \subseteq \rho \left(\mathcal {N} _ {\sigma} \left(V, \mathbb {R} ^ {G}, \mathbb {R} ^ {G / H}\right)\right). \tag {16} +$$ + +Note that the family of equivariant continuous functions $\mathcal{C}_G(V,\mathbb{R}^{G / H})$ cannot separate $H$ -orbits in $V$ . Indeed, for each $f\in \mathcal{C}_G(V,\mathbb{R}^{G / H})$ , $f(hv) = hf(v) = f(v)$ for each $h\in H$ . Hence, Proposition 4 implies that $\mathcal{N}_{\sigma}(V,\mathbb{R}^{G},\mathbb{R}^{G / H})$ has the finer separation power between families of functions in $\mathcal{C}_G(V,\mathbb{R}^{G / H})$ . This implies equality in (16), concluding the proof. + +# B.4 THE ROLE OF INTERMEDIATE REPRESENTATIONS + +For now, we focus on developing the notation necessary to state and prove Theorem 4. The structure of our network of interest is as follows: + +$$ +\eta : V \xrightarrow {\phi_ {1}} V _ {1} \xrightarrow {\tilde {\sigma}} \dots \xrightarrow {\phi_ {i}} V _ {i} ^ {\prime} \oplus V _ {i} ^ {\prime \prime} \xrightarrow {\tilde {\sigma}} V _ {i} ^ {\prime} \oplus V _ {i} ^ {\prime \prime} \xrightarrow {\phi_ {i + 1}} \dots \xrightarrow {\tilde {\sigma}} V _ {d} \xrightarrow {\phi_ {d + 1}} W +$$ + +with $\eta \in \mathcal{N}_{\sigma}(M_1,\ldots ,M_d)$ + +To formulate the identification equivalence relation of these networks in terms of the identification relations of simpler architectures with only $V'$ and $V''$ as intermediate representations, we need to define the projection map $\pi': V' \oplus V'' \to V'$ and the immersion map $\iota': V' \to V' \oplus V''$ . Similarly, we can define $\pi''$ and $\iota''$ . Furthermore, for any $G$ -representation $W$ , we define + +$$ +\pi_{*}^{\prime}: \begin{array}{c}\operatorname{Aff}_{G}(W,V^{\prime}\oplus V^{\prime \prime})\to \operatorname{Aff}_{G}(W,V^{\prime})\\ f\mapsto \pi^{\prime}\circ f \end{array} \text{and $\iota^{*}: \begin{array}{c}\operatorname{Aff}_{G}(V^{\prime}\oplus V^{\prime \prime},W)\to \operatorname{Aff}_{G}(V^{\prime},W)\\ f\mapsto f\circ \iota^{\prime} \end{array}$.} +$$ + +Similarly, we define $\pi_{*}^{\prime \prime}$ and $\iota^{\prime \prime *}$ . Let $M$ be a subspace of $\mathrm{Aff}_G(W,V'\oplus V'')$ , its image $\pi_{*}^{\prime}(M)$ is a subspace of $\mathrm{Aff}_G(W,V')$ and + +$$ +M = \pi_ {*} ^ {\prime} (M) + \pi_ {*} ^ {\prime \prime} (M). +$$ + +Indeed, each $f \in M$ can be expressed as $f = \pi' f + \pi'' f = \pi'_*(f) + \pi''_*(f)f$ , identifying $V'$ and $V''$ as subspaces of $V$ . Similarly, for $M$ subspace of $\mathrm{Aff}_G(V' \oplus V'', W)$ , + +$$ +M = \iota^ {\prime *} (M) + \iota^ {\prime \prime *} (M) +$$ + +Hence, we can write + +$$ +\mathcal {N} _ {\sigma} \left(M _ {1}, \dots , M _ {d}\right) = \mathcal {N} _ {\sigma} \left(M _ {1}, \dots , \pi_ {*} ^ {\prime} \left(M _ {i}\right) + \pi_ {*} ^ {\prime \prime} \left(M _ {i}\right), \iota^ {\prime *} \left(M _ {i + 1}\right) + \iota^ {\prime \prime *} \left(M _ {i + 1}\right), \dots , M _ {d}\right), +$$ + +and the problem informally stated above reduces to determining the separation power of the entire family $\mathcal{N}_{\sigma}(M_1,\ldots ,M_d)$ by understanding the separation power of the smaller families $\mathcal{N}_{\sigma}(M_1,\dots ,\pi 'M_i,\iota^{\prime *} (M_{i + 1}),\dots ,M_d)$ and $\mathcal{N}_{\sigma}(M_1,\dots ,\pi ''M_i,\iota^{\prime *}(M_{i + 1}),\dots ,M_d)$ . This is achieved by the following theorem. + +Theorem 8. With the notation defined above, we have + +$$ +\rho \left(\mathcal {N} _ {\sigma} \left(M _ {1}, \dots , M _ {d}\right)\right) = +$$ + +$$ +\rho (\mathcal {N} _ {\sigma} (M _ {1}, \ldots , \pi_ {*} ^ {\prime} (M _ {i}), \iota^ {\prime *} (M _ {i + 1}), \ldots , M _ {d})) \cap \rho (\mathcal {N} _ {\sigma} (M _ {1}, \ldots , \pi_ {*} ^ {\prime \prime} (M _ {i}), \iota^ {\prime \prime *} (M _ {i + 1}), \ldots , M _ {d})). +$$ + +Proof. Note that $\overline{\psi \circ \phi} = \overline{\psi} \circ \overline{\phi}$ . Indeed, $\overline{\psi} \circ \overline{\phi} = (\phi, \phi) \circ (\psi, \phi) = (\phi \circ \psi, \phi \circ \psi) = \overline{\phi \circ \psi}$ , and $\tilde{\sigma} \iota' = \iota' \tilde{\sigma}$ and $\tilde{\sigma} \pi' = \pi' \tilde{\sigma}$ . Similarly, for $\pi''$ and $\iota''$ . + +Furthermore, $\overline{(\iota' + \iota'') \circ (\pi' + \pi'')} = (\overline{\iota'} + \overline{\iota''}) \circ (\overline{\pi'} + \overline{\pi''})$ since + +$$ +\begin{array}{l} \overline {{(\iota^ {\prime} + \iota^ {\prime \prime}) \circ (\pi^ {\prime} + \pi^ {\prime \prime})}} = \overline {{i d _ {V _ {i} ^ {\prime} \oplus V _ {i} ^ {\prime \prime}}}} = \left(\overline {{i d _ {V _ {i} ^ {\prime}} \oplus 0 _ {V _ {i} ^ {\prime \prime}}}}\right) + \left(\overline {{0 _ {V _ {i} ^ {\prime}} \oplus i d _ {V _ {i} ^ {\prime \prime}}}}\right) \\ = \left(\overline {{\iota^ {\prime} \circ \pi^ {\prime}}}\right) + \left(\overline {{\iota^ {\prime \prime} \circ \pi^ {\prime \prime}}}\right) = \left(\overline {{\iota^ {\prime}}} \circ \overline {{\pi^ {\prime}}}\right) + \left(\overline {{\iota^ {\prime \prime}}} \circ \overline {{\pi^ {\prime \prime}}}\right) \\ = \left(\overline {{\iota^ {\prime}}} + \overline {{\iota^ {\prime \prime}}}\right) \circ \left(\overline {{\pi^ {\prime}}} + \overline {{\pi^ {\prime \prime}}}\right). \\ \end{array} +$$ + +We now need to prove that + +$$ +\overline {{(\psi \iota^ {\prime} + \psi \iota^ {\prime \prime})}} \tilde {\sigma} \overline {{(\pi^ {\prime} \phi + \pi^ {\prime \prime} \phi)}} = \overline {{(\psi \iota^ {\prime}}} + \overline {{\psi \iota^ {\prime \prime}}} \tilde {\sigma} (\overline {{\pi^ {\prime} \phi}} + \overline {{\pi^ {\prime \prime} \phi}}). \tag {17} +$$ + +Indeed, + +$$ +\begin{array}{l} \overline {{(\psi \iota^ {\prime} + \psi \iota^ {\prime \prime})}} \tilde {\sigma} \overline {{(\pi^ {\prime} \phi + \pi^ {\prime \prime} \phi)}} = \overline {{\psi}} \circ \overline {{(\iota^ {\prime} + \iota^ {\prime \prime})}} \tilde {\sigma} (\pi^ {\prime} + \pi^ {\prime \prime}) \circ \overline {{\phi}} \\ = \bar {\psi} \circ \overline {{\left(\iota^ {\prime} + \iota^ {\prime \prime}\right) \left(\pi^ {\prime} + \pi^ {\prime \prime}\right)}} \circ \tilde {\sigma} \bar {\phi} = \bar {\psi} \circ \left(\overline {{\iota^ {\prime}}} + \overline {{\iota^ {\prime \prime}}}\right) \left(\overline {{\pi^ {\prime}}} + \overline {{\pi^ {\prime \prime}}}\right) \circ \tilde {\sigma} \bar {\phi} \\ = \bar {\psi} \circ (\overline {{\iota^ {\prime}}} + \overline {{\iota^ {\prime \prime}}}) \tilde {\sigma} (\overline {{\pi^ {\prime}}} + \overline {{\pi^ {\prime \prime}}}) \bar {\phi} = (\overline {{\psi}} \iota^ {\prime} + \overline {{\psi}} \iota^ {\prime \prime}) \tilde {\sigma} (\overline {{\pi^ {\prime} \phi}} + \overline {{\pi^ {\prime \prime} \phi}}). \\ \end{array} +$$ + +Hence, thanks to (17), + +$$ +\mathcal {N} _ {\sigma} \left(\bar {M} _ {1}, \dots , \bar {M} _ {d - 1}, M _ {d} ^ {\prime}\right) = +$$ + +$$ +\mathcal {N} _ {\sigma} \left(\bar {M} _ {1}, \dots , \bar {\pi} _ {*} ^ {\prime} \left(M _ {i}\right) + \pi_ {*} ^ {\prime \prime} \left(M _ {i}\right), \bar {\iota} ^ {*} \left(M _ {i + 1}\right) + \iota^ {\prime \prime *} \left(M _ {i + 1}\right), \dots , \bar {M} _ {d - 1}, M _ {d} ^ {\prime}\right) = +$$ + +$$ +\mathcal {N} _ {\sigma} (\overline {{M}} _ {1}, \ldots , \overline {{\pi_ {*} ^ {\prime} (M _ {i})}} + \overline {{\pi_ {*} ^ {\prime \prime} (M _ {i})}}, \overline {{\iota^ {\prime *} (M _ {i + 1})}} + \overline {{\iota^ {\prime \prime *} (M _ {i + 1})}}, \ldots , \overline {{M}} _ {d - 1}, M _ {d} ^ {\prime}). +$$ + +By Theorem 1 and the previous observations, we can limit to study spaces of the type + +$$ +\mathcal {N} _ {\sigma} \left(\bar {M} _ {1}, \dots , \bar {\pi} _ {*} ^ {\prime} (M _ {i}) + \bar {\pi} _ {*} ^ {\prime \prime} (M _ {i}), \left(\bar {\iota} ^ {\prime *} (M _ {i + 1}) + \bar {\iota} ^ {\prime \prime *} (M _ {i + 1})\right) _ {u v}\right) = +$$ + +$$ +\mathcal {N} _ {\sigma} \left(\overline {{M}} _ {1}, \dots , \overline {{\pi_ {*} ^ {\prime} (M _ {i})}} + \overline {{\pi_ {*} ^ {\prime \prime} (M _ {i})}}, \overline {{\left(\iota^ {\prime *} (M _ {i + 1})\right) _ {u v}}}\right) + +$$ + +$$ +\mathcal {N} _ {\sigma} \left(\bar {M} _ {1}, \dots , \bar {\pi} _ {*} ^ {\prime} (M _ {i}) + \bar {\pi} _ {*} ^ {\prime \prime} (M _ {i}), \overline {{\left(\iota^ {\prime \prime \prime} (M _ {i + 1})\right) _ {u v}}}\right) +$$ + +thanks to the linearity of the map $\phi \mapsto (\phi)_{uv}$ . Note that + +$$ +\mathcal {N} _ {\sigma} (\overline {{M}} _ {1}, \ldots , \overline {{\pi_ {*} ^ {\prime} (M _ {i})}} + \overline {{\pi_ {*} ^ {\prime \prime} (M _ {i})}}, \overline {{(\iota^ {\prime *} (M _ {i + 1}))}} _ {u v}) = \mathcal {N} _ {\sigma} (\overline {{M}} _ {1}, \ldots , \overline {{\pi_ {*} ^ {\prime} (M _ {i})}}, \overline {{(\iota^ {\prime *} (M _ {i + 1}))}} _ {u v}) +$$ + +as $\pi' \circ \iota'' = 0$ and both projections and immersions commute with activations. From Lemma 6 we get + +$$ +\begin{array}{l} \mathcal {I} \left(\mathcal {N} _ {\sigma} \left(\bar {M} _ {1}, \dots , \bar {\pi} _ {*} ^ {\prime} \left(M _ {i}\right)\right) + \bar {\pi} _ {*} ^ {\prime \prime} \left(M _ {i}\right), \left(\bar {\iota} ^ {\prime *} \left(M _ {i + 1}\right) + \bar {\iota} ^ {\prime \prime *} \left(M _ {i + 1}\right)\right) _ {u v}\right)\left. \right) = \\ = \mathcal {I} \left( \right.\mathcal {N} _ {\sigma} \left(\bar {M} _ {1}, \dots , \overline {{\pi_ {*} ^ {\prime} (M _ {i})}}, \overline {{\left(\iota^ {\prime *} (M _ {i + 1})\right)}} _ {u v}\right) \cap \mathcal {I} \left(\mathcal {N} _ {\sigma} \left(\bar {M} _ {1}, \dots , \overline {{\pi_ {*} ^ {\prime \prime} (M _ {i})}}, \overline {{\left(\iota^ {\prime \prime *} (M _ {i + 1})\right)}} _ {u v}\right). \right. \\ \end{array} +$$ + +Combining all the above results, we conclude the proof of the theorem. + +Proof of Theorem 4. Theorem 4 is a consequence of Theorem 8 in the case where $M_{i}$ is the full set $\operatorname{Aff}_G(V_{i-1}, V_i)$ . Note that + +$$ +\pi_ {*} ^ {\prime} \operatorname {A f f} _ {G} \left(V _ {i}, V _ {i} ^ {\prime} \oplus V _ {i} ^ {\prime \prime}\right) = \operatorname {A f f} _ {G} \left(V _ {i - 1}, V _ {i} ^ {\prime}\right) +$$ + +and + +$$ +\iota^ {\prime *} \operatorname {A f f} _ {G} \left(V _ {i} ^ {\prime} \oplus V _ {i} ^ {\prime \prime}, V _ {i + 1}\right) = \operatorname {A f f} _ {G} \left(V _ {i} ^ {\prime}, V _ {i + 1}\right). +$$ + +Similarly, for $\pi_{*}^{\prime \prime}$ and $\iota^{\prime \prime \ast}$ . + +# B.5 THE ROLE OF REPRESENTATION TYPE + +Proof of Theorem 5. Write $H / K = \{h_1K, \dots, h_sK\}$ , we have the following injection + +$$ +\mathbb {R} ^ {G / H} \longrightarrow \mathbb {R} ^ {G / K} +$$ + +$$ +\iota : \quad e _ {g H} \mapsto \frac {1}{s} \sum_ {i = 1} ^ {s} e _ {g h _ {i} K} \tag {18} +$$ + +and projection + +$$ +\pi : \begin{array}{c} \mathbb {R} ^ {G / K} \longrightarrow \mathbb {R} ^ {G / H} \\ e _ {g K} \mapsto e _ {g H}. \end{array} \tag {19} +$$ + +Note that $\pi_{\iota} = id_{\mathbb{R}^{G_H}}$ , indeed, + +$$ +\pi \iota (e _ {g H}) = \frac {1}{s} \sum_ {i = 1} ^ {s} \pi (e _ {g h _ {i} K}) = \frac {1}{s} \sum_ {i = 1} ^ {s} e _ {g h _ {i} H} = e _ {g H}, +$$ + +as $gh_i H = gH$ for each $i = 1, \ldots, s$ . + +Consider the following diagram + +$$ +\begin{array}{l} \eta : V \longrightarrow \dots \xrightarrow {\phi} \mathbb {R} ^ {G / H} \xrightarrow {\sigma_ {H}} \mathbb {R} ^ {G / H} \xrightarrow {\psi} \dots \longrightarrow W \\ \pi \Bigg {\uparrow} \Bigg {\downarrow} \iota \qquad \qquad \pi \Bigg {\uparrow} \Bigg {\downarrow} \iota \\ \end{array} +$$ + +$$ +\eta^ {\prime}: V \longrightarrow \dots \xrightarrow {\phi^ {\prime}} \mathbb {R} ^ {G / K} \xrightarrow {\sigma_ {H} ^ {\prime}} \mathbb {R} ^ {G / K} \xrightarrow {\psi^ {\prime}} \dots \longrightarrow W. +$$ + +From the network $\eta$ in $\mathcal{N}_{\sigma}(V,\dots ,\mathbb{R}^{G / H},\dots ,W)$ composed by $\phi$ , $\psi$ , and $\sigma$ we want construct a new representation $\eta^{\prime}$ defined as follows. Let $\phi^{\prime} = \iota \circ \phi$ , $\psi^{\prime} = \psi \circ \pi$ , and $\tilde{\sigma}^{\prime} = \iota \circ \tilde{\sigma}\circ \pi$ and note that $\psi^{\prime}\circ \tilde{\sigma}^{\prime}\circ \phi^{\prime} = \psi \circ \pi \circ \iota \circ \tilde{\sigma}\circ \pi \circ \iota \circ \phi = \psi \circ \tilde{\sigma}\circ \phi$ . Hence, substituting $\psi \circ \tilde{\sigma}\circ \phi$ with $\psi^{\prime}\circ \tilde{\sigma}^{\prime}\circ \phi^{\prime}$ inside the definition of $\eta$ do not change the function, and embeds it into a parameter space with intermediate representation $\mathbb{R}^{G / K}$ instead of $\mathbb{R}^{G / H}$ . But to prove that $\eta$ is a neural network, we need to prove that $\tilde{\sigma}^{\prime}$ is a point-wise activation function for some real-valued function $\sigma^{\prime}$ . + +If $\tilde{\sigma}$ is a point-wise activation associated to $\sigma: \mathbb{R} \to \mathbb{R}$ defined on $\mathbb{R}^{G / H}$ we have that + +$$ +\tilde {\sigma} (\sum_ {g H \in G / H} a _ {g H} e _ {g H}) = \sum_ {g H \in G / H} \sigma (a _ {g H}) e _ {g H}. +$$ + +On the other hand, we have + +$$ +\begin{array}{l} \tilde {\sigma} ^ {\prime} \left(\sum_ {g K \in G / K} a _ {g K} e _ {g K}\right) = \iota \circ \tilde {\sigma} \circ \pi \left(\sum_ {g K \in G / K} a _ {g K} e _ {g K}\right) = \\ \iota \circ \tilde{\sigma} (\sum_{\substack{gH\in G / H\\ ghK\in gH / K}}a_{ghK}e_{gH}) = \iota \sum_{gH\in G / H}\sigma (\sum_{ghK\in gH / K}a_{ghK})e_{gH} = \\ \frac {1}{s} \sum_ {g H \in G / H} \sigma \left(\sum_ {g h K \in g H / K} a _ {g h K}\right) \sum_ {h K \in H / K} e _ {g h K} = \\ \frac {1}{s} \sum_ {g K \in G / K} \sigma (\sum_ {h K \in H / K} a _ {g h K}) e _ {g K}. \\ \end{array} +$$ + +Note that the map + +$$ +\alpha : \sum_ {g K \in G / K} a _ {g K} e _ {g K} \mapsto \sum_ {h K \in H / K} a _ {g h K} e _ {g K} +$$ + +is linear and $G$ -equivariant. In particular, note that $\tilde{\sigma}^{\prime} = \frac{\tilde{\sigma}_{K}\circ\alpha}{s}$ , where we denote the standard point-wise activation induced by $\sigma$ on $\mathbb{R}^{G / K}$ as $\tilde{\sigma}_K$ , to distinguish it from $\tilde{\sigma}$ , the + +point-wise activation induced by $\sigma$ but defined on $\mathbb{R}^{G / H}$ . Hence, substituting $\psi \circ \tilde{\sigma} \circ \phi$ with $\psi' \circ \tilde{\sigma}' \circ \phi' = \psi' \circ \frac{\tilde{\sigma}_K \circ \alpha}{s} \circ \phi'$ , we obtain an immersion of $\eta$ in $\mathcal{N}_{\sigma}(V, \ldots, \mathbb{R}^{G / K}, \ldots, W)$ . Hence $\mathcal{N}_{\sigma}(V, \ldots, \mathbb{R}^{G / H}, \ldots, W) \subseteq \mathcal{N}_{\sigma}(V, \ldots, \mathbb{R}^{G / K}, \ldots, W)$ and $\rho(\mathcal{N}_{\sigma}(V, \ldots, \mathbb{R}^{G / K}, \ldots, W)) \subseteq \rho(\mathcal{N}_{\sigma}(V, \ldots, \mathbb{R}^{G / H}, \ldots, W))$ + +We are now going to develop the tools to prove Proposition 4. + +Lemma 3. Let $M = \operatorname{Aff}_G(V, \mathbb{R}^G)$ , then $\mathcal{I}(M_{u,v}) = \mathcal{I}(M_{v^{-1}u,e}) = \mathcal{I}(M_{uv^{-1},e})$ . Moreover, $(\beta, \beta') \in \mathcal{I}(M_{g,e})$ if and only if $g\beta = \beta'$ . + +Proof. Let $V = V_{1} \oplus \dots \oplus V_{s}$ where $V_{i} = \mathbb{R}^{G / K_{i}}$ for each $i = 1, \ldots, s$ . By Proposition 14 and setting $H = \{e\}$ , we know that $\mathrm{Hom}_G(V, \mathbb{R}^G) = \mathrm{Hom}_G(\mathbb{R}^{G / K_1}, \mathbb{R}^G) \oplus \dots \oplus (\mathbb{R}^{G / K_s}, \mathbb{R}^G)$ is generated by functions $\mathcal{R}_{g_iK_i} \pi_{G / K_i}$ for each $g_{i}K_{i} \in G / K_{i}$ for each $i = 1, \ldots, s$ , and $\pi_{G / K_i}$ is the projection of $V$ onto $V_{i} = \mathbb{R}^{G / K_{i}}$ . Moreover, + +$$ +\left(\mathcal {R} _ {g _ {i} K _ {i}} \pi_ {G / K _ {i}} (\beta)\right) _ {u} = \left(\mathcal {R} _ {g _ {i} K _ {i}} \pi_ {G / K _ {i}} \Big (\sum_ {k K _ {i} \in G / K _ {i}} \beta_ {k K _ {i}} e _ {k K _ {i}} \Big)\right) _ {u} = \frac {1}{| K _ {i} |} \beta_ {u g _ {i} K _ {i}}. +$$ + +For each $g\in G$ , we have that + +$$ +\mathcal {I} (M _ {u, v}) = +$$ + +$$ +\begin{array}{l} \left\{(\beta , \beta^ {\prime}) \mid \left(\mathcal {R} _ {g _ {i} K _ {i}} \pi_ {G / K _ {i}} (\beta)\right) _ {u} - \left(\mathcal {R} _ {g _ {i} K _ {i}} \pi_ {G / K _ {i}} (\beta^ {\prime})\right) _ {v} = 0 \forall i \forall g _ {i} K _ {i} \in G / K _ {i} \right\} = \\ \left\{\left(\beta , \beta^ {\prime}\right) \mid \beta_ {u g _ {i} K _ {i}} - \beta_ {v g _ {i} K _ {i}} ^ {\prime} = 0 \forall i \forall g _ {i} K _ {i} \in G / K _ {i} \right\} = \\ \left\{\left(\beta , \beta^ {\prime}\right) \mid v ^ {- 1} u \beta = \beta^ {\prime} \right\}. \\ \end{array} +$$ + +In particular, we have that $\mathcal{I}(M_{u,v}) = \mathcal{I}(M_{v^{-1}u,e})$ . Hence, $(\beta ,\beta^{\prime})\in \mathcal{I}(M_{g,e})$ if and only if $g\beta = \beta^{\prime}$ . + +Finally, in a similar way, we are able to observe that $\mathcal{I}(M_{u,v}) = \mathcal{I}(M_{uv^{-1},e})$ . + +![](images/7c4939b2faaa82d7af70abd306ae4d757ec925d8a2329d738b8c7f32f5a3469c.jpg) + +Proof of Proposition 4. In what follows we have to consider $G \sqcup G'$ , to distinguish the two distinct copies of $G$ , we denote $G'$ as the second copy of $G$ and, when $g$ is an element of $G$ , we will indicate as $g'$ the analogous element in $G'$ . + +Define $M = \overline{\mathrm{Aff}_G(V,\mathbb{R}^G)}$ and $N = \mathrm{Aff}_G(\mathbb{R}^G,\mathbb{R}^{G / H})' < \mathrm{Hom}_G(\mathbb{R}^G\oplus \mathbb{R}^{G'},\mathbb{R}^{G / H})$ . Proposition 2 implies + +$$ +\rho (\mathcal {N} _ {\sigma} (V, \mathbb {R} ^ {G}, \mathbb {R})) = \mathcal {I} (\mathcal {N} _ {\sigma} (M, N)). +$$ + +Note that $N = \langle \mathcal{R}_{Hg} - \mathcal{R}_{H^{\prime}g}\rangle_{Hg\in H\backslash G}$ where functions $\mathcal{R}_{Hg}$ are defined as + +$$ +\Big (\mathcal {R} _ {H g} (e _ {k}) \Big) _ {s H} = \left\{ \begin{array}{l l} 1 & \text {i f} s \in k g ^ {- 1} H, \\ 0 & \text {o t h e r w i s e .} \end{array} \right. +$$ + +An element $\mathcal{Q}$ in $\Psi_{Hg,sH}$ is a partition of $G\sqcup G^{\prime}$ , where for each $P\in \mathcal{Q}$ the intersection $P\cap sHg\sqcup sH^{\prime}g$ have the same number of elements in $sHg$ and $sH^{\prime}g$ . Due to Remark 8, we can just consider $\Psi_{Hg,sH}^{\prime}$ containing the partitions of $G\sqcup G^{\prime}$ whose only parts are $P = \{u,v\}$ for $u\in sHg$ and $v\in sH^{\prime}g$ , otherwise $P$ is a singleton not containing elements in $sHg$ or $sH^{\prime}g$ . + +Hence, by Theorem 1, + +$$ +\mathcal {I} \left(\mathcal {N} _ {\sigma} (M, N)\right) = \bigcap_ {H g, s H} \bigcup_ {\mathcal {Q} \in \Psi_ {H g, s H} ^ {\prime}} \bigcap_ {\{u, v \} \in \mathcal {Q}} \mathcal {I} \left(M _ {u, v}\right). \tag {20} +$$ + +If we prove that for each $Hg$ and $sH$ + +$$ +\bigcup_ {\mathcal {Q} \in \Psi_ {H g, s H} ^ {\prime}} \bigcap_ {\{u, v \} \in \mathcal {Q}} \mathcal {I} (M _ {u, v}) = \bigcup_ {h \in H} \mathcal {I} (M _ {h, e}). \tag {21} +$$ + +then we are done. Indeed, thanks to Lemma 3, $(\beta, \beta') \in \bigcup_{h \in H} \mathcal{I}(M_{h,e})$ if and only if there exists some $h \in H$ such that $h\beta = \beta'$ . Moreover, (21) does not depend on $Hg$ and $sH$ then the outer intersection in (20) is trivial. + +Now to prove (21), we first show that + +$$ +\bigcup_ {\mathcal {Q} \in \Psi_ {H _ {g}, s H} ^ {\prime}} \bigcap_ {\{u, v \} \in \mathcal {Q}} \mathcal {I} (M _ {u, v}) \subseteq \bigcup_ {h \in H} \mathcal {I} (M _ {h, e}). +$$ + +Note that if $\{u,v\} \in \mathcal{Q}$ and $u,v\in sHg$ , then, by Lemma 3, + +$$ +\mathcal {I} \left(M _ {u, v}\right) = \mathcal {I} \left(M _ {s h g, s h ^ {\prime} g}\right) = \mathcal {I} \left(M _ {h h ^ {\prime - 1}, e}\right). +$$ + +Therefore, + +$$ +\bigcap_ {\{u, v \} \in \mathcal {Q}} \mathcal {I} (M _ {u, v}) \subseteq \mathcal {I} (M _ {u, v}) \subseteq \bigcup_ {h \in H} \mathcal {I} (M _ {h, e}). +$$ + +The right-hand side is independent of $\mathcal{Q}$ then the union on each $\mathcal{Q}$ in $\Psi_{Hg,sH}^{\prime}$ of sets on the left-hand side proves the searched inclusion. + +To prove the opposite inclusion, for each $h$ define $\mathcal{P}_h\in \Psi_{Hg,sH}^{\prime}$ as the partition containing the sets $\{ghts,gts\}$ for each $t\in H$ and the remaining singletons. Then, note that, by Lemma 3, + +$$ +\bigcap_ {\{g h t s, g t s \} \in \mathcal {P} _ {h}} \mathcal {I} (M _ {g h t s, g t s}) = \mathcal {I} (M _ {h, e}). +$$ + +Hence, + +$$ +\bigcup_ {h \in H} \mathcal {I} (M _ {h, e}) = \bigcup_ {h \in H} \bigcap_ {\{g h t s, g t s \} \in \mathcal {P} _ {h}} \mathcal {I} (M _ {g h t s, g t s}) \subseteq \bigcup_ {\mathcal {Q} \in \Psi_ {H g, s H} ^ {\prime}} \bigcap_ {\{u, v \} \in \mathcal {Q}} \mathcal {I} (M _ {u, v}). +$$ + +This concludes the proof. + +![](images/74fd3a9aed020b265cfb72b834fb153a4d062767b05204408d92645ff7de802a.jpg) + +# C IMPLICATIONS ON PRACTICAL MODELS + +Lemma 4. An element $(\alpha, \beta) \in \rho(1-CNN)$ if and only if there exist a permutation of $\sigma \in S_n$ such that $\alpha_i = \beta_{\sigma(i)}$ for each $i = 1, \ldots, n$ . + +Proof. Write $[n] \sqcup [n]' = \{1, \dots, n, 1', \dots, n'\}$ , and notice that $\mathrm{Aff}_{\mathbb{Z}_n}(\mathbb{R}^n, \mathbb{R})' = \langle \mathbb{1}_{[n]} - \mathbb{1}_{[n']} \rangle$ , hence $\Psi'$ as defined in Remark 8 is composed by partitions $\mathcal{Q}$ of $[n] \sqcup [n']$ such that + +$$ +\mathcal {Q} = \{\{i, j ^ {\prime} \} \mid i \in [ n ], j \in [ n ] ^ {\prime} \}. +$$ + +Recall $M^1 = \langle id_{\mathbb{R}^n\oplus \mathbb{R}^{n'}}\rangle$ . Note that $(\alpha ,\beta)\in \mathcal{I}(M_{i,j'}^1) = \langle id_{\mathbb{R}^n\oplus \mathbb{R}^{n'}}\rangle$ if and only if $\alpha_{i} = \beta_{j}$ Moreover, for a given $\mathcal{Q}$ in $\Psi^\prime$ , we have $(\alpha ,\beta)\in \bigcap_{i,j'\in \mathcal{Q}}\mathcal{I}(M_{i,j'}^1)$ if and only if, given the bijection $\sigma :[n]\to [n]^{\prime}$ associating $i$ to $j^{\prime}$ $\alpha_{i} = \beta_{\sigma (i)}$ for each $i = 1,\ldots ,n$ + +Notice that, by Theorem 1, + +$$ +(\alpha ,\beta)\in \rho (\mathcal{N}_{\sigma}(M^{1},\mathrm{Aff}_{\mathbb{Z}_{n}}(\mathbb{R}^{n},\mathbb{R})) = \bigcup_{\mathcal{Q}\in \Psi}\bigcap_{i,j^{\prime}\in \mathcal{Q}}\mathcal{I}(M^{1}_{i,j^{\prime}}), +$$ + +which is equivalent at saying that there exist a permutation of $\sigma \in S_{n}$ such that $\alpha_{i} = \beta_{\sigma (i)}$ for each $i = 1,\dots ,n$ + +Proof of Proposition 6. Note that $\rho(1\text{-CNN})$ is characterized by Lemma 4 as follows: $(\alpha, \beta) \in \rho(1\text{-CNN})$ if and only if there exists a permutation $\sigma \in S_n$ such that $\alpha_i = \beta_{\sigma(i)}$ for each $i = 1, \ldots, n$ . In contrast, Proposition 4 shows that $(\alpha, \beta) \in \rho(\mathcal{N}_{\sigma}(M^n, \mathrm{Aff}_{\mathbb{Z}_n}(\mathbb{R}^n, \mathbb{R})))$ if and only if there exists an element $g \in \mathbb{Z}_n$ such that $\alpha_i = \beta_{i + g \pmod{n}}$ for each $i = 1, \ldots, n$ . Notice that for $n > 1$ , $\mathbb{Z}_n \nleq S_n$ , hence $\rho(n\text{-CNN}) \subsetneq \rho(1\text{-CNN})$ , as desired. The proof of the chain of inclusions + +$$ +\rho (n \text {- C N N}) \subseteq \dots \subseteq \rho (2 \text {- C N N}) \subseteq \rho (1 \text {- C N N}) +$$ + +is a direct consequence of Lemma 5 since: $1\text{-CNN}\subseteq 2\text{-CNN}\subseteq \dots \subseteq n\text{-CNN}.$ + +# D FUNCTIONAL EQUATIONS + +In this section, we introduce key results from the theory of functional equations that are necessary to prove Theorem 1. A functional equation, by definition, is an identity involving unknown functions as variables, and common examples include differential and integral equations (Kannappan, 2009). Here, we are particularly interested in the class of linear functional equations, which we explore in greater detail in the following section. + +# D.1 LINEAR FUNCTIONAL EQUATIONS + +Linear functions equations are functional equations which, for given $a_i \in \mathbb{R}$ and $b_i \in \mathbb{R}^d$ , are defined by + +$$ +\sum_ {i = 1} ^ {n} a _ {i} \sigma (b _ {i} x) = 0 \qquad \qquad (\forall x \in \mathbb {R} ^ {d}). +$$ + +In particular, Theorem 9 is a fundamental tool in the proof of Theorem 1, since it characterizes the set of parameters $b_{1}, \ldots, b_{n}$ for which the specific case of linear functional equation in (22) is always satisfied for a non-polynomial $\sigma$ and arbitrary $a_{1}, \ldots, a_{n} \in \mathbb{R}$ . + +Theorem 9. Let $\sigma : \mathbb{R} \to \mathbb{R}$ be a non-polynomial continuous function and $a_1, \ldots, a_n \in \mathbb{R}$ . Let $\mathcal{P}$ be a partition of $[n]$ and define + +$$ +\Psi = \{\mathcal {Q} \leq \mathcal {P} | \sum_ {i \in P} a _ {i} = 0 \forall P \in \mathcal {Q} \}. +$$ + +The set $B$ of elements $b = (b_{1},\ldots ,b_{n})\in \mathbb{R}^{n\times m}$ which satisfy + +$$ +\sum_ {P \in \mathcal {P}} \sum_ {i \in P} a _ {i} \sigma \left(b _ {i} \cdot x + y _ {P}\right) = 0 \quad \left(\forall x \in \mathbb {R} ^ {m} \forall y = \left(y _ {P}\right) _ {P \in \mathcal {P}} \in \mathbb {R} ^ {\mathcal {P}}\right) \tag {22} +$$ + +is + +$$ +\bigcup_ {\mathcal {Q} \in \Psi} \left\{\left(b _ {1}, \dots , b _ {n}\right) \mid b _ {i _ {1}} = \dots = b _ {i _ {k}} \forall \left\{i _ {1}, \dots , i _ {k} \right\} \in \mathcal {Q} \right\}. \tag {23} +$$ + +Equivalently, + +$$ +B = \bigcup_{\mathcal{Q}\in \Psi}\bigcap_{\substack{P\in \mathcal{Q}\\ i,j\in P}}\left\{(b_{1},\ldots ,b_{n}) \mid b_{i} - b_{j} = 0\right\} . +$$ + +For arbitrary continuous functions $\sigma$ , it is only true that the set defined in (23) is contained in $B$ . + +To prove Theorem 9, we first need to prove some auxiliary results. Theorem 10, stated below, is a reformulation of Theorem 2.27 in Kiss & Laczkovich (2014) adapted here to the context of continuous real functions for convenience. For further discussion, refer to Appendix D.2. + +Theorem 10. Let $a_1, \ldots, a_n$ non-null real values, and let $b_1, \ldots, b_n \in \mathbb{R}^m$ be distinct real vectors. Continuous solutions $\sigma: \mathbb{R} \to \mathbb{R}$ of + +$$ +\sum_ {i} a _ {i} \sigma (b _ {i} \cdot x + y) = 0 \quad (\forall x \in \mathbb {R} ^ {m} \forall y \in \mathbb {R}) \tag {24} +$$ + +are polynomial. + +Moreover, to prove Theorem 9, the following notions and auxiliary results are required. + +Definition 14. Let $b = (b_{1},\ldots ,b_{n})\in \mathbb{R}^{n\times m}$ , the identity pattern of $b$ is the coarser partition $\mathcal{P}$ of $[n]$ such that $b_{i} = b_{j}$ for each $i,j\in P$ and $P\in \mathcal{P}$ . + +Theorem 11. Let $\sigma : \mathbb{R} \to \mathbb{R}$ be a non-polynomial continuous function, and $a_1, \ldots, a_n \in \mathbb{R}$ . Then $b = (b_1, \ldots, b_n) \in \mathbb{R}^{n \times m}$ satisfies + +$$ +\sum_ {i = 1} ^ {n} a _ {i} \sigma (b _ {i} \cdot x + y) = 0 \quad (\forall x \in \mathbb {R} ^ {m} \forall y \in \mathbb {R}) \tag {25} +$$ + +if and only if $\sum_{i\in P}a_i = 0$ for each $P$ in the identity pattern of $b$ . + +Proof. Let $P_{1}, \ldots, P_{q}$ be the parts in the identity pattern of $b$ such that $\sum_{i \in P_{j}} a_{i} \neq 0$ , define $a_{j}' = \sum_{i \in P_{j}} a_{i}$ then we can rewrite the equation in (25) as + +$$ +\sum_ {j = 1} ^ {q} a _ {j} ^ {\prime} \sigma \left(b _ {j} ^ {\prime} \cdot x + y\right) = 0, +$$ + +where, for each $j = 1, \dots, q$ , the value of $b_{j}^{\prime}$ is set to the value of the $b_{i}$ for $i \in P_{j}$ , which are all equal to each other. Since the $a_{j}^{\prime}$ are non-null and $b_{j}^{\prime}$ are distinct, by Theorem 10, $\sigma$ have to be polynomial which is impossible. To prove the opposite implication, let $\mathcal{P}$ be the identity pattern of $b_{i}$ and write + +$$ +\sum_ {i = 1} ^ {n} a _ {i} \sigma (b _ {i} \cdot x + y) = \sum_ {P \in \mathcal {P}} \sum_ {i \in P} a _ {i} \sigma (b _ {i} \cdot x + y) = \sum_ {P \in \mathcal {P}} (\sum_ {i \in P} a _ {i}) \sigma (b _ {i} \cdot x + y), +$$ + +where the last equality is possible because $b_{i} = b_{j}$ for each $i,j\in P$ . + +![](images/242b0d834d3b15a353296abc6a9f02f761acf5ba95b06dbeaa045fdc3a83988a.jpg) + +Remark 7. Note that the second implication of Theorem 11 holds for any $\sigma$ , including polynomial functions. + +This theorem gives the following corollary, which is the one actually needed to prove Theorem 9. + +Corollary 2. Let $\sigma : \mathbb{R} \to \mathbb{R}$ be a non-polynomial continuous function and $a_1, \ldots, a_n \in \mathbb{R}$ . Let $\mathcal{P}_n$ be the set of all partitions of $[n]$ and define + +$$ +\Phi = \{\mathcal {P} \in \mathcal {P} _ {n} \mid \sum_ {i \in P} a _ {i} = 0 \forall P \in \mathcal {P} \}. +$$ + +The set $B$ of elements $b = (b_{1},\ldots ,b_{n})\in \mathbb{R}^{n\times m}$ satisfying (25) is + +$$ +\bigcup_ {\mathcal {P} \in \Phi} \left\{\left(b _ {1}, \dots , b _ {n}\right) \mid b _ {i _ {1}} = \dots = b _ {i _ {k}} \forall \left\{i _ {1}, \dots , i _ {k} \right\} \in \mathcal {P} \right\}. \tag {26} +$$ + +Or equivalently, + +$$ +B = \bigcup_{\mathcal{P}\in \Phi}\bigcap_{\substack{P\in \mathcal{P}\\ i,j\in P}}\left\{(b_{1},\ldots ,b_{n}) \mid b_{i} - b_{j} = 0\right\} . +$$ + +For arbitrary continuous functions $\sigma$ , it is only true that the set defined in (26) is contained in $B$ . + +Proof. Define + +$$ +B ^ {\prime} = \bigcup_ {\mathcal {P} \in \Phi} \left\{\left(b _ {1}, \dots , b _ {n}\right) \mid b _ {i _ {1}} = \dots = b _ {i _ {k}} \forall \left\{i _ {1}, \dots , i _ {k} \right\} \in \mathcal {P} \right\}. +$$ + +By Theorem 11, $b$ satisfies (25) if and only if $\sum_{i\in P}a_i = 0$ for each $P$ in the identity pattern of $b$ . Thus, $B\subseteq B^{\prime}$ . To prove the opposite inclusion, note that if $b = (b_{1},\ldots ,b_{n})\in B^{\prime}$ then there exist $\mathcal{P}\in \Phi$ such that $b$ has identity pattern $\mathcal{P}$ , then, as $\sum_{i\in P}a_i = 0$ for each $P\in \mathcal{P}$ , (25) is verified. Finally, note that this implication holds for any $\sigma$ by Remark 7, proving the last claim in Corollary 2. + +Proof of Theorem 9. Notice that the problem + +$$ +\sum_ {P \in \mathcal {P}} \sum_ {i \in P} a _ {i} \sigma \left(b _ {i} \cdot x + y _ {P}\right) = 0 \quad \left(\forall x \in \mathbb {R} ^ {m} \forall y = \left(y _ {P}\right) _ {P \in \mathcal {P}} \in \mathbb {R} ^ {\mathcal {P}}\right) \tag {27} +$$ + +is equivalent to + +$$ +\sum_ {P \in \mathcal {P}} \sum_ {i \in P} a _ {i} \sigma \left(b _ {i} \cdot x + y _ {P} + \hat {y}\right) = 0 \quad \left(\forall x \in \mathbb {R} ^ {m} \forall y \in \mathbb {R} ^ {\mathcal {P}} \forall \hat {y} \in \mathbb {R}\right) +$$ + +through the change of variables $y_{P}\mapsto y_{P} + \hat{y}$ for each $P\in \mathcal{P}$ . This problem is in turn equivalent to + +$$ +\sum_ {i = 1} ^ {n} a _ {i} \sigma (\hat {b} _ {i} \cdot \hat {x} + \hat {y}) = 0 \quad (\forall \hat {x} \in \mathbb {R} ^ {m} \oplus \mathbb {R} ^ {\mathcal {P}} \forall \hat {y} \in \mathbb {R}) \tag {28} +$$ + +due to the following change of variables + +$$ +\hat {b} _ {i} \mapsto \left( \begin{array}{c} b _ {i} \\ e _ {P} \end{array} \right) \text {f o r} i \in P, \text {a n d} \hat {x} \mapsto \left( \begin{array}{c} x \\ y _ {P} e _ {P} \end{array} \right), +$$ + +where $\{e_P\}_{P\in \mathcal{P}}$ is the canonical base of $\mathbb{R}^{\mathcal{P}}$ . Corollary 2 implies that the solution to (28) is + +$$ +\bigcup_ {\mathcal {Q} \in \Phi} \left\{\left(\hat {b} _ {1}, \dots , \hat {b} _ {n}\right) \mid \hat {b} _ {i _ {1}} = \dots = \hat {b} _ {i _ {k}} \forall \left\{i _ {1}, \dots , i _ {k} \right\} \in \mathcal {Q} \right\}. \tag {29} +$$ + +Note that $\hat{b}_{i_1} = \dots = \hat{b}_{i_k}$ if and only if $b_{i_1} = \dots = b_{i_k}$ and $\{i_1,\ldots ,i_k\} \subseteq P$ for some $P\in \mathcal{P}$ if and only if $b_{i_1} = \dots = b_{i_k}$ and $\{i_1,\ldots ,i_k\} \in \mathcal{Q}$ for some $\mathcal{Q}\leq \mathcal{P}$ . + +Recall the definitions + +$$ +\Phi = \left\{\mathcal {Q} \in \mathcal {P} _ {n} \mid \sum_ {i \in P} a _ {i} = 0 \forall P \in \mathcal {Q} \right\} \text {a n d} \Psi = \left\{\mathcal {Q} \leq \mathcal {P} \mid \sum_ {i \in P} a _ {i} = 0 \forall P \in \mathcal {Q} \right\}. +$$ + +Noting that $\Psi = \{\mathcal{Q}\in \Phi \mid \mathcal{Q}\leq \mathcal{P}\}$ , equation (29) implies that the solutions of (27) are + +$$ +\bigcup_ {\mathcal {Q} \in \Psi} \left\{\left(b _ {1}, \dots , b _ {n}\right) \mid b _ {i _ {1}} = \dots = b _ {i _ {k}} \forall \left\{i _ {1}, \dots , i _ {k} \right\} \in \mathcal {Q} \right\}. +$$ + +The final claim follows directly from the concluding statement in Corollary 2. + +Remark 8. In Theorem 9 the union + +$$ +\bigcup_ {\mathcal {Q} \in \Psi} \left\{\left(b _ {1}, \dots , b _ {n}\right) \mid b _ {i _ {1}} = \dots = b _ {i _ {k}} \forall \left\{i _ {1}, \dots , i _ {k} \right\} \in \mathcal {Q} \right\} \tag {30} +$$ + +has redundancies. Indeed, $\{(b_1,\ldots ,b_n)\mid b_{i_1} = \dots = b_{i_k}\forall \{i_1,\ldots ,i_k\} \in \mathcal{Q}\}$ is contained in $\{(b_1,\ldots ,b_n)\mid b_{i_1} = \dots = b_{i_k}\forall \{i_1,\ldots ,i_k\} \in \mathcal{R}\}$ for each $\mathcal{Q}\leq \mathcal{R}$ finer partitions of $\mathcal{P}$ . Hence, the set defined by (30) is the same as + +$$ +\bigcup_ {\mathcal {Q} \in \Psi^ {\prime}} \left\{\left(b _ {1}, \dots , b _ {n}\right) \mid b _ {i _ {1}} = \dots = b _ {i _ {k}} \forall \left\{i _ {1}, \dots , i _ {k} \right\} \in \mathcal {Q} \right\} +$$ + +where $\Psi'$ is the subset of $\Psi$ containing only the minimal partitions with respect to the refinement ordering. + +# D.2 GENERALIZED POLYNOMIALS IN THE CONTINUOUS CASE + +In Appendix D.1, we employ Theorem 10, a reformulation of Theorem 2.27 in Kiss & Laczkovich (2014), adapted here for convenience to the context of continuous real functions. In particular, the original version of this theorem proves that arbitrary complex functions satisfying (24) are generalized polynomials, defined as follows. + +Definition 15. A function $\sigma : \mathbb{C} \to \mathbb{C}$ is a generalized monomial function if there exist a symmetric function $F : \mathbb{C}^n \to \mathbb{C}$ additive in each of its variables, such that $\sigma(x) = F(x, \ldots, x)$ for each $x \in \mathbb{C}$ . A function $\sigma : \mathbb{C} \to \mathbb{C}$ is a generalized polynomial if it is a finite sum of generalized monomials, we say that a generalized polynomial $\sigma$ is real if $\sigma$ is real and there exists a symmetric function $F : \mathbb{C}^n \to \mathbb{R}$ additive in each of its variables, such that $\sigma(x) = F(x, \ldots, x)$ for each $x \in \mathbb{R}$ . + +Trivially, since complex functions satisfying (24) are generalized polynomials, any real solutions are real generalized polynomials. + +To conclude the proof of Theorem 10, it remains to show that continuous real generalized polynomials are simply real polynomial functions, as shown by Proposition 17. + +Proposition 17. A real continuous generalized polynomial is a real polynomial function. + +Proof. The proof of Theorem 17 will be analogous to the proof of the classical proof that any continuous real additive function is linear, see Theorem 1.1 in Kannappan (2009). + +First, we show that real generalized monomials are monomial functions on rational numbers. + +Indeed, suppose first that $f$ is a real generalized monomial and let $F: \mathbb{R}^n \to \mathbb{R}$ be the symmetric function additive in each variable and such that $f(x) = F(x, \ldots, x)$ for each $x \in \mathbb{R}$ . Note that for each $r \in \mathbb{N}$ , + +$$ +F (x _ {1}, \dots , r x _ {i}, \dots , x _ {n}) = F (x _ {1}, \dots , x _ {i} + \dots + x _ {i}, \dots , x _ {n}) = +$$ + +$$ +F \left(x _ {1}, \dots , x _ {i}, \dots , x _ {n}\right) + \dots + F \left(x _ {1}, \dots , x _ {i}, \dots , x _ {n}\right) = r F \left(x _ {1}, \dots , x _ {i}, \dots , x _ {n}\right). \tag {31} +$$ + +Note that $F(x_{1},\ldots ,x_{i - 1},0,x_{i + 1},\ldots ,x_{n}) = 0$ , indeed + +$$ +F (x _ {1}, \dots , x _ {i - 1}, 0, x _ {i + 1}, \dots , x _ {n}) = +$$ + +$$ +F \left(x _ {1}, \dots , x _ {i - 1}, 0 + 0, x _ {i + 1}, \dots , x _ {n}\right) = \tag {32} +$$ + +$$ +F \left(x _ {1}, \dots , x _ {i - 1}, 0, x _ {i + 1}, \dots , x _ {n}\right) + F \left(x _ {1}, \dots , x _ {i - 1}, 0, x _ {i + 1}, \dots , x _ {n}\right) +$$ + +Eliminating a term $F(x_{1},\ldots ,x_{i - 1},0,x_{i + 1},\ldots ,x_{n})$ from both the sides of (32), we get the required result. + +Furthermore, $F(x_{1},\ldots ,x_{i},\ldots ,x_{n}) = -F(x_{1},\ldots , - x_{i},\ldots ,x_{n})$ . Indeed, + +$$ +F \left(x _ {1}, \dots , x _ {i}, \dots , x _ {n}\right) + F \left(x _ {1}, \dots , - x _ {i}, \dots , x _ {n}\right) = F \left(x _ {1}, \dots , x _ {i} - x _ {i}, \dots , x _ {n}\right) = 0. \tag {33} +$$ + +Equations (31) and (33) yields + +$$ +F \left(x _ {1}, \dots , r x _ {i}, \dots , x _ {n}\right) = r F \left(x _ {1}, \dots , x _ {i}, \dots , x _ {n}\right) \tag {34} +$$ + +for each $r \in \mathbb{Z}$ . Note that by substituting $rx_{i} = y_{i}$ , we obtain + +$$ +F (x _ {1}, \dots , y _ {i}, \dots , x _ {n}) = r F (x _ {1}, \dots , \frac {1}{r} y _ {i}, \dots , x _ {n}) +$$ + +Equivalently, + +$$ +F \left(x _ {1}, \dots , \frac {1}{r} y _ {i}, \dots , x _ {n}\right) = \frac {1}{r} F \left(x _ {1}, \dots , y _ {i}, \dots , x _ {n}\right) \tag {35} +$$ + +Equations (34) and (35) prove + +$$ +F (x, \dots , r x, \dots , x) = r F (x, \dots , x) \tag {36} +$$ + +for each $r\in \mathbb{Q}$ . Hence, + +$$ +f (r x) = F (r x, \dots , r x) = r ^ {n} F (x, \dots , x) = r ^ {n} f (x). +$$ + +for each $r\in \mathbb{Q}$ . In particular set $x = 1$ and $f(1) = c\in \mathbb{R}$ , + +$$ +f (r) = r ^ {n} f (1) = c r ^ {n}. +$$ + +Hence, a real generalized monomial is a monomial on $\mathbb{Q}$ . + +Finally, we can prove the general case where $f$ is a real generalized polynomial. Recalling that real generalized polynomials are sums of real generalized monomials, they are sums of real monomial functions on $\mathbb{Q}$ , namely polynomial functions on $\mathbb{Q}$ . + +We conclude by noting that, since $f$ is continuous, it extends as a polynomial function on $\mathbb{R}$ due to continuity. + +# E TECHNICAL LEMMAS + +In what follows, let $\mathcal{C},\mathcal{D}$ and $\mathcal{F}$ be families of functions in $\mathcal{C}(X,V)$ , where $X$ is a topological space and $V$ a real vector space. + +Lemma 5. If $\mathcal{C} \subseteq \mathcal{D}$ , then $\rho(\mathcal{D}) \subseteq \rho(\mathcal{C})$ . + +Lemma 6. Let $\mathcal{C}$ and $\mathcal{D}$ be two families of real-valued functions such that each of them contains at least a constant function. The equivalence relations induced by their identification condition are linked by the following conditions $\rho (\mathcal{C} + \mathcal{D}) = \rho (\mathcal{C}\cup \mathcal{D}) = \rho (\mathcal{C})\cap \rho (\mathcal{D})$ + +Proof. Let us prove the first equality. Let $c$ be the constant function in $\mathcal{D}$ . Hence $\rho(\mathcal{C} + \mathcal{D}) \subseteq \rho(\mathcal{C} + c) = \rho(\mathcal{C}) \subseteq \rho(\mathcal{C}) \cup \rho(\mathcal{D})$ . To prove the inverse inclusion, suppose there exists a function $f$ either in $\mathcal{C}$ or $\mathcal{D}$ separating $x$ and $y$ . Without loss of generality, suppose $f \in \mathcal{C}$ , $f + c \in \mathcal{C} + \mathcal{D}$ would be separating $x$ and $y$ . This concludes the proof of the first equality. The proof of the second equality follows from the definition of $\rho$ . Indeed, + +$$ +\begin{array}{l} \rho (\mathcal {C} \cup \mathcal {D}) = \{(x, y) \in X \times X \mid f (x) = f (y) \forall f \in \mathcal {C} \cup \mathcal {D} \} = \\ \{(x, y) \in X \times X \mid f (x) = f (y) \forall f \in \mathcal {C} \} \cap \{(x, y) \in X \times X \mid f (x) = f (y) \forall f \in \mathcal {D} \} = \\ \rho (\mathcal {C}) \cap \rho (\mathcal {D}). \\ \end{array} +$$ + +![](images/aef10d2a8030674b9cb9c60d0a04f283685a56ef6f16c7f7d0cc31182b602e3e.jpg) + +Remark 9. Note that, with slight modifications to the proofs, analogous results to all previous lemmas can be derived by substituting $\rho$ with $\mathcal{I}$ . + +Lemma 7. If $\mathcal{F}_d$ is a set spanning a null-bias space $M_d$ , then + +$$ +\mathcal {I} \left(\mathcal {N} _ {\sigma} \left(M _ {1}, \dots , M _ {d}\right)\right) = \mathcal {I} \left(\mathcal {N} _ {\sigma} \left(M _ {1}, \dots , M _ {d - 1}, \mathcal {F} _ {d}\right)\right). +$$ + +Proof. Trivially, + +$$ +\left. \mathcal {N} _ {\sigma} \left(M _ {1}, \dots , M _ {d - 1}, \mathcal {F} _ {d}\right)\right) \subseteq \mathcal {N} _ {\sigma} \left(M _ {1}, \dots , M _ {d}\right)). +$$ + +For the zero-locus analogous of Lemma 5, + +$$ +\mathcal {I} \left(\mathcal {N} _ {\sigma} \left(M _ {1}, \dots , M _ {d}\right)\right) \subseteq \mathcal {I} \left(\mathcal {N} _ {\sigma} \left(M _ {1}, \dots , M _ {d - 1}, \mathcal {F} _ {d}\right)\right). +$$ + +To prove the opposite inclusion, write $\mathcal{F}_d = \{\phi_1,\dots ,\phi_s\}$ and note that each neural network $\eta^d$ in $\mathcal{N}_{\sigma}(M_1,\ldots ,M_d)$ can be written as + +$$ +\eta^ {d} = \big (x _ {1} \phi_ {1} + \dots + x _ {s} \phi_ {s} \big) \circ \tilde {\sigma} \circ \eta^ {d - 1} = x _ {1} (\phi_ {1} \circ \tilde {\sigma} \circ \eta^ {d - 1}) + \dots + x _ {s} (\phi_ {s} \circ \tilde {\sigma} \circ \eta^ {d - 1}), +$$ + +for some $x_{1},\ldots ,x_{s}\in \mathbb{R}$ and $\eta^{d - 1}\in \mathcal{N}_{\sigma}(M_1,\dots ,M_{d - 1})$ + +Moreover, note that + +$$ +\phi_ {i} \circ \tilde {\sigma} \circ \eta^ {d - 1} \in \mathcal {N} _ {\sigma} (M _ {1}, \dots , M _ {d - 1}, \mathcal {F} _ {d}), +$$ + +for each $i = 1,\ldots ,s$ + +If $\beta \in \mathcal{I}(\mathcal{N}_{\sigma}(M_1,\ldots ,M_{d - 1},\mathcal{F}_d))$ , then + +$$ +\eta^ {d} (\beta) = x _ {1} \left(\phi_ {1} \circ \tilde {\sigma} \circ \eta^ {d - 1}\right) + \dots + x _ {s} \left(\phi_ {s} \circ \tilde {\sigma} \circ \eta^ {d - 1}\right) = 0. +$$ + +Thus, + +$$ +\mathcal {I} \left(\mathcal {N} _ {\sigma} \left(M _ {1}, \dots , M _ {d - 1}, \mathcal {F} _ {d}\right)\right) \subseteq \mathcal {I} \left(\mathcal {N} _ {\sigma} \left(M _ {1}, \dots , M _ {d}\right)\right), +$$ + +completing the proof. + +![](images/a374636441434e3d59f604bb3247bc7343a9d0c6f06022d6bfead81b800dccea.jpg) \ No newline at end of file diff --git a/ICLR/2025/Separation Power of Equivariant Neural Networks/images.zip b/ICLR/2025/Separation Power of Equivariant Neural Networks/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..ae54e25b08df1c47cf6e866c3c6e216cd3d4a164 --- /dev/null +++ b/ICLR/2025/Separation Power of Equivariant Neural Networks/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:441322d67cf84c843662ed525e7288177a0fa09dba28c8118f8f2feb2973069d +size 1250822 diff --git a/ICLR/2025/Separation Power of Equivariant Neural Networks/layout.json b/ICLR/2025/Separation Power of Equivariant Neural Networks/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..28d2441d3d7e6409584961768416cbb0a63de436 --- /dev/null +++ b/ICLR/2025/Separation Power of Equivariant Neural Networks/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5f4e1c8e80b2b6dab9a87317862133fd266cba4448726acb8d3895a2101dc7fe +size 2128635 diff --git a/ICLR/2025/Seq-VCR_ Preventing Collapse in Intermediate Transformer Representations for Enhanced Reasoning/29f65ce5-abe1-45e0-829e-aa577f7d82c3_content_list.json b/ICLR/2025/Seq-VCR_ Preventing Collapse in Intermediate Transformer Representations for Enhanced Reasoning/29f65ce5-abe1-45e0-829e-aa577f7d82c3_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..1d545cf56eec5801ccf686254ee1d0656b7128d4 --- /dev/null +++ b/ICLR/2025/Seq-VCR_ Preventing Collapse in Intermediate Transformer Representations for Enhanced Reasoning/29f65ce5-abe1-45e0-829e-aa577f7d82c3_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9b11d0ec5e5e8934ac7c02e17e1e95f27d2ce01cd05a59cbbb1e5174aacedbf1 +size 110222 diff --git a/ICLR/2025/Seq-VCR_ Preventing Collapse in Intermediate Transformer Representations for Enhanced Reasoning/29f65ce5-abe1-45e0-829e-aa577f7d82c3_model.json b/ICLR/2025/Seq-VCR_ Preventing Collapse in Intermediate Transformer Representations for Enhanced Reasoning/29f65ce5-abe1-45e0-829e-aa577f7d82c3_model.json new file mode 100644 index 0000000000000000000000000000000000000000..181970f51dd0719345796b5370873086a3459e27 --- /dev/null +++ b/ICLR/2025/Seq-VCR_ Preventing Collapse in Intermediate Transformer Representations for Enhanced Reasoning/29f65ce5-abe1-45e0-829e-aa577f7d82c3_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b652f0ea27c8b8e260180ef4bd0b5c2948e825620561eba87b135ef87bb87fa8 +size 134700 diff --git a/ICLR/2025/Seq-VCR_ Preventing Collapse in Intermediate Transformer Representations for Enhanced Reasoning/29f65ce5-abe1-45e0-829e-aa577f7d82c3_origin.pdf b/ICLR/2025/Seq-VCR_ Preventing Collapse in Intermediate Transformer Representations for Enhanced Reasoning/29f65ce5-abe1-45e0-829e-aa577f7d82c3_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..879c0fe70d8737e909b317b3a0100e9a24a6db29 --- /dev/null +++ b/ICLR/2025/Seq-VCR_ Preventing Collapse in Intermediate Transformer Representations for Enhanced Reasoning/29f65ce5-abe1-45e0-829e-aa577f7d82c3_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:349904a5ea13cb9ae156ee0269db495212df142ae70de20819cf03e22e522291 +size 1127574 diff --git a/ICLR/2025/Seq-VCR_ Preventing Collapse in Intermediate Transformer Representations for Enhanced Reasoning/full.md b/ICLR/2025/Seq-VCR_ Preventing Collapse in Intermediate Transformer Representations for Enhanced Reasoning/full.md new file mode 100644 index 0000000000000000000000000000000000000000..0e0ce2c3b8a005561b775adb9aef2c12d8b5758d --- /dev/null +++ b/ICLR/2025/Seq-VCR_ Preventing Collapse in Intermediate Transformer Representations for Enhanced Reasoning/full.md @@ -0,0 +1,431 @@ +# SEQ-VCR:PREVENTING COLLAPSE IN INTERMEDIATE TRANSFORMER REPRESENTATIONS FOR ENHANCED REASONING + +Md Rifat Arefin $^{1,2,3*}$ Gopeshh Subbaraj $^{1,2}$ , Nicolas Gontier $^{3}$ , Yann LeCun $^{5,6}$ , Irina Rish $^{1,2}$ , Ravid Shwartz-Ziv $^{6}$ , Christopher Pal $^{3,4}$ + +1Université de Montréal, 2Mila, 3ServiceNow, 4Polytechnique Montreal, 5Meta FAIR, 6New York University + +# ABSTRACT + +Decoder-only Transformers often struggle with complex reasoning tasks, particularly arithmetic reasoning requiring multiple sequential operations. In this work, we identify representation collapse in the model's intermediate layers as a key factor limiting their reasoning capabilities. To address this, we propose Sequential Variance-Covariance Regularization (Seq-VCR)1, which enhances the entropy of intermediate representations and prevents collapse. Combined with dummy pause tokens as substitutes for chain-of-thought (CoT) tokens, our method significantly improves performance in arithmetic reasoning problems. In the challenging $5 \times 5$ integer multiplication task, our approach achieves $99.5\%$ exact match accuracy, outperforming models of the same size (which yield $0\%$ accuracy) and GPT-4 with five-shot CoT prompting ( $44\%$ ). We also demonstrate superior results on arithmetic expression and longest increasing subsequence (LIS) datasets. Our findings highlight the importance of preventing intermediate layer representation collapse to enhance the reasoning capabilities of Transformers and show that Seq-VCR offers an effective solution without requiring explicit CoT supervision. + +# 1 INTRODUCTION + +![](images/b9f78a9300291961d8190abf4d78d50b402b58d0fb39560691779074d9e9a353.jpg) +Figure 1: Position-wise number of operations needed for $5 \times 5$ digits integer multiplication task. Middle tokens in the output sequence need more operations than the peripheral ones, making their prediction much harder (as shown in Figure 6). Example of $12345 \times 67890$ is shown here. + +![](images/afc88630574d19d619076c58dc887e73a7f31283c50dc31b5c97ad6318392bdf.jpg) +Number of Operations Per Position in the Output Sequence + +Large Language Models (LLMs) based on Transformer architectures have achieved remarkable success across a wide range of tasks, positioning them as foundational models in artificial intelligence (Bommasani et al., 2021). Despite their impressive capabilities, LLMs often struggle with tasks + +requiring complex reasoning, particularly arithmetic reasoning that necessitates multiple sequential operations (Bubeck et al., 2023). These challenges are attributed to the models' limitations in handling tasks that involve deep cognitive abilities and multi-step reasoning processes. + +One of the key obstacles is the representation collapse in the intermediate layers of Transformer models. Representation collapse occurs when internal representation diversity diminishes, leading to less informative features and hindering the model's ability to solve complex tasks (Jing et al., 2021). For arithmetic reasoning, transformers struggle with successive carryovers and storing intermediate results Qiu et al. (2024), which are essential for solving complex sub-tasks, requiring more computations (Figure 1). We hypothesize that representation collapse prevents the model from effectively performing sub-tasks by calculating successive carryovers and storing intermediate results, which are essential for accurate prediction. + +To address this limitation, we introduce Sequential Variance-Covariance Regularization (SeqVCR), a regularization technique designed to enhance the entropy of intermediate representations and prevent representation collapse. By increasing the diversity of representations within the model's layers, Seq-VCR enables the Transformer to maintain richer and more informative features throughout the computation process. + +Furthermore, we incorporate dummy pause tokens as substitutes for chain-of-thought (CoT) tokens. While CoT prompting has been shown to improve reasoning by breaking down tasks into intermediate steps (Wei et al., 2022), it often requires explicit supervision and can be computationally expensive. Our approach leverages pause tokens to simulate the effect of CoT without the need for explicit intermediate reasoning steps. + +We validate our method on challenging arithmetic reasoning tasks. Notably, on the $5 \times 5$ integer multiplication task, our approach achieves $99.5\%$ exact match accuracy, surpassing models of the same size (which yield $0\%$ accuracy) and GPT-4 with five-shot CoT prompting ( $44\%$ ). We also demonstrate significant improvements on arithmetic expression and longest increasing subsequence (LIS) datasets. + +Our contributions are summarized as follows: + +- We identify representation collapse in intermediate layers as a key limitation affecting the reasoning capabilities of Transformer models. +- We propose Seq-VCR, a regularization technique that enhances the diversity of intermediate representations and prevents collapse. +- We demonstrate that combining Seq-VCR with pause tokens enables models to solve complex arithmetic reasoning tasks without explicit CoT supervision. +We provide extensive experimental results showing significant improvements over baseline models and state-of-the-art LLMs like GPT-4. + +The paper is structured as follows: Section 2 reviews reasoning in large language models, representation collapse, and regularization. Section 3 presents our method, Sequential Variance-Covariance Regularization (Seq-VCR), including its formulation and motivation. Section 4 describes the experimental setup, datasets, models, and shows Seq-VCR's effectiveness in arithmetic reasoning and its impact on representations. Section 5 summarizes key findings and discusses future directions. + +# 2 LITERATURE REVIEW + +Transformer Reasoning Research in large language models (LLMs) has advanced significantly. Models like BERT (Devlin et al., 2019) and GPT (Radford & Narasimhan, 2018) demonstrated improvements in natural language understanding. However, challenges remain in tasks that require deep cognitive abilities. Integrating external knowledge has shown promise in improving reasoning capabilities (Bosselut et al., 2019). Recent advances include techniques such as chain-of-thought (CoT) prompting, which allow models such as GPT-3 (Brown et al., 2020) to perform complex reasoning by breaking tasks into intermediate steps (Wei et al., 2022) with human supervision, called process supervision (Lightman et al., 2023). Wang et al. (2022) shows that even incorrect but coherent intermediate steps can improve reasoning performance. Jin et al. (2024) found increasing the + +length of the reasoning steps in the prompts, even without adding new information to the prompt, improves the reasoning abilities of LLMs. + +Wang et al. (2024), investigated the addition of dummy tokens such as periods or hash symbols to inputs at inference time. They found that this simple modification could improve performance in arithmetic reasoning tasks. Some works show that these dummy tokens, commonly referred to as filler tokens, do not extend transformers' abilities beyond $\mathrm{TC^0}$ circuit complexity, but still significantly enhance problem-solving within this class (Merrill & Sabharwal, 2023; Strobl et al., 2023). Building on this idea, Goyal et al. (2023a) introduced a more comprehensive framework called "pause-training." Their approach involves incorporating learnable $<$ pause $>$ tokens during both pre-training and fine-tuning of language models. While there are differences between the pause tokens and filler tokens approach, they share the goal of providing additional computation time for transformers which extends the expressive power of transformers within the $\mathrm{TC^0}$ class without changing the fundamental limitations of the model architecture. Chain-of-thought prompting can potentially elevate transformers beyond the $\mathrm{TC^0}$ complexity class; However, it may not be necessary for all problems. Furthermore, filler tokens have been demonstrated to enhance the expressivity of transformers (Pfau et al., 2024), even in cases where traditional transformers, lacking chain-of-thought mechanisms, exhibit insufficient expressive power (Sanford et al., 2024). + +Representation Collapse Representation collapse in representation learning degrades model performance by making features indistinguishable. It often occurs in unsupervised and self-supervised learning tasks due to the lack of labeled data, leading to trivial solutions and a low-rank feature space. Research by Jing et al. (2021) highlights that representation collapse is due to poor optimization, loss function design, and improper regularization. Recent studies (Grill et al., 2020) suggest the use of contrastive learning, such as SimCLR, to mitigate this by contrasting positive and negative samples. Additionally, Zbontar et al. (2021) introduced Barlow Twins to minimize redundancy between learned representations. A further advancement is VICReg (Bardes et al., 2021; Zhu et al., 2023) which employs variance, invariance, and covariance regularization to prevent collapse, ensuring diverse and non-trivial representations. While these researches focus on images, it is less explored in language models. Recently, Barbero et al. (2024) studied last-layer representations of the next tokens and found representation collapse in pre-trained models. + +# 3 METHODOLOGY + +# 3.1 PRELIMINARIES + +Consider a finite set of token vocabulary denoted by $V = (1 \dots v)$ , while $x, y \in V$ constitutes a sequence of these tokens representing the input $\mathbf{x} = [x_1, \ldots, x_K]$ and the output $\mathbf{y} = [y_1, \ldots, y_T]$ , where $K$ and $T$ indicate the respective sequence lengths of the input and output. + +We covert the input $\mathbf{x}$ and output sequence $\mathbf{y}$ in an embedded sequence: + +$$ +E _ {e m b} = \left[ \tilde {x} _ {1}, \dots , \tilde {x} _ {K}, \tilde {y} _ {1}, \dots , \tilde {y} _ {T} \right] \in \mathbb {R} ^ {T + K \times d} \text {a n d} E _ {p o s} = \left[ p _ {1}, p _ {2}, \dots \right] \in \mathbb {R} ^ {T + K \times d} \text {o f d i m e n s i o n} d. +$$ + +We can get the language model layer-wise as: $f = (f_{cls} \circ f_L \circ f_{L-1} \dots \circ f_0)$ + +where $f_0 = [\tilde{x}_1 + p_1, \dots, \tilde{x}_K + p_K, \tilde{y}_1 + p_{K+1}, \dots, \tilde{y}_T + p_{K+T}]$ and $f_{cls} \in \mathbb{R}^{|V| \times d}$ is the final linear classification layer. $f_l$ is the self-attention layer with MLP for layer $l$ (Vaswani et al., 2017). + +# 3.2 NEXT-TOKEN PREDICTION LOSS + +Large language models like $GPT$ (Radford et al., 2018) (Generative Pre-trained Transformer) are trained to auto-regressively predict the next token in a sequence. This minimizes the difference between predicted and actual tokens for coherent and contextually appropriate text. A loss function like cross-entropy for next-token prediction is given by: + +$$ +\mathcal {L} _ {\text {n e x t}} (y, f (x)) = - \sum_ {t = 1} ^ {T} y _ {t} ^ {\top} \log \left(f \left(x, y _ {< t}\right)\right), \tag {1} +$$ + +where $y_{t}$ is the one-hot encoded true token at time step $t$ and input tokens $x$ , modeled by a language model, $f$ . + +3.3 REPRESENTATION COLLAPSE IN TRANSFORMERS +![](images/49a12b7e2d67c34834852f92dbe0a3e07fd1c26ef10d5f69137962dfd6970faa.jpg) +(a) Training minGPT from scratch on Arithmetic Expression + +Figure 2: Representation collapse across layers during (a) training (or fine-tuning(b)) for two datasets. The x-axis represents the layer ID, while the y-axis shows the degree of collapse as measured by representation Matrix-Entropy. The results highlight how intermediate layers (shown by the decline in Entropy) experience representation collapse for Pretrained GPT-2 Small on $5 \times 5$ digit Multiplication (b) and during Vanilla training or fine-tuning for both datasets, indicating potential bottlenecks in information flow or feature learning. Tools like Pause Goyal et al. (2023b) token-based tuning can't fix it, but our proposed regularization Seq-VCR can improve collapse. +![](images/84cdee9f3625cd4f97ad50f5bd4be1434a62c11cd3ed5a18a0824bc378bc36ca.jpg) +(b) Fine-tuning GPT-2 Small on $5 \times 5$ digit Multiplication + +Representation collapse in Transformers manifests as a reduction in the diversity of internal representations across layers, particularly in tasks requiring complex reasoning. This collapse hinders the model's ability to capture and process intricate patterns necessary for tasks like multi-digit multiplication. To illustrate this, we analyze the layer-wise representation entropy of a GPT-2 model fine-tuned on the $5 \times 5$ digit multiplication task. As shown in Figure 2(b), there is a significant drop in entropy in the intermediate layers, indicating a collapse in representation diversity. We hypothesize that this representation collapse is the reason why it is very hard for the model to calculate multiplication, carry, and store them, thus resulting in poorer performance, as shown in Figure 6 for the output positions, which require more computation (Figure 1). + +We quantify the phenomenon of representation collapse in token sequences by computing the matrix-based entropy of representation vectors across transformer model layers. We specifically explore the $\alpha$ -order matrix-based entropy (Skean et al., 2023; Giraldo et al., 2014) using a similarity kernel $\kappa$ applied to layer-wise token representations without assuming the underlying distribution. We use a linear kernel defined as $\kappa(a, b) = ab^T$ in our analysis as in (Skean et al., 2024). Assuming, $Z^{(l)} = f_l \in \mathbb{R}^{T \times d}$ be the $l^{th}$ layer representations of $T$ tokens in a sequence with dimension $d$ , we compute the pairwise similarity of $T$ token representations to form the Gram matrix $\mathbf{K} = \kappa(Z^{(l)}, Z^{(l)}) = Z^{(l)}Z^{(l)^T} \in \mathbb{R}^{T \times T}$ . Then, we determine the matrix-based entropy of order $\alpha > 0$ : + +$$ +S _ {\alpha} \left(Z ^ {l}\right) = \frac {1}{1 - \alpha} \log \left[ \sum_ {i = 1} ^ {T} \left(\frac {\lambda_ {i} (\mathbf {K})}{\operatorname {t r} (\mathbf {K})}\right) ^ {\alpha} \right] \tag {2} +$$ + +Equation 2 is similar to the $\alpha$ -order Rényi entropy of eigenvalues of the Gram matrix $^2$ , providing insights into their distribution and the underlying token structure. In particular, we employ $\lim_{\alpha \to 1}$ , which corresponds to the Shannon or Von Neumann entropy Bach (2022); Boes et al. (2019). Eigenvalues are normalized by the matrix trace $\operatorname{tr}(\mathbf{K}) = \sum_{i=1}^{T} \lambda_i(K)$ , then raised to the power $\alpha$ , forming + +a probability distribution over principal components. Each eigenvalue indicates how much variance the corresponding principal component explains (Scholkopf & Smola, 2018). Low entropy results in a heavy-tailed distribution, with a few components dominating, concentrating token information and collapsing the representation space with a lack of representations diversity. + +# 3.4 SEQUENTIAL VARIANCE COVARIANCE REGULARIZATION (SEQ-VCR) + +To address representation collapse, we introduce Seq-VCR, a regularization technique that enforces high variance and low covariance in intermediate representations of Transformer models. Adapted for sequential data, Seq-VCR builds directly on the variance and covariance regularization principles of VICReg (Bardes et al., 2021) and VCReg (Zhu et al., 2023), with Equation 3 re-purposing the formulations from VICReg to tackle the challenges of sequence modeling. + +Seq-VCR is implemented on the final output of the model $(X = f_{cls})^3$ . The process involves computing a covariance matrix and using a pre-trained model like GPT-2, leading to dimensions such as $f_{cls} \in \mathbb{R}^{T \in \times 50,257}$ , which can be computationally challenging. So, for a model like GPT-2, instead of applying regularization on the output of $f_{cls}$ , we apply a linear projection that projects the representation of layer $l$ into a more manageable space, expressed as $X = f_{proj}(f_l)$ , with $f_{proj} \in \mathbb{R}^{T \times 2048}$ . This projection layer is inserted over the representation just before the Seq-VCR regularization loss calculation and is trained exclusively end-to-end with the Seq-VCR loss defined below. + +Now we can assume that we have $N$ samples in the batch, so $N$ number of $X$ , denoted as $\mathbf{X} \in R^{N \times T \times d}$ . We can calculate the covariance matrix across the batch dimension, $C \in R^{T \times d \times d}$ . + +$$ +L _ {\text {S e q - V C R}} = \frac {1}{T \times d} \sum_ {i = 1} ^ {T} \sum_ {k = 1} ^ {d} \left(\lambda_ {1} \underbrace {\max (0 , 1 - \sqrt {\mathbf {C} _ {i , k , k} + \eta})} _ {\text {V a r i a n c e T e r m}} + \lambda_ {2} \underbrace {\sum_ {k \neq \hat {k}} (\mathbf {C} _ {i , k , \hat {k}}) ^ {2}} _ {\text {C o v a r i a n c e T e r m}}\right) \tag {3} +$$ + +Where for each position in the sequence, covariance matrix can be calculated across the batch dimension when $\mathbf{X}_{:,i}$ is the input for $i^{th}$ position, + +$$ +C _ {i} \left(\mathbf {X} _ {:, i}\right) = \frac {1}{N - 1} \sum_ {j = 1} ^ {N} \left(\mathbf {X} _ {j, i} - \bar {\mathbf {X}} _ {:, i}\right) \left(\mathbf {X} _ {j, i} - \bar {\mathbf {X}} _ {:, i}\right) ^ {\top}, \quad \text {w h e r e} \quad \bar {\mathbf {X}} _ {:, i} = \frac {1}{N} \sum_ {j = 1} ^ {N} \mathbf {X} _ {j, i} \tag {4} +$$ + +where $\lambda_{1}$ and $\lambda_{2}$ are the coefficients of the variance and covariance regularization terms. $\eta$ is a small constant (set to 0.001 in our experiments), used for numerical stability. Detailed hyper-parameter choices can be found in Appendix A. + +The Variance Term encourages unit variance in each dimension, while the Covariance Term penalizes covariance between different dimensions, promoting de-correlation and diversity in representations. + +# 3.5 INCORPORATING PAUSE TAXENS + +Increasing the model capacity brings significant accuracy boost for solving $n \times n$ digit multiplication tasks (Qiu et al., 2024). While some previous work increases depth to increase the model capacity, an alternative solution is to use pause tokens that serve as explicit indicators for the model to temporarily pause on intermediate states in sequential tasks before proceeding to the next computation step (Goyal et al., 2023b). + +Similarly, we enhance the model's reasoning capacity by introducing dummy pause tokens, which act as placeholders for intermediate computation steps. This offers notable benefits over Chain-of-Thought (CoT) reasoning tokens, particularly in reducing inference time (as there are often more + +CoT tokens to decode than pause tokens) and dependency on costly human-supervised data. With pause tokens we can solve tasks like multiplication in a fraction of the time compared to CoT, while performing at a similar accuracy (5 times faster and close to $100\%$ in our experiments. See Appendix E for further details). In all experiments, pause tokens were placed between input and output tokens to emulate CoT reasoning. In particular, the input-output format looked like: + + . + +We tried with 2, 4, 6, and 8 pause tokens on $4 \times 4$ and $5 \times 5$ digit multiplication tasks, and we did not find any correlation with task complexity. As such, we used 2 pause tokens in all our experiments. We believe that this may be due to the fact that all pause tokens share the same embedding. Future work will explore the effect of having different embeddings per pause tokens. + +# 3.6 TRAINING OBJECTIVE + +The overall training objective combines the standard next-token prediction loss with the Seq-VCR regularization. Our final loss $\mathbf{L}$ is: + +$$ +\mathbf {L} = L _ {\text {n e x t}} + L _ {\text {S e q - V C R}} \tag {5} +$$ + +This encourages the model to not only predict the next token accurately, but also maintain diverse and informative intermediate representations. + +# 4 EXPERIMENTS + +# 4.1 DATA + +![](images/3c9673ed51eec6de5c25e5546905ceea1128acd307150116bf896269fa636c40.jpg) +(a) Arithmetic Expression + +![](images/fcf204eb2425b637de2d303e98db0008e5b05b34b440cc7e4c67a5ef5d2cf627.jpg) +(b) LIS +Figure 3: Illustrations of Input, Output and CoT on the Arithmetic, LIS and multiplication datasets + +![](images/749cef99319889b144bb4edc03757bc67b4d1c09886bdca90e9c1eda54c59bc5.jpg) +(c) $5 \times 5$ Multiplication + +We conduct experiments on three tasks: we first consider the multi-digit multiplication task from the BIG-bench benchmark (Srivastava et al., 2022), which is the most challenging among arithmetic tasks (Yang et al., 2023). In particular, we use the four-digit $(4 \times 4)$ and five-digit $(5 \times 5)$ multiplication problems, since these two tasks prove very challenging to solve under no CoT, utilizing the training data generated by Deng et al. (2023). + +Next, we focus on the Arithmetic Expressions Feng et al. (2024) dataset. This task focuses on evaluating arithmetic expressions. The input sequence for this task is a sequence consisting of numbers, mathematical operators such as addition $(+)$ , subtraction $(-)$ , multiplication $(\times)$ , division $(\div)$ and brackets, followed by the equal sign. The goal of this task is to calculate the input arithmetic expression and generate the correct result. This task is naturally well-suited for a Chain-of-Thought (CoT) method, where each step does part of the calculation, slowly solving one operation at a time while keeping the other parts the same. + +Finally, we also conduct experiments in a more general setting outside arithmetic tasks, called Dynamic Programming (DP). Dynamic Programming is a framework for solving decision-making problems. The core idea in this setting is to break down a complex task into a series of smaller sub-tasks that can be solved sequentially. We chose a very popular problem in this setting called the + +Longest Increasing Sub-sequence (LIS) as described in the Introduction to Algorithms book (Cormen et al., 2022). For this task, the goal is to find the length of the longest increasing subsequence of a given integer sequence. We generate datasets with different input sequence lengths ranging from \{50, 80, 100\} as shown in Feng et al. (2024). Moreover, all input sequences, and answers in LIS are bounded-range integers and can therefore be tokenized (similar to the multi-digit multiplication task). The CoT tokens for this task consist of the dynamic programming array plus the final answer. Figure 3 shows a working example for a sample problem in all the datasets considered. + +Table 3 in Appendix D provides an overview of the different datasets i.e., Multiplication, Arithmetic Expression and LIS, along with their respective input, chain-of-thought (CoT), and output token details. + +# 4.2 MODELS AND TRAINING CONFIGURATIONS + +We conduct experiments using two models: + +GPT-2 Small Fine-Tuning We fine-tune a pre-trained GPT-2 Small model on the multi-digit multiplication tasks. Fine-tuning is performed for 40 epochs with a learning rate of $5 \times 10^{-4}$ and a batch size of 32. + +minGPT Training from Scratch We train a minGPT model from scratch on the Arithmetic Expressions and LIS datasets. Training is conducted for 100 epochs with a learning rate of $1 \times 10^{-4}$ and a batch size of 128. + +We compare five configurations: + +- Vanilla: Standard training/finetuning without CoT or pause tokens. +- With CoT: Training/finetuning with explicit CoT supervision. +- Pause: Inserting pause tokens in the input sequence. +- Seq-VCR: Applying Seq-VCR regularisation. +- Seq-VCR + Pause: Combining Seq-VCR with pause tokens. + +# 4.3 RESULTS + +# 4.3.1 REPRESENTATION DIVERSITY + +![](images/89fe700c2c1f5bacab4ebcfef7a77fb1f376086df13cbd45f8c7df939997ec0c.jpg) +Figure 4: Layer-wise entropy distributions for different configurations on the $5 \times 5$ multiplication task. Seq-VCR and Seq-VCR+Pause maintain higher entropy across layers, indicating greater representation diversity. + +Seq-VCR significantly enhances representation diversity, as evidenced by the layer-wise distribution of representation entropy across different configurations. In Figure 4, we observe that the configurations that employ our regularization technique, particularly Seq-VCR and Seq-VCR+Pause, exhibit higher entropy values in the intermediate layers compared to the other configurations (Vanilla, and Pause). This increased diversity in the representation entropy suggests that the model is able to capture a wider range of features and maintain distinct representations. The histograms also reveal that while other configurations show peaks at lower entropy values, indicating potential representation collapse and redundancy in the intermediate representations, our method fosters a more uniform distribution across the layers. This uniformity suggests that the model is using a richer feature space, enabling it to better generalize to unseen data, thus improving performance in downstream tasks. + +# 4.4 LEARNING DYNAMICS + +![](images/69a684c2ffb05359ba8cc2701b99fa06b4247b826e5979cb71d8fc51b473a4bd.jpg) +(a) Fine-tuning GPT-2 Small on $5 \times 5$ digit Multiplication + +![](images/741fdfcd6678436bcd86eab38fec0910de3b74da6078a75d9beb8127bdbbcf1e.jpg) +(b) Training minGPT from scratch on Arithmetic Expression +Figure 5: Learning dynamics (curves for next token prediction loss) illustrating the phase transition observed across datasets when applying our regularization methods. The x-axis represents training epochs, and the y-axis denotes the model's loss. The phase transition is characterized by a sharp reduction in loss, marking a distinct shift in the learning regime when using Seq-VCR and Seq-VCR + Pause, compared to the gradual decline or saturating curves in other configurations. + +Our regularization method, Seq-VCR or Seq-VCR+Pause cause a significant phase transition (improving the next token prediction loss) in the performance of the model across datasets compared to other configurations such as Vanilla, and Pause, which do not induce this phase transition as shown in Figure 5. Specifically, this phase transition marks a distinct shift in the model's ability to capture and generalize representations during training or fine-tuning. + +Without regularization, learning is difficult and training loss saturates. Seq-VCR improves the learning curve. Adding Seq-VCR with 2 Pause tokens causes a sharp phase transition (Figure 5 (a)) and solves the $5 \times 5$ digit multiplication task. Figure 5 (b) shows similar improvements in the arithmetic reasoning task that is learned from scratch. + +# 4.5 RESULTS ON $4 \times 4$ AND $5 \times 5$ DIGITS MULTIPLICATION TASKS + +Table 1 shows the results on $4 \times 4$ and $5 \times 5$ digits using a fine-tuned GPT-2 Small. Compared to no CoT configurations like (Vanilla, Pause), our method enables solving tasks previously not solvable without explicit CoT. We can see the effectiveness of the Seq-VCR on $4 \times 4$ digit multiplication task where without pause token it improves performance from $25\%$ to $52\%$ and with 2 pause tokens Seq-VCR + Pause achieves accuracy $99.2\%$ , which is close to With CoT performance and significantly better than other configuration without CoT. It even outperforms the 5-shot prompt(with or without CoT) performance of GPT-3.5 and GPT-4.0. + +
ModelConfiguration4x4 Mult5x5 Mult
GPT-3.5With CoT0.430.05
No CoT0.020.00
GPT-4With CoT0.770.44
No CoT0.040.00
GPT-2 SmallWith CoT1.01.0
Vanilla0.250.0
Pause0.280.0
Seq-VCR0.520.0
Seq-VCR + Pause0.9920.995
+ +Table 1: Accuracy (exact match) on $4 \times 4$ and $5 \times 5$ digits Multiplication Tasks. GPT-3.5 and GPT-4 results are taken from Deng et al. (2024) which are produced by 5-shot prompt + +We also see from Table 1 that GPT-4 with CoT 5-shot prompts achieves $44.0\%$ for $5 \times 5$ digit multiplication, while Vanilla, Seq-VCR, and Pause achieve $0\%$ without CoT. Because, all configurations struggle with predicting middle tokens in the output sequence (shown in Figure 6). This happens because those middle tokens require more computations to calculate successive carry and store them, since these tokens require more computation (as shown in Figure 1), thus making them difficult sub-tasks than predicting the peripheral tokens which require less computations, thus easier to solve. However, Seq-VCR+Pause with 2 Pause tokens solves the $5 \times 5$ digit multiplication task, previously unsolved without CoT tokens. Figure 2(b) shows our regularization Seq-VCR increases intermediate layer entropy, allowing more exploration in the representation space. We hypothesize that along with better representation by Seq-VCR, 2 Pause tokens increase the computational ability, allowing the model to carry the necessary multiplication values and solve the task. More results by training GPT-2 from scratch are in the Appendix H. + +![](images/af1857c2f338c34f87347745ab4c803c4445a88e60262c03b09229638ce4b014.jpg) +Figure 6: Position-wise accuracy of Multiplication of $5 \times 5$ digits with different configuration of GPT-2 Small. We see that models fail on the middle tokens as they require more compute. + +# 4.6 RESULTS ON ARITHMETIC EXPRESSION AND LONGEST INCREASING SUB-SEQUENCE (LIS) DATASETS + +Figure 7 illustrates how the accuracy varies among different methods (represented by different bar colors in the plot) and with changing levels of task complexity, such as the number of operators in the Arithmetic Expressions Dataset or the input sequence length in the case of the LIS dataset. + +We can observe that as the task complexity is low, i.e. in case of 4 operators in the arithmetic expression and input sequence length of 50 in the LIS dataset, all the methods perform quite well. But, as the number of operators or sequence length increases, the tasks become more complex, which shows the need for models other than the vanilla baselines. + +Seq-VCR demonstrates substantial improvement over vanilla models and achieved results comparable to the chain-of-thought (CoT) prompting method as shown in Feng et al. (2024). Although CoT outperforms the other methods, there is an increase in the serial computation due to its step-by-step reasoning approach. On the other hand, Pause tokens and regularization primarily boost parallel computation, enhancing the model's expressivity for these types of problem without significantly increasing serial computation. The results presented in Figure 7 are based on models with a 5-layer configuration, optimized using the best-performing number of pause tokens. We find that the number of pause tokens that works best for a particular model and layer config vary a bit. For example, + +![](images/aa2d98aeef1b7dbd360538e1b1368a8f5afd63888e1585d19862210089db8cea.jpg) +(a) Test accuracy on Arithmetic Expressions Dataset + +![](images/82b50cc7ef53dcd4ddbb1fbf48597b5b75da3057c795abeb5594de1425102f99.jpg) +(b) Test accuracy on LIS Dataset + +![](images/948acf4aaf88ee00bf0b4db25c0c3c84cb870b97a1cafd66cd9674e8cc500a01.jpg) +Figure 7: Performance of each method across tasks of varying difficulty +(a) Test accuracy on 6 operator Arithmetic Expression +Figure 8: Performance of each method on the complex task w/ varying number of layers + +![](images/ec15d57561b0bca1f0496203ea7339060ba69e5cf0d6050a35bc83493b1c2751.jpg) +(b) Test accuracy on LIS Dataset with 100 Input Sequence Length + +the best working Seq-VCR + Pause model uses 7 pause tokens in the case of the 5 operator task in Arithmetic Expression, while 4 pause tokens work the best for the LIS task with 80 as input sequence length. In Figure 8 we show how the different models perform in the most complex task in each dataset. We also clearly see that more depth of the model helps every method in solving the task better. Another conclusion we can draw from Figures 7 and 8 is that although the combination of Seq-VCR with Pause Tokens works best (almost close to the CoT method), Seq-VCR achieves a similar test accuracy without the use of Pause Tokens in both datasets. All results in Figures 7 and 8 are over 3 seed runs. Detailed ablation studies, exploring variations in the number of pause tokens, layers, and task complexities, can be found in the Appendices B and C. + +# 5 CONCLUSION + +Despite the remarkable success of large transformer based language models, they exhibit deficiencies in multi-step reasoning tasks. One proposed remedy is the application of Chain-of-Thought supervision, which, although effective, entails considerable cost. Conversely, there has been limited exploration into enhancing the capacity of the pre-trained model representation itself without explicit supervision. Our analysis indicates that intermediate layer representation collapse detrimentally affects the computation of intermediate information essential for solving arithmetic reasoning tasks. Our proposed regularization technique enhances the model's representation capacity, thereby improving its ability to solve these tasks. We think that further research is required to enhance the capability of pre-training as well, where improved representation learning will enhance the model with greater capabilities. + +# ACKNOWLEDGMENTS + +We acknowledge the support of the Canada CIFAR AI Chair Program and IVADO. We thank Mila and Compute Canada for providing computational resources. + +# REFERENCES + +Francis Bach. Information theory with kernel methods. IEEE Transactions on Information Theory, 69(2):752-775, 2022. +Federico Barbero, Andrea Banino, Steven Kapturowski, Dharshan Kumaran, João GM Araujo, Alex Vitvitskyi, Razvan Pascanu, and Petar Velicković. Transformers need glasses! information oversquashing in language tasks. arXiv preprint arXiv:2406.04267, 2024. +Adrien Bardes, Jean Ponce, and Yann LeCun. Vicreg: Variance-invariance-covariance regularization for self-supervised learning. arXiv preprint arXiv:2105.04906, 2021. +Paul Boes, Jens Eisert, Rodrigo Gallego, Markus P Müller, and Henrik Wilming. Von neumann entropy from unitarity. Physical review letters, 122(21):210402, 2019. +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. +Antoine Bosselut, Hannah Rashkin, Maarten Sap, Chaitanya Malaviya, Asli Celikyilmaz, and Yejin Choi. Comet: Commonsense transformers for automatic knowledge graph construction. In ACL, 2019. +Tom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel M. Ziegler, Jeff Wu, Clemens Winter, Christopher Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, and Dario Amodei. Language models are few-shot learners. ArXiv, abs/2005.14165, 2020. URL https://api_semanticscholar.org/ CorpusID:218971783. +Sebastien Bubeck, Varun Chandrasekaran, Ronen Eldan, John A. Gehrke, Eric Horvitz, Ece Kamar, Peter Lee, Yin Tat Lee, Yuan-Fang Li, Scott M. Lundberg, Harsha Nori, Hamid Palangi, Marco Tulio Ribeiro, and Yi Zhang. Sparks of artificial general intelligence: Early experiments with gpt-4. ArXiv, abs/2303.12712, 2023. URL https://api-semanticscholar.org/CorpusID:257663729. +Thomas H Cormen, Charles E Leiserson, Ronald L Rivest, and Clifford Stein. Introduction to algorithms. MIT press, 2022. +Yuntian Deng, Kiran Prasad, Roland Fernandez, Paul Smolensky, Vishrav Chaudhary, and Stuart Shieber. Implicit chain of thought reasoning via knowledge distillation. arXiv preprint arXiv:2311.01460, 2023. +Yuntian Deng, Yejin Choi, and Stuart Shieber. From explicit cot to implicit cot: Learning to internalize cot step by step. arXiv preprint arXiv:2405.14838, 2024. +Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. In North American Chapter of the Association for Computational Linguistics, 2019. URL https://api_semanticscholar.org/ CorpusID:52967399. +Guhao Feng, Bohang Zhang, Yuntian Gu, Haotian Ye, Di He, and Liwei Wang. Towards revealing the mystery behind chain of thought: a theoretical perspective. Advances in Neural Information Processing Systems, 36, 2024. + +Luis Gonzalo Sanchez Giraldo, Murali Rao, and Jose C Principe. Measures of entropy from data using infinitely divisible kernels. IEEE Transactions on Information Theory, 61(1):535-548, 2014. +Sachin Goyal, Ziwei Ji, Ankit Singh Rawat, Aditya Krishna Menon, Sanjiv Kumar, and Vaishnavh Nagarajan. Think before you speak: Training language models with pause tokens. ArXiv, abs/2310.02226, 2023a. URL https://api_semanticscholar.org/CorpusID:263608983. +Sachin Goyal, Ziwei Ji, Ankit Singh Rawat, Aditya Krishna Menon, Sanjiv Kumar, and Vaishnavh Nagarajan. Think before you speak: Training language models with pause tokens. arXiv preprint arXiv:2310.02226, 2023b. +Jean-Bastien Grill, Florian Strub, Florent Alché, Coretin Tallec, Pierre Richemond, Elena Buchatskaya, Carl Doersch, Bernardo Avila Pires, Zhaohan Guo, Mohammad Gheshlaghi Azar, et al. Bootstrap your own latent-a new approach to self-supervised learning. Advances in neural information processing systems, 33:21271-21284, 2020. +Mingyu Jin, Qinkai Yu, Haiyan Zhao, Wenyue Hua, Yanda Meng, Yongfeng Zhang, Mengnan Du, et al. The impact of reasoning step length on large language models. arXiv preprint arXiv:2401.04925, 2024. +Li Jing, Pascal Vincent, Yann LeCun, and Yuandong Tian. Understanding dimensional collapse in contrastive self-supervised learning. arXiv preprint arXiv:2110.09348, 2021. +Hunter Lightman, Vineet Kosaraju, Yura Burda, Harri Edwards, Bowen Baker, Teddy Lee, Jan Leike, John Schulman, Ilya Sutskever, and Karl Cobbe. Let's verify step by step. arXiv preprint arXiv:2305.20050, 2023. +William Merrill and Ashish Sabharwal. The parallelism tradeoff: Limitations of log-precision transformers. Transactions of the Association for Computational Linguistics, 11:531-545, 2023. +Jacob Pfau, William Merrill, and Samuel R Bowman. Let's think dot by dot: Hidden computation in transformer language models. arXiv preprint arXiv:2404.15758, 2024. +Luyu Qiu, Jianing Li, Chi Su, Chen Jason Zhang, and Lei Chen. Dissecting multiplication in transformers: Insights into llms. arXiv preprint arXiv:2407.15360, 2024. +Alec Radford and Karthik Narasimhan. Improving language understanding by generative pretraining. 2018. URL https://api_semanticscholar.org/CorpusID:49313245. +Alec Radford, Karthik Narasimhan, Tim Salimans, Ilya Sutskever, et al. Improving language understanding by generative pre-training. 2018. +Clayton Sanford, Daniel J Hsu, and Matus Telgarsky. Representational strengths and limitations of transformers. Advances in Neural Information Processing Systems, 36, 2024. +Bernhard Scholkopf and Alexander J Smola. Learning with kernels: support vector machines, regularization, optimization, and beyond. MIT press, 2018. +Oscar Skean, Jhoan Keider Hoyos Osorio, Austin J Brockmeier, and Luis Gonzalo Sanchez Giraldo. Dime: Maximizing mutual information by a difference of matrix-based entropies. arXiv preprint arXiv:2301.08164, 2023. +Oscar Skean, Md Rifat Arefin, and Ravid Shwartz-Ziv. Does representation matter? exploring intermediate layers in large language models. In Workshop on Machine Learning and Compression, NeurIPS 2024, 2024. URL https://openreview.net/forum?id=FN0tZ9pVLz. +Aarohi Srivastava, Abhinav Rastogi, Abhishek Rao, Abu Awal Md Shoeb, Abubakar Abid, Adam Fisch, Adam R. Brown, Adam Santoro, Aditya Gupta, Adrià Garriga-Alonso, Agnieszka Kluska, Aitor Lewkowycz, Akshat Agarwal, Alethea Power, Alex Ray, Alex Warstadt, Alexander W. Kocurek, Ali Safaya, Ali Tazarv, Alice Xiang, Alicia Parrish, Allen Nie, Aman Hussain, Amanda Askell, Amanda Dsouza, Ambrose Slone, Ameet Annasaheb Rahane, Anantharaman S. Iyer, Anders Andreassen, Andrea Madotto, Andrea Santilli, Andreas Stuhlmuller, Andrew M. Dai, + +Andrew La, Andrew Kyle Lampinen, Andy Zou, Angela Jiang, Angelica Chen, Anh Vuong, Animesh Gupta, Anna Gottardi, Antonio Norelli, Anu Venkatesh, Arash Gholamidavoodi, Arfa Tabassum, Arul Menezes, Arun Kirubarajan, Asher Mullokandov, Ashish Sabharwal, Austin Herrick, Avia Efrat, Aykut Erdem, Ayla Karakacs, B. Ryan Roberts, Bao Sheng Loe, Barret Zoph, Bartlomiej Bojanowski, Batuhan Ozyurt, Behnam Hedayatnia, Behnam Neyshabur, Benjamin Inden, Benno Stein, Berk Ekmekci, Bill Yuchen Lin, Blake Stephen Howald, Bryan Orion, Cameron Diao, Cameron Dour, Catherine Stinson, Cedrick Argueta, C'esar Ferri Ram'irez, Chandan Singh, Charles Rathkopf, Chenlin Meng, Chitta Baral, Chiyu Wu, Chris Callison-Burch, Chris Waites, Christian Voigt, Christopher D. Manning, Christopher Potts, Cindy Ramirez, Clara Rivera, Clemencia Siro, Colin Raffel, Courtney Ashcraft, Cristina Garbacea, Damien Sileo, Daniel H Garrette, Dan Hendrycks, Dan Kilman, Dan Roth, Daniel Freeman, Daniel Khashabi, Daniel Levy, Daniel Mosegu'i Gonz'alez, Danielle R. Perszyk, Danny Hernandez, Danqi Chen, Daphne Ippolito, Dar Gilboa, David Dohan, David Drakard, David Jurgens, Debajyoti Datta, Deep Ganguli, Denis Emelin, Denis Kleyko, Deniz Yuret, Derek Chen, Derek Tam, Dieuwke Hupkes, Diganta Misra, Dilyar Buzan, Dimitri Coelho Mollo, Diyi Yang, Dong-Ho Lee, Dylan Schrader, Ekaterina Shutova, Ekin Dogus Cubuk, Elad Segal, Eleanor Hagerman, Elizabeth Barnes, Elizabeth P. Donoway, Ellie Pavlick, Emanuele Rodola, Emma Lam, Eric Chu, Eric Tang Erkut Erdem, Ernie Chang, Ethan A. Chi, Ethan Dyer, Ethan J. Jerzak, Ethan Kim, Eunice Engefu Manyasi, Evgenii Zheltonozhskii Fanyue Xia Fatemeh Siar Fernando Mart'inez-Plumed Francesca Happ'e,Francois CholletFrieda Rong,Gaurav MishraGenta Indra Winata Gerard de MeloGermán Kruszewski Giambattista Parascandolo Giorgio Mariani Gloria Wang Gonzalo Jaimovitch-L'opez,Gregor BetzGuy Gur-AriHana Galijasevic,Hannah Kim Hannah Rashkin Hannaneh Hajishirzi Harsh Mehta Hayden Bogar Henry Shevlin Hinrich Schutze Hiromu Yakura Hongming Zhang Hugh Mee Wong Ian Ng Isaac Noble Jaap Jumelet Jack Geissinger John Kernion Jacob Hilton Jaehoon Lee Jaime Fernandez Fisac James B. Simon James KoppelJames ZhengJames ZouJan Koc'nJana ThompsonJanelle Wingfield Jared Kaplan Jarema Radom Jascha Narain Sohl-Dickstein Jason Phang Jason Wei Jason Yosinski,Jekaterina Novikova Jelle Bosscher Jennifer Marsh Jeremy KimJeroen Taal Jesse Engel Jesujoba Oluwadara Alabi Jiacheng Xu Jiaming Song Jillian Tang Jane W Waweru John Burden John Miller John U. Balis Jonathan Batchelder Jonathan Berant Jorg Frohberg Jos Rozen Jose Fernandez-Orallo Joseph Boudeman Joseph Guerr Joseph JonesJoshua Tenenbaum Joshua S. RuleJoyce ChuaKamil KanclerzKaren Livescu Karl Krauth,Karthik Gopalakrishnan Katerina Ignatyeva Katja Markert Kaustubh D.Dhole Kevin Gimpel Kevin Omondi Kory Wallace Mathewson Kristen ChiafulloKsenia Shkaruta Kumar Shridhar Kyle McDonell Kyle RichardsonLaria ReynoldsLeo GaoLi ZhangLiam DuganLianhui Qin Lidia Contreras-Ochando Louis-Philippe Morency Luca Moschella Luca Lam Lucy Noble Ludwig Schmidt Luheng He Luis Oliveros Col'on Luke Metz Lutfi Kerem cSenel Maarten Bosma Maarten Sap,Maartje ter HoeveMaheen Farooqi Manaal Faruqui Mantas Mazeika Marco Baturan Marco Marelli Marco MaruMaria Jose Ram'iez Quintana Marie Tolkiehn Mario Giulianelli Martha Lewis Martin Potthast Matthew L. Leavitt Matthias Hagen M'aty'as Schubert Medina Baitemirova Melody Arnaud Melvin Andrew McElrath Michael A. Yee Michael Cohen Michael Gu Michael Igorevich Ivanitskiy Michael Starritt Michael Strube Michal Swkedrowski Michele Bevilacqua Michihiro YasunagaMihir Kale Mike CainMimee Xu Mirac Suzgun Mitch Walker Monica Tiari Mohit Bansal Moin Aminnaseri Mor Geva Mozhdeh Gheini T MukundVarma Nanyun Peng Nathan A. Chi Nayon Lee Neta Gur-Ari Krakover Nicholas Cameron Nicholas Roberts Nick Doiron Nicole Martinez Nikita Nangia Niklas Deckers Niklas Muennighoff Nitish Shirish Keskar Niveditha Iyer Noah Constant Noah Fiedel Nuan Wen Oliver Zhang Omar Agha Omar Elbaghdadi Omer Levy Owain Evans Pablo Antonio Moreno Casares Parth Doshi Pascale Fung Paul Pu Liang Paul Vicol Pegah Alipoormolabashi Peiyuan Liao Percy Liang Peter Chang Peter Eckersley Phu Mon Htut PiBei Hwang P. Milkowski Piyush S. Patil Pouya Pezeshkpour Priti Oli Qiaozhu Mei Qing Lyu Qinlang Chen Rabin Banjade Rachel Etta Rudolph Raefer Gabriel Rahel Habacker Ramon Risco Raphael Milliere Rhythm Garg Richard Barnes Rif A.Saurous,Riku Arakawa Robbe Raymaekers Robert Frank Rohan Sikand Roman Novak Roman Sitelew Ronan Lebras Rosanne Liu Rowan Jacobs Rui Zhang Ruslan Salakhutdinov Ryan Chi Ryan Lee Ryan Stovall Ryan Teehan Ryan Yang Sahib Singh Saif M Mohammad Sajant Anand Sam DilllavouSam ShleiferSam Wiseman Samuel Gruetter Samuel R. Bowman Samuel S. Schoenholz Sanghyun Han Sanjeev Kwatra Sarah A.Rous Sarik Ghazarian Sayan Ghosh Sean Casey Sebastian Bischoff Sebastian Gehrmann Sebastian Schuster Sepideh Sadeghi Shadi S. + +Hamdan, Sharon Zhou, Shashank Srivastava, Sherry Shi, Shikhar Singh, Shima Asaadi, Shixiang Shane Gu, Shubh Pachchigar, Shubham Toshniwal, Shyam Upadhyay, Shyamolima Debnath, Siamak Shakeri, Simon Thormeyer, Simone Melzi, Siva Reddy, Sneha Priscilla Makini, Soo-Hwan Lee, Spencer Torene, Sriharsha Hatwar, Stanislas Dehaene, Stefan Divic, Stefano Ermon, Stella Biderman, Stephanie Lin, Stephen Prasad, Steven T Piantadosi, Stuart M. Shieber, Summer Misherghi, Svetlana Kiritchenko, Swaroop Mishra, Tal Linzen, Tal Schuster, Tao Li, Tao Yu, Tariq Ali, Tatsunori Hashimoto, Te-Lin Wu, Theo Desbordes, Theodore Rothschild, Thomas Phan, Tianle Wang, Tiberius Nkinyili, Timo Schick, Timofei Kornev, Titus Tunduny, Tobias Gerstenberg, Trenton Chang, Trishala Neeraj, Tushar Khot, Tyler Shultz, Uri Shaham, Vedant Misra, Vera Demberg, Victoria Nyamai, Vikas Raunak, Vinay Venkatesh Ramasesh, Vinay Uday Prabhu, Vishakh Padmakumar, Vivek Srikumar, William Fedus, William Saunders, William Zhang, Wout Vossen, Xiang Ren, Xiaoyu Tong, Xinran Zhao, Xinyi Wu, Xudong Shen, Yadollah Yaghoobzadeh, Yair Lakretz, Yangqiu Song, Yasaman Bahri, Yejin Choi, Yichi Yang, Yiding Hao, Yifu Chen, Yonatan Belinkov, Yu Hou, Yu Hou, Yuntao Bai, Zachary Seid, Zhuoye Zhao, Zijian Wang, Zijie J. Wang, Zirui Wang, and Ziyi Wu. Beyond the imitation game: Quantifying and extrapolating the capabilities of language models. ArXiv, abs/2206.04615, 2022. URL https://apisemantic scholar.org/CorpusID:263625818. +Lena Strobl, William Merrill, Gail Weiss, David Chiang, and Dana Angluin. Transformers as recognizers of formal languages: A survey on expressivity. arXiv preprint arXiv:2311.00208, 2023. +Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. Advances in neural information processing systems, 30, 2017. +Weizhi Wang, Li Dong, Hao Cheng, Xiaodong Liu, Xifeng Yan, Jianfeng Gao, and Furu Wei. Aug-mentation language models with long-term memory. Advances in Neural Information Processing Systems, 36, 2024. +Xuezhi Wang, Jason Wei, Dale Schuurmans, Quoc Le, Ed Chi, Sharan Narang, Aakanksha Chowdhery, and Denny Zhou. Self-consistency improves chain of thought reasoning in language models. arXiv preprint arXiv:2203.11171, 2022. +Jason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma, Ed Huai hsin Chi, F. Xia, Quoc Le, and Denny Zhou. Chain of thought prompting elicits reasoning in large language models. ArXiv, abs/2201.11903, 2022. URL https://api_semanticscholar.org/ CorpusID:246411621. +Zhen Yang, Ming Ding, Qingsong Lv, Zhihuan Jiang, Zehai He, Yuyi Guo, Jinfeng Bai, and Jie Tang. Gpt can solve mathematical problems without a calculator. arXiv preprint arXiv:2309.03241, 2023. +Jure Zbontar, Li Jing, Ishan Misra, Yann LeCun, and Stephane Deny. Barlow twins: Self-supervised learning via redundancy reduction. In Marina Meila and Tong Zhang (eds.), Proceedings of the 38th International Conference on Machine Learning, volume 139 of Proceedings of Machine Learning Research, pp. 12310-12320. PMLR, 18-24 Jul 2021. URL https://proceedings.mlr.press/v139/zbontar21a.html. +Jiachen Zhu, Katrina Evtimova, Yubei Chen, Ravid Shwartz-Ziv, and Yann LeCun. Variance-covariance regularization improves representation learning. arXiv preprint arXiv:2306.13292, 2023. + +# A HYPERPARAMETERS + +
ParameterValue/Details
Learning Rate0.0001
Batch Size128
OptimizerAdamW
Dropout0.1
Attn. Heads4
Epochs100
Number of Layers4, 5, 6
Input Sequence Length50, 80, 100
# of Operators4, 5, 6
Total Compute Resources132GB GPU, 6CPU, 32 GB RAM
Total Job Timemax 24 Hrs
+ +Table 2: Summary of Hyper-parameters, Compute Resources, and Time for Experiments. Each experiment was run on same configurations of GPUs, with the total time dependent on the number of layers and input parameters such as Dataset, task complexity. + +We manually searched for hyperparameters, we did not do exhaustive searches such as grid search or random search. We found this was enough to find good hyperparameters for our tasks. For the two coefficients $\lambda_{1}$ and $\lambda_{2}$ in Equation ??, we keep their proportion similar to(Bardes et al., 2021). For multiplication tasks $\lambda_{1} = 1.0$ and $\lambda_{2} = 0.004$ and for other tasks we use $\lambda_{1} = 0.1$ and $\lambda_{2} = 0.5$ . For computing the covariance matrix, we use a batch size of 32 for multiplication tasks and 128 for others. Other hyperparams like learning rate and batch size values are similar to other related works (Deng et al., 2023; Feng et al., 2024). + +Regarding the number of pause tokens, we tried 2, 4, 6, 8 pause tokens on $4 \times 4$ and $5 \times 5$ digit multiplication tasks, and we did not find any correlation with task complexity. We believe it may be due to the fact that all the pause tokens share the same embedding. + +# B MODEL COMPLEXITY VS TASK DIFFICULTY + +![](images/b2074f61aa7fea29f29b4d119ef96352243aec0f315ab80328f8e1a3bd45b324.jpg) +(a) Test accuracy on Arithmetic Expressions Dataset + +![](images/445776a9066d0b3412ea8ca873f3327327ac6737de7aa07701df7be8a716d93c.jpg) +(b) Test accuracy on LIS Dataset +Figure 9: Seq-VCR + Pause Accuracy Vs Number of Layers for tasks of different complexity in Arithmetic Expressions and LIS + +Both plots in Figure9 demonstrate the trade-offs between model complexity (in terms of layers) and the complexity of the input (number of operators or sequence length). The model performs best when handling simpler configurations, such as fewer operators or shorter sequences, and tends to struggle with more complex setups as the number of operators or sequence length increases. Moreover, Increasing the number of layers seems to mitigate performance drops to some extent, especially in simpler cases, but it cannot fully offset the challenges posed by more complex inputs. All results in figure 9 are over 3 seed runs. + +![](images/2c12a9c99dd14f7846481004eaef5933af0cea1f6b0266c17bf3d6faf6810ef6.jpg) +C NUMBER OF PAUSE TAXENS VS TASK COMPLEXITY +Figure 10: Ablation of Varying Pause Tokens and Comparing Vanilla Vs Seq-VCR + Pause Tokens for different Task Complexities in the arithmetic dataset. Low, High, Medium refer to 4, 5, 6 arithmetic Operators respectively, when number of layers is fixed to 5. + +Figure10 shows that Seq-VCR + Pause model consistently achieves high accuracy (around 0.8 or higher) across all numbers of pause tokens, indicating that the addition of pause tokens does not affect its performance. The Vanilla model, in contrast, exhibits much lower accuracy across all settings except for the low-complexity task with four operators. We hypothesize that this is because five layers are likely sufficient to solve such a simple task. + +For this task, where the Vanilla model performs better, we observe a notable drop in accuracy when pause tokens are added. We speculate that this occurs because, in scenarios where the model has sufficient capacity to solve the task, pause tokens introduce distractions that hinder performance rather than enhancing it. However, in tasks with insufficient depth, such as the 5x5 digit multiplication task on GPT2-Small, pause tokens prove beneficial, as shown in Table 1. + +DATA STATISTICS + +
DatasetTaskSize# Input Tokens# CoT Tokens# Output Tokens
Multiplication4 x 4 Mult808k9478
5 x 5 Mult808k117510
Arithmetic Expression4 Operators1M19241
5 Operators1M23401
6 Operators1M27601
LISSeq Length 501M50501
Seq Length 801M80801
Seq Length 1001M1001001
+ +Table 3: Dataset statistics. Size refers to the training set. The number of input, output, and intermediate chain of thought tokens are median values on the validation set. The number of tokens are based on the GPT-2 tokenizer, and a special ending symbol is counted for both intermediate tokens and output tokens. + +# E SPEEDUP AND ACCURACY TRADE-OFF FOR PAUSE AND COT TOKENS + +Seq-VCR offers notable benefits over Chain-of-Thought (CoT) reasoning, particularly in reducing inference time and dependency on costly human-supervised data. Unlike CoT, which requires extensive labeled data for multi-step reasoning, Seq-VCR uses a few dummy pause tokens to solve tasks like multiplication in a fraction of the time (5 times faster), while performing at a similar accuracy close to $100\%$ in our experiments (see table below). Seq-VCR's efficiency in both inference time, data requirements, and accuracy makes it a more scalable and robust approach compared to CoT. + +To compute the normalized throughput for inference, we use the following equation, as in the Deng et al. (2024) paper: + +$$ +T _ {\text {n o r m}} = \frac {T _ {\text {t a r g e t}}}{T _ {\text {b a s e}}} +$$ + +Here: + +- $T_{\mathrm{norm}}$ is the normalized throughput, which represents the relative inference speed. +- $T_{\text{target}}$ is the throughput (number of examples processed per second) when using target method. +- $T_{\text{base}}$ is the throughput (number of examples processed per second) for the baseline model without Chain of Thought or Pause tokens. + +
TnormAccuracy
Method4x4 Mult5x5 Mult4x4 Mult5x5 Mult
No CoT1.01.00.250.0
With CoT0.170.141.01.0
Seq-VCR + Pause (2)0.950.910.9920.995
+ +Note, that it is expected that models with CoT tokens perform the best as CoT tokens carry more useful information than simple dummy pause tokens. However, they are more expensive to get (human labor) and require more compute to generate at inference time (since there are more of them). In that sense, Seq-VCR will always scale better than CoT, no matter the model size. + +# F COMPUTATION OF THE COVARIANCE MATRIX ACROSS BOTH THE BATCH AND LENGTH DIMENSIONS + +Here we present an ablation study done by fine-tuning GPT2-small on the $5 \times 5$ digit multiplication. We compared the performance of calculating the covariance matrix across the batch dimension vs both the batch and the length dimensions and present results in the Table below. + +Table 4: Normalized Throughput (the higher the better) and Accuracy measures on $4 \times 4$ and $5 \times 5$ digit multiplication without CoT tokens, with CoT tokens, and with 2 pause tokens. + +
GPT2-small (fine-tuned)AccuracyCompute Complexity
baseline00
Seq-VCR - batch dim0.99O(b · d2)
Seq-VCR - batch+length dim0.98O(b · n · d2)
+ +Table 5: Accuracy and compute complexity (when b, n and d are batch size, # tokens and feature dimension respectively) difference between computing the covariance matrix across the batch vs length+batch dimensions. + +We find that there are no significant differences (between 98 and $99\%$ accuracy on 5x5 digit multiplication). However the computation time is $n$ times larger on average when using both the batch and length dimensions, which grows with the increase of sequence lengths. + +# G ABALATION OF LAYERS + +We apply Seq-VCR to all layers while fine-tuning GPT-2-small on a 5x5 multiplication task. The results indicate improved performance when Seq-VCR is applied to the last layer. + +
LayerL0L11L12
Accuracy0.970.980.99
+ +With $\lambda_{1} = 1.0$ , $\lambda_{2} = 0.004$ , and pause $= 2$ , we achieve these results, where applying Seq-VCR on the first and last two layers almost solves the task, but for the rest of the layers it does not work. However, hyperparameter tuning may be required for other layers. + +# H PRE-TRAINED MODELS VS TRAINING FROM SCRATCH + +Here, we run more experiments to emphasize the advantage of fine-tuning pre-trained models. We train a GPT2-small model from scratch on $5 \times 5$ digit multiplication tasks over multiple hyperparameter settings and present the results in the table below: + +Table 6: Performance of Seq-VCR + Pause across different layers. + +
GPT2-smallFrom ScratchFine-Tuned
LayerL12L0L12L0
Baseline0000
Seq-VCR - batch dim0.030.970.990.97
Seq-VCR - batch+length dim0.870.990.981.0
+ +Training models from scratch is more sensitive to hyperparameter choices, such as batch size, and performs poorly when Seq-VCR is applied to the last layer. However, computing covariance across both the batch and length dimensions significantly improves performance. In contrast, fine-tuning GPT-2 proves to be more stable than training from scratch. Interestingly, as shown in Table 7, applying regularization to the 1st(L0) layer is effective for both fine-tuning and training from scratch. This is likely because Seq-VCR at the 1st(L0) layer enhances collapse prevention, as shown in Figure 15. + +# I EXPERIMENTS WITH LARGER MODEL + +To test the effectiveness of our approach on larger, more recent models we applied our Sec-VCR regularization method during fine-tuning of a Llama3.2-1B model with $\mathrm{LoRA}(r = 64)$ adapters on the challenging 5x5 digit multiplication task. + +We measure the representation collapse across layers for the finetuned model with and without our regularization and report results in Figure 11 below. + +Table 7: Accuracy of pre-trained and training from scratch by computing the covariance matrix across the batch vs. length+batch dimensions, applying Seq-VCR on 1st (L0) and last (L12) layers + +
LLama 3.2-1BAccuracy
Vanilla0
Seq-VCR0.974
+ +Table 8: Accuracy of finetuning Llama3.2-1B model on 5x5 digit multiplication task + +We find that the model trained with Sec-VCR has a higher average entropy (reduced collapse) by $10 - 20\%$ compared to the baseline llama model and achieving $97.4\%$ (Table 8) accuracy. This experiment highlights that collapse is not an isolated case and is still an issue in more recent models. + +![](images/73e8a69dcd57c1e8295427c07c7fa6e6cda07675abbf665d4df660377d30664c.jpg) +Figure 11: Representation collapse across llama3.2-1B layers on the $5 \times 5$ digit multiplication task. + +# J COLLAPSE AT SCALE + +![](images/a0702cf24b008386a6c75fee331295005ce6a1a09ef381b0c46ba6e4a067d485.jpg) +Figure 12: Representation collapse across scale (1B, 3B and 8B) of LLama pretrained models + +We tested pre-trained Llama models of varying scales on the 5x5 digit multiplication dataset and observed consistent representation collapse across all model sizes (Figure 12). This highlights that the issue persists regardless of scale, emphasizing the need for effective regularization techniques like Seq-VCR to mitigate collapse and improve intermediate reasoning capabilities. + +# K COLLAPSE MITIGATION IN OTHER BENCHMARKS + +To test the effectiveness of our method to other domains, we finetuned a Code-GPT-2 Small model on the CodeXGLUE-text-to-code benchmark4. We measure the representation collapse across layers for the finetuned model with and without our regularization and report results in Figure 13 below. + +We find that the model trained with Sec-VCR has a higher average entropy (reduced collapse) than the baseline pre-trained llama model by $3 - 4\%$ . This experiment showcases that our method also reduces collapse in other domains. + +![](images/740856c9fbf0aa6a5fdb5acdfe9da0f6875981ab60657d69c847d7bb4cdf6467.jpg) +Figure 13: Representation collapse across Code-GPT-2 Small layers on the CodeXGLUE-text-to-code task. + +# L COLLAPSE MITIGATION DURING PRE-TRAINING + +To evaluate the effectiveness of our method in mitigating representation collapse during pre-training, we trained GPT-2-small from scratch on the C4 dataset. The regularizer was applied either to the last layer (L12) or the first layer (L0). As shown in Figure 14, the validation perplexity achieved by our method is similar to the baseline Vanilla validation perplexity. For $L0$ , $\lambda_{1} = 1.0$ and $\lambda_{2} = 0.01$ and for $L12$ , $\lambda_{1} = 0.5$ and $\lambda_{2} = 0.1$ + +![](images/dd9b0eaaa677e1198fa6aa2e57547c6b558808bc2a76ece3a1a5a70096d196a7.jpg) +Figure 14: Validation Perplexity of GPT-2 Small trained on the C4 dataset. + +However, Figure 15 demonstrates that Seq-VCR effectively mitigates collapse across layers. We find that the model trained with Sec-VCR has a higher average entropy (reduced collapse) than the vanilla trained model by $3 - 5\%$ . This experiment showcases that our method also reduces collapse in other domains. Notably, applying the regularizer to the first layer resulted in a more stable prevention of collapse in intermediate layers. + +![](images/05a0643c70469708b0473f1bd6f08e8cda50f1c6c946321246fd4b54f65b5cc6.jpg) +Figure 15: Representation collapse across GPT-2 Small layers after the C4 pretraining. + +# M RESULTS ON GSM8K + +We performed further experiments to fine-tune the GPT-2 Small model using an enhanced version of the GSM8K dataset[1], incorporating and excluding Seq-VCR, Pause (2), and CoT. The findings are presented below. + +
MethodAccuracy
Vanilla0.191
CoT0.437
Pause(2)0.197
Seq-VCR0.198
Seq-VCR + Pause(2)0.202
+ +Table 9: Comparison of Various Methods by Fine-tuning GPT-2 Small on the GSM8K Dataset. + +For this dataset, performance improves slightly compared to Vanilla fine-tuning when using SeqVCR without pauses, and even more when applying pauses with Seq-VCR. \ No newline at end of file diff --git a/ICLR/2025/Seq-VCR_ Preventing Collapse in Intermediate Transformer Representations for Enhanced Reasoning/images.zip b/ICLR/2025/Seq-VCR_ Preventing Collapse in Intermediate Transformer Representations for Enhanced Reasoning/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..44ce046d5ec36ac5508b77bc3758fb32787f8557 --- /dev/null +++ b/ICLR/2025/Seq-VCR_ Preventing Collapse in Intermediate Transformer Representations for Enhanced Reasoning/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:672f8cb232c67c956eb525cb50f2587cbeca2a21b3ed4dec59e229edc7369f24 +size 786596 diff --git a/ICLR/2025/Seq-VCR_ Preventing Collapse in Intermediate Transformer Representations for Enhanced Reasoning/layout.json b/ICLR/2025/Seq-VCR_ Preventing Collapse in Intermediate Transformer Representations for Enhanced Reasoning/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..4595bed45d6810356047a289a6de3a179c8fdc74 --- /dev/null +++ b/ICLR/2025/Seq-VCR_ Preventing Collapse in Intermediate Transformer Representations for Enhanced Reasoning/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c7bf797a690f0300bc43d6ca03accf84d31c29db9534d1e4f865f11c4ce6111a +size 578186 diff --git a/ICLR/2025/Sequential Controlled Langevin Diffusions/e096e8f8-98af-4e7f-8bce-7cd09958a8b5_content_list.json b/ICLR/2025/Sequential Controlled Langevin Diffusions/e096e8f8-98af-4e7f-8bce-7cd09958a8b5_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..eba12b6d9e787b7c9aa48a0b6b3faebb2aef6f3b --- /dev/null +++ b/ICLR/2025/Sequential Controlled Langevin Diffusions/e096e8f8-98af-4e7f-8bce-7cd09958a8b5_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:02ab54a7a29605a3e9b6fd41f005eddeb728aeb86b475992a0aa979eae1cd1ee +size 243925 diff --git a/ICLR/2025/Sequential Controlled Langevin Diffusions/e096e8f8-98af-4e7f-8bce-7cd09958a8b5_model.json b/ICLR/2025/Sequential Controlled Langevin Diffusions/e096e8f8-98af-4e7f-8bce-7cd09958a8b5_model.json new file mode 100644 index 0000000000000000000000000000000000000000..77eb03318a77dff6e3dbcb467940a78cdb428c58 --- /dev/null +++ b/ICLR/2025/Sequential Controlled Langevin Diffusions/e096e8f8-98af-4e7f-8bce-7cd09958a8b5_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d41a89eeda876cc242d5ae59b0428654de86958cbce95d55dca44c06fc6f4b79 +size 294663 diff --git a/ICLR/2025/Sequential Controlled Langevin Diffusions/e096e8f8-98af-4e7f-8bce-7cd09958a8b5_origin.pdf b/ICLR/2025/Sequential Controlled Langevin Diffusions/e096e8f8-98af-4e7f-8bce-7cd09958a8b5_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..db2323479681322d24f5f1a4cd8d38220f9b9a62 --- /dev/null +++ b/ICLR/2025/Sequential Controlled Langevin Diffusions/e096e8f8-98af-4e7f-8bce-7cd09958a8b5_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:02d8a53b1e3a8066b925cc73568a9f4f93a5684499ce7dbca8b3ff83e0192cac +size 3899942 diff --git a/ICLR/2025/Sequential Controlled Langevin Diffusions/full.md b/ICLR/2025/Sequential Controlled Langevin Diffusions/full.md new file mode 100644 index 0000000000000000000000000000000000000000..7f0931bb29e48620abc3b6477352af8e2e1be197 --- /dev/null +++ b/ICLR/2025/Sequential Controlled Langevin Diffusions/full.md @@ -0,0 +1,1057 @@ +# SEQUENTIAL CONTROLLED LANGEVIN DIFFUSIONS + +Junhua Chen\*,†,1, Lorenz Richter\*,2,3, Julius Berner\*,†,4, Denis Blessing\*,5, Gerhard Neumann\*, Anima Anandkumar\* + +1University of Cambridge, 2Zuse Institute Berlin, 3dida Datenschmiede GmbH, + +$^{4}$ NVIDIA, $^{5}$ Karlsruhe Institute of Technology, $^{6}$ California Institute of Technology + +# ABSTRACT + +An effective approach for sampling from unnormalized densities is based on the idea of gradually transporting samples from an easy prior to the complicated target distribution. Two popular methods are (1) Sequential Monte Carlo (SMC), where the transport is performed through successive annealed densities via prescribed Markov chains and resampling steps, and (2) recently developed diffusion-based sampling methods, where a learned dynamical transport is used. Despite the common goal, both approaches have different, often complementary, advantages and drawbacks. The resampling steps in SMC allow focusing on promising regions of the space, often leading to robust performance. While the algorithm enjoys asymptotic guarantees, the lack of flexible, learnable transitions can lead to slow convergence. On the other hand, diffusion-based samplers are learned and can potentially better adapt themselves to the target at hand, yet often suffer from training instabilities. In this work, we present a principled framework for combining SMC with diffusion-based samplers by viewing both methods in continuous time and considering measures on path space. This culminates in the new Sequential Controlled Langevin Diffusion (SCLD) sampling method, which is able to utilize the benefits of both methods and reaches improved performance on multiple benchmark problems, in many cases using only $10\%$ of the training budget of previous diffusion-based samplers. + +# 1 INTRODUCTION + +We consider the task of sampling from densities of the form + +$$ +p _ {\text {t a r g e t}} = \frac {\rho_ {\text {t a r g e t}}}{Z} \quad \text {w i t h} \quad Z := \int_ {\mathbb {R} ^ {d}} \rho_ {\text {t a r g e t}} (x) \mathrm {d} x, \tag {1} +$$ + +where $\rho_{\mathrm{target}} \in C(\mathbb{R}^d, \mathbb{R}_{\geq 0})$ can be evaluated pointwise, but the normalizing constant $Z$ is typically intractable. This task is of great practical interest, with numerous applications in the natural sciences (Zhang et al., 2023b), for instance, for Boltzmann distributions in molecular dynamics or lattice field theory in quantum physics, as well as posterior sampling in Bayesian statistics (Gelman et al., 2013). + +Sampling problems vs. generative modeling. The sampling problem poses unique challenges not found in other areas of probabilistic modeling. For instance, while both generative modeling and sampling involve approximating a target distribution $p_{\mathrm{target}}$ , they differ fundamentally in terms of the information available. In generative modeling, one has access to samples $X \sim p_{\mathrm{target}}$ , whereas in sampling, we only have access to a pointwise oracle $\rho_{\mathrm{target}}$ (and, potentially, its pointwise gradients) and no samples. This distinction introduces obstacles for the sampling problem that do not exist in generative modeling. For example, a key challenge in modeling a distribution is identifying its regions of high probability, or modes. When samples are available, they can directly reveal the locations of these modes. In their absence, however, the sampling algorithm must include an exploration strategy to discover them and identify their shape. This exploration becomes exponentially more difficult as the dimensionality of the state space increases, making the sampling problem challenging even in moderate dimensions (e.g., 10 - 50). + +Dynamical Measure Transport A general idea to approach the sampling problem is to draw particles from an easy prior distribution and gradually move them toward the complicated target (sometimes termed dynamical measure transport). In this work, we focus on two popular paradigms: + +![](images/aea731766b4142944c9e62f34410e67c6650327e5b80968744f31bb74152d445.jpg) +Figure 1: Illustration of our SCLD algorithm, which combines controlled Langevin diffusions with Sequential Monte Carlo methods. The goal is to sample from a target distribution by learning a stochastic evolution (diffusion steps) that starts from a tractable prior and evolves along a prescribed annealed density to the target. We do not have access to samples from the target distribution but can only evaluate its density up to a normalizing factor. At intermediate timesteps, we resample according to the importance weights of each subtrajectory (black dots) and use MCMC steps for additional refinement (yellow dots). + +- In Annealed Importance Sampling (AIS) (Neal, 2001) and its extension Sequential Monte Carlo (SMC) (Chopin, 2002; Del Moral et al., 2006) particles are successively updated and reweighted, as to approach relevant regions in space, targeting an annealed sequence of intermediate distributions. This procedure is typically formulated in discrete time and does not require learning. +- In diffusion-based sampling (Richter & Berner, 2024; Vargas et al., 2024) the idea is to learn a drift of a stochastic differential equation (SDE) to transport the samples from the prior to the desired target, typically formulated in continuous time. The absence of samples means that data-driven approaches such as for generative modeling (Song et al., 2021) are not possible, and training is instead done via variational inference, gaining information through evaluations of $\rho_{\mathrm{target}}$ . + +Each paradigm brings its own advantages and drawbacks. Traditional SMC methods rely on predefined rules for particle updates, such as Markov Chain Monte Carlo (MCMC) and resampling methods, which help to direct computational effort onto promising regions of the space and enjoy asymptotic guarantees. While they do not require learning, the employed MCMC methods can, in many cases, exhibit slow convergence to the target (Del Moral et al., 2006). Diffusion-based samplers, on the other hand, require a training phase, which enables them to automatically adapt to the given target. However, training can take significant time and often suffers from numerical instabilities as well as mode collapse (Richter & Berner, 2024). + +Sequential Controlled Langevin Diffusions. In this work, we show that the two methods can complement each other. SMC can benefit from the flexible nature of the learnable transitions, and resampling and MCMC can help diffusion-based samplers converge faster and counteract numerical stability issues arising, for instance, from outlier particles. Motivated by this, we identify a principled and general framework to unify the two methods, culminating in our Sequential Controlled Langevin Diffusion (SCLD) algorithm, which alternates between SMC and diffusion steps as illustrated in Figure 1. In addition, we devise a family of loss functions that enables end-to-end training (i.e., for which the algorithm used during inference can be directly optimized). This becomes possible by viewing both methods in continuous time and considering measures of the underlying SDEs on the path space. Overall, Our contributions can be summarized as follows: + +- Taking the continuous-time perspective, we can rigorously connect and unify SMC and diffusion-based sampling by performing importance sampling in path space. +- The principled framework of path space measures allows us to readily propose suitable loss functions, which allow for off-policy training with replay buffers and provably scale better to high dimensions than previously used losses. +- Building on those connections, we propose our new sampling method Sequential Controlled Langevin Diffusion (SCLD) as a special case of our framework. +- We show that our method achieves competitive performance on 11 real-world and synthetic examples, improving over other baseline methods in almost every task, and in many cases only using $10\%$ of the training budget. In two tasks based on robotics control, our method is the only one to approximately recover the true distribution. + +# 1.1 RELATED WORK + +We present an extensive comparison to related works in Appendix A.1. To summarize, our proposed SCLD sampler relies on three crucial building blocks: + +Table 1: Comparison of different methods (see Appendix A.1 for details). By discretization-flexible, we describe the fact that we can include resampling and MCMC steps at arbitrary times. Finite-time convergence refers to the property that the target distribution can (theoretically, in the optimum) be reached in finite time. We note that stochastic transitions allow omitting or reducing (costly) MCMC steps in learned SMC methods. + +
Traditional SMCCMCDCRAFTPDDSSCLD (ours)
Learned TransitionX (MCMC)✓ (Neural SDE)✓ (Neural ODE)✓ (Neural SDE)✓ (Neural SDE)
Stochastic Transition✓✓X✓✓
End-to-end Training-✓✓ (needs importance weights)X (alternating)✓ (incl. hyperparameters)
Particle Method✓X✓✓✓
Discretization-flexible✓✓X✓ (in theory)✓
Finite-time ConvergenceX✓✓✓✓
+ +Sequential Monte Carlo (SMC). SMC methods (Chopin, 2002; Del Moral et al., 2006) describe a general methodology to sample sequentially from a sequence of annealed distributions, using transition kernels (typically based on MCMC) and resampling steps. To mitigate drawbacks such as long mixing times and tedious tuning, previous works proposed to learn the kernels (Phillips et al., 2024; Matthews et al., 2022; Arbel et al., 2021). However, prior training objectives suffer from various shortcomings, either requiring importance sampling with potentially high variance, exhibiting bias, or relying on alternating methods that preclude end-to-end training (see also Table 1). Further, they need to place restrictions on their parameterizations or suffer from unfavorable computational costs. In particular, approaches with deterministic transitions, such as normalizing flows, require computations of divergences or Jacobian determinants, and MCMC steps to recover sample diversity after resampling. This is not needed for methods based on stochastic transitions like our method SCLD. + +Diffusion-based samplers on subtrajectories. To overcome these shortcomings and flexibly parameterize the transition kernels, we draw ideas from recent work on controlled SDEs for sampling problems (Zhang et al., 2023a; Richter & Berner, 2024). This can be done by partitioning the SDE trajectories in time. However, to compute importance weights (in path space), which are necessary for resampling as well as for MCMC kernels in SMC, the SDE marginals after each subtrajectory need to be known. To cope with that, we identify the recently proposed Controlled Monte Carlo Diffusions (CMCD) (Vargas et al., 2024) as a suitable framework since it allows us to define a prescribed (and therefore known) target evolution of the SDE marginals. Building upon this, we develop an extension of SMC to continuous time, where resampling (and, optionally, MCMC steps) can be employed at arbitrary times. + +Log-variance loss. However, the subtrajectories and discrete resampling steps make optimization challenging. Previous methods either relied on alternating schemes or approaches based on the reverse KL divergence and importance sampling, known to suffer from mode collapse and potentially high variance. We show that the log-variance loss (Nusken & Richter, 2021) offers a way to obtain a principled, efficient, and low-variance objective such that we can optimize our sampler and parts of the hyperparameters in an end-to-end fashion using replay buffers. + +# 2 SEQUENTIAL CONTROLLED LANGEVIN DIFFUSIONS + +We start by giving an introduction to Sequential Monte Carlo methods. However, different from previous work, our focus is on a continuous-time perspective that can be readily integrated with diffusion-based samplers. + +# 2.1 A PRIMER ONSEQUENTIAL MONTE CARLO IN CONTINUOUS TIME + +Importance sampling (IS). The idea of utilizing samples from a prior distribution in order to compute statistics relying on samples from a target can be motivated by importance sampling. In its simplest case, one can compute unbiased estimates w.r.t. the target distribution via + +$$ +\mathbb {E} _ {X _ {T} \sim p _ {\text {t a r g e t}}} [ \varphi (X _ {T}) ] = \mathbb {E} _ {X _ {0} \sim p _ {\text {p r i o r}}} [ \varphi (X _ {0}) w (X _ {0}) ] \approx \frac {1}{K} \sum_ {k = 1} ^ {K} \varphi (X _ {0} ^ {(k)}) w (X _ {0} ^ {(k)}), \tag {2} +$$ + +where $\varphi \in C(\mathbb{R}^d,\mathbb{R})$ is a function of interest, the weight is defined as $w\coloneqq \frac{p_{\mathrm{target}}}{p_{\mathrm{prior}}}$ , and $(X_0^{(k)})_{k = 1}^K$ are i.i.d. samples from $p_{\mathrm{prior}}$ . Since importance sampling becomes highly inefficient if the high- + +probability regions of prior and target do not overlap substantially, a key idea is to gradually "transport" $X_0$ to $X_T$ . + +Annealed importance sampling (AIS). In particular, we may sequentially move particles from the prior to the target along a curve $(\pi(\cdot, t))_{t \in [0, T]}$ , chosen such that $\pi(\cdot, 0) = p_{\mathrm{prior}}$ and $\pi(\cdot, T) = p_{\mathrm{target}}$ , e.g., by linear interpolation in log-space (Dai et al., 2022). To this end, we consider two (time-dependent, forward and backward) Markov kernels $\vec{p}_{s|t}$ and $\vec{p}_{t|s}$ . Given a time grid $0 = t_0 < t_1 < \dots < t_N = T$ (also referred to as annealing steps), we may now sample $X_{t_0} \sim p_{\mathrm{prior}}$ and iterate for each $n = 1, \ldots, N$ : + +1. Sample $X_{t_n}\sim \vec{p}_{t_n|t_{n - 1}}(\cdot |X_{t_{n - 1}})$ +2. Compute the weights $w_{t_{n-1}, t_n}(X_{t_{n-1}}, X_{t_n}) = \frac{\pi(X_{t_n}, t_n) \overline{p}_{t_{n-1} \mid t_n}(X_{t_{n-1}}|X_{t_n})}{\pi(X_{t_{n-1}}, t_{n-1}) \overline{p}_{t_n \mid t_{n-1}}(X_{t_n}|X_{t_{n-1}})}$ . + +We can then perform importance sampling on an augmented target distribution via the weights + +$$ +w \left(X _ {t _ {0}}, \dots , X _ {t _ {N}}\right) := \prod_ {n = 1} ^ {N} w _ {t _ {n - 1}, t _ {n}} \left(X _ {t _ {n - 1}}, X _ {t _ {n}}\right) = \frac {\bar {p} _ {t _ {0} , \dots , t _ {N}} \left(X _ {t _ {0}} , \dots , X _ {t _ {N}}\right)}{\bar {p} _ {t _ {0} , \dots , t _ {N}} \left(X _ {t _ {0}} , \dots , X _ {t _ {N}}\right)}, \tag {3} +$$ + +where $\vec{p}_{t_0,\dots,t_N}$ and $\vec{p}_{t_0,\dots,t_N}$ are the joint densities of the "forward" and a corresponding "backward" operation. In particular, in analogy to (2), it holds that + +$$ +\mathbb {E} _ {X _ {t _ {0}}, \dots , X _ {t _ {N}}} \left[ \varphi (X _ {T}) w (X _ {t _ {0}}, \dots , X _ {t _ {N}}) \right] = \mathbb {E} _ {X _ {T} \sim p _ {\mathrm {t a r g e t}}} \left[ \varphi (X _ {T}) \right]. \tag {4} +$$ + +Resampling. In principle, any forward and backward Markov kernels lead to an unbiased estimator of the expectation of interest, as stated in (4). In practice, however, a notorious problem with importance sampling is its potentially high variance. Specifically, the variance might increase exponentially with the dimension, sometimes termed curse of dimensionality, see, e.g., Chatterjee & Diaconis (2018); Hartmann & Richter (2024). To circumvent this issue, one idea is to sequentially "update" samples (also referred to as "particles") during the course of the simulation according to their weights, so as to refocus computational effort on promising particles—a procedure referred to as resampling. For instance, we can select only certain (relevant) samples $X_0^{(k)}$ for the estimation of the expectation in (2). To this end, let $O^{(k)}$ be a random variable with values in $\{0,\dots ,K\}$ and $\mathbb{E}[O^{(k)}|X_0^{(1)},\ldots ,X_0^{(K)}] = KW(X_0^{(k)})$ , where $W(X_0^{(k)})\coloneqq w(X_0^{(k)}) / \sum_{i = 1}^K w(X_0^{(i)})$ , defining how many times we select the $k$ -th sample. Due to the tower property, we can then also obtain a consistent estimator of the expectation in (2) via + +$$ +\mathbb {E} _ {X _ {T} \sim p _ {\text {t a r g e t}}} [ \varphi (X _ {T}) ] \approx \frac {1}{K} \sum_ {k = 1} ^ {K} \varphi (X _ {0} ^ {(k)}) O ^ {(k)}. \tag {5} +$$ + +A common choice is to consider $O \sim \mathcal{M}_K(W(X_0^{(1)}),\ldots ,W(X_0^{(K)}))$ drawn from a multinomial distribution with $K$ trials, where the normalized weights determine the event probabilities (Gordon et al., 1993). We note that with this resampling step, we introduce additional stochasticity. However, at the same time, it can bring statistical advantages by focusing on "relevant" samples, e.g., stabilizing effects and variance reduction (Dai et al., 2022). + +Remark 2.1 (SMC formulation in continuous vs. discrete time). We stress that, even though we evaluate our process $X$ on $N + 1$ discrete time instances, the formalism above includes time-continuous processes $(X_{t})_{t\in [0,T]}$ . While some transition kernels used in SMC, e.g., uncorrected Langevin kernels, can be interpreted in continuous time, SMC is typically stated for a fixed number of discrete steps. We will see in the sequel how the continuous-time formulation offers an elegant framework with certain advantages, in particular, allowing us to integrate learned SDE-based transition kernels and interleave them with resampling and MCMC steps at arbitrary times. + +# 2.2 CONTROLLED SDES AND IMPORTANCE SAMPLING IN PATH SPACE + +A central question in SMC is how to choose the forward and backward transition densities $\vec{p}_{s|t}$ and $\vec{p}_{t|s}$ defined above. Clearly, when the forward and backward joint densities stated in (3) agree, we achieve perfect sampling in the sense that no corrections with importance weights are necessary. However, it is typically not possible to obtain such transitions, and thus the choice of $\vec{p}_{s|t}$ and $\vec{p}_{t|s}$ to approximate this criterion is of critical importance to the success of SMC. Whereas, traditionally, MCMC steps have been employed as the transition kernel (Dai et al., 2022), they are known to require a large number of steps to achieve approximate transportation between densities. In recent years, there has been interest in employing learned transition densities to overcome the slow convergence times of fixed MCMC kernels (Matthews et al., 2022; Phillips et al., 2024). Advancing those + +Algorithm 1 Sequential Controlled Langevin Diffusion (SCLD). See Algorithm 2 for details. +Require: Annealing path $\pi$ , learned control $u$ , time grid $0 = t_0 < \dots < t_N = T$ +1: Initialize: $\overline{X}_0 := X_0^{(1:K)} \sim p_{\text{prior}}$ and $\overline{w}_0 := w_0^{(1:K)} = 1$ +2: for $n = 1$ to $n = N$ do +3: Transport: $\overline{X}_{[t_{n-1},t_n]} = \text{simulate\_SDE}(\overline{X}_{t_{n-1}},u)$ +4: Compute RNDs: $\overline{w}_{[t_{n-1},t_n]} = \frac{\mathrm{d}\overline{P}_{[t_{n-1},t_n]}}{\mathrm{d}\overline{P}_{[t_{n-1},t_n]}}(\overline{X}_{[t_{n-1},t_n]})$ +5: Update weights: $\overline{w}_n = \overline{w}_{n-1}\overline{w}_{[t_{n-1},t_n]}$ +6: Resample: $\overline{X}_{t_n},\overline{w}_n = \text{resample}(\overline{X}_{t_n},\overline{w}_n)$ +7: return Samples $\overline{X}_T := X_T^{(1:K)}$ approximately from $p_{\text{target}}$ + +attempts, we will show how transition densities corresponding to SDEs yield a principled solution that, moreover, allows us to leverage recent advancements of diffusion models. + +Diffusion bridges. To this end, let us consider the stochastic process $X^{u} = (X_{t}^{u})_{t\in [0,T]}$ , defined by the SDE + +$$ +\mathrm {d} X _ {t} ^ {u} = u \left(X _ {t} ^ {u}, t\right) \mathrm {d} t + \sigma (t) \vec {\mathrm {d}} W _ {t}, \quad X _ {0} ^ {u} \sim p _ {\text {p r i o r}}, \tag {6} +$$ + +where $u \in C(\mathbb{R}^d \times [0, T], \mathbb{R}^d)$ is a control function, $\sigma \in C([0, T], \mathbb{R})$ the diffusion coefficient, and $W$ a standard Brownian motion. This process uniquely defines a forward transition density $\vec{p}_{s|t}$ and falls into the framework stated in Section 2.1 for any time steps $0 = t_0 < t_1 < \dots < t_N = T$ . In fact, we can leverage the ideas from CMCD (Vargas et al., 2024) and learn $u$ such that the transport happens along a prescribed density in time, i.e., such that the density $p_{X^u}(\cdot, t)$ of $X_t^u$ is equal to a prescribed target density $\pi(\cdot, t)$ , connecting the prior and the target, for every $t \in [0, T]$ ; cf. Lemma 2.2 below. We will see that the knowledge of the marginals allows for a natural integration within SMC frameworks. Now, similar to the importance sampling framework from Section 2.1, the general idea is to exploit a time-reversed dynamics that starts in the desired target density. To be precise, we may further define a related reverse-time SDE + +$$ +\mathrm {d} Y _ {t} ^ {v} = v \left(Y _ {t} ^ {v}, t\right) \mathrm {d} t + \sigma (t) \mathrm {d} W _ {t}, \quad Y _ {T} ^ {v} \sim p _ {\text {t a r g e t}}, \tag {7} +$$ + +which depends on the control $v \in C(\mathbb{R}^d \times [0, T], \mathbb{R}^d)$ and where $\bar{\mathrm{d}} W_t$ denotes backward $^2$ integration of Brownian motion. Now, if $u$ and $v$ are learned such that $X^u$ and $Y^v$ are time-reversals of each other, then $p_{X^u} = p_{Y^v}$ , i.e., the two processes transport the prior to the target and vice versa. However, in this general setting, there are infinitely many such bridging processes, all fulfilling Nelson's identity (Nelson, 1967), i.e., + +$$ +u - v = \sigma^ {2} \nabla \log p _ {X ^ {u}} = \sigma^ {2} \nabla \log p _ {Y ^ {v}}. \tag {8} +$$ + +Since our goal is to satisfy $p_{X^u} = p_{Y^v} = \pi$ , we can incorporate this constraint via the ansatz $v = u - \sigma^2\nabla \log \pi$ , leading to the SDE + +$$ +\mathrm {d} Y _ {t} ^ {u} = \left(u - \sigma^ {2} \nabla \log \pi\right) \left(Y _ {t} ^ {u}, t\right) \mathrm {d} t + \sigma (t) \overleftarrow {\mathrm {d}} W _ {t}, \quad Y _ {T} ^ {u} \sim p _ {\text {t a r g e t}}, \tag {9} +$$ + +as suggested in Vargas et al. (2024), noting that the process now also depends on the control $u$ . Consequently, under mild conditions, this constraint leads to a unique gradient field representing the solution $u^{*}$ to the time-reversal problem (Vargas et al., 2024, Proposition 3.2). We comment on more general, learnable density evolutions in Remark A.1. + +Measures in path space. The task of learning the time-reversal can be approached via the perspective of measures on the space of continuous trajectories $C([0,T],\mathbb{R}^d)$ , also called path space. Loosely speaking, a path space measure $\vec{\mathbb{P}} = \vec{\mathbb{P}}^{u,p_{\mathrm{prior}}}$ of the process (6) can be thought of as the joint density $\vec{p}_{t_0,\dots,t_N}(X_{t_0}^u,\ldots,X_{t_N}^u)$ in (3) when $N\to \infty$ , i.e., evaluated along infinitely many time instances (Baldi, 2017, Corollary 11.1). + +In analogy to importance sampling described in Section 2.1, we may now consider a change of measure in path space, i.e., + +$$ +\mathbb {E} _ {X ^ {u} \sim \tilde {\mathbb {P}}} \left[ \varphi \left(X _ {T} ^ {u}\right) w \left(X ^ {u}\right) \right] = \mathbb {E} _ {Y ^ {u} \sim \tilde {\mathbb {P}}} \left[ \varphi \left(Y _ {T} ^ {u}\right) \right] = \mathbb {E} _ {x \sim p _ {\text {t a r g e t}}} [ \varphi (x) ], \tag {10} +$$ + +where $w = \frac{\mathrm{d}\overline{\mathbb{P}}}{\mathrm{d}\overline{\mathbb{P}}}$ and $\overline{\mathbb{P}} = \overline{\mathbb{P}}^{u,p_{\mathrm{target}}}$ is the path space measure associated to (9). Furthermore, we can formulate the time-reversal task as the minimization problem + +$$ +u ^ {*} = \arg \min _ {u \in \mathcal {U}} D \left(\overleftrightarrow {\mathbb {P}} ^ {u, p _ {\text {p r i o r}}}, \overleftrightarrow {\mathbb {P}} ^ {u, p _ {\text {t a r g e t}}}\right), \tag {11} +$$ + +where $D$ is a divergence and $\mathcal{U} \subset C(\mathbb{R}^d \times [0, T], \mathbb{R}^d)$ the set of admissible controls, cf. Richter & Berner (2024). If we can bring the divergence to zero, we have indeed achieved time-reversal between the forward and backward transitions and, thus, perfect sampling. Both for (10) and typical divergences in (11), it is essential to have a tractable expression for the likelihood ratio $w$ between the measures of the forward and the reverse-time process, also called the Radon-Nikodym derivative (RND). This is given by the following lemma; see Vargas et al. (2024) for the proof. + +Lemma 2.2 (Likelihood ratio between path measures). Let $\vec{\mathbb{P}}_{[s,t]}$ and $\vec{\mathbb{P}}_{[s,t]}$ be the path space measures of the solutions to the SDEs in (6) and (9) on the time interval $[s,t]\subset [0,T]$ , where we assume $X_s^u\sim \pi (\cdot ,s)$ and $Y_{t}^{u}\sim \pi (\cdot ,t)$ . Then for a generic process $X$ it holds + +$$ +\begin{array}{l} w _ {[ s, t ]} (X) = \frac {\mathrm {d} \tilde {\mathbb {P}} _ {[ s , t ]}}{\mathrm {d} \tilde {\mathbb {P}} _ {[ s , t ]}} (X) = \frac {\pi \left(X _ {t} , t\right)}{\pi \left(X _ {s} , s\right)} \exp \left(\int_ {s} ^ {t} \frac {\| u \| ^ {2} - \| u - \sigma^ {2} \nabla \log \pi \| ^ {2}}{2 \sigma^ {2}} \left(X _ {\tau}, \tau\right) \mathrm {d} \tau \right. \tag {12} \\ + \int_ {s} ^ {t} \frac {u - \sigma^ {2} \nabla \log \pi}{\sigma^ {2}} (X _ {\tau}, \tau) \cdot \overleftarrow {\mathrm {d}} X _ {\tau} - \int_ {s} ^ {t} \frac {u}{\sigma^ {2}} (X _ {\tau}, \tau) \cdot \overrightarrow {\mathrm {d}} X _ {\tau}). \\ \end{array} +$$ + +As can be seen from Lemma 2.2, path space measures can be readily employed for sequential algorithms that operate on the time grid that we introduced before. In particular, we may divide our trajectories $X^{u}$ and $Y^{u}$ into subtrajectories and thus our path space measure into multiple chunks. To be precise, we may write + +$$ +w = \frac {\mathrm {d} \widetilde {\mathrm {P}}}{\mathrm {d} \widetilde {\mathrm {P}}} = \frac {\mathrm {d} \widetilde {\mathrm {P}} _ {[ t _ {0} , t _ {1} ]}}{\mathrm {d} \widetilde {\mathrm {P}} _ {[ t _ {0} , t _ {1} ]}} \dots \frac {\mathrm {d} \widetilde {\mathrm {P}} _ {[ t _ {N - 1} , t _ {N} ]}}{\mathrm {d} \widetilde {\mathrm {P}} _ {[ t _ {N - 1} , t _ {N} ]}} = w _ {[ t _ {0}, t _ {1} ]} \dots w _ {[ t _ {N - 1}, t _ {N} ]}. \tag {13} +$$ + +Different from the framework in Section 2.1, we note that Lemma 2.2 offers an explicit formula for computing the weights $w_{[t_{n - 1}, t_n]}$ in continuous time. As can be seen in the importance sampling identity (10), the weights can be interpreted as correcting for a potentially imperfect time-reversal. For convenience, we state Algorithm 1 for a simplified, high-level overview of combining SMC with diffusion models and refer to Algorithm 2 in Appendix A.3 for a more detailed exposition. Further, we note that the suggested setting relates to the usual SMC algorithm (such as in Dai et al. (2022)) by taking a different forward transport step (where our Markov kernel is implemented by an SDE) and by adopting the weighting step (using the Radon-Nikodym derivative in place of the likelihood ratio). Using the target density $\pi(\cdot, t_n)$ , we can also add MCMC refinements at each time $t_n$ ; see Section 2.4. + +# 2.3 LOSS FUNCTIONS AND OFF-POLICY TRAINING + +We can adapt the idea of learning the optimal control $u^{*}$ to our sequential setting by considering divergences on each subinterval $[t_{n - 1}, t_n]$ separately, in consequence bringing losses of the form + +$$ +\mathcal {L} (u) = \sum_ {n = 1} ^ {N} D \left(\overrightarrow {\mathbb {P}} _ {[ t _ {n - 1}, t _ {n} ]} ^ {u, \pi_ {n - 1}}, \overleftarrow {\mathbb {P}} _ {[ t _ {n - 1}, t _ {n} ]} ^ {u, \pi_ {n}}\right), \tag {14} +$$ + +where $\pi_n \coloneqq \pi(\cdot, t_n)$ . We stress that with (14) optimization can in principle be conducted globally in spite of the resampling happening sequentially. However, depending on the choice of the divergence, this comes with additional challenges. + +KL divergence. A classical choice is the Kullback-Leibler (KL) divergence $D = D_{\mathrm{KL}}$ , i.e., + +$$ +D _ {\mathrm {K L}} \left(\vec {\mathbb {P}} _ {[ t _ {n - 1}, t _ {n} ]} ^ {u, \pi_ {n - 1}} | \vec {\mathbb {P}} _ {[ t _ {n - 1}, t _ {n} ]} ^ {u, \pi_ {n}}\right) = - \mathbb {E} _ {X ^ {u} \sim \vec {\mathbb {P}} _ {[ t _ {n - 1}, t _ {n} ]} ^ {u, \pi_ {n - 1}}} \left[ \log \left(w _ {[ t _ {n - 1}, t _ {n} ]} (X ^ {u})\right) \right], \tag {15} +$$ + +where $w_{[t_{n-1}, t_n]}$ is defined as in Lemma 2.2 and the minus originates from the reciprocal importance weights in the logarithm. However, for computing the expectation we need $X_{t_{n-1}}^u \sim \pi_{n-1}$ . If resampling has been employed in the previous iteration (at time $t_{n-1}$ ; see Algorithm 1), a potential mismatch in the expectation is automatically corrected. Alternatively, we may correct with importance sampling in path space. To this end, let $t_m$ (with $t_m < t_{n-1}$ ) be the last time resampling has been conducted, i.e., the last time the weights have been reset; see Algorithm 5. As suggested in + +Matthews et al. (2022), we can then consider the importance weight $w_{[t_m, t_{n-1}]}$ and compute + +$$ +D _ {\mathrm {K L}} \left(\vec {\mathbb {P}} _ {[ t _ {n - 1}, t _ {n} ]} ^ {u, \pi_ {n - 1}} | \vec {\mathbb {P}} _ {[ t _ {n - 1}, t _ {n} ]} ^ {u, \pi_ {n}}\right) = - \mathbb {E} _ {X ^ {u} \sim \vec {\mathbb {P}} _ {[ t _ {m}, t _ {n} ]} ^ {u, \pi_ {m}}} \left[ \log \left(w _ {[ t _ {n - 1}, t _ {n} ]} (X ^ {u})\right) w _ {[ t _ {m}, t _ {n - 1} ]} (X ^ {u}) \right], \tag {16} +$$ + +for which $X_{t_{n-1}}^u$ does not need to be distributed according to $\pi_{n-1}$ anymore. However, the importance weights potentially introduce additional variance into the loss, particularly in high dimensions. This observation is stated rigorously in the following proposition, cf. Nusken & Richter (2021, Proposition 5.7), and proved in Appendix A.2. + +Proposition 2.3 (Relative error of KL divergence). Denote by $D_{\chi^2}$ the $\chi^2$ -divergence and by $r^{(K)} \coloneqq \mathrm{Var}(\widehat{D}_{\mathrm{KL}}^{(K)})^{1/2} / D_{\mathrm{KL}}$ the relative error of the Monte Carlo estimator $\widehat{D}_{\mathrm{KL}}^{(K)}$ of the KL divergence in (16) with sample size $K$ . Moreover, let $t_m$ be the last resampling time and let $\mathbb{P}_{[t_{n-1}, t_n]}^{\otimes I}$ and $\mathbb{P}_{[t_{n-1}, t_n]}^{\otimes I}$ be the $I$ -fold product measures of identical copies of $\mathbb{P}_{[t_{n-1}, t_n]}$ and $\mathbb{P}_{[t_{n-1}, t_n]}$ , respectively. Then there exists a constant $c > 0$ , such that for any $I \geq 2$ it holds that + +$$ +r ^ {(K)} \left(\vec {\mathbb {P}} _ {[ t _ {n - 1}, t _ {n} ]} ^ {\otimes I} | \vec {\mathbb {P}} _ {[ t _ {n - 1}, t _ {n} ]} ^ {\otimes I}\right) \geq c \left(D _ {\chi^ {2}} \left(\vec {\mathbb {P}} _ {[ t _ {m}, t _ {n - 1} ]} | \vec {\mathbb {P}} _ {[ t _ {m}, t _ {n - 1} ]}\right) + 1\right) ^ {I / 2}. \tag {17} +$$ + +Given a path measure $\vec{\mathbb{P}}$ of a $D$ -dimensional process, we note that $\vec{\mathbb{P}}^{\otimes I}$ is a measure on the product space $\bigotimes_{i=1}^{I} C([0,T],\mathbb{R}^{D}) \simeq C([0,T],\mathbb{R}^{ID})$ . In particular, for $D = 1$ (corresponding to independent components), we can clearly identify $d = I$ as the dimension of the considered problem. This means that the relative error of the estimator of the KL divergence (16) is expected to scale exponentially in the dimension, which is illustrated in Figure 11 in Appendix A.6.10. As shown in Nusken & Richter (2021), the log-variance (LV) divergence does not exhibit this unfavorable property. + +LV divergence and off-policy training. An alternative divergence can be defined by + +$$ +D _ {\mathrm {L V}} ^ {\mathbb {Q}} \left(\overline {{\mathbb {P}}} _ {[ t _ {n - 1}, t _ {n} ]} ^ {u, \pi_ {n - 1}} | \overline {{\mathbb {P}}} _ {[ t _ {n - 1}, t _ {n} ]} ^ {u, \pi_ {n}}\right) = \operatorname {V a r} _ {X \sim \mathbb {Q}} \left[ \log \left(w _ {[ t _ {n - 1}, t _ {n} ]} (X)\right) \right] \tag {18} +$$ + +which, in fact, is a family of divergences parametrized by a reference measure $\mathbb{Q} = \overleftrightarrow{\mathbb{P}}_{[t_{n - 1},t_n]}$ that can be chosen with arbitrary controls $\widetilde{u}$ and initial distributions $\widetilde{\pi}_{n - 1}$ (also called off-policy training, see Remark A.2 for details and connections to reinforcement learning). In particular, we do not need $X_{t_{n - 1}}\sim \pi_{n - 1}$ anymore, and thus reweighting such as in (16) is not necessary, irrespective of the fact that resampling at time $t_n$ might not have been conducted. We summarize the training procedure for both divergences in Algorithm 3 and present details in Appendix A.3. + +# 2.4 ALGORITHMIC REFINEMENTS AND IMPLEMENTATIONAL DETAILS + +In this section, we turn our theoretical considerations from Sections 2.1 to 2.3 into implementable algorithms. We collate these changes in Algorithm 2 in Appendix A.3, representing a practical version of Algorithm 1. + +Loss Function. We focus on the log-variance divergence in the sequel and refer to Appendix A.6.10 for a comparison to the KL divergence. We choose $\widetilde{u} = u$ (or previous versions when using a buffer, see "replay buffers" below) and simulate $X$ in (18) starting from the prior, so $\widetilde{\pi}_n$ corresponds to the SDE marginal. However, since we do not take gradients w.r.t. the control $\widetilde{u}$ of the reference measures, we detach the trajectory $X$ , in line with Richter & Berner (2024). In particular, we do not need to differentiate through the SDE integrator. + +Time discretization. In practice, we choose $N$ equidistant resampling times, i.e. $t_n - t_{n-1} = \tau$ , for every $n \in \{1, \dots, N\}$ , where the number of subtrajectories $N$ may change across applications. We discretize the SDE (7) via the Euler-Maruyama scheme, containing $L$ evenly spaced steps per subtrajectory, i.e., + +$$ +\widehat {X} _ {i} ^ {u} = \widehat {X} _ {i - 1} ^ {u} + u \left(\widehat {X} _ {i - 1} ^ {u}, (i - 1) h\right) h + \sigma \left((i - 1) h\right) \sqrt {h} \xi_ {i}, \quad \xi_ {i} \sim \mathcal {N} (0, \operatorname {I d}), \tag {19} +$$ + +for $i \in \{1, \dots, NL\}$ with $h = \tau / L$ . We refer to (31) in Appendix A.3 for the resulting discretization of the Radon-Nikodym derivative from Lemma 2.2 for computing the importance weights $w_{[t_{n-1}, t_n]}$ . + +Annealing path. For the prescribed density curve $\pi$ we consider + +$$ +\pi (x, t) \propto p _ {\text {p r i o r}} (x) ^ {1 - \beta (t)} \rho_ {\text {t a r g e t}} (x) ^ {\beta (t)}, \tag {20} +$$ + +Table 2: Comparison of different methods in terms of ELBOs, i.e., lower bounds on the log-normalization constant $\log Z$ . We use this metric for all tasks where we do not have access to groundtruth metrics. We report NA if all considered hyperparameter choices diverged. + +
ELBO (↑)Seeds (26d)Sonar (61d)Credit (25d)Brownian (32d)LGCP (1600d)
SMC-74.63±0.14-111.50±0.96-589.82±5.72-2.21±0.53385.75±7.65
SMC-ESS-74.07±0.60-109.10±0.17-505.57±0.180.49±0.19497.85±0.11
SMC-FC-74.07±0.02-108.93±0.02-505.30±0.02-1.91±0.04-878.10±2.20
CRAFT-73.75±0.02-108.97±0.16-518.25±0.520.90±0.10485.87±0.37
DDS-75.21±0.21-121.22±5.99-514.74±1.220.56±0.23NA
PIS-88.92±2.05-142.87±3.29-846.57±2.42NA479.54±0.40
CMCD-KL-73.51±0.01-109.09±0.01-507.23±6.400.86±0.01478.75±0.34
CMCD-LV-73.67±0.01-109.50±0.03-504.90±0.020.54±0.03472.79±0.44
SCLD (ours)-73.45±0.01-108.17±0.25-504.46±0.091.00±0.18486.77±0.70
+ +where $\beta \colon [0,T]\to [0,1]$ is a monotonically increasing function fulfilling $\beta (0) = 0$ and $\beta (T) = 1$ . We choose to learn the function $\beta$ to attain a smoother transition; see (35) and Appendix A.6.5. + +Resampling. There is a wealth of literature (Webber, 2019; Doucet et al., 2001; Douc & Cappé, 2005) regarding designing SMC resampling schemes. However, for a fair comparison to CRAFT (Matthews et al., 2022), we utilize the common multinomial resampling scheme. Resampling can, however, reduce particle diversity by introducing identical particles in its output. As such, it is common to trigger resampling at a time $t_n$ only when the Effective Sample Size (ESS), a measure of particle quality defined by $\mathrm{ESS} = \frac{\left(\sum_{k=1}^{K} w_n^{(k)}\right)^2}{\sum_{k=1}^{K} \left(w_n^{(k)}\right)^2}$ , is below a certain threshold, where $w_n$ are the importance weights at time $t_n$ (as in Algorithm 2). In line with prior works (Matthews et al., 2022; Phillips et al., 2024), we pick the threshold to be $0.3K$ where $K$ is the number of particles. + +MCMC refinements. In order to cope with sub-optimal controls $u$ during the course of optimization, we add some MCMC refinement steps after each subtrajectory at time $t_n$ , using a Markov kernel with invariant measure $\pi(\cdot, t_n)$ . In line with Matthews et al. (2022), after every subtrajectory, we use one Hamiltonian Monte Carlo (HMC) step with 10 leapfrog steps. + +Replay buffers. Replay buffers are known to prevent mode collapse and improve sample efficiency for sampling tasks (Vemgal et al., 2023; Midgley et al., 2022; Sendera et al., 2024). As such, we utilize a prioritized replay buffer during training time. At a high level, we maintain a fixed-size rolling cache of paths generated by previous versions of the policy, i.e., learned control $u$ . For the gradient updates, we then take half of the samples from the current policy and the other from the buffer using Radon-Nikodym derivatives as weights for prioritization, see Algorithm 4 in Appendix A.3 for details. We note that this procedure is easily feasible with the log-variance divergence since this divergence does not rely on an evaluation along the current policy (see Section 2.3). + +# 3 EXPERIMENTS + +We empirically demonstrate the performance of the proposed SCLD sampler on a wide variety of sampling benchmarks. We consider a combination of practical and synthetic examples taken from Blessing et al. (2024), the full descriptions of which are contained in Appendix A.4: + +- Examples from Bayesian statistics: The Seeds, Sonar, Credit, Brownian, and LGCP tasks. +- Synthetic targets: A 40-mode Gaussian mixture model in $50d$ (GMM40), a 32-mode Many-Well task (MW54) in $5d$ , the popular $10d$ Funnel benchmark, and a $50d$ Student mixture model (MoS). Many of these are in relatively high dimensions and with many well-separated modes. +- The Robot1 and Robot4 tasks: Inspired by robotics control problems, these synthetic 10-dimensional targets model the distribution over the configurations of a 10-joint robotic arm in the plane. They have multiple well-separated and sharp modes. + +As baselines, we consider a representative selection of related sampling methods and refer to Appendix A.1 for descriptions. We study two metrics used frequently by previous works, such as in Blessing et al. (2024); Vargas et al. (2023). When groundtruth samples are available, we report the Sinkhorn distance (an optimal transport distance) to a set of generated samples (Cuturi, 2013), and otherwise consider the ELBO metric (i.e., a lower bound on $\log Z$ ). + +Table 3: Comparison of different methods in terms of Sinkhorn distances. We present all tasks where we have access to samples for the evaluation. We report NA if all considered hyperparameter choices diverged. + +
Sinkhorn (↓)Funnel (10d)MW54 (5d)Robot1 (10d)Robot4 (10d)GMM40 (50d)MoS (50d)
SMC149.35±4.7320.71±5.3324.02±1.0624.08±0.2646370.34±137.793297.28±2184.54
SMC-ESS117.48±9.701.11±0.151.82±0.502.11±0.3124240.68±50.521477.04±133.80
SMC-FC211.43±30.082.03±0.170.37±0.081.23±0.0239018.27±159.323200.10±95.35
CRAFT133.42±1.0411.47±0.902.92±0.014.14±0.5028960.70±354.891918.14±108.22
DDS142.89±9.550.63±0.2411.44±12.505.38±2.445435.18±172.202154.88±3.86
PISNA0.42±0.011.54±0.722.02±0.3610405.75±69.412113.17±31.17
CMCD-KL124.89±8.950.57±0.053.71±1.002.62±0.4122132.28±595.181848.89±532.56
CMCD-LV139.07±9.350.51±0.0828.49±0.0727.00±0.074258.57±737.151945.71±48.79
SCLD (ours)134.23±8.390.44±0.060.31±0.040.40±0.013787.73±249.75656.10±88.97
+ +![](images/bbe33f0b8cb4f142ce3f90e28e4be3cabe6a6596f84ce90b98e82cc9134e5937.jpg) +CMCD-KL + +![](images/b0c904888123447f02021efe60e9dcb46c35d66a947b73825d655072d68f04e8.jpg) + +![](images/a45057b5f1321e72db6c002972c90ffb2006ad529918c79d2ddcaf52fa4aa386.jpg) +CMCD-LV + +![](images/36bbabe4beb4ae3b4239d523fa25dbafe03cace929f202691df646cd3b00e565.jpg) + +![](images/b5e88183532458543d127c9dd52ad752324dc87175d75c24cde3e8b30965221d.jpg) +CRAFT + +![](images/8654081f1a0697139af5333e7629be0be0fb0b42b899e9d5bd9c7dbed1d44bf9.jpg) + +![](images/70e4280a2cd578b319c84c4f310c50a0a9636c66d386c8ef03857832f9626f72.jpg) + +![](images/11f9fe1a14d8fec1dcdefb5dff0890b92384171bfbe0e6c5f751b75eb2cfa092.jpg) +SCLD (ours) +Figure 2: Samples from our considered methods and the groundtruth for the GMM40 (50d) (top) and Robot4 (10d) (bottom) tasks. Our SCLD method accurately finds all modes and avoids low probability regions. + +![](images/daa83814b9ea0e5145d64282db24e588fb686db223f51a00af605183ce1943f7.jpg) +Groundtruth + +![](images/0922f85f04e07c5239c348eb01689e605d7613556a3ffa1433cb271c7012b39a.jpg) + +We took great care to ensure the fairness of our experiments and refer the reader to Appendix A.5 for full experimental and reproducibility details and to Blessing et al. (2024) for a discussion on benchmarking samplers. We also include numerous additional experiments and metrics in the appendices, such as ablation studies in Appendices A.6.1 and A.6.2, runtime information in Appendix A.6.3, a study on log $Z$ estimation in Appendix A.6.4, the effect of learning priors by variational inference in Appendix A.6.6, a comparison to PDDS in Appendix A.6.7, and a comparison of KL and LV training in Appendix A.6.10. + +# 3.1 RESULTS + +Our SCLD method exhibits strong performance on both ELBO and Sinkhorn benchmarks (Tables 2 and 3). Indeed, among all tasks except Funnel, we are able to achieve the top performance or come a close second when measuring performance by Sinkhorn distances (when it is available). For ELBO estimation, SCLD can utilize a large number of resampling steps to attain the strongest performances in all but one task. In particular, SCLD can surpass the outcomes of CMCD-KL and CMCD-LV with 40000 gradient steps using only 3000 steps. In the following, we comment on different aspects. + +Avoiding mode collapse. We visualize the samples for GMM40 and the Robot4 task in Figure 2. For GMM40, we plot the first two dimensions of samples against the true marginal distribution. In all attempted hyperparameter settings, we found that CRAFT suffers from mode collapse (see also Appendix A.6.4) and that CMCD-KL gradually collapses to a few modes, covering low probability regions. CMCD-LV and SCLD perform much better, and indeed the samples from SCLD are virtually indistinguishable from the groundtruth. For Robot4, we visualize the sampled robot arm positions. Observe that for the Robot4 task, CMCD-KL and CRAFT both collapse onto 1 mode. CMCD-LV does not experience mode collapse but nevertheless does not sample accurately for any mode. Only our SCLD Method is able to identify and sample relatively precisely from all 8 modes. + +Improved convergence properties of SCLD. We found that the SCLD algorithm demonstrates superior convergence properties. As SCLD is effectively initialized as an SMC sampler and is trained to improve upon it, we expect a good initial performance even before training and, thus, an improved starting point for optimization. As visualized in Figure 3, SCLD consistently attains better ELBOs for any given training time budget on all tasks when compared to CMCD-KL and CMCD-LV. While in some cases SCLD is initially worse than CRAFT, it always manages to catch up quickly and surpasses it. SCLD and CMCD steps require similar amounts of time for these tasks (see Appendix A.6.3), and thus SCLD offers a 10-fold decrease in training time as well as iteration count compared to CMCD. See Appendix A.6.9 for an alternative visualization. + +![](images/74a1127b5335780d30362daab1b0f3edad36412b91822a7fa703c4e6d7f8c9ed.jpg) +Figure 3: ELBOs during training for several tasks. We visualize the ELBO estimates attained by 4 methods as a function of the training time elapsed (until SCLD finished after 3000 iterations), running 3 seeds for each task. We mark the long run CMCD ELBOs (best out of KL and LV loss), corresponding to running for 40000 gradient steps as for the main table. Methods leveraging Sequential Monte Carlo (SCLD and CRAFT) generally exhibit improved convergence speed, but whereas CRAFT plateaus quickly, our SCLD method often achieves state-of-the-art performance in about 5 minutes. + +![](images/6d69564397483355457dca35fda0d5aad7df4de59952c5e53840373059755d6e.jpg) + +![](images/5bc244daa0ce794c9cdac59e831aa8930ff26eb2abd294478af6b303d9e62c8d.jpg) + +![](images/1855436b18fbd05a4373700929067ab0af63d2ee2b2426f507d2a16e7426baf0.jpg) + +![](images/6318d2047f122f8791f5feb6cdd87c412730f34b3069eb33dfc83d7124337de8.jpg) +Figure 4: Performance of SCLD for different numbers of SMC steps at training and evaluation time for several tasks. Better results are shaded darker. We note that taking "zero" SMC steps corresponds to the CMCD method. Using more SMC steps has generally a beneficial effect during training. Our method allows us to select a different number at training and during inference. + +Choice of number of SMC steps. Here, we study the effect of varying the number $N$ of subtrajectories used in the SCLD sampler, i.e., SMC steps where we apply resampling (if ESS is lower than the threshold) and MCMC steps, and offer practical advice on choosing this value. For this study, we fix the number of gradient steps for training to 8000 but otherwise retain the same experimental design. The results are illustrated in Figure 4, where we visualize the relevant metric for four tasks and demonstrate the effect of varying the number of SMC steps used at training and evaluation. For most tasks, we found it advantageous to use as many SMC steps as possible at both training and evaluation time. Particularly for the Seeds and Sonar targets, the outcomes look strikingly similar. For these tasks, it is also shown that using a smaller number of SMC steps at training or even only adding SMC steps at evaluation already improves upon stand-alone diffusion-based samplers. + +While it is well known that resampling can potentially lead to mode collapse and loss of sample diversity on highly multimodal tasks (Doucet et al., 2001), we found that even for such tasks, resampling, when used sparingly, was still beneficial during training. This is clearly reflected in the multimodal Robot4 task, where using SMC steps at training significantly improves sample quality. In line with the previous paragraph, this suggests that our SCLD training setup can help improve training convergence. Informed by our observations, we opt to use 4 subtrajectories only at training for all synthetic tasks except Funnel and MoS, and, for all other tasks, we utilize 128 subtrajectories at both training and evaluation time for the main experiments. These choices, while not necessarily optimal, are robust and work well across our diverse set of benchmarks. + +# 4 CONCLUSION + +We have developed a framework for combining diffusion-based samplers with Sequential Monte Carlo algorithms and propose simple yet effective methods for training. Our framework culminates in a novel sampler, termed Sequential Controlled Langevin Diffusion (SCLD), in principle offering a great amount of design freedom. In particular, SCLD allows for accelerated training, flexible parameterizations, end-to-end training with prioritized replay buffers, and injection of resampling and MCMC steps at arbitrary times in the generative process. We provide careful ablation studies of our design choices and empirically show state-of-the-art performance on a diverse range of benchmarks. + +# ACKNOWLEDGEMENTS + +We thank Francisco Vargas, Lee Cheuk-Kit, and Dinghuai Zhang for very helpful discussions. J.C. was supported by a Summer Undergraduate Research Fellowship at the California Institute of Technology. D.B. is supported by funding from the pilot program Core Informatics of the Helmholtz Association (HGF). J.B. acknowledges support from the Wally Baer and Jeri Weiss Postdoctoral Fellowship. A.A. is supported in part by Bren endowed chair, ONR (MURI grant N00014-23-1-2654), and the AI2050 senior fellow program at Schmidt Sciences. The research of L.R. was partially funded by Deutsche Forschungsgemeinschaft (DFG) through the grant CRC 1114 "Scaling Cascades in Complex Systems" (project A05, project number 235221301). We thank the anonymous reviewers for their careful reading of our manuscript and their insightful comments and suggestions. + +# REFERENCES + +Michael S. Albergo and Eric Vanden-Eijnden. NETS: A non-equilibrium transport sampler, 2025. URL https://arxiv.org/abs/2410.02711. +Michael Arbel, Alex Matthews, and Arnaud Doucet. Annealed flow transport Monte Carlo. In International Conference on Machine Learning, pp. 318-330, 2021. +Oleg Arenz, Mingjun Zhong, and Gerhard Neumann. Trust-region variational inference with gaussian mixture models. Journal of Machine Learning Research, 21(163):1-60, 2020. +Paolo Baldi. Stochastic calculus. Springer, 2017. +Julius Berner, Lorenz Richter, and Karen Ullrich. An optimal control perspective on diffusion-based generative modeling. Transactions on Machine Learning Research, 2024. +Espen Bernton, Jeremy Heng, Arnaud Doucet, and Pierre E Jacob. Schrödinger bridge samplers. arXiv preprint arXiv:1912.13170, 2019. +Christopher M. Bishop. Pattern Recognition and Machine Learning (Information Science and Statistics). Springer-Verlag, Berlin, Heidelberg, 2006. +Denis Blessing, Xiaogang Jia, Johannes Esslinger, Francisco Vargas, and Gerhard Neumann. Beyond ELBOs: A large-scale evaluation of variational methods for sampling. In *Forty-first International Conference on Machine Learning*, 2024. +Benjamin Boys, Mark Girolami, Jakiw Pidstrigach, Sebastian Reich, Alan Mosca, and O Deniz Akyildiz. Tweedie moment projected diffusions for inverse problems. arXiv preprint arXiv:2310.06721, 2023. +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/jax-ml/jax. +Alexander Buchholz, Nicolas Chopin, and Pierre E Jacob. Adaptive tuning of hamiltonian monte carlo within sequential monte carlo. Bayesian Analysis, 16(3):745-771, 2021. +Alberto Cabezas, Adrien Corenflos, Junpeng Lao, Rémi Louf, Antoine Carnec, Kaustubh Chaudhari, Reuben Cohn-Gordon, Jeremie Couillon, Wei Deng, Sam Duffield, et al. BlackJAX: Composable Bayesian inference in JAX. arXiv preprint arXiv:2402.10797, 2024. +Sourav Chatterjee and Persi Diaconis. The sample size required in importance sampling. The Annals of Applied Probability, 28(2):1099-1135, 2018. +Tianrong Chen, Guan-Horng Liu, and Evangelos Theodorou. Likelihood training of Schrödinger bridge using forward-backward SDEs theory. In International Conference on Learning Representations, 2022. +Eungchun Cho, Moon Jung Cho, and John Eltinge. The variance of sample variance from a finite population. International Journal of Pure and Applied Mathematics, 21(3):389, 2005. + +Nicolas Chopin. A sequential particle filter method for static models. Biometrika, 89(3):539-552, 2002. +Nicolas Chopin, Omiros Papaspiliopoulos, et al. An introduction to sequential Monte Carlo, volume 4. Springer, 2020. +Hyungjin Chung, Jeongsol Kim, Michael T McCann, Marc L Klasky, and Jong Chul Ye. Diffusion posterior sampling for general noisy inverse problems. arXiv preprint arXiv:2209.14687, 2022a. +Hyungjin Chung, Byeongsu Sim, Dohoon Ryu, and Jong Chul Ye. Improving diffusion models for inverse problems using manifold constraints. Advances in Neural Information Processing Systems, 35:25683-25696, 2022b. +Marco Cuturi. Sinkhorn distances: Lightspeed computation of optimal transport. In C.J. Burges, L. Bottou, M. Welling, Z. Ghahramani, and K.Q. Weinberger (eds.), Advances in Neural Information Processing Systems, volume 26, 2013. +Marco Cuturi, Laetitia Meng-Papaxanthos, Yingtao Tian, Charlotte Bunne, Geoff Davis, and Olivier Teboul. Optimal transport tools (OTT): A JAX toolbox for all things wasserstein. arXiv preprint arXiv:2201.12324, 2022. +Chenguang Dai, Jeremy Heng, Pierre E Jacob, and Nick Whiteley. An invitation to sequential Monte Carlo samplers. Journal of the American Statistical Association, 117(539):1587-1600, 2022. +Paolo Dai Pra. A stochastic control approach to reciprocal diffusion processes. Applied mathematics and Optimization, 23(1):313-329, 1991. +Valentin De Bortoli, James Thornton, Jeremy Heng, and Arnaud Doucet. Diffusion Schrödinger bridge with applications to score-based generative modeling. Advances in Neural Information Processing Systems, 34:17695-17709, 2021. +Pierre del Moral. Mean field simulation for Monte Carlo integration. Monographs on Statistics & Applied Probability. Chapman&Hall, 2013. +Pierre Del Moral, Arnaud Doucet, and Ajay Jasra. Sequential Monte Carlo samplers. Journal of the Royal Statistical Society Series B: Statistical Methodology, 68(3):411-436, 2006. +Kieran Didi, Francisco Vargas, Simon V Mathis, Vincent Dutordoir, Emile Mathieu, Urszula J Komorowska, and Pietro Lio. A framework for conditional diffusion modelling with applications in motif scaffolding for protein design. arXiv preprint arXiv:2312.09236, 2023. +Carles Domingo-Enrich. A taxonomy of loss functions for stochastic optimal control. arXiv preprint arXiv:2410.00345, 2024. +Carles Domingo-Enrich, Jiequn Han, Brandon Amos, Joan Bruna, and Ricky TQ Chen. Stochastic optimal control matching. arXiv preprint arXiv:2312.02027, 2023. +Carles Domingo-Enrich, Michal Drozdjal, Brian Karrer, and Ricky TQ Chen. Adjoint matching: Fine-tuning flow and diffusion generative models with memoryless stochastic optimal control. arXiv preprint arXiv:2409.08861, 2024. +Randal Douc and Olivier Cappé. Comparison of resampling schemes for particle filtering. In Proceedings of the 4th International Symposium on Image and Signal Processing and Analysis, pp. 64-69, 2005. +Arnaud Doucet, Nando de Freitas, and Neil J. Gordon (eds.). Sequential Monte Carlo Methods in Practice. Statistics for Engineering and Information Science. Springer, 2001. +Arnaud Doucet, Will Grathwohl, Alexander G de G Matthews, and Heiko Strathmann. Score-based diffusion meets annealed importance sampling. In Advances in Neural Information Processing Systems, 2022. +Marylou Gabriel, Grant M Rotskoff, and Eric Vanden-Eijnden. Efficient Bayesian sampling using normalizing flows to assist Markov Chain Monte Carlo methods. arXiv preprint arXiv:2107.08001, 2021. + +Marylou Gabrie, Grant M Rotskoff, and Eric Vanden-Eijnden. Adaptive Monte Carlo augmented with normalizing flows. Proceedings of the National Academy of Sciences, 119(10):e2109420119, 2022. +Tomas Geffner and Justin Domke. MCMC variational inference via uncorrected Hamiltonian annealing. In Advances in Neural Information Processing Systems, 2021. +Tomas Geffner and Justin Domke. Langevin diffusion variational inference. arXiv preprint arXiv:2208.07743, 2022. +A. Gelman, J.B. Carlin, H.S. Stern, D.B. Dunson, A. Vehtari, and D.B. Rubin. Bayesian Data Analysis, Third Edition. Chapman & Hall/CRC Texts in Statistical Science. Taylor & Francis, 2013. +Neil J Gordon, David J Salmond, and Adrian FM Smith. Novel approach to nonlinear/non-Gaussian Bayesian state estimation. In *IEE Proc. F Radar Signal Proc.*, volume 140, pp. 107-113, 1993. +Paul Lyonel Hagemann, Johannes Hertrich, and Gabriele Steidl. Generalized normalizing flows via Markov chains. Cambridge University Press, 2023. +Carsten Hartmann and Lorenz Richter. Nonasymptotic bounds for suboptimal importance sampling. SIAM/ASA Journal on Uncertainty Quantification, 12(2):309-346, 2024. +Jeremy Heng, Adrian N. Bishop, George Deligiannidis, and Arnaud Doucet. Controlled sequential Monte Carlo. The Annals of Statistics, 48(5), 2017. +M.F. Hutchinson. A stochastic estimator of the trace of the influence matrix for Laplacian smoothing splines. Communication in Statistics- Simulation and Computation, 18:1059-1076, 1989. +Bowen Jing, Gabriele Corso, Jeffrey Chang, Regina Barzilay, and Tommi Jaakkola. Torsional diffusion for molecular conformer generation. Advances in Neural Information Processing Systems, 35:24240-24253, 2022. +Takeshi Koshizuka and Issei Sato. Neural lagrangian Schrödinger bridge: Diffusion modeling for population dynamics. In The Eleventh International Conference on Learning Representations, 2023. +Guan-Horng Liu, Tianrong Chen, Oswin So, and Evangelos Theodorou. Deep generalized Schrödinger bridge. Advances in Neural Information Processing Systems, 35:9374-9388, 2022. +Guan-Horng Liu, Yaron Lipman, Maximilian Nickel, Brian Karrer, Evangelos A Theodorou, and Ricky TQ Chen. Generalized Schrödinger bridge matching. arXiv preprint arXiv:2310.02233, 2023. +Kanika Madan, Jarrid Rector-Brooks, Maksym Korablyov, Emmanuel Bengio, Moksh Jain, Andrei Cristian Nica, Tom Bosc, Yoshua Bengio, and Nikolay Malkin. Learning GFlowNets from partial episodes for improved convergence and stability. In International Conference on Machine Learning, pp. 23467-23483, 2023. +Alex Matthews, Michael Arbel, Danilo Jimenez Rezende, and Arnaud Doucet. Continual repeated annealed flow transport Monte Carlo. In International Conference on Machine Learning, pp. 15196-15219, 2022. +Laurence Illing Midgley, Vincent Stimper, Gregor NC Simm, Bernhard Scholkopf, and José Miguel Hernández-Lobato. Flow annealed importance sampling bootstrap. arXiv preprint arXiv:2208.01893, 2022. +Volodymyr Mnih. Playing Atari with deep reinforcement learning. arXiv preprint arXiv:1312.5602, 2013. +Jesper Møller, Anne Randi Syversveen, and Rasmus Plenge Waagepetersen. Log Gaussian Cox processes. Scandinavian Journal of Statistics, 25(3):451-482, 1998. +Radford M Neal. Annealed importance sampling. Statistics and computing, 11:125-139, 2001. + +Radford M Neal. Slice sampling. The annals of statistics, 31(3):705-767, 2003. +Kirill Neklyudov, Rob Brekelmans, Daniel Severo, and Alireza Makhzani. Action matching: Learning stochastic dynamics from samples. In International conference on machine learning, pp. 25858-25889. PMLR, 2023. +E Nelson. Dynamical theories of Brownian motion. Press, Princeton, NJ, 1967. +Nikolas Nusken and Lorenz Richter. Solving high-dimensional Hamilton-Jacobi-Bellman PDEs using neural networks: perspectives from the theory of controlled diffusions and measures on path space. *Partial differential equations and applications*, 2(4):48, 2021. +Angus Phillips, Hai-Dang Dau, Michael John Hutchinson, Valentin De Bortoli, George Deligiannisidis, and Arnaud Doucet. Particle denoising diffusion sampler. arXiv preprint arXiv:2402.06320, 2024. +Lorenz Richter and Julius Berner. Improved sampling via learned diffusions. In The Twelfth International Conference on Learning Representations, 2024. +Marcin Sendera, Minsu Kim, Sarthak Mittal, Pablo Lemos, Luca Scimeca, Jarrid Rector-Brooks, Alexandre Adam, Yoshua Bengio, and Nikolay Malkin. On diffusion models for amortized inference: Benchmarking and improving stochastic control and sampling. arXiv preprint arXiv:2402.05098, 2024. +Yuyang Shi, Valentin De Bortoli, Andrew Campbell, and Arnaud Doucet. Diffusion schrödinger bridge matching. Advances in Neural Information Processing Systems, 36, 2024. +Jiaming Song, Arash Vahdat, Morteza Mardani, and Jan Kautz. Pseudoinverse-guided diffusion models for inverse problems. In International Conference on Learning Representations, 2022. +Jiaming Song, Qinsheng Zhang, Hongxu Yin, Morteza Mardani, Ming-Yu Liu, Jan Kautz, Yongxin Chen, and Arash Vahdat. Loss-guided diffusion models for plug-and-play controllable generation. In International Conference on Machine Learning, pp. 32483-32498, 2023. +Yang Song, Jascha Sohl-Dickstein, Diederik P Kingma, Abhishek Kumar, Stefano Ermon, and Ben Poole. Score-based generative modeling through stochastic differential equations. In International Conference on Learning Representations, 2021. +Jingtong Sun, Julius Berner, Lorenz Richter, Marius Zeinhofer, Johannes Müller, Kamyar Aziz-zadenesheli, and Anima Anandkumar. Dynamical measure transport and neural PDE solvers for sampling. arXiv preprint arXiv:2407.07873, 2024. +Alexander Tong, Kilian FATRAS, Nikolay Malkin, Guillaume Huguet, Yanlei Zhang, Jarrid Rector-Brooks, Guy Wolf, and Yoshua Bengio. Improving and generalizing flow-based generative models with minibatch optimal transport. Transactions on Machine Learning Research, 2024. +Suriyanarayanan Vaikuntanathan and Christopher Jarzynski. Escorted free energy simulations: Improving convergence by reducing dissipation. Physical Review Letters, 100(19):190601, 2008. +Francisco Vargas, Pierre Thodoroff, Austen Lamacraft, and Neil Lawrence. Solving schrödinger bridges via maximum likelihood. Entropy, 23(9):1134, 2021. +Francisco Vargas, Will Sussman Grathwohl, and Arnaud Doucet. Denoising diffusion samplers. In International Conference on Learning Representations, 2023. +Francisco Vargas, Shreyas Padhy, Denis Blessing, and Nikolas Nusken. Transport meets variational inference: Controlled Monte Carlo diffusions. In The Twelfth International Conference on Learning Representations, 2024. +Nikhil Vemgal, Elaine Lau, and Doina Precup. An empirical study of the effectiveness of using a replay buffer on mode discovery in GFlowNets. arXiv preprint arXiv:2307.07674, 2023. + +Siddarth Venkatraman, Moksh Jain, Luca Scimeca, Minsu Kim, Marcin Sendera, Mohsin Hasan, Luke Rowe, Sarthak Mittal, Pablo Lemos, Emmanuel Bengio, et al. Amortizing intractable inference in diffusion models for vision, language, and control. arXiv preprint arXiv:2405.20971, 2024. +Robert J Webber. Unifying sequential Monte Carlo with resampling matrices. arXiv preprint arXiv:1903.12583, 2019. +Max Welling and Yee Whye Teh. Bayesian learning via stochastic gradient Langevin dynamics. In Proceedings of the 28th International Conference on International Conference on Machine Learning, pp. 681-688, Madison, WI, USA, 2011. +Hao Wu, Jonas Kohler, and Frank Noé. Stochastic normalizing flows. Advances in Neural Information Processing Systems, 33:5933-5944, 2020. +Luhuan Wu, Brian Trippe, Christian Naesseth, David Blei, and John P Cunningham. Practical and asymptotically exact conditional sampling in diffusion models. Advances in Neural Information Processing Systems, 36, 2024. +Bingliang Zhang, Wenda Chu, Julius Berner, Chenlin Meng, Anima Anandkumar, and Yang Song. Improving diffusion inverse problem solving with decoupled noise annealing. arXiv preprint arXiv:2407.01521, 2024. +Dinghuai Zhang, Ricky Tian Qi Chen, Cheng-Hao Liu, Aaron Courville, and Yoshua Bengio. Diffusion generative flow samplers: Improving learning signals through partial trajectory optimization. arXiv preprint arXiv:2310.02679, 2023a. +Qinsheng Zhang and Yongxin Chen. Path integral sampler: A stochastic control approach for sampling. In International Conference on Learning Representations, 2022. +Xuan Zhang, Limei Wang, Jacob Helwig, Youzhi Luo, Cong Fu, Yaochen Xie, Meng Liu, Yuchao Lin, Zhao Xu, Keqiang Yan, et al. Artificial intelligence for science in quantum, atomistic, and continuum systems. arXiv preprint arXiv:2307.08423, 2023b. + +# A APPENDIX + +# CONTENTS + +A.1 Related works 16 +A.2 Proofs and theoretical remarks 19 +A.3 Algorithmic details and pseudocode 21 + +A.3.1 Computation of the Radon-Nikodym derivative 21 +A.3.2 A practical algorithm 22 + +A.4 Benchmark target distributions 22 + +A.4.1 Bayesian statistics tasks 22 +A.4.2 Synthetic targets 24 + +A.5 Experimental details 25 + +A.5.1 Metrics and evaluation 25 +A.5.2 Design choices 26 +A.5.3 Hyperparameter selection 27 + +A.6 Additional experiments 29 + +A.6.1 Ablation studies of SCLD 29 +A.6.2 Removing MCMC components 29 +A.6.3 Timings 30 +A.6.4 Estimations of the normalizing constant 31 +A.6.5 The learned annealing schedule 32 +A.6.6 Mean field prior for SCLD 32 +A.6.7 Comparison to PDDS 33 +A.6.8 Comparison with advanced SMC schemes 34 +A.6.9 Convergence of different methods by iteration count 34 +A.6.10 KL-based training of SCLD 35 + +# A.1 RELATED WORKS + +Adding to Section 1.1, this section provides additional related works. + +SMC. SMC methods (Chopin, 2002; Del Moral et al., 2006) describe a general methodology to sample sequentially from a sequence of (annealed) distributions. They rely on forward and backward kernels in order to move from one distribution to another and leverage resampling steps in between. Popular choices for the kernels include MCMC. However, while enjoying theoretical guarantees, they suffer from drawbacks such as long mixing times and tedious tuning (Dai et al., 2022). + +SMC with learned kernels. To make the transition kernels more flexible and reduce the amount of manual tuning, previous approaches have been proposed to learn them (Wu et al., 2020; Geffner & Domke, 2021). Combinations with SMC include the works by Bernton et al. (2019); Heng et al. (2017). While they propose learned SMC transitions, they do not utilize neural networks (partially due to tractability issues). Bernton et al. (2019) build on the prior work of Heng et al. (2017), which uses ideas from optimal control to iteratively modify the prior distribution and transition kernels through an approximate dynamic programming approach. However, this requires the prior distribution to be conjugate with respect to the policy of the underlying optimal control problem, among other drawbacks discussed in Bernton et al. (2019). The latter work, in turn, proposes the Sequential Schrödinger Bridge Sampler (SSB), which produces a trained SMC sampler by applying sequential approximate iterative proportional fitting (IPF) to learn the forward and backward kernels. + +Whereas the paper works in discrete time, we take a continuous time perspective and, in doing so, obtain a family of simpler, unbiased training procedures, as well as reveal additional design choices like the ability to choose the integrator. We also note that our objective is fundamentally different from IPF and, in particular, yields a different solution for a finite numbers of steps (see Vargas et al. (2024, Proposition 3.4)). + +Methods combining SMC with neural networks include Annealed Flow Transport Monte Carlo (AFT) (Arbel et al., 2021), as well as its improved version Continual Repeated Annealed Flow Transport Monte Carlo (CRAFT) (Matthews et al., 2022). Those works use normalizing flows to transition between adjacent annealing steps. While achieving improved performance, the deterministic nature of the transitions requires MCMC steps after the resampling steps to avoid particles collapsing to the same location. Moreover, the log-determinant of the Jacobian (or divergence of the drift for continuous time) is required. To avoid costly computations in high dimensions, one either needs to place architectural restrictions on the architecture or require the use of noisy estimators (such as Hutchinson's trace estimator (Hutchinson, 1989) for the divergence). We remark that there is also a series of works that combines normalizing flows with MCMC methods (Midgley et al., 2022; Gabrie et al., 2021; 2022; Hagemann et al., 2023). + +Diffusion-based samplers. Works on diffusion-based samplers such as Path Integral Samplers (PIS), Denoising Diffusion Samplers (DDS), Time-reversed Diffusion Samplers (DIS), and others introduced by Zhang & Chen (2022); Berner et al. (2024); Vargas et al. (2023; 2024); Sendera et al. (2024); Sun et al. (2024) have focused on transporting a prior to the target distribution using controlled stochastic differential equations (SDEs), where the control is learned by minimizing suitable divergences between induced measures on the SDE trajectories; see the framework described in Section 2.2. As a historical note, some of the ideas of diffusion sampling were anticipated in earlier works such as Vaikuntanathan & Jarzynski (2008). In this work, we aim to harness their flexibility together with the power of SMC. Orthogonal to our work, techniques from diffusion models have been employed to approximate the extended target distribution needed in AIS methods (Doucet et al., 2022; Geffner & Domke, 2022). + +Subtrajectories. In our work, we utilize the idea of dividing a path measure into sequential sections. This bears resemblance to the concept of subtrajectories as introduced in a discrete-time setting in the context of GFlownets (Zhang et al., 2023a; Madan et al., 2023), and thus we will also use this term. While conceptually similar, the latter work only proposed subtrajectories as an alternative training loss, whereas we use them to facilitate integration with SMC methods. Additionally, their formulation requires learning the evolution of the SDE marginals, whereas we adapt recent Controlled Monte Carlo Diffusions (CMCD) (Vargas et al., 2024) to get rid of this requirement. + +SMC with diffusion-based samplers. To the best of our knowledge, the only prior work on combining diffusion-based methods with SMC steps is the Particle Denoising Diffusion Sampler (PDDS) (Phillips et al., 2024), where the backward kernel is chosen to be the noising diffusion and the forward kernel the approximate (learned) time-reversal. While also inspired by diffusion-based samplers, PDDS significantly differs from our approach. First, we take a more general continuous-time perspective, allowing us more freedom in design choices while still recovering the (discrete-time) setup of PDDS as a special case (i.e., where we use one Euler-Marumaya step per subtrajectory). Next, their setup requires learning potential functions and relies on automatic differentiation to compute the control, which can be unstable and challenging to optimize. Indeed, PDDS was empirically found to require variational approximations for the prior distribution to train stably, which has certain drawbacks (see Appendices A.6.6 and A.6.7). Moreover, it uses an alternating training setup that uses (approximate) samples from the partially trained model, whereas we train our model end-to-end, i.e., our setup is the same during training and inference. We empirically compare methods and discuss the impact of this difference in training methodology in Appendix A.6.7. We additionally compare different SMC-based methods in Table 1. Lastly, we note that the recent concurrent work by Albergo & Vanden-Eijnden (2025) also utilizes resampling steps as part of a learned SDE-based sampling algorithm. + +Diffusion-based generative modeling. As outlined in our introduction, sampling problems are substantially different from problems in generative modeling, where samples from the target distribution are provided. However, many successful techniques from diffusion-based generative modeling, such as SDE integrators, noise schedules, and probability flow ODEs, can be translated to diffusion-based samplers. Loosely related to CMCD, and thus SCLD, are (entropic) action-matching ap + +proaches (Neklyudov et al., 2023), where the intermediate distributions are prescribed via samples as compared to (unnormized) densities in our setting. In both settings, there exist unique gradient fields representing the optimal controls, which can be characterized as solutions to infinitesimal Schrödinger bridge problems at the intermediate distributions, i.e., minimizers of the kinetic energy (see Vargas et al. (2024, Proposition 3.4) and Neklyudov et al. (2023, Appendix B.3)). As described in Remark A.1, we could replace the CMCD framework with more general bridges, i.e., arbitrary, learnable density evolutions as considered in Richter & Berner (2024), at the cost of learning the (unnormized) marginals with a separate model. A corresponding objective in generative modeling has been considered by Chen et al. (2022). While such approaches do not exhibit unique solutions, one can additionally minimize the KL divergence of the learned path measure to a reference measure, typically given by a Brownian motion, which leads to dynamic Schrödinger bridge problems (i.e., entropy-regularized optimal transport). This has been explored by, e.g., Vargas et al. (2021); De Bortoli et al. (2021); Shi et al. (2024) in the context of generative modeling, and we refer to Koshizuka & Sato (2023); Liu et al. (2022; 2023) for extensions beyond kinetic energy minimization (related to mean-field games). + +Finally, we mention that generative modeling frameworks that allow likelihood computations can also be used for sampling problems. Specifically, one can optimize objectives from generative modeling (e.g., score-matching objectives) using approximate samples from the target distribution obtained from the partially trained model together with importance sampling based on the likelihoods of the samples. This can be viewed as a version of the cross-entropy method and is used, e.g., in Jing et al. (2022, Section 3.6) for diffusion models5 and in Tong et al. (2024, Appendix C.2) for flow matching. However, a mismatch of the high-probability regions of the proposal (given by the partially trained model) and target distributions often leads to high variance in high-dimensional settings. We note that PDDS can be viewed as a very elaborate version of such an approach, counteracting the aforementioned problems by incorporating SMC steps into the proposal as well as training with a combination of target-matching and score-matching objectives. We compare to PDDS in Appendix A.6.7. + +Diffusion-based posterior sampling and stochastic optimal control. For our considered sampling problems, we only assume minimal to no prior knowledge of the properties of the target distribution. However, for sampling from posterior distributions arising from Bayesian inference problems, one can decompose the target as $p_{\mathrm{target}} = p_{X|Y}(\cdot ,y) = \frac{p_Xp_{Y|X}(y|\cdot)}{Z}$ , where $y$ is a given measurement and $p_{X}$ and $p_{Y|X}$ are the prior and likelihood, respectively. In our Bayesian statistics tasks (see Appendix A.4), the prior $p_{X}$ is given by a simple, tractable distribution, and we do not incorporate knowledge about the prior into our framework. + +However, for certain problems, the prior can also be more complex, e.g., in inverse problems on image, audio, or video distributions. Assuming – different from our setting – that samples from the prior $p_{X}$ are given, recent methods leverage diffusion priors, i.e., diffusion models pre-trained on $p_{X}$ , to simplify sampling from $p_{\mathrm{target}}$ ; see, e.g., Chung et al. (2022a,b); Song et al. (2022; 2023); Boys et al. (2023); Zhang et al. (2024). Using the decomposition of $p_{\mathrm{target}}$ , they draw approximate samples from $p_{\mathrm{target}}$ based on approximations of the likelihood score (i.e., the difference of the score for the noised posterior and prior distributions) during inference. For instance, the common reconstruction guidance approximates this score by the (scaled) gradient of the log-likelihood evaluated at the denoised sample obtained via Tweedie's formula and the pre-trained model. While such plug-and-play approaches can yield impressive results for high-dimensional distributions without additional training, they typically lack theoretical guarantees and typically suffer from instabilities and mode collapse. + +At the cost of simulating multiple particles during the generative process, the bias originating from approximating the likelihood score can be eliminated (in the limit of infinitely many particles) by leveraging ideas from SMC, i.e., by computing importance weights and interleaving the generative process with resampling steps (Wu et al., 2024). Taking into account an additional training phase, one can also obtain theoretical guarantees by writing the likelihood score as a solution to an stochastic optimal control (SOC) problem (as in DDS, however, with the pre-trained diffusion model as a reference process; see Didi et al. (2023, Section 2.4) and also Venkatraman et al. (2024). The SOC problem can then be solved using, e.g., the log-variance divergence. While such posterior sampling + +![](images/d4697e9754fdc212fecaaa02988b62ffbb56e572b68dd9e09dd344feb337862f.jpg) +Figure 5: Illustration of annealed importance sampling along a geometric path, where we consider either one (top arrow) or three (bottom arrows) transition steps from the prior to the target. + +approaches assume more structure than our considered sampling problem and rely on pre-trained diffusion prior, one could also adopt the idea of SCLD to such settings (see also Remark A.1), which we leave to future work. This would basically correspond to a combination of the approaches by Wu et al. (2024) and Didi et al. (2023), where the likelihood score is learned but training is facilitated by leveraging SMC steps. + +We note that ideas similar to Didi et al. (2023) have recently also been used for fine-tuning diffusion models (where $p_{Y|X}(y|\cdot)$ corresponds to a reward function), using adjoint matching to minimize the KL divergence instead of, e.g., the log-variance divergence, to solve the SOC (Domingo-Enrich et al., 2024). While we propose to use the log-variance divergence to allow off-policy training and reduce variance (see Section 2.3), we note that adjoint matching and related approaches (Domingo-Enrich et al., 2023; Domingo-Enrich, 2024) could also be used for SCLD to solve the SOC problems in each subtrajectory. + +# A.2 PROOFS AND THEORETICAL REMARKS + +In this section, we provide additional remarks on our theory and the proof of Proposition 2.3. + +Remark A.1 (Generalizations). We note that, in principle, prescribing an annealing, i.e. $p_{X^u} = \pi$ , is not strictly necessary, and one could instead consider general bridges allowing for arbitrary density evolutions between the prior to the target. This, however, would come with the additional challenge of learning the (unnormized) log-density $\log p_{X^u}$ of the controlled process, see, e.g., Richter & Berner (2024, Appendix A.7), which could make optimization potentially more difficult. Moreover, we can only use the approximate densities for the MCMC refinements as compared to using the target density $\pi$ in case of a prescribed annealing. While the general bridges do not exhibit unique solutions, one can consider the case studied in diffusion models, where the control $v$ of the reverse-time process in (7) is fixed such that $Y_0^v$ is approximately distributed as $p_{\mathrm{prior}}$ . Nelson's identity in (8) shows that it is sufficient to learn the log-density $\log p_{Y^v}$ and the optimal control can be computed using automatic differentiation, as leveraged in Phillips et al. (2024); Richter & Berner (2024). However, this can potentially be unstable and computationally more expensive. + +Remark A.2 (Connections to reinforcement learning). The objectives of diffusion-based samplers can be viewed as stochastic optimal control problems; see, e.g., Dai Pra (1991); Zhang & Chen (2022); Berner et al. (2024). More generally, stochastic optimal control problems can be understood as versions of maximum entropy reinforcement learning in continuous time and space; see, e.g., Domingo-Enrich et al. (2024, Appendix C). Specifically, the prior distribution $p_{\mathrm{prior}}$ together with the control $u$ define policies and transitions via the SDE (6) (or, in discrete time, via the transition kernels in (32) given by the Euler-Maruyama scheme). This allows the transfer of successful ideas from reinforcement learning to diffusion-based samplers. Motivated by previous work (Zhang et al., 2023a; Richter & Berner, 2024; Sendera et al., 2024), we propose to use off-policy training with prioritized replay buffers for SCLD, which is enabled by the log-variance loss (see Section 2.3). + +Proof of Proposition 2.3. We follow the proof ideas from Nusken & Richter (2021, Proposition 5.7), however, need to be careful since the reweighting of the measure $\vec{\mathbb{P}}_{[t_{n - 1},t_n]} = \vec{\mathbb{P}}_{[t_{n - 1},t_n]}^{u,\pi_{n - 1}}$ is done w.r.t. a measure on the previous time interval $[t_m,t_{n - 1}]$ . Let us recall the KL divergence (16), namely + +$$ +\begin{array}{l} D := D _ {\mathrm {K L}} \left(\overrightarrow {\mathbb {P}} _ {[ t _ {n - 1}, t _ {n} ]} | \overleftarrow {\mathbb {P}} _ {[ t _ {n - 1}, t _ {n} ]}\right) = - \mathbb {E} _ {X \sim \overrightarrow {\mathbb {P}} _ {[ t _ {n - 1}, t _ {n} ]}} \left[ \log \left(w _ {[ t _ {n - 1}, t _ {n} ]} (X)\right) \right] \\ = - \mathbb {E} _ {X \sim \vec {\mathbb {P}} _ {[ t _ {m}, t _ {n} ]}} \left[ \log \left(w _ {[ t _ {n - 1}, t _ {n} ]} (X)\right) w _ {[ t _ {m}, t _ {n - 1} ]} (X) \right], \\ \end{array} +$$ + +where we abbreviate $w_{[s,t]} \coloneqq \frac{\mathrm{d}\tilde{\mathbb{P}}_{[s,t]}^{u,\pi(\cdot,s)}}{\mathrm{d}\tilde{\mathbb{P}}_{[s,t]}^{u,\pi(\cdot,t)}}$ . Using the analogous abbreviation $w_{[s,t]}^{\otimes I}$ for the product measures, we note that + +$$ +\begin{array}{l} \operatorname {V a r} \left[ \widehat {D} _ {\mathrm {K L}} ^ {(K)} \left(\overline {{\mathbb {P}}} _ {[ t _ {n - 1}, t _ {n} ]} ^ {\otimes I} | \overline {{\mathbb {P}}} _ {[ t _ {n - 1}, t _ {n} ]} ^ {\otimes I}\right) \right] = \frac {1}{K} \operatorname {V a r} _ {X \sim \overline {{\mathbb {P}}} _ {[ t _ {m}, t _ {n} ]} ^ {\otimes I}} \left[ \log \left(w _ {[ t _ {n - 1}, t _ {n} ]} ^ {\otimes I} (X)\right) w _ {[ t _ {m}, t _ {n - 1} ]} ^ {\otimes I} (X) \right] \tag {21} \\ = \frac {M _ {I} - D _ {I} ^ {2}}{K}, \\ \end{array} +$$ + +where + +$$ +M _ {I} := \mathbb {E} _ {X \sim \vec {\mathbb {P}} _ {[ t _ {m}, t _ {n} ]} ^ {\otimes I}} \left[ \log^ {2} \left(w _ {[ t _ {n - 1}, t _ {n} ]} ^ {\otimes I} (X)\right) \left(w _ {[ t _ {m}, t _ {n - 1} ]} ^ {\otimes I} (X)\right) ^ {2} \right] +$$ + +and + +$$ +\begin{array}{l} D _ {I} := - \mathbb {E} _ {X \sim \vec {\mathbb {F}} _ {[ t _ {m}, t _ {n} ]} ^ {\otimes I}} \left[ \log \left(w _ {[ t _ {n - 1}, t _ {n} ]} ^ {\otimes I} (X)\right) w _ {[ t _ {m}, t _ {n - 1} ]} ^ {\otimes I} (X) \right] \\ = - \mathbb {E} _ {X \sim \vec {\mathbb {P}} _ {[ t _ {n - 1}, t _ {n} ]} ^ {\otimes I}} \left[ \log \left(w _ {[ t _ {n - 1}, t _ {n} ]} ^ {\otimes I} (X)\right) \right] = D _ {\mathrm {K L}} \left(\vec {\mathbb {P}} _ {[ t _ {n - 1}, t _ {n} ]} ^ {\otimes I} | \vec {\mathbb {P}} _ {[ t _ {n - 1}, t _ {n} ]} ^ {\otimes I}\right) = I D. \tag {22} \\ \end{array} +$$ + +Moreover, we can compute + +$$ +\begin{array}{l} M _ {I} = \mathbb {E} _ {X \sim \widetilde {\mathbb {P}} _ {[ t _ {m}, t _ {n} ]} ^ {\otimes I}} \left[ \left(\sum_ {i = 1} ^ {I} \log w _ {[ t _ {n - 1}, t _ {n} ]} ^ {(i)} (X)\right) ^ {2} \left(w _ {[ t _ {m}, t _ {n - 1} ]} ^ {\otimes I} (X)\right) ^ {2} \right] \\ = \sum_ {i = 1} ^ {I} \mathbb {E} _ {X \sim \tilde {\mathbb {P}} _ {[ t _ {m}, t _ {n} ]} ^ {\otimes I}} \left[ \log^ {2} \left(w _ {[ t _ {n - 1}, t _ {n} ]} ^ {(i)} (X)\right) \left(w _ {[ t _ {m}, t _ {n - 1} ]} ^ {\otimes I} (X)\right) ^ {2} \right] \tag {23} \\ +\sum_{\substack{i,j = 1\\ i\neq j}}^{I}\mathbb{E}_{X\sim \vec{\mathbb{F}}_{[t_{m},t_{n}]}^{\otimes I}}\left[\log \left(w_{[t_{n - 1},t_{n}]}^{(i)}(X)\right)\log \left(w_{[t_{n - 1},t_{n}]}^{(j)}(X)\right)\left(w_{[t_{m},t_{n - 1}]}^{\otimes I}(X)\right)^{2}\right] \\ = I M C ^ {I - 1} + I (I - 1) D ^ {2} C ^ {I - 2}, \\ \end{array} +$$ + +where $w_{[s,t]}^{(i)}$ denotes the weight for the $i$ -th factor of the product measure and we abbreviate + +$$ +M := \mathbb {E} _ {X \sim \mathbb {P} _ {[ t _ {m}, t _ {n} ]}} \left[ \log^ {2} \left(w _ {[ t _ {n - 1}, t _ {n} ]} (X)\right) \left(w _ {[ t _ {m}, t _ {n - 1} ]} (X)\right) ^ {2} \right] \geq D ^ {2} \tag {24} +$$ + +and + +$$ +\begin{array}{l} C := \mathbb {E} _ {X \sim \vec {\mathbb {P}} _ {[ t _ {m}, t _ {n} ]}} \left[ \left(w _ {[ t _ {m}, t _ {n - 1} ]} (X)\right) ^ {2} \right] = \mathbb {E} _ {X \sim \vec {\mathbb {P}} _ {[ t _ {m}, t _ {n - 1} ]}} \left[ \left(w _ {[ t _ {m}, t _ {n - 1} ]} (X)\right) ^ {2} \right] \\ = D _ {\chi^ {2}} \left(\overleftrightarrow {\mathbb {P}} _ {[ t _ {m}, t _ {n - 1} ]} | \overrightarrow {\mathbb {P}} _ {[ t _ {m}, t _ {n - 1} ]}\right) + 1 \geq 1. \tag {25} \\ \end{array} +$$ + +Combining the definition of the relative error with (21), (22), and (23), we obtain that + +$$ +r ^ {(K)} \left(\overrightarrow {\mathbb {P}} _ {[ t _ {n - 1}, t _ {n} ]} ^ {\otimes I} | \overleftarrow {\mathbb {P}} _ {[ t _ {n - 1}, t _ {n} ]} ^ {\otimes I}\right) = \sqrt {\frac {M _ {I} - D _ {I} ^ {2}}{K D _ {I} ^ {2}}} = \frac {C ^ {I / 2}}{\sqrt {K}} \sqrt {\frac {M C + D ^ {2} (I - 1)}{C ^ {2} I D ^ {2}} - \frac {1}{C ^ {I}}}, +$$ + +which, in view of (24) and (25), proves the claim. + +![](images/e8f4ba2be3c572ec50c7264cbb3a2f417b8932e271b48ef3d9443ce1f94888c9.jpg) + +As already stated in the main text, we note that the log-variance divergence, defined in (18), does not scale exponentially in the dimension, as already proved in (Nusken & Richter, 2021, Proposition 5.7). For convenience of the reader, let us explicitly verify that this statement also holds in our + +setting. To this end, first note that + +$$ +D _ {\mathrm {L V}} ^ {\mathbb {Q} ^ {\otimes I}} \left(\vec {\mathbb {P}} _ {[ t _ {n - 1}, t _ {n} ]} ^ {\otimes I} | \vec {\mathbb {P}} _ {[ t _ {n - 1}, t _ {n} ]} ^ {\otimes I}\right) = \operatorname {V a r} _ {X \sim \mathbb {Q} ^ {\otimes I}} \left[ \log \left(w _ {[ t _ {n - 1}, t _ {n} ]} ^ {\otimes I} (X)\right) \right] = \tag {26a} +$$ + +$$ +\sum_ {i = 1} ^ {I} \operatorname {V a r} _ {X \sim \mathbb {Q}} \left[ \log \left(w _ {\left[ t _ {n - 1}, t _ {n} \right]} ^ {(i)} (X)\right) \right] = I D _ {\mathrm {L V}} ^ {\mathbb {Q}} \left(\overrightarrow {\mathbb {P}} _ {\left[ t _ {n - 1}, t _ {n} \right]} | \overleftarrow {\mathbb {P}} _ {\left[ t _ {n - 1}, t _ {n} \right]}\right), \tag {26b} +$$ + +where we recall that $\mathbb{Q}$ is an arbitrary reference measure. Following Cho et al. (2005), the sample variance satisfies + +$$ +\left. \operatorname {V a r} \left[ \widehat {D} _ {\mathrm {L V}} ^ {\mathbb {Q} ^ {\otimes I}, (K)} \left(\overline {{\mathbb {P}}} _ {[ t _ {n - 1}, t _ {n} ]} ^ {\otimes I} | \overline {{\mathbb {P}}} _ {[ t _ {n - 1}, t _ {n} ]} ^ {\otimes I}\right) \right] = \frac {1}{K} \left(\mu_ {4} - \frac {K - 3}{K - 1} D _ {\mathrm {L V}} ^ {\mathbb {Q} ^ {\otimes I}} \left(\overline {{\mathbb {P}}} _ {[ t _ {n - 1}, t _ {n} ]} ^ {\otimes I} | \overline {{\mathbb {P}}} _ {[ t _ {n - 1}, t _ {n} ]} ^ {\otimes I}\right) ^ {2}\right), \right. \tag {27} +$$ + +where + +$$ +\mu_ {4} = \mathbb {E} _ {X \sim \mathbb {Q} ^ {\otimes I}} \left[ \left(\log \left(w _ {[ t _ {n - 1}, t _ {n} ]} ^ {\otimes I} (X)\right) - \mathbb {E} _ {X \sim \mathbb {Q} ^ {\otimes I}} \left[ \log \left(w _ {[ t _ {n - 1}, t _ {n} ]} ^ {\otimes I} (X)\right) \right]\right) ^ {4} \right]. \tag {28} +$$ + +We can calculate + +$$ +\begin{array}{l} \mu_ {4} = \mathbb {E} _ {X \sim \mathbb {Q} ^ {\otimes I}} \left[ \left(\sum_ {i = 1} ^ {I} \left(\log \left(w _ {[ t _ {n - 1}, t _ {n} ]} ^ {(i)} (X)\right) - \mathbb {E} _ {X \sim \mathbb {Q}} \left[ \log \left(w _ {[ t _ {n - 1}, t _ {n} ]} ^ {(i)} (X)\right) \right]\right)\right) ^ {4} \right] (29a) \\ = I \mathbb {E} _ {X \sim \mathbb {Q}} \left[ \left(\log \left(w _ {[ t _ {n - 1}, t _ {n} ]} (X)\right) - \mathbb {E} _ {X \sim \mathbb {Q}} \left[ \log \left(w _ {[ t _ {n - 1}, t _ {n} ]} (X)\right) \right]\right) ^ {4} \right] (29b) \\ + 6 \binom {I} {2} \mathbb {E} _ {X \sim \mathbb {Q}} \left[ \left(\log \left(w _ {[ t _ {n - 1}, t _ {n} ]} (X)\right) - \mathbb {E} _ {X \sim \mathbb {Q}} \left[ \log \left(w _ {[ t _ {n - 1}, t _ {n} ]} (X)\right) \right]\right) ^ {2} \right] ^ {2}, (29c) \\ \end{array} +$$ + +where we have used the fact that, for instance, + +$$ +\begin{array}{l} \mathbb {E} _ {X \sim \mathbb {Q} ^ {\otimes I}} \left[ \left(\log \left(w _ {[ t _ {n - 1}, t _ {n} ]} ^ {(i)} (X)\right) - \mathbb {E} _ {X \sim \mathbb {Q}} \left[ \log \left(w _ {[ t _ {n - 1}, t _ {n} ]} ^ {(i)} (X)\right) \right]\right) \right. \tag {30} \\ \left. \left(\log \left(w _ {[ t _ {n - 1}, t _ {n} ]} ^ {(j)} (X)\right) - \mathbb {E} _ {X \sim \mathbb {Q}} \left[ \log \left(w _ {[ t _ {n - 1}, t _ {n} ]} ^ {(j)} (X)\right) \right]\right) ^ {3} \right] = 0, \\ \end{array} +$$ + +for $i\neq j$ . Combining this with (26), it follows that $\mathrm{Var}\left[\widehat{D}_{\mathrm{LV}}^{(K)}\left(\overline{\mathbb{P}}_{[t_{n - 1},t_n]}^{\otimes I}|\overline{\mathbb{P}}_{[t_{n - 1},t_n]}\right)\right] = \mathcal{O}(I^2)$ Recalling the definition of the relative error, $r^{(K)}\coloneqq \mathrm{Var}(\widehat{D}_{\mathrm{LV}}^{(K)})^{1 / 2} / D_{\mathrm{LV}}$ , we see that it does not scale exponentially in $I$ + +# A.3 ALGORITHMIC DETAILS AND PSEUDOCODE + +We first provide formulas to compute the Radon-Nikodym derivative (RND) and the forward and backward kernels in discrete time. Then, we give an implementable method in Algorithm 2 and provide details on the resampling step and training with a buffer. Note that we can also use nonuniform discretizations within subtrajectories by adapting the times $hi$ , $i = 0, \dots, N$ , accordingly. + +# A.3.1 COMPUTATION OF THE RADON-NIKODYM DERIVATIVE + +As in Vargas et al. (2024), we obtain an approximate, computable formula for the Radon-Nikodym derivative in Lemma 2.2 between the $(n - 1)$ -th and $n$ -th time step, given by + +$$ +w _ {[ t _ {n - 1}, t _ {n} ]} (X) = \frac {\mathrm {d} \tilde {\mathbb {P}} _ {[ t _ {n - 1} , t _ {n} ]}}{\mathrm {d} \tilde {\mathbb {P}} _ {[ t _ {n - 1} , t _ {n} ]}} (X) \approx \frac {\pi \left(X _ {t _ {n}} , t _ {n}\right)}{\pi \left(X _ {t _ {n - 1}} , t _ {n - 1}\right)} \prod_ {i = (n - 1) L + 1} ^ {n L} \frac {\tilde {p} _ {(i - 1) h | i h} \left(X _ {(i - 1) h} | X _ {i h}\right)}{\tilde {p} _ {i h | (i - 1) h} \left(X _ {i h} | X _ {(i - 1) h}\right)}, \tag {31} +$$ + +where the transition densities for the forward and reverse-time SDEs, coming from the Euler-Maruyama discretization as in (19), are given as + +$$ +\begin{array}{l} \vec {p} _ {t | s} \left(X _ {t} \mid X _ {s}\right) = \mathcal {N} \left(X _ {t}; X _ {s} + u \left(X _ {s}, s\right) (t - s), \sigma^ {2} (s) (t - s)\right) \tag {32} \\ \tilde {p} _ {s \mid t} (X _ {s} \mid X _ {t}) = \mathcal {N} (X _ {s}; X _ {t} + (\sigma^ {2} \nabla \log \pi - u) (X _ {t}, t) (t - s), \sigma^ {2} (t) (t - s)). \\ \end{array} +$$ + +In practice, in line with Vargas et al. (2024), we parameterize the control as + +$$ +u = \sigma^ {2} \widetilde {u} _ {\theta} + \frac {\sigma^ {2}}{2} \nabla \log \pi , \tag {33} +$$ + +where $\widetilde{u}_{\theta}$ is parametrized by a neural network. When $\widetilde{u}_{\theta}$ is initialized as the zero function, we recover an annealed form of Langevin dynamics (Welling & Teh, 2011), providing an improved starting point for optimization. + +# A.3.2 A PRACTICAL ALGORITHM + +In Algorithm 2, we give a practical and detailed version of Algorithm 1. + +Algorithm 2 SCLD-ForwardPass +Require: Target $\rho_{\mathrm{target}}$ (learnable) prior $p_{\mathrm{prior}} = \mathcal{N}(\mu_\theta, \mathrm{diag}(\exp(2\ell_\theta))$ , number of subtrajectories $N$ , steps per subtrajectory $L$ and step size $h$ , annealing schedule $\beta_\theta$ as in (35), noise schedule $\sigma$ , control $u$ given by neural network $\widetilde{u}^\theta$ as in (33), number of particles $K$ +1: Sample from prior (by reparametrization): $\widehat{X}_0^{(1:K)} \sim p_{\mathrm{prior}} \quad \triangleright$ Independent for each particle +2: Initialize (unnormized) importance weights: $w_0^{(1:K)} = 1$ +3: Evaluate control and prior: $u(\widehat{X}_0^{(1:K)}, 0)$ and $p_{\mathrm{prior}}(\widehat{X}_0^{(1:K)})$ +4: for $n = 1$ to $N$ do $\triangleright$ Note that $t_n = nLh$ +5: for $i = (n - 1)L + 1$ to $nL$ do $\triangleright$ Consider the time interval $[(i - 1)h, ih]$ +6: Euler-Maruyama simulation: $\widehat{X}_i^{(1:K)} \sim \vec{p}_{ih|(i - 1)h}(\cdot|\widehat{X}_{i - 1}^{(1:K)})$ as in (32) $\triangleright$ See (19) +7: Evaluate control: $u(\widehat{X}_i^{(1:K)}, ih)$ +8: Evaluate (unnormized) annealing: $\pi(\widehat{X}_{nL}^{(1:K)}, t_n) = (p_{\mathrm{prior}}^{1-\beta_\theta(t_n)} \rho_{\mathrm{target}}^{\beta_\theta(t_n)})(\widehat{X}_{nL}^{(1:K)}) \triangleright$ See (20) +9: Compute RNDs: $w_{[t_{n-1}, t_n]}^{(1:K)}$ as in (31) $\triangleright$ For every $k$ , we use $X_{ih} = \widehat{X}_i^{(k)}$ +10: Update weights: $w_n^{(1:K)} = w_{n-1}^{(1:K)} w_{[t_{n-1}, t_n]}^{(1:K)}$ +11: Resample: $\widehat{X}_{nL}^{(1:K)}, w_n^{(1:K)} = \text{resample}(\widehat{X}_{nL}^{(1:K)}, w_n^{(1:K)}) \triangleright$ See Algorithm 5 +12: MCMC step: Update $\widehat{X}_{nL}^{(1:K)}$ with $\pi(\cdot, t_n)$ -invariant kernel +13: return RNDs $(w_{[t_{n-1}, t_n]}^{(1:K)})_{n=1}^N$ , weights $(w_n^{(1:K)})_{n=0}^N$ , trajectories $\widehat{X}^{(1:K)}$ , log Z estimate $\sum_{n=1}^N \log \left( \sum_{k=1}^K w_{n-1}^{(k)} w_{[t_{n-1}, t_n]}^{(k)} \right)$ , ELBO $\sum_{n=1}^N \sum_{k=1}^K w_{n-1}^{(k)} \log \left( w_{[t_{n-1}, t_n]}^{(k)} \right)$ + +Prioritized replay buffer. We give the exact algorithm of our replay buffer in Algorithm 4. We note that there are many alternative possibilities for choosing the buffer priority (including by importance weight), which we leave to future exploration. Moreover, as in traditional replay buffers (Mnih, 2013), there is an option to perform multiple gradient steps per simulation to reduce computation costs. + +Resampling. The work of Webber (2019) shows that there is great scope to design resampling methods. However, in line with prior work, we opt to use the simple adaptive multinomial resampling for which pseudocode is provided in Algorithm 5. + +Annealing Schedule While we choose to learn the annealing schedule, an alternative approach that takes advantage of the flexibility of our continuous-time perspective is to set $\beta(t) = t$ and instead adaptively choose the time discretization. For example, the constant-ESS scheme annealing schedule Buchholz et al. (2021) is a commonly used scheme in the SMC literature and can be easily adapted to the SCLD setting for both training and sampling. We leave the investigation of this idea to future work. + +# A.4 BENCHMARK TARGET DISTRIBUTIONS + +Here, we introduce the target densities considered in our experiments more formally. Most of these are standard benchmarks taken from, e.g., Heng et al. (2017); Arbel et al. (2021); Geffner & Domke (2022); Richter & Berner (2024); Blessing et al. (2024). + +# A.4.1 BAYESIAN STATISTICS TASKS + +For these tasks, no groundtruth samples are available. + +# Algorithm 3 SCLD-Training + +See Algorithm 4 for training with buffers. + +Require: Number of iterations $I$ , initial parameters $\theta^{(0)}$ , optimizer update update, inputs for Algorithm 2 + +1: for $i = 0$ to $I - 1$ do +2: Run Algorithm 2: $(w_{[t_{n - 1},t_n]}^{(1:K)})_{n = 1}^N,(w_n^{(1:K)})_{n = 0}^N = \mathrm{SCLD - ForwardPass}(\theta^{(i)})$ +3: if LV then Trajectories $\widehat{X}^{(1:K)}$ are detached during forward pass +4: Compute loss: $\mathcal{L} = \sum_{n=1}^{N} \frac{1}{K} \sum_{k=1}^{K} \left( \log w_{[t_{n-1}, t_n]}^{(k)} - \frac{1}{K} \sum_{i=1}^{K} \log w_{[t_{n-1}, t_n]}^{(i)} \right)^2$ +5: else if KL then +6: Compute loss: $\mathcal{L} = -\sum_{n=1}^{N} \frac{1}{K} \sum_{k=1}^{K} \operatorname{detach}(w_{n-1}^{(k)}) \log w_{[t_{n-1}, t_n]}^{(k)}$ +7: Compute gradient w.r.t. parameters: $G^{(i)} = \nabla_{\theta^{(i)}}\mathcal{L}$ +8: Optimizer step: $\theta^{(i + 1)} = \mathrm{update}(\theta^{(i)},(G^{(j)})_{j = 0}^{i})$ $\triangleright$ We use Adam +9: return Optimized parameters $\theta^{(I)}$ + +# Algorithm 4 SCLD-Buffer-Training + +Require: Buffer $(\mathcal{B}_n)_{n=1}^N$ for every suturectory, inputs for Algorithm 3 +1: for $i = 0$ to $I - 1$ do +2: Run Algorithm 2: $(w_{[t_n - 1,t_n]}^{(1;K)})_{n = 1}^N,\widehat{X}^{(1;K)} = \mathrm{SCLD - ForwardPass}(\theta^{(i)})$ with $K$ particles +3: for $n = 1$ to $N$ do +4: Store subtrajectories: $\left(\widehat{X}_i^{(1;K)}\right)_{i = (n - 1)L}^{nL}$ into $\mathcal{B}_n$ with weights $w_{[t_{n - 1},t_n]}^{(1;K)}$ , replacing oldest entries +5: Sample from buffer: $\widetilde{X}^{(1:K/2)} \sim \mathcal{B}_n$ with probability proportional to buffer weights +6: Recompute RNDs: $\widetilde{w}_{[t_n - 1,t_n]}^{(1:K / 2)}$ for detached $\widetilde{X}^{(1:K / 2)}$ using (31) and current parameters $\theta^{(i)}$ +7: Update buffer: Set $\widetilde{w}_{[t_{n - 1},t_n]}$ as weights for $\widetilde{X}^{(1:K / 2)}$ $\triangleright$ Updating all $B$ particles is too slow +8: Sample other half from simulation: $\widetilde{w}_{[t_{n-1}, t_n]}$ from $w_{[t_{n-1}, t_n]}^{(1:K)}$ uniformly without replacement +9: Compute log-variance loss: $\mathcal{L} = \sum_{n=1}^{N} \frac{1}{K} \sum_{k=1}^{K} \left( \log \widetilde{w}_{[t_{n-1}, t_n]}^{(k)} - \frac{1}{K} \sum_{i=1}^{K} \log \widetilde{w}_{[t_{n-1}, t_n]}^{(i)} \right)^2$ +10: Compute gradient w.r.t. parameters: $G^{(i)} = \nabla_{\theta^{(i)}}\mathcal{L}$ +11: Optimizer step: $\theta^{(i + 1)} = \mathrm{update}(\theta^{(i)},(G^{(j)})_{j = 0}^{i})$ We use Adam +12: return Optimized parameters $\theta^{(I)}$ + +Bayesian Logistic Regression (Sonar and Credit). We used two binary classification problems in our benchmark, which have also been used in various other works to compare different state-of-the-art methods in variational inference and MCMC. Specifically, we assess the performance of a Bayesian logistic model with + +$$ +\rho_ {\text {t a r g e t}} (x) = p (x) \prod_ {i = 1} ^ {n} \operatorname {B e r n o u l l i} \left(y _ {i}; \operatorname {s i g m o i d} \left(x \cdot u _ {i}\right)\right) +$$ + +on two standardized datasets $((u_i, y_i))_{i=1}^n$ , namely Sonar $(d = 61)$ and German Credit $(d = 25)$ with $n = 208$ and $n = 1000$ data points, respectively. We choose $p = \mathcal{N}(0, I)$ for Sonar and $p \equiv 1$ for Credit (in line with the code of Blessing et al. (2024) which omitted the prior). + +Random Effect Regression (Seeds). The Seeds $(d = 26)$ target uses a random effect regression model given by: + +$$ +\begin{array}{l} \tau \sim \mathrm {G a m m a} (0. 0 1, 0. 0 1) \\ a _ {0}, a _ {1}, a _ {2}, a _ {1 2} \sim \mathcal {N} (0, 1 0) \\ b _ {i} \sim \mathcal {N} \left(0, \frac {1}{\sqrt {\tau}}\right), \quad i = 1, \dots , 2 1, \\ \log_ {i} = a _ {0} + a _ {1} x _ {i} + a _ {2} y _ {i} + a _ {1 2} x _ {i} y _ {i} + b _ {1}, \quad i = 1, \dots , 2 1, \\ r _ {i} \sim \text {B i n o m i a l} \left(\log, N _ {i}\right), \quad i = 1, \dots , 2 1. \\ \end{array} +$$ + +The goal is to do inference over the variables $\tau, a_0, a_1, a_2, a_{12}$ and $b_i$ for $i = 1, \ldots, 21$ , given observed values for $x_i, y_i$ , and $N_i$ from a dataset modeling the germination proportion of seeds; see Geffner & Domke (2022) for details. + +Algorithm 5 Adaptive Multinomial Resampling +Require: particles $X^{(1:K)}$ , unnormalized weights $w^{(1:K)}$ +1: Normalize: $W^{(k)} = w^{(k)} / \sum_{i=1}^{K} w^{(i)}$ , $k = 1, \ldots, K$ +2: Compute ESS: $\mathrm{ESS} = 1 / \sum_{k=1}^{K} (W^{(k)})^2$ +3: if ESS < $\alpha K$ then ▷ We take $\alpha = 0.3$ +4: for $k = 1$ to $K$ do +5: Sample index from categorical distribution: $i \in \{1, \ldots, K\}$ with probabilities $W^{(1:K)}$ +6: Define resampled particle: $\widetilde{X}^{(k)} = X^{(i)}$ +7: Reset weights: $W^{(1:K)} = 1 / K$ +8: else +9: Keep particles: $\widetilde{X}^{(1:K)} = X^{(1:K)}$ +10: return resampled particles $\widetilde{X}^{(1:K)}$ , updated and normalized weights $W^{(1:K)}$ + +Time Series Models (Brownian). The Brownian $(d = 32)$ model corresponds to the time discretization of a Brownian motion with Gaussian observation noise: + +$$ +\alpha_ {\text {i n n}} \sim \operatorname {L o g N o r m a l} (0, 2), +$$ + +$$ +\alpha_ {\mathrm {o b s}} \sim \operatorname {L o g N o r m a l} (0, 2), +$$ + +$$ +x _ {1} \sim \mathcal {N} (0, \alpha_ {\mathrm {i n n}}), +$$ + +$$ +x _ {i} \sim \mathcal {N} \left(x _ {i - 1}, \alpha_ {\text {i n n}}\right), \quad i = 2, \dots , 3 0, +$$ + +$$ +y _ {i} \sim \mathcal {N} \left(x _ {i}, \alpha_ {\mathrm {o b s}}\right), \quad i = 1, \dots , 3 0. +$$ + +Inference is performed over the variables $\alpha_{\mathrm{inn}}$ , $\alpha_{\mathrm{obs}}$ , and $\{x_i\}_{i=1}^{30}$ given the observations $\{y_i\}_{i=1}^{10}$ and $\{y_i\}_{i=20}^{30}$ (i.e., the middle observations are missing); see Geffner & Domke (2022). + +Spatial Statistics (LGCP). The Log Gaussian Cox process (LGCP) is a popular high-dimensional task in spatial statistics (Møller et al., 1998), which models the position of pine saplings. Using a $d = 40 \times 40 = 1600$ grid, we obtain the unnormalized target density by + +$$ +\rho_ {\mathrm {t a r g e t}} = \mathcal {N} (x; \mu , \Sigma) \prod_ {i = 1} ^ {d} \exp \left(x _ {i} y _ {i} - \frac {\exp (x _ {i})}{d}\right), +$$ + +where $y$ is a given dataset and $\mu$ and $\Sigma$ are the mean and covariance matrix of the given prior. We use the more challenging unwhitened version; see Heng et al. (2017); Arbel et al. (2021) for details. + +# A.4.2 SYNTHETIC TARGETS + +For these tasks, groundtruth samples are available. + +Robot. The Robot targets (Arenz et al., 2020) (Robot1, Robot4) aim at learning joint configurations of a 10 degrees-of-freedom planar robot, parameterized by + +$$ +\alpha = (\alpha_ {1}, \dots , \alpha_ {1 0}), +$$ + +such that it reaches a desired goal position while enforcing smooth configurations. The target density is given by + +$$ +\rho_ {\text {t a r g e t}} (\alpha) = p _ {\text {c o n f}} (\alpha) p _ {\text {c a r t}} (\alpha), +$$ + +where $p_{\mathrm{conf}}$ enforces smooth configurations and $p_{\mathrm{cart}}$ penalizes deviations from the goal position. $p_{\mathrm{conf}}$ is modeled as zero-mean Gaussian distribution with a diagonal covariance matrix, where the angle $\alpha_{1}$ of the first joint has a variance of 1 and the remaining joint angles $\alpha_{2}, \ldots, \alpha_{10}$ have a variance of $4 \times 10^{-2}$ . + +Formally, we define the locations of the robot joints by + +$$ +x _ {i} (\alpha) = \sum_ {j = 1} ^ {i} \cos (\alpha_ {j}), \qquad i = 0, \dots , 1 0, +$$ + +$$ +y _ {i} (\alpha) = \sum_ {j = 1} ^ {i} \sin (\alpha_ {j}), \qquad i = 0, \dots , 1 0. +$$ + +In the Robot1 task there is one goal at $(7,0)$ , and we specify + +$$ +p _ {\text {c a r t}} (\alpha) = \mathcal {N} \left(\binom {x _ {1 0} (\alpha)} {y _ {1 0} (\alpha)}; \binom {7} {0}, 1 0 ^ {- 4} I\right), \tag {34} +$$ + +i.e., a Gaussian distribution centered at the Cartesian coordinates of the goal position, with a variance of $10^{-4}$ in both directions. + +In the Robot4 task there are 4 goals at $(\pm 7,0)$ and $(0,\pm 7)$ , and so $p_{\mathrm{cart}}$ is given by the maximum over the four respective Gaussian distributions as in (34) (up to a constant of proportionality). Groundtruth samples are generated by long slice sampling runs (Neal, 2003) and taken from the repository of Arenz et al. (2020). + +Mixture distributions (GMM and MoS). For the GMM and MoS tasks, we define a mixture distribution with $m$ components as + +$$ +p _ {\text {t a r g e t}} = \frac {1}{m} \sum_ {i = 1} ^ {m} p _ {i}. +$$ + +The Gaussian Mixture Model (GMM), taken from Blessing et al. (2024), consists of $m = 40$ mixture components with + +$$ +p _ {i} = \mathcal {N} (\mu_ {i}, I), +$$ + +$$ +\mu_ {i} \sim \mathcal {U} _ {d} (- 4 0, 4 0), +$$ + +where $\mathcal{U}_d(l,u)$ refers to a uniform distribution on $[l,u]^d$ . We take $d = 50$ for the main experiments. + +The Mixture of Student's t-distributions (MoS), taken from Blessing et al. (2024), comprises $m = 10$ Student's t-distributions $t_2$ , where the 2 refers to the degree of freedom. Specifically, we use + +$$ +p _ {i} = t _ {2} + \mu_ {i}, +$$ + +$$ +\mu_ {i} \sim \mathcal {U} _ {d} (- 1 0, 1 0), +$$ + +where $\mu_{i}$ refers to the translation of the individual components, and take $d = 50$ . For both the GMM and MoS tasks, the $\mu_{i}$ 's are fixed throughout experiments, i.e., selected with the same random seed. + +Funnel. The Funnel target introduced in Neal (2003) is a challenging funnel-shaped distribution given by + +$$ +p _ {\text {t a r g e t}} (x) = \mathcal {N} (x _ {1}; 0, \sigma^ {2}) \mathcal {N} (x _ {2}, \dots , x _ {1 0}; 0, \exp (x _ {1}) I), +$$ + +with $\sigma^2 = 9$ for any number of dimensions $d\geq 2$ . We take $d = 10$ in our main experiments. + +Many-Well (MW). A typical problem in molecular dynamics considers sampling from the stationary distribution of Langevin dynamics. In our example we shall consider a $d$ -dimensional many-well potential, corresponding to the (unnormized) density + +$$ +\rho_ {\text {t a r g e t}} (x) = \exp \left(- \sum_ {i = 1} ^ {m} \left(x _ {i} ^ {2} - \delta\right) ^ {2} - \frac {1}{2} \sum_ {i = m + 1} ^ {d} x _ {i} ^ {2}\right). +$$ + +In line with Berner et al. (2024); Sun et al. (2024), we take $d = 5$ , $m = 5$ , and $\delta = 4$ , leading to $2^{m} = 32$ well-separated modes. Groundtruth $\log Z$ and samples can be obtained by noting that the distribution factors over dimensions. + +# A.5 EXPERIMENTAL DETAILS + +In this section, we describe the experimental setup and evaluation protocol. We also discuss design choices for our main experiments as well as how our hyperparameters are selected. + +# A.5.1 METRICS AND EVALUATION + +- Maximization of the ELBO. The ELBO refers to a lower bound on $\log Z$ . This is a classic benchmark for samplers, and higher ELBOs are usually associated with precise sampling from discovered modes. However, the ELBO is not necessarily indicative of mode collapse; see Blessing et al. (2024) and Appendix A.6.4 for details. +- Minimization of the Sinkhorn distance. The Sinkhorn distance $\mathcal{W}_2$ is an optimal transport (OT) distance. When computed between a set of generated samples and a groundtruth set of samples + +from the target (when the latter is available), this gives an estimate of the OT distance from the distribution generated by the sampler to $p_{\mathrm{target}}$ . As discussed further in Blessing et al. (2024), low OT distances are associated with good mode coverage (i.e., avoiding mode collapse). + +For both ELBO and optimal transport evaluation, we follow the protocol of Blessing et al. (2024). In particular, we use the Sinkhorn distance as implemented in Cuturi et al. (2022) and use standard formulas for the ELBO computations of our baselines. For SCLD, the ELBO computation is stated in Algorithm 2. We compute all performance criteria 100 times during training using 2000 samples, applying a running average with a length of 5 over these evaluations to obtain robust results within a single run. To ensure robustness across runs, we use four different random seeds and average the best results from each run. As we use the same evaluation protocol as Blessing et al. (2024), we re-use their results for DDS and PIS whenever available. + +As discussed in Blessing et al. (2024), ELBO metrics are insensitive to mode collapse and, as such, may not accurately reflect the quality of samples on multimodal tasks. As groundtruth samples are available for the synthetic tasks considered and due to their generally multimodal nature, we report Sinkhorn distances for these tasks. + +# A.5.2 DESIGN CHOICES + +We follow the following principles: + +- SCLD follows design choices of other methods when these are shared. +- SCLD reuses the hyperparameter choices of baseline methods when shared such that it is not tuned excessively. +- Baseline methods should be given as much or more computational budget compared to SCLD. + +General remarks. For SCLD, CMCD, DDS, and PIS we take the convention that $T = 1$ as rescaling time is equivalent to rescaling the noise level. Since the objectives of DDS and the Time-Reversed Diffusion Sampler (DIS) (Berner et al., 2024) only differ by choice of the reference process (see also Berner et al. (2024, Appendix A.10.1), Richter & Berner (2024, Section 3), and Vargas et al. (2024, Appendix C.3)), we do not explicitly compare against DIS in this work. + +CMCD and SCLD. As SCLD and CMCD share numerous design choices, we mostly follow the choices of CMCD as in Vargas et al. (2024). In particular, we opt to learn the prior as well as the annealing schedule. For the former, we define $p_{\mathrm{prior}} \coloneqq \mathcal{N}(\mu_\theta, \mathrm{diag}(\exp(2\ell_\theta))$ . In other words, we parameterize the Gaussian prior through its mean $\mu_\theta \in \mathbb{R}^d$ and logarithmic standard deviations $\ell_\theta \in \mathbb{R}^d$ , initialized to $\mathcal{N}(0, \sigma^2 I)$ , i.e., $\mu_\theta = 0$ and $(\ell_\theta)_i = \log(\sigma)$ , for some $\sigma > 0$ (referred to as initial scale) to be tuned. We update $\mu_\theta$ and $\ell_\theta$ via the parameterization trick as training progresses. For learning the annealing, we parameterize the schedule in (20) for every $j \in \{1, \dots, NL\}$ by + +$$ +\beta_ {\theta} (j h) := \sum_ {i = 1} ^ {j} \frac {\operatorname {s o f t p l u s} \left(\theta_ {i}\right)}{\sum_ {i = 1} ^ {N L} \operatorname {s o f t p l u s} \left(\theta_ {i}\right)}, \tag {35} +$$ + +where $\theta_{i}\in \mathbb{R}$ are learnable parameters. We choose the buffer size to be 20 times the training batch size, i.e., $B = 20K$ . Moreover, we parametrize the control $u$ as in (33). For SCLD, we use the subtrajectory settings from Section 3. + +CRAFT. We use the implementation by Blessing et al. (2024), following the standard settings of Matthews et al. (2022). Specifically, we employ diagonal affine flows as the transport maps. + +SMC operations. We use the same resampling strategy and MCMC kernel for CRAFT, SMC, and SCLD. In particular, every SMC step consists of adaptive resampling with a threshold of $0.3K$ , followed by one Hamiltonian Monte Carlo (HMC) step with 10 leapfrog steps. For details on the advanced SMC schemes (SMC-ESS and SMC-FC), we refer to Buchholz et al. (2021) and Appendix A.6.8. + +Optimization and batch size. We utilize the Adam optimizer for all methods that require learning. We also found that clipping gradients to 1 was important for stable training on all diffusion-based methods. We use batch size 2000 for training except for LGCP, where batch size 300 is used. We always evaluate with $K = 2000$ particles. + +Number of annealing / diffusion steps. For SMC, DDS, PIS, CMCD, and SCLD in the main experiments, we fix 128 steps. In particular, we have $L = 128 / N$ for SCLD. For CRAFT, we sweep over [4, 8, 128] annealing steps (which also define the number of SMC operations). + +Number of training iterations. We select the number of training iterations such that all methods are given roughly the same number of target function evaluations (NFEs) for a given number of SMC operations or subtrajectories $N$ , evaluations per SMC operation $M$ , and annealing or diffusion steps per subtrajectory $L$ . In our setup, $M = 10$ due to the 10 leapfrog steps in HMC, $(N, L) = (1, 128)$ for DDS, PIS, and CMCD, and $N \in \{4, 8, 128\}$ for CRAFT (with $L = 1$ ) and SCLD (with $L = 128 / N$ ). As a reference value, we use 40000 iterations for DDS and PIS as in Blessing et al. (2024). We report the chosen number of iterations for each method in Table 4. + +Table 4: Number of training iterations for our considered method depending on the number of SMC operations or subtrajectories $N$ . The last rows show the approximate number of target function evaluations (NFEs) per particle in each iteration w.r.t. the number of evaluations per SMC operation $M$ and annealing or diffusion steps per subtrajectory $L$ . + +
CRAFTSCLDDDS, PIS, CMCD-KL, CMCD-LV
N = 1--4 × 104
N = 41052.5 × 104-
N = 85 × 104--
N = 1283 × 1033 × 103-
Approx. NFEs per particleMNMN + LL
Our setupL = 1, M = 10LN = 128, M = 10N = 1, L = 128
+ +We note that all baselines converged satisfactorily within the given iteration budget. Moreover, the generous budget of 40000 iterations for DDS, PIS, and CMCD required running for $4 - 20$ times as long as SCLD's training process on equivalent architecture for our considered tasks (see also Table 9). + +# A.5.3 HYPERPARAMETER SELECTION + +General remarks. We follow the spirit of experimental design in Blessing et al. (2024) to fairly compare SCLD with our diverse range of baselines. We describe the search space and selection procedure below. We select the best configuration based on the target metric and a single seed. We note that alternative experimental setups such as done in Vargas et al. (2024) are possible, leveraging the ability of CMCD and SCLD to learn further hyperparameters end-to-end or use variational mean field approximations (see Appendix A.6.6) instead of a grid-search. + +Prior scale. For all methods that require a $\mathcal{N}(0,\sigma^2 I)$ prior, we sweep over $\sigma$ in [0.1, 1, 10] for tasks where we have no information about the target. For GMM40 and MoS tasks, we know that the initial scale should be around 40 and 15, respectively, by construction of the problem, so we fix these values for all methods. Similarly, for the Robot tasks, we know that the coordinates correspond to radial angles, so we set the initial scale to 2 to cover the $[- \pi, \pi]$ range. + +Diffusion noise schedule. For diffusion-based samplers a noise schedule $\sigma$ as in (6) needs be specified. For PIS, we use a linear noise schedule as in Zhang & Chen (2022), and for DDS, CMCD, and SCLD we use a cosine schedule as in Vargas et al. (2023). Both noise schedules are parameterized by a "minimum diffusion" and a "maximum diffusion" coefficient. We set the minimum diffusion noise level to 0.01 for all tasks and methods except the Robot tasks, where we set it to 0.001. For all methods and tasks we perform grid searches over the maximum diffusion parameter. For all tasks except the Robot and GMM40 tasks we search in [0.1, 1, 10]. Due to the large initial scale of GMM40, we search the maximum diffusion parameter over [5, 10, 20]. For Robot, we search it in [0.003, 0.03, 0, 3] instead of the usual grid due to the constructed sharpness of the modes. + +Architecture. For hyperparameter selection on CMCD-KL, CMCD-LV and SCLD, we use the PISGradNet architecture (with detached score and 2 hidden layers of 64 units) for all diffusion-based methods as in Vargas et al. (2023). However, for CMCD-KL, we found that using the simpler MLP architecture described in Vargas et al. (2024) (which we term PISNet) gave significantly better performance than PISGradNet on most tasks. As such, to ensure strong baselines for CMCD-KL and CMCD-LV, we also select the best architecture among PISGradNet and PISNet (with 2 hidden layers + +of 90 units to ensure similar parameter counts), re-sweeping learning rates as necessary. For SCLD we use PISGradNet on all tasks. + +CMCD-KL, CMCD-LV, DDS, and PIS. We jointly grid search the initial scale and maximum diffusion along with the learning rates. We use one learning rate for the model $\widetilde{u}_{\theta}$ and prior $p_{\mathrm{prior}}$ , and another for the annealing schedule $\beta$ . We sweep over the learning rate of the model in $[10^{-3}, 10^{-4}, 10^{-5}]$ and learning rate of the annealing schedule in $[10^{-2}, 10^{-3}]$ . We perform model selection using 8000 gradient steps instead of 40000 due to the large grid. + +SMC. For all tasks not present in Blessing et al. (2024) (namely the Robot tasks and MW54), we search the same parameter grid used for other methods for the scale of the prior, jointly with HMC step sizes. For all tasks present in the benchmark, we re-use their results and SMC configuration for SCLD and CRAFT. We tuned the step size of HMC, using different step sizes for $t < T / 2$ and $t > T / 2$ (where time corresponds to annealing steps in CRAFT) in the same fashion as Blessing et al. (2024). We search step sizes in the set [0.001, 0.01, 0.5, 0.1, 0.2] + +CRAFT. We sweep over [4, 8, 128] for the number of annealing steps, jointly with the prior scale and the learning rate (also in $[10^{-3}, 10^{-4}, 10^{-5}]$ ), and choose the best value. As in Blessing et al. (2024), we re-use the HMC step sizes that were tuned for SMC. Our results uniformly reproduce or improve upon those presented in the aforementioned paper due to the extended search space. + +SCLD. To ensure a fair comparison with baseline methods, we reuse the chosen scale and diffusion parameters of CMCD-LV as well as the HMC step sizes tuned for SMC. The only grid search we perform for SCLD is over the learning rate of the model in $[10^{-3}, 10^{-4}]$ and the learning rate of the annealing schedule in $[10^{-2}, 10^{-3}]$ . However, as reflected in Table 5, setting all learning rates to $10^{-3}$ typically turned out to be a robust choice. + +Table of hyperparameter choices. In Tables 5 and 6 we present the tuned hyperparameters we obtained. Please note that "PGN" refers to the PISGradNet architecture, whereas "PN" refers to the PISNet architecture. We refer to Blessing et al. (2024) for further details and design choices for PIS and DDS. In Table 6, we specify the hyperparameters for DDS, PIS, and SMC on tasks not present in Blessing et al. (2024). + +Table 5: Hyperparameter choices of our considered methods for the tasks in Blessing et al. (2024). + +
Funnel (10d)MW54 (5d)Robot1 (10d)Robot4 (10d)GMM40 (50d)MoS (50d)Seeds (26d)Sonar (61d)Credit (25d)Brownian (32d)LGCP (1600d)
CMCD-KL
Initial Scale1.01.02.02.040.015.01.00.110.00.11.0
Max Diffusion10.01.00.030.0310.010.01.01.01.01.010.0
ArchitecturePNPGNPGNPGNPNPGNPNPNPGNPNPGN
Model LR0.0010.00010.0010.0010.00010.0010.0010.0010.0010.0010.0001
Annealing Schedule LR0.010.0010.0010.0010.010.0010.010.0010.010.010.01
CMCD-LV
Initial scale1.01.02.02.040.015.01.01.00.10.11.0
Maximum diffusion1.010.00.030.0320.01.01.01.00.11.010.0
ArchitecturePNPNPGNPGNPGNPNPGNPNPNPGNPGN
Model LR0.0010.00010.00010.0010.00010.0010.0010.0010.0010.0010.0001
Annealing schedule LR0.010.010.010.010.010.0010.010.0010.010.010.001
SCLD
Model LR0.0010.00010.0010.0010.0010.0010.0010.0010.0010.0010.001
Annealing schedule LR0.010.010.010.0010.0010.0010.010.010.010.0010.001
CRAFT
Number of steps1281288441281281288128128
LR0.0010.000010.0010.0010.000010.0010.00010.00010.00010.0010.001
initial scale1.01.02.02.040.015.00.11.01.01.01.0
+ +Experimental details. Here, we provide additional details on the experiments in the main part of the paper. + +- Improved convergence (Figure 3). All experiments were performed on a single Nvidia RTX4090 GPU using the same settings as the main experiments. + +Table 6: Hyperparameter choices of DDS, PIS, and SMC for the tasks not present in Blessing et al. (2024). + +
Robot1Robot4MW54
SMC
Initial scale2.02.01.0
HMC step sizes[0.001, 0.01][0.01, 0.001][0.01, 0.001]
DDS
Initial scale2.02.00.1
Maximum diffusion0.30.310.0
LR0.0010.0010.00001
PIS
Maximum diffusion0.30.310.0
LR0.000010.000010.00001
+ +- Varying the number of SMC steps (Figure 4). For this study, we train for 8000 gradient steps in all instances and vary the number of subtrajectories at training and evaluation time. Apart from that, we use the same hyperparameters and procedures as in the main experiments. In particular, the total number of annealing steps is fixed to 128. + +# A.6 ADDITIONAL EXPERIMENTS + +In this section, we present additional experiments. + +# A.6.1 ABLATION STUDIES OF SCLD + +In Figure 6, we study the effect of removing various parts of SCLD on several tasks. We investigate the use of the buffer, resampling, and MCMC steps. For this experiment, all other design choices are kept the same as in the main experiments. In particular, the reported results for the full SCLD algorithm here coincide with those in the main experiments up to variation due to seeds. On the other hand, the "No (Buffer, Resampling, MCMC)" Algorithm corresponds to CMCD-LV with subtrajectories. + +In all studied cases except the Seeds task, the addition of each component (MCMC, resampling, and buffer) improves performance (we use a logarithmic scale for clarity on the Robot task). In the case of the Seeds task, the performances of all choices are effectively the same (note the small range of the y-axis). In summary, this study shows that none of our components are redundant. + +# A.6.2 REMOVING MCMC COMPONENTS + +Here, we investigate the effect of not using MCMC steps during training. This is an interesting question because, unlike SMC methods with deterministic transitions like CRAFT, where MCMC steps are needed to remove the particle degeneracy caused by resampling steps, our stochastic transitions do this automatically. As such, it is possible to remove MCMC steps from the SCLD training procedure, and we investigate the effect of doing so here, as it offers potentially accelerated training. + +Table 7: ELBOs attained by SCLD when removing MCMC steps during training and evaluation. + +
ELBO (↑)Seeds (26d)Sonar (61d)Credit (25d)Brownian (32d)LGCP (1600d)
SCLD-73.45±0.01-108.17±0.25-504.46±0.091.00±0.18486.77±0.70
SCLD-NoMCMC-73.48±0.03-109.39±1.10-504.72±0.340.82±0.09415.83±19.53
+ +Table 8: Sinkhorn distances attained by SCLD when removing MCMC steps during training and evaluation. + +
Sinkhorn (↓)Funnel (10d)MW54 (5d)Robot1 (10d)Robot4 (10d)GMM40 (50d)MoS (50d)
SCLD134.23±8.390.44±0.060.31±0.040.40±0.013787.73±249.75656.10±88.97
SCLD-NoMCMC147.38±7.840.44±0.050.31±0.040.41±0.013929.52±753.271252.87±183.95
+ +Using the same experimental setting as the main experiments, we compare the effect of omitting SMC steps during training and evaluation in Tables 7 and 8. Unsurprisingly, removing MCMC steps has an adverse effect on performance. However, in many cases, the difference is not too big. In particular, on tasks where a smaller number of 4 subtrajectories have been used (Robot1, Robot4, + +![](images/66232c78c87a6b5e29842f7b4a6fb1b51e1b091bfe9460331008343922785e37.jpg) +Figure 6: Ablation study of the different components of SCLD on four tasks. We sequentially add MCMC steps, resampling, and a prioritized relay buffer to LV-CMCD with subtrajectories (corresponding to the "No (Buffer,Resampling,MCMC)" method) to arrive at our proposed SCLD method. We observe that on most tasks, each of these components improves performance. + +GMM40, MW54), the effect was negligible, as MCMC steps did not feature prominently in the training process in the first place. On the other tasks, where 128 SMC steps have been employed, the impact on performance was larger. However, the performance was still competitive with other approaches, noting that we did not increase the number of gradient steps. In all, using SCLD without MCMC steps is shown to be a viable possibility. It is also plausible that increased noise levels could help compensate for the lack of additional randomness. + +# A.6.3 TIMINGS + +In Table 9, we report the timings on each task for each of the methods in the main table with regards to time taken per gradient step (except SMC, which does not require training), using the same hyperparameters as for the main experiments. We worked in the JAX framework and used jitting, discarding the first iteration (Bradbury et al., 2018). We average across 3 seeds on a single Nvidia RTX4090 GPU for 500 iterations. Dynamical memory allocation via XLA_PYTHONCLIENTAllocator=platform was required for CMCD-KL on GMM40 to fit within the memory limit, resulting in slower runtimes. + +Table 9: Average time per gradient step for all considered methods and tasks. + +
Time (s)BrownianCreditLGCPSeedsSonarFunnelGMM40MW54Robot1Robot4MoS
CMCD-KL0.210.140.390.120.130.140.580.100.240.240.20
CMCD-LV0.341.410.420.130.180.100.140.090.110.120.11
SCLD0.130.151.480.070.110.070.120.070.080.080.09
CRAFT0.060.0040.890.030.040.020.010.020.010.050.04
DDS0.040.030.110.030.030.030.040.030.040.040.03
PIS0.040.030.100.030.030.030.040.030.040.040.03
+ +The dimension of the target, the number of SMC operations, as well as the difficulty of evaluating the target all significantly influence the computation time. It may seem strange that SCLD, with the added complexity of SMC steps, was generally faster than the CMCD variants. This can be attributed to two points. First, SCLD detaches the trajectory due to the use of the off-policy log-variance loss, unlike CMCD-KL, which results in a simplified computation graph, saving both time and memory. We refer to Richter & Berner (2024) for a full discussion on using detaching in the log-variance loss. Due to our use of the subtrajectory-based LV loss, the gradients for each subtrajectory can be computed independently and in parallel, improving speed over CMCD-LV. Please note, however, that timings are highly dependent on implementational details. + +# A.6.4 ESTIMATIONS OF THE NORMALIZING CONSTANT + +When the true normalizing constant $Z$ for a density is known, another benchmark often used to evaluate a sampler is to study how accurately it can estimate $Z$ or $\log Z$ . It is, however, known that for multimodal tasks, methods that achieve good $\log Z$ estimates often do so at the expense of mode collapse. Conversely, methods that avoid mode collapse sometimes yield poor $\log Z$ estimates (Blessing et al., 2024). Indeed, applying (tuned) CRAFT to the GMM40 (50d) task achieves an $\log Z$ estimate of $-3.63$ (the true value is $\log 1 = 0$ ) and is one of the better-performing methods for the task. While this may sound impressive, it is realized that $-3.63 \approx -\log 40$ corresponds to sampling perfectly from exactly 1 of the 40 modes (as evidenced by Figure 7). Thus while CRAFT achieves relatively good estimates of the true $\log Z$ , it performs poorly as a sampler. Likewise, when SCLD is optimized for Sinkhorn distances, it often has worse estimation errors but achieves significantly better sample quality. + +![](images/f0c049e0603b8c2a2fd2c64e431649592dcf3b52312a8fdb51676eaad4d54356.jpg) +Figure 7: CRAFT only samples from one mode of GMM40 (50d). + +Acknowledging this trade-off between $\log Z$ estimation and mode collapse, we present two sets of results for CRAFT, CMCD-KL, CMCD-LV, and SCLD corresponding to the $\log Z$ estimation error when methods are optimized for Sinkhorn distances (named CRAFT-SD, SCLD-SD, CMCD-KL-SD, CMCD-LV-SD) and when methods are optimized for $\log Z$ estimation (named correspondingly). In Table 10, we present errors of normalizing constant estimations on a selection of tasks where true $\log Z$ values are available, averaged over 4 seeds and using the same evaluation protocol as the main experiments. For this experiment, results for DDS and PIS are also taken from Blessing et al. (2024) when available. + +Table 10: log $Z$ estimations for different tasks. + +
Δ log Z (↓)Funnel (10d)MW54 (5d)GMM40 (2d)GMM40 (50d)MoS (50d)
SMC0.19±0.091.45±1.530.08±0.03761.93±21.553.88±1.76
PIS0.92±0.600.36±0.070.27±0.017.12±0.6312.25±0.33
DDS0.19±0.083.34±0.080.01±0.011.74±0.447.95±0.30
CRAFT-SD0.10±0.020.16±0.050.02±0.026295.25±144.710.75±0.19
CRAFT-logZ0.10±0.020.16±0.050.02±0.013.63±0.050.75±0.19
CMCD-KL-SD0.04±0.011.65±0.100.01±0.003.53±0.122.72±0.45
CMCD-KL-logZ0.04±0.011.65±0.100.01±0.003.53±0.122.19±0.36
CMCD-LV-SD0.24±0.100.01±0.010.01±0.001.45±0.353.04±0.41
CMCD-LV-logZ0.18±0.050.01±0.010.00±0.001.45±0.353.04±0.41
SCLD-SD0.09±0.010.14±0.030.02±0.017.10±4.050.05±0.03
SCLD-logZ0.09±0.010.01±0.000.02±0.010.77±0.660.05±0.03
+ +We found that using SMC at evaluation time (with the same configuration as during training) consistently improved $\log Z$ estimate quality for SCLD and consequently used it for all tasks. We maintain the same subtrajectory settings as we did for the main experiments. SCLD significantly outperforms all other methods on the GMM40 (50d) and MoS tasks and is best or a close second on the other tasks. This illustrates that our method can also be adjusted to target better $\log Z$ estimates. + +# A.6.5 THE LEARNED ANNEALING SCHEDULE + +For CMCD-KL, CMCD-LV, and SCLD, we found that using a learned annealing schedule as in (35) is crucial to obtaining good results. We illustrate this in Figure 8 with a case study on SCLD, visualizing the linearly interpolated annealing schedule, i.e., (20) with $\beta(t) = t / T$ , and the learned annealing schedule in (35) for the 2-dimensional GMM40 task. + +![](images/3ad48d6c1f255ea4a8905a98637882441e6d291cabb6dc00f338b102d9bb9e48.jpg) +t=0 + +![](images/8e50bb2030d943831b4f672461d4711649d127ca0d6861708962e44b7d9c4a4d.jpg) + +![](images/609a57818d446c5cf41abd941b093638e2ea500d790aa775ed59e58611ddc1a4.jpg) + +![](images/4c833826b58eacbfac67f4cc1706569f014f35728b9d325d29e1cac4fa793550.jpg) + +![](images/f05e52caee5dbe1ae5e9e4a7a775293370ae7c792766f899f9749a4f49caa1c5.jpg) + +![](images/9a46cc27caabf0e68b7561bafaedb99a7fad46c0ce278b17a96cdc833e5d3399.jpg) +Figure 8: We compare the uniform annealing schedule with the annealing schedule learned by SCLD for $0 \leq t \leq T/2$ . SCLD is able to learn a more gradual annealing schedule, which potentially allows transitions between adjacent densities to be learned more easily. + +![](images/ee3d73567ffd116f0010dd104d61f311cb20f35772da4eb9368c6ff9e6ab836d.jpg) +t=0.125T + +![](images/363fea9197f05636fdcd970959d517f4e58b451ebabe82209b1d31ab95e7b1d7.jpg) +t=0.25T + +![](images/b664c9d4e90065a283311b4b108130cca57c981ec666198666cea967a59babc8.jpg) +t=0.375T + +![](images/52dcf5adb7a52240c4d9e1c274ea02f186dda496dd567bfe717983801b3d5632.jpg) +t=0.5T + +# A.6.6 MEAN FIELD PRIOR FOR SCLD + +While we opt for a prior of the form $\mathcal{N}(0,\sigma^2 I)$ for SCLD in our main experiments, an alternative approach is to initialize it using a diagonal Gaussian trained using Mean Field Variational Inference (MFVI) (Bishop, 2006). We study this design choice experimentally here. + +We use 50000 iterations of MFVI with batch size 2000 and constant learning rate $10^{-3}$ , initializing with $\mathcal{N}(0, I)$ . We retain the same experimental setup and hyperparameter settings as for the main experiments, except for the max diffusion coefficient, where we divide the values from the main experiments by 10. This is because MFVI is mode seeking, and so aims to cover a high probability region of the target distribution tightly, leading to a prior with smaller support. We compare the attained ELBOs in Table 11 and also report results for SCLD-MFVI at initialization (i.e., without training the control), termed "NoTrain". + +Table 11: Performance of SCLD when fitting the diagonal of the prior covariance matrix using MFVI at initialization ("NoTrain") and after training ("SCLD-MFVI"). + +
ELBOs (↑)BrownianCreditLGCPSeedsSonar
NoTrain1.07±0.23-513.70±0.70500.42±0.37-73.48±0.05-114.89±1.35
SCLD1.00±0.18-504.46±0.09486.77±0.70-73.45±0.01-108.17±0.25
SCLD-MFVI1.14±0.05-504.59±0.15500.56±0.12-73.44±0.01-108.93±0.34
+ +Impressively, SCLD often achieves near-state-of-the-art results even without training when initialized with MFVI, such as on the LGCP task. We can attribute this to SCLD being initialized as an SMC sampler with Unadjusted Langevin Annealing (ULA) transition kernels as well as MCMC steps, which, in conjunction with the mode-seeking behavior of MFVI, leads to high ELBO values. SCLD-MFVI attains competitive performances on all tasks. Given that we performed no re-tuning on SCLD-MFVI, it is probable that with more careful setting and hyperparameter choices, even higher ELBOs could be attained. + +However, using MFVI-fitted priors in practice often carries serious drawbacks. In line with the experiments of Blessing et al. (2024), we found that using MFVI priors leads to mode collapse + +(due to the mode-seeking nature of MFVI training restricting the sampling to a subset of the target modes), and thus potentially poor sample quality. We illustrate this in Figure 9 on the GMM40 (50d) target, where we use the same hyperparameters as in the main experiment except for the prior. + +![](images/5a0cfce2626955fad4e1ca3607cdb1b13faed472c1a0ae868decb0b713846b69.jpg) +Figure 9: The samples drawn by SCLD when an MFVI-fitted prior is used. MFVI obtains a prior density that covers exactly one mode of the GMM40 distribution. As such, SCLD is unable to discover the other modes and experiences complete mode collapse. This is in contrast to Figure 2 where SCLD samples are visually indistinguishable from the target density. + +# A.6.7 COMPARISON TO PDDS + +In this section, we empirically compare the PDDS and SCLD methods. We employ the exact experimental methodology of Phillips et al. (2024). In particular, we train for 20000 gradient steps, refreshing the model every 500 steps. We employed 50000 gradient steps to train the mean field prior. We note that this corresponds to a significantly higher iteration budget than was allocated to SCLD. In line with the findings of Phillips et al. (2024), we found that sweeping over the prior scale as opposed to using a variational approximation significantly degraded performance on all tasks (and indeed on several tasks, such as Robot and GMM40 could not train at all). One reason for the degraded performance might be that PPDS is unable to further optimize the prior during training (as is done in SCLD). We thus opt to use variational approximations (by mean field Gaussians) to initialize the prior for all tasks. Benchmarking was done exactly as in the main experiments, and we analyzed the performance of PDDS with and without MCMC steps. + +For all tasks present in the benchmark of Phillips et al. (2024) (including the Gaussian mixture tasks), we used the pre-tuned MCMC step sizes. For the other tasks, we chose a linearly interpolated step size schedule from $t = 0$ to $t = T$ where step sizes at times 0 and $T$ are taken from the grid [0.1, 0.3, 1, 3, 10] since the method for tuning MCMC step sizes was not specified. We select the best parameters directly based on the target metric and present the results in Tables 12 and 13. + +Table 12: Comparison of SCLD against PDDS (Phillips et al., 2024) in terms of ELBOs. + +
ELBOs (↑)BrownianCreditLGCPSeedsSonar
PDDS1.12±0.23-502.80±0.72499.35±0.65-73.48±0.21-108.61±0.06
PDDS-MCMC1.04±0.04-502.90±0.28499.83±0.08-73.47±0.19-108.67±0.04
SCLD (ours)1.00±0.18-504.46±0.09486.77±0.70-73.45±0.01-108.17±0.25
SCLD-MFVI (ours)1.14±0.05-504.59±0.15500.56±0.12-73.44±0.01-108.93±0.34
+ +Table 13: Comparison of SCLD against PDDS (Phillips et al., 2024) in terms of Sinkhorn distances. + +
Sinkhorn (↓)FunnelGMM40MW54Robot1Robot4MoS
PDDS145.81±13.2842157.92±346.211.28±0.183.36±0.083.09±0.163119.83±98.64
PDDS-MCMC151.02±28.0042157.92±346.211.07±0.253.35±0.083.08±0.143108.75±98.61
SCLD (ours)134.23±8.393787.73±249.750.44±0.060.31±0.040.40±0.01656.10±88.97
+ +PDDS attains comparable ELBOs to SCLD on the Bayesian statistics tasks. This is due to both methods being initialized as SMC samplers with a prior obtained by the same variational approximation + +(for SCLD-MFVI). We also observed, in line with the findings of Phillips et al. (2024) and similar to Appendix A.6.6, that often relatively little training is required to achieve optimal performance, so the gap in performance between the initial, untrained SMC scheme and the trained sampler is small. + +However, PDDS consistently presents significantly worse Sinkhorn distances (on all tasks where this is available) than SCLD. This is due to the reliance of PDDS on using an MFVI prior, which, as discussed in Appendix A.6.6, is prone to mode collapse. On the other hand, SCLD is able to operate stably without relying on using the MFVI prior, avoiding mode collapse. + +# A.6.8 COMPARISON WITH ADVANCED SMC SCHEMES + +In the section, we compare SCLD against two advanced SMC schemes implemented in the framework by Cabezas et al. (2024). We consider adaptive tempered SMC, which utilizes the constant-ESS method for choosing the annealing schedule as seen in Buchholz et al. (2021). We term this method SMC-ESS. In line with SCLD, we utilize a single HMC step for the SMC kernel with 10 leapfrog integration steps, and apply the same tuning procedure for HMC step size as we did for our own SMC method. We additionally sweep over the ESS threshold $\alpha \in \{0.3, 0.5, 0.75, 0.9, 0.95, 0.99\}$ . Due to the large search grid, we run 10 seeds per task to mitigate outliers. Unlike SCLD, which uses multinomial resampling (for a fair comparison to our other baselines), we use systematic resampling (see, e.g., Chopin et al. (2020, Chapter 9)) for SMC-ESS, which we found led to best performance. We consider another method from Buchholz et al. (2021), utilizing the full-covariance tuning approach for Independent Rosenbluth Metropolis-Hastings (IRMH) proposals (on top of using adaptive tempered SMC). We use 100 MCMC steps per step and term this method SMC-FC. + +We report results in Tables 2 and 3, using the same evaluation protocol (in particular, using 2000 particles). For reference, we also compare all SMC methods with SCLD in Tables 14 and 15. + +Table 14: Comparison of SCLD against advanced SMC methods (Buchholz et al., 2021) in terms of ELBOs. + +
ELBOs (↑)BrownianCreditLGCPSeedsSonar
SMC-2.21±0.53-589.82±5.72385.75±7.65-74.63±0.14-111.50±0.96
SMC-ESS0.49±0.19-505.57±0.18497.85±0.11-74.07±0.60-109.10±0.17
SMC-FC-1.91±0.04-505.30±0.02-878.10±2.20-74.07±0.02-108.93±0.02
SCLD (ours)1.00±0.18-504.46±0.09486.77±0.70-73.45±0.01-108.17±0.25
+ +Table 15: Comparison of SCLD against advanced SMC methods (Buchholz et al., 2021) in terms of Sinkhorn distances. + +
Sinkhorn (↓)FunnelGMM40MW54Robot1Robot4MoS
SMC149.35±4.7346370.34±137.7920.71±5.3324.02±1.0624.08±0.263297.28±2184.54
SMC-ESS117.48±9.7024240.68±50.521.11±0.151.82±0.502.11±0.311477.04±133.80
SMC-FC211.43±30.0839018.27±159.322.03±0.170.37±0.081.23±0.023200.10±95.35
SCLD (ours)134.23±8.393787.73±249.750.44±0.060.31±0.040.40±0.01656.10±88.97
+ +The full-covariance tuning and the ESS-based scheme for selecting the annealing schedule significantly outperform our baseline implementation of SMC at the expense of longer and variable (possibly unbounded) sampling times. Nevertheless, all considered SMC methods are superseded by SCLD in performance on all but two tasks. While SCLD uses a relatively simple version of SMC for fair comparisons to our baselines, our framework enables the usage of more advanced techniques, such as those used for SMC-ESS and SMC-FC. Thus, we expect that the performance of SCLD can be even further improved. + +# A.6.9 CONVERGENCE OF DIFFERENT METHODS BY ITERATION COUNT + +In Figure 10, we visualize the same data as in Section 3.1 but plotting by the number of elapsed gradient steps. In this perspective, the same conclusions hold that SCLD exhibits superior convergence properties, attaining the best ELBOs on each task for all numbers of gradient steps. Note that CRAFT was not competitive on the Credit task in this perspective. + +![](images/34b122e375da8689ef25f379d0ff465cab4cd911efb5cdda75df36100d4ed4d2.jpg) +Figure 10: The same experiments as in Figure 3 plotted instead by iterations. + +![](images/bb782d1eb9661818b84808d1054c4c698cc91a98a78277ec0dbdab8785fd40dd.jpg) + +![](images/b715e102a3c387decd51b1427915405710c631a73a5e7c30d264476e17333eef.jpg) + +![](images/ebab533d6178f314f4ae32f4cb0ec8e898f04482e70b71c3885542c6414805ec.jpg) + +# A.6.10 KL-BASED TRAINING OF SCLD + +We compare KL and LV-based training of the SCLD algorithm, using the family of Funnel distributions with $d \in \{10, 20, 30, 40, 50\}$ as a case study. We train SCLD using KL and LV losses with 4 and 128 subtrajectories as described in Section 2.3 for 3000 gradient steps using the same hyperparameters and settings (including learning the annealing schedule and prior) as in the $d = 10$ case for the main experiments. In Figure 11, we visualize the ELBOs attained (using the same settings during evaluation as for training) alongside CMCD-KL and CMCD-LV. + +![](images/d52987eec14086f1614b5527be5765fe11c2a6eb353bf7c42992feed21ca07a7.jpg) +Figure 11: ELBOs across Varying Funnel Dimensions for different SCLD-variants + +All methods except SCLD with LV loss and 128 subtrajectories experience some form of performance degradation as dimensions scale. For the LV loss, adding subtrajectories reduces the amount of performance degradation. This may be due to SMC steps counteracting increased dimensionality by focusing computation on high-density regions. For the KL loss, however, increasing the number of subtrajectories resulted in worse performance, especially as the dimension increased. Indeed, SCLD-KL with 128 subtrajectories scales the most poorly of the methods tried as $d$ increases. As discussed in Section 2.3, this may be due to the use of importance sampling to estimate the loss function. Indeed, a set of importance weights is required for each subtrajectory to estimate the loss, and thus, using more subtrajectories demands a greater reliance on importance sampling. As the variance of importance sampling can increase significantly with dimension, this may account for the decreased performance of KL-based subtrajectory losses. In summary, this supports the hypothesis that losses avoiding importance sampling, such as the log-variance loss, are more suited to the training of SCLD on higher-dimensional tasks. \ No newline at end of file diff --git a/ICLR/2025/Sequential Controlled Langevin Diffusions/images.zip b/ICLR/2025/Sequential Controlled Langevin Diffusions/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..73f225d7f301baf7c97c170e31e84d9b4d0c0864 --- /dev/null +++ b/ICLR/2025/Sequential Controlled Langevin Diffusions/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d039bc212808993384b61cf0cc64d0a82b1a21290710326ef6dbef2542da53de +size 1631897 diff --git a/ICLR/2025/Sequential Controlled Langevin Diffusions/layout.json b/ICLR/2025/Sequential Controlled Langevin Diffusions/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..26d93fd84ed4120869271a55564dd6022c0beee3 --- /dev/null +++ b/ICLR/2025/Sequential Controlled Langevin Diffusions/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3e9e14d57ef42299856433e712abdf798b13af80768a9af1dc14c69df5c98ce7 +size 1333723 diff --git a/ICLR/2025/Sequential Stochastic Combinatorial Optimization Using Hierarchal Reinforcement Learning/7c06b6a5-1102-4811-8a1e-71a72ed4c52b_content_list.json b/ICLR/2025/Sequential Stochastic Combinatorial Optimization Using Hierarchal Reinforcement Learning/7c06b6a5-1102-4811-8a1e-71a72ed4c52b_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..5b7b65f578adb643a5fbcf9862cafda6296fa584 --- /dev/null +++ b/ICLR/2025/Sequential Stochastic Combinatorial Optimization Using Hierarchal Reinforcement Learning/7c06b6a5-1102-4811-8a1e-71a72ed4c52b_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f92fa240997ee81f2c031e982c67c9397a1c0c8e3fd36d7cc4d25546e1b9ef2f +size 151129 diff --git a/ICLR/2025/Sequential Stochastic Combinatorial Optimization Using Hierarchal Reinforcement Learning/7c06b6a5-1102-4811-8a1e-71a72ed4c52b_model.json b/ICLR/2025/Sequential Stochastic Combinatorial Optimization Using Hierarchal Reinforcement Learning/7c06b6a5-1102-4811-8a1e-71a72ed4c52b_model.json new file mode 100644 index 0000000000000000000000000000000000000000..46133ab6c4769d4ba006ebb59e28e69b19fee0bb --- /dev/null +++ b/ICLR/2025/Sequential Stochastic Combinatorial Optimization Using Hierarchal Reinforcement Learning/7c06b6a5-1102-4811-8a1e-71a72ed4c52b_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e9481f7bf70388d9dc0f4bfe6421665aedd564d2c94a4923c690c82ab6a4fcae +size 188824 diff --git a/ICLR/2025/Sequential Stochastic Combinatorial Optimization Using Hierarchal Reinforcement Learning/7c06b6a5-1102-4811-8a1e-71a72ed4c52b_origin.pdf b/ICLR/2025/Sequential Stochastic Combinatorial Optimization Using Hierarchal Reinforcement Learning/7c06b6a5-1102-4811-8a1e-71a72ed4c52b_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..c6229007683220189734619c061ff967fd58a838 --- /dev/null +++ b/ICLR/2025/Sequential Stochastic Combinatorial Optimization Using Hierarchal Reinforcement Learning/7c06b6a5-1102-4811-8a1e-71a72ed4c52b_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f26aef6851e27c0834725fdc3ab5a4ee5938180af6352ae56a40d4aab0c3d91b +size 685441 diff --git a/ICLR/2025/Sequential Stochastic Combinatorial Optimization Using Hierarchal Reinforcement Learning/full.md b/ICLR/2025/Sequential Stochastic Combinatorial Optimization Using Hierarchal Reinforcement Learning/full.md new file mode 100644 index 0000000000000000000000000000000000000000..525bde5172e394bcad247253367839a9ecfc1f6f --- /dev/null +++ b/ICLR/2025/Sequential Stochastic Combinatorial Optimization Using Hierarchal Reinforcement Learning/full.md @@ -0,0 +1,699 @@ +# SEQUENTIAL STOCHASTIC COMBINATORIAL OPTIMIZATION USING HIERARCHICAL REINFORCEMENT LEARNING + +Xinsong Feng $^{1}$ , Zihan Yu $^{2}$ , Yanhai Xiong $^{3}$ , Haipeng Chen $^{3}$ + +$^{1}$ UCLA, $^{2}$ The University of Hong Kong, $^{3}$ William & Mary + +xsfeng@ucla.edu,u3634664@connect.hku.hk,{yxiong05,hchen23}@wm.edu + +# ABSTRACT + +Reinforcement learning (RL) has emerged as a promising tool for combinatorial optimization (CO) problems due to its ability to learn fast, effective, and generalizable solutions. Nonetheless, existing works mostly focus on one-shot deterministic CO, while sequential stochastic CO (SSCO) has rarely been studied despite its broad applications such as adaptive influence maximization (IM) and infectious disease intervention. In this paper, we study the SSCO problem where we first decide the budget (e.g., number of seed nodes in adaptive IM) allocation for all time steps, and then select a set of nodes for each time step. The few existing studies on SSCO simplify the problems by assuming a uniformly distributed budget allocation over the time horizon, yielding suboptimal solutions. We propose a generic hierarchical RL (HRL) framework called wake-sleep option (WS-option), a two-layer option-based framework that simultaneously decides adaptive budget allocation on the higher layer and node selection on the lower layer. WS-option starts with a coherent formulation of the two-layer Markov decision processes (MDPs), capturing the interdependencies between the two layers of decisions. Building on this, WS-option employs several innovative designs to balance the model's training stability and computational efficiency, preventing the vicious cyclic interference issue between the two layers. Empirical results show that WS-option exhibits significantly improved effectiveness and generalizability compared to traditional methods. Moreover, the learned model can be generalized to larger graphs, which significantly reduces the overhead of computational resources. + +# 1 INTRODUCTION + +Combinatorial optimization (CO) problems cover a broad spectrum of application domains, such as social networks [45, 2], public health [17, 29], transportation [7], telecommunications [8], and scheduling [40, 55]. Hence, much attention has been drawn from both the theory and application communities toward solving CO problems. Recently, there have been studies using reinforcement learning (RL) to learn generalizable heuristic policies for CO problems on graphs [24, 39, 14, 5, 26, 6]. The RL policy is trained on a set of previously seen training graphs and generalizes to unseen test graphs of similar structure. This policy is usually represented using graph embedding methods such as structure2vec (S2V) [12] and graph convolutional networks (GCNs) [25]. However, most existing studies focus on one-shot deterministic CO, while research on another broad class of CO problems, which contain stochasticity and must be solved sequentially over multiple time steps, remains limited. + +Problem Statement In this paper, we study the sequential stochastic CO (SSCO) problem where we first decide the budget allocation for all the time steps, and then select a combination of nodes for each time step. Given a graph $G = (V, E)$ , where $V$ and $E$ represent the set of vertices and edges on the graph, respectively, the number of time steps $T$ , and the total budget $K$ for selecting nodes, the task is to decide 1) an allocation $K_{1}, K_{2}, \ldots, K_{T}$ of budget over the time horizon, together with 2) a + +sequence of node sets $S_{1}, S_{2}, \ldots, S_{T} \subseteq V$ , such that + +$$ +\underset { \begin{array}{c} K _ {1}, \dots , K _ {T} \\ S _ {1}, \dots , S _ {T} \end{array} } {\text {m a x i m i z e}} \quad \sum_ {t = 1} ^ {T} r _ {t} \left(S _ {t}\right) \tag {1a} +$$ + +$$ +\text {s u b j e c t} \quad \sum_ {t = 1} ^ {T} K _ {t} \leq K, \tag {1b} +$$ + +$$ +\left| S _ {t} \right| \leq K _ {t}, \quad \forall t = 1, \dots , T, \tag {1c} +$$ + +$$ +K _ {t} \in \mathbb {N}, \quad \forall t = 1, \dots , T, \tag {1d} +$$ + +$$ +S _ {t} \subseteq V, \quad \forall t = 1, \dots , T. \tag {1e} +$$ + +Here, $r_t(S_t)$ denotes the reward obtained from the nodes in set $S_t$ at the time step $t$ . SSCO has a wide range of real-world applications such as resource allocation in wireless communication networks [32], route planning [22], and adaptive influence maximization (IM) [42, 48]. + +As far as we know, there are not many works that address SSCO using RL; two notable examples are adaptive IM in [10] and medical resource allocation for epidemic control in [41]. However, they assume that the budget is evenly allocated across all the time steps (i.e., $K_{t} = K / T$ , $\forall t$ ), which may not be optimal in stochastic environments or when additional information or feedback becomes available over time. These scenarios need adaptive sequential decision-making. For example, in the adaptive IM problem, an even allocation policy cannot adapt to sudden changes and uncertainties, leading to resource shortages at critical times or redundancy at less important times. Additionally, it lacks the flexibility to adjust strategy when more important information becomes available. + +Despite its criticality, solving SSCO is extremely challenging due to the following factors: 1) Combinatorial complexity. The search space grows exponentially as the graph grows, which makes it difficult to find the optimal solution efficiently. 2) Stochasticity. Future states and rewards are uncertain, so the ability to adaptively update the solutions based on the real-time state and stochasticity in the future is required. 3) Sequential decision making. Decisions are interdependent and require sophisticated planning that considers both current and future consequences. 4) Scalability. The methods need to have the ability to be generalized to large-scale problems in the real world. + +While traditional RL struggles with these challenges, hierarchical RL (HRL) presents a viable solution by decomposing complex tasks into simpler sub-tasks to improve learning efficiency. Several works have contributed to the development of HRL. The option framework models temporally extended actions, allowing agents to learn at different levels of abstraction [47]. Multi-level approaches use higher-level managers to set tasks for sub-managers [13]. Data-efficient methods leverage offline experiences for training [38]. Combining HRL with intrinsic motivation [27] and hindsight experience replay (HER) [1] further enhances learning. + +In this paper, we propose an HRL framework, WS-option, for solving SSCO by jointly considering budget allocation and node selection, with a coherent definition of MDPs for both layers. The lower layer is particularly challenging due to the need for explicit definitions of states and rewards. The MDP formulation directly affects the overall performance of the model. Maintaining model stability is crucial due to the interdependence and mutual influence of the two layers. To improve model stability, especially in the higher layer, we adopt MC methods to learn budget allocation, known as the option policy. To ensure faster convergence and stable operation of the lower layer, we use TD methods to learn node selection, known as the intra-option policy [3]. These methods ensure that both layers can run stably and efficiently, avoiding the issue of potential vicious mutual interference. + +Our main contributions are as follows. + +- We are the first to formally summarize and define the generic class of SSCO problems. +- We design a novel HRL algorithm, WS-option, to solve the formulated SSCO, with major novelties in terms of the two-layer MDP formulation, and new wake-sleep training procedures to balance the training stability and efficiency and avoid the potential vicious mutual interference. Our algorithm is a generic framework that applies to a wide range of SSCO problems of the same nature. For completeness, we also provide a brief theoretical analysis of the algorithm's convergence. +- We conduct experiments on two distinct SSCO problem instances – adaptive IM and route planning. The results show that compared to traditional methods, our algorithm exhibits superior performance in solving both SSCO problems. In particular, the algorithm is able to generalize to larger unseen graphs, thus significantly reducing computational overheads for larger-scale SSCO problems. + +# 2 RELATED WORK + +RL for CO RL has been widely used to solve CO problems [35]. Nazari et al. [39] propose a generic RL framework for solving the vehicle routing problem (VRP), outperforming traditional heuristic algorithms. Bello et al. [4] introduce neural combinatorial optimization, combining neural networks and RL to solve the TSP problem. Kool et al. [26] develop an attention-based model using the REINFORCE algorithm, achieving superior results on various CO problems like TSP, VRP, and the Orienteering Problem (OP). Khalil et al. [24] combine RL with graph embedding to construct solutions for CO problems step by step. Chen & Tian [11] present a method where neural networks iteratively improve combinatorial solutions through learned local modifications. Deudon et al. [14] introduce a method where policy gradient techniques are used to train neural networks to develop heuristics for solving the TSP. Emami & Ranka [15] propose Sinkhorn policy gradient methods to learn permutation matrices for CO problems. Cappart et al. [9] combine decision diagrams with deep RL to enhance optimization bounds for combinatorial problems. Lu et al. [34] introduce an iterative approach that leverages REINFORCE to enhance solutions for VRPs. Recent methods have further integrated search algorithms, such as active search [20], Monte Carlo tree search [16], and beam search [28], to enhance the solution qualities of RL algorithms during inference time. While these algorithms show promising results, they typically tackle one-shot deterministic CO problems without sequential decision-making, limiting their effectiveness for more complex scenarios. + +Graph embedding Graph embedding techniques are crucial for RL-based solutions to CO problems, representing graph structures in continuous vector spaces to preserve structural properties, facilitate downstream RL tasks, and generalize to unseen (potentially larger) graphs. Node2Vec [18] uses biased random walks to explore neighborhoods efficiently, which maps nodes to low-dimensional vector spaces while preserving the neighbor structures. Deepwalk [43], which is inspired by language models, uses truncated random walks to obtain local node information and learn potential representations. Significant progress has also been made with graph neural networks (GNN) [44, 58, 53], such as GCN [25], Graph Attention Networks (GAT) [49] and Graph Transformer Networks [57]. Xu et al. [54] evaluate the expressiveness of GNNs, comparing them to the Weisfeiler-Lehman test in capturing graph structures. Li et al. [31] analyze the effectiveness and mechanisms of GCNs in semi-supervised learning. Ying et al. [56] introduce a method to interpret GNNs by identifying the crucial subgraphs and features that influence their predictions. Nonetheless, determining the most beneficial graph embedding technique for RL tasks remains an important research question. + +Hierarchical reinforcement learning HRL introduces a hierarchical structure to RL, decomposing complex tasks into simpler subtasks to improve learning efficiency. The option framework [47] defines HRL with options as temporally extended actions, which enables agents to learn at different levels of temporal abstraction. Dayan & Hinton [13] introduce a multi-level RL approach based on subgoals, where high-level managers set tasks for sub-managers to achieve efficiently. Nachum et al. [38] propose a data-efficient HRL method using off-line experiences to train higher-level and lower-level layers, and the results demonstrate its ability to learn complex behaviors. Bacon et al. [3] develop a method to automatically learn policy, termination function, and intra-option policy in HRL using intra-option policy gradient and termination gradient, without extra rewards or subgoals. Vezhnevets et al. [50] divide agent behavior into two levels: the Manager, which sets goals in a latent space, and the Worker, which executes these goals with primitive actions. Kulkarni et al. [27] combine hierarchical structures and intrinsic motivation to improve learning in complex tasks. Andrychowicz et al. [1] introduce a technique called HER that enhances RL by learning from failures as if they were successes with different goals, and Levy et al. [30] integrate HER with HRL to enhance learning at multiple levels. Despite their success, these methods often do not address the specific challenges of SSCO problems, especially the need to handle sequential, combinatorial state-action spaces, and dynamic environments. Furthermore, they typically do not integrate graph-based representations, which could significantly enhance their effectiveness when dealing with graph-based CO problems. + +# 3 THE WS-OPTION FRAMEWORK + +This section will show how to learn budget allocation and node selection using our proposed WSoption framework. We begin with a brief introduction to the option framework, followed by the architecture used in our approach. Subsequently, we will formulate the MDPs for both hierarchical layers and adopt value-based methods as the backbone RL approach. In particular, to balance training + +stability and computational efficiency, we employ MC methods to learn the Q-function for the higher layer and TD-learning to learn the Q-function for the lower layer. Additionally, it is important to note that our model is trained on different graphs that follow a certain distribution to enhance its generalization ability to unseen, similarly-structured graphs from the same distribution. The network architecture is shown in Appendix C.1. + +# 3.1 PRELIMINARY: THE OPTION FRAMEWORK + +The option framework, proposed by [47], is an implementation of temporal abstraction in RL. It provides a straightforward way to describe temporally extended actions, known as options, which are higher-level actions composed of several primitive actions. Formally, an option $o$ is defined by the tuple $(I,\pi^{II},\beta)$ , where + +- Initiation set $I$ : a set of states where the option can be initialized. We will assume that any state satisfies $s \in I$ in our problems. +- Intra-option policy $\pi^{II}$ : a policy that maps states to actions under a given option, controlling the lower-level actions taken under that option. We use $\pi^{II}$ as the lower-level node selection policy. +- Termination function $\beta$ : a mapping $\beta : S \to [0,1]$ that specifies the probability of terminating the option in a given state, where $S$ is the state space. + +When an agent operates within the option framework, it follows the process: 1) Option selection – the agent selects an option based on its option policy given a state. 2) Option execution – once the option is determined, the agent follows the intra-option policy $\pi^{II}$ until the option terminates. 3) Option termination – when the termination condition is met, the agent terminates the current option and proceeds to the next option selection. + +In our study, we adopt a slightly different approach to defining options. While at the higher layer, the option $o_{t}^{I}$ we select represents the budget $K_{t}$ allocated at the current time step $t$ , we simplify the information representation when passing the option to the lower layer. Specifically, we use option $o_{t}^{II} = 1$ to indicate that the lower layer should continue selecting nodes, and option $o_{t}^{II} = 0$ to indicate that it should stop selecting nodes and interact with the environment. It is important to note that to handle cases where the budget allocated by the higher layer is 0 (i.e., $o_{t}^{I} = o_{t}^{II} = 0$ ), we introduce a null action $a_{t,\emptyset}$ for the lower layer. The null action $a_{t,\emptyset}$ represents directly interacting with the environment and moving to the next time step. In fact, we achieved very good results by introducing this null action. + +# 3.2 HIERARCHICAL MDP FORMULATION + +Here, we define the MDPs for the two layers of our hierarchical model (c.f. Figure 1). For ease of understanding, we will take the adaptive IM problem as a running example. More details of both problems are shown in Appendix C.2 and C.3, respectively. + +![](images/104f8f8a140aaa30d4625a9adcf362260eb015b24a9769bea50ce4f8305ebecf.jpg) +Figure 1: Hierarchical MDPs for SSCO + +# 3.2.1 HIGHER LAYER MDP + +State The state $s^I = (X, g) \in S$ includes two types of information: node features $X$ (e.g., inactive or active in adaptive IM problem) and global information $g$ (e.g., the remaining time steps $T_r$ and the remaining budget $K_r$ ). + +Option The option $o^I$ represents the budget $0 \leq K_t \leq K_r$ allocated to the current time step $t$ . + +State transition The state transition in this layer is stochastic, which is a fundamental characteristic of SSCO problems. Given the current state $s_t^I$ and the action $a_{t}^{II}$ from the lower layer, the state $s_{t + 1}^{I}$ is updated according to the following function: + +$$ +s _ {t + 1} ^ {I} = f \left(s _ {t} ^ {I}, a _ {t} ^ {I I}\right) + \eta \left(s _ {t} ^ {I}, a _ {t} ^ {I I}\right), \tag {2} +$$ + +where $f(s_{t}^{I},a_{t}^{II})$ is a deterministic function that updates the state $s_t^I$ based on the current action $a_{t}^{II}$ , while $\eta (s_t^I,a_t^{II})$ represents the stochastic component, which introduces randomness into the state transition, thereby capturing the stochastic nature of the environment. For example, in the adaptive IM problem, there is no deterministic component. Instead, the entire state transition is governed by the stochastic process $\eta (s_t^I,a_t^{II})$ , which can be interpreted as the "activation process" within this problem. + +Reward The total reward depends on the problem of interest. In adaptive IM, it is the total number of influenced nodes (e.g., active and removed nodes). Then, the immediate reward $r^I$ is the increase in the total reward. + +# 3.2.2 LOWER LAYER MDP + +State The state $s^{II}$ is also defined as $s^{II} = \{X, g\}$ . + +Option The option $o^{II}$ can be either 0 or 1, where "1" represents continuing to select nodes, and "0" represents not selecting any node and interacting with the environment. + +Action Two kinds of actions are defined. Given the current time step $t$ , the action $a_{t,j}^{II}$ is the node selected for a sub time step $j$ (e.g., $o_{t,j}^{II} = 1$ ) or just the null action $a_{t,\emptyset}$ (e.g., $o_{t,j}^{II} = 0$ ). And the $a_{t}^{II}$ is all the nodes selected in the current time step or the null action $a_{t,\emptyset}$ if no nodes are selected. + +State transition The state transition can occur either in a deterministic or stochastic way. If option $o_{t}^{II}$ is 1 and the action is node $v$ , we update the state of node $v$ deterministically (e.g., activating node $v$ ). If option $o$ is 0, the agent interacts with the environment as described in the higher layer MDP. + +Reward The reward in the lower layer significantly affects the convergence of the model. We first define the reward $r_{t,\emptyset}^{II}$ for the null action $a_{t,\emptyset}$ , which means directly interacting with the environment at time step $t$ . $r_{t,\emptyset}^{II}$ depends on the specific problem, and the intuition is to determine the expected reward when moving to the next day if we do not select any node in the current state. For propagation problems, we can choose $r_{t,\emptyset}^{II} = r_t^I -k_{\mathrm{eff}}$ , where $k_{\mathrm{eff}}$ represents the effective number of nodes in action $a_{t}^{II}$ (e.g., number of inactive nodes in $a_{t}^{II}$ ) that can yield actual gain. For problems without a propagation process (e.g., TSP, RP), we can simply set this reward to 0. Next, we define the marginal reward $m_{t,v}$ for node $v$ . We denote the selected nodes in the current sub time step $j$ as $A_{t} = \{a_{t,v_{1}},\dots,a_{t,v_{j - 1}}\}$ . The marginal reward is obtained as follows + +$$ +m _ {t, v} = R _ {t} \left(s _ {t} ^ {I}, A _ {t} \cup \left\{a _ {t, v} \right\}\right) - R _ {t} \left(s _ {t} ^ {I}, A _ {t}\right), \tag {3} +$$ + +where $R_{t}(S,A)$ is the immediate reward from taking action $A$ in state $S$ . In our experiments, this reward is estimated by averaging the results of multiple (typically 10) simulations. As a result, the reward for selecting node $v$ is given by + +$$ +r _ {t, v} ^ {I I} = \frac {m _ {t , v}}{\sum_ {u \in a _ {t} ^ {I I}} m _ {t , u}} \left(r _ {t} ^ {I} - r _ {t, \emptyset} ^ {I I}\right). \tag {4} +$$ + +In this manner, the total reward at each time step for the lower layer will remain consistent with the higher layer, enhancing the model's stability. + +# 3.3 WS-OPTION + +Due to the high interdependencies between the learned Q-values across the two policy layers, along with advantages such as reduced sample complexity, we employ a value-based RL for both layers. In our framework, the policies of both layers are $\epsilon$ -greedy. + +Algorithm 1 WS-option: Overall training +1: Initialize experience buffer $\mathcal{M}_1$ and $\mathcal{M}_2$ for the higher and lower layer, respectively. +2: Initialize Q-networks for both layers. +3: for epoch $i = 1,..,N$ do +4: Sample a Graph $G$ from the distribution $\mathbb{D}$ . +5: for episode $j = 1$ to $M$ do +6: if $i\leq N / 2$ then +7: Set the flag use_fixated_higher_layer to true. +8: else +9: Set flag use_fixated_higher_layer to false. +10: end if +11: Run an episode with the flag use_fixated_higher_layer (see Algorithm 2). +12: Store transitions (see Algorithm 3). +13: end for +14: Sample a sequential minibatch of the most recent transitions from the replay buffer $\mathcal{M}_1$ . +15: Train the higher layer using MC methods with sampled transitions. +16: Sample a random minibatch of transitions from the replay buffer $\mathcal{M}_2$ . +17: Train the lower layer using TD-learning with sampled transitions. +18: end for + +Algorithm 2 WS-option: Run episode +1: Initialize the state $s_1^I$ and temporary storage $\mathcal{T}$ for episode transitions. +2: for step $t = 1$ to $T$ do +3: if use_fixated_higher_layer is True then +4: $o_t^I\gets$ average budget allocation. +5: else +6: $o_t^I\gets \left\{ \begin{array}{ll} \text{randomly selected in the remaining budget, w.p. } \epsilon_1, \\ \arg \max_o q^I (s_t^I,o), \end{array} \right.$ otherwise. +7: end if +8: Initialize the set of selected nodes $a_{t}^{II} = \{\}$ . +9: for $k = 1$ to $o_t^I$ do +10: $s_{t,k}^{II}, o_{t,k}^{II}\gets$ state transition $(s_t^I,o_t^I,a_t^{II})$ +11: $a_{t,k}^{II}\gets \left\{ \begin{array}{ll} \text{randomly select a node from } V\setminus a_{t}^{II}, \text{w.p., } \epsilon_2 \\ \arg \max_a q^{II}(s_{t,k}^{II},o_{t,k}^{II},a) \text{ subject to } a\notin a_{t}^{II}, \text{ otherwise.} \end{array} \right.$ +12: $a_{t}^{II}\gets a_{t}^{II}\cup \{a_{t,k}^{II}\}$ +13: end for +14: Execute action $a_{t}^{II}$ and obtain reward $r_t^I$ and next state $s_{t + 1}^I$ . +15: Store the transition $(s_t^I,o_t^I,a_t^{II},r_t^I,s_{t + 1}^I)$ in the temporary storage $\mathcal{T}$ . +16: Update the current state: $s_t^I\gets s_{t + 1}^I$ . +17: end for + +Moreover, as shown from the formulation of the MDPs for both layers, we can see that the Q-functions of the two layers are highly interdependent. On one hand, the higher-layer option selection will determine feasible action spaces for the lower-layer node selection; on the other hand, the specific lower-layer node selection will affect how good the higher-layer's selected option is. Hence, we observe that, if we simply adopt the commonly used (double) Q-learning framework [51, 36, 37, 19], or more essentially off-policy TD learning [46] for both layers, then the Q-values for both layers, especially the first layer will tend to diverge. This is because of the estimation bias derived from the deep models (see Appendix C.1) and bootstrapping of TD learning. We can see the result in Figure 2(b). To stabilize the training of both layers, while maintaining computational efficiency, we propose + +the following two designs for our training algorithm, i.e., wake-sleep training and layer-wise learning method selection. The pseudocode of the training algorithm is shown in Algorithm 1. During each epoch, a graph is obtained from a certain distribution $\mathbb{D}$ (line 4). We divide all epochs into two stages (lines 6-10), which correspond to the wake-sleep training procedure described in this section. After we run algorithm 2 and 3, we can use the transitions to train both layers (lines 14-16). Note that during the training of the higher layer, transitions are sampled sequentially (line 14). Although the higher-layer policy, based on MC method, is inherently on-policy and does not require stored transitions, we maintain this to ensure consistency across both layers. + +Algorithm 2 shows the process of running episodes. We first get the option (lines 3-6), then choose node one by one (lines 8-13). Subsequently, we run Algorithm 3 (see Appendix B.1) to store transitions for training. Algorithm 3 shows how to store transitions, especially for the lower layer. Since the second layer does not interact with the environment after selecting a single node and suffers from sparse rewards, we first obtain the marginal rewards for each transition state through simulation (lines 5-10). To keep the total reward of the lower layer consistent with the higher layer, we scale all the marginal rewards (lines 12-15), which does not affect the relative $Q$ value of the actions. + +# 3.3.1 WAKE-SLEEP TRAINING + +The primary challenge in HRL lies in ensuring stable training and model convergence. Notably, training both layers together can lead to instability, as the policies of each layer are interdependent and can interfere with one another. To address this issue, we devise a wake-sleep approach to enhance training stability. As we will show in Section 3.3.3, this proposed wake-sleep training procedure is well-aligned with our theoretical analysis. In Figure 2(a), we present the Q value learned by traditional HRL, where both layers are trained simultaneously from the beginning, and our proposed WS-option. Then, we will provide the details of this wake-sleep training procedure. + +In the sleep stage of this training paradigm, the Q-function of the higher layer is initially frozen and an average budget allocation strategy is used instead. While more advanced strategies could be considered, we choose the simplest one to allow the lower layer to approach convergence under the current high-layer policy. The lower layer's Q-function is sufficiently trained along with the average budget allocation strategy in this stage. Meanwhile, the high layer's Q-function will be pre-trained offline using the trajectories of the average strategy. In the subsequent wake stage, both layers are trained online simultaneously, allowing for the fine-tuning and optimization of their interdependent policies, which ultimately lead to convergence. + +# 3.3.2 LAYER-WISE LEARNING METHOD SELECTION + +MC methods provide unbiased estimates by calculating the expected value via a complete trajectory, offering reliable and accurate results when the sample size is sufficient. In contrast, TD methods may reduce the accuracy of the Q estimation if errors occur during the intermediate process, known as error propagation. Additionally, in practice, TD methods often result in the overestimation of Q values. Hence, using MC methods to provide more reliable Q value estimates for the higher layer can enhance the model stability. Our experimental results show that this trick, combined with wake-sleep training, is one of the key components that makes the HRL training successful. Figure 2(b) shows the Q values learned using MC and TD methods. The Q values from TD methods are monotonic, while those from MC methods are concave. + +On the downside, MC methods are usually more data-hungry because they have to wait until the end of a trajectory to get a training sample. Given that the lower-layer Q-learning (which is essentially a subtask that uses RL to solve one-shot CO problems) has been demonstrated to be reliable [24, 39, 14, 5, 26, 6], we choose the off policy TD-learning (Q-learning) framework for the lower-layer Q-function update. TD-learning has a faster convergence speed compared to MC methods. When training in the sleep stage, the rapid feedback of the TD method can help the lower layer converge faster, so that the whole model will be better initialized with more optimized parameters. This in turn will accelerate the co-training in the wake stage. + +# 3.3.3 CONVERGENCE ANALYSIS + +For completeness of our study and to offer intuition for our framework, we present a concise theoretical analysis of the algorithm's convergence. We first discuss the convergence of the intra- + +![](images/1cbd59f4ac61ba19a27fe2017dd76dd93c98dc19231a9fc97beed6f91e26e0b3.jpg) +(a) WS-option vs. traditional HRL + +![](images/060b8b918aecef4b4ccd80528ab06718cc015efa7507bb7de82b378188fd0ffe.jpg) +(b) MC methods vs. TD methods +Figure 2: Q-values learned for the AIM problem $(T = 10, K = 20)$ . + +option policy and give Theorem 1. Then, we show the convergence of the option policy and give the Theorem 2. The proofs are provided in Appendix A.5.1 and Appendix A.5.2, respectively. + +Theorem 1. (Intra-option policy convergence). In our WS-option framework, given any Markov transition $(s_{\tau},o_{\tau},a_{\tau},r_{\tau},s_{\tau +1},o_{\tau +1})$ , the $Q$ -value function $q^{II}(s_{\tau},o_{\tau},a_{\tau})$ converges to the optimal $Q$ -value function $q_{*}^{II}(s_{\tau},o_{\tau},a_{\tau})$ with probability 1, assuming that the higher-layer policy is fixed. + +Theorem 2. (Option policy convergence). In our WS-option framework, given any state-option pair $(s_t, o_t)$ , the $Q$ -value function $q^I(s_t, o_t)$ converges to the optimal $Q$ -value function $q_*^I(s_t, o_t)$ with probability 1, assuming that for any given higher-layer policy, the lower-layer policy always provides the corresponding conditionally optimal response. + +As a result, the convergence of the hierarchical framework is guaranteed by the convergence of both layers. Although the interaction between layers will have some effects, we use the wake-sleep procedure instead. As illustrated in Figure 3, after the sleep stage, we can get an optimal policy $\pi^{II}$ conditioned on the higher layer's policy $\pi^I$ . Notably, even when the higher layer policies differ, the nature of the node selection task leads to lower layer optimal policy $\pi^{II}$ being similar to any conditional optimal policy $\pi^{\prime II}$ . This is analogous to the Stackelberg game setting, where the follower can always give best response. In this case, the convergence of the total framework can be achieved. Notably, our analysis is just limited to the tabular case. + +![](images/dfc9d20a8076b804df49301719eb7af7d7114758ae75e1668d63968545437f00.jpg) +Figure 3: Wake-sleep training procedure + +# 4 EXPERIMENTAL RESULTS + +# 4.1 SSCO PROBLEM INSTANCES + +In this article, we examine two broad classes of problems: the propagation problem (high stochasticity) and the route planning problem (low stochasticity). For the propagation problem, we use an adaptive version of the classic IM problem. For the route planning (RP) problem, we consider a model tailored for travel route planning. Notably, instead of showing the standard deviation of test results, we perform two-sample t-tests to show the effectiveness of our framework in SSCO scenarios. + +# 4.2 COMPARISON WITH BASELINES + +Baselines To evaluate the effectiveness of our approach, we compare it against appropriate baselines for each problem, measuring the cumulative reward obtained by various methods. Each baseline is named in the form of A-B, where A is the higher-layer algorithm, and B is the lower-layer algorithm. For the AIM problem, we use the baselines mentioned in Tong et al. [48]: average policy, static policy, and normal policy at the high level. The static policy divides the time period $T$ into $d$ cycles, allocating the same resources only on the first day of each cycle. The normal policy allocates all resources at the beginning. At the lower level, we use a degree-based greedy strategy and a well-designed score-based strategy. The score for each node $v$ is defined as $s_v = \sum_{u \in \mathcal{N}_{\mathrm{in}}(v)} p(u, v)$ , where $\mathcal{N}_{\mathrm{in}}(v)$ denotes the set of inactive nodes among the neighbors of $v$ , and $p(u, v)$ is the probability that $u$ can successfully activate $v$ . This method takes into account the characteristics of the problem and uses expected values to score each node, showing strong performance in our experiments. For the RP problem, we use genetic algorithms (GA) and greedy algorithms. We train and test on graphs of the same size here. The results are shown in Tables 1-2, where $T$ and $K$ are chosen according to Tong et al. [48]. + +Table 1: Experimental results for AIM, $n = {200}$ . All cases have p-values $\leq {0.05}$ . + +
MethodT,K=10,10T,K=10,20T,K=10,30T,K=20,10
WS-option76.00118.56129.0680.95
average-degree67.92104.54122.5072.18
average-score74.36116.10128.2980.31
normal-degree69.28101.50.34109.3963.47
normal-score75.05111.89118.7870.68
static-degree70.02105.25122.3770.57
static-score74.81118.13128.0171.68
+ +Table 2: Experimental results for RP, $n = {100}$ . All cases have p-values $\leq {0.05}$ . + +
MethodT,K=10,10T,K=10,20T,K=10,30T,K=20,10
WS-option7.4612.8618.577.52
greedy6.2912.0215.686.73
GA6.7911.6515.706.93
+ +As shown in Tables 1-2, our method performs consistently well across various settings. As expected, our method outperforms the baseline methods in the AIM problem, which emphasizes structural information about the graph as well as feedback processing of stochasticity (whether the node is successfully activated or not). In our experiments, we use simple graph neural networks. In fact, employing more advanced graph neural networks could further improve the performance of our algorithm, but graph embedding is not the focus of our study. For the RP, our algorithm also shows advantages. The graph of RP is essentially a fully connected graph, which does not emphasize the structural information of the graph but focuses more on the distance between nodes. Nonetheless, the primary advantage of our algorithm is its ability to be applied to larger graphs without the need for retraining after a single training, which significantly reduces computational overhead compared to traditional algorithms. Additionally, cumulative reward during training for AIM problem is provided in Figure 5 of Appendix D.1. + +# 4.3 ASSESSING THE LEARNED POLICIES + +We now assess the learned budget allocation and node selection policies using the AIM problem. By fixing one layer's policy, we compare the cumulative rewards obtained by only the other layer, enabling us to independently assess the policy of each layer. + +To evaluate the higher layer, we fix the lower layer using its learned policy and vary the budget allocation policy. Conversely, to evaluate the performance of the lower layer, we fix the higher layer using the average budget allocation policy and vary the node selection policy. As shown in Table + +Table 3: Cumulative rewards when varying one layer's policy while the other layer remains fixed. All cases have p-values $\leq 0.05$ . + +
Settinglower layer fixed (using the learned policy)
WS-optionaveragenormalstatic
T,K=10,1076.7971.4575.2774.85
T,K=10,20127.51126.35120.26125.46
Settinghigher layer fixed (using the average policy)
WS-optiondegreescore
T,K=10,1071.4562.5569.15
T,K=10,20126.35118.75125.02
+ +3, our algorithm performs well even when applied to a single layer. Both the node selection and the learned budget allocation strategies yield better results compared to the baseline approach. The learned budget allocation policy is showed in Appendix D.2, Figures 6 to 8. + +# 4.4 GENERALIZATION TO LARGER GRAPHS + +Most excitingly, our algorithm generalizes well to larger graphs. This means that models trained on small graphs can be effectively applied to larger ones. The reason for this generalization ability lies in the framework we use, which does not include any parameters related to graph size or number of nodes. This allows us to use the same parameters for graphs of different sizes. + +Table 4: AIM: Generalization to larger graphs. All cases have p-values $\leq {0.05}$ . + +
2004007001000
WS-option120.88176.13204.87221.16
average-degree110.18144.93155.85167.58
average-score119.80158.98165.24176.31
normal-degree103.22152.46186.01210.57
normal-score106.47166.45199.41220.81
static-degree109.62155.08178.66198.44
static-score118.86171.91188.44204.16
+ +We train the model on graphs with 50-100 nodes with $T = 10$ , $K = 20$ . Table 4 and Table 7 (see Appendix D.3) present the results of our tests on different graph sizes. As shown, even though the model was trained on small graphs, it still exhibits excellent performance on larger graphs. This result demonstrates that our algorithm has good scalability and generalization ability to effectively deal with large-scale graph structure problems. + +# 5 CONCLUSION + +We propose an option-based HRL framework for solving complex SSCO problems. The core of our approach is to use the wake-sleep training procedure and layer-wise learning method selection to make the system more stable without interfering with each other, as well as to facilitate our learning process by giving a clear definition of MDPs of two layers. Through extensive experimental evaluations, we demonstrate the strong performance of our algorithm in solving the SSCO problem, its ability to learn effective budget allocation and node selection policies, and its strong generalization to larger graphs. However, a notable limitation of our algorithm is that each new problem needs a new graph embedding technique, which adds complexity to the framework's implementation across different scenarios. We leave the investigation of model-agnostic graph embedding techniques for RL-based solutions to SSCO as future work, potentially borrowing ideas of recent advancements on graph foundation models [33]. + +# ACKNOWLEDGEMENTS + +This research was partially supported by the National Science Foundation under IIS-2348405. The authors acknowledge William & Mary Research Computing for providing computational resources and/or technical support that have contributed to the results reported within this paper. + +# REFERENCES + +[1] Marcin Andrychowicz, Filip Wolski, Alex Ray, Jonas Schneider, Rachel Fong, Peter Welinder, Bob McGrew, Josh Tobin, OpenAI Pieter Abbeel, and Wojciech Zaremba. Hindsight experience replay. Advances in Neural Information Processing Systems, 30, 2017. +[2] Maria Chiara Angelini and Federico Ricci-Tersenghi. Modern graph neural networks do worse than classical greedy algorithms in solving combinatorial optimization problems like maximum independent set. Nature Machine Intelligence, 5(1):29-31, 2023. +[3] Pierre-Luc Bacon, Jean Harb, and Doina Precup. The option-critic architecture. In Proceedings of the AAAI conference on Artificial Intelligence, volume 31, 2017. +[4] Irwan Bello, Hieu Pham, Quoc V Le, Mohammad Norouzi, and Samy Bengio. Neural combinatorial optimization with reinforcement learning. arXiv preprint arXiv:1611.09940, 2016. +[5] Yoshua Bengio, Andrea Lodi, and Antoine Prouvost. Machine learning for combinatorial optimization: A methodological tour d'horizon. European Journal of Operational Research, 2020. +[6] Federico Berto, Chuanbo Hua, Junyoung Park, Minsu Kim, Hyeonah Kim, Jiwoo Son, Haeyeon Kim, Jouungho Kim, and Jinkyoo Park. Rl4co: an extensive reinforcement learning for combinatorial optimization benchmark. arXiv preprint arXiv:2306.17100, 2023. +[7] Valentina Cacchiani. Models and algorithms for combinatorial optimization problems arising in railway applications. 4OR, 7:109-112, 2009. +[8] Buyang Cao, Minghe Sun, and Charles Macleod. Applying gis and combinatorial optimization to fiber deployment plans. Journal of Heuristics, 5:385-402, 1999. +[9] Quentin Cappart, Emmanuel Goutierre, David Bergman, and Louis-Martin Rousseau. Improving optimization bounds using machine learning: Decision diagrams meet deep reinforcement learning. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pp. 1443-1451, 2019. +[10] Haipeng Chen, Wei Qiu, Han-Ching Ou, Bo An, and Milind Tambe. Contingency-aware influence maximization: A reinforcement learning approach. In Uncertainty in Artificial Intelligence, pp. 1535–1545. PMLR, 2021. +[11] Xinyun Chen and Yuandong Tian. Learning to perform local rewriting for combinatorial optimization. Advances in Neural Information Processing Systems, 32, 2019. +[12] Hanjun Dai, Bo Dai, and Le Song. Discriminative embeddings of latent variable models for structured data. In International Conference on Machine Learning, pp. 2702-2711. PMLR, 2016. +[13] Peter Dayan and Geoffrey E Hinton. Feudal reinforcement learning. Advances in Neural Information Processing Systems, 5, 1992. +[14] Michel Deudon, Pierre Cournut, Alexandre Lacoste, Yossiri Adulyasak, and Louis-Martin Rousseau. Learning heuristics for the tsp by policy gradient. In *Integration of Constraint Programming*, Artificial Intelligence, and Operations Research: 15th International Conference, CPAIOR 2018, Delft, The Netherlands, June 26–29, 2018, Proceedings 15, pp. 170–181. Springer, 2018. +[15] Patrick Emami and S. Ranka. Learning Permutations with Sinkhorn Policy Gradient. ArXiv, abs/1805.07010, 2018. + +[16] Zhang-Hua Fu, Kai-Bin Qiu, and Hongyuan Zha. Generalize a small pre-trained model to arbitrarily large tsp instances. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 35, pp. 7474-7482, 2021. +[17] Ganga Gireesan, Nisha Pillai, Michael J Rothrock, Bindu Nanduri, Zhiqian Chen, and Mahalingam Ramkumar. Deep sensitivity analysis for objective-oriented combinatorial optimization. arXiv preprint arXiv:2403.00016, 2024. +[18] Aditya Grover and Jure Leskovec. node2vec: Scalable feature learning for networks. In Proceedings of the 22nd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, pp. 855-864, 2016. +[19] Hado Hasselt. Double q-learning. Advances in Neural Information Processing Systems, 23, 2010. +[20] André Hottung, Yeong-Dae Kwon, and Kevin Tierney. Efficient active search for combinatorial optimization problems. In International Conference on Learning Representations, 2021. +[21] Tommi Jaakkola, Michael Jordan, and Satinder Singh. Convergence of stochastic iterative dynamic programming algorithms. Advances in neural information processing systems, 6, 1993. +[22] Waldy Joe and Hoong Chuin Lau. Deep reinforcement learning approach to solve dynamic vehicle routing problem with stochastic customers. In Proceedings of the International Vonference on Automated Planning and Scheduling, volume 30, pp. 394-402, 2020. +[23] David Kempe, Jon Kleinberg, and Éva Tardos. Maximizing the spread of influence through a social network. In Proceedings of the ninth ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, pp. 137-146, 2003. +[24] Elias Khalil, Hanjun Dai, Yuyu Zhang, Bistra Dilkina, and Le Song. Learning combinatorial optimization algorithms over graphs. Advances in Neural Information Processing Systems, 30, 2017. +[25] Thomas N Kipf and Max Welling. Semi-supervised classification with graph convolutional networks. In International Conference on Learning Representations, 2016. +[26] Wouter Kool, Herke van Hoof, and Max Welling. Attention, learn to solve routing problems! In International Conference on Learning Representations, 2018. +[27] Tejas D Kulkarni, Karthik Narasimhan, Ardavan Saeedi, and Josh Tenenbaum. Hierarchical deep reinforcement learning: Integrating temporal abstraction and intrinsic motivation. Advances in Neural Information Processing Systems, 29, 2016. +[28] Yeong-Dae Kwon, Jinho Choo, Byoungjip Kim, Iljoo Yoon, Youngjune Gwon, and Seungjai Min. Pomo: Policy optimization with multiple optima for reinforcement learning. Advances in Neural Information Processing Systems, 33:21188-21198, 2020. +[29] Changhun Lee, Soohyeok Kim, Sehwa Jeong, Chiehyeon Lim, Jayun Kim, Yeji Kim, and Minyoung Jung. Mind dataset for diet planning and dietary healthcare with machine learning: dataset creation using combinatorial optimization and controllable generation with domain experts. In Thirty-fifth Conference on Neural Information Processing Systems Datasets and Benchmarks Track (Round 2), 2021. +[30] Andrew Levy, George Konidaris, Robert Platt, and Kate Saenko. Learning multi-level hierarchies with hindsight. In International Conference on Learning Representations, 2018. +[31] Qimai Li, Zhichao Han, and Xiao-Ming Wu. Deeper Insights Into Graph Convolutional Networks for Semi-Supervised Learning. In AAAI Conference on Artificial Intelligence (AAAI), pp. 3538-3545, 2018. +[32] Le Liang, Hao Ye, Guanding Yu, and Geoffrey Ye Li. Deep-learning-based wireless resource allocation with application to vehicular networks. Proceedings of the IEEE, 108(2):341-356, 2019. + +[33] Jiawei Liu, Cheng Yang, Zhiyuan Lu, Junze Chen, Yibo Li, Mengmei Zhang, Ting Bai, Yuan Fang, Lichao Sun, Philip S Yu, et al. Towards graph foundation models: A survey and beyond. arXiv preprint arXiv:2310.11829, 2023. +[34] Hao Lu, Xingwen Zhang, and Shuang Yang. A learning-based iterative method for solving vehicle routing problems. In International Conference on Learning Representations, 2019. +[35] Nina Mazyavkina, Sergey Sviridov, Sergei Ivanov, and Evgeny Burnaev. Reinforcement learning for combinatorial optimization: A survey. Computers & Operations Research, 134:105400, 2021. +[36] Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Alex Graves, Ioannis Antonoglou, Daan Wierstra, and Martin Riedmiller. Playing atari with deep reinforcement learning. arXiv preprint arXiv:1312.5602, 2013. +[37] Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Andrei A Rusu, Joel Veness, Marc G Bellemare, Alex Graves, Martin Riedmiller, Andreas K Fidjeland, Georg Ostrovski, et al. Human-level control through deep reinforcement learning. Nature, 2015. +[38] Ofir Nachum, Shixiang Shane Gu, Honglak Lee, and Sergey Levine. Data-efficient hierarchical reinforcement learning. Advances in Neural Information Processing Systems, 31, 2018. +[39] Mohammadreza Nazari, Afshin Oroojlooy, Lawrence Snyder, and Martin Takác. Reinforcement learning for solving the vehicle routing problem. Advances in Neural Information Processing Systems, 31, 2018. +[40] Joel Oren, Chana Ross, Maksym Lefarov, Felix Richter, Ayal Taitler, Zohar Feldman, Dotan Di Castro, and Christian Daniel. Solo: search online, learn offline for combinatorial optimization problems. In Proceedings of the International Symposium on Combinatorial Search, volume 12, pp. 97-105, 2021. +[41] Han-Ching Ou, Haipeng Chen, Shahin Jabbari, and Milind Tambe. Active screening for recurrent diseases: A reinforcement learning approach. In Proceedings of the 20th International Conference on Autonomous Agents and MultiAgent Systems, pp. 992-1000, 2021. +[42] Binghui Peng and Wei Chen. Adaptive influence maximization with myopic feedback. Advances in Neural Information Processing Systems, 32, 2019. +[43] Bryan Perozzi, Rami Al-Rfou, and Steven Skiena. 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. +[44] F. Scarselli, M. Gori, Ah Chung Tsoi, M. Hagenbuchner, and G. Monfardini. The Graph Neural Network Model. IEEE Transactions on Neural Networks, 20(1):61-80, 2009. +[45] Martin JA Schuetz, J Kyle Brubaker, and Helmut G Katzgraber. Combinatorial optimization with physics-inspired graph neural networks. Nature Machine Intelligence, 4(4):367-377, 2022. +[46] Richard S Sutton. Learning to predict by the methods of temporal differences. Machine Learning, 3:9-44, 1988. +[47] Richard S Sutton, Doina Precup, and Satinder Singh. Between mdps and semi-mdps: A framework for temporal abstraction in reinforcement learning. Artificial Intelligence, 112(1-2): 181-211, 1999. +[48] Guangmo Tong, Ruiqi Wang, Zheng Dong, and Xiang Li. Time-constrained adaptive influence maximization. IEEE Transactions on Computational Social Systems, 8(1):33-44, 2020. +[49] Petar Velicković, Guillem Cucurull, Arantxa Casanova, Adriana Romero, Pietro Liò, and Yoshua Bengio. Graph attention networks. In International Conference on Learning Representations, 2018. +[50] Alexander Sasha Vezhnevets, Simon Osindero, Tom Schaul, Nicolas Heess, Max Jaderberg, David Silver, and Koray Kavukcuoglu. Feudal networks for hierarchical reinforcement learning. In International Conference on Machine Learning, pp. 3540-3549. PMLR, 2017. + +[51] Christopher JCH Watkins and Peter Dayan. Q-learning. Machine Learning, 8:279-292, 1992. +[52] Zheng Wen, Doina Precup, Morteza Ibrahimi, Andre Barreto, Benjamin Van Roy, and Satinder Singh. On efficiency in hierarchical reinforcement learning. Advances in Neural Information Processing Systems, 33:6708-6718, 2020. +[53] Zonghan Wu, Shirui Pan, Fengwen Chen, Guodong Long, Chengqi Zhang, and Philip S. Yu. A Comprehensive Survey on Graph Neural Networks. IEEE Transactions on Neural Networks and Learning Systems, 32(1):4-24, 2021. +[54] Keyulu Xu, Weihua Hu, Jure Leskovec, and Stefanie Jegelka. How powerful are graph neural networks? arXiv preprint arXiv:1810.00826, 2018. +[55] Jiaqi Yin and Cunxi Yu. Accelerating Exact Combinatorial Optimization via RL-based Initialization - A Case Study in Scheduling. In 2023 IEEE/ACM International Conference on Computer Aided Design (ICCAD). IEEE, 2023. +[56] Zhitao Ying, Dylan Bourgeois, Jiaxuan You, Marinka Zitnik, and Jure Leskovec. Gnnexplainer: Generating explanations for graph neural networks. Advances in Neural Information Processing Systems, 32, 2019. +[57] Seongjun Yun, Minbyul Jeong, Raehyun Kim, Jaewoo Kang, and Hyunwoo J Kim. Graph transformer networks. Advances in Neural Information Processing Systems, 32, 2019. +[58] Jie Zhou, Ganqu Cui, Shengding Hu, Zhengyan Zhang, Cheng Yang, Zhiyuan Liu, Lifeng Wang, Changcheng Li, and Maosong Sun. Graph neural networks: A review of methods and applications. AI Open, 1:57-81, 2020. + +# CONTENTS + +1 Introduction 1 +2 Related work 3 + +3 The WS-option framework 3 + +3.1 Preliminary: the option framework 4 +3.2 Hierarchical MDP formulation 4 + +3.2.1 Higher layer MDP 5 +3.2.2 Lower layer MDP 5 + +3.3 WS-option 6 + +3.3.1 Wake-sleep training 7 +3.3.2 Layer-wise learning method selection 7 +3.3.3 Convergence analysis 7 + +4 Experimental results 8 + +4.1SSCO problem instances 8 +4.2 Comparison with baselines 9 +4.3 Assessing the learned policies 9 +4.4 Generalization to larger graphs 10 + +5 Conclusion 10 + +A Theoretical Insights 17 + +A.1 Hierarchical Learning for Bi-Level Optimization 17 +A.2 Intuition behind Wake-Sleep Option Framework 17 +A.3 Simplification of Options in the Lower Layer 18 + +A.3.1 Why Simplify Options? 18 +A.3.2 Justification of Budget Irrelevance 18 + +A.4 Lower-Layer Reward Design 18 + +A.4.1 Challenges in Lower-Layer Reward Design 18 +A.4.2 Normalization of Marginal Reward 19 + +A.5 Convergence Analysis 19 + +A.5.1 Proof of Theorem 1 19 +A.5.2 Proof of Theorem 2 20 +A.5.3 Interaction and Convergence of Hierarchical Layers 20 + +B Algorithm Details 21 + +B.1 Algorithm 3 21 + +# C Implementation Details 21 + +C.1 Network architecture 21 +C.2 Adaptive influence maximization (AIM) 22 +C.3 Route planning (RP) 23 +C.4 Experiment hyper-parameter 24 +C.5 Using T-Test for Evaluation 24 + +# D Additional Results 24 + +D.1 Cumulative reward 24 +D.2 Resource allocation 24 +D.3 Generalization to larger graphs 26 +D.4 Evaluation on the Real-World Data 26 +D.5 Ablation Study for Sleep Stage with Different Training Time 26 +D.6 Ablation Study for Simplified Option in the Lower Layer 27 + +# A THEORETICAL INSIGHTS + +# A.1 HIERARCHICAL LEARNING FOR BI-LEVEL OPTIMIZATION + +Based on the problem formulation in equation 1, we provide a high-level insight into the nature of this problem, which motivates the use of HRL. Specifically, the SSCO problem can be reformulated as a bi-level optimization problem: + +$$ +\max _ {\pi^ {h}} \quad J \left(\pi^ {I}, \pi^ {I I *} \left(\pi^ {I}\right)\right) \tag {5} +$$ + +$$ +\text {s u b j e c t} \quad \pi^ {I I *} (\pi^ {I}) \in \arg \max _ {\pi^ {I}} J (\pi^ {I}, \pi^ {I I}) \tag {6} +$$ + +where $J = \sum_{t=1}^{T} r_t(S_t)$ , $\pi^I = \{K_t\}$ , and $\pi^{II} = \{S_t\}$ . Here, $\pi^I$ is constrained by equation 1b, and $\pi^{II}$ satisfies the constraints in equation 1c. + +The formulation highlights that the SSCO problem inherently exhibits a bi-level optimization structure. The higher-level policy $\pi^I$ determines the budget allocation strategy (e.g., $\{K_t\}$ ), while the lower-level policy $\pi^{II}$ selects the corresponding subsets (e.g., $\{S_t\}$ ) based on the higher-level decisions. + +Given this hierarchical dependency, it is natural and intuitive to employ a hierarchical learning algorithm such as HRL to address such problems effectively. + +In contrast, traditional single-agent RL methods struggle with this bi-level optimization problem due to the following limitations: + +- Hierarchical Dependency: Single-agent RL lacks the structure to handle the interdependent objective, as the lower-level policy $\pi^{II}$ directly depends on higher-level decisions $\pi^I$ . +- Exploration Efficiency: HRL separates exploration across two tractable levels, improving learning efficiency compared to single-agent RL's flat exploration approach, which is one of the HRL's greatest advantages [52]. +- Scalability and Interpretability: Optimizing the joint action space of both levels in single-agent RL is computationally intractable. HRL, by decoupling the problem into manageable subproblems, offers a scalable, interpretable, and modular framework for solving complex hierarchical tasks. + +# A.2 INTUITION BEHIND WAKE-SLEEP OPTION FRAMEWORK + +The core idea for solving this bi-level optimization problem is to decompose it into two separate single-level optimization problems. + +When the lower layer provides a conditionally optimal solution, denoted as $\pi^{II*}(\pi^I)$ , the bi-level problem reduces to a single-layer problem, which corresponds to the objective defined in equation 5. In this context, the task is just to find the optimal policy for the higher layer. Conversely, when the higher-layer policy is fixed, the problem becomes solving the sub-optimization objective in equation 6, which is to find the corresponding conditionally optimal lower-layer policy. Building on this decomposition, the framework iteratively refines the higher-layer policy by alternating between the two optimization processes. Specifically, a higher-layer policy is first provided, and the corresponding conditionally optimal lower-layer policy is determined. This iterative procedure continues until the global optimal solution is achieved. + +However, in the context of the SSCO problem, the role of lower layer is to perform node selection, while the higher layer only adjusts the termination condition. Due to the nature of this task, we claim that the conditionally optimal lower-layer policy remains similar across different higher-layer policies $\pi^I$ . Given this, the wake-sleep procedure is employed. During the sleep stage, the lower layer determines a near-optimal policy. Subsequently, the two layers are trained jointly during the wake stage. Since the lower layer has already converged to a close-to-optimal policy, the joint training further refines both the higher-layer policy and the lower-layer policy, ensuring that the global optimal solution is achieved. + +# A.3 SIMPLIFICATION OF OPTIONS IN THE LOWER LAYER + +In this section, we justify our simplification of options and provide a deeper understanding of the option framework within our HRL approach. First, we revisit the definition of an option $o$ in 3.1. In the traditional option framework, an option $o$ is defined as a tuple $(I,\pi^{II},\beta)$ , where: + +- $I$ is the initiation set, which specify the states where the option can be initialized. +- $\pi^{II}$ is the lower-policy that the agent follows while the option is being executed. +- $\beta$ is the termination condition that determines when the option should terminate. + +Options allow the agent to execute temporally extended actions, thereby enabling more efficient exploration and decision-making by abstracting lower-level actions into higher-level policies. + +# A.3.1 WHY SIMPLIFY OPTIONS? + +In our specific bi-level optimization problem, the primary role of the option in the lower layer is to determine when the lower-level policy $\pi^{II}$ should terminate its node selection process. Specifically, the higher-level budget allocation $K_{t}$ implicitly decides the number of nodes the lower layer should select before terminating. Given this context, we simplify options due to the following reasons. + +Redundant Information and Enhanced Interpretability The numerical value of the budget $K_{t}$ does not provide additional useful information beyond determining the number of node selections. Therefore, conveying the exact budget value to the lower layer is unnecessary and does not contribute to the termination decision. By representing options as binary indicators, we clarify whether the lower layer should continue or terminate, enhancing the interpretability of the policy. + +Improved Learning Efficiency Reducing the option to a binary indicator allows the lower layer to focus solely on a straightforward termination condition, without needing to interpret specific budget values. This simplification minimizes the complexity of the learning task, leading to faster convergence and more stable learning processes. + +Therefore, we simplify the option passed to the lower layer to a binary indicator: + +- $o_{t}^{II} = 1$ : Indicates that the lower layer should continue selecting nodes. +- $o_{t}^{II} = 0$ : Indicates that the lower layer should stop selecting nodes and interact with the environment. + +# A.3.2 JUSTIFICATION OF BUDGET IRRELEVANCE + +It is important to note that the specific numerical value of the budget $K_{t}$ does not inherently affect the termination condition beyond determining the number of node selections. The budget serves as a constraint that limits the range of the lower layer's actions but does not need to be explicitly taken as part of the option. By abstracting the budget into a binary termination signal, we retain the essential functionality required for effective decision-making without introducing additional complexity. + +Overall, this design choice strikes a balance between simplicity and functionality, leveraging the hierarchical structure of our problem to enhance learning efficiency and policy interpretability. + +# A.4 LOWER-LAYER REWARD DESIGN + +The reward structure in the lower layer is a critical component of the WS-option framework, as it directly influences both the stability and convergence of the model. Proper design of the reward ensures that the hierarchical optimization aligns seamlessly across layers, mitigating potential instability caused by sparse or inconsistent feedback signals. + +# A.4.1 CHALLENGES IN LOWER-LAYER REWARD DESIGN + +The task of the lower layer is to select nodes based on the budget allocated by the higher layer. However, if the lower layer were to select all $K_{t}$ nodes in a single step, the size of the action + +space would grow combinatorially as $\binom{N}{K_t}$ , where $N$ is the total number of (available) nodes. This combinatorial explosion makes the optimization process computationally infeasible for large $N$ and $K_{t}$ . Therefore, we adopt a sequential selection approach where the lower layer selects one node at a time and repeat this process for $K_{t}$ times. This strategy effectively reduces the action space size from $\binom{N}{K_t}$ to $N$ per selection step, significantly enhancing the tractability of the optimization problem. + +However, this sequential approach introduces a new challenge: sparse rewards. Specifically, the environment only provides feedback after the final node in the sequence has been selected, resulting in delayed and aggregate reward signals. Such delayed feedback makes it difficult for the model to identify the contribution of individual node selections to the overall reward. + +# A.4.2 NORMALIZATION OF MARGINAL REWARD + +We normalize marginal rewards to ensure that the total reward of the lower layer for each time step $t$ is the same as the reward of the higher layer, which is + +$$ +\sum_ {u \in a _ {t} ^ {I I}} r _ {t, u} ^ {I I} + r _ {t, \emptyset} ^ {I I} = r _ {t} ^ {I} = R \left(s _ {t} ^ {I}, o _ {t} ^ {I}, a _ {t} ^ {I I}\right). \tag {7} +$$ + +At each time step, the reward $R(s_{t}^{I},o_{t}^{I},a_{t}^{II})$ is determined jointly by both the higher-layer option $o_{t}^{I}$ and the lower-layer action $a_{t}^{II}$ . Since both layers share the same reward and objective, it is essential that the rewards remain aligned. + +When the lower-layer actions are decomposed into sequential sub-actions (e.g., selecting one node at a time), the individual rewards for each sub-action must sum up to the total reward $R(s_t^I, o_t^I, a_t^{II})$ . Without normalization, the reward distribution across these sub-actions could deviate, leading to inconsistencies between the lower layer's objective and the higher layer's global reward signal. As a result, by normalizing the marginal reward, we ensure: 1) reward consistency. The total reward for the lower layer matches the original reward defined by the hierarchical framework, maintaining coherence between the two layers; and then 2) objective alignment. Both the higher layer and lower layer optimize the same objective, preserving the shared purpose of achieving the overall framework's goals. + +# A.5 CONVERGENCE ANALYSIS + +# A.5.1 PROOF OF THEOREM 1 + +Theorem. (Intra-option policy convergence). In our WS-option framework, given any Markov transition $(s_{\tau},o_{\tau},a_{\tau},r_{\tau},s_{\tau +1},o_{\tau +1})$ , the $Q$ -value function $q^{II}(s_{\tau},o_{\tau},a_{\tau})$ converges to the optimal $Q$ -value function $q_{*}^{II}(s_{\tau},o_{\tau},a_{\tau})$ with probability 1, assuming that the higher-layer policy is fixed. + +Proof. The update formula of intra-option Q-value in tabular form is as follows: + +$$ +q _ {n + 1} ^ {I I} \left(s _ {t, \tau}, o _ {t, \tau}, a _ {t, \tau}\right) = \left\{ \begin{array}{l l} r _ {t, \tau} + \gamma \max _ {a} q _ {n} ^ {I I} \left(s _ {t, \tau + 1}, o _ {t, \tau + 1}, a\right), & \text {I f} o _ {t, \tau} > 0 \text {a n d} a _ {t, \tau} \neq a _ {t, \phi}, \\ r _ {t, \tau} + \gamma q ^ {I} \left(s _ {t + 1}, o _ {t + 1}\right), & \text {o t h e r w i s e .} \end{array} \right. \tag {8} +$$ + +According to Theorem 1 from [21], we need to show the update operator is a contraction mapping. For $o_{t,\tau} > 0$ and $a_{t,\tau}\neq a_{t,\phi}$ + +$$ +\begin{array}{l} \left| q _ {n + 1} ^ {I I} \left(s _ {t, \tau}, o _ {t, \tau}, a _ {t, \tau}\right) - q _ {*} ^ {I I} \left(s _ {t, \tau}, o _ {t, \tau}, a _ {t, \tau}\right) \right| \\ = | r _ {t, \tau} + \gamma \max _ {a} q _ {n} ^ {I I} (s _ {t, \tau + 1}, o _ {\tau + 1}, a) - r _ {t, \tau} - \gamma \max _ {a} q _ {*} ^ {I I} (s _ {t, \tau + 1}, o _ {t, \tau + 1}, a) | \\ = \gamma \left| \max _ {a} q _ {n} ^ {I I} \left(s _ {t, \tau + 1}, o _ {t, \tau + 1}, a\right) - \max _ {a} q _ {*} ^ {I I} \left(s _ {t, \tau + 1}, o _ {t, \tau + 1}, a\right) \right| \tag {9} \\ \leq \gamma \max _ {a} \left| q _ {n} ^ {I I} \left(s _ {t, \tau + 1}, o _ {t, \tau + 1}, a\right) - q _ {*} ^ {I I} \left(s _ {t, \tau + 1}, o _ {t, \tau + 1}, a\right) \right| \\ \end{array} +$$ + +For the other case, + +$$ +\left| q _ {n + 1} ^ {I I} \left(s _ {t, \tau}, o _ {t, \tau}, a _ {t, \tau}\right) - q _ {*} ^ {I I} \left(s _ {t, \tau}, o _ {t, \tau}, a _ {t, \tau}\right) \right| = \left| r _ {t, \tau} + \gamma q ^ {I} \left(s _ {t + 1}, o _ {t + 1}\right) - r _ {t, \tau} - \gamma q _ {*} ^ {I} \left(s _ {t + 1}, o _ {t + 1}\right) \right| \tag {10} +$$ + +Note that $q^{I}(s_{t + 1},o_{t + 1}) = \max_{a}q^{II}(s_{t + 1},o_{t + 1},a)$ . Therefore, we have + +$$ +\begin{array}{l} \left| q _ {n + 1} ^ {I I} \left(s _ {t, \tau}, o _ {t, \tau}, a _ {t, \tau}\right) - q _ {*} ^ {I I} \left(s _ {t, \tau}, o _ {t, \tau}, a _ {t, \tau}\right) \right| \\ = \gamma \left| \max _ {a} q _ {n} ^ {I I} \left(s _ {t + 1}, o _ {t + 1}, a\right) - \max _ {a} q _ {*} ^ {I I} \left(s _ {t + 1}, o _ {t + 1}, a\right) \right| \tag {11} \\ \leq \gamma \max _ {a} \left| q _ {n} ^ {I I} \left(s _ {t + 1}, o _ {t + 1}, a\right) - q _ {*} ^ {I I} \left(s _ {t + 1}, o _ {t + 1}, a\right) \right| \\ \end{array} +$$ + +So we prove the convergence of the intra-option policy. + +![](images/06ba572c0a8c68421e05b68c0e5507d5a95e182ba41e309d57d3fae185610e53.jpg) + +# A.5.2 PROOF OF THEOREM 2 + +Theorem. (Option policy convergence). In our WS-option framework, given any state-option pair $(s_t, o_t)$ , the $Q$ -value function $q^I(s_t, o_t)$ converges to the optimal $Q$ -value function $q_*^I(s_t, o_t)$ with probability 1, assuming that for any given higher-layer policy, the lower-layer policy always provides the corresponding conditionally optimal response. + +Proof. The Q-value of the higher layer is updated by: + +$$ +q _ {t + 1} ^ {I} \left(s _ {t}, o _ {t}\right) = q _ {t} ^ {I} \left(s _ {t}, o _ {t}\right) - \alpha_ {t} \left(s _ {t}, o _ {t}\right) \left(q _ {t} ^ {I} \left(s _ {t}, o _ {t}\right) - g _ {t}\right), \tag {12} +$$ + +where $g_{t}$ is the return estimated by MC methods. Again, according to the Theorem 1 from [21], to establish the convergence, we need to show that $\mathbb{E}[q_t^I (s_t,a_t) - g_t] = 0$ . Under the assumption that for any given higher-layer policy, the lower-layer always provides the best-response policy, the lower-layer policy remains fixed and conditionally optimal at each time step $t$ . At each time step $t$ , the lower policy is fixed and the conditionally optimal. Consequently, the expected value of the observed return $g_{t}$ matches the Q-value estimate $q_{t}^{I}(s_{t},o_{t})$ . Therefore, the condition $\mathbb{E}[q_t^I (s_t,o_t) - g_t] = 0$ is satisfied. As a result, the Q-value function $q^{I}$ converges to the optimal option Q-value $q_{*}^{I}$ with probability 1. + +# A.5.3 INTERACTION AND CONVERGENCE OF HIERARCHICAL LAYERS + +The theorems presented above establish the convergence of two separate single-level optimization problems, as discussed in Section A.2. However, ensuring the convergence of the entire framework for bi-level optimization remains challenging due to the inherent interdependence between the two layers. + +To address this, we alternate between the two optimization processes and further use our WS option framework, which effectively decouples their dependencies during training. Specifically, the higher-layer policy provides guidance to the lower-layer policy, which then adapts to the given conditions and converges to its conditionally optimal response. Once the lower layer converges, the higher-layer policy is refined based on the updated performance metrics. + +This iterative approach leverages the individual convergence of each layer, as proven in Theorems in A.5.1 and A.5.2, to ensure the overall framework converges. By combining the independent convergence of the two layers, the framework achieves global optimization for the bi-level problem. + +# B ALGORITHM DETAILS + +# B.1 ALGORITHM 3 + +Algorithm 3 WS-option: Store transitions +1: for each transition $(s_t^I,o_t^I,a_t^{II},r_t^I,s_{t + 1}^I)$ in $\mathcal{T}$ do +2: Compute the gain $g_{t} = \sum_{i = t}^{T}\gamma^{i - 1}r_{i}^{I}$ +3: Store the transition $(s_t^I,o_t^I,g_t)$ in the replay buffer $\mathcal{M}_1$ +4: Set $s_\tau^{II}\gets s_t^I$ and $o_{\tau}^{II}\gets o_t^I$ +5: for each node $u$ in the $a_{t}^{II}$ do +6: $s_{\tau +1}^{II},o_{\tau +1}^{II}\gets$ state transition $(s_{\tau}^{II},o_{\tau}^{II},u)$ +7: Estimate the marginal reward $m_{\tau}^{II}$ by running 10 simulations. +8: Store the intermediate transition $(s_{\tau}^{II},o_{\tau}^{II},u,m_{\tau}^{II},s_{\tau +1}^{II},o_{\tau +1}^{II})$ for later scaling. +9: Update $s_\tau^{II}\gets s_{\tau +1}^{II},o_\tau^{II}\gets o_{\tau +1}^{II}$ +10: end for +11: for each stored intermediate transition $(s_{\tau}^{II},o_{\tau}^{II},u,m_{\tau}^{II},s_{\tau +1}^{II},o_{\tau +1}^{II})$ do +12: Scale the reward $r_\tau^{II} = \frac{m_\tau^{II}}{\sum m_k^{II}} (r_t^I -r_{t,\emptyset}^{II})$ +13: Store the transition $(s_{\tau}^{II},o_{\tau}^{II},u,r_{\tau}^{II},s_{\tau +1}^{II},o_{\tau +1}^{II})$ in the replay buffer $\mathcal{M}_2$ +14: end for +15: end for + +# C IMPLEMENTATION DETAILS + +# C.1 NETWORK ARCHITECTURE + +![](images/461f9a0d0b3282b6c1a0cf70f882c90c353668284485d97a3247d9f58631a43d.jpg) +Figure 4: Network architecture + +![](images/ab69cae76ecc77e4603a69faf27388fce5dc2faf0f676633a3dea7dbfb1dfa01.jpg) + +The network architecture consists of two primary components: the higher layer network and the lower layer network, as illustrated in Figure 4. There are two inputs: the node feature $X$ and the context $c$ . We use context $c$ to represent non-node feature information, such as global information $g$ and the option $o^I$ , which is a one-dimensional vector. The basic idea is to use graph network layers to get node embeddings. Then, we concatenate the node embeddings with the context embedding, which are used as the input of linear layers. + +Higher layer network with action-in This network is used for estimating $q^{I}(s^{I},o^{I})$ . It is worth noting that we adopt an action-in network structure, which differs from the traditional action-out + +structure in typical Q-learning frameworks like DQN [36, 37]. In the action-in structure, actions are also taken as inputs. In our study, this means the option (budget) is an input. We choose the action-in structure for two main reasons: first, it can capture the properties of a particular state-action pair more accurately because of the ability to embed the action into potential features. More importantly, since the size of the budget is not used as a parameter of the network (i.e., the number of output nodes), this approach allows for more powerful generalization ability of the model, which is not possible with the action-out structure. + +For the network architecture, we use graph network layers to obtain node embeddings $h$ . An average readout function is then applied to get the graph embedding $\overline{h}$ . After concatenating this with the context embedding, we use linear layers to compute $q^{I}(s^{I},o^{I})$ . + +Lower layer network with action-out The lower layer network adopts a traditional "action-out" structure to estimate $q^{II}(s^{II}, o^{II}, a^{II})$ . After obtaining the node embeddings $h$ through graph layers, we concatenate each node embedding $h_i$ with the context embedding $c$ (so we need to expand it first). Subsequently, we average the node embeddings to get the graph embedding, which is used to denote the null action. + +Details of the network In our study, we use different architectures for two problems. For the AIM problem, we employ the S2V structure in [24] with $T = 3$ to obtain node embedding and graph embedding (64-dimensional) for the higher layer. Subsequently, we use a linear layer to get the embedding of the option (64-dimensional), which is also called context embedding. We then concatenate the graph embedding with the context embedding and apply three linear layers to get the Q-value. For the lower layer, we also use S2V structure but with $T = 1$ to get both node embedding and graph embedding (64-dimensional). And using two linear layers for node embedding and graph embedding, respectively, to estimate the Q-value of all action ( $n$ nodes and a null action). To tackle the RP problem, we use attention layers due to their effectiveness in capturing the features of distances and benefits associated with nodes. For the higher layer, three attention layers with an embedding size of 64 are used to get the node and graph embeddings. Additionally, for this problem, the context is the option, the current node and the starting node. We use a linear layer to get the option embedding and combine it with node embeddings of the current node and starting node to get the context embedding and concatenate them with the graph embedding. The combined embedding is then passed through three linear layers to estimate the Q-value. For the lower layer, a single attention layer is used to get the node embedding (64 dimensional). The context embedding is the same as the higher layer. Notably, the embedding of the current node is employed as the representation for the null action instead of the graph embedding. Finally, three linear layers are applied to get the Q-value. + +# C.2 ADAPTIVE INFLUENCE MAXIMIZATION (AIM) + +AIM is an extension of IM [23], which aims to progressively select seed nodes in dynamic and uncertain environments to maximize the spread of information within a social network. AIM has diverse applications in fields such as viral marketing, information dissemination, and public health. In this paper, we use the Independent Cascade (IC) model as the information propagation model. + +The problem is modeled on a directed graph $G = (V, E)$ , where $V$ and $E$ are nodes and edges, respectively. Each node can be either active or inactive. Once a node $u$ becomes active (either by being selected as a seed or being activated by other nodes), it will attempt to activate each of its inactive neighbors $v$ with a probability $p(u, v)$ on the next day and cannot activate nodes afterwards. The probability $p(u, v)$ is constant and is set to $\frac{1}{d^{-}(v)}$ in our model, where $d^{-}(v)$ denotes the indegree of node $v$ . Initially, all nodes are inactive, and before each day starts, we can select some seed nodes to activate. We assume a total budget $K$ (i.e., the total number of nodes that can be selected) and study how to allocate the seed nodes to maximize the influenced nodes within the time constraint of $T$ days [48]. + +The MDP formulation of AIM is described in the following. The datasets used in the experiments are randomly generated using the `erdos_renyi_graph()` function from Python's NetworkX library, with a probability of 0.01. + +MDP formulation For the higher level, we denote the state of nodes as $X_{t} \in \{0,1\}^{|V| \times 3}$ . The state of each node is represented as a one-hot vector, indicating that the node is in one of three possible states: inactive, active (able to activate other nodes), or removed (active but unable to activate + +other nodes). What's more, the global information here is the remaining budget. The option is the budget allocated to the current time step. The reward is the increase in the number of influenced nodes. For the state transition, for example, given the current state $s_t^I$ and action $a_{t}^{II}$ (selected nodes) from the lower layer, we first change the state of selected nodes $a_{t}^{II}$ . For each node $v\in a_{t}^{II}$ , + +$$ +X _ {t} ^ {v} = [ 0, 1, 0 ]. \tag {13} +$$ + +Now we consider the interaction with environment. Assume the set of current active nodes is $C_{\mathrm{a},t}$ and the set of their inactive neighbors is $C_{\mathrm{ina},t}$ . Then, for each node $v \in C_{\mathrm{ina},t}$ , the probability of being activated is + +$$ +P \left(X _ {t} ^ {v} = [ 0, 1, 0 ]\right) = 1 - \prod_ {u \in \mathcal {N} (v) \cap C _ {\mathrm {a}, t}} (1 - p (u, v)). \tag {14} +$$ + +where $\mathcal{N}(v)$ is the set of neighbors of node $v$ , and $p(u,v)$ is the probability that node $v$ is activated by node $u$ . Then, we update the state of newly activated nodes $\mathcal{A}$ as in equation 13. + +For the lower level, the state remains consistent with the higher level but includes the option chosen by the higher level. The action is to select a node. The immediate reward is defined in Equation 4. The state transition occurs by simply setting the selected node to an active state. + +# C.3 ROUTE PLANNING (RP) + +RP includes a broad class of optimization problems that seeks to find an optimal route to satisfy specific constraints and objectives. This problem is applicable to fields such as logistics, travel planning, and vehicle routing. In this paper, we focus on a travel planning scenario with $N$ cities. The traveler must select $K$ cities to visit, starting from a specific city. Each city $c$ provides a profit $p_c$ , but the combined profit for visiting multiple cities in one day is a submodular function of these individual profits. The profit of each city changes dynamically over time and resets to 0 once visited. There is a maximum daily travel distance $d_{\mathrm{max}}$ , with penalties for exceeding it. The goal is to visit the selected cities within $T$ days and return to the starting point, maximizing overall travel profits. + +Specifically, the initial profit of each city follows from a uniform distribution $U(0.5,1)$ and updates as follows: + +$$ +p _ {c, t + 1} = p _ {c, t} + \xi_ {c, t + 1}, \quad \text {f o r} t \geq 0, \tag {15} +$$ + +where $\xi_{c,t + 1}\sim U(-0.05,0.05)$ . For a set of cities $C$ , the combined profit in one day is defined as + +$$ +f (C) = \sum_ {c \in C} p _ {c} - \eta (\max (| C | - 1, 0)) ^ {2}, \tag {16} +$$ + +where $\eta$ is a coefficient set to 0.1 in our experiments. Exceeding the maximum daily travel distance $d_{\mathrm{max}}$ results in a penalty proportional to the excess distance (we choose 5). The $d_{\mathrm{max}}$ we set is $1.5\max_{i,j}d_{ij}$ , where $d_{ij}$ is the distance of city $i$ and $j$ . The datasets used in this problem (coordinates of the city) are also randomly generated using the random rand() function from Python's Numpy library with a scale of 100. + +MDP formulation For the higher level, the state includes: the coordinates of each city, their profits, the current city, and the starting city. The option is the same as in the AIM problem. The reward is the combined profits of the selected cities at the current time step. The state transition involves the update of profits as described in Equation 15 and the change of the current city. + +For the lower level, the state remains consistent with the higher level but also includes the option chosen by the higher level. The action is to select a city. The marginal reward is simply the profit of the selected city, and the immediate reward can be obtained as described in Equation 4. Note that there is no propagation process, and the expected profit of each city does not change. Therefore, we can set $r_{t,\emptyset}^{II}$ to 0. The state transition only involves the change in the current node and is deterministic. + +The definitions of MDPs for these two problems are also shown in Table 5, and we will use the framework proposed in this paper to address these problems. + +Table 5: MDPs for AIM and RP problems + +
ProblemLayerStateOption/ActionReward
AIMHigheractive and inactivechoose a budget knumber of new active nodes
Loweractive and inactive, optionselect a nodescaled marginal reward of choosing a node
RPHighercoordinates, profitschoose a budget kcombined profit of k cities
Lowercoordinates, profits, optionselect a cityscaled profit
+ +# C.4 EXPERIMENT HYPER-PARAMETER + +To ensure the stability of the learning process in both problems, we employ Double Deep Q-Networks with an update frequency of 10 episodes. The $\epsilon$ -greedy strategy we use is initialized with $\epsilon = 0.9$ and decays by a factor of 0.98 after each single training, with a minimum threshold of 0.1. We train each model for 20 epochs and 10 episodes. + +All experiments on two COPs are implemented in Python and conducted on two machines. One is NVIDIA GeForce RTX 4090 GPU and Intel 24GB 24-Core i9-13900K. The other is NVIDIA V100 GPU and Inter 256 GB 32-Core Xeon E5-2683 v4. + +Table 6: Experiment hyper-parameters for both problems + +
ParameterAIMRP
Discount factor (γ)0.990.99
Learning rate (higher-layer)10-310-2
Learning rate (lower-layer)10-410-4
Batch size3232
DDQN update frequency10 episodes10 episodes
Initial ε in ε-greedy0.90.9
Decay factor for ε0.980.98
Minimum ε threshold0.10.1
Epochs2020
Episodes1010
HardwareNVIDIA GeForce RTX 4090, Intel 24GB 24-Core i9-13900K, NVIDIA V100, Intel 256GB 32-Core Xeon E5-2683 v4
+ +# C.5 USING T-TEST FOR EVALUATION + +To evaluate the performance of our model, we use a t-test rather than standard deviation. This approach is particularly suitable given the presence of both aleatoric and epistemic uncertainties. Typically, we conduct multiple experiments to calculate the mean and standard deviation. Through this process, the epistemic uncertainty—arising from limited data—can be mitigated according to the law of large numbers. However, aleatoric uncertainty, which stems from inherent stochasticity in the environment, is irreducible and contributes to natural variability. Consequently, the standard deviation in such scenarios primarily reflects aleatoric uncertainty. In our stochastic environment, this metric alone provides limited insight into the true performance of the model. + +# D ADDITIONAL RESULTS + +# D.1 CUMULATIVE REWARD + +# D.2 RESOURCE ALLOCATION + +Figure 6-8 shows the budget allocation for AIM problem. The last three days have been ignored due to none resource allocation. + +![](images/e01e6c18358acdc0a970d57cdbe1afd68fd0f06b8678de225337db37068fa65a.jpg) +Figure 5: Cumulative reward during training for AIM $T = 10$ , $K = 20$ + +![](images/7d7603bed40878333fd7a4ff5c29ae19071be03f42554baf5634abb51d6a00d3.jpg) +Figure 6: Budget allocation for $T = 10$ , $K = 10$ + +![](images/df2ed688027e51b8d8d57bedac832ae2aa2fd1b9da9fc34a093357a47ba533a8.jpg) +Figure 7: Budget allocation for $T = 10$ , $K = 20$ + +Table 7: RP: Generalization to larger graphs. All cases have p-values $\leq 0.05$ . + +
2004007001000
WS-option14.4513.4814.4914.23
greedy12.4110.7411.3712.04
GA12.6210.9611.3711.77
+ +![](images/a92b1f0b5c29ad9fa7e625db857399a404291f4c17e7649502e9c9e5306f15fc.jpg) +Figure 8: Budget allocation for $T = 10$ , $K = 30$ + +# D.3 GENERALIZATION TO LARGER GRAPHS + +# D.4 EVALUATION ON THE REAL-WORLD DATA + +Real-world datasets often exhibit certain patterns, such as clustering characteristics. These patterns are easier for our RL-based algorithm to recognize, which can, in turn, achieve even better results. To demonstrate this, we evaluate our model on power2500 dataset, which has 2500 nodes. + +
MethodT=10, K=20
WS-option496.37
average-degree314.49
average-score317.16
normal-degree449.30
normal-score462.54
static-degree350.84
static-score393.10
+ +The results in Table 8 show that our RL-based algorithm (WS-option) significantly outperforms baseline methods, especially under scenarios characterized by clustering patterns. This demonstrates the model's capability to exploit structural properties in real-world datasets. + +# D.5 ABLATION STUDY FOR SLEEP STAGE WITH DIFFERENT TRAINING TIME + +Table 8: Performance comparison of methods on the power2500 dataset (T=10, K=20). + +
MethodT=10, K=20
WS-option (sleep with 1/2 N)118.56
WS-option (sleep with 1/3 N)104.84
WS-option (sleep with 2/3 N)118.59
average-degree104.54
average-score116.10
normal-degree101.50
normal-score111.89
static-degree105.25
static-score118.13
+ +Table 9: Performance comparison under different training time for the sleep stage $\left( {\mathrm{T} = {10},\mathrm{\;K} = {20}}\right)$ . + +Note that we use the same random seed as in 4.2. From the results, we observe that ensuring the lower layer converges during the sleep stage is crucial. Specifically, when the model trains with $\frac{1}{2} N$ + +or $\frac{2}{3} N$ , the performance is nearly identical, indicating sufficient convergence. In contrast, training with $\frac{1}{3} N$ leads to significantly degraded performance, demonstrating that insufficient convergence in the lower layer undermines the overall results. + +# D.6 ABLATION STUDY FOR SIMPLIFIED OPTION IN THE LOWER LAYER + +The experimental results for evaluating the effect of simplifying the option in the lower layer are presented in Table 10. We observe that using a simplified option achieves slightly better performance compared to the non-simplified version (118.56 vs. 116.37). This shows that while the non-simplified option can still yield good results with sufficient iterations, it requires more training for agents to accurately identify termination conditions. Specifically, termination occurs only when the budget equals 0; when the budget is greater than 0, the behavior remains the same across methods. + +
MethodT=10, K=20
WS-option118.56
WS-option (non-simplified option)116.37
average-degree104.54
average-score116.10
normal-degree101.50
normal-score111.89
static-degree105.25
static-score118.13
+ +Table 10: Ablation study results for simplified options in the lower layer $\left( {\mathrm{T} = {10},\mathrm{\;K} = {20}}\right)$ . \ No newline at end of file diff --git a/ICLR/2025/Sequential Stochastic Combinatorial Optimization Using Hierarchal Reinforcement Learning/images.zip b/ICLR/2025/Sequential Stochastic Combinatorial Optimization Using Hierarchal Reinforcement Learning/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..0ab4fcc8a787a6119ebcb12218b5afc3e65838d3 --- /dev/null +++ b/ICLR/2025/Sequential Stochastic Combinatorial Optimization Using Hierarchal Reinforcement Learning/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:60f5098b1b3adaf7ea694af3323217c923c429482362ef9acb2e1d608f8ff57e +size 691016 diff --git a/ICLR/2025/Sequential Stochastic Combinatorial Optimization Using Hierarchal Reinforcement Learning/layout.json b/ICLR/2025/Sequential Stochastic Combinatorial Optimization Using Hierarchal Reinforcement Learning/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..5e9a481d9c5c2c10f2da5e207c0d3e514191fb0d --- /dev/null +++ b/ICLR/2025/Sequential Stochastic Combinatorial Optimization Using Hierarchal Reinforcement Learning/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b1078f9a2dc1ca1857299772db0a896f85d3b7a1c701c4440d3ed465af113377 +size 895585 diff --git a/ICLR/2025/Shallow diffusion networks provably learn hidden low-dimensional structure/5694b73e-b91a-4799-81b3-8bde769c1308_content_list.json b/ICLR/2025/Shallow diffusion networks provably learn hidden low-dimensional structure/5694b73e-b91a-4799-81b3-8bde769c1308_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..3f211f924d1680ae336ee6f0090a1295848c7aaa --- /dev/null +++ b/ICLR/2025/Shallow diffusion networks provably learn hidden low-dimensional structure/5694b73e-b91a-4799-81b3-8bde769c1308_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:92bc88a3b06f87d44a8d89e3705263353643d82922f5c7306c1d4e9b0060348b +size 288798 diff --git a/ICLR/2025/Shallow diffusion networks provably learn hidden low-dimensional structure/5694b73e-b91a-4799-81b3-8bde769c1308_model.json b/ICLR/2025/Shallow diffusion networks provably learn hidden low-dimensional structure/5694b73e-b91a-4799-81b3-8bde769c1308_model.json new file mode 100644 index 0000000000000000000000000000000000000000..d7f0ea3d809593312150663772827926c8024682 --- /dev/null +++ b/ICLR/2025/Shallow diffusion networks provably learn hidden low-dimensional structure/5694b73e-b91a-4799-81b3-8bde769c1308_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8e3779f7a3c25c60c3e99f862690d0bd38ab2b2ca515144dc06fb4abedc07f21 +size 329430 diff --git a/ICLR/2025/Shallow diffusion networks provably learn hidden low-dimensional structure/5694b73e-b91a-4799-81b3-8bde769c1308_origin.pdf b/ICLR/2025/Shallow diffusion networks provably learn hidden low-dimensional structure/5694b73e-b91a-4799-81b3-8bde769c1308_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..75d7a4212647de4e54ef97bf7598c91ec4ab6c37 --- /dev/null +++ b/ICLR/2025/Shallow diffusion networks provably learn hidden low-dimensional structure/5694b73e-b91a-4799-81b3-8bde769c1308_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:29bd9788788da7a869bd89ed8e26b469ead1a40fca0b2131fd4dd0527602330c +size 21793431 diff --git a/ICLR/2025/Shallow diffusion networks provably learn hidden low-dimensional structure/full.md b/ICLR/2025/Shallow diffusion networks provably learn hidden low-dimensional structure/full.md new file mode 100644 index 0000000000000000000000000000000000000000..b2206c76c8d38d20fdd324649186ecf487be99db --- /dev/null +++ b/ICLR/2025/Shallow diffusion networks provably learn hidden low-dimensional structure/full.md @@ -0,0 +1,1585 @@ +# SINGLE HIDDEN LAYER DIFFUSION MODELS PROVABLY LEARN SIMPLE LOW-DIMENSIONAL STRUCTURE + +Nicholas M. Boffi + +Carnegie Mellon University + +nboffi@andrew.cmu.edu + +Arthur Jacot + +New York University + +arthur.jacot@nyu.edu + +Stephen Tu + +University of Southern California + +stephen.tu@usc.edu + +Ingvar Ziemann + +University of Pennsylvania + +ingvarz@seas.upenn.edu + +# ABSTRACT + +Diffusion-based generative models provide a powerful framework for learning to sample from a complex target distribution. The remarkable empirical success of these models applied to high-dimensional signals, including images and video, stands in stark contrast to classical results highlighting the curse of dimensionality for distribution recovery. In this work, we take a step towards understanding this gap through a careful analysis of learning diffusion models over the Barron space of single hidden layer neural networks. In particular, we show that these shallow models provably adapt to simple forms of low-dimensional structure, such as an unknown linear subspace or hidden independence, thereby avoiding the curse of dimensionality. We combine our results with recent analyses of sampling with diffusions to provide an end-to-end sample complexity bound for learning to sample from structured distributions. Importantly, our results do not require specialized architectures tailored to particular latent structures, and instead rely on the low-index structure of the Barron space to adapt to the underlying distribution. + +# 1 INTRODUCTION + +Generative models learn to sample from a target probability distribution given a dataset of examples. Applications are pervasive, and include language modeling (Li et al., 2022), high-fidelity image generation (Rombach et al., 2022), de-novo drug design (Watson et al., 2023), and molecular dynamics (Arts et al., 2023). Recent years have witnessed extremely rapid advancements in the field of generative modeling, particularly with the development of models based on dynamical transport of measure (Santambrogio, 2015), such as diffusion-based generative models (Ho et al., 2020; Song et al., 2021), stochastic interpolants (Albergo et al., 2023), flow matching (Lipman et al., 2023), and rectified flow (Liu et al., 2023) approaches. Yet, despite their strong empirical performance and well-grounded mathematical formulation, a theoretical understanding of how and why these large-scale generative models work is still in its infancy. + +A promising line of recent research has shown that the problem of sampling from an arbitrarily complex distribution can be reduced to unsupervised learning: for diffusion models, if an accurate velocity or score field can be estimated from data, then high-quality samples can be generated via numerical simulation (Chen et al., 2023d; Lee et al., 2023). While deeply insightful, these works leave open the difficulty of statistical estimation, and therefore raise the possibility that the sampling problem's true difficulty is hidden in the complexity of learning the score. + +In this work, we address this fundamental challenge by presenting an end-to-end analysis of sampling with score-based diffusion models. To balance tractability of the analysis with empirical relevance, we study the Barron space of single hidden layer neural networks (E et al., 2019; Bach, 2017). This space contains important features of models used in practice – most importantly, parametric nonlinearity – while retaining well-studied theoretical properties that we can adapt to the generative modeling problem. As paradigmatic examples of the widely-held belief that real-world datasets contain hidden low-dimensional structure (Tenenbaum et al., 2000; Weinberger & Saul, 2006), we focus on two + +idealized settings in which the target data density is concentrated on an unknown low-dimensional linear manifold, or consists of groups of independent low-dimensional variables. We show that for learning to sample from a target distribution with either of these structures, diffusion models backed by Barron networks enjoy a sample complexity bound that only depends exponentially on the intrinsic dimension of the structure rather than on the ambient dimension. Our results highlight that diffusion models based on one hidden layer networks without specific architectural modifications can adapt to hidden structure and sidestep the curse of dimensionality; in this way, they give insight into the empirical performance of more complex architectures on real-world high-dimensional datasets. + +# 2 RELATED WORK + +Sampling bounds for diffusion models. Much of the recent work on analyzing diffusion models has focused on the accuracy of sampling from a discretized backwards diffusion process, assuming access to $L_{2}$ accurate score functions. This includes work on discretized stochastic differential equations (Lee et al., 2022; Chen et al., 2023d; Lee et al., 2023; Chen et al., 2023a; Benton et al., 2024) and more recently, discretized probability flows (Chen et al., 2023e;c; Li et al., 2024; Liang et al., 2024; Gao & Zhu, 2024). Recent work by Li & Yan (2024) shows that the DDPM sampler (Ho et al., 2020) can be tuned so that in the presence of low dimensional structure, the discretization error only depends polynomially on the intrinsic dimension (in addition to the score error). However, these works assume the existence of an $\varepsilon$ -accurate score function in $L_{2}$ , and thereby leave open the question of the sample complexity of learning such a model. + +Sample complexity of score matching. Several works have considered the statistical complexity of learning a score function. Block et al. (2020) and Koehler et al. (2023) use the standard Rademacher complexity framework to bound the error of empirical risk minimization (ERM) for learning the score, but leave open the question of which function class to learn over. Han et al. (2024) and Wang et al. (2024) consider optimizing the denoising score matching loss over neural network models, and show that gradient descent on overparameterized models finds quality ERM solutions. Wibisono et al. (2024), Zhang et al. (2024), Oko et al. (2023), and Dou et al. (2024) study the minimax optimality of diffusion modeling under various functional assumptions regarding the target density and its corresponding score function. While together these works show that diffusion modeling is both nearly optimal for learning to sample and also computationally efficient, they simultaneously highlight the curse of dimensionality that arises without more structure. To address this issue, both Oko et al. (2023) and Chen et al. (2023b) impose a latent subspace assumption on the data distribution, which they show avoids exponential dependence on the ambient dimension. Our work is directly inspired by these results, and we defer a detailed comparison to Section 3. Another related work is Bortoli (2022), which studies diffusion models under a manifold hypothesis, proving a bound that depends exponentially on the diameter of the manifold. Finally, Cole & Lu (2024) show that under the assumption that the target log-relative density (w.r.t. a standard Gaussian) can be approximated by a network with low path norm, score estimation can be performed with a sample complexity bound that does not depend explicitly on the ambient dimension.1 However their absolute continuity assumption rules out examples such as target distributions supported on low dimensional manifolds. + +Learning in Barron spaces. Even though the implicit bias of deep networks remains largely an open question, there is now strong consensus that the implicit bias of shallow networks with large width is accurately captured by the Barron norm (E et al., 2019) or variational $\mathcal{F}_1$ norm (Bach, 2017). Such networks can avoid the curse of dimensionality by capturing low-index structure (i.e., when the target $f(x) = f(Px)$ for a low-dimensional projection $P \in \mathbb{R}^{d \times D}$ ), leading to generalization bounds that depend on the intrinsic dimension $d$ rather than the ambient dimension $D$ (Bach, 2017). Several recent results have also studied the (sometimes modified) gradient descent dynamics of shallow networks, and how this low-index structure emerges in the network (Abbe et al., 2022; Bietti et al., 2022; Ben Arous et al., 2022; Glasgow, 2024; Lee et al., 2024). While most of this literature focuses on supervised training problems, some work has shown that this type of analysis can be extended to the unsupervised case, in particular to learn energy-based models (Domingo-Enrich et al., 2021). + +# 3 PROBLEM FORMULATION AND MAIN RESULTS + +Our goal in this work is to study the statistical complexity of learning to sample from a target probability measure $p_0(x_0)$ defined on $\mathbb{R}^D$ given a dataset of $n$ iid examples $x_0^i \sim p_0$ for $i = 1, \dots, n$ . In particular, we consider the use of a diffusion model (Sohl-Dickstein et al., 2015; Song et al., 2021; Ho et al., 2020) to learn a stochastic process that maps random noise to a new sample from the data distribution. We assume that the target $p_0$ contains hidden latent structure – either a low-dimensional subspace or independent components – and our primary goal will be to show that a single hidden layer network can learn this hidden structure efficiently, in the sense that the statistical rates are governed primarily by the underlying latent dimension $d$ , as opposed to the ambient dimension $D \gg d$ . + +Diffusion models. We consider diffusion-based generative models based on stochastic differential equations (Song et al., 2021). These models construct a path in the space of measures between the target $p_0$ and a standard Gaussian $\mathsf{N}(0, I_D)$ by defining a forward process that converges to Gaussian data over an infinite horizon. For simplicity, we consider the Ornstein-Uhlenbeck (OU) process, + +$$ +\mathrm {d} x _ {t} = - x _ {t} \mathrm {d} t + \sqrt {2} \mathrm {d} B _ {t}, \quad t \in [ 0, T ], \tag {3.1} +$$ + +though our results straightforwardly generalize to the time-scaled OU processes commonly used in practice (Song et al., 2021). In (3.1), $(B_{t})_{t\geqslant 0}$ denotes a standard Brownian motion on $\mathbb{R}^D$ . Due to the linear nature of the OU process, for $w\sim \mathsf{N}(0,I_D)$ drawn independently of $x_0,x_t$ is equivalent in distribution to the stochastic interpolant (Albergo et al., 2023) + +$$ +x _ {t} \stackrel {\mathrm {d}} {=} m _ {t} x _ {0} + \sigma_ {t} w, \quad m _ {t} := \exp (- t), \quad \sigma_ {t} := \sqrt {1 - \exp (- 2 t)}. \tag {3.2} +$$ + +Let the marginal distributions of $x_{t}$ be denoted as $(p_t)_{t\in [0,T]}$ . The reverse process is the process of $y_{t}\coloneqq x_{T - t}$ for $t\in [0,T]$ . A classic result (Anderson, 1982) shows that the reverse process satisfies + +$$ +\mathrm {d} y _ {t} = \left(y _ {t} + 2 \nabla \log p _ {T - t} \left(y _ {t}\right)\right) \mathrm {d} t + \sqrt {2} \mathrm {d} B _ {t}, \quad y _ {0} \sim p _ {T} (\cdot), \quad t \in [ 0, T ]. \tag {3.3} +$$ + +Thus, assuming knowledge of the time-dependent score function $\nabla \log p_t$ , sampling from $p_0(\cdot)$ can be accomplished by (a) setting $T$ large enough so that $p_T(\cdot)$ is approximately an isotropic Gaussian, (b) sampling $y_0 \sim \mathsf{N}(0, I_D)$ , and (c) running the reverse SDE (3.3) until time $T$ . + +To implement this scheme in practice, the score function must be learned, and the reverse process must be discretized. Assuming access to a learned score function $\hat{s} \approx \nabla \log p$ , we now consider discretizing (3.3). In this work we make use of the exponential integrator (EI), which fixes a sequence (to be specified) of reverse process timesteps $0 = \tau_0 < \tau_1 < \dots < \tau_N = T$ and implements + +$$ +\mathrm {d} \tilde {y} _ {t} = \left(\tilde {y} _ {t} + 2 \hat {s} _ {T - \tau_ {k}} \left(\tilde {y} _ {\tau_ {k}}\right)\right) \mathrm {d} t + \sqrt {2} \mathrm {d} B _ {t}, \quad t \in [ \tau_ {k}, \tau_ {k + 1} ], \quad k \in \{0, \dots , N - 1 \}. \tag {3.4} +$$ + +Recently, building off of the works by Chen et al. (2023d) and Lee et al. (2023), Benton et al. (2024) showed that it suffices to control the score approximation error in $L_{2}(p_{t})$ to guarantee that the process (3.4) yields a high quality sample from $p_0$ .2 + +Score function estimation. To estimate the score function $\nabla \log p_t$ over the interval $[0, T]$ , one would ideally minimize the least-squares objective over a model $\hat{s}$ , + +$$ +\mathcal {R} (\hat {s}) := \int_ {0} ^ {T} \mathcal {R} _ {t} \left(\hat {s} _ {t}\right) \mathrm {d} t, \quad \mathcal {R} _ {t} \left(\hat {s} _ {t}\right) := \mathbb {E} _ {x _ {t}} \| \hat {s} _ {t} (x _ {t}) - \nabla \log p _ {t} (x _ {t}) \| ^ {2}. \tag {3.5} +$$ + +While direct minimization is not possible because $\nabla \log p_t$ is not observed, minimizing $\mathcal{R}(s)$ is equivalent to minimizing the following denoising score matching (DSM) loss (Vincent, 2011) + +$$ +\mathcal {L} (\hat {s}) := \int_ {0} ^ {T} \mathcal {L} _ {t} (\hat {s} _ {t}) \mathrm {d} t, \quad \mathcal {L} _ {t} (\hat {s} _ {t}) := \mathbb {E} _ {(w, x _ {t})} \| \hat {s} _ {t} (x _ {t}) + w / \sigma_ {t} \| ^ {2}, \tag {3.6} +$$ + +as can be shown by Tweedie's identity $\nabla \log p_t(x) = -\frac{1}{\sigma_t}\mathbb{E}[w\mid x_t = x]$ (Efron, 2011). In practice, (3.6) is typically approximated via Monte-Carlo by generating samples $x_{t^i}^i = m_{t^i}x_0^i +\sigma_{t^i}w^i$ using the dataset of samples from $p_0$ , iid random draws of Gaussian noise $w^{i}$ , and random time points + +$t^i$ drawn from $[0,T]$ . This empirical risk can then be minimized to estimate a time-dependent score function $\hat{s}:[0,T] \times \mathbb{R}^D \to \mathbb{R}^D$ . + +In this work, to simplify the mathematical analysis, we consider a stylized variant in which we fix a sequence of timesteps $0 < t_0 < \dots < t_{N - 1} = T$ and estimate $N$ time-independent score functions $\{\hat{s}_{t_i}\}_{i = 0}^{N - 1}$ of the form $\hat{s}_{t_i}:\mathbb{R}^D\to \mathbb{R}^D$ from a family of function classes $\mathcal{F}_t$ : + +$$ +\hat {s} _ {t} \in \underset {s _ {t} \in \mathcal {F} _ {t}} {\arg \min } \hat {\mathcal {L}} _ {t} (s _ {t}), \quad \hat {\mathcal {L}} _ {t} (s _ {t}) := \frac {1}{n} \sum_ {i = 1} ^ {n} \| s _ {t} \left(x _ {t} ^ {i}\right) + w ^ {i} / \sigma_ {t} \| ^ {2}, \quad t \in \left\{t _ {i} \right\} _ {i = 0} ^ {N - 1}. \tag {3.7} +$$ + +In the sequel, we will let $\mathcal{D}_t\coloneqq \{(x_t^i,w^i)\}_{i = 1}^n$ denote the training data used in (3.7) for timestep $t$ . + +From Wibisono et al. (2024), we know that if the true score $\nabla \log p_t$ is Lipschitz continuous and $p_t$ is sub-Gaussian, then the minimax rate for estimating $\nabla \log p_t$ is given by $n^{-2/(D+4)}$ . Unfortunately, this type of bound ignores all latent structure, raising the question of whether or not diffusion models can learn latent structure in a sample efficient way. + +The Barron space $\mathcal{F}_1$ . Consider a single hidden layer network $f_{m}$ with $m$ neurons and mean-field scaling, $f_{m}(x) = \frac{1}{m}\sum_{i = 1}^{m}u_{i}\sigma (\langle x,v_{i}\rangle)$ . In the limit as $m$ tends to infinity, the summation may be replaced by integration $f_{\infty}(x) = \int u\sigma (\langle x,v\rangle)\mathrm{d}\mu (u,v)$ against a signed Radon measure $\mu$ over the neuron parameters $(u,v)$ . This leads to the Barron space $\mathcal{F}_1$ (Bach, 2017; Mhaskar, 2004; Rotskoff & Vanden-Eijnden, 2019; Mei et al., 2018; Sirignano & Spiliopoulos, 2020), which models single hidden layer networks in the infinite width limit and feature learning regime (Chizat et al., 2020). + +Concretely, given a Radon measure $\mu$ on a measurable space $\mathcal{V}$ , recall that the total variation norm (TV) is defined as $\| \mu \|_{\mathrm{tv}} \coloneqq \sup_g \int_{\mathcal{V}} g(v) \, \mathrm{d}\mu(v)$ , where the supremum is over continuous functions $g: \mathcal{V} \mapsto [-1, 1]$ . Given a basis function $\varphi_v(x)$ , the TV-norm induces the space of functions $\mathcal{F}_1 \coloneqq \{f(x) = \int_{\mathcal{V}} \varphi_v(x) \, \mathrm{d}\mu(v) \mid \| \mu \|_{\mathrm{tv}} < \infty\}$ . For a function $f \in \mathcal{F}_1$ , its $\mathcal{F}_1$ -norm is the infimum over all TV-norms of measures that can represent $f$ , i.e., $\| f \|_{\mathcal{F}_1} \coloneqq \inf \{\| \mu \|_{\mathrm{tv}} \mid f(x) = \int_{\mathcal{V}} \varphi_v(x) \, \mathrm{d}\mu(v)\}$ . + +In this work, we will consider the special case $\mathcal{V} = \mathbb{S}^{p - 1}\times \mathbb{S}^{p - 1}$ for $p\in \mathbb{N}_{+}$ and $\varphi_v(x) = u\sigma (\langle x,v\rangle)$ , where $(u,v)\in \mathcal{V}$ and $\sigma (\cdot) = \max \{0,\cdot \}$ is the ReLU activation. Hence, the induced class $\mathcal{F}_1$ consists of vector-valued maps from $\mathbb{R}^p\to \mathbb{R}^p$ that satisfy $\| f(x)\| \leqslant \| f\|_{\mathcal{F}_1}\| x\|$ . In learning the score functions $\hat{s}_{t_i}$ via DSM (3.7), we will utilize norm-ball subsets of $\mathcal{F}_1$ to model the true score functions $\nabla \log p_{t_i}(x)$ . This allows us to leverage the low-index structure of $\mathcal{F}_1$ (Bach, 2017) and obtain bounds for score estimation that scale with the intrinsic, rather than ambient, dimension of the problem. + +Finally, while we consider $\mathcal{F}_1$ in this paper, we note that any $f\in \mathcal{F}_1$ can be $\varepsilon$ -approximated in $L_{2}$ by a finite width $f_{m}$ with $m\leqslant O(\| f\|_{\mathcal{F}_1}^2 /\varepsilon^2)$ neurons (Bach, 2017, Section 2). Since we will show that we can approximate the underlying score function with $\mathcal{F}_1$ -norm polynomial in $D$ , our results easily extend to finite width one hidden layer networks with $\mathrm{poly}(D)$ width. + +Flow matching and interpolant models. Flow matching models (Lipman et al., 2023; Liu et al., 2023) and stochastic interpolants (Albergo et al., 2023) have also been used recently in the context of generative modeling. In Appendix B, we relate the Barron norm of the drift vector field in these ODE based models with the Barron norm of the score function, which implies that our proof techniques can also be used to prove similar results for learning flow matching and interpolant drift terms. + +Notation. We briefly review the (relatively standard) notation used in this work. For a $d$ -dimensional vector $x$ , the $\ell_p$ norm is denoted $\| x\| _p$ ; the notation $\| x\|$ is reserved for the Euclidean $(p = 2)$ case. The (closed) $\ell_2$ -ball of radius $r$ in $d$ -dimension is denoted by $B_{2}(r,d)$ ; when $r = 1$ , we use the shorthand $B_{2}(d)$ . The unit sphere in $\mathbb{R}^d$ is denoted $\mathbb{S}^{d - 1}$ . The notation $O_d(\cdot)$ hides both universal constants and constants that depend arbitrarily on the variable $d$ . Similarly, $\tilde{O}_d(\cdot)$ hides universal constants, constants that depend on $d$ , and terms that may depend poly-logarithmically on $d$ , i.e., terms of the form $\log^{O(d)}(\cdot)$ . The notation $\mathrm{poly}(\cdot)$ indicates a polynomial dependence on the arguments, whereas $\mathrm{poly}_d(\cdot)$ indicates that the polynomial degrees are allowed to depend arbitrarily on $d$ . The notation $a\lesssim b$ (resp. $a\gtrsim b$ ) indicates that there exists a universal positive constant $c$ such that $a\leqslant cb$ (resp. $a\geqslant cb$ ), and $a\succ b$ means that $a\lesssim b$ and $a\gtrsim b$ . Finally, we use $a\lor b$ to denote $\max \{a,b\}$ . + +# 3.1 LEARNING LATENT SUBSPACE STRUCTURE + +We first consider a setting in which $x_0$ is supported on a $d$ -dimensional $(d \ll D)$ linear subspace: + +$$ +x _ {0} = U z _ {0}, \quad z _ {0} \sim \pi_ {0} (\cdot), \quad U \in O (D, d), \tag {3.8} +$$ + +where $z_0$ is a $d$ -dimensional random vector and $O(D, d) \coloneqq \{U \in \mathbb{R}^{D \times d} \mid U^{\top}U = I_d\}$ denotes the $d$ -dimensional orthogonal group in $\mathbb{R}^D$ . Note that both the subspace dimension $d$ and the embedding matrix $U$ are unknown to the learner. + +Recently, both Chen et al. (2023b) and Oko et al. (2023) consider learning diffusion models under the subspace structure (3.8). The main takeaway from both works is that the latent subspace dimension $d$ , rather than the ambient dimension $D$ , can govern the complexity of learning to sample from $p_0$ if the network used for learning satisfies various architectural assumptions. While insightful, these architectural assumption are difficult to satisfy in practice. Chen et al. (2023b) utilize a function class that is specifically tailored to the linear structure (3.8), in the sense that a linear autoencoder with prior knowledge of the latent dimension $d$ is used to reduce the learning problem to the latent space. The situation is improved in Oko et al. (2023), which considers fully-connected neural networks with bounded weight sparsity. Though closer to real-world architectures, optimizing networks with bounded sparsity constraints is computationally challenging in practice. + +Our first result further closes the gap between theory and practice: we show that by optimizing over $\mathcal{F}_1$ , the space of infinite-width single hidden layer networks, the latent subspace is adaptively learned without requiring prior latent dimension knowledge or difficult to impose sparsity constraints. We note that from a computational perspective, sufficiently wide shallow networks trained with gradient descent (GD) and weight decay will converge to the minimal $\mathcal{F}_1$ -norm solution (Chizat & Bach, 2018). While control on the number of neurons required in the worst case is not available (optimizing over $\mathcal{F}_1$ is unfortunately NP-hard (Bach, 2017)), recent results have shown that under various assumptions on the data and task, this hardness can be avoided and GD can indeed learn low-index functions with a number of neurons that scales polynomially with an exponent that depends only on the intrinsic dimension (Abbe et al., 2022; Dandi et al., 2023; Lee et al., 2024). The fact that an exponential width might be required for GD to converge to the optimal solution is not in contradiction with the fact that a polynomial width is sufficient to approximate the optimal solution (cf. beginning of Section 3), since approximation is a weaker guarantee than convergence of GD. + +Towards stating our first result, we begin with a few standard regularity assumptions. + +Assumption 3.1. The latent variable $z_0 \sim \pi_0(\cdot)$ is $\beta$ -sub-Gaussian (with $\beta \geqslant 1$ ), i.e., + +$$ +\mathbb {E} \exp (\lambda (\| z _ {0} \| - \mathbb {E} \| z _ {0} \|)) \leqslant \exp (\lambda^ {2} \beta^ {2} / 2), \quad \forall \lambda \in \mathbb {R}. +$$ + +Our next assumption concerns the regularity of the score function of the latent distribution $\pi_t$ , which denotes the marginal distribution of $z_t \coloneqq U^\top x_t$ . + +Assumption 3.2. The latent score $\nabla \log \pi_t$ is $L$ -Lipschitz (with $L \geqslant 1$ ) on $\mathbb{R}^d$ for all $t \geqslant 0$ . + +We emphasize that Assumption 3.2 concerns the Lipschitz regularity of the latent measure $\pi_t$ and not the ambient measure $p_t$ ; due to the subspace structure (3.8), the Lipschitz constant of the ambient score diverges as $t \to 0$ . Finally, we define some shorthand notation for $t \in [0, T]$ , + +$$ +\mu_ {t, x} := \mu_ {0} \vee \sigma_ {t} \sqrt {D}, \quad \mu_ {t, z} := \mu_ {0} \vee \sigma_ {t} \sqrt {d}, \quad \bar {L} := c L (\mu_ {0} + \sqrt {d} + \| \nabla \log \pi_ {0} (0) \|), +$$ + +where $\mu_0\coloneqq (\mathbb{E}\| z_0\| ^2)^{1 / 2}$ and $c\geqslant 1$ is a universal constant. Since $\sigma_t\to 1$ as $t\to \infty$ , these constants are uniformly bounded above. Hence, we define $\mu_{x}\coloneqq \lim_{t\to \infty}\mu_{t,x}$ and $\mu_z\coloneqq \lim_{t\to \infty}\mu_{t,z}$ + +Theorem 3.3. Suppose that $p_0$ follows the latent structure (3.8), and that both Assumption 3.1 and Assumption 3.2 hold. Fix a $t > 0$ and define + +$$ +\mathscr {F} _ {t} := \left\{s: \mathbb {R} ^ {D} \mapsto \mathbb {R} ^ {D} \mid \| s \| _ {\mathcal {F} _ {1}} \leqslant R _ {t} \right\}, \quad R _ {t} := \bar {R} _ {t} n ^ {\frac {d + 1}{2 (d + 5)}} + \frac {D}{\sigma_ {t} ^ {2}}, \tag {3.9} +$$ + +where $\bar{R}_t$ does not depend on $n$ .5 Suppose that $n$ satisfies + +$$ +n \geqslant n _ {0} (t) := \operatorname {p o l y} \left(D, 1 / \sigma_ {t}, \mu_ {t, x} \vee \beta\right) \cdot \operatorname {p o l y} _ {d} (\bar {L}, \mu_ {t, z} \vee \beta). \tag {3.10} +$$ + +Then, the empirical risk minimizer $\hat{s}_t \in \arg \min_{s \in \mathcal{F}_t} \hat{\mathcal{L}}_t(s)$ satisfies: + +$$ +\mathbb {E} _ {\mathcal {D} _ {t}} [ \mathcal {R} _ {t} (\hat {s} _ {t}) ] \leqslant \tilde {O} _ {d} (1) \left[ \frac {D ^ {2}}{\sigma_ {t} ^ {2} n} (\bar {L} (\mu_ {t, z} \vee \beta)) ^ {d + 3} (\mu_ {t, x} \vee \beta) ^ {2} \right] ^ {\frac {2}{d + 5}} + \tilde {O} _ {d} (1) \sqrt {\frac {D ^ {3}}{\sigma_ {t} ^ {6} n} (\mu_ {t , x} \vee \beta) ^ {2}}. +$$ + +Focusing on the factors $n, d, D$ , Theorem 3.3 states that the score matching risk scales as $\mathbb{E}_{\mathcal{D}_t}[\mathcal{R}_t(\hat{s}_t)] \leqslant \tilde{O}_d(1)(\mathrm{poly}(D) / n)^{2 / (d + 5)}$ , demonstrating that exponential dependence enters only through the latent subspace dimension $d$ and not the ambient dimension $D$ . Some further remarks regarding Theorem 3.3 are in order. First, we can obtain a high-probability bound with minor modifications to the proof; we omit these details in the interest of brevity. Second, our $n^{-2 / (d + 5)}$ rate nearly matches the minimax optimal rate of score matching from Wibisono et al. (2024), but with the subspace dimension $d$ replacing the ambient dimension $D$ ; we leave showing a $n^{-2 / (d + 4)}$ rate to future work. Last, as noted before, Chen et al. (2023b, Theorem 2) proves a related result for learning score functions under the subspace structure (3.8). However, Theorem 3.3 substantially improves their result in the following ways. First, as already mentioned, our result does not require any specialized architectures, but instead applies to learning directly in the Barron space $\mathcal{F}_1$ of single hidden layer neural networks. Additionally, our result also provides several technical improvements: (a) our leading dependence on $n$ is improved to $n^{-2 / (d + 5)}$ from $n^{-(2 - o(1)) / (d + 5)}$ , and (b) our dependence on $\sigma_t$ is improved to $\sigma_t^{-4 / (d + 5)}$ instead of $\sigma_t^{-2}$ in the regime as $t \to 0$ . + +We now use Theorem 3.3 to provide an end-to-end sample complexity bound for sampling from $p_0$ . + +Corollary 3.4. Fix $\varepsilon, \zeta \in (0,1)$ . Suppose that $p_0$ follows the latent structure (3.8), and that both Assumption 3.1 and Assumption 3.2 hold. Consider the exponential integrator (3.4) with: + +$$ +T = c _ {0} \log \left(\frac {\sqrt {D} \vee \mu_ {0}}{\varepsilon}\right), \quad N = 2 \left[ c _ {1} \frac {D \vee \mu_ {0} ^ {2}}{\varepsilon^ {2}} \left[ \log^ {2} \left(\frac {\sqrt {D} \vee \mu_ {0}}{\varepsilon}\right) + \log^ {2} \left(\frac {1}{\zeta}\right) \right] \right], \tag {3.11} +$$ + +and reverse process discretization timesteps $\{\tau_i\}_{i = 0}^N$ defined as: + +$$ +\tau_ {i} = \left\{ \begin{array}{l l} 2 (T - 1) \frac {i}{N} & i f i \in \{0, \dots , N / 2 \}, \\ T - \zeta^ {2 i / N - 1} & i f i \in \{N / 2 + 1, \dots , N \}. \end{array} \right. \tag {3.12} +$$ + +Next, define the forward process timesteps $\{t_i\}_{i=0}^{N-1}$ by $t_i := T - \tau_{N-i}$ . Suppose the exponential integration scheme is run with score functions $\{\hat{s}_{t_i}\}_{i=0}^{N-1}$ , where $\hat{s}_{t_i} \in \arg \min_{s \in \mathcal{F}_{t_i}} \hat{\mathcal{L}}_{t_i}(s)$ with $\mathcal{F}_t$ as defined in (3.9). Suppose furthermore that $n$ satisfies: + +$$ +n \geqslant \tilde {O} _ {d} (1) \max \left\{\frac {D ^ {2}}{\zeta} (\bar {L} (\mu_ {z} \vee \beta)) ^ {d + 3} (\mu_ {x} \vee \beta) ^ {2} \cdot \varepsilon^ {- (d + 5)}, \frac {D ^ {3}}{\zeta^ {3}} (\mu_ {x} \vee \beta) ^ {2} \cdot \varepsilon^ {- 4}, n _ {0} (\zeta) \right\}, +$$ + +where $n_0(\cdot)$ is defined in (3.10). With constant probability (over the randomness of the training datasets $\{\mathcal{D}_{t_i}\}_{i = 0}^{N - 1}$ ), we have that $\mathrm{KL}(p_{\zeta} \parallel \mathrm{Law}(\hat{y}_{T - \zeta})) \leqslant \varepsilon^2$ , where $\mathrm{Law}(\hat{y}_{T - \zeta})$ refers to the distribution of the random vector $\hat{y}_{T - \zeta}$ . + +Treating $\bar{L}$ and $\beta$ as constants, Corollary 3.4 prescribes a rate of $n\geqslant \tilde{O}_d(1)\frac{\mathrm{poly}(D)}{\zeta}\varepsilon^{-(d + 5)}$ (after a burn-in on $n$ ) to obtain a sampler that satisfies $\mathrm{KL}(p_{\zeta}\parallel \mathrm{Law}(\hat{y}_{T - \zeta}))\leqslant \varepsilon^2$ . To the best of our knowledge, this is the first end-to-end sample complexity bound for learning a diffusion model over single hidden layer neural networks that adapts to the intrinsic dimensionality of the problem. Note that as Corollary 3.4 controls the KL-divergence between the true data distribution $p_{\zeta}$ and the distribution $\mathrm{Law}(\hat{y}_{T - \zeta})$ of the final iterate of the exponential integrator (3.4), by Pinsker's inequality this also implies control on the TV-distance $\| p_{\zeta} - \mathrm{Law}(\hat{y}_{T - \zeta})\|_{\mathrm{tv}}$ . Furthermore, we can upgrade Corollary 3.4 to a high probability guarantee by utilizing a high probability variant of Theorem 3.3. + +The parameter $\zeta > 0$ is the early stopping parameter often found in practical implementations of diffusion models (cf. Karras et al. (2022)). Note that this is necessary since $p_0$ is supported on a lower-dimensional manifold and hence $\nabla \log p_0$ is not smooth on all of $\mathbb{R}^D$ . We remark that bounds comparing the original $p_0$ to $\mathrm{Law}(\hat{y}_{T - \zeta})$ are possible in Wasserstein distance by adopting the techniques from e.g. Chen et al. (2023d, Section 3.2); we omit these calculations. + +Compared to Chen et al. (2023b, Theorem 3), who obtain a $n \geqslant \tilde{O}_d(1)(\varepsilon \sqrt{\zeta})^{-(d + 5) / (1 - o(1))}$ rate in the case of a latent subspace-aware architecture, we see that our bound also improves the dependency on $\zeta$ . This is important, because ultimately $\zeta$ will be chosen to decay to zero as $n \to \infty$ . We do remark, however, that Chen et al. (2023b, Theorem 3) only depends polylogarithmically on the ambient dimension $D$ instead of polynomially. This can be traced back in their analysis to imposing the constraint that their score functions are uniformly bounded, i.e., $\sup_{z,t} \| s(z,t) \| \leqslant K$ , which allows truncation arguments to avoid picking up extra $\mathrm{poly}(D)$ factors. We choose to not impose such constraints in our model class, as this adds another hyperparameter that must be tuned in practice. We leave open the question of whether or not these $\mathrm{poly}(D)$ pre-factors in the sample complexity can be removed without further modifications (e.g., clipping) of the $\mathcal{F}_1$ hypothesis class. + +Compared to Oko et al. (2023, Theorem 6.4), Corollary 3.4 also relaxes a few technical assumptions, including a uniformly lower bounded density $\pi_0$ , and a requirement that $\pi_0$ be $C^\infty$ near the boundary $[-1,1]^d$ . On the other hand, their work obtains a sharper rate on $W_{1}(p_{0},\mathrm{Law}(\hat{y}_{T - \zeta}))\lesssim n^{-(3 - \delta) / (d + 4)}$ for any $\delta >0$ . We also leave open the question of whether these extra assumptions can be used to strengthen our guarantees for learning over $\mathcal{F}_1$ . + +# 3.2 LEARNING LATENT INDEPENDENCE + +We now consider a different kind of latent structure – here generated by independence – as opposed to the low-dimensional subspace setting just studied. Specifically, we suppose that for some $K \in [D]$ , + +$$ +x _ {0} = U z _ {0}, \quad z _ {0} \sim \left(z _ {0} ^ {(1)}, \dots , z _ {0} ^ {(K)}\right), \quad z _ {0} ^ {(i)} \sim \pi_ {0} ^ {(i)} (\cdot), \tag {3.13} +$$ + +where $U \in O(D) \coloneqq \{U \in \mathbb{R}^{D \times D} \mid U^{\mathsf{T}}U = I_{D}\}$ , $z_0^{(i)} \in \mathbb{R}^{d_i}$ with $\sum_{i=1}^{K} d_i = D$ , and where $z_0^{(i)}$ is independent of $z_0^{(j)}$ for $i \neq j$ . This setting differs from the previous case in that the latent structure considered is probabilistic and not geometric; it is possible for $z_0$ to satisfy (3.13) but still be fully supported on $\mathbb{R}^D$ . Similar to the linear subspace setting, we assume that the orthonormal matrix $U$ , the number of components $K$ , and the dimensionality of each component $\{d_i\}_{i=1}^K$ are all unknown to the learner, and we study the adaptive properties of $\mathcal{F}_1$ in the presence of this latent structure. We begin by imposing a similar set of assumptions as in the subspace case (cf. Section 3.1). + +Assumption 3.5. For all $i\in [K]$ , we have that $\pi_0^{(i)}$ is $\beta_{i}$ -sub-Gaussian (for $\beta_{i}\geqslant 1$ ), i.e., + +$$ +\mathbb {E} \exp (\lambda (\| z _ {0} ^ {(i)} \| - \mathbb {E} \| z _ {0} ^ {(i)} \|)) \leqslant \exp (\lambda^ {2} \beta_ {i} ^ {2} / 2), \quad \lambda \in \mathbb {R}. +$$ + +Our next assumption again deals with the latent measure $\pi_t$ , defined as the marginal distribution of $z_t \coloneqq U^\top x_t$ . We decompose $z_t = (z_t^{(1)}, \ldots, z_t^{(K)})$ into coordinate groups as for $z_0$ , and we define $\pi_t^{(i)}$ as the marginal distribution of $z_t^{(i)}$ . + +Assumption 3.6. For all $i\in [K]$ , $\nabla \log \pi_t^{(i)}$ is $L_{i}$ -Lipschitz (for $L_{i}\geqslant 1$ ) on $\mathbb{R}^{d_i}$ for all $t\geqslant 0$ . + +As before, we define some shorthand notation for $t \in [0, T]$ and $i \in [K]$ : + +$$ +\mu_ {t, x} ^ {(i)} := \mu_ {0} ^ {(i)} \vee \sigma_ {t} \sqrt {d _ {i}}, \quad \bar {L} _ {i} := c L _ {i} (\mu_ {0} ^ {(i)} + \sqrt {d _ {i}} + \| \nabla \log \pi_ {0} ^ {(i)} (0) \|), +$$ + +where $\mu_0^{(i)}\coloneqq (\mathbb{E}\| z_0^{(i)}\| ^2)^{1 / 2}$ and $c\geqslant 1$ is a universal constant. Furthermore, we combine the individual constants together as $\mu_0\coloneqq \sqrt{\sum_{i = 1}^K(\mu_0^{(i)})^2},\beta \coloneqq \sqrt{\sum_{i = 1}^K\beta_i^2}$ , and $\mu_{t,x}\coloneqq \mu_0\vee \sigma_t\sqrt{D}$ . Finally, as before, we let $\mu_x^{(i)}\coloneqq \lim_{t\to \infty}\mu_{t,x}^{(i)}$ and $\mu_{x}\coloneqq \lim_{t\to \infty}\mu_{t,x}$ . Mirroring Theorem 3.3, we first bound the error on the learned score functions under the latent independent structure (3.13). + +Theorem 3.7. Suppose that $p_0$ follows the latent structure (3.13), and that both Assumption 3.5 and Assumption 3.6 hold. Fix a $t > 0$ and define + +$$ +\mathscr {F} _ {t} := \left\{s: \mathbb {R} ^ {D} \mapsto \mathbb {R} ^ {D} \mid \| s \| _ {\mathcal {F} _ {1}} \leqslant R _ {t} \right\}, \quad R _ {t} := \sum_ {i = 1} ^ {K} \bar {R} _ {t} ^ {(i)} n ^ {\frac {d _ {i} + 1}{2 (d _ {i} + 5)}}, \tag {3.14} +$$ + +where $\bar{R}_t^{(i)}$ does not depend on $n$ . Suppose that $n$ satisfies + +$$ +n \geqslant n _ {0} (t) := \operatorname {p o l y} \left(D, 1 / \sigma_ {t}, \mu_ {t, x} \vee \beta\right) \cdot \max _ {i \in [ K ]} \operatorname {p o l y} _ {d _ {i}} \left(\bar {L} _ {i}, \mu_ {t, x} ^ {(i)} \vee \beta^ {(i)}\right). \tag {3.15} +$$ + +Then, the empirical risk minimizer $\hat{s}_t \in \arg \min_{s \in \mathcal{F}_t} \hat{\mathcal{L}}_t(s)$ satisfies: + +$$ +\mathbb {E} _ {\mathcal {D} _ {t}} [ \mathcal {R} _ {t} (\hat {s} _ {t}) ] \leqslant \sum_ {i = 1} ^ {K} \tilde {O} _ {d _ {i}} (1) \left[ \frac {D ^ {2} K}{\sigma_ {t} ^ {2} n} (\bar {L} _ {i} (\mu_ {t, x} ^ {(i)} \vee \beta_ {i})) ^ {d _ {i} + 3} (\mu_ {t, x} \vee \beta) ^ {2} \right] ^ {\frac {2}{d _ {i} + 5}} + \tilde {O} (1) \sqrt {\frac {D ^ {2}}{\sigma_ {t} ^ {4} n} (\mu_ {t , x} \vee \beta) ^ {2}}. +$$ + +Ignoring all parameters other than $K$ and $n$ , Theorem 3.7 states that the score matching risk $\mathbb{E}_{\mathcal{D}_t}[\mathcal{R}_t(\hat{s}_t)]$ scales as $\mathbb{E}_{\mathcal{D}_t}[\mathcal{R}_t(\hat{s}_t)] \lesssim \sum_{i=1}^{K} (K/n)^{2/(d_i+5)}$ , which again captures the intrinsic dimensionality of the problem. To the best of our knowledge, this is the first result establishing a score function error bound in the setting (3.13) that depends primarily on the latent $d_i$ 's. Our final result mirrors that of Corollary 3.4 and establishes an end-to-end sampling guarantee for this setting. + +Corollary 3.8. Fix $\varepsilon, \zeta \in (0,1)$ . Suppose that $p_0$ follows the latent structure (3.13), and that both Assumption 3.5 and Assumption 3.6 hold. Consider the exponential integrator (3.4) with $(N,T)$ as in (3.11) and reverse process discretization timesteps $\{\tau_i\}_{i=0}^N$ defined as in (3.12). Next, define the forward process timesteps $\{t_i\}_{i=0}^{N-1}$ by $t_i \coloneqq T - \tau_{N-i}$ . Suppose the exponential integration scheme is run with score functions $\{\hat{s}_{t_i}\}_{i=0}^{N-1}$ , where $\hat{s}_{t_i} \in \arg \min_{s \in \mathcal{F}_{t_i}} \hat{\mathcal{L}}_{t_i}(s)$ with $\mathcal{F}_t$ as defined in (3.14). Suppose that $n \geqslant n_0(\zeta)$ satisfies: + +$$ +n \geqslant (\mu_ {x} \vee \beta) ^ {2} \max \left\{\max _ {i \in [ K ]} \left\{\frac {\tilde {O} _ {d _ {i}} (1) D ^ {2}}{\zeta} K ^ {(d _ {i} + 7) / 2} (\bar {L} _ {i} (\mu_ {x} ^ {(i)} \vee \beta)) ^ {d _ {i} + 3} \cdot \varepsilon^ {- (d _ {i} + 5)} \right\}, \frac {\tilde {O} (1) D ^ {2}}{\zeta^ {2}} \cdot \varepsilon^ {- 4} \right\}. +$$ + +where $n_0(\cdot)$ is defined in (3.15). With constant probability (over the randomness of the training datasets $\{\mathcal{D}_{t_i}\}_{i = 0}^{N - 1}$ ), we have that $\mathrm{KL}(p_{\zeta} \parallel \mathrm{Law}(\hat{y}_{T - \zeta})) \leqslant \varepsilon^2$ . + +Corollary 3.8 states that $n \geqslant \mathrm{poly}(D) / \zeta \cdot \max_{i \in [K]} \mathrm{poly}_{d_i}(K) \varepsilon^{-(d_i + 5)}$ samples (ignoring $\mu_x, \beta, L_i$ ) suffice to ensure that $\mathrm{KL}(p_\zeta \parallel \mathrm{Law}(\hat{y}_{T - \zeta})) \leqslant \varepsilon^2$ . We note that, unlike the latent subspace setting of Section 3.1, given Assumption 3.6 it is possible to prove a bound on $\mathrm{KL}(p_0 \parallel \mathrm{Law}(\hat{y}_{T - \zeta}))$ directly, since $\nabla \log p_t$ is uniformly Lipschitz for all $t \geqslant 0$ . This can be done by using Chen et al. (2023d, Theorem 2) to analyze the backwards exponential integrator process (3.4) instead of the results of Benton et al. (2024). We elect to utilize the latter's analysis in the interest of consistency with Section 3.1 where it is required. + +# 3.2.1 NON-ORTHOGONAL INDEPENDENT COMPONENTS + +Section 3.2 shows that a diffusion model based on a single hidden layer network can adapt to hidden independent component structure. A natural question is whether this extends to the non-orthogonal case, similar to independent component analysis (ICA) (Herault et al., 1985). Here, we explain why a direct extension of our argument works at $t = 0$ case, but breaks whenever $t > 0$ since the addition of noise breaks the independence structure. We then use data whitening to address the issue. + +Recall from (3.13) that $z_0 = (z_0^{(1)}, \ldots, z_0^{(K)})$ where $x^{(i)} \in \mathbb{R}^{d_i}$ for $d_1 + \dots + d_K = D$ , and where each of the $K$ components are sampled independently. Now, let us assume that $x_0 = A z_0$ , where $A \in \mathbb{R}^{D \times D}$ is invertible, but not necessarily orthonormal. Note that for $t = 0$ , the score function $\nabla \log p_0$ can be expressed as $\nabla \log p_0(x) = \sum_{i=1}^{K} A^{-\top} P_i^{\top} \nabla \log \pi_0^{(i)}(P_i A^{-1} x)$ , where $P_i \in \mathbb{R}^{d_i \times D}$ selects the $d_i$ coordinates that correspond to the $i$ -th variable group. Hence, the score function has the structure of a sum of low-index functions, and the $\mathcal{F}_1$ norm of the score can be bounded in terms of the sum of $\mathcal{F}_1$ norms of each component. However, once isotropic noise is added, this structure is lost in general because the isotropy is not preserved in the latent space $(z_t = A^{-1}(m_t x_0 + \sigma_t w) = m_t z_0 + \sigma_t A^{-1} w)$ . + +A possible fix for this issue is to first whiten the data, and then to apply the results of Section 3.2 to the whitened data. Specifically, write $\operatorname{Cov}(x_0) = A\Sigma A^\top$ , where $\Sigma$ is a block diagonal matrix with $K$ blocks $\Sigma^{(1)}, \ldots, \Sigma^{(K)}$ . Now consider the transform $\bar{x}_0 \coloneqq \Sigma^{-\frac{1}{2}}A^{-1}x_0$ , which orthogonalizes the components and whitens each of them independently. Indeed, $\bar{x}_0$ follows the latent structure (3.13), and hence the results from Section 3.2 directly apply to $\bar{x}_0$ . However, one caveat with this approach is that the whitening factor $\Sigma^{-1/2}A^{-1}$ must be learned from the data samples $x_0^i \sim p_0(\cdot)$ . Standard results in covariance estimation (see e.g., Wainwright, 2019, Chapter 6) allow us to learn $\Sigma^{-1/2}A^{-1}$ (modulo rotation) up to $n^{-1/2}$ accuracy. It is an interesting question that we leave to future work to study how the associated estimation error propagates through both the learning and sampling procedures when obtaining a final sample complexity bound. + +![](images/69c9988d9046b68a4f7588ed629d405f50d0996212b10335f1d3cf5625d39f82.jpg) +Figure 1: Hidden linear structure. Experimental results comparing the performance of a single hidden layer neural network, a two hidden layer neural network, and a random feature model in the presence of a hidden linear structure. The target is an eight-mode Gaussian mixture model in $d = 2$ dimensions embedded into a $D$ dimensional space via an unknown orthogonal transformation; this transformation is used to project generated samples down to $\mathbb{R}^2$ . The Barron model continues to perform well in moderately high dimension which is consistent with our theory, whereas the random feature model struggles to identify the orthogonal transform and performs significantly worse than the other two models. + +# 4 EXPERIMENTAL RESULTS + +In this section, we present experimental results that verify our theoretical claims. To this end, we compare the performance of a single hidden layer (Barron) neural network with a random feature network (Bach, 2015; Rahimi & Recht, 2007) and a two hidden layer neural network as a function of the ambient dimension $D$ on two synthetic tasks that isolate the hidden structures we analyzed. To make the comparison as fair as possible, all networks are trained with gradient descent for $2.5 \times 10^{5}$ steps. We use a cosine decay schedule that initializes the learning rate from $5 \times 10^{-4}$ and ends at 0. The single hidden layer neural network has a hidden layer width of 1024 neurons; to keep the number of parameters fixed, the corresponding random feature model has 2048 neurons. To avoid an unnatural reduction in width for the two hidden-layer neural network, we keep the width fixed at 1024 rather than fixing the number of parameters. We sample from each learned diffusion model using 1024 evenly-spaced timesteps on the horizon $t \in [0,5]$ . + +Hidden linear structure. We consider data points $x \in \mathbb{R}^D$ given by $x = Uz$ where $z \in \mathbb{R}^d$ with $d = 2$ is drawn from the Gaussian mixture model $\rho = \frac{1}{N}\sum_{i=1}^{N}\mathsf{N}(\mu_i,\Sigma_i)$ with $N = 8$ . Here, $U \in \mathbb{R}^{D\times d}$ is a random orthogonal matrix that we keep fixed across all networks for constant $D$ . We take $\Sigma_i = \frac{1}{2}I$ for all $i$ and $\mu_i = r\left(\cos\left(\frac{2\pi i}{N}\right),\sin\left(\frac{2\pi i}{N}\right)\right)^\top$ , which leads to an eight-mode, narrowly-spaced mixture evenly distributed on the circle of radius $r = 5$ . We study the performance of each network architecture as a function of $D$ ranging from $D = 2$ to $D = 64$ in powers of two. Results are shown in Figure 1, where we visualize $5\times 10^4$ samples $\hat{z} = U^\top \hat{x}$ from each model. In each case, performance degrades as $D$ increases, reflective of the increasing difficulty of the learning problem. Notably, performance degrades significantly more rapidly for the random feature model than for the Barron model despite the fact that both models have the same number of parameters; in particular, for $D = 32$ and $D = 64$ , samples do not lie within the visualized frame because the model becomes unstable. This is consistent with our theory, which predicts that sample complexity guarantees for Barron will depend exponentially on $d = 2$ rather than $D$ , whereas the random feature model does not adapt to the latent structure Bach (2017). Unsurprisingly, given its extra parameters and additional nonlinear layer, the two-layer network maintains the highest performance for all $D$ . + +![](images/49e8d220910c5cc60b7311a31ebb2f9b8875bb7fba836e86086a0355ddc61819.jpg) +Figure 2: Product of hidden independent components. Experimental results comparing the performance of a random feature model, a single hidden layer network, and a two hidden layer network for a dataset with hidden independence structure. The target is a product of $K$ four mode Gaussian mixtures in $\mathbb{R}^2$ forming a randomly rotated square, so that $D = 2K$ ; each mixture has a different random rotation. Approximate samples are generated in $\mathbb{R}^D$ and only the first mixture is visualized. Similar to Figure 1, the single hidden layer (and two hidden layer) network is able to detect the hidden independence structure, while the performance of the random feature model rapidly breaks down. + +Hidden independent components. We now consider data points $x = (x_{1}, x_{2}, \ldots, x_{K})^{\top} \in \mathbb{R}^{D}$ where $D = Kd$ and each $x_{k} \in \mathbb{R}^{d}$ . We again take $d = 2$ for visualization, and we draw each $x_{k}$ from the Gaussian mixture model $\rho_{k} = \frac{1}{N} \sum_{i=1}^{N} \mathsf{N}(\mu_{i}^{k}, \Sigma_{i})$ with $N = 4$ . Similar to the previous experiment, we take $\Sigma_{i} = \frac{1}{2} I$ for all $i$ and $\mu_{i}^{k} = r\left(\cos \left(\frac{2\pi i}{N} + \phi_{k}\right), \sin \left(\frac{2\pi i}{N} + \phi_{k}\right)\right)^{\top}$ where $\phi_{k} \sim \mathrm{Unif}(0, 2\pi)$ is fixed across all network architectures for fixed $D$ . This construction ensures that each block $x_{k} \in \mathbb{R}^{d}$ is drawn from a Gaussian mixture with four modes placed on the corners of a square of side length $\sqrt{2}r$ that has been randomly rotated by an angle $\phi_{k}$ in the plane. Results are shown in Figure 2, where we visualize $5 \times 10^{4}$ samples of $\hat{x}_{1} \in \mathbb{R}^{2}$ . Similar to the previous experiment, Barron networks significantly outperform random feature models, while the two hidden-layer network outperforms Barron. + +# 5 CONCLUSION + +In this work, we showed that diffusion models based on single hidden layer neural networks applied to data from distributions that contain low dimensional structure – specifically, linear subspace and hidden independent component structure – exhibit favorable sample complexity bounds that primarily depend on the latent dimensionality of the problem, thereby avoiding the curse of dimensionality. We accomplish this by leveraging the low-index structure of the Barron space, which allows us to avoid specific latent-aware architectural modifications and computationally intractable sparsity constraints, both of which have been used to obtain similar results in earlier work. + +Several exciting future research threads arise directly from our study. The most pertinent direction is to increase the scope of the latent structures covered by our analysis, to include, for example, non-linear manifolds. Another related question is whether or not favorable results that avoid the curse of dimensionality can be shown for latent diffusion models (Rombach et al., 2022), which first learn an autoencoder before learning a diffusion model in the autoencoder's latent space. On the algorithmic front, an interesting open question is whether or not gradient-based optimization algorithms can efficiently learn the low-index structure associated with the latent models studied in this paper. Finally, improving our rates to match the minimax optimal score estimation rates of Wibisono et al. (2024) – with the latent dimension playing the role of the ambient dimension – is another exciting area for future work. + +# REFERENCES + +Emmanuel Abbe, Enric Boix Adsera, and Theodor Misiakiewicz. The merged-staircase property: a necessary and nearly sufficient condition for sgd learning of sparse functions on two-layer neural networks. In Conference on Learning Theory, pp. 4782-4887. PMLR, 2022. +Michael S Albergo, Nicholas M Boffi, and Eric Vanden-Eijnden. Stochastic interpolants: A unifying framework for flows and diffusions. arXiv preprint arXiv:2303.08797, 2023. +Brian D.O. Anderson. Reverse-time diffusion equation models. Stochastic Processes and their Applications, 12(3):313-326, 1982. ISSN 0304-4149. +Marloes Arts, Victor Garcia Satorras, Chin-Wei Huang, Daniel Zugner, Marco Federici, Cecilia Clementi, Frank Noé, Robert Pinsler, and Rianne van den Berg. Two for one: Diffusion models and force fields for coarse-grained molecular dynamics. Journal of Chemical Theory and Computation, 19(18):6151-6159, 2023. +Francis Bach. On the Equivalence between Kernel Quadrature Rules and Random Feature Expansions. arXiv:1502.06800, November 2015. +Francis Bach. Breaking the curse of dimensionality with convex neural networks. Journal of Machine Learning Research, 18(19):1-53, 2017. +Gerard Ben Arous, Reza Gheissari, and Aukosh Jagannath. High-dimensional limit theorems for sgd: Effective dynamics and critical scaling. Advances in Neural Information Processing Systems, 35: 25349-25362, 2022. +Joe Benton, Valentin De Bortoli, Arnaud Doucet, and George Deligiannidis. Nearly $d$ -linear convergence bounds for diffusion models via stochastic localization. In The Twelfth International Conference on Learning Representations, 2024. +Alberto Bietti, Joan Bruna, Clayton Sanford, and Min Jae Song. Learning single-index models with shallow neural networks. Advances in Neural Information Processing Systems, 35:9768-9783, 2022. +Adam Block, Youssef Mroueh, and Alexander Rakhlin. Generative modeling with denoising autoencoders and Langevin sampling. arXiv preprint arXiv:2002.00107, 2020. +Valentin De Bortoli. Convergence of denoising diffusion models under the manifold hypothesis. Transactions on Machine Learning Research, 2022. ISSN 2835-8856. +Hongrui Chen, Holden Lee, and Jianfeng Lu. Improved analysis of score-based generative modeling: user-friendly bounds under minimal smoothness assumptions. In Proceedings of the 40th International Conference on Machine Learning, 2023a. +Minshuo Chen, Kaixuan Huang, Tuo Zhao, and Mengdi Wang. Score approximation, estimation and distribution recovery of diffusion models on low-dimensional data. In Proceedings of the 40th International Conference on Machine Learning, volume 202, pp. 4672-4712. PMLR, 2023b. +Sitan Chen, Sinho Chewi, Holden Lee, Yuanzhi Li, Jianfeng Lu, and Adil Salim. The probability flow ode is provably fast. In Advances in Neural Information Processing Systems, volume 36, pp. 68552-68575. Curran Associates, Inc., 2023c. +Sitan Chen, Sinho Chewi, Jerry Li, Yuanzhi Li, Adil Salim, and Anru Zhang. Sampling is as easy as learning the score: theory for diffusion models with minimal data assumptions. In *The Eleventh International Conference on Learning Representations*, 2023d. +Sitan Chen, Giannis Daras, and Alexandros G. Dimakis. Restoration-degradation beyond linear diffusions: a non-asymptotic analysis for ddim-type samplers. In Proceedings of the 40th International Conference on Machine Learning, 2023e. +Lenaic Chizat and Francis Bach. On the Global Convergence of Gradient Descent for Overparameterized Models using Optimal Transport. In Advances in Neural Information Processing Systems 31, pp. 3040-3050. Curran Associates, Inc., 2018. + +Lenaic Chizat, Edouard Oyallon, and Francis Bach. On Lazy Training in Differentiable Programming. arXiv:1812.07956, January 2020. +Frank Cole and Yulong Lu. Score-based generative models break the curse of dimensionality in learning a family of sub-gaussian distributions. In The Twelfth International Conference on Learning Representations, 2024. +Yatin Dandi, Florent Krzakala, Bruno Loureiro, Luca Pesce, and Ludovic Stephan. How two-layer neural networks learn, one (giant) step at a time. arXiv preprint arXiv:2305.18270, 2023. +Carles Domingo-Enrich, Alberto Bietti, Eric Vanden-Eijnden, and Joan Bruna. On energy-based models with overparametrized shallow neural networks. In International Conference on Machine Learning, pp. 2771-2782. PMLR, 2021. +Zehao Dou, Subhodh Kotekal, Zhehao Xu, and Harrison H Zhou. From optimal score matching to optimal sampling. arXiv preprint arXiv:2409.07032, 2024. +Simon Du, Sham Kakade, Jason Lee, Shachar Lovett, Gaurav Mahajan, Wen Sun, and Ruosong Wang. Bilinear classes: A structural framework for provable generalization in rl. In Proceedings of the 38th International Conference on Machine Learning, volume 139 of Proceedings of Machine Learning Research, pp. 2826-2836. PMLR, 2021. +Weinan E, Chao Ma, and Lei Wu. Barron spaces and the compositional function spaces for neural network models. arXiv preprint arXiv:1906.08039, 2019. +Bradley Efron. Tweedie's formula and selection bias. Journal of the American Statistical Association, 106(496):1602-1614, 2011. +Xuefeng Gao and Lingjiong Zhu. Convergence analysis for general probability flow odes of diffusion models in Wasserstein distances. arXiv preprint arXiv:2401.17958, 2024. +Margalit Glasgow. SGD finds then tunes features in two-layer neural networks with near-optimal sample complexity: A case study in the XOR problem. In The Twelfth International Conference on Learning Representations, 2024. +Yinbin Han, Meisam Razaviyayn, and Renyuan Xu. Neural network-based score estimation in diffusion models: Optimization and generalization. In The Twelfth International Conference on Learning Representations, 2024. +Jeanny Herault, Christian Jutten, and Bernard Ans. Detection de grandeurs primitives dans un message composite par une architecture de calcul neuromimetique en apprenticessage non supervise. $10^{\circ}$ Colloque sur le traitement du signal et des images, 1985; p. 1017-1022, 01 1985. +Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. In Advances in Neural Information Processing Systems, volume 33, pp. 6840-6851. Curran Associates, Inc., 2020. +Arthur Jacot, Seok Hoan Choi, and Yuxiao Wen. How dnns break the curse of dimensionality: Compositionality and symmetry learning. arXiv preprint arXiv:2407.05664, 2024. +Chi Jin, Praneeth Netrapalli, Rong Ge, Sham M Kakade, and Michael I Jordan. A short note on concentration inequalities for random vectors with subgaussian norm. arXiv preprint arXiv:1902.03736, 2019. +Tero Karras, Miika Aittala, Timo Aila, and Samuli Laine. Elucidating the design space of diffusion-based generative models. In Advances in Neural Information Processing Systems, volume 35, pp. 26565-26577. Curran Associates, Inc., 2022. +Frederic Koehler, Alexander Heckett, and Andrej Risteski. Statistical efficiency of score matching: The view from isoperimetry. In *The Eleventh International Conference on Learning Representations*, 2023. +Holden Lee, Jianfeng Lu, and Yixin Tan. Convergence for score-based generative modeling with polynomial complexity. In Advances in Neural Information Processing Systems, volume 35, pp. 22870-22882. Curran Associates, Inc., 2022. + +Holden Lee, Jianfeng Lu, and Yixin Tan. Convergence of score-based generative modeling for general data distributions. In Proceedings of The 34th International Conference on Algorithmic Learning Theory, volume 201, pp. 946-985. PMLR, 2023. +Jason D Lee, Kazusato Oko, Taiji Suzuki, and Denny Wu. Neural network learns low-dimensional polynomials with sgd near the information-theoretic limit. arXiv preprint arXiv:2406.01581, 2024. +Gen Li and Yuling Yan. Adapting to unknown low-dimensional structures in score-based diffusion models. arXiv preprint arXiv:2405.14861, 2024. +Gen Li, Yuting Wei, Yuejie Chi, and Yuxin Chen. A sharp convergence theory for the probability flow odes of diffusion models. arXiv preprint arXiv:2408.02320, 2024. +Xiang Li, John Thickstun, Ishaan Gulrajani, Percy S Liang, and Tatsunori B Hashimoto. Diffusion-lm improves controllable text generation. In Advances in Neural Information Processing Systems, volume 35, pp. 4328-4343. Curran Associates, Inc., 2022. +Yuchen Liang, Peizhong Ju, Yingbin Liang, and Ness Shroff. Non-asymptotic convergence of discrete-time diffusion models: New approach and improved rate. arXiv preprint arXiv:2402.13901, 2024. +Yaron Lipman, Ricky T. Q. Chen, Heli Ben-Hamu, Maximilian Nickel, and Matthew Le. Flow matching for generative modeling. In The Eleventh International Conference on Learning Representations, 2023. +Xingchao Liu, Chengyue Gong, and Qiang Liu. Flow straight and fast: Learning to generate and transfer data with rectified flow. In The Eleventh International Conference on Learning Representations, 2023. +Andreas Maurer. A vector-contraction inequality for rademacher complexities. In Algorithmic Learning Theory, pp. 3-17. Springer, 2016. +Song Mei, Andrea Montanari, and Phan-Minh Nguyen. A Mean Field View of the Landscape of Two-Layers Neural Networks. arXiv:1804.06561, August 2018. +Shahar Mendelson. Learning without concentration. J. ACM, 62(3), June 2015. +H.N. Mhaskar. On the tractability of multivariate integration and approximation by neural networks. Journal of Complexity, 20(4):561-590, 2004. +Kazusato Oko, Shunta Akiyama, and Taiji Suzuki. Diffusion models are minimax optimal distribution estimators. In Proceedings of the 40th International Conference on Machine Learning, volume 202 of Proceedings of Machine Learning Research, pp. 26517-26582. PMLR, 23-29 Jul 2023. +Ali Rahimi and Benjamin Recht. Random Features for Large-Scale Kernel Machines. In Advances in Neural Information Processing Systems, volume 20. Curran Associates, Inc., 2007. +Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Björn Ommer. High-resolution image synthesis with latent diffusion models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 10684-10695, June 2022. +Grant M. Rotskoff and Eric Vanden-Eijnden. Trainability and Accuracy of Neural Networks: An Interacting Particle System Approach. arXiv:1805.00915, July 2019. +Filippo Santambrogio. Optimal transport for applied mathematicians. *Birkhäuser*, NY, 55(58-63):94, 2015. +Justin Sirignano and Konstantinos Spiliopoulos. Mean Field Analysis of Deep Neural Networks. arXiv:1903.04440, November 2020. +Jascha Sohl-Dickstein, Eric Weiss, Niru Maheswaranathan, and Surya Ganguli. Deep unsupervised learning using nonequilibrium thermodynamics. In Proceedings of the 32nd International Conference on Machine Learning, volume 37 of Proceedings of Machine Learning Research, pp. 2256-2265. PMLR, 07-09 Jul 2015. + +Yang Song, Jascha Sohl-Dickstein, Diederik P Kingma, Abhishek Kumar, Stefano Ermon, and Ben Poole. Score-based generative modeling through stochastic differential equations. In International Conference on Learning Representations, 2021. +Nathan Srebro, Karthik Sridharan, and Ambuj Tewari. Smoothness, low noise and fast rates. In Advances in Neural Information Processing Systems, volume 23. Curran Associates, Inc., 2010. +Joshua B. Tenenbaum, Vin de Silva, and John C. Langford. A global geometric framework for nonlinear dimensionality reduction. Science, 290(5500):2319-2323, 2000. +Alexandre B. Tsybakov. Introduction to Nonparametric Estimation. Springer, 1st edition, 2008. +Roman Vershynin. High-dimensional probability: An introduction with applications in data science, volume 47. Cambridge university press, 2018. +Pascal Vincent. A connection between score matching and denoising autoencoders. *Neural Computation*, 23(7):1661-1674, 2011. +Martin J Wainwright. High-dimensional statistics: A non-asymptotic viewpoint, volume 48. Cambridge university press, 2019. +Yuqing Wang, Ye He, and Molei Tao. Evaluating the design space of diffusion-based generative models. arXiv preprint arXiv:2406.12839, 2024. +Joseph L Watson, David Juergens, Nathaniel R Bennett, Brian L Trippe, Jason Yim, Helen E Eisenach, Woody Ahern, Andrew J Borst, Robert J Ragotte, Lukas F Milles, et al. De novo design of protein structure and function with rfdiffusion. Nature, 620(7976):1089-1100, 2023. +Kilian Q Weinberger and Lawrence K Saul. Unsupervised learning of image manifolds by semidefinite programming. International journal of computer vision, 70:77-90, 2006. +Andre Wibisono, Yihong Wu, and Kaylee Yingxi Yang. Optimal score estimation via empirical bayes smoothing. In Proceedings of Thirty Seventh Conference on Learning Theory, volume 247 of Proceedings of Machine Learning Research, pp. 4958-4991. PMLR, 2024. +Kaihong Zhang, Heqi Yin, Feng Liang, and Jingbo Liu. Minimax optimality of score-based diffusion models: Beyond the density lower bound assumptions. In Proceedings of the 41st International Conference on Machine Learning, volume 235 of Proceedings of Machine Learning Research, pp. 60134-60178. PMLR, 21-27 Jul 2024. + +# A PROOF IDEAS + +Here, we outline the key proof ideas behind the results in Section 3.1 and Section 3.2. We focus our discussion exclusively on bounding the error of the score function estimate, as translating score error into sample quality bounds is already well-established in the literature (cf. Section 2). For this discussion, we fix a specific value of $t > 0$ , noting from our discussion in Section 3 (specifically Equation (3.7)) that we learn separate score models for a fixed sequence of forward process timesteps $\{t_i\}_{i=0}^{N-1}$ . + +# A.1 BASIC INEQUALITY + +Recall that $s_t \in \arg \min_{s \in \mathcal{F}_t} \hat{\mathcal{L}}_t(s)$ is the empirical risk minimizer (ERM) of the empirical denoising loss $\hat{\mathcal{L}}_t$ over the function class $\mathcal{F}_t = \{s : \mathbb{R}^D \mapsto \mathbb{R}^D \mid \|s\|_{\mathcal{F}_1} \leqslant R_t\}$ , where the norm bound $R_t$ will be determined. Our first step uses the link between the $L_2(p_t)$ score error $\mathcal{R}_t(s)$ and the DSM loss $\mathcal{L}_t(s)$ in addition to standard arguments from the analysis of ERM to show the following basic inequality for all $\varepsilon \geqslant 0$ : + +$$ +\mathbb {E} _ {\mathcal {D} _ {t}} \left[ \mathcal {R} _ {t} \left(\hat {s} _ {t}\right) \right] \leqslant (1 + \varepsilon) \inf _ {s \in \mathcal {F} _ {t}} \mathcal {R} _ {t} (s) + \mathbb {E} _ {\mathcal {D} _ {t}} \sup _ {s \in \mathcal {F} _ {t}} \left[ \mathcal {L} _ {t} (s) - (1 + \varepsilon) \hat {\mathcal {L}} _ {t} (s) \right] + \varepsilon \cdot C _ {t}, \tag {A.1} +$$ + +where $C_t \coloneqq \mathbb{E}\operatorname{tr}\operatorname{Cov}(\sigma_t^{-2}(m_tx_0 - x_t) \mid x_t)$ . The basic inequality (A.1) contains three key terms: an approximation-theoretic term $T_1 \coloneqq (1 + \varepsilon)\inf_{s \in \mathcal{F}_t} \mathcal{R}_t(s)$ which measures how well the $\mathcal{F}_1$ -norm bounded subset $\mathcal{F}_t$ approximates the true score, a uniform convergence term $T_2 \coloneqq \mathbb{E}_{\mathcal{D}_t} \sup_{s \in \mathcal{F}_t} [\mathcal{L}_t(s) - (1 + \varepsilon)\hat{\mathcal{L}}_t(s)]$ over the function class $\mathcal{F}_t$ , and a third offset term $T_3 \coloneqq \varepsilon \cdot C_t$ which trades off a fast rate for $T_2$ (controlled via $\varepsilon$ ) with the constant offset $C_t$ between the score error and the DSM loss. In addition, the first two terms are in tension with each other, and must be carefully balanced to achieve the desired rate. + +# A.2 APPROXIMATION OF STRUCTURED MODELS WITH $\mathcal{F}_1$ + +Our analysis is based on careful control of the approximation error term $T_{1}$ in (A.1) of the structured models we consider in a way such that the requisite $\mathcal{F}_1$ -norm $R_{t}$ does not depend exponentially on the ambient dimension $D$ . This is accomplished by first understanding the low-dimensional structure present in the score functions $\nabla \log p_t$ , and then arguing that this low-dimensional structure can be approximated with a norm bound $R_{t}$ that depends reasonably on $D$ . + +Subspace structure. We first consider the low dimensional subspace from Section 3.1. Under this model, we have the following expression relating the score $\nabla \log p_t$ to the score $\nabla \log \pi_t$ of the latent $z_t$ . + +Proposition A.1 (see e.g., Chen et al. (2023b, Lemma 1)). The following decomposition holds under the subspace model (3.8): + +$$ +\nabla \log p _ {t} (x) = U \nabla \log \pi_ {t} \left(U ^ {\mathsf {T}} x\right) - \frac {1}{\sigma_ {t} ^ {2}} \left(I - U U ^ {\mathsf {T}}\right) x. \tag {A.2} +$$ + +Independent components. We next consider the independent structure from Section 3.2. Under this model, we have the following decomposition for the score. + +Proposition A.2. The following holds under the independent components model (3.13): + +$$ +\nabla \log p _ {t} (x) = \sum_ {i = 1} ^ {K} U P _ {i} ^ {\top} \nabla \log \pi_ {t} ^ {(i)} \left(P _ {i} U ^ {\top} x\right), \tag {A.3} +$$ + +where $P_{i}\in \mathbb{R}^{d_{i}\times D}$ selects the coordinates corresponding to the $i$ -th variable group. + +Note that the proof of Proposition A.2 follows directly from the standard change of variables formula, and the fact that the distribution of $w$ is unchanged when pre-multiplied by $U^{\top}$ . + +The score function decompositions (A.2) and (A.3) both exhibit similar structure, where latent score functions are embedded into a score function in the ambient space via a linear encoding/decoding process. Fortunately, this embedding preserves the $\mathcal{F}_1$ -norm of the underlying function. + +Fact A.3. Let $f: \mathbb{R}^d \mapsto \mathbb{R}^d$ have bounded $\mathcal{F}_1$ -norm, and let $U \in O(D, k)$ . Consider $g: \mathbb{R}^D \mapsto \mathbb{R}^D$ defined as $g(x) = Uf(U^\top x)$ . We have that $\| g \|_{\mathcal{F}_1} = \| f \|_{\mathcal{F}_1}$ . + +Hence, if the latent function $f: \mathbb{R}^d \to \mathbb{R}^d$ can be approximated well in $\mathcal{F}_1$ , then the embedded function is also approximated well with the same $\mathcal{F}_1$ norm. This is the key observation that enables our results. Concretely, suppose that $\hat{f}: \mathbb{R}^d \mapsto \mathbb{R}^d$ has bounded $\mathcal{F}_1$ norm and approximates $f: \mathbb{R}^d \to \mathbb{R}^d$ via $\sup_{z \in B_2(d,M)} \| f(z) - \hat{f}(z) \| \leqslant \varepsilon$ . Then, $\hat{g}(x) = U \hat{f}(U^\top x)$ approximates $g(x) = U f(U^\top x)$ via $\sup_{x \in B_2(D,M)} \| g(x) - \hat{g}(x) \| \leqslant \varepsilon$ , and $\| \hat{g} \|_{\mathcal{F}_1} = \| \hat{f} \|_{\mathcal{F}_1}$ . + +It remains to argue that $\mathcal{F}_1$ can approximate low dimensional functions well. Fortunately, the approximation properties of $\mathcal{F}_1$ functions over various function classes is well-understood (Bach, 2017; Jacot et al., 2024). In particular, we utilize the following $\mathcal{F}_1$ approximation result for Lipschitz continuous functions, adopted from Bach (2017, Proposition 6). + +Lemma A.4. Let $f: \mathbb{R}^d \to \mathbb{R}^d$ be $L$ -Lipschitz and $B$ -bounded on $B_2(d, M)$ . Define $K := B \vee LM$ . For any $\varepsilon \in (0, K/2)$ , there exists an $f_\varepsilon \in \mathcal{F}_1$ such that $\sup_{x \in B_2(d, M)} \| f(x) - f_\varepsilon(x) \| \leqslant \varepsilon$ and: + +$$ +\left\| f _ {\varepsilon} \right\| _ {\mathcal {F} _ {1}} \leqslant O _ {d} (1) K \left(\frac {K}{\varepsilon}\right) ^ {(d + 1) / 2} \log^ {(d + 1) / 2} \left(\frac {K}{\varepsilon}\right). +$$ + +# A.3 UNIFORM CONVERGENCE OF THE DSM LOSS + +With the approximation result in place, we turn to the analysis of uniform convergence term $T_{2}$ in (A.1). Since the DSM loss is a least-squares regression problem, we can utilize existing results for analyzing generalization error with smooth losses (Srebro et al., 2010). However, the main technical hurdle here is dealing with the fact that the data tuples $(x_0, x_t)$ are not uniformly bounded, which is a technical assumption needed in many of these arguments. While this can be handled straightforwardly for a fixed time $t$ via standard truncation arguments, one challenge is ensuring that the resulting high probability bounds degrade nicely as $t \to 0$ . The reason this is necessary is because the smallest timescale $t_0$ used will ultimately scale with the number of datapoints $n$ . + +To highlight the class of issues that arise in our truncation arguments, consider the latent score function $\nabla \log \pi_t$ arising from the subspace structure setting (3.8). In order to apply a truncation argument for analyzing $T_{2}$ , we need to argue that $\| \nabla \log \pi_t(z)\|$ is bounded uniformly over a high-probability truncation set $z\in B_2(d,M)$ . By the continuity of $\nabla \log \pi_t$ , we know that $\sup_{z\in B_2(d,M)}\| \nabla \log \pi_t(z)\| = A_t < \infty$ . However, we need to control the behavior of $A_{t}$ as $t\to 0$ . By leveraging the perturbation analysis of Lee et al. (2023), we show that for all $t\geqslant 0$ , under our assumptions, the inequality $\| \nabla \log \pi_t(z)\| \leqslant \bar{L} (1 + \| z\|)$ holds for all $z\in \mathbb{R}^d$ . Hence, we can bound $A_{t}\leqslant \bar{L} (1 + M)$ for all $t\geqslant 0$ . + +# B EXTENSION TO STOCHASTIC INTERPOLANTS + +In this section, we describe how our approach can be extended to learning the drift field entering in flow matching models (Lipman et al., 2023; Liu et al., 2023), stochastic interpolants (Albergo et al., 2023), and probability flow ODE-based samplers in diffusion models. To this end, we observe that every method can be viewed as building a stochastic interpolant with linear coefficients + +$$ +x _ {t} = \alpha (t) x _ {0} + \beta (t) x _ {1}, +$$ + +$$ +\alpha (0) = 1, \alpha (1) = 0, \tag {B.1} +$$ + +$$ +\beta (0) = 0, \beta (1) = 1, +$$ + +where $x_0 \sim \mathsf{N}(0, I)$ and $x_1 \sim \rho^*$ is drawn from the target data density. A common choice is given by $\alpha(t) = 1 - t$ and $\beta(t) = t$ . In this section, we use the convention of interpolants and flow matching models, which exactly interpolate on $[0, 1]$ rather than doing so on $[0, \infty)$ like diffusions. Moreover, we fix the base density at $t = 0$ and the target density at $t = 1$ , which is opposite from the convention + +considered in the main text; see (3.2) for how this construction works in the diffusion model setup. Given (B.1), the drift field entering the probability flow equation is given by + +$$ +b (x, t) = \mathbb {E} \left[ \dot {x} _ {t} \mid x _ {t} = x \right], \tag {B.2} +$$ + +while the score field is given by + +$$ +s (x, t) = - \frac {1}{\alpha (t)} \mathbb {E} [ x _ {0} \mid x _ {t} = x ]. \tag {B.3} +$$ + +The following argument is also given in Albergo et al. (2023). We first observe that $\dot{x}_t = \dot{\alpha}(t)x_0 + \dot{\beta}(t)x_1$ , and then solve (B.1) for $x_1$ to find that + +$$ +x _ {1} = \frac {1}{\beta (t)} \left(x _ {t} - \alpha (t) x _ {0}\right). \tag {B.4} +$$ + +Hence, plugging in to (B.2), we find that + +$$ +\begin{array}{l} b (x, t) = \mathbb {E} \left[ \dot {\alpha} (t) x _ {0} + \dot {\beta} (t) x _ {1} \mid x _ {t} = x \right], \\ = \mathbb {E} \left[ \dot {\alpha} (t) x _ {0} + \dot {\beta} (t) \left(\frac {1}{\beta (t)} \left(x _ {t} - \alpha (t) x _ {0}\right)\right) \mid x _ {t} = x \right], \\ = \mathbb {E} \left[ \left(\dot {\alpha} (t) - \frac {\dot {\beta} (t) \alpha (t)}{\beta (t)}\right) x _ {0} + \frac {\dot {\beta} (t)}{\beta (t)} x _ {t} \mid x _ {t} = x \right], \tag {B.5} \\ = \left(\dot {\alpha} (t) - \frac {\dot {\beta} (t) \alpha (t)}{\beta (t)}\right) \mathbb {E} [ x _ {0} \mid x _ {t} = x ] + \frac {\dot {\beta} (t)}{\beta (t)} x, \\ = \alpha (t) \left(\frac {\dot {\beta} (t) \alpha (t)}{\beta (t)} - \dot {\alpha} (t)\right) s (x, t) + \frac {\dot {\beta} (t)}{\beta (t)} x, \\ \end{array} +$$ + +so that $b(x,t)$ can be entirely re-written in terms of the score $s(x,t)$ . This shows that the $\mathcal{F}_1$ -norm of $b(x,t)$ is the same as the $\mathcal{F}_1$ -norm of $s(x,t)$ up to time-scaling and an additive $O(D)$ term coming from the linear term. Hence, similar sample complexity bounds which we derive in Section 3 for learning score models can also be shown for learning the drift field $b(x,t)$ . + +# C PRELIMINARY RESULTS + +We first make explicit the relation between the score matching error $\mathcal{R}_t$ and the denoising loss $\mathcal{L}_t$ . In the sequel, we will make frequent use of Tweedie's formula (see e.g. Efron, 2011): + +$$ +\nabla \log p _ {t} (x _ {t}) = \mathbb {E} \left[ \nabla \log q _ {t} (x _ {t} | x _ {0}) | x _ {t} \right], \quad \nabla \log q _ {t} (x _ {t} | x _ {0}) := \frac {m _ {t} x _ {0} - x _ {t}}{\sigma_ {t} ^ {2}}. +$$ + +Fact C.1 (DSM loss minimizes score). We have that for all sufficiently regular $s:\mathbb{R}^D\mapsto \mathbb{R}^D$ .. + +$$ +\mathcal {R} _ {t} (s) = \mathcal {L} _ {t} (s) - C _ {t}, \tag {C.1} +$$ + +where the offset constant $C_t$ is given by: + +$$ +C _ {t} := \mathbb {E} \operatorname {t r} \operatorname {C o v} \left(\frac {m _ {t} x _ {0} - x _ {t}}{\sigma_ {t} ^ {2}} \mid x _ {t}\right). +$$ + +Furthermore, we can bound $C_t$ by: + +$$ +C _ {t} \leqslant D / \sigma_ {t} ^ {2}. +$$ + +Proof. The standard proof for denoising score matching (see e.g. Vincent, 2011, Section 4.2) shows that for all $s$ : + +$$ +\mathcal {R} _ {t} (f) = \mathcal {L} _ {t} (f) + \mathbb {E} _ {\left(x _ {0}, x _ {t}\right)} \left[ \| \nabla \log p _ {t} \left(x _ {t}\right) \| ^ {2} - \| \nabla \log q _ {t} \left(x _ {t} \mid x _ {0}\right) \| ^ {2} \right]. +$$ + +Hence, + +$$ +\begin{array}{l} \mathbb {E} _ {\left(x _ {0}, x _ {t}\right)} \left[ \| \nabla \log p _ {t} \left(x _ {t}\right) \| ^ {2} - \| \nabla \log q _ {t} \left(x _ {t} \mid x _ {0}\right) \| ^ {2} \right] \\ = \mathbb {E} _ {\left(x _ {0}, x _ {t}\right)} \left[ \left\| \mathbb {E} \left[ \frac {m _ {t} x _ {0} - x _ {t}}{\sigma_ {t} ^ {2}} \mid x _ {t} \right] \right\| ^ {2} - \left\| \frac {m _ {t} x _ {0} - x _ {t}}{\sigma_ {t} ^ {2}} \right\| ^ {2} \right] \\ = - \mathbb {E} \mathbb {E} \left[ \left\| \frac {m _ {t} x _ {0} - x _ {t}}{\sigma_ {t} ^ {2}} \right\| ^ {2} - \left\| \mathbb {E} \left[ \frac {m _ {t} x _ {0} - x _ {t}}{\sigma_ {t} ^ {2}} \mid x _ {t} \right] \right\| ^ {2} \mid x _ {t} \right] \\ = - \mathbb {E} \operatorname {t r} \operatorname {C o v} \left(\frac {m _ {t} x _ {0} - x _ {t}}{\sigma_ {t} ^ {2}} \mid x _ {t}\right) \\ = - C _ {t}. \\ \end{array} +$$ + +To bound $C_t$ , we observe: + +$$ +C _ {t} = \mathbb {E} \operatorname {t r} \operatorname {C o v} \left(\frac {m _ {t} x _ {0} - x _ {t}}{\sigma_ {t} ^ {2}} \mid x _ {t}\right) = \mathbb {E} \operatorname {t r} \operatorname {C o v} \left(\frac {w}{\sigma_ {t}} \mid x _ {t}\right) \leqslant \mathbb {E} \| w / \sigma_ {t} \| ^ {2} = D / \sigma_ {t} ^ {2}. +$$ + +![](images/d82551f7f1d9ab76b0e575f7352f618e0823f0d44c801afde3cd8d5005ea4128.jpg) + +We next state a result from Benton et al. (2024) regarding the quality of the samples generated via the exponential integrator scheme (3.4). + +Lemma C.2 (Sampler quality from $L_{2}$ score bounds (Benton et al., 2024, Theorem 2)). Fix a $T \geqslant 1$ and $\zeta \in (0,1)$ . Also fix an $N \in \mathbb{N}_{+}$ which is even and satisfies $N \geqslant 2\log(1/\zeta)$ . Define a sequence of strictly increasing backwards process times $\{\tau_i\}_{i=0}^N$ : + +$$ +\tau_ {i} = \left\{ \begin{array}{l l} 2 (T - 1) \frac {i}{N} & \text {i f} i \in \{0, \dots , N / 2 \}, \\ T - \zeta^ {2 i / N - 1} & \text {i f} i \in \{N / 2 + 1, \dots , N \}. \end{array} \right. \tag {C.2} +$$ + +Let $\gamma_{i} := \tau_{i+1} - \tau_{i}$ for $i \in \{0, \dots, N-1\}$ . Suppose we have $N$ score functions $\hat{s}_{t}(x)$ for $t \in \{T - \tau_{i}\}_{i=0}^{N-1}$ which satisfy: + +$$ +\sum_ {i = 0} ^ {N - 1} \gamma_ {i} \mathbb {E} _ {p _ {T} - \tau_ {i}} \| \hat {s} _ {T - \tau_ {i}} - \nabla \log p _ {T - \tau_ {i}} \| ^ {2} \leqslant \varepsilon_ {\text {s c o r e}} ^ {2}. \tag {C.3} +$$ + +Then, we have the following guarantee for the exponential integrator (3.4): + +$$ +\mathrm {K L} (p _ {\zeta} \parallel \mathrm {L a w} (\hat {y} _ {T - \zeta})) \lesssim \varepsilon_ {\mathrm {s c o r e}} ^ {2} + \kappa^ {2} D N + \kappa (D T + \mu_ {0} ^ {2}) + (D + \mu_ {0} ^ {2}) e ^ {- 2 T}, +$$ + +where $\kappa, \mu_0$ are defined as: + +$$ +\kappa := \frac {2 (T - 1) + 4 \log (1 / \zeta)}{N}, \quad \mu_ {0} := \mathbb {E} \| x _ {0} \| ^ {2}. +$$ + +Proof. In order to apply Benton et al. (2024, Theorem 2), we need to compute a $\kappa$ such that: + +$$ +\gamma_ {k} \leqslant \kappa \min \{1, T - t _ {k + 1} \}, \quad \forall k \in \{0, \dots , N - 1 \}. +$$ + +To do this, we follow the proof of Benton et al. (2024, Corollary 1). First, for $k \in \{0, \dots, N/2 - 1\}$ , we have that $t_{k+1} \leqslant T - 1$ , and hence $T - t_{k+1} \geqslant T - (T - 1) = 1$ . Hence, we can simply take $\kappa \geqslant 2(T - 1)/N$ . Now, for $k \in \{N/2, \dots, N - 1\}$ , we have that $t_{k+1} \geqslant T - 1$ , and therefore $T - t_{k+1} \leqslant T - (T - 1) = 1$ . Hence we need a $\kappa$ such that $\gamma_k \leqslant \kappa (T - t_{k+1})$ . We therefore compute: + +$$ +\zeta^ {2 k / N - 1} - \zeta^ {2 (k + 1) / N - 1} = \gamma_ {k} \leqslant \kappa (T - t _ {k + 1}) = \kappa \zeta^ {2 (k + 1) / N - 1}. +$$ + +From this we see that $\kappa \geqslant \zeta^{-2 / N} - 1$ is required. A sufficient condition takes: + +$$ +\begin{array}{l} \zeta^ {- 2 / N} - 1 = \exp \left(\frac {2}{N} \log (1 / \zeta)\right) - 1 \\ \leqslant 1 + (e - 1) \frac {2}{N} \log (1 / \zeta) - 1 \quad \text {s i n c e} e ^ {x} \leqslant 1 + (e - 1) x \text {f o r} x \in [ 0, 1 ] \\ \leqslant \frac {4 \log (1 / \zeta)}{N}. \\ \end{array} +$$ + +Hence, in total we can set: + +$$ +\kappa = \frac {2 (T - 1) + 4 \log (1 / \zeta)}{N}. +$$ + +The result now follows from invoking Benton et al. (2024, Theorem 2). + +![](images/40442a4988e577da6a69e96a298fc72c09fc70aa05f4d064332016fe356c3bbf.jpg) + +Note that an immediate consequence of Lemma C.2 is the following observation: for any $\varepsilon \in (0,1)$ , setting + +$$ +T = c _ {0} \log \left(\frac {\sqrt {D} \vee \mu_ {0}}{\varepsilon}\right), \quad N = 2 \left\lceil c _ {1} \frac {D \vee \mu_ {0} ^ {2}}{\varepsilon^ {2}} \left[ \log^ {2} \left(\frac {\sqrt {D} \vee \mu_ {0}}{\varepsilon}\right) + \log^ {2} \left(\frac {1}{\zeta}\right)\right]\right\rceil , +$$ + +for some universal positive constants $c_{0}, c_{1}$ , we have that + +$$ +\mathrm {K L} (p _ {\zeta} \parallel \mathrm {L a w} (\hat {y} _ {T - \zeta})) \lesssim \varepsilon_ {\mathrm {s c o r e}} ^ {2} + \varepsilon^ {2}. +$$ + +Next, we state a technical lemma regarding a perturbation result for Gaussian mollifications at small scale. + +Lemma C.3 (Score function perturbation (Lee et al., 2023, Lemma C.12)). Suppose that $p(x)$ is a density on $\mathbb{R}^d$ such that $\nabla \log p(x)$ is $L$ -Lipschitz on $\mathbb{R}^d$ . For $\alpha \geqslant 1$ , define the corresponding density $p_{\alpha}(x) \coloneqq \alpha^d p(\alpha x)$ . Let $\gamma_{\sigma^2}$ denote an $\mathsf{N}(0,\sigma^2 I_d)$ distribution. If $L \leqslant 1 / (2\alpha^2\sigma^2)$ , then we have the following bound for all $x \in \mathbb{R}^d$ : + +$$ +\begin{array}{l} \left\| \nabla \log p (x) - \nabla \log p _ {\alpha} * \gamma_ {\sigma^ {2}} (x) \right\| \\ \leqslant 6 \alpha^ {2} L \sigma \sqrt {d} + (\alpha + 2 \alpha^ {3} L \sigma^ {2}) (\alpha - 1) L \| x \| + (\alpha - 1 + 2 \alpha^ {3} L \sigma^ {2}) \| \nabla \log p (x) \|. \\ \end{array} +$$ + +The previous mollification lemma is next used to bound the score functions uniformly over time. + +Proposition C.4. Consider a forward diffusion process $z_{t} \stackrel{\mathrm{d}}{=} m_{t}z_{0} + \sigma_{t}w$ on $\mathbb{R}^d$ . Let $\pi_t$ denote the marginal distribution of $z_{t}$ for all $t \geqslant 0$ . Suppose that $\nabla \log \pi_t$ is $L$ -Lipschitz (for $L \geqslant 1$ ) on $\mathbb{R}^d$ for all $t \geqslant 0$ . Defining $\bar{L} := cL(\mathbb{E}\|z_0\| + \sqrt{d} + \| \nabla \log \pi_0(0)\|)$ where $c \geqslant 1$ is an universal constant, we have that for all $t \geqslant 0$ and $z \in \mathbb{R}^d$ , + +$$ +\left\| \nabla \log \pi_ {t} (z) \right\| \leqslant \bar {L} (1 + \| z \|). +$$ + +Proof. Define $\bar{\pi}_t(z) \coloneqq m_t^{-d}\pi_0(m_t^{-1}z)$ , which is the density of the random variable $m_t z_0$ . Hence, we have that $\pi_t = \bar{\pi}_t * \gamma_{\sigma_t^2}$ . By Lemma C.3, whenever $L \leqslant m_t^2 / (2\sigma_t^2)$ , we have that: + +$$ +\| \nabla \log \pi_ {t} (0) \| \leqslant 6 m _ {t} ^ {- 2} L \sigma_ {t} \sqrt {d} + \left(m _ {t} ^ {- 1} + 2 m _ {t} ^ {- 3} L \sigma_ {t} ^ {2}\right) \| \nabla \log \pi_ {0} (0) \|. +$$ + +We now compute the range of $t$ 's for which $L \leqslant m_t^2 / (2\sigma_t^2)$ holds. Using the specific form of $m_t, \sigma_t$ , + +$$ +2 L \leqslant \frac {m _ {t} ^ {2}}{\sigma_ {t} ^ {2}} = \frac {\exp (- 2 t)}{1 - \exp (- 2 t)} = \frac {1}{\exp (2 t) - 1} \Longleftrightarrow t \leqslant \frac {1}{2} \log \left(1 + \frac {1}{2 L}\right) =: t _ {\star}. +$$ + +First, note that since we assume $L \geqslant 1$ , then we have that $t_\star$ is bounded by a universal constant. Hence, for $t \leqslant t_\star$ , + +$$ +\| \nabla \log \pi_ {t} (0) \| \lesssim L (\sqrt {d} + \| \nabla \log \pi_ {0} (0) \)). +$$ + +Hence for any $z$ + +$$ +\begin{array}{l} \left\| \nabla \log \pi_ {t} (z) \right\| \leqslant L \| z \| + \left\| \nabla \log \pi_ {t} (0) \right\| \\ \leqslant L \| z \| + c L (\sqrt {d} + \| \nabla \log \pi_ {0} (0) \|) \\ \leqslant c L (\sqrt {d} + \| \nabla \log \pi_ {0} (0) \|) (1 + \| z \|). \\ \end{array} +$$ + +On the other hand, when $t \geqslant t_{\star}$ , more work is needed. When $t \geqslant t_{\star}$ , we first bound: + +$$ +\sigma_ {t} ^ {- 1} \leqslant \sigma_ {t _ {\star}} ^ {- 1} = \sqrt {2 L + 1}. +$$ + +Define two events: + +$$ +\mathcal {E} _ {1} := \left\{\mathbb {E} [ \| w \| / \sigma_ {t} \mid z _ {t} ] \geqslant 4 \sqrt {d} / \sigma_ {t} \right\}, \quad \mathcal {E} _ {2} := \left\{\| z _ {t} \| \geqslant 4 (\mathbb {E} \| z _ {0} \| + \sigma_ {t} \sqrt {d}) \right\} +$$ + +By Markov's inequality we have that: + +$$ +\mathbb {P} _ {z _ {t}} \left\{\mathcal {E} _ {1} \right\} \leqslant 1 / 4, \quad \mathbb {P} _ {z _ {t}} \left\{\mathcal {E} _ {2} \right\} \leqslant 1 / 4. +$$ + +Now suppose that $\mathcal{E}_1^c\subseteq \mathcal{E}_2$ . Then, we have a contradiction, since: + +$$ +1 - 1 / 4 \leqslant \mathbb {P} _ {z _ {t}} \left\{\mathcal {E} _ {1} ^ {c} \right\} \leqslant \mathbb {P} _ {z _ {t}} \left\{\mathcal {E} _ {2} \right\} \leqslant 1 / 4. +$$ + +Hence, there must exist an $\omega \in \mathcal{E}_1^c$ such that $\omega \notin \mathcal{E}_2$ . Hence, there exists a $\bar{z}_t$ satisfying: + +$$ +\| \nabla \log \pi_ {t} (\bar {z} _ {t}) \| \leqslant \mathbb {E} [ \| w \| / \sigma_ {t} \mid z _ {t} = \bar {z} _ {t} ] \leqslant 4 \sqrt {d} / \sigma_ {t}, \quad \| \bar {z} _ {t} \| \leqslant 4 (\mathbb {E} \| z _ {0} \| + \sigma_ {t} \sqrt {d}). +$$ + +Hence for any $z$ + +$$ +\begin{array}{l} \left\| \nabla \log \pi_ {t} (z) \right\| \leqslant L \| z - \bar {z} _ {t} \| + \left\| \nabla \log \pi_ {t} (\bar {z} _ {t}) \right\| \\ \leqslant L \| z \| + 4 L \left(\mathbb {E} \| z _ {0} \| + \sigma_ {t} \sqrt {d}\right) + 4 \sqrt {d} / \sigma_ {t} \\ \leqslant L \| z \| + 4 L (\mathbb {E} \| z _ {0} \| + \sqrt {d}) + 4 \sqrt {(2 L + 1) d} \\ \leqslant c ^ {\prime} L (\mathbb {E} \| z _ {0} \| + \sqrt {d}) (1 + \| z \|). \\ \end{array} +$$ + +![](images/1cadfc68a4d8cb17ca329fb2f9d5dab59865ada1e9f088b188d6e73c7918cbfa.jpg) + +Next, we state a $L_{\infty}$ approximation result for scalar-valued Lipschitz function from Bach (2017). + +Lemma C.5 ( $L_{\infty}$ approximation of scalar Lipschitz functions (Bach, 2017, Proposition 6)). Let $f: \mathbb{R}^d \mapsto \mathbb{R}$ . Suppose that $f$ is $L$ -Lipschitz and $B$ -bounded on $B_2(d, M)$ . Set $K := B \vee LM$ . For any $\gamma \geqslant O_d(1) \cdot K$ there exists an $f_\gamma \in \mathcal{F}_1$ such that $\| f_\gamma \|_{\mathcal{F}_1} \leqslant \gamma$ and: + +$$ +\sup _ {x \in B _ {2} (d, M)} | f (x) - f _ {\gamma} (x) | \leqslant O _ {d} (1) K \left(\frac {K}{\gamma}\right) ^ {2 / (d + 1)} \log \left(\frac {\gamma}{K}\right). +$$ + +Our next result is a simple technical fact which we will utilize in our truncation analysis. + +Proposition C.6. Let $S, \tilde{S}$ be two $X$ -valued random variables over the same probability space. Let $f: X \mapsto \mathbb{R}$ be a measurable function. We have: + +$$ +\mathbb {E} [ f (S) ] \leqslant \mathbb {E} [ f (\check {S}) ] + (\sqrt {\mathbb {E} [ f ^ {2} (S) ]} + \sqrt {\mathbb {E} [ f ^ {2} (\check {S}) ]}) \sqrt {\mathbb {P} \{S \neq \check {S} \}}. +$$ + +Note if $f$ is non-negative, then we have the simpler bound: + +$$ +\mathbb {E} [ f (S) ] \leqslant \mathbb {E} [ f (\check {S}) ] + \sqrt {\mathbb {E} [ f ^ {2} (S) ] \mathbb {P} \{S \neq \check {S} \}}. +$$ + +Proof. We have: + +$$ +\begin{array}{l} \mathbb {E} [ f (S) ] = \mathbb {E} [ f (S) \mathbf {1} \{S = \check {S} \} ] + \mathbb {E} [ f (S) \mathbf {1} \{S \neq \check {S} \} ] \\ = \mathbb {E} [ f (\tilde {S}) \mathbf {1} \{S = \tilde {S} \} ] + \mathbb {E} [ f (S) \mathbf {1} \{S \neq \tilde {S} \} ] \\ = \mathbb {E} [ f (\breve {S}) ] + \mathbb {E} [ f (S) \mathbf {1} \{S \neq \breve {S} \} ] - \mathbb {E} [ f (\breve {S}) \mathbf {1} \{S \neq \breve {S} \} ] \\ \leqslant \mathbb {E} [ f (\check {S}) ] + \sqrt {\mathbb {E} [ f ^ {2} (S) ] \mathbb {P} \{S \neq \check {S} \}} + \sqrt {\mathbb {E} [ f ^ {2} (\check {S}) ] \mathbb {P} \{S \neq \check {S} \}}. \\ \end{array} +$$ + +![](images/2e1724ca6533c6eb3e5e0f9d7dd6cd74feffaa7c1f6fb18bbef66a1c88973f6f.jpg) + +The next result is a simple algebraic fact which will be useful for solving for implicit inequalities involving logarithms. + +Proposition C.7 (Log dominance rule, (see e.g. Du et al., 2021, Lemma F.2)). Let $a, b, \nu$ be positive scalars. Put $\bar{\nu} \coloneqq (1 + \nu)^{\nu}$ . Then, + +$$ +m \geqslant \bar {\nu} a \log^ {\nu} (\bar {\nu} a b) \Longrightarrow m \geqslant a \log^ {\nu} (b m). +$$ + +Next, we have an intermediate result to bound the Rademacher complexity of $\mathcal{F}_1$ -norm bounded functions. + +Proposition C.8. Let $\| x_{i} \| \leqslant 1$ for $i \in [n]$ . We have: + +$$ +\mathbb {E} _ {\{\varepsilon_ {i} \}} \sup _ {u, v \in B _ {2} (D)} \left| \frac {1}{n} \sum_ {i = 1} ^ {n} \langle u, \varepsilon_ {i} \rangle \sigma (\langle v, x \rangle) \right| \leqslant c \sqrt {\frac {D}{n}}, +$$ + +where the $\varepsilon_{i}\in \{\pm 1\}^{d}$ are independent Rademacher random vectors and $c > 0$ is a universal constant. + +Proof. Define $X_{u,v} \coloneqq \frac{1}{n}\sum_{i = 1}^{n}\langle u,\varepsilon_i\rangle \sigma (\langle v,x\rangle)$ . Observe that for $u_{i},v_{i}\in B_{2}(D)$ for $i\in \{1,2\}$ , + +$$ +\begin{array}{l} X _ {u _ {1}, v _ {1}} - X _ {u _ {2}, v _ {2}} = \frac {1}{n} \sum_ {i = 1} ^ {n} [ \sigma (\langle v _ {1}, x _ {i} \rangle) - \sigma (\langle v _ {2}, x _ {i} \rangle) ] \langle u _ {1}, \varepsilon_ {i} \rangle + \frac {1}{n} \sum_ {i = 1} ^ {n} \sigma (\langle v _ {2}, x _ {i} \rangle) \langle u _ {1} - u _ {2}, \varepsilon_ {i} \rangle \\ =: T _ {1} + T _ {2}. \\ \end{array} +$$ + +First, we recall that a Rademacher random variable is 1-sub-Gaussian, and therefore $\langle u_i,\varepsilon_i\rangle$ is also 1-sub-Gaussian since $\| u_{i}\| \leqslant 1$ . Using the fact that ReLU is 1-Lipschitz followed by Cauchy-Schwarz and the assumption that $\| x_{i}\| \leqslant 1$ , + +$$ +\left| \sigma \left(\left\langle v _ {1}, x _ {i} \right\rangle\right) - \sigma \left(\left\langle v _ {2}, x _ {i} \right\rangle\right) \right| \leqslant \left| \left\langle v _ {1} - v _ {2}, x _ {i} \right\rangle \right| \leqslant \| v _ {1} - v _ {2} \|. +$$ + +Hence, $[\sigma(\langle v_1, x_i \rangle) - \sigma(\langle v_2, x_i \rangle)]\langle u_1, \varepsilon_i \rangle$ is $\|v_1 - v_2\|$ -sub-Gaussian. Consequently, $T_1$ is $\|v_1 - v_2\| / \sqrt{n}$ -sub-Gaussian. Similarly, since $|\sigma(\langle v_2, x_i \rangle)| \leqslant 1$ , we also have that $T_2$ is $\|u_1 - u_2\| / \sqrt{n}$ -sub-Gaussian. Hence, the sum $T_1 + T_2$ is sub-Gaussian with constant: + +$$ +\sqrt {2 (\| v _ {1} - v _ {2} \| ^ {2} + \| u _ {1} - u _ {2} \| ^ {2})} / \sqrt {n}. +$$ + +Letting $\omega = (u,v)$ , we consider the following metric on $\Omega \coloneqq B_2(D) \times B_2(D)$ : + +$$ +d \left(\left(u _ {1}, v _ {1}\right), \left(u _ {2}, v _ {2}\right)\right) = \sqrt {\left\| u _ {1} - u _ {2} \right\| ^ {2} + \left\| v _ {1} - v _ {2} \right\| ^ {2}}. +$$ + +Hence for any $\omega_{1},\omega_{2}\in \Omega$ , the difference $X_{\omega_1} - X_{\omega_2}$ is $\sqrt{2 / n}\cdot d(\omega_1,\omega_2)$ -sub-Gaussian. Therefore we can use Dudley's inequality (see e.g. Vershynin, 2018, Chapter 8) to bound: + +$$ +\mathbb {E} \sup _ {\omega \in \Omega} X _ {\omega} \leqslant c n ^ {- 1 / 2} \int_ {0} ^ {\infty} \sqrt {\log N (\varepsilon ; \Omega , d)} \mathrm {d} \varepsilon = c n ^ {- 1 / 2} \int_ {0} ^ {\sqrt {2}} \sqrt {\log N (\varepsilon ; \Omega , d)} \mathrm {d} \varepsilon . +$$ + +Next, fix an $\varepsilon > 0$ and let $\{u_i\}, \{v_i\}$ be $\varepsilon / \sqrt{2}$ -covers of $B_2(D)$ . Let $[u]$ (resp. $[v]$ ) denote the closest point in the cover to $u$ (resp. $v$ ). Given $(u, v) \in \Omega$ , we have: + +$$ +d ((u, v), ([ u ], [ v ])) = \sqrt {\| u - [ u ] \| ^ {2} + \| v - [ v ] ^ {2} \|} \leqslant \varepsilon . +$$ + +Using the standard volume estimate of the covering of $B_{2}(D)$ (see e.g. Vershynin, 2018, Chapter 4), + +$$ +\log N (\varepsilon ; \Omega , d) \leqslant 2 D \log (1 + 2 \sqrt {2} / \varepsilon). +$$ + +Consequently, + +$$ +\mathbb {E} \sup _ {\omega \in \Omega} X _ {w} \leqslant c n ^ {- 1 / 2} \sqrt {2 D} \int_ {0} ^ {\sqrt {2}} \sqrt {\log (1 + 2 \sqrt {2} / \varepsilon)} \mathrm {d} \varepsilon = c ^ {\prime} \sqrt {D / n}. +$$ + +![](images/ba3a1d6153663abee77c4c34663fec08868f6b9a68ff3e383be7984262e3dcdf.jpg) + +Our final preliminary result translates the previous bound Proposition C.8 to a bound on the Rademacher complexity of $\mathcal{F}_1$ -norm balls. + +Proposition C.9. Let $\mathcal{F} = \{s : \mathbb{R}^d \mapsto \mathbb{R}^d \mid \| s \|_{\mathcal{F}_1} \leqslant R\}$ . For any $\check{x}_i \in B_2(D, M)$ , $i \in [n]$ , we have: + +$$ +\mathbb {E} _ {\left\{\varepsilon_ {i} \right\}} \sup _ {f \in \mathcal {F}} n ^ {- 1} \left| \sum_ {i = 1} ^ {n} \langle \varepsilon_ {i}, f (\check {x} _ {i}) \rangle \right| \leqslant c R M \sqrt {\frac {D}{n}}, +$$ + +where the $\varepsilon_{i}\in \{\pm 1\}^{d}$ are independent Rademacher random vectors and $c > 0$ is a universal constant. + +Proof. For any $\{\varepsilon_i\}$ and $f\in \mathcal{F}$ , observe that by the definition of $\mathcal{F}_1$ : + +$$ +\begin{array}{l} n ^ {- 1} \left| \sum_ {i = 1} ^ {n} \langle \varepsilon_ {i}, f (\check {x} _ {i}) \rangle \right| = n ^ {- 1} \left| \sum_ {i = 1} ^ {n} \left\langle \varepsilon_ {i}, \int u \sigma (\langle v, \check {x} _ {i} \rangle) d \mu (u, v) \right\rangle \right| \\ = \left| \int \left[ \frac {1}{n} \sum_ {i = 1} ^ {n} \langle \varepsilon_ {i}, u \rangle \sigma (\langle v, \check {x} _ {i} \rangle) \right] d \mu (u, v) \right| \\ \leqslant R \sup _ {u, v \in \mathbb {S} ^ {D - 1}} \left| \frac {1}{n} \sum_ {i = 1} ^ {n} \langle \varepsilon_ {i}, u \rangle \sigma (\langle v, \check {x} _ {i} \rangle) \right|. \\ \end{array} +$$ + +Hence, + +$$ +\mathbb {E} _ {\{\varepsilon_ {i} \}} \sup _ {f \in \mathcal {F}} n ^ {- 1} \left| \sum_ {i = 1} ^ {n} \langle \varepsilon_ {i}, f (\check {x} _ {i}) \rangle \right| \leqslant R \cdot \mathbb {E} _ {\{\varepsilon_ {i} \}} \sup _ {u, v \in \mathbb {S} ^ {D - 1}} \left| \frac {1}{n} \sum_ {i = 1} ^ {n} \langle \varepsilon_ {i}, u \rangle \sigma (\langle v, \check {x} _ {i} \rangle) \right|, +$$ + +from which the claim follows by Proposition C.8 and using homogeneity of ReLU to scale the data points $\check{x}_i$ to $B_{2}(D)$ . + +# D $\mathcal{F}_1$ APPROXIMATION THEORY FOR LIPSCHITZ CONTINUOUS FUNCTIONS + +Here we develop the necessary results to establish that $\mathcal{F}_1$ functions can approximate structured score functions in an efficient way. Our first result is a preliminary result that allows us to translate $L_{\infty}$ approximation bounds to $L_{2}$ bounds. For what follows, let the notation $\mathcal{P}(\mathsf{X})$ denote the set of subsets of $\mathsf{X}$ . + +Proposition D.1. Let $M:(0,1)\mapsto \mathcal{P}(\mathbb{R}^D)$ be such that: + +$$ +\forall \delta \in (0, 1), \quad \mathbb {P} _ {x _ {t} \sim p _ {t}} \left\{x _ {t} \in M (\delta) \right\} \geqslant 1 - \delta . +$$ + +Suppose that $R(\varepsilon, \delta)$ satisfies the following condition: for any positive $\varepsilon > 0$ and $\delta \in (0,1)$ there exists a function $\hat{s} : \mathbb{R}^D \mapsto \mathbb{R}^D$ such that + +$$ +\| \hat {s} \| _ {\mathcal {F} _ {1}} \leqslant R (\varepsilon , \delta), \quad \sup _ {x \in M (\delta)} \| \hat {s} (x) - \nabla \log p _ {t} (x) \| \leqslant \varepsilon . \tag {D.1} +$$ + +Suppose there exists a $\delta \in (0,1)$ satisfying: + +$$ +R ^ {4} (\varepsilon / 2, \delta) \cdot \delta \leqslant c _ {0} \varepsilon^ {4} / \mathbb {E} \| x _ {t} \| ^ {4}, \quad \delta \leqslant c _ {1} (\varepsilon \sigma_ {t}) ^ {4} / D ^ {2}. \tag {D.2} +$$ + +Above, both $c_{0}, c_{1}$ are universal positive constants. Then, there exists an $\hat{s}:\mathbb{R}^{D}\mapsto \mathbb{R}^{D}$ such that: + +$$ +\left\| \hat {s} \right\| _ {\mathcal {F} _ {1}} \leqslant R (\varepsilon / 2, \delta), \quad \left\| \hat {s} - \nabla \log p _ {t} \right\| _ {L _ {2} \left(p _ {t}\right)} \leqslant \varepsilon . \tag {D.3} +$$ + +Proof. Let $\mathcal{E}_G\coloneqq \{x_t\in M(\delta)\}$ . By assumption, we have that $\mathbb{P}(\mathcal{E}_G)\geqslant 1 - \delta$ . Put $s_{\star}\coloneqq \nabla \log p_t$ and let $\hat{s}:\mathbb{R}^D\mapsto \mathbb{R}^D$ be as guaranteed by the assumption such that: + +$$ +\| \hat{s}\|_{\mathcal{F}_{1}}\leqslant R(\varepsilon /2,\delta),\quad \sup_{x\in M(\delta)}\| \hat{s} (x) - s_{\star}(x)\| \leqslant \varepsilon /2. +$$ + +Hence, + +$$ +\begin{array}{l} \mathbb {E} _ {x _ {t}} \left\| \hat {s} - s _ {\star} \right\| ^ {2} = \mathbb {E} _ {x _ {t}} \left\| \hat {s} - s _ {\star} \right\| ^ {2} \mathbf {1} \{\mathcal {E} _ {G} \} + \mathbb {E} _ {x _ {t}} \left\| \hat {s} - s _ {\star} \right\| ^ {2} \mathbf {1} \{\mathcal {E} _ {G} ^ {c} \} \\ \leqslant \sup _ {x \in M (\delta)} \| \hat {s} (x) - s _ {\star} (x) \| ^ {2} + \sqrt {\mathbb {E} _ {x _ {t}} \| \hat {s} - s _ {\star} \| ^ {4}} \cdot \sqrt {\delta} \\ \leqslant \left(\varepsilon / 2\right) ^ {2} + \sqrt {\mathbb {E} _ {x _ {t}} \left\| \hat {s} - s _ {\star} \right\| ^ {4}} \cdot \sqrt {\delta}. \\ \end{array} +$$ + +Consequently, by taking square root of both sides: + +$$ +\left\| \hat {s} - s _ {\star} \right\| _ {L _ {2} \left(p _ {t}\right)} \leqslant \varepsilon / 2 + \left\| \hat {s} - s _ {\star} \right\| _ {L _ {4} \left(p _ {t}\right)} \cdot \delta^ {1 / 4}. +$$ + +Let us now control $\| \hat{s} - s_{\star}\|_{L_4(p_t)}$ . By triangle inequality and $\| \hat{s}(x)\| \leqslant \| \hat{s}\|_{\mathcal{F}_1}\| x\|$ for all $x$ : + +$$ +\begin{array}{l} \left\| \hat {s} - s _ {\star} \right\| _ {L _ {4} \left(p _ {t}\right)} \leqslant \left\| \hat {s} \right\| _ {L _ {4} \left(p _ {t}\right)} + \left\| s _ {\star} \right\| _ {L _ {4} \left(p _ {t}\right)} \\ \leqslant \| \hat {s} \| _ {\mathcal {F} _ {1}} \| x _ {t} \| _ {L _ {4} (p _ {t})} + \| s _ {\star} \| _ {L _ {4} (p _ {t})} \\ \leqslant R (\varepsilon / 2, \delta) \| x _ {t} \| _ {L _ {4} (p _ {t})} + \| s _ {\star} \| _ {L _ {4} (p _ {t})}. \\ \end{array} +$$ + +To control $\| s_{\star}\|_{L_4(p_t)}$ , we use Tweedie's formula: + +$$ +\nabla \log p _ {t} (x _ {t}) = \mathbb {E} \left[ \frac {m _ {t} x _ {0} - x _ {t}}{\sigma_ {t} ^ {2}} \Bigg | x _ {t} \right] = - \frac {\mathbb {E} [ w \mid x _ {t} ]}{\sigma_ {t}}. +$$ + +Hence by Jensen's inequality and the tower property, + +$$ +\| s _ {\star} \| _ {L _ {4} (p _ {t})} ^ {4} = \mathbb {E} \| \nabla \log p _ {t} (x _ {t}) \| ^ {4} = \frac {1}{\sigma_ {t} ^ {4}} \mathbb {E} \| \mathbb {E} [ w \mid x _ {t} ] \| ^ {4} \leqslant \frac {1}{\sigma_ {t} ^ {4}} \mathbb {E} \| w \| ^ {4} \leqslant \frac {3 D ^ {2}}{\sigma_ {t} ^ {4}}. +$$ + +Combining these calculations, + +$$ +\| \hat {s} - s _ {\star} \| _ {L _ {4} (p _ {t})} \leqslant R (\varepsilon / 2, \delta) \| x _ {t} \| _ {L _ {4} (p _ {t})} + \frac {3 ^ {1 / 4} \sqrt {D}}{\sigma_ {t}}. +$$ + +Hence, + +$$ +\| \hat {s} - s _ {\star} \| _ {L _ {2} (p _ {t})} \leqslant \varepsilon / 2 + \left[ R (\varepsilon / 2, \delta) \| x _ {t} \| _ {L _ {4} (p _ {t})} + \frac {3 ^ {1 / 4} \sqrt {D}}{\sigma_ {t}} \right] \cdot \delta^ {1 / 4} +$$ + +Hence, if we set $\delta$ such that: + +$$ +R (\varepsilon / 2, \delta) \| x _ {t} \| _ {L _ {4} (p _ {t})} \cdot \delta^ {1 / 4} \leqslant \varepsilon / 4, \quad \frac {3 ^ {1 / 4} \sqrt {D}}{\sigma_ {t}} \cdot \delta^ {1 / 4} \leqslant \varepsilon / 4, +$$ + +then we conclude that $\| \hat{s} - s_{\star} \|_{L_2(p_t)} \leqslant \varepsilon$ . + +![](images/d9d24c505bb720dbb80f9e0b4c4b3f9d9da739da78d1b2a21e8a96ff33c1b85f.jpg) + +We next turn to our main $L_{\infty}$ approximation result for Lipschitz functions. We proceed in two steps. First, we extend Lemma C.5 to vector-valued Lipschitz functions in a straightforward way. Then, we use the log dominance rule to invert the result. For the first step, we have the following result. + +Proposition D.2. Let $f: \mathbb{R}^d \mapsto \mathbb{R}^d$ . Suppose that $f$ is $L$ -Lipschitz and $B$ -bounded on $B_2(d, M)$ . Set $K_d := d \cdot (B \lor LM)$ . For any $\gamma \geqslant O_d(1) \cdot K_d$ , there exists an $f_\gamma \in \mathcal{F}_1$ such that $\| f_\gamma \|_{\mathcal{F}_1} \leqslant \gamma$ and: + +$$ +\sup _ {x \in B _ {2} (d, M)} \| f (x) - f _ {\gamma} (x) \| \leqslant O _ {d} (1) K _ {d} \left(\frac {K _ {d}}{\gamma}\right) ^ {2 / (d + 1)} \log \left(\frac {\gamma}{K _ {d}}\right). \tag {D.4} +$$ + +Proof. For $i \in [d]$ , let $f_{i}(x) \coloneqq \langle e_{i}, f(x) \rangle$ , where $e_{i} \in \mathbb{R}^{d}$ is the $i$ -th standard basis vector. We will apply Lemma C.5 to each of the $f_{i}$ 's. Note that each $f_{i}$ is also $L$ -Lipschitz and $B$ -bounded on $B_{2}(d, M)$ . Hence, for every $i \in [d]$ there exists an $f_{\gamma, i} \in \mathcal{F}_{1}$ with $\| f_{\gamma, i} \|_{\mathcal{F}_{1}} \leqslant \gamma / d$ and: + +$$ +\sup _ {x \in B _ {2} (d, M)} | f _ {i} (x) - f _ {\gamma , i} (x) | \leqslant O _ {d} (1) \frac {K _ {d}}{d} \left(\frac {K _ {d}}{\gamma}\right) ^ {2 / (d + 1)} \log \left(\frac {\gamma}{K _ {d}}\right) =: \zeta . +$$ + +Choosing $f_{\gamma} \coloneqq (f_{\gamma,1}, \ldots, f_{\gamma,d})$ yields: + +$$ +\begin{array}{l} \sup _ {x \in B _ {2} (d, M)} \| f (x) - f _ {\gamma} (x) \| = \sup _ {x \in B _ {2} (d, M)} \sqrt {\sum_ {i = 1} ^ {d} | f _ {i} (x) - f _ {\gamma , i} (x) | ^ {2}} \\ \leqslant \sqrt {\sum_ {i = 1} ^ {d} \sup _ {x \in B _ {2} (d , M)} | f _ {i} (x) - f _ {\gamma , i} (x) | ^ {2}} \leqslant \sqrt {d} \zeta . \\ \end{array} +$$ + +To finish the claim, we bound the $\mathcal{F}_1$ norm of $f_{\gamma}$ . Since + +$$ +f _ {\gamma} (x) = \sum_ {i = 1} ^ {d} e _ {i} f _ {\gamma , i} (x), +$$ + +by triangle inequality $\| f_{\gamma}\|_{\mathcal{F}_1}\leqslant \sum_{i = 1}^{d}\| f_{\gamma ,i}\|_{\mathcal{F}_1}\leqslant d\cdot (\gamma /d) = \gamma$ + +We now execute the second step, where we invert the RHS of Proposition D.2 and solve for $\gamma$ . + +Lemma A.4. Let $f: \mathbb{R}^d \to \mathbb{R}^d$ be $L$ -Lipschitz and $B$ -bounded on $B_2(d, M)$ . Define $K := B \vee LM$ . For any $\varepsilon \in (0, K/2)$ , there exists an $f_{\varepsilon} \in \mathcal{F}_1$ such that $\sup_{x \in B_2(d, M)} \| f(x) - f_{\varepsilon}(x) \| \leqslant \varepsilon$ and: + +$$ +\| f _ {\varepsilon} \| _ {\mathcal {F} _ {1}} \leqslant O _ {d} (1) K \left(\frac {K}{\varepsilon}\right) ^ {(d + 1) / 2} \log^ {(d + 1) / 2} \left(\frac {K}{\varepsilon}\right). +$$ + +Proof. Setting the RHS of (D.4) from Proposition D.2 to $\varepsilon$ and rearranging terms, we need the following condition to hold (recall $K_{d} \coloneqq d \cdot K$ ): + +$$ +\frac {\gamma}{K _ {d}} \geqslant \left(\frac {O _ {d} (1) K _ {d}}{\varepsilon}\right) ^ {(d + 1) / 2} \log^ {(d + 1) / 2} \left(\frac {\gamma}{K _ {d}}\right). +$$ + +Using Proposition C.7, a sufficient condition is: + +$$ +\frac {\gamma}{K _ {d}} \geqslant O _ {d} (1) \left(\frac {O _ {d} (1) K _ {d}}{\varepsilon}\right) ^ {(d + 1) / 2} \log^ {(d + 1) / 2} \left(O _ {d} (1) \left(\frac {O _ {d} (1) K _ {d}}{\varepsilon}\right) ^ {(d + 1) / 2}\right). +$$ + +The claim now follows by simplifying these expressions with our assumptions. + +![](images/425f131dcef196ced0eb10488f26de387dff0875e5560cc76a05154adde85102.jpg) + +# E UNIFORM CONVERGENCE FOR THE DSM LOSS + +Our first step is to establish the claimed basic inequality (A.1). + +Proposition E.1 (Basic generalization inequality). Let $\mathcal{F}$ be any set of functions mapping $\mathbb{R}^D\mapsto \mathbb{R}^D$ . Let $\hat{f}_t\in \mathcal{F}$ denote the DSM empirical risk minimizer: + +$$ +\hat {f} _ {t} \in \arg \min _ {f \in \mathcal {F}} \hat {\mathcal {L}} _ {t} (f). +$$ + +Then, we have for any $\varepsilon \geqslant 0$ : + +$$ +\mathbb {E} _ {\mathcal {D} _ {t}} [ \mathcal {R} _ {t} (\hat {f} _ {t}) ] \leqslant (1 + \varepsilon) \inf _ {f \in \mathcal {F}} \mathcal {R} _ {t} (f) + \mathbb {E} _ {\mathcal {D} _ {t}} \sup _ {f \in \mathcal {F}} [ \mathcal {L} _ {t} (f) - (1 + \varepsilon) \hat {\mathcal {L}} _ {t} (f) ] + \varepsilon \cdot C _ {t}. +$$ + +Proof. For any $\varepsilon \geqslant 0$ and any $f\in \mathcal{F}$ + +$$ +\begin{array}{l} \mathbb {E} _ {\mathcal {D} _ {t}} \left[ \mathcal {R} _ {t} \left(\hat {f} _ {t}\right) \right] = \mathbb {E} _ {\mathcal {D} _ {t}} \left[ \mathcal {L} _ {t} \left(\hat {f} _ {t}\right) - C _ {t} \right] \quad \text {u s i n g F a c t C . 1} \\ = \mathbb {E} _ {\mathcal {D} _ {t}} \left[ \mathcal {L} _ {t} (\hat {f} _ {t}) - (1 + \varepsilon) \hat {\mathcal {L}} _ {t} (\hat {f} _ {t}) + (1 + \varepsilon) \hat {\mathcal {L}} _ {t} (\hat {f} _ {t}) - C _ {t} \right] \\ \leqslant \mathbb {E} _ {\mathcal {D} _ {t}} \left[ \mathcal {L} _ {t} (\hat {f} _ {t}) - (1 + \varepsilon) \hat {\mathcal {L}} _ {t} (\hat {f} _ {t}) + (1 + \varepsilon) \hat {\mathcal {L}} _ {t} (f) - C _ {t} \right] \quad \text {s i n c e} \hat {f} _ {t} \text {i s a n E R M} \\ = \mathbb {E} _ {\mathcal {D} _ {t}} \left[ \mathcal {L} _ {t} (\hat {f} _ {t}) - (1 + \varepsilon) \hat {\mathcal {L}} _ {t} (\hat {f} _ {t}) \right] + (1 + \varepsilon) \mathcal {L} _ {t} (f) - C _ {t} \quad \text {s i n c e} \mathbb {E} _ {\mathcal {D} _ {t}} \left[ \hat {\mathcal {L}} _ {t} (f) \right] = \mathcal {L} _ {t} (f) \\ = \mathbb {E} _ {\mathcal {D} _ {t}} \left[ \mathcal {L} _ {t} \left(\hat {f} _ {t}\right) - (1 + \varepsilon) \hat {\mathcal {L}} _ {t} \left(\hat {f} _ {t}\right) \right] + (1 + \varepsilon) \mathcal {R} _ {t} (f) + \varepsilon \cdot C _ {t} \quad \text {u s i n g F a c t C . 1} \\ \leqslant \mathbb {E} _ {\mathcal {D} _ {t}} \sup _ {f \in \mathscr {F}} [ \mathcal {L} _ {t} (f) - (1 + \varepsilon) \hat {\mathcal {L}} _ {t} (f) ] + (1 + \varepsilon) \mathcal {R} _ {t} (f) + \varepsilon \cdot C _ {t}. \\ \end{array} +$$ + +The claim now follows by taking the infimum of the RHS over $f \in \mathcal{F}$ . + +![](images/462d78e1b033a69405c3e3821e5cc5969ee0a6f8ace55741bc85052999015fdd.jpg) + +The rest of this section will focus on the uniform convergence term in the basic inequality (A.1). We first define some notation which we will use in our analysis. Let $\nu_{\delta}(\tilde{x}_0,\tilde{x}_t)$ denote a distribution over pairs of truncated vectors, parameterized by $\delta \in (0,1)$ , defined as follows: + +$$ +\nu_ {\delta} := \operatorname {L a w} \left(\left(x _ {0}, x _ {t}\right) \cdot \mathbf {1} \left\{\mathcal {E} _ {x} (\delta) \right\}\right), \quad \mathbb {P} \left\{\mathcal {E} _ {x} (\delta) \right\} \geqslant 1 - \delta . \tag {E.1} +$$ + +Note that in the above definition, the event $\mathcal{E}_x(\delta)$ lives in the joint probability space of $(x_0,x_t)$ . The specifics of the event $\mathcal{E}_x(\delta)$ are left unspecified for now, as they depend on the underlying details of our latent structure. However, we will require the following properties to hold almost surely for some $\check{\mu}_{t,x}(\delta)$ and $\check{\mu}_{t,q}(\delta)$ : + +$$ +\left(\check {x} _ {0}, \check {x} _ {t}\right) \sim \nu_ {\delta} \Longrightarrow \left\| \check {x} _ {t} \right\| \leqslant \check {\mu} _ {t, x} (\delta) \text {a n d} \| \nabla \log q _ {t} \left(\check {x} _ {t} \mid \check {x} _ {0}\right) \| \leqslant \check {\mu} _ {t, q} (\delta). \tag {E.2} +$$ + +Next, define the population denoising loss over $\nu_{\delta}$ as: + +$$ +\check {\mathcal {L}} _ {t} (f; \delta) := \mathbb {E} _ {(\check {x} _ {0}, \check {x} _ {t}) \sim \nu_ {\delta}} \| f (\check {x} _ {t}) - \nabla \log q _ {t} (\check {x} _ {t} \mid \check {x} _ {0}) \| ^ {2}. \tag {E.3} +$$ + +Furthermore, given a dataset $\bar{\mathcal{D}}_t = \{(\bar{x}_0^i,\bar{x}_t^i)\}_{i = 1}^n$ , the generalized empirical loss is defined as + +$$ +\hat {\mathcal {L}} _ {t} (f; \bar {\mathcal {D}} _ {t}) := \frac {1}{n} \sum_ {i = 1} ^ {n} \| f (\bar {x} _ {t} ^ {i}) - \nabla \log q _ {t} \left(\bar {x} _ {t} ^ {i} \mid \bar {x} _ {0} ^ {i}\right) \| ^ {2}. \tag {E.4} +$$ + +Note that the above definitions are used only in our truncation argument, and do not appear in the actual learning procedure. + +The main result of this section is the following bound on the uniform convergence term. + +Lemma E.2. For $R_{t}\geqslant 1$ define $\mathcal{F}_t\coloneqq \{s:\mathbb{R}^D\mapsto \mathbb{R}^D\mid \| s\|_{\mathcal{F}_1}\leqslant R_t\}$ .For $\varepsilon \in (0,1]$ , we have: + +$$ +\begin{array}{l} \mathbb {E} \sup _ {f \in \mathcal {F} _ {t}} [ \mathcal {L} _ {t} (f) - (1 + \varepsilon) \hat {\mathcal {L}} _ {t} (f) ] \\ \leqslant \tilde {O} (1) (1 + \varepsilon^ {- 1}) \left[ \frac {R _ {t} ^ {2} \breve {\mu} _ {t , x} ^ {2} (n ^ {- 5}) D + \breve {\mu} _ {t , q} ^ {2} (n ^ {- 5})}{n} \right] + O (1) \frac {R _ {t} ^ {2} \| x _ {t} \| _ {L _ {4} (p _ {t})} ^ {2} + D / \sigma_ {t} ^ {2}}{n ^ {2}}. \\ \end{array} +$$ + +The proof of Lemma E.2 follows immediately from the following two results (invoking them both with $\delta = n^{-4}$ ). The first result applies a truncation argument so that it suffices to prove uniform convergence over truncated data. + +Proposition E.3. Fix a $\delta \in (0,1)$ . Define the truncated random pair $(\check{x}_0,\check{x}_t) \sim \nu_{\delta /n}$ (cf. (E.1)). Let the truncated dataset $\check{\mathcal{D}}_t := \{(\check{x}_0^i,\check{x}_t^i)\}_{i = 1}^n$ be $n$ iid copies of $(\check{x}_0,\check{x}_t)$ , i.e., $\check{\mathcal{D}}_t \sim \nu_{\delta /n}^{\otimes n}$ . For some $R_t \geqslant 1$ , define $\mathcal{F}_t := \{s:\mathbb{R}^D\mapsto \mathbb{R}^D\mid \| s\|_{\mathcal{F}_1} \leqslant R_t\}$ . For all $\varepsilon \in [0,1]$ , we have that: + +$$ +\begin{array}{l} \mathbb {E} \sup _ {f \in \mathscr {F} _ {t}} [ \mathcal {L} _ {t} (f) - (1 + \varepsilon) \hat {\mathcal {L}} _ {t} (f) ] \\ \leqslant \mathbb {E} \sup _ {f \in \mathcal {F} _ {t}} [ \check {\mathcal {L}} _ {t} (f; \delta / n) - (1 + \varepsilon) \hat {\mathcal {L}} _ {t} (f; \check {\mathcal {D}} _ {t}) ] + c (R _ {t} ^ {2} \| x _ {t} \| _ {L _ {4} (p _ {t})} ^ {2} + \sigma_ {t} ^ {- 2} D) \cdot \delta^ {1 / 2}, \\ \end{array} +$$ + +where $c > 0$ is a universal constant. + +Proof. Let $\mathcal{E}_G$ denote the event $\mathcal{E}_G\coloneqq \{\mathcal{D}_t = \tilde{\mathcal{D}}_t\}$ . By a union bound, $\mathbb{P}(\mathcal{E}_G)\geqslant 1 - \delta$ . Next we define for a dataset $\bar{\mathcal{D}}_t$ the random variable: + +$$ +\psi (\bar {D} _ {t}): = \sup _ {f \in \mathscr {F} _ {t}} [ \mathcal {L} _ {t} (f) - (1 + \varepsilon) \hat {\mathcal {L}} _ {t} (f; \bar {D} _ {t}) ]. \tag {E.5} +$$ + +Applying Proposition C.6: + +$$ +\mathbb {E} \left[ \psi \left(\mathcal {D} _ {t}\right) \right] \leqslant \mathbb {E} \left[ \psi \left(\check {\mathcal {D}} _ {n}\right) \right] + \left(\sqrt {\mathbb {E} \left[ \psi^ {2} \left(\mathcal {D} _ {t}\right) \right]} + \sqrt {\mathbb {E} \left[ \psi^ {2} \left(\check {\mathcal {D}} _ {n}\right) \right]}\right) \cdot \delta^ {1 / 2}. \tag {E.6} +$$ + +We next need to upper bound both: + +$$ +\mathbb {E} [ \psi^ {2} (\mathcal {D} _ {t}) ], \quad \mathbb {E} [ \psi^ {2} (\tilde {\mathcal {D}} _ {n}) ]. +$$ + +To do this, we first derive a few intermediate bounds. We start with: + +$$ +\begin{array}{l} \mathcal {L} _ {t} (f) = \mathbb {E} _ {\left(x _ {0}, x _ {t}\right)} \| f (x _ {t}) - \nabla \log q _ {t} \left(x _ {t} \mid x _ {0}\right) \| ^ {2} \\ \leqslant 2 \mathbb {E} \| f (x _ {t}) \| ^ {2} + 2 \mathbb {E} \| \nabla \log q _ {t} (x _ {t} \mid x _ {0}) \| ^ {2} \quad \text {s i n c e} (a + b) ^ {2} \leqslant 2 (a ^ {2} + b ^ {2}) \\ \leqslant 2 R _ {t} ^ {2} \mathbb {E} \| x _ {t} \| ^ {2} + 2 \mathbb {E} \| \left(x _ {t} - m _ {t} x _ {0}\right) / \sigma_ {t} ^ {2} \| ^ {2} \quad \text {s i n c e} \| f \| _ {\mathcal {F} _ {1}} \leqslant R _ {t} \\ = 2 R _ {t} ^ {2} \mathbb {E} \| x _ {t} \| ^ {2} + 2 \mathbb {E} \| w / \sigma_ {t} \| ^ {2} \\ = 2 R _ {t} ^ {2} \mathbb {E} \| x _ {t} \| ^ {2} + 2 D / \sigma_ {t} ^ {2}. \\ \end{array} +$$ + +Next, we have: + +$$ +\begin{array}{l} \mathbb {E} \sup _ {f \in \mathcal {F} _ {t}} \hat {\mathcal {L}} _ {t} ^ {2} (f) = \mathbb {E} \sup _ {f \in \mathcal {F} _ {t}} \left(\frac {1}{n} \sum_ {i = 1} ^ {n} \| f (x _ {t} ^ {i}) - \nabla \log q _ {t} (x _ {t} ^ {i} | x _ {0} ^ {i}) \| ^ {2}\right) ^ {2} \\ \leqslant \mathbb {E} \left(\frac {2 R _ {t} ^ {2}}{n} \sum_ {i = 1} ^ {n} \| x _ {t} ^ {i} \| ^ {2} + \frac {2}{n \sigma_ {t} ^ {2}} \sum_ {i = 1} ^ {n} \| w ^ {i} \| ^ {2}\right) ^ {2} \quad \text {s i n c e} \| f \| _ {\mathcal {F} _ {1}} \leqslant R _ {t} \\ \leqslant \frac {4 R _ {t} ^ {4}}{n} \sum_ {i = 1} ^ {n} \mathbb {E} \| x _ {t} ^ {i} \| ^ {4} + \frac {4}{n \sigma_ {t} ^ {4}} \sum_ {i = 1} ^ {n} \mathbb {E} \| w ^ {i} \| ^ {4} \quad \text {C a u c h y - S c h w a r z} \\ \leqslant 4 R _ {t} ^ {4} \mathbb {E} \| x _ {t} \| ^ {4} + 1 2 D ^ {2} / \sigma_ {t} ^ {4}. \\ \end{array} +$$ + +Hence, + +$$ +\begin{array}{l} \mathbb {E} \left[ \psi^ {2} \left(\mathcal {D} _ {t}\right) \right] \leqslant \mathbb {E} \sup _ {f \in \mathscr {F} _ {t}} \left[ \mathcal {L} _ {t} (f) - (1 + \varepsilon) \hat {\mathcal {L}} _ {t} (f) \right] ^ {2} \\ \lesssim \sup _ {f \in \mathscr {F} _ {t}} \mathcal {L} _ {t} ^ {2} (f) + \mathbb {E} \sup _ {f \in \mathscr {F} _ {t}} \hat {\mathcal {L}} _ {t} ^ {2} (f) \\ \lesssim R _ {t} ^ {4} \mathbb {E} \| x _ {t} \| ^ {4} + D ^ {2} / \sigma_ {t} ^ {4}. \\ \end{array} +$$ + +Now we move on to bounding $\mathbb{E}[\psi^2 (\tilde{\mathcal{D}}_n)]$ . Defining $\mathcal{E}_x\coloneqq \mathcal{E}_x(\delta /n)$ + +$$ +\tilde {x} _ {t} - m _ {t} \check {x} _ {0} = \left(x _ {t} - m _ {t} x _ {0}\right) \cdot \mathbf {1} \left\{\mathcal {E} _ {x} \right\} = \sigma_ {t} w \cdot \mathbf {1} \left\{\mathcal {E} _ {x} \right\}, +$$ + +and therefore: + +$$ +\mathbb {E} \| (\check {x} _ {t} - m _ {t} \check {x} _ {0}) / \sigma_ {t} ^ {2} \| ^ {4} = \mathbb {E} \| w / \sigma_ {t} \| ^ {4} \mathbf {1} \{\mathcal {E} _ {x} \} \leqslant \mathbb {E} \| w / \sigma_ {t} ^ {4} \| \leqslant 3 D ^ {2} / \sigma_ {t} ^ {4}. +$$ + +Hence: + +$$ +\begin{array}{l} \mathbb {E} \sup _ {f \in \mathcal {F} _ {t}} \hat {\mathcal {L}} _ {t} ^ {2} (f; \check {\mathcal {D}} _ {t}) = \mathbb {E} \sup _ {f \in \mathcal {F} _ {t}} \left(\frac {1}{n} \sum_ {i = 1} ^ {n} \| f (\check {x} _ {t} ^ {i}) - \nabla \log q _ {t} (\check {x} _ {t} ^ {i} | \check {x} _ {0} ^ {i}) \| ^ {2}\right) ^ {2} \\ \leqslant \mathbb {E} \left(\frac {2 R _ {t} ^ {2}}{n} \sum_ {i = 1} ^ {n} \| \check {x} _ {t} ^ {i} \| ^ {2} + \frac {2}{n \sigma_ {t} ^ {2}} \sum_ {i = 1} ^ {n} \| (\check {x} _ {t} ^ {i} - m _ {t} \check {x} _ {0} ^ {i}) / \sigma_ {t} ^ {2} \| ^ {2}\right) ^ {2} \quad \text {s i n c e} \| f \| _ {\mathcal {F} _ {1}} \leqslant R _ {t} \\ \leqslant \frac {4 R _ {t} ^ {4}}{n} \sum_ {i = 1} ^ {n} \mathbb {E} \| \tilde {x} _ {t} ^ {i} \| ^ {4} + \frac {4}{n \sigma_ {t} ^ {4}} \sum_ {i = 1} ^ {n} \mathbb {E} \| \left(\tilde {x} _ {t} ^ {i} - m _ {t} \tilde {x} _ {0} ^ {i}\right) / \sigma_ {t} ^ {2} \| ^ {4} \quad \text {C a u c h y - S c h w a r z} \\ \leqslant \frac {4 R _ {t} ^ {4}}{n} \sum_ {i = 1} ^ {n} \mathbb {E} \| x _ {t} ^ {i} \| ^ {4} + \frac {4}{n \sigma_ {t} ^ {4}} \sum_ {i = 1} ^ {n} \mathbb {E} \| \left(x _ {t} ^ {i} - m _ {t} x _ {0} ^ {i}\right) / \sigma_ {t} ^ {2} \| ^ {4} \\ = \frac {4 R _ {t} ^ {4}}{n} \sum_ {i = 1} ^ {n} \mathbb {E} \| x _ {t} ^ {i} \| ^ {4} + \frac {4}{n \sigma_ {t} ^ {4}} \sum_ {i = 1} ^ {n} \mathbb {E} \| w ^ {i} / \sigma_ {t} \| ^ {4} \\ \leqslant 4 R _ {t} ^ {4} \mathbb {E} \| x _ {t} \| ^ {4} + 1 2 D ^ {2} / \sigma_ {t} ^ {4}. \\ \end{array} +$$ + +Therefore, we conclude that: + +$$ +\left. \right. \max \left\{\mathbb {E} \left[ \psi^ {2} \left(\mathcal {D} _ {t}\right)\right], \mathbb {E} \left[ \psi^ {2} \left(\check {\mathcal {D}} _ {t}\right)\right]\right\} \lesssim R _ {t} ^ {4} \mathbb {E} \| x _ {t} \| ^ {4} + \sigma_ {t} ^ {- 4} D ^ {2}. \tag {E.7} +$$ + +Plugging (E.7) into (E.6), + +$$ +\begin{array}{l} \mathbb {E} [ \psi (\mathcal {D} _ {t}) ] \leqslant \mathbb {E} [ \psi (\check {\mathcal {D}} _ {t}) ] + c \left(R _ {t} ^ {2} \| x _ {t} \| _ {L _ {4} (p _ {t})} ^ {2} + \sigma_ {t} ^ {- 2} D\right) \cdot \delta^ {1 / 2} \\ \leqslant \mathbb {E} \sup _ {f \in \mathscr {F} _ {t}} \left[ \mathcal {L} _ {t} (f) - (1 + \varepsilon) \hat {\mathcal {L}} _ {t} (f; \check {\mathcal {D}} _ {t}) \right] + c \left(R _ {t} ^ {2} \| x _ {t} \| _ {L _ {4} \left(p _ {t}\right)} ^ {2} + \sigma_ {t} ^ {- 2} D\right) \cdot \delta^ {1 / 2} \\ \leqslant \mathbb {E} \sup _ {f \in \mathcal {F} _ {t}} \left[ \check {\mathcal {L}} _ {t} (f; \delta / n) - (1 + \varepsilon) \hat {\mathcal {L}} _ {t} (f; \check {\mathcal {D}} _ {t}) \right] + \sup _ {f \in \mathcal {F} _ {t}} \left[ \mathcal {L} _ {t} (f) - \check {\mathcal {L}} _ {t} (f; \delta / n) \right] \\ + c \left(R _ {t} ^ {2} \| x _ {t} \| _ {L _ {4} (p _ {t})} ^ {2} + \sigma_ {t} ^ {- 2} D\right) \cdot \delta^ {1 / 2}. \\ \end{array} +$$ + +Next, define: + +$$ +V _ {f} ((x, \bar {x})) := \| f (\bar {x}) - \nabla \log q _ {t} (\bar {x} | x) \| ^ {2}. +$$ + +Observe by Jensen's inequality we can bound + +$$ +\mathbb {E} \left[ V _ {f} ^ {2} \left(\left(x _ {0}, x _ {t}\right)\right) \right] \leqslant \mathbb {E} \sup _ {f \in \mathscr {F} _ {t}} \hat {\mathcal {L}} _ {t} ^ {2} (f) \lesssim R _ {t} ^ {4} \mathbb {E} \| x _ {t} \| ^ {4} + D ^ {2} / \sigma_ {t} ^ {4}. +$$ + +Therefore, by application of Proposition C.6, + +$$ +\begin{array}{l} \mathbb {E} \left[ V _ {f} \left(\left(x _ {0}, x _ {t}\right)\right) \right] \leqslant \mathbb {E} \left[ V _ {f} \left(\left(\check {x} _ {0}, \check {x} _ {t}\right)\right) \right] + \sqrt {\mathbb {E} \left[ V _ {f} ^ {2} \left(\left(x _ {0} , x _ {t}\right)\right) \right]} \cdot \sqrt {\delta / n} \\ \leqslant \mathbb {E} [ V _ {f} ((\check {x} _ {0}, \check {x} _ {t})) ] + c ^ {\prime} (R _ {t} ^ {2} \| x _ {t} \| _ {L _ {4} (p _ {t})} ^ {2} + \sigma_ {t} ^ {- 2} D) \cdot \sqrt {\delta / n}. \\ \end{array} +$$ + +Hence, + +$$ +\begin{array}{l} \sup _ {f \in \mathscr {F} _ {t}} [ \mathscr {L} _ {t} (f) - \check {\mathscr {L}} _ {t} (f; \delta / n) ] = \sup _ {f \in \mathscr {F} _ {t}} [ \mathbb {E} [ V _ {f} ((x _ {0}, x _ {t})) ] - \mathbb {E} [ V _ {f} ((\check {x} _ {0}, \check {x} _ {t})) ] ] \\ \leqslant c ^ {\prime} \left(R _ {t} ^ {2} \| x _ {t} \| _ {L _ {4} (p _ {t})} ^ {2} + \sigma_ {t} ^ {- 2} D\right) \cdot \sqrt {\delta / n}, \\ \end{array} +$$ + +from which the claim follows. + +![](images/fbfb020bf65b2904595ba342c0d48813ee43ff16e61c0fc00086a634b2ee0a0a.jpg) + +The second result proves uniform convergence over truncated inputs. + +Proposition E.4. Fix $\delta \in (0,1)$ . Define the truncated random vectors $(\check{x}_0,\check{x}_t) \sim \nu_{\delta /n}$ (cf. (E.1)), and let $\check{D}_t \sim \nu_{\delta /n}^{\otimes n}$ . For some $R_t \geqslant 1$ , define $\mathcal{F}_t := \{s : \mathbb{R}^D \mapsto \mathbb{R}^D \mid \|s\|_{\mathcal{F}_1} \leqslant R_t\}$ . For all $\varepsilon \in (0,1]$ , we have that: + +$$ +\begin{array}{l} \mathbb {E} \sup _ {f \in \mathscr {F} _ {t}} \left[ \check {\mathcal {L}} _ {t} (f; \delta / n) - (1 + \varepsilon) \hat {\mathcal {L}} _ {t} (f; \check {\mathcal {D}} _ {t}) \right] \\ \leqslant \tilde {O} (1) (1 + \varepsilon^ {- 1}) \left[ \frac {R _ {t} ^ {2} \breve {\mu} _ {t , x} ^ {2} (\delta / n) D + \breve {\mu} _ {t , q} ^ {2} (\delta / n)}{n} \right] + O (1) \frac {R _ {t} ^ {2} \| x _ {t} \| _ {L _ {4} (p _ {t})} ^ {2} + D / \sigma_ {t} ^ {2}}{n ^ {2}}. \\ \end{array} +$$ + +Proof. Let $\check{\mu}_{t,x} \coloneqq \check{\mu}_{t,x}(\delta / n)$ and similarly $\check{\mu}_{t,q} \coloneqq \check{\mu}_{t,q}(\delta / n)$ . We first observe that the following holds almost surely: + +$$ +\begin{array}{l} \left\| f \left(\tilde {x} _ {t}\right) - \nabla \log q _ {t} \left(\tilde {x} _ {t} \mid \tilde {x} _ {0}\right) \right\| \leqslant R _ {t} \| \tilde {x} _ {t} \| + \| \nabla \log q _ {t} \left(\tilde {x} _ {t} \mid \tilde {x} _ {0}\right) \| \\ \leqslant R _ {t} \tilde {\mu} _ {t, x} + \breve {\mu} _ {t, q} =: B _ {\mathcal {H}}. \\ \end{array} +$$ + +We consider the hypothesis of functions: + +$$ +\mathcal {H} := \left\{\left(x, \bar {x}\right) \mapsto \| f (\bar {x}) - \nabla \log q _ {t} (\bar {x} \mid x) \| \mid f \in \mathscr {F} _ {t} \right\}, +$$ + +defined over the support $\tilde{\mathcal{Z}}\coloneqq \mathrm{supp}((\check{x}_0,\check{x}_t))$ , and coupled with the loss function $\phi (z) = z^2$ , which is 2-smooth. From Srebro et al. (2010, Theorem 1), we have with probability at least $1 - \delta$ over $\check{D}_t$ , for all $h\in \mathcal{H}$ : + +$$ +\mathbb {E} \left[ \phi \left(h \left(\tilde {x} _ {0}, \tilde {x} _ {t}\right)\right) \right] \leqslant (1 + \varepsilon) \frac {1}{n} \sum_ {i = 1} ^ {n} \phi \left(h \left(\tilde {x} _ {0} ^ {i}, \tilde {x} _ {t} ^ {i}\right)\right) + (1 + \varepsilon^ {- 1}) c \left[ \log^ {3} n \cdot \Re_ {n} ^ {2} (\mathcal {H}) + \frac {B _ {\mathcal {H}} ^ {2} \log (1 / \delta)}{n} \right], \tag {E.8} +$$ + +where $c > 0$ is a universal constant, and $\Re_n(\mathcal{H})$ denotes the Rademacher complexity of $\mathcal{H}$ : + +$$ +\mathfrak{R}_{n}(\mathcal{H}):= \sup_{z_{1:n}\subset \tilde{\mathcal{Z}}}\mathbb{E}_{\varepsilon}\sup_{h\in \mathcal{H}}\frac{1}{n}\left|\sum_{i = 1}^{n}h(z_{i})\varepsilon_{i}\right|. +$$ + +We now bound this Rademacher complexity term. Let $\mathcal{G}$ denote the shifted function class: + +$$ +\mathcal {G} := \left\{\left(x, \bar {x}\right) \mapsto f (\bar {x}) - \nabla \log q _ {t} (\bar {x} \mid x) \mid f \in \mathscr {F} _ {t} \right\}. +$$ + +Letting $g_0 \in \mathcal{G}$ and $z_i = (x_i, \bar{x}_i) \in \tilde{Z}$ for $i \in [n]$ be arbitrary, we have: + +$$ +\begin{array}{l} \mathbb {E} _ {\varepsilon} \sup _ {h \in \mathcal {H}} \left| \sum_ {i = 1} ^ {n} h (z _ {i}) \varepsilon_ {i} \right| \\ = \mathbb {E} _ {\varepsilon} \sup _ {g \in \mathcal {G}} \left| \sum_ {i = 1} ^ {n} \varepsilon_ {i} \| g (z _ {i}) \| \right| \\ \leqslant \mathbb {E} _ {\varepsilon} \sup _ {g \in \mathcal {G}} \left| \sum_ {i = 1} ^ {n} \varepsilon_ {i} \left(\left\| g (z _ {i}) \right\| - \left\| g _ {0} (z _ {i}) \right\|\right) \right| + \mathbb {E} \left| \sum_ {i = 1} ^ {n} \varepsilon_ {i} \left\| g _ {0} (z _ {i}) \right\| \right| \\ \leqslant \mathbb {E} _ {\varepsilon} \sup _ {g \in \mathcal {G}} \left| \sum_ {i = 1} ^ {n} \varepsilon_ {i} \left(\left\| g \left(z _ {i}\right) \right\| - \left\| g _ {0} \left(z _ {i}\right) \right\|\right) \right| + \sqrt {\sum_ {i = 1} ^ {n} \left\| g _ {0} \left(z _ {i}\right) \right\| ^ {2}} \quad \text {J e s s e n ' s i n e q u a l i t y} \\ \leqslant \mathbb {E} _ {\varepsilon} \sup _ {g, g ^ {\prime} \in \mathcal {G}} \left| \sum_ {i = 1} ^ {n} \varepsilon_ {i} \left(\left\| g \left(z _ {i}\right) \right\| - \left\| g ^ {\prime} \left(z _ {i}\right) \right\|\right) \right| + \sqrt {\sum_ {i = 1} ^ {n} \left\| g _ {0} \left(z _ {i}\right) \right\| ^ {2}} \quad \text {s i n c e} g _ {0} \in \mathcal {G} \\ = \mathbb {E} _ {\varepsilon} \sup _ {g, g ^ {\prime} \in \mathcal {G}} \sum_ {i = 1} ^ {n} \varepsilon_ {i} \left(\| g (z _ {i}) \| - \| g ^ {\prime} (z _ {i}) \|\right) + \sqrt {\sum_ {i = 1} ^ {n} \| g _ {0} (z _ {i}) \| ^ {2}} \quad \text {s i n c e} \mathcal {G} - \mathcal {G} \text {i s s y m m e t r i c} \\ \leqslant 2 \mathbb {E} _ {\varepsilon} \sup _ {g \in \mathcal {G}} \sum_ {i = 1} ^ {n} \varepsilon_ {i} \| g (z _ {i}) \| + \sqrt {n} B _ {\mathcal {H}}. \\ \end{array} +$$ + +Next, we proceed with Maurer (2016, Corollary 4), which allows to bound, for Rademacher random vectors $\gamma_i \in \{\pm 1\}^D$ , + +$$ +\begin{array}{l} \mathbb {E} _ {\varepsilon} \sup _ {g \in \mathcal {G}} \sum_ {i = 1} ^ {n} \varepsilon_ {i} \| g (z _ {i}) \| \leqslant \sqrt {2} \mathbb {E} _ {\gamma} \sup _ {g \in \mathcal {G}} \sum_ {i = 1} ^ {n} \langle \gamma_ {i}, g (z _ {i}) \rangle \\ = \sqrt {2} \mathbb {E} _ {\gamma} \sup _ {f \in \mathcal {F} _ {t}} \sum_ {i = 1} ^ {n} \langle \gamma_ {i}, f (\bar {x} _ {i}) \rangle \\ \lesssim R _ {t} \breve {\mu} _ {t, x} \sqrt {D n}, \\ \end{array} +$$ + +where the last inequality uses Proposition C.9. Putting the terms together, + +$$ +\mathfrak {R} _ {n} (\mathcal {H}) \lesssim (R _ {t} \breve {\mu} _ {t, x} \sqrt {D} + B _ {\mathcal {H}}) \frac {1}{\sqrt {n}} \lesssim (R _ {t} \breve {\mu} _ {t, x} \sqrt {D} + \breve {\mu} _ {t, q}) \frac {1}{\sqrt {n}}. +$$ + +From (E.8), with probability at least $1 - 1/n^4$ , for all $h \in \mathcal{H}$ : + +$$ +\mathbb {E} [ \phi (h (\check {x} _ {0}, \check {x} _ {t})) ] \leqslant (1 + \varepsilon) \frac {1}{n} \sum_ {i = 1} ^ {n} \phi (h (\check {x} _ {0} ^ {i}, \check {x} _ {t} ^ {i})) + (1 + \varepsilon^ {- 1}) c \log^ {3} n \left[ \frac {R _ {t} ^ {2} \breve {\mu} _ {t , x} ^ {2} D + \breve {\mu} _ {t , q} ^ {2}}{n} \right]. +$$ + +That is, with probability at least $1 - 1 / n^4$ + +$$ +\sup _ {f \in \mathscr {F} _ {t}} \left[ \tilde {\mathcal {L}} _ {t} (f; \delta / n) - (1 + \varepsilon) \hat {\mathcal {L}} _ {t} (f; \check {\mathcal {D}} _ {t}) \right] \leqslant \tilde {O} (1) (1 + \varepsilon^ {- 1}) \left[ \frac {R _ {t} ^ {2} \breve {\mu} _ {t , x} ^ {2} D + \breve {\mu} _ {t , q} ^ {2}}{n} \right]. +$$ + +Call this event $\mathcal{E}'$ . We have that: + +$$ +\begin{array}{l} \mathbb {E} \sup _ {f \in \mathscr {F} _ {t}} \left[ \check {\mathcal {L}} _ {t} (f; \delta / n) - (1 + \varepsilon) \hat {\mathcal {L}} _ {t} (f; \check {\mathcal {D}} _ {t}) \right] \\ = \mathbb {E} \sup _ {f \in \mathcal {F} _ {t}} [ \check {\mathcal {L}} _ {t} (f; \delta / n) - (1 + \varepsilon) \hat {\mathcal {L}} _ {t} (f; \check {\mathcal {D}} _ {t}) ] \mathbf {1} \{\mathcal {E} ^ {\prime} \} + \mathbb {E} \sup _ {f \in \mathcal {F} _ {t}} [ \check {\mathcal {L}} _ {t} (f; \delta / n) - (1 + \varepsilon) \hat {\mathcal {L}} _ {t} (f; \check {\mathcal {D}} _ {t}) ] \mathbf {1} \{(\mathcal {E} ^ {\prime}) ^ {c} \} \\ \lesssim \tilde {O} (1) (1 + \varepsilon^ {- 1}) \left[ \frac {R _ {t} ^ {2} \breve {\mu} _ {t , x} ^ {2} D + \breve {\mu} _ {t , q} ^ {2}}{n} \right] + \frac {1}{n ^ {2}} \sqrt {\mathbb {E} \sup _ {f \in \mathcal {F} _ {t}} [ \breve {\mathcal {L}} _ {t} (f ; \delta / n) - (1 + \varepsilon) \hat {\mathcal {L}} _ {t} (f ; \breve {\mathcal {D}} _ {t}) ] ^ {2}}. \\ \end{array} +$$ + +To finish the proof, we observe that: + +$$ +\begin{array}{l} \check {\mathcal {L}} _ {t} (f; \delta / n) = \mathbb {E} _ {(\check {x} _ {0}, \check {x} _ {t}) \sim \nu_ {\delta / n}} \| f (\check {x} _ {t}) - \nabla \log q _ {t} (\check {x} _ {t} | \check {x} _ {0}) \| ^ {2} \\ \leqslant 2 \mathbb {E} \| f (\check {x} _ {t}) \| ^ {2} + 2 \mathbb {E} \| \nabla \log q _ {t} (\check {x} _ {t} \mid \check {x} _ {0}) \| ^ {2} \\ \leqslant 2 R _ {t} ^ {2} \mathbb {E} \| \tilde {x} _ {t} \| ^ {2} + 2 \mathbb {E} \| (\tilde {x} _ {t} - m _ {t} \tilde {x} _ {0}) / \sigma_ {t} ^ {2} \| ^ {2} \\ \leqslant 2 R _ {t} ^ {2} \mathbb {E} \| x _ {t} \| ^ {2} + 2 \mathbb {E} \| \left(x _ {t} - m _ {t} x _ {0}\right) / \sigma_ {t} ^ {2} \| ^ {2} \\ = 2 R _ {t} ^ {2} \mathbb {E} \| x _ {t} \| ^ {2} + 2 D / \sigma_ {t} ^ {2}. \\ \end{array} +$$ + +On the other hand, from (E.7), + +$$ +\mathbb {E} \sup _ {f \in \mathcal {F} _ {t}} \check {\mathcal {L}} _ {t} ^ {2} (f; \check {\mathcal {D}} _ {t}) \lesssim R _ {t} ^ {4} \mathbb {E} \| x _ {t} \| ^ {4} + \sigma_ {t} ^ {- 4} D ^ {2}. +$$ + +Hence, combining these bounds together, + +$$ +\begin{array}{l} \mathbb {E} \sup _ {f \in \mathcal {F} _ {t}} \left[ \check {\mathcal {L}} _ {t} (f; \delta / n) - (1 + \varepsilon) \hat {\mathcal {L}} _ {t} (f; \check {\mathcal {D}} _ {t}) \right] \\ \lesssim \tilde {O} (1) (1 + \varepsilon^ {- 1}) \left[ \frac {R _ {t} ^ {2} \tilde {\mu} _ {t , x} ^ {2} D + \breve {\mu} _ {t , q} ^ {2}}{n} \right] + \frac {R _ {t} ^ {2} \| x _ {t} \| _ {L _ {4} (p _ {t})} ^ {2} + D / \sigma_ {t} ^ {2}}{n ^ {2}}. \\ \end{array} +$$ + +![](images/7cdd6facfda8528fc75da953a83c1a9562499bfcc3caf4eb70d4f11e66ae91bf.jpg) + +# F ANALYSIS OF SUBSPACE STRUCTURE (SECTION 3.1) + +We now specialize the previous approximation and uniform convergence results to the subspace structure setting. + +Proposition F.1. Fix an $M \geqslant 1$ . For any $\varepsilon \in (0, \bar{L}M/2)$ , there exists an $f_{\varepsilon}: \mathbb{R}^d \mapsto \mathbb{R}^d$ such that $\sup_{z \in B_2(d,M)} \| f_{\varepsilon}(z) - \nabla \log \pi_t(z) \| \leqslant \varepsilon$ , and + +$$ +\left\| f _ {\varepsilon} \right\| _ {\mathcal {F} _ {1}} \leqslant R _ {\operatorname {l i n}} (\varepsilon , M) := O _ {d} (1) (\bar {L} M) ^ {(d + 3) / 2} \varepsilon^ {- (d + 1) / 2} \log^ {(d + 1) / 2} (\bar {L} M / \varepsilon). \tag {F.1} +$$ + +Proof. We will invoke Lemma A.4. To do this, we first observe for any $z \in B_2(d, M)$ , using Proposition C.4, + +$$ +\| \nabla \log \pi_ {t} (z) \| \leqslant \bar {L} (1 + \| z \|) \leqslant 2 \bar {L} M. +$$ + +On the other hand, we know that $\nabla \log \pi_t$ is $L$ -Lipschitz. The claim now follows from Lemma A.4. + +Our next task is to upgrade the previous result to an approximation result for the ambient score $\nabla \log p_t$ , using Proposition D.1. + +Proposition F.2. Fix an $\varepsilon \in (0,1)$ . There exists an $\hat{s}:\mathbb{R}^D\mapsto \mathbb{R}^D$ such that: + +$$ +\| \hat {s} \| _ {\mathcal {F} _ {1}} \leqslant \tilde {O} _ {d} (1) (\bar {L} \left(\mu_ {t, z} \vee \beta)\right) ^ {(d + 3) / 2} \varepsilon^ {- (d + 1) / 2} + 2 (D - d) / \sigma_ {t} ^ {2}, \quad \| \hat {s} - \nabla \log p _ {t} \| _ {L _ {2} \left(p _ {t}\right)} \leqslant \varepsilon . \tag {F.2} +$$ + +Proof. Define + +$$ +M (\delta) := \left\{\| U ^ {\mathsf {T}} x _ {t} \| \leqslant A _ {\delta} \right\}, \quad A _ {\delta} := c _ {0} (\mu_ {t, z} + \beta \sqrt {\log (1 / \delta)}). +$$ + +We note that the condition $\mathbb{P}\{x_t\in M(\delta)\} \geqslant 1 - \delta$ holds for an appropriate choice of $c_{0}$ + +Now, given $\varepsilon, \delta \in (0,1)$ , from Proposition F.1 there exists $\hat{h}:\mathbb{R}^d\mapsto \mathbb{R}^d$ such that: + +$$ +\| \hat{h}\|_{\mathcal{F}_{1}}\leqslant R_{\mathrm{lin}}(\varepsilon ,A_{\delta}),\sup_{z\in B_{2}(d,A_{\delta})}\| \hat{h} (z) - \nabla \log \pi_{t}(z)\| \leqslant \varepsilon . +$$ + +Embed $\hat{h}$ to a function $\hat{s}:\mathbb{R}^D\mapsto \mathbb{R}^D$ by: + +$$ +\hat {s} (x) = U \hat {h} (U ^ {\mathsf {T}} x) - \frac {1}{\sigma_ {t} ^ {2}} (I - U U ^ {\mathsf {T}}) x, +$$ + +and observe that (cf. Proposition A.1): + +$$ +\begin{array}{l} \sup _ {x \in M (\delta)} \| \hat {s} (x) - s _ {\star} (x) \| = \sup _ {x \in M (\delta)} \| U \hat {h} (U ^ {\mathsf {T}} x) - U \nabla \log \pi_ {t} (U ^ {\mathsf {T}} x) \| \\ \leqslant \sup _ {x \in M (\delta)} \| \hat {h} (U ^ {\mathsf {T}} x) - \nabla \log \pi_ {t} (U ^ {\mathsf {T}} x) \| \\ \leqslant \sup _ {z \in B _ {2} (d, A _ {\delta})} \| \hat {h} (z) - \nabla \log \pi_ {t} (z) \| \\ \leqslant \varepsilon . \\ \end{array} +$$ + +Next, we bound the $\mathcal{F}_1$ -norm of $\hat{s}$ . To do this, we first bound the $\mathcal{F}_1$ -norm of $x \mapsto (I - UU^{\top})x$ by representing it by the following sum of Dirac masses + +$$ +\sum_ {i = 1} ^ {D - d} \delta_ {\left(u _ {i}, u _ {i}\right)} + \delta_ {\left(- u _ {i}, - u _ {i}\right)}, +$$ + +and hence $\| x\mapsto (I - UU^{\mathsf{T}})x\|_{\mathcal{F}_1}\leqslant 2(D - d)$ . Next, recall by Fact A.3 that $\| x\mapsto U\hat{h} (U^{\mathsf{T}}x)\|_{\mathcal{F}_1} = \| h\|_{\mathcal{F}_1}$ . Combining these results, + +$$ +\begin{array}{l} \| \hat {s} \| _ {\mathcal {F} _ {1}} \leqslant \| x \mapsto U \hat {h} (U ^ {\top} x) \| _ {\mathcal {F} _ {1}} + \frac {1}{\sigma_ {t} ^ {2}} \| x \mapsto (I - U U ^ {\top}) x \| _ {\mathcal {F} _ {1}} \\ \leqslant \| \hat {h} \| _ {\mathcal {F} _ {1}} + \frac {2}{\sigma_ {t} ^ {2}} (D - d) \leqslant R _ {\operatorname {l i n}} (\varepsilon , A _ {\delta}) + \frac {2}{\sigma_ {t} ^ {2}} (D - d) =: R (\varepsilon , \delta). \tag {F.3} \\ \end{array} +$$ + +That is, we have shown that for $\varepsilon > 0$ and $\delta \in (0,1)$ , there exists a $\hat{s} : \mathbb{R}^D \mapsto \mathbb{R}^D$ such that: + +$$ +\| \hat{s}\|_{\mathcal{F}_{1}}\leqslant R(\varepsilon ,\delta),\quad \sup_{x\in M(\delta)}\| \hat{s} (x) - \nabla \log p_{t}(x)\| \leqslant \varepsilon . +$$ + +This verifies condition (D.1) of Proposition D.1. We now need to solve for a $\delta_{\star}$ which satisfies the conditions listed in (D.2). By several applications of Proposition C.7, the conditions listed (D.2) are satisfied with a $\delta_{\star} \in (0, 1)$ satisfying: + +$$ +\log (1 / \delta_ {\star}) \leqslant O _ {d} (1) \log \left(\frac {\bar {L} D \mu_ {t , x} \beta}{\varepsilon \sigma_ {t}}\right). +$$ + +Since we do not track the exact form of the leading $O_{d}(1)$ constant, we skip the specific calculations. The result now follows from Proposition D.1 after estimating $R(\varepsilon /2,\delta_{\star})$ . First, we bound, + +$$ +A _ {\delta_ {\star}} = c _ {0} \left(\mu_ {t, z} + \beta \sqrt {\log \left(1 / \delta_ {\star}\right)}\right) = \tilde {O} _ {d} (1) \left(\mu_ {t, z} \vee \beta\right). +$$ + +Hence, + +$$ +R (\varepsilon / 2, \delta_ {\star}) \leqslant \tilde {O} _ {d} (1) (\bar {L} (\mu_ {t, z} \vee \beta)) ^ {(d + 3) / 2} \varepsilon^ {- (d + 1) / 2}. +$$ + +Therefore, the result follows. + +Now we have the tools in place to prove Theorem 3.3, our main score estimation result for this section. + +Theorem 3.3. Suppose that $p_0$ follows the latent structure (3.8), and that both Assumption 3.1 and Assumption 3.2 hold. Fix a $t > 0$ and define + +$$ +\mathscr {F} _ {t} := \left\{s: \mathbb {R} ^ {D} \mapsto \mathbb {R} ^ {D} \mid \| s \| _ {\mathcal {F} _ {1}} \leqslant R _ {t} \right\}, \quad R _ {t} := \bar {R} _ {t} n ^ {\frac {d + 1}{2 (d + 5)}} + \frac {D}{\sigma_ {t} ^ {2}}, \tag {3.9} +$$ + +where $\bar{R}_t$ does not depend on $n$ .10 Suppose that $n$ satisfies + +$$ +n \geqslant n _ {0} (t) := \operatorname {p o l y} \left(D, 1 / \sigma_ {t}, \mu_ {t, x} \vee \beta\right) \cdot \operatorname {p o l y} _ {d} (\bar {L}, \mu_ {t, z} \vee \beta). \tag {3.10} +$$ + +Then, the empirical risk minimizer $\hat{s}_t \in \arg \min_{s \in \mathcal{F}_t} \hat{\mathcal{L}}_t(s)$ satisfies: + +$$ +\underline {{\mathbb {E} _ {\mathcal {D} _ {t}} [ \mathcal {R} _ {t} (\hat {s} _ {t}) ] \leqslant \tilde {O} _ {d} (1) \left[ \frac {D ^ {2}}{\sigma_ {t} ^ {2} n} (\bar {L} (\mu_ {t , z} \vee \beta)) ^ {d + 3} (\mu_ {t , x} \vee \beta) ^ {2} \right] ^ {\frac {2}{d + 5}} + \tilde {O} _ {d} (1) \sqrt {\frac {D ^ {3}}{\sigma_ {t} ^ {6} n} (\mu_ {t , x} \vee \beta) ^ {2}}}}. +$$ + +Proof. First, by Proposition F.2, we know if we set $R_{t}$ to be + +$$ +R _ {t} = \tilde {O} _ {d} (1) (\bar {L} (\mu_ {t, z} \vee \beta)) ^ {(d + 3) / 2} \varepsilon^ {- (d + 1) / 2} + 2 (D - d) / \sigma_ {t} ^ {2}, +$$ + +then, we have $\inf_{s\in \mathcal{F}_t}\mathcal{L}_t(s)\leqslant \varepsilon^2$ + +Now we need to apply Lemma E.2. To do this, we need to define our auxiliary truncated random vectors (cf. (E.1)). We choose the definition: + +$$ +\mathcal {E} _ {x} (\delta) := \left\{\| z _ {0} \| \leqslant \mu_ {0} + \beta \sqrt {2 \log (2 / \delta)}, \| w \| \leqslant \sqrt {D} + \sqrt {2 \log (2 / \delta)} \right\}, \tag {F.4} +$$ + +which by sub-Gaussian concentration followed by a union bound satisfies $\mathbb{P}\{\mathcal{E}_x(\delta)\} \geqslant 1 - \delta$ . Note that under this definition of $\mathcal{E}_x(\delta)$ , we can take: + +$$ +\check {\mu} _ {t, x} (\delta) \lesssim \mu_ {t, x} + \beta \sqrt {\log (1 / \delta)}, \quad \check {\mu} _ {t, q} (\delta) \lesssim \sigma_ {t} ^ {- 1} (\sqrt {D} + \sqrt {\log (1 / \delta)}). \tag {F.5} +$$ + +By applying Lemma E.2, we obtain for $\gamma \in (0,1)$ + +$$ +\mathbb {E} \sup _ {f \in \mathcal {F} _ {t}} \left[ \mathcal {L} _ {t} (f) - (1 + \gamma) \hat {\mathcal {L}} _ {t} (f) \right] \leqslant \tilde {O} (1) (1 + \gamma^ {- 1}) \frac {D}{n} \left[ R _ {t} ^ {2} \left(\mu_ {t, x} \vee \beta\right) ^ {2} + 1 / \sigma_ {t} ^ {2} \right]. +$$ + +By the basic inequality Proposition E.1, + +$$ +\begin{array}{l} \mathbb {E} _ {\mathcal {D} _ {t}} [ \mathcal {R} _ {t} (\hat {f} _ {t}) ] \leqslant 2 \varepsilon^ {2} + \tilde {O} _ {d} (\gamma^ {- 1}) \frac {D}{n} (\bar {L} (\mu_ {t, z} \vee \beta)) ^ {d + 3} \varepsilon^ {- (d + 1)} (\mu_ {t, x} \vee \beta) ^ {2} \\ + \tilde {O} _ {d} (\gamma^ {- 1}) \frac {D ^ {2}}{n \sigma_ {t} ^ {4}} (\mu_ {t, x} \vee \beta) ^ {2} + \gamma \cdot C _ {t}. \\ \end{array} +$$ + +We now optimize this expression over both $\varepsilon, \gamma \in (0,1)$ . We first optimize both expressions ignoring the constraint that $\varepsilon, \gamma < 1$ . First, optimizing over $\gamma$ , we set + +$$ +\gamma = \tilde {O} _ {d} (1) \sqrt {\frac {1}{C _ {t}} \left[ \frac {D}{n} (\bar {L} (\mu_ {t , z} \vee \beta)) ^ {d + 3} \varepsilon^ {- (d + 1)} (\mu_ {t , x} \vee \beta) ^ {2} + \frac {D ^ {2}}{n \sigma_ {t} ^ {4}} (\mu_ {t , x} \vee \beta) ^ {2} \right]}, +$$ + +and from this we obtain: + +$$ +\mathbb {E} _ {\mathcal {D} _ {t}} [ \mathcal {R} _ {t} (\hat {f} _ {t}) ] \leqslant 2 \varepsilon^ {2} + \sqrt {\tilde {O} _ {d} (1) \frac {C _ {t} D}{n} (\bar {L} (\mu_ {t , z} \vee \beta)) ^ {d + 3} \varepsilon^ {- (d + 1)} (\mu_ {t , x} \vee \beta) ^ {2}} + \sqrt {\tilde {O} _ {d} (1) \frac {C _ {t} D ^ {2}}{n \sigma_ {t} ^ {4}} (\mu_ {t , x} \vee \beta) ^ {2}}. +$$ + +Now optimizing over $\varepsilon$ , we set + +$$ +\varepsilon = \tilde {O} _ {d} (1) \left[ \frac {C _ {t} D}{n} (\bar {L} (\mu_ {t, z} \vee \beta)) ^ {d + 3} (\mu_ {t, x} \vee \beta) ^ {2} \right] ^ {1 / (d + 5)}, +$$ + +and obtain: + +$$ +\mathbb {E} _ {\mathcal {D} _ {t}} [ \mathcal {R} _ {t} (\hat {f} _ {t}) ] \leqslant \tilde {O} _ {d} (1) \left[ \frac {C _ {t} D}{n} (\bar {L} (\mu_ {t, z} \vee \beta)) ^ {d + 3} (\mu_ {t, x} \vee \beta) ^ {2} \right] ^ {2 / (d + 5)} + \tilde {O} _ {d} (1) \sqrt {\frac {C _ {t} D ^ {2}}{n \sigma_ {t} ^ {4}} (\mu_ {t , x} \vee \beta) ^ {2}}. +$$ + +The proof concludes by setting $n$ large enough so that both $\varepsilon, \gamma < 1$ . + +We now restate and prove Corollary 3.4, our main end-to-end bound for the latent subspace case. + +Corollary 3.4. Fix $\varepsilon, \zeta \in (0,1)$ . Suppose that $p_0$ follows the latent structure (3.8), and that both Assumption 3.1 and Assumption 3.2 hold. Consider the exponential integrator (3.4) with: + +$$ +T = c _ {0} \log \left(\frac {\sqrt {D} \vee \mu_ {0}}{\varepsilon}\right), \quad N = 2 \left[ c _ {1} \frac {D \vee \mu_ {0} ^ {2}}{\varepsilon^ {2}} \left[ \log^ {2} \left(\frac {\sqrt {D} \vee \mu_ {0}}{\varepsilon}\right) + \log^ {2} \left(\frac {1}{\zeta}\right) \right] \right], \tag {3.11} +$$ + +and reverse process discretization timesteps $\{\tau_i\}_{i=0}^N$ defined as: + +$$ +\tau_ {i} = \left\{ \begin{array}{l l} 2 (T - 1) \frac {i}{N} & i f i \in \{0, \dots , N / 2 \}, \\ T - \zeta^ {2 i / N - 1} & i f i \in \{N / 2 + 1, \dots , N \}. \end{array} \right. \tag {3.12} +$$ + +Next, define the forward process timesteps $\{t_i\}_{i=0}^{N-1}$ by $t_i := T - \tau_{N-i}$ . Suppose the exponential integration scheme is run with score functions $\{\hat{s}_{t_i}\}_{i=0}^{N-1}$ , where $\hat{s}_{t_i} \in \arg \min_{s \in \mathcal{F}_{t_i}} \hat{\mathcal{L}}_{t_i}(s)$ with $\mathcal{F}_t$ as defined in (3.9). Suppose furthermore that $n$ satisfies: + +$$ +n \geqslant \tilde {O} _ {d} (1) \max \left\{\frac {D ^ {2}}{\zeta} (\bar {L} (\mu_ {z} \vee \beta)) ^ {d + 3} (\mu_ {x} \vee \beta) ^ {2} \cdot \varepsilon^ {- (d + 5)}, \frac {D ^ {3}}{\zeta^ {3}} (\mu_ {x} \vee \beta) ^ {2} \cdot \varepsilon^ {- 4}, n _ {0} (\zeta) \right\}, +$$ + +where $n_0(\cdot)$ is defined in (3.10). With constant probability (over the randomness of the training datasets $\{\mathcal{D}_{t_i}\}_{i=0}^{N-1}$ ), we have that $\mathrm{KL}(p_{\zeta} \parallel \mathrm{Law}(\hat{y}_{T-\zeta})) \leqslant \varepsilon^2$ , where $\mathrm{Law}(\hat{y}_{T-\zeta})$ refers to the distribution of the random vector $\hat{y}_{T-\zeta}$ . + +Proof. Using the bounds $\mu_{t,z} \leqslant \mu_z$ and $\mu_{t,x} \leqslant \mu_x$ , from Theorem 3.3 we have that the following ERM bound holds for all $t \in [0,T]$ : + +$$ +\mathbb {E} _ {\mathcal {D} _ {t}} [ \mathcal {R} _ {t} (\hat {f} _ {t}) ] \leqslant \tilde {O} _ {d} (1) \left[ \frac {D ^ {2}}{n \sigma_ {t} ^ {2}} (\bar {L} (\mu_ {z} \vee \beta)) ^ {d + 3} (\mu_ {x} ^ {2} \vee \beta^ {2}) \right] ^ {2 / (d + 5)} + \tilde {O} _ {d} (1) \sqrt {\frac {D ^ {3}}{n \sigma_ {t} ^ {6}} (\mu_ {x} ^ {2} \vee \beta^ {2})}. +$$ + +Furthermore, since $e^{-x} \leqslant 1 - x / 2$ for $x \in [0,1.59]$ , then for $t \leqslant 0.795$ we have + +$$ +\sigma_ {t} ^ {2} = 1 - \exp (- 2 t) \geqslant t \Longrightarrow 1 / \sigma_ {t} ^ {2} \leqslant 1 / t. +$$ + +On the other hand, for $t > 0.795$ , we have the bound + +$$ +\sigma_ {t} ^ {2} = 1 - \exp (- 2 t) \geqslant 1 - \exp (- 1. 5 9) \geqslant 0. 7 9 6 \Longrightarrow 1 / \sigma_ {t} ^ {2} \lesssim 1. +$$ + +Combining these inequalities we have that $1 / \sigma_t^2\leqslant 1 / \sigma_\zeta^2\lesssim 1 / \zeta$ for all $t\geqslant \zeta$ + +Hence, using the choice of $T$ , $N$ from (3.11) and $\{t_i\}_{i=0}^N$ as specified in Lemma C.2, we have that: + +$$ +\begin{array}{l} \sum_ {k = 0} ^ {N - 1} \gamma_ {k} \mathbb {E} _ {p _ {T - t _ {k}}} \| \hat {f} _ {T - t _ {k}} - \nabla \log p _ {T - t _ {k}} \| ^ {2} \\ \lesssim T \left[ \tilde {O} _ {d} (1) \left[ \frac {D ^ {2}}{n \zeta} (\bar {L} (\mu_ {z} \vee \beta)) ^ {d + 3} (\mu_ {x} ^ {2} \vee \beta^ {2}) \right] ^ {2 / (d + 5)} + \tilde {O} _ {d} (1) \sqrt {\frac {D ^ {3}}{n \zeta^ {3}} (\mu_ {x} ^ {2} \vee \beta^ {2})} \right] \\ \lesssim \log \left(\frac {\sqrt {D} \vee \mu_ {0}}{\varepsilon}\right) \left[ \tilde {O} _ {d} (1) \left[ \frac {D ^ {2}}{n \zeta} (\bar {L} (\mu_ {z} \vee \beta)) ^ {d + 3} (\mu_ {x} ^ {2} \vee \beta^ {2}) \right] ^ {2 / (d + 5)} + \tilde {O} _ {d} (1) \sqrt {\frac {D ^ {3}}{n \zeta^ {3}} (\mu_ {x} ^ {2} \vee \beta^ {2})} \right]. \\ \end{array} +$$ + +Hence, in order to make $\varepsilon_{\mathrm{score}}^2 \leqslant \varepsilon^2$ , we need to take $n$ large enough such that the following conditions hold: + +$$ +\begin{array}{l} \log \left(\frac {\sqrt {D} \vee \mu_ {0}}{\varepsilon}\right) \tilde {O} _ {d} (1) \left[ \frac {D ^ {2}}{n \zeta} (\bar {L} (\mu_ {z} \vee \beta)) ^ {d + 3} (\mu_ {x} ^ {2} \vee \beta^ {2}) \right] ^ {2 / (d + 5)} \lesssim \varepsilon^ {2}, \\ \log \left(\frac {\sqrt {D} \vee \mu_ {0}}{\varepsilon}\right) \tilde {O} _ {d} (1) \sqrt {\frac {D ^ {3}}{n \zeta^ {3}} (\mu_ {x} ^ {2} \vee \beta^ {2})} \lesssim \varepsilon^ {2}. \\ \end{array} +$$ + +Hence, we need to take $n$ satisfying: + +$$ +n \geqslant \tilde {O} _ {d} (1) \max \left\{\frac {D ^ {2}}{\zeta} (\bar {L} (\mu_ {z} \vee \beta)) ^ {d + 3} (\mu_ {x} ^ {2} \vee \beta^ {2}) \cdot \varepsilon^ {- (d + 5)}, \frac {D ^ {3}}{\zeta^ {3}} (\mu_ {x} ^ {2} \vee \beta^ {2}) \cdot \varepsilon^ {- 4} \right\}. +$$ + +On the other hand we also need to take $n \geqslant n_0(\zeta)$ (cf. (3.10)). The claim now follows. + +![](images/062338b3b3cee3dc8a1597bc9eb7dee8c917d513c9ebb31b38db0f9326133190.jpg) + +# G ANALYSIS OF INDEPENDENT COMPONENTS (SECTION 3.2) + +We follow a very similar structure as in Appendix F. We first start with an approximation result. + +Proposition G.1. For an $M \geqslant 1$ and $i \in [K]$ . For any $\varepsilon \in (0, \bar{L}_i M / 2)$ , there exists an $f_{\varepsilon} : \mathbb{R}^{d_i} \mapsto \mathbb{R}^{d_i}$ such that $\sup_{z \in B_2(d_i, M)} \| f_{\varepsilon}(z) - \nabla \log \pi_t^{(i)}(z) \| \leqslant \varepsilon$ , and + +$$ +\left\| f _ {\varepsilon} \right\| _ {\mathcal {F} _ {1}} \leqslant R _ {\text {i n d}} ^ {(i)} (\varepsilon , M) := O _ {d} (1) \left(\bar {L} _ {i} M\right) ^ {(d + 3) / 2} \varepsilon^ {- (d + 1) / 2} \log^ {(d + 1) / 2} \left(\bar {L} _ {i} M / \varepsilon\right). \tag {G.1} +$$ + +Proof. The proof is nearly identical to Proposition F.1, and therefore we omit the details. + +![](images/634bd498aac4e45341a2561d37de27554d6015259066708bbfd234361dce2eca.jpg) + +Next, we upgrade the previous approximation result to approximation in $L_{2}(p_{t})$ . + +Proposition G.2. Fix $\varepsilon_1, \ldots, \varepsilon_K \in (0, 1)$ . There exists an $\hat{s}: \mathbb{R}^D \mapsto \mathbb{R}^D$ satisfying: + +$$ +\| \hat {s} \| _ {\mathcal {F} _ {1}} \leqslant \sum_ {i = 1} ^ {K} \tilde {O} _ {d _ {i}} (1) (\bar {L} _ {i} (\mu_ {t, x} ^ {(i)} \vee \beta)) ^ {(d _ {i} + 3) / 2} \varepsilon_ {i} ^ {- (d _ {i} + 1) / 2}, \quad \| \hat {s} - \nabla \log p _ {t} \| _ {L _ {2} (p _ {t})} \leqslant \sqrt {\sum_ {i = 1} ^ {K} \varepsilon_ {i} ^ {2}}. +$$ + +Proof. Recall that $P_{i} \in \mathbb{R}^{d_{i} \times D}$ selects the coordinates corresponding to the $i$ -th variable group (cf. Proposition A.2). Define the sets $M^{(i)}(\delta)$ as: + +$$ +M ^ {(i)} (\delta) := \left\{x \in \mathbb {R} ^ {D} \mid \| P _ {i} U ^ {\mathsf {T}} x \| \leqslant A _ {\delta} ^ {(i)} \right\}, \quad A _ {\delta} ^ {(i)} := c _ {0} (\mu_ {t, x} ^ {(i)} + \beta_ {i} \sqrt {\log (1 / \delta)}), \quad i \in [ K ]. +$$ + +With appropriate choice of $c_{0}$ , we have that $\mathbb{P}_{x_t\sim p_t}\{x_t\in M^{(i)}(\delta)\} \geqslant 1 - \delta$ + +Given $\varepsilon, \delta \in (0,1)$ , from Proposition G.1, there exists $\hat{h}_i: \mathbb{R}^d \mapsto \mathbb{R}^d$ for $i \in [K]$ such that: + +$$ +\| \hat{h}_{i}\|_{\mathcal{F}_{1}}\leqslant R^{(i)}_{\mathrm{ind}}(\varepsilon ,A^{(i)}_{\delta}),\sup_{z\in B_{2}(d,A^{(i)}_{\delta})}\| \hat{h}_{i}(z) - \nabla \log \pi^{(i)}_{t}(z)\| \leqslant \varepsilon . +$$ + +Now define $\hat{s}_i\coloneqq UP_i^\top \hat{h}_i(P_iU^\top x)$ . Observe that: + +$$ +\begin{array}{l} \sup _ {x \in M ^ {(i)} (\delta)} \| \hat {s} _ {i} (x) - U P _ {i} ^ {\mathsf {T}} \nabla \log \pi_ {t} ^ {(i)} (P _ {i} U ^ {\mathsf {T}} x) \| \leqslant \sup _ {x \in M ^ {(i)} (\delta)} \| \hat {h} _ {i} (P _ {i} U ^ {\mathsf {T}} x) - \nabla \log \pi_ {t} ^ {(i)} (P _ {i} U ^ {\mathsf {T}} x) \| \\ \leqslant \sup _ {z \in B _ {2} \left(d _ {i}, A _ {\delta} ^ {(i)}\right)} \| \hat {h} _ {i} (z) - \nabla \log \pi_ {t} ^ {(i)} (z) \| \\ \leqslant \varepsilon . \\ \end{array} +$$ + +Next, observe that $\| \hat{s}_i\|_{\mathcal{F}_1} = \| \hat{h}_i\|_{\mathcal{F}_1}$ by Fact A.3. Invoking Proposition D.1 as is done in the proof of Proposition F.2, we have that for all $i\in [K]$ , $\| \hat{s}_i - UP_i^\top \nabla \log \pi_t^{(i)}(P_iU^\top \cdot)\|_{L_2(p_t)}\leqslant \varepsilon_i$ and + +$$ +\| \hat {s} _ {i} \| _ {\mathcal {F} _ {1}} \leqslant \tilde {O} _ {d _ {i}} (1) (\bar {L} _ {i} (\mu_ {t, z} ^ {(i)} \vee \beta_ {i})) ^ {(d _ {i} + 3) / 2} \varepsilon_ {i} ^ {- (d + 1) / 2}. +$$ + +Recall by Proposition A.2 we have: + +$$ +\nabla \log p _ {t} (x) = \sum_ {i = 1} ^ {K} U P _ {i} ^ {\intercal} \nabla \log \pi_ {t} ^ {(i)} (P _ {i} U ^ {\intercal} x). +$$ + +Hence, setting $\hat{s} = \sum_{i=1}^{K} \hat{s}_i$ , we have that + +$$ +\begin{array}{l} \left\| \hat {s} - \nabla \log p _ {t} \right\| _ {L _ {2} (p _ {t})} ^ {2} \\ = \mathbb {E} \left\| \sum_ {i = 1} ^ {K} U P _ {i} ^ {\mathsf {T}} (\hat {h} _ {i} (P _ {i} U ^ {\mathsf {T}} x _ {t}) - \nabla \log \pi_ {t} ^ {(i)} (P _ {i} U ^ {\mathsf {T}} x _ {t})) \right\| ^ {2} \\ = \sum_ {i = 1} ^ {K} \mathbb {E} \| U P _ {i} ^ {\mathsf {T}} \left(\hat {h} _ {i} \left(P _ {i} U ^ {\mathsf {T}} x _ {t}\right) - \nabla \log \pi_ {t} ^ {(i)} \left(P _ {i} U ^ {\mathsf {T}} x _ {t}\right)\right) \| ^ {2} \quad \text {s i n c e} P _ {j} P _ {i} ^ {\mathsf {T}} = 0 \text {f o r} i \neq j \\ = \sum_ {i = 1} ^ {K} \| \hat {s} _ {i} - U P _ {i} ^ {\mathsf {T}} \nabla \log \pi_ {t} ^ {(i)} (P _ {i} U ^ {\mathsf {T}} \cdot) \| _ {L _ {2} (p _ {t})} ^ {2} \\ \leqslant \sum_ {i = 1} ^ {K} \varepsilon_ {i} ^ {2}. \\ \end{array} +$$ + +Furthermore, + +$$ +\| \hat {s} \| _ {\mathcal {F} _ {1}} \leqslant \sum_ {i = 1} ^ {K} \| \hat {s} _ {i} \| _ {\mathcal {F} _ {1}} \leqslant \sum_ {i = 1} ^ {K} \tilde {O} _ {d _ {i}} (1) (\bar {L} _ {i} (\mu_ {t, z} ^ {(i)} \vee \beta_ {i})) ^ {(d _ {i} + 3) / 2} _ {\varepsilon_ {i} ^ {- (d + 1) / 2}}. +$$ + +We now prove Theorem 3.7, our score estimation result for the independent components setting. + +Theorem 3.7. Suppose that $p_0$ follows the latent structure (3.13), and that both Assumption 3.5 and Assumption 3.6 hold. Fix a $t > 0$ and define + +$$ +\mathcal {F} _ {t} := \left\{s: \mathbb {R} ^ {D} \mapsto \mathbb {R} ^ {D} \mid \| s \| _ {\mathcal {F} _ {1}} \leqslant R _ {t} \right\}, \quad R _ {t} := \sum_ {i = 1} ^ {K} \bar {R} _ {t} ^ {(i)} n ^ {\frac {d _ {i} + 1}{2 \left(d _ {i} + 5\right)}}, \tag {3.14} +$$ + +where $\bar{R}_t^{(i)}$ does not depend on $n$ . Suppose that $n$ satisfies + +$$ +n \geqslant n _ {0} (t) := \operatorname {p o l y} \left(D, 1 / \sigma_ {t}, \mu_ {t, x} \vee \beta\right) \cdot \max _ {i \in [ K ]} \operatorname {p o l y} _ {d _ {i}} \left(\bar {L} _ {i}, \mu_ {t, x} ^ {(i)} \vee \beta^ {(i)}\right). \tag {3.15} +$$ + +Then, the empirical risk minimizer $\hat{s}_t \in \arg \min_{s \in \mathcal{F}_t} \hat{\mathcal{L}}_t(s)$ satisfies: + +$$ +\mathbb {E} _ {\mathcal {D} _ {t}} [ \mathcal {R} _ {t} (\hat {s} _ {t}) ] \leqslant \sum_ {i = 1} ^ {K} \tilde {O} _ {d _ {i}} (1) \left[ \frac {D ^ {2} K}{\sigma_ {t} ^ {2} n} (\bar {L} _ {i} (\mu_ {t, x} ^ {(i)} \vee \beta_ {i})) ^ {d _ {i} + 3} (\mu_ {t, x} \vee \beta) ^ {2} \right] ^ {\frac {2}{d _ {i} + 5}} + \tilde {O} (1) \sqrt {\frac {D ^ {2}}{\sigma_ {t} ^ {4} n} (\mu_ {t , x} \vee \beta) ^ {2}}. +$$ + +Proof. Here we mimic the proof of Theorem 3.3. First, by Proposition G.2, we know if we set $R_{t}$ as + +$$ +R _ {t} = \sum_ {i = 1} ^ {K} \tilde {O} _ {d _ {i}} (1) (\bar {L} _ {i} (\mu_ {t, x} ^ {(i)} \vee \beta_ {i})) ^ {(d _ {i} + 3) / 2} \varepsilon_ {i} ^ {- (d _ {i} + 1) / 2}, +$$ + +then, we have $\inf_{s\in \mathcal{F}_t}\mathcal{L}_t(s)\leqslant \sum_{i = 1}^{K}\varepsilon_i^2.$ + +Our next step is to apply Lemma E.2. To do this we need to define auxiliary truncated random vectors (cf. (E.1)). In this case, we use the definition: + +$$ +\mathcal {E} _ {x} (\delta) := \bigcap_ {i \in [ K ]} \left\{\| z _ {0} ^ {(i)} \| \leqslant \mu_ {0} ^ {(i)} + \beta_ {i} \sqrt {2 \log (2 K / \delta)} \right\} \cap \left\{\| w \| \leqslant \sqrt {D} + \sqrt {2 \log (2 / \delta)} \right\}, \tag {G.2} +$$ + +which satisfies $\mathbb{P}\{\mathcal{E}_x(\delta)\} \geqslant 1 - \delta$ . We have + +$$ +\check {\mu} _ {t, x} (\delta) \lesssim \mu_ {t, x} + \beta \sqrt {\log (K / \delta)}, \quad \check {\mu} _ {t, q} (\delta) \lesssim \sigma_ {t} ^ {- 1} (\sqrt {D} + \sqrt {\log (1 / \delta)}). +$$ + +By applying Lemma E.2, we obtain for $\gamma \in (0,1)$ + +$$ +\begin{array}{l} \mathbb {E} \sup _ {f \in \mathcal {F} _ {t}} [ \mathcal {L} _ {t} (f) - (1 + \gamma) \hat {\mathcal {L}} _ {t} (f) ] \\ \leqslant \tilde {O} (1) \gamma^ {- 1} \frac {D}{n} \left[ R _ {t} ^ {2} \left(\mu_ {t, x} \vee \beta\right) ^ {2} + 1 / \sigma_ {t} ^ {2} \right] \\ \leqslant \gamma^ {- 1} \frac {D K}{n} \sum_ {i = 1} ^ {K} \tilde {\cal O} _ {d _ {i}} (1) (\bar {L} _ {i} (\mu_ {t, x} ^ {(i)} \vee \beta_ {i})) ^ {d _ {i} + 3} \varepsilon_ {i} ^ {- (d _ {i} + 1)} (\mu_ {t, x} \vee \beta) ^ {2} + \tilde {\cal O} (1) \frac {D}{\gamma n \sigma_ {t} ^ {2}} \\ \end{array} +$$ + +By the basic inequality Proposition E.1, + +$$ +\begin{array}{l} \mathbb {E} _ {\mathcal {D} _ {t}} \left[ \mathcal {R} _ {t} (\hat {f} _ {t}) \right] \leqslant 2 \sum_ {i = 1} ^ {K} \varepsilon_ {i} ^ {2} + \gamma^ {- 1} \frac {D K}{n} \sum_ {i = 1} ^ {K} \tilde {O} _ {d _ {i}} (1) \left(\bar {L} _ {i} \left(\mu_ {t, x} ^ {(i)} \vee \beta_ {i}\right)\right) ^ {d _ {i} + 3} \varepsilon_ {i} ^ {- (d _ {i} + 1)} \left(\mu_ {t, x} \vee \beta\right) ^ {2} \\ + \tilde {O} (1) \frac {D}{\gamma n \sigma_ {t} ^ {2}} + \gamma \cdot C _ {t}. \\ \end{array} +$$ + +We now need to optimize over both $\varepsilon_{i},\gamma \in (0,1)$ . We first set $\gamma$ as: + +$$ +\gamma = \sqrt {\frac {1}{C _ {t}} \cdot \left[ \frac {D K}{n} \sum_ {i = 1} ^ {K} \tilde {O} _ {d _ {i}} (1) (\bar {L} _ {i} (\mu_ {t , x} ^ {(i)} \vee \beta_ {i})) ^ {d _ {i} + 3} \varepsilon_ {i} ^ {- (d _ {i} + 1)} (\mu_ {t , x} \vee \beta) ^ {2} + \tilde {O} (1) \frac {D}{n \sigma_ {t} ^ {2}} \right]}, +$$ + +from which we obtain: + +$$ +\mathbb {E} _ {\mathcal {D} _ {t}} [ \mathcal {R} _ {t} (\hat {f} _ {t}) ] \leqslant 2 \sum_ {i = 1} ^ {K} \varepsilon_ {i} ^ {2} + \sum_ {i = 1} ^ {K} \sqrt {\tilde {O} _ {d _ {i}} (1) \frac {C _ {t} D K}{n} (\bar {L} _ {i} (\mu_ {t , x} ^ {(i)} \vee \beta_ {i})) ^ {d _ {i} + 3} \varepsilon_ {i} ^ {- (d _ {i} + 1)} (\mu_ {t , x} \vee \beta) ^ {2}} + \sqrt {\tilde {O} (1) \frac {C _ {t} D}{n \sigma_ {t} ^ {2}}}. +$$ + +We now set $\varepsilon_{i}$ as: + +$$ +\varepsilon_ {i} = \tilde {\mathcal {O}} _ {d _ {i}} (1) \left[ \frac {C _ {t} D K}{n} (\bar {L} _ {i} (\mu_ {t, x} ^ {(i)} \vee \beta_ {i})) ^ {d _ {i} + 3} (\mu_ {t, x} \vee \beta) ^ {2} \right] ^ {1 / (d _ {i} + 5)}, +$$ + +and obtain: + +$$ +\mathbb {E} _ {\mathcal {D} _ {t}} \left[ \mathcal {R} _ {t} \left(\hat {f} _ {t}\right) \right] \leqslant \sum_ {i = 1} ^ {K} \tilde {O} _ {d _ {i}} (1) \left[ \frac {C _ {t} D K}{n} \left(\bar {L} _ {i} \left(\mu_ {t, x} ^ {(i)} \vee \beta_ {i}\right)\right) ^ {d _ {i} + 3} \left(\mu_ {t, x} \vee \beta\right) ^ {2} \right] ^ {2 / (d _ {i} + 5)} + \sqrt {\tilde {O} (1) \frac {C _ {t} D}{n \sigma_ {t} ^ {2}}}. +$$ + +The proof concludes by setting $n$ large enough so that all of $\varepsilon_{i},\gamma < 1$ + +![](images/f3203affe96a67d430deaeac23f769f6b3b5e3e3bf4b558106df08b4aa0cbb96.jpg) + +Finally, we conclude with Corollary 3.8, which provides an end-to-end sampling bound. + +Corollary 3.8. Fix $\varepsilon, \zeta \in (0,1)$ . Suppose that $p_0$ follows the latent structure (3.13), and that both Assumption 3.5 and Assumption 3.6 hold. Consider the exponential integrator (3.4) with $(N,T)$ as in (3.11) and reverse process discretization timesteps $\{\tau_i\}_{i=0}^N$ defined as in (3.12). Next, define the forward process timesteps $\{t_i\}_{i=0}^{N-1}$ by $t_i \coloneqq T - \tau_{N-i}$ . Suppose the exponential integration scheme is run with score functions $\{\hat{s}_{t_i}\}_{i=0}^{N-1}$ , where $\hat{s}_{t_i} \in \arg \min_{s \in \mathcal{F}_{t_i}} \hat{\mathcal{L}}_{t_i}(s)$ with $\mathcal{F}_t$ as defined in (3.14). Suppose that $n \geqslant n_0(\zeta)$ satisfies: + +$$ +n\geqslant (\mu_{x}\lor \beta)^{2}\max \left\{\max_{i\in [K]}\left\{\frac{\tilde{O}_{d_{i}}(1)D^{2}}{\zeta} K^{(d_{i} + 7) / 2}(\bar{L}_{i}(\mu_{x}^{(i)}\lor \beta))^{d_{i} + 3}\cdot \varepsilon^{-(d_{i} + 5)}\right\} ,\frac{\tilde{O}(1)D^{2}}{\zeta^{2}}\cdot \varepsilon^{-4}\right\} . +$$ + +where $n_0(\cdot)$ is defined in (3.15). With constant probability (over the randomness of the training datasets $\{\mathcal{D}_{t_i}\}_{i=0}^{N-1}$ ), we have that $\mathrm{KL}(p_{\zeta} \parallel \mathrm{Law}(\hat{y}_{T-\zeta})) \leqslant \varepsilon^2$ . + +Proof. We follow the proof of Corollary 3.4. Using the bounds $\mu_{t,x}^{(i)}\leqslant \mu_x^{(i)}$ and $\mu_{t,x}\leqslant \mu_x$ , from Theorem 3.7 we have that the following ERM bound holds for all $t\in [0,T]$ : + +$$ +\mathbb {E} _ {\mathcal {D} _ {t}} [ \mathcal {R} _ {t} (\hat {s} _ {t}) ] \leqslant \sum_ {i = 1} ^ {K} \tilde {O} _ {d _ {i}} (1) \left[ \frac {D ^ {2} K}{\sigma_ {t} ^ {2} n} (\bar {L} _ {i} (\mu_ {x} ^ {(i)} \vee \beta_ {i})) ^ {d _ {i} + 3} (\mu_ {x} \vee \beta) ^ {2} \right] ^ {\frac {2}{d _ {i} + 5}} + \tilde {O} (1) \sqrt {\frac {D ^ {2}}{\sigma_ {t} ^ {4} n} (\mu_ {x} \vee \beta) ^ {2}}. +$$ + +Recalling that $1 / \sigma_t^{-2} \lesssim 1 / \zeta$ for all $t \geqslant \zeta$ , using the choice of $T, N$ from (3.11) and $\{t_i\}_{i=0}^N$ we have that: + +$$ +\begin{array}{l} \sum_ {k = 0} ^ {N - 1} \gamma_ {k} \mathbb {E} _ {p _ {T - t _ {k}}} \| \hat {f} _ {T - t _ {k}} - \nabla \log p _ {T - t _ {k}} \| ^ {2} \\ \lesssim \log \left(\frac {\sqrt {D} \vee \mu_ {0}}{\varepsilon}\right) \sum_ {i = 1} ^ {K} \tilde {O} _ {d _ {i}} (1) \left[ \frac {D ^ {2} K}{\zeta n} (\bar {L} _ {i} (\mu_ {x} ^ {(i)} \vee \beta_ {i})) ^ {d _ {i} + 3} (\mu_ {x} \vee \beta) ^ {2} \right] ^ {\frac {2}{d _ {i} + 5}} \\ + \log \left(\frac {\sqrt {D} \vee \mu_ {0}}{\varepsilon}\right) \tilde {O} (1) \sqrt {\frac {D ^ {2}}{\zeta^ {2} n} (\mu_ {x} \vee \beta) ^ {2}}. \\ \end{array} +$$ + +Hence, in order to make $\varepsilon_{\mathrm{score}}^2 \leqslant \varepsilon^2$ , we need to take $n$ large enough such that the following conditions hold: + +$$ +\begin{array}{l} \log \left(\frac {\sqrt {D} \vee \mu_ {0}}{\varepsilon}\right) \sum_ {i = 1} ^ {K} \tilde {O} _ {d _ {i}} (1) \left[ \frac {D ^ {2} K}{\zeta n} (\bar {L} _ {i} (\mu_ {x} ^ {(i)} \vee \beta_ {i})) ^ {d _ {i} + 3} (\mu_ {x} \vee \beta) ^ {2} \right] ^ {\frac {2}{d _ {i} + 5}} \lesssim \varepsilon^ {2}, \\ \log \left(\frac {\sqrt {D} \vee \mu_ {0}}{\varepsilon}\right) \tilde {O} (1) \sqrt {\frac {D ^ {2}}{\zeta^ {2} n} (\mu_ {x} \vee \beta) ^ {2}} \lesssim \varepsilon^ {2}. \\ \end{array} +$$ + +Hence, we need to take $n$ satisfying: + +$$ +n\geqslant (\mu_{x}\lor \beta)^{2}\max \left\{\max_{i\in [K]}\left\{\frac{\tilde{O}_{d_{i}}(1)D^{2}}{\zeta} K^{(d_{i} + 7) / 2}(\bar{L}_{i}(\mu_{x}^{(i)}\lor \beta))^{d_{i} + 3}\cdot \varepsilon^{-(d_{i} + 5)}\right\} ,\frac{\tilde{O}(1)D^{2}}{\zeta^{2}}\cdot \varepsilon^{-4}\right\} . +$$ + +On the other hand we also need to take $n \geqslant n_0(\zeta)$ (cf. (3.15)). The claim now follows. + +![](images/9a6b1184b4295c607b85f4ce1fdb3efd302ecb3f2efa88fa20ebfb9aa9b104b3.jpg) \ No newline at end of file diff --git a/ICLR/2025/Shallow diffusion networks provably learn hidden low-dimensional structure/images.zip b/ICLR/2025/Shallow diffusion networks provably learn hidden low-dimensional structure/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..9172aa1315432ae9e60bfcf0cdc4db98df534b7f --- /dev/null +++ b/ICLR/2025/Shallow diffusion networks provably learn hidden low-dimensional structure/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7a677a55562d617d4ad3293381279445f15e573ea566c0e7cc5caaeec05151af +size 2354939 diff --git a/ICLR/2025/Shallow diffusion networks provably learn hidden low-dimensional structure/layout.json b/ICLR/2025/Shallow diffusion networks provably learn hidden low-dimensional structure/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..7d3a1463298ec386669a62f14510af87584c8a62 --- /dev/null +++ b/ICLR/2025/Shallow diffusion networks provably learn hidden low-dimensional structure/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:175cf99c7655f4db954a8e888a2c04279f3781e97ae5cf88cd224dacbbc369ca +size 1803485 diff --git a/ICLR/2025/Shape as Line Segments_ Accurate and Flexible Implicit Surface Representation/8f7d58c7-542f-46d8-b57a-8df24e68cf24_content_list.json b/ICLR/2025/Shape as Line Segments_ Accurate and Flexible Implicit Surface Representation/8f7d58c7-542f-46d8-b57a-8df24e68cf24_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..09e07bcf3bd6ce5e64816ccc9c41e8fe9a361d0b --- /dev/null +++ b/ICLR/2025/Shape as Line Segments_ Accurate and Flexible Implicit Surface Representation/8f7d58c7-542f-46d8-b57a-8df24e68cf24_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f204da5526e34773b556c4df9e2fb995937b6bc51d5913b0aca41e4243f4f444 +size 133067 diff --git a/ICLR/2025/Shape as Line Segments_ Accurate and Flexible Implicit Surface Representation/8f7d58c7-542f-46d8-b57a-8df24e68cf24_model.json b/ICLR/2025/Shape as Line Segments_ Accurate and Flexible Implicit Surface Representation/8f7d58c7-542f-46d8-b57a-8df24e68cf24_model.json new file mode 100644 index 0000000000000000000000000000000000000000..cb2edb348775798e686d023b5403467bed7c80b5 --- /dev/null +++ b/ICLR/2025/Shape as Line Segments_ Accurate and Flexible Implicit Surface Representation/8f7d58c7-542f-46d8-b57a-8df24e68cf24_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f8d9964c33042a1a765014f61f6cbf4b1a37df0c940aee039003c2370b093995 +size 157634 diff --git a/ICLR/2025/Shape as Line Segments_ Accurate and Flexible Implicit Surface Representation/8f7d58c7-542f-46d8-b57a-8df24e68cf24_origin.pdf b/ICLR/2025/Shape as Line Segments_ Accurate and Flexible Implicit Surface Representation/8f7d58c7-542f-46d8-b57a-8df24e68cf24_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..94be4ad551bb51ab9ec89a180e71f4a1698f25a7 --- /dev/null +++ b/ICLR/2025/Shape as Line Segments_ Accurate and Flexible Implicit Surface Representation/8f7d58c7-542f-46d8-b57a-8df24e68cf24_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f9b1bf713c1226a197dc1ebf1652b8a55bc8422ca128a939cf4496614b8b68ea +size 51069010 diff --git a/ICLR/2025/Shape as Line Segments_ Accurate and Flexible Implicit Surface Representation/full.md b/ICLR/2025/Shape as Line Segments_ Accurate and Flexible Implicit Surface Representation/full.md new file mode 100644 index 0000000000000000000000000000000000000000..8a7471bc73eaf05e21b59ec88f495d7dda660d6d --- /dev/null +++ b/ICLR/2025/Shape as Line Segments_ Accurate and Flexible Implicit Surface Representation/full.md @@ -0,0 +1,631 @@ +# SHAPE AS LINE SEGMENTS: ACCURATE AND FLEXIBLE IMPLICIT SURFACE REPRESENTATION + +Siyu Ren + +Department of Computer Science + +City University of Hong Kong + +Hong Kong SAR, China + +siyuren2-c@my.cityu.edu.hk + +Junhui Hou* + +Department of Computer Science + +City University of Hong Kong + +Hong Kong SAR, China + +jh.hou@cityu.edu.hk + +# ABSTRACT + +Distance field-based implicit representations like signed/unsigned distance fields have recently gained prominence in geometry modeling and analysis. However, these distance fields are reliant on the closest distance of points to the surface, introducing inaccuracies when interpolating along cube edges during surface extraction. Additionally, their gradients are ill-defined at certain locations, causing distortions in the extracted surfaces. To address this limitation, we propose Shape as Line Segments (SALS), an accurate and efficient implicit geometry representation based on attributed line segments, which can handle arbitrary structures. Unlike previous approaches, SALS leverages a differentiable Line Segment Field to implicitly capture the spatial relationship between line segments and the surface. Each line segment is associated with two key attributes, intersection flag and ratio, from which we propose edge-based dual contouring to extract a surface. We further implement SALS with a neural network, producing a new neural implicit presentation. Additionally, based on SALS, we design a novel learning-based pipeline for reconstructing surfaces from 3D point clouds. We conduct extensive experiments, showcasing the significant advantages of our methods over state-of-the-art methods. The source code is available at https://github.com/rsy6318/SALS. + +# 1 INTRODUCTION + +Various implicit geometry representations have emerged as powerful approaches in 3D vision, graphics, and robotics (Park et al., 2019; Takikawa et al., 2021; Wang et al., 2021; Mescheder et al., 2019; Chibane et al., 2020b). Unlike explicit representations that define surfaces through point clouds or polygon meshes, implicit representations describe surfaces as the isosurface of a scalar field. The signed/unsigned distance field (SDF/UDF) is among the most widely used implicit representations. Specifically, SDF captures the signed distance from a given point to the closest surface, where the sign is used to distinguish between the inside and outside. The surface can be extracted from SDFs easily via Marching Cubes (MC) (Lorensen & Cline, 1987), Dual Contouring (Ju et al., 2002) or their variants (Ju et al., 2002; Doi & Koide, 1991; Shen et al., 2021). However, SDF can only represent watertight shapes and cannot represent more general shapes, such as those with open boundaries and multi-layers, limiting its applications. By contrast, UDF, representing the absolute distance to the closest surface, allows for the representation of more general shapes. However, extracting surfaces from UDFs is much more difficult than SDFs, although several methods (Guillard et al., 2022; Ye et al., 2022; Chen et al., 2022; Zhang et al., 2023; Ren et al., 2023; Zhou et al., 2022) modified from MC and DC have been recently presented to extract surfaces from UDFs. + +When extracting surfaces from SDFs and UDFs, MC-based methods compute the intersection point on each cube edge by interpolating the ratio of the distance values at the two endpoints of the edge. However, since this distance reflects the closest surface, inaccuracies may arise when there is another surface closer to one or both endpoints, leading to erroneous intersection points, as shown + +in Fig. 1a. Similarly, for DC-based methods (see Fig. 1b), an inaccurately calculated intersection point on the edge can lead to an incorrect solution of the quadratic error function within the cube. The differentiable properties of SDFs and UDFs, specifically their spatial gradients, are critical for surface extraction and offer notable advantages. However, the use of distance fields results in gradients that are meaningless in certain regions, such as at points equidistant from two surfaces (Fig. 1c), or even directly on the surface for UDFs. These limitations of SDFs and UDFs can introduce distortions during surface extraction. + +Distance fields like SDF and UDF focus on the closest distances of individual spatial points to the surface. However, surface extraction from these fields often introduces distortions. As analyzed previously, both MC-based and DC-based methods rely on interpolation along each edge (line segment) of the cubes during surface extraction. Therefore, a natural approach is to shift the focus from individual points to line segments in 3D space. So can we build a field reflecting the spatial relationship between the line segment and the surface? Building on this intuition, we propose Shape as Line Segments (SALS), a precise and versatile implicit surface representation that centers on spatial line segments. SALS consists of two key components: 1) a differentiable line segment field (LSF) that captures the spatial relationship between a query line segment and the surface, and 2) an edge-based dual contouring approach to extract the surface from the LSF. As illustrated in Fig. 1d, our method focuses on line segments, avoiding the distortions typically introduced by SDFs and UDFs when extracting surfaces. Additionally, we establish a relationship between the unoriented surface normal and the proposed LSF, which facilitates surface extraction from SFSs. Based on SALS, we develop a neural surface representation technique and a surface reconstruction method from point clouds. Extensive experiments on diverse geometric data demonstrate the significant superiority of SALS over state-of-the-art methods. + +![](images/dbf0a154665eb638f1c1b36810d5652013b22729268fdaa9b769ecb85714f387.jpg) +(a) + +![](images/9c42b9eef6a046e7f0cac657d3277a07b78e9bd5f939207e48fb919637a5e270.jpg) +(b) + +![](images/9ee8a54fd6bf8a8b45867cfafb4144f5b1ace79182466807f12a09adf3ebaeda.jpg) +(c) +Figure 1: Visual comparisons of various implicit geometry representations and surface extraction methods. The gray points and gray line segments denote the vertices and edges of the cubes, respectively. The blue lines indicate the ground truth surface, while the orange lines represent the reconstructed surfaces. Green points points mark the correctly interpolated points on the edges, whereas red points indicate interpolation errors. The pink arrows and pink lines represent oriented and unoriented normal vectors, respectively. (a) MC. (b) DC. (c) Gradient of distance fields. (d) Ours. + +![](images/018a72819a37e789775ec072fe7d9f6784c7616a58036a801c287c311e7612a5.jpg) +(d) + +In summary, we have made the following key contributions: + +- a novel, accurate, and efficient implicit geometry representation, as well as its neural implementation, termed the line segment field (LSF), capable of handling shapes with arbitrary structures; +- a new surface extraction algorithm specifically designed for LSFs; +- a highly accurate, efficient, and generalizable learning pipeline for surface reconstruction from 3D point clouds. + +# 2 RELATED WORK + +Implicit Geometry Representation. Implicit geometry representations use the isosurface of a function or field to define a surface. Methods such as ONet (Mescheder et al., 2019), IF-Net (Chibane et al., 2020a), CONet (Peng et al., 2020), SPSR (Kazhdan & Hoppe, 2013), SAP (Peng et al., 2021), and POCO (Boulch & Marlet, 2022) employ the binary occupancy field (BOF) to represent surfaces by dividing the space into two regions—inside and outside the surface. This approach formulates the problem as binary classification, where the isosurface at a value of 0.5 defines the surface. Compared to BOFs, signed distance fields (SDFs) offer a more accurate representation by incorporating distance and using signs to indicate inside and outside regions. DeepSDF (Park et al., 2019) and DeepLS (Chabra et al., 2020) optimize latent vectors using an auto-decoder to refine SDFs, while NeuralPull (Baorui et al., 2021) and OSP (Ma et al., 2022) focus on the gradients of SDFs, pulling + +points onto the surface to guide SDFs. Some traditional methods can also be integrated with neural networks; for instance, DeepIMLS (Liu et al., 2021) and DOG (Wang et al., 2022) adapt implicit moving least-squares (IMLS) (Kolluri, 2008) to estimate SDFs. Recently, methods like (Wang et al., 2021; 2023; Meng et al., 2023) utilize SDFs in the volume rendering pipeline, and utilize image information as supervision to optimize the SDFs. + +BOFs and SDFs are limited to representing watertight shapes and cannot handle more general geometries, such as open surfaces with boundaries or non-manifold surfaces. The unsigned distance field (UDF), the absolute value of SDF, is capable of representing more general shapes. NDF (Chibane et al., 2020b) employs 3D CNNs to regress UDFs from voxelized point clouds and generates dense point clouds by adjusting points according to UDF gradients. Building on previous work (Baorui et al., 2021; Ma et al., 2022), CAP-UDF (Zhou et al., 2022) applies a field consistency constraint to achieve consistency-aware UDFs. To improve reconstruction accuracy and generalizability, GeoUDF (Ren et al., 2023) leverages the geometric properties of point clouds to predict UDFs, decoupling UDF from its gradients. Methods like NueralUDF(Long et al., 2023) and NeUDF(Liu et al., 2023) incorporate UDFs to represent the objects in the volume rendering pipeline. Beyond distance fields, other types of implicit fields have also been developed to represent surfaces (Ye et al., 2022; Lu et al., 2024). + +Surface Extraction from Implicit Geometry Representations. Marching Cubes (MC) (Lorensen & Cline, 1987) is the most widely used method for extracting surfaces from BOFs and SDFs. Marching Tetrahedra (Doi & Koide, 1991) and its variant (Shen et al., 2021) further divide the space into tetrahedra, a simpler cell than cubes. However, these methods are not applicable to UDFs due to the lack of inside/outside information. NDF (Chibane et al., 2020b) addresses this limitation by generating a much denser point cloud and then using the ball-pivoting algorithm (Bernardini et al., 1999) to create triangle meshes. + +GIFS (Ye et al., 2022) employs a classifier to determine whether each edge of the cubes intersects the surface and then selects the closest match from the MC lookup table to extract triangles. In contrast, GeoUDF (Ren et al., 2023) uses UDF and its gradient to determine edge-surface intersections. MeshUDF (Guillard et al., 2022) and CAP-UDF (Zhou et al., 2022) adopt a different approach by using one vertex of the cube as a reference and computing the inner product of the UDF gradient with the remaining vertices. This converts a UDF into an SDF within the cube based on the sign of the inner product, allowing triangle extraction through MC. However, this method lacks robustness, often mispredicting faces at edges and corners. DCUDF (Hou et al., 2023) does not directly extract the surface, it first utilizes MC to extract an inflated surface, then the UDF gradients are used to refine the vertices. + +Compared to these MC-based surface extraction techniques, dual contouring (DC) (Ju et al., 2002) preserves sharp surface features by solving a quadratic error function (QEF) in each cube. DC can be applied to BOFs, SDFs, and UDFs alike. Recently, NDC (Chen et al., 2022) improves DC by leveraging neural networks to solve QEFs, and DualMesh (Zhang et al., 2023) by introducing subsampling within each cube. + +# 3 PROPOSED METHOD + +As analyzed previously, existing implicit geometry representations, such as SDF and UDF, primarily focus on the closest distance from individual points to the surface, which can introduce distortion during surface extraction. Moreover, their differentiable properties, such as the gradient of UDF, become ill-defined at certain critical positions, further reducing the accuracy of the extracted surfaces. + +![](images/2e5b78b0f9872f6742672639ee3413dafc1f19c241635688c17e91d1e529cee4.jpg) +(a) + +![](images/5978e372ed9c456141fa391792b740bfb0b298bf6e6a03d1187dc24e0d705c0b.jpg) +(b) +Figure 2: Visual illustration of the two attributes of the query segments: (a) $o$ and (b) $s$ . + +Unlike previous approaches, our method is focused on spatial line segments to capture the geometric relationship between the segments and the surface. Specifically, we introduce a line segment field (LSF) to represent this spatial relationship (Sec. 3.1). We then propose edge-based dual contouring (E-DC) to extract the triangle mesh from the LSF (Sec. 3.2). Finally, based on LSF and E-DC, we + +propose neural shape representation (Sec. 3.3) and a new pipeline for reconstructing surfaces from 3D point clouds (Sec. 3.4). + +# 3.1 DEFINITION OF LINE SEGMENT FIELD + +Unlike existing implicit representations such as BOF and SDF, which concentrate on individual points in space, our line segment field (LSF) emphasizes spatial line segments. Let $\overline{\mathbf{uv}} \in \Omega$ be a query line segment with $\mathbf{u}, \mathbf{v} \in \mathbb{R}^3$ being the two end-points and $\Omega$ the set of all line segments in space and $S$ a 3D surface. The spatial relationship between $\overline{\mathbf{uv}}$ and $S$ can be classified into two types: intersecting and non-intersecting. If intersecting, the intersection point lies on $\overline{\mathbf{uv}}$ , whose position can be represented as a linear combination of $\mathbf{u}$ and $\mathbf{v}$ . + +Under such an intuition, we assign two attributes to the line segment $\overline{\mathbf{uv}}$ : a binary intersection flag $o(\overline{\mathbf{uv}}) \in \{0, 1\}$ and an intersection ratio $s(\overline{\mathbf{uv}}) \in [0, 1]^1$ . More precisely, as illustrated in Fig. 2a, when $o(\overline{\mathbf{uv}}) = 1$ , it indicates the line segment $\overline{\mathbf{uv}}$ intersects the surface $S$ , whereas $o(\overline{\mathbf{uv}}) = 0$ signifies non-intersection. The intersection ratio $s(\overline{\mathbf{uv}})$ specifies the location of the intersection point, denoted as $\mathbf{p} \in \mathbb{R}^3$ , under the case $o(\overline{\mathbf{uv}}) = 1$ ; moreover, we have $\mathbf{p} = s(\overline{\mathbf{uv}})\mathbf{u} + (1 - s(\overline{\mathbf{uv}}))\mathbf{v}$ , as shown in Fig. 2b. Thus, by using the query line segments in $\Omega$ , the surface $S$ could be represented implicitly as + +$$ +\mathcal {S} = \left\{s (\overline {{\mathbf {u v}}}) \mathbf {u} + (1 - s (\overline {{\mathbf {u v}}})) \mathbf {v} \mid o (\overline {{\mathbf {u v}}}) = 1, \overline {{\mathbf {u v}}} \in \Omega \right\}. \tag {1} +$$ + +Given that $o$ and $s$ characterize the local geometric properties of the surface $S$ around the query line segment $\overline{\mathbf{u}\mathbf{v}}$ , we utilize the tangent plane of the surface at the intersection point $\mathbf{p}$ to represent the local geometry. Specifically, let $\mathbf{n} \in \mathbb{R}^3$ be the unoriented normal vector at $\mathbf{p}$ , and $\mathbf{p}_0$ any point on the tangent plane. It is worth noting that $\mathbf{n}$ and $\mathbf{p}_0$ are fixed, independent of $\overline{\mathbf{u}\mathbf{v}}$ . Theorem 1 demonstrates that the normal vector $\mathbf{n}$ is parallel to the spatial gradient of $s$ with respect to $\mathbf{u}$ and $\mathbf{v}$ , and provides a formal proof of this relationship. + +Theorem 1. The unoriented normal vector $\mathbf{n}$ at the intersection point $\mathbf{p}$ between the ling segment $\overline{\mathbf{uv}}$ and surface $\mathcal{S}$ is parallel to the spatial gradient of $s$ , $\nabla_{\mathbf{u}} s$ and $\nabla_{\mathbf{v}} s$ . + +Proof. According to Fig. 3, the intersection ratio $s$ is calculated as + +$$ +s = \frac {\mathbf {n} ^ {\top} (\mathbf {v} - \mathbf {p} _ {0})}{\mathbf {n} ^ {\top} (\mathbf {v} - \mathbf {u})}. +$$ + +![](images/1c00faedc507f002271e0d85b5fc0bdc60e7cc8bb96e119315321112484d49c5.jpg) +Figure 3: Local geometry of the surface near the intersection point. + +Then, its gradient for $\mathbf{u}$ and $\mathbf{v}$ is + +$$ +\nabla_ {\mathbf {u}} s = \frac {\mathbf {n} ^ {\top} (\mathbf {v} - \mathbf {p} _ {0})}{(\mathbf {n} ^ {\top} (\mathbf {v} - \mathbf {u})) ^ {2}} \mathbf {n}, \quad \nabla_ {\mathbf {v}} s = - \frac {\mathbf {n} ^ {\top} (\mathbf {v} - \mathbf {p} _ {0})}{(\mathbf {n} ^ {\top} (\mathbf {v} - \mathbf {u})) ^ {2}} \mathbf {n}. +$$ + +Obviously, they are parallel to $\mathbf{n}$ . + +![](images/60da8e05ae4714c24c4a8b661bb52632a3d0d7b87ca7c40be66600441f7a3c9d.jpg) + +# 3.2 SURFACE EXTRACTION FROM LSFS VIA EDGE-BASED DUAL CONTOURING + +Building upon the principles of dual contouring (Ju et al., 2002), we propose edge-based dual contouring (E-DC) to extract the triangle meshes indicated by a given LSF. Specifically, as shown in Fig. 4a, for a given cube $\mathcal{C}$ with its set of edges denoted as $\mathcal{E} = \{\overline{\mathbf{u}_i\mathbf{v}_i}\}_{i = 1}^{12}$ , the normal vector $\mathbf{n}_i$ at $\overline{\mathbf{u}_i\mathbf{v}_i}$ 's intersection point $\mathbf{p}_i$ can be calculated through Theorem 1. Specifically, we use the gradient of the endpoint nearest to the intersection point to determine the normal vector's direction at that point, + +![](images/259265463ddda9ceb89ab0e17c736586b6643608a25ce13d037e5763f69dde49.jpg) +(a) +Figure 4: Visual illustration of surface extraction from an LSF. (a) QEF in each cube. (b) Triangle extraction in adjacency cubes. + +![](images/d9faf3abbae3563dc72d036fa10c65172e80aceaa8052deccb8ea3ef8cbe1ede.jpg) +(b) + +$$ +\mathbf {n} _ {i} = \left\{ \begin{array}{l l} \mathbf {n} = \nabla_ {\mathbf {u}} s / | | \nabla_ {\mathbf {u}} s | |, & \text {i f} \quad \mathrm {s} \left(\overline {{\mathbf {u} _ {\mathrm {i}} \mathbf {v} _ {\mathrm {i}}}}\right) \leq 0. 5 \\ \mathbf {n} = \nabla_ {\mathbf {v}} s / | | \nabla_ {\mathbf {v}} s | |, & \text {o t h e r w i s e} \end{array} . \right. \tag {2} +$$ + +The intersection point within the cube can be determined through optimizing the following quadratic error function (QEF): + +$$ +\hat {\mathbf {x}} = \underset {\mathbf {x}} {\operatorname {a r g m i n}} \sum_ {\overline {{\mathbf {u} _ {i} \cdot \mathbf {v} _ {i}}} \in \mathcal {E}} \left(o _ {i} \left(\mathbf {x} - \mathbf {p} _ {i}\right) ^ {\top} \mathbf {n} _ {i}\right) ^ {2}, \tag {3} +$$ + +We refer readers to Appendix B for the solution to Eq. (3). + +For any edge $\overline{\mathbf{uv}}$ that intersects the surface, i.e., $o(\overline{\mathbf{uv}}) = 1$ , it belongs to four cubes, denoted as $\{\mathcal{C}_i\}_{i=1}^4$ , as shown in Fig. 4b. By solving the QEFs in these cubes, we obtain intersection points $\{\hat{\mathbf{x}}_i\}_{i=1}^4$ within these four cubes, which can be connected to form a quadrilateral. However, since quadrilateral meshes are not widely used in practice, it is necessary to subdivide the quadrilateral into triangles to generate a triangular mesh. Importantly, the intersection point $\mathbf{p}$ on the edge $\overline{\mathbf{uv}}$ lies on the surface, enabling the quadrilateral to be divided into four triangles. By applying this process to all edges intersecting the surface, we can extract a triangle mesh from a given LSF. + +# 3.3 LSF-BASED NEURAL IMPLICIT REPRESENTATION + +In this section, we employ a neural network to model the LSF of a given shape, where a lightweight MLP is trained with a set of ground-truth attributed line segments sampled in the space. After training, the MLP can predict the attributes $o$ and $s$ for any query line segment, producing the LSF, where we can utilize E-DC to extract a triangle mesh. + +Technically, for a typical query line segment $\overline{\mathbf{uv}}$ , we concatenate its two endpoints $\mathbf{u}$ and $\mathbf{v}$ , which are then fed into an MLP parameterized with $\theta$ , outputting the corresponding values for $o$ and $s$ . It is worth noting that the concatenation is in an orderly manner, and the output intersection ratio $s$ always indicates the ratio of the distance from the intersection point to the endpoint at the second concatenated position to the total length of the line segment, while the intersection flag $o$ is independent of the concatenation order. Such a process is described as + +$$ +\{o, s \} = \operatorname {M L P} _ {\theta} (\mathbf {u} | | \mathbf {v}), \tag {4} +$$ + +where $||$ denotes the concatenation of two vectors. The surface normal at the intersection points on the line segments can be determined by computing the gradient of $s$ via backpropagation. + +We optimize $\theta$ by minimizing the following loss function: + +$$ +\mathcal {L} = \underset {\overline {{\mathbf {u v}}} \in \Omega^ {*}} {\mathbb {E}} \left(\lambda_ {1} \operatorname {B C E} \left(o (\overline {{\mathbf {u v}}}), o ^ {*} (\overline {{\mathbf {u v}}})\right) + \lambda_ {2} o ^ {*} (\overline {{\mathbf {u v}}}) \left| s (\overline {{\mathbf {u v}}}) - s ^ {*} (\overline {{\mathbf {u v}}}) \right|\right), \tag {5} +$$ + +where $\mathsf{BCW}(\cdot ,\cdot)$ represents Binary Cross Entropy, $\Omega^{*}$ is the set of sampled line segments, and $o^*$ and $s^*$ are the ground-truth intersection flag and ratio, respectively. See Sec. 4.1 for the experimental comparisons and analyses. + +# 3.4 LEARNING LSFS FROM 3D POINT CLOUDS FOR SURFACE RECONSTRUCTION + +Built upon the LSF introduced in Sec. 3.1, we propose a novel learning-based pipeline for reconstructing surfaces from 3D point clouds. After training, this pipeline is capable of predicting the LSF for any given 3D point cloud, enabling the subsequent application of our E-DC in Sec. 3.2 to extract a precise triangle mesh. + +Denote by $\mathbf{P}$ a 3D point cloud. Let $\mathcal{N}(\overline{\mathbf{u}\overline{\mathbf{v}}}) = \{\mathbf{p}_i\}_{i=1}^K$ be a patch of $K$ points associated with a typical query line segment $\overline{\mathbf{u}\overline{\mathbf{v}}}$ , which is derived by finding the $K$ -nearest neighbors of the midpoint of $\overline{\mathbf{u}\overline{\mathbf{v}}}$ in $\mathbf{P}$ . Also, let $\mathcal{N}_{\mathbf{u}}(\overline{\mathbf{u}\overline{\mathbf{v}}}) := \{\mathbf{p}_i - \mathbf{u}\}_{i=1}^K$ and $\mathcal{N}_{\mathbf{v}}(\overline{\mathbf{u}\overline{\mathbf{v}}}) := \{\mathbf{p}_i - \mathbf{v}\}_{i=1}^K$ . Calculating the attributes of $\overline{\mathbf{u}\overline{\mathbf{v}}}$ against the un- + +![](images/117e47d5349679236c0f37748959d82b6fea346f49824de87b8e37d5478655d9.jpg) +Figure 5: Flowchart of our learning-based surface reconstruction method from 3D point clouds. + +derlying surface of $\mathbf{P}$ is a local geometry problem, which pertains only to $\mathcal{N}(\overline{\mathbf{u}\mathbf{v}})$ . Based on this + +observation, we construct our surface reconstruction pipeline using the following network architecture, as illustrated in Fig. 5: two MLPs followed by a MaxPool operation are first utilized to extract features from these two localized patches: + +$$ +\mathbf {F} _ {\mathbf {u}} = \operatorname {M a x P o o l} \left(\mathrm {M L P} _ {\theta_ {1}} \left(\mathcal {N} _ {\mathbf {u}} (\overline {{\mathbf {u v}}})\right)\right), \mathbf {F} _ {\mathbf {v}} = \operatorname {M a x P o o l} \left(\mathrm {M L P} _ {\theta_ {2}} \left(\mathcal {N} _ {\mathbf {v}} (\overline {{\mathbf {u v}}})\right)\right), \tag {6} +$$ + +where $\theta_{1}$ and $\theta_{2}$ are the sets of network parameters. The resulting features $\mathbf{F_u}$ and $\mathbf{F_v}$ are then concatenated and fed into another MLP parameterized with $\theta_{3}$ to predict the corresponding $o$ and $s$ : + +$$ +\{o, s \} = \mathrm {M L P} _ {\theta_ {3}} \left(\mathbf {F} _ {\mathbf {u}} \| \mathbf {F} _ {\mathbf {v}}\right). \tag {7} +$$ + +We minimize the loss function defined in Eq. (5) to train the network. See Sec. 4.1 for the experimental comparisons and analyses. + +# 4 EXPERIMENTS + +# 4.1 EVALUATION ON NEURAL IMPLICIT REPRESENTATION + +Datasets. We randomly selected 50 shapes from the ABC dataset (Koch et al., 2019) to conduct experiments. Additionally, we constructed a more complex dataset named non-manifold ABC dataset, in which each of the 50 shapes was produced by intersecting two randomly selected shapes for creating non-manifold structures. Besides, we utilized shapes from other commonly used datasets, including open-boundary clothes from the DeepFashion3D dataset (Zhu et al., 2020), and complex shapes from the Famous dataset (Erler et al., 2020). All shapes were rescaled to a bounding cube with an edge length of 2 and centered at the origin. + +Implementation Details. We employed an 8-layer MLP, with each layer comprising 512 neurons. All layers, except the final one, use the Softplus activation function ( $\beta = 100$ , as recommended in (Atzmon & Lipman, 2020)). The final layer consists of 2 neurons, followed by a Sigmoid activation function. We sampled 10 million line segments within the space to optimize the MLP. The model was trained for 100,000 epochs with a batch size of 10,000, using the ADAMW optimizer (Loshchilov, 2017) with an initial learning rate of 0.001. The learning rate was progressively adjusted using cosine annealing (Loshchilov & Hutter, 2016), with a minimum learning rate of $10^{-5}$ . When extracting the surface, the resolution of grids used in E-DC was set to 128, keeping the same as the baseline methods. To measure the reconstructed quality quantitatively, we sample $10^{5}$ points from each surface to calculate L1-CD, Normal Consistency (NC), and F-Score with the threshold of 0.005 and 0.01 with respect to the ground truth surfaces. + +Methods under Comparison. We compared our method against three commonly used implicit geometry representations, i.e., BOF, SDF, and UDF, using MLPs with the same architectures as ours for modeling. For surface extraction methods from implicit representations, we benchmarked SALS against MC (Lorensen & Cline, 1987), NDC (Chen et al., 2022), MeshUDF (Guillard et al., 2022), DCUDF (Hou et al., 2023), and DualMesh (Zhang et al., 2023). Additionally, we included two recently proposed methods, i.e., NGLOD (Takikawa et al., 2021) and UODF (Lu et al., 2024), maintaining the settings consistent with their original papers. + +Results. We quantitatively compared those methods on the ABC and non-manifold ABC datasets in Table 1, where it can be seen that our method outperforms the other methods in terms of all metrics, especially on the non-manifold ABC dataset. The visual results are shown in Fig. 6, and obviously, the surfaces represented by our method can preserve detailed structures, including the non-manifold ones. Our method only built upon a simple MLP can represent shapes with higher accuracy, compared with the relatively complex methods, such as NGLOD and UODF, which is credited to our novel LSF. BOF represents the probability that a query point is either inside or outside the surface, and it is less accurate than other methods. Surfaces extracted from the distance fields present distortion at the detailed regions since they rely on the closest distance of individual points to the surface. Therefore, under the same MLP settings, these methods exhibit low representation accuracy. UODF utilizes SPSR (Kazhdan & Hoppe, 2013) to extract the surface, decreasing its accuracy. When handling shapes with non-manifold structures, the representation accuracy of both BOF and SDF drops significantly, as they are inherently unable to represent non-manifold geometry. While UDF can represent non-manifold structures, its reliance on gradients for surface extraction leads to inaccuracies, particularly at non-manifold regions, which in turn reduces representation + +Table 1: Quantitative comparisons of different neural implicit representations with various surface extraction methods on the ABC and non-manifold ABC datasets. The best results are highlighted in bold. + +
Methods#ParamCD (10-3) ↓NC ↑F1-0.005 ↑F1-0.01 ↑
ABCNeural BOF + MC (Lorensen & Cline, 1987)1.84M6.3850.9110.5280.941
Neural SDF + MC (Lorensen & Cline, 1987)1.84M5.8100.9660.6180.946
Neural SDF + NDC (Chen et al., 2022)2.07M4.6070.9670.6270.963
NGLOD (Takikawa et al., 2021)10.14M6.0700.9570.5410.919
Neural UDF + MeshUDF (Guillard et al., 2022)1.84M5.0750.9670.5780.937
Neural UDF + NDC (Chen et al., 2022)2.07M4.9440.9550.5840.942
Neural UDF + DCUDF (Hou et al., 2023)1.84M4.5930.9710.6250.962
Neural UDF + DualMesh (Zhang et al., 2023)1.84M4.7250.9780.6090.952
UODF (Lu et al., 2024)5.55M4.7940.9770.6030.953
SALS (Ours)1.84M4.4930.9800.6380.965
Non-manifold ABCNeural BOF + MC (Lorensen & Cline, 1987)1.84M14.3710.8860.3560.810
Neural SDF + MC (Lorensen & Cline, 1987)1.84M13.5670.9290.4220.822
Neural SDF + NDC (Chen et al., 2022)2.07M8.6420.9440.4220.835
NGLOD (Takikawa et al., 2021)10.14M10.2500.9130.3010.750
Neural UDF + MeshUDF (Guillard et al., 2022)1.84M6.4650.9480.3920.855
Neural UDF + NDC (Chen et al., 2022)2.07M14.8930.9320.3820.849
Neural UDF + DCUDF (Hou et al., 2023)1.84M6.1110.9540.4270.886
Neural UDF + DualMesh (Zhang et al., 2023)1.84M6.7060.9610.3670.823
UODF (Lu et al., 2024)5.55M6.7460.9530.3670.835
SALS (Ours)1.84M5.9490.9630.4370.889
+ +accuracy. Additionally, Fig. 7 visualizes the results of our method on other general shapes from the DeepFashion3D and Famous datasets. Obviously, the extracted surface can preserve detailed structures. We refer the readers to Appendix C for more results. + +# 4.2 EVALUATION ON SURFACE RECONSTRUCTION FROM 3D POINT CLOUDS + +Datasets. We employed a significantly smaller training set compared to previous methods, comprising 100 shapes selected from the Thingi10K dataset (Zhou & Jacobson, 2016) to train our network. For testing, we utilized the ABC and non-manifold ABC datasets, as well as more diverse shapes from the DeepFashion3D (Zhu et al., 2020), Synthetic Rooms (Peng et al., 2020) and Waymo (Sun et al., 2020) datasets. Each shape contains 40,000 randomly sampled points. + +Implementation Details. Each of the three MLPs in Fig. 5 consists of 4 layers, with 256 neurons per layer. All layers, except the final one, used the LeakyReLU activation function. The patch size for $K$ -NN is set to $K = 20$ . The network was trained for 400 epochs with a batch size of 4, where 5120 line segments were sampled for each shape at each iteration. The optimizer used was ADAMW (Loshchilov, 2017), with an initial learning rate of 0.001, which was adjusted via cosine annealing (Loshchilov & Hutter, 2016) to a minimum learning rate of $10^{-5}$ . The grid resolution was set to 128 when performing surface extraction, keeping the same as the baseline methods. + +Methods under Comparison. We compared our method against SOTA surface reconstruction methods, including POCO (Boulch & Marlet, 2022), GIFS (Ye et al., 2022), CAP-UDF (Zhou et al., 2022), and GeoUDF (Ren et al., 2023), whose settings were maintained the same as their original papers for fair comparisons. + +Results. Table 2 lists the quantitative results of different methods. It is obvious that our method outperforms baseline methods, especially on the non-manifold ABC datasets. Achieving such high + +Table 2: Quantitative comparisons of 3D point cloud-based surface reconstruction methods on the ABC and non-manifold ABC datasets. The best results are highlighted in bold. + +
Method#ParamCD (10-3) ↓NC ↑F1-0.005 ↑F1-0.01 ↑
ABCPOCO (Boulch & Marlet, 2022)12.79M8.8550.9520.5580.886
GIFS (Ye et al., 2022)3.68M5.7260.9400.4710.923
CAP-UDF (Zhou et al., 2022)0.46M5.3080.9580.5540.924
GeoUDF (Ren et al., 2023)0.77M4.6780.9700.6150.957
SALS (Ours)1.07M4.5600.9730.6300.962
Non-manifold ABCPOCO (Boulch & Marlet, 2022)12.79M16.8300.9050.2690.658
GIFS (Ye et al., 2022)3.68M7.0780.9270.3050.826
CAP-UDF (Zhou et al., 2022)0.46M7.2800.9290.3570.833
GeoUDF (Ren et al., 2023)0.77M6.2300.9500.4100.869
SALS (Ours)1.07M6.0330.9510.4250.883
+ +![](images/a942924861044378cb03235011e5d8001890a146b018d1240600a239c15216ab.jpg) +Figure 6: Visual comparisons of different neural implicit representations. $\mathbb{Q}$ Zoom in to see details. precision reconstruction with so little training data and such a simple network structure is primarily attributed to our proposed implicit geometry representation and the effective local geometry modeling. The visual comparison is shown in Fig. 8, where our method can preserve detailed structures. Furthermore, Figs. 9 and 10 present the results of our method applied to additional shapes and scenes from the DeepFashion3D, Synthetic Rooms, and Waymo datasets. Notably, the reconstructed surfaces successfully capture fine structural details, highlighting the strong generalizability and robustness of our approach across diverse datasets. We refer the reader to Appendix D for more results. + +![](images/39040371cfa86f5643b8d2477f423dbd572fdcd7818a6328112cd1455860199a.jpg) +Ours + +![](images/6c5cc7e4fbb56343f2e7c877a4bc20255f9ad97845e1cae409fa39d6b574e384.jpg) + +![](images/ddbd0c021cc5c32b906a8db8ce29054dd52a87b85b76caf79b1e8e7e0b4234f8.jpg) + +![](images/703eaeba4744c11d2f72f9e1ac4eca16aeefbca8c03d2066d5193354740d8bf1.jpg) + +![](images/ba445fc3fdec5ced2d8e0a6f8c1de92aa8af520aef165a5362b4e078146890f2.jpg) + +![](images/cca9c82b6d46405b3d7b23a7e8043891d8e8ef16f63041aa83942cbedc54314a.jpg) + +![](images/3b5be9ec9772bf2876f28191c7842708035ed398ff788c6a570e0da88c6212c4.jpg) +GT +Figure 7: Visual results on the DeepFashion3D and Famous datasets. Q Zoom in to see details. + +![](images/5685bca0adff220a06558e71144fbd0f34f0c74ec7e8afc44a488ddf63241696.jpg) + +![](images/8bcac715d8cda719f6aea05c262d39fbdab2a1317b102f3beb34726a2ef7ff9b.jpg) + +![](images/b2670e8bcc69b5d11caeb6aaafc1114359e4fc1fa92c4ad63d60e91228a786b9.jpg) + +![](images/742cac36a0a8a46bd39058fc10f05285969c70bbba092624c9c4c22651f59bac.jpg) + +![](images/52e906cdff1f265f12720c10af2337387d98b8438806b7f91679ab86abb54d2f.jpg) + +![](images/7ddf736e2f2b9ca0df19762ddb0e18ee7c7fa53240073a2cd0941880c3ac8e75.jpg) + +![](images/14acf20b0bcba5d52793c8ef613f692b8320aa7d6bf23d4bac95df702473c065.jpg) + +![](images/bfb2e4f72296378e7578ddabe73f007ac4a990dcafd01d97db9f5bc1b642bd0a.jpg) + +![](images/6a41fcca5c943139d7199c82478d6d91bcc125ed940a73f8dc6ac70312a1a00e.jpg) + +![](images/16c01c52b6386ca78ed6dfc5fd00b5017769eb6d9fca5d35969d0ecd4376aca9.jpg) + +![](images/5693c0f8d30fca9ff493eb31dc31aca52928dabb607545aec4532a7e8fa56f3a.jpg) + +![](images/650eb6f45478509c2220b0c6e1c433d24e7d559b6c28e5f79a5cb00dc659b617.jpg) + +![](images/4adc727b22788f9dc739885efc8b89abb24b4b74a5468f165d106b946c63438e.jpg) + +![](images/e2a60c8fd1c956ac4b1e1deb662c1728868e65511feb7bfd3a8e665a7cc9f014.jpg) + +![](images/b3f60488f84895857723b49b1f4edac9fc7b97a8f89a87cd571e3edba7ae2d32.jpg) + +![](images/aefb5f73c9633766eed1d7c9ee3291d18569828bc8a1da8d18f125d0f406be04.jpg) + +![](images/621d4f6319b721120c2ab8097968adcae63e067aed630a630e606255c741dcc5.jpg) + +![](images/2150d0594b163b69ac3d6bdcc0c899d19f747bc347d0a6a3066121d267495609.jpg) + +![](images/b72bdf0c64da943ced3a03a1259bc41e28c8f2adba9a158f7497fde11cae661f.jpg) + +![](images/0bb63ab270d3573a073fe4029915adc0823acae91b37bd01367261ca3de3dc79.jpg) + +![](images/5930530f5efba780c4661f9fa7cb643f041b0c13a813dfefd5384fcf79ade436.jpg) + +![](images/239c4838d639d2c8d49fc6f726b63a94818f0998671ea6ed5e517ede5af4f85b.jpg) + +![](images/41dc228be11a93528e8353667f683dc016a12e9a69b47472d1134f1da51a153e.jpg) + +![](images/f857389c7d80ca640bd8315205daf43995c6c3961d251023edb8a5a28647cebf.jpg) + +![](images/c5683c631030a37f2b2639c3cb98dea92a979ae51fb895328d3318cc8582c942.jpg) + +![](images/db232d22bbb7cc215c4db2290622ebfacdd10f3c876fc9eae9ae6b1afa7f9379.jpg) + +![](images/4a6b52c7770293c2a9d0e9a44d66fb7c280432ef2c92d0367b2485cb5a2a225a.jpg) +(a) Input + +![](images/988447ad7190135acefc76d788250682c77474013686cac8e974a6752df80c11.jpg) +(b)POCO + +![](images/a9f634147ab8190666052db5f0f7ca95e44cd591f34d13cc06261d95ea9553fd.jpg) +(c) GIFS + +![](images/2703afc3aaad61373406ea2d19ca7f72b0067da8a91fcf66aa1e23e42384f48e.jpg) +(d) CAP-UDF + +![](images/9e074d5c7c73de010fa72bf28edcc976a553a00bf708bbf0cbaf0a34309d8bc8.jpg) +(e) GeoUDF + +![](images/3780ea383090b74b2f6182e0b8dff546e6f07d2fb3c8dca5028dafd5c5cc9f20.jpg) +(f) Ours + +![](images/7d85c3c490fd23dacb0e2bd33809de6d26b133f6b7c184716e1836b67dd5cc7b.jpg) +(g) GT + +# 4.3 ABLATION STUDY + +We conducted comprehensive ablation studies on the ABC dataset to show the rationality of our design. + +![](images/288b62fb797775b4b686a2c3d1833200288b1431599b77141e89b2abe33c8c90.jpg) +Figure 8: Visual comparisons of different point cloud surface reconstruction methods. Q Zoom in to see details. +(a) w/o normal +Figure 11: Extracted surfaces using E-DC without and with normal. + +![](images/fe5c839676c03a7b203ce4b8d01e6bbb7527699ac1e4b1309a4187e0ec4b2de1.jpg) +(b) w/ normal + +![](images/9e85a8985764646ac19fb5b1cd44e1ea890b042bd69cc80a75359cfb92657a7e.jpg) +(c) GT + +Spatial gradient of $s$ . Theorem 1 demonstrates that the normal vector at the intersection point is parallel to the spatial gradient of $s$ , which is crucial for accurate surface extraction. To validate this, we conducted experiments where, instead of directly utilizing the normal vectors at the intersection points, we employed the center of the intersection points within each cube as the solution for the QEF during surface extraction from the LSF. As shown in Fig 11, removing normals from E-DC significantly reduces the ability to capture fine surface details, as normals are essential for describing detailed structures. On the other way, this also confirms the validity of Theorem 1. + +E-DC Resolution. We evaluated the accuracy of the extracted surfaces under varying resolutions of E-CD, with the numerical results presented in + +Table 3: Representation accuracy under various resolutions of E-DC. + +
Res.Inf. TimeGPU Mem.CD (10-3)NCF1-0.005 ↑F1-0.01 ↑
641.099s1.55GB4.7310.9630.6060.952
1286.682s4.78GB4.4930.9800.6380.965
19219.663s11.99GB4.4900.9810.6380.965
+ +Table 3. At lower resolutions, such as 64, the representation accuracy decreases significantly. However, increasing the resolution beyond 128, for instance to 192, does not yield substantial improvements in accuracy despite requiring more computational resources. We also refer reviewers to Fig. + +15 of Appendix C for the visual results. + +$K$ -NN Size of Query Line Segments. When computing the LSF for query line segments from a point cloud, the size of the $K$ -NN patch is a critical hyperparameter. To evaluate its impact, we tested the accuracy of our method under different values of $K$ . + +Table 4: Point cloud surface reconstruction accuracy under different $K$ -NN sizes. + +
KCD (10-3)NCF1-0.005 ↑F1-0.01 ↑
106.3670.9030.4890.848
204.5600.9730.6300.962
5014.3700.6570.1640.415
+ +![](images/efb7e541f4f5b72db2e892c2824cd15b71076f1111cc15c1d0fc4936b83e5035.jpg) +Figure 9: Visual results of point cloud surface reconstruction methods on DeepFashion3D and Synthetic Rooms datasets. $\mathbb{Q}$ Zoom in to see details. + +![](images/3c27baff0ff0a355238d92034a205fb846ed6b8a4e4fc916e75fdd4fca3cd41b.jpg) +(a) Input + +![](images/9aae41e67d619014d7e1cbddf708738488a849c9a26b10bb3caa0d4798d9dad4.jpg) +(b) GeoUDF +Figure 10: Visual results of point cloud surface reconstruction methods on the Waymo dataset. Q Zoom in to see details. + +![](images/4e32e8381aa56d8dd8d45ba06b1bbb758ce051f4420230236a35ec5606d80b75.jpg) +(c) Ours + +As listed in Table 4, setting $K$ either too large or too small leads to a noticeable decrease in reconstruction accuracy. We also refer reviewers to Fig. 20 of Appendix C for visual results. + +Point Cloud Density. We evaluated the reconstruction accuracy of our method across different point cloud densities to verify its robustness. The numerical results, presented in Table 5, indicate a slight decrease in accuracy when the point clouds become sparser. However, increasing the number of points + +does not result in significant improvements in accuracy, suggesting its robustness. We also refer reviewers to Fig. 19 in Appendix for visual results. + +Table 5: Point cloud surface reconstruction accuracy under different numbers of input points. + +
#PointsCD (10-3)NCF1-0.005 ↑F1-0.01 ↑
1 × 1044.8420.9530.6080.948
4 × 1044.5600.9730.6300.962
10 × 1044.5140.9770.6360.964
+ +# 5 CONCLUSION + +We have introduced SALS, an accurate and flexible implicit geometry representation. We began by analyzing the primary limitations of existing implicit representations, which are predominantly based on distance fields. In contrast, SALS focuses on the spatial relationship between line segments and the surface, resulting in greater accuracy than prior methods. Leveraging SALS, we proposed both a neural shape representation approach and a learning pipeline of surface reconstruction from point clouds, achieving superior performance over state-of-the-art methods. The effectiveness and advantages of SALS underscore its potential to significantly advance the field of 3D geometric modeling and processing. + +# REFERENCES + +Matan Atzmon and Yaron Lipman. Sald: Sign agnostic learning with derivatives. arXiv preprint arXiv:2006.05400, 2020. +Ma Baorui, Han Zhizhong, Liu Yu-Shen, and Zwicker Matthias. Neural-pull: Learning signed distance functions from point clouds by learning to pull space onto surfaces. In International Conference on Machine Learning, volume 139, pp. 7246-7257, 2021. +Fausto Bernardini, Joshua Mittleman, Holly Rushmeier, Cláudio Silva, and Gabriel Taubin. The ball-pivoting algorithm for surface reconstruction. IEEE transactions on visualization and computer graphics, 5(4):349-359, 1999. +Alexandre Boulch and Renaud Marlet. Poco: Point convolution for surface reconstruction. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 6302-6314, June 2022. +Rohan Chabra, Jan E Lenssen, Eddy Ilg, Tanner Schmidt, Julian Straub, Steven Lovegrove, and Richard Newcombe. Deep local shapes: Learning local sdf priors for detailed 3d reconstruction. In European Conference on Computer Vision, pp. 608-625. Springer, 2020. +Zhiqin Chen, Andrea Tagliasacchi, Thomas Funkhouser, and Hao Zhang. Neural dual contouring. ACM Transactions on Graphics (TOG), 41(4):1-13, 2022. +Julian Chibane, Thiemo Alldieck, and Gerard Pons-Moll. Implicit functions in feature space for 3d shape reconstruction and completion. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 6970-6981, June 2020a. +Julian Chibane, Gerard Pons-Moll, et al. Neural unsigned distance fields for implicit function learning. Advances in Neural Information Processing Systems, 33:21638-21652, 2020b. +Akio Doi and Akio Koide. An efficient method of triangulating equi-valued surfaces by using tetrahedral cells. IEICE TRANSACTIONS on Information and Systems, 74(1):214-224, 1991. +Philipp Erler, Paul Guerrero, Stefan Ohrhallinger, Niloy J Mitra, and Michael Wimmer. Points2surf learning implicit surfaces from point clouds. In European Conference on Computer Vision, pp. 108-124. Springer, 2020. +Benoit Guillard, Federico Stella, and Pascal Fua. Meshudf: Fast and differentiable meshing of unsigned distance field networks. In European Conference on Computer Vision, pp. 576-592, 2022. +Fei Hou, Xuhui Chen, Wencheng Wang, Hong Qin, and Ying He. Robust zero level-set extraction from unsigned distance fields based on double covering. ACM Transactions on Graphics (TOG), 42(6):1-15, 2023. +Tao Ju, Frank Losasso, Scott Schaefer, and Joe Warren. Dual contouring of hermite data. In Proceedings of the 29th annual conference on Computer graphics and interactive techniques, pp. 339-346, 2002. +Michael Kazhdan and Hugues Hoppe. Screened poisson surface reconstruction. ACM Transactions on Graphics, 32(3):1-13, 2013. +Sebastian Koch, Albert Matveev, Zhongshi Jiang, Francis Williams, Alexey Artemov, Evgeny Burnaev, Marc Alexa, Denis Zorin, and Daniele Panozzo. Abc: A big cad model dataset for geometric deep learning. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 9601-9611, 2019. +Ravikrishna Kolluri. Provably good moving least squares. ACM Transactions on Algorithms, 4(2): 1-25, 2008. +Shi-Lin Liu, Hao-Xiang Guo, Hao Pan, Peng-Shuai Wang, Xin Tong, and Yang Liu. Deep implicit moving least-squares functions for 3d reconstruction. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 1788-1797, June 2021. + +Yu-Tao Liu, Li Wang, Jie Yang, Weikai Chen, Xiaoxu Meng, Bo Yang, and Lin Gao. Neudf: Leaning neural unsigned distance fields with volume rendering. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 237-247, 2023. +Xiaoxiao Long, Cheng Lin, Lingjie Liu, Yuan Liu, Peng Wang, Christian Theobalt, Taku Komura, and Wenping Wang. Neuraludf: Learning unsigned distance fields for multi-view reconstruction of surfaces with arbitrary topologies. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 20834-20843, 2023. +William E Lorensen and Harvey E Cline. Marching cubes: A high resolution 3d surface construction algorithm. ACM siggraph computer graphics, 21(4):163-169, 1987. +I Loshchilov. Decoupled weight decay regularization. arXiv preprint arXiv:1711.05101, 2017. +Ilya Loshchilov and Frank Hutter. Sgdr: Stochastic gradient descent with warm restarts. arXiv preprint arXiv:1608.03983, 2016. +Yujie Lu, Long Wan, Nayu Ding, Yulong Wang, Shuhan Shen, Shen Cai, and Lin Gao. Unsigned orthogonal distance fields: An accurate neural implicit representation for diverse 3d shapes. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 20551-20560, 2024. +Baorui Ma, Yu-Shen Liu, and Zhizhong Han. Reconstructing surfaces for sparse point clouds with on-surface priors. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 6315-6325, June 2022. +Xiaoxu Meng, Weikai Chen, and Bo Yang. Neat: Learning neural implicit surfaces with arbitrary topologies from multi-view images. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 248-258, 2023. +Lars Mescheder, Michael Oechsle, Michael Niemeyer, Sebastian Nowozin, and Andreas Geiger. Occupancy networks: Learning 3d reconstruction in function space. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 4460-4470, June 2019. +Jeong Joon Park, Peter Florence, Julian Straub, Richard Newcombe, and Steven Lovegrove. Deepsdf: Learning continuous signed distance functions for shape representation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 165-174, June 2019. +Songyou Peng, Michael Niemeyer, Lars Mescheder, Marc Pollefeys, and Andreas Geiger. Convolutional occupancy networks. In European Conference on Computer Vision, pp. 523-540. Springer, 2020. +Songyou Peng, Chiyu Jiang, Yiyi Liao, Michael Niemeyer, Marc Pollefeys, and Andreas Geiger. Shape as points: A differentiable poisson solver. Advances in Neural Information Processing Systems, 34:13032-13044, 2021. +Siyu Ren, Junhui Hou, Xiaodong Chen, Ying He, and Wenping Wang. Geoudf: Surface reconstruction from 3d point clouds via geometry-guided distance representation. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 14214-14224, 2023. +Tianchang Shen, Jun Gao, Kangxue Yin, Ming-Yu Liu, and Sanja Fidler. Deep marching tetrahedra: a hybrid representation for high-resolution 3d shape synthesis. Advances in Neural Information Processing Systems, 34:6087-6101, 2021. +Pei Sun, Henrik Kretzschmar, Xerxes Dotiwalla, Aurelien Chouard, Vijaysai Patnaik, Paul Tsui, James Guo, Yin Zhou, Yuning Chai, Benjamin Caine, et al. Scalability in perception for autonomous driving: Waymo open dataset. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 2446-2454, 2020. +Towaki Takikawa, Joey Litalien, Kangxue Yin, Karsten Kreis, Charles Loop, Derek Nowrouzezahrai, Alec Jacobson, Morgan McGuire, and Sanja Fidler. Neural geometric level of detail: Real-time rendering with implicit 3d shapes. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 11358-11367, 2021. + +Peng Wang, Lingjie Liu, Yuan Liu, Christian Theobalt, Taku Komura, and Wenping Wang. Neus: Learning neural implicit surfaces by volume rendering for multi-view reconstruction. Advances in Neural Information Processing Systems, 34:27171-27183, 2021. +Peng-Shuai Wang, Yang Liu, and Xin Tong. Dual octree graph networks for learning adaptive volumetric shape representations. ACM Transactions on Graphics, 41(4):1-15, 2022. +Yiming Wang, Qin Han, Marc Habermann, Kostas Daniilidis, Christian Theobalt, and Lingjie Liu. Neus2: Fast learning of neural implicit surfaces for multi-view reconstruction. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 3295-3306, 2023. +Jianglong Ye, Yuntao Chen, Naiyan Wang, and Xiaolong Wang. Gifs: Neural implicit function for general shape representation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 12829-12839, June 2022. +Congyi Zhang, Guying Lin, Lei Yang, Xin Li, Taku Komura, Scott Schaefer, John Keyser, and Wenping Wang. Surface extraction from neural unsigned distance fields. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 22531-22540, 2023. +Junsheng Zhou, Baorui Ma, Yu-Shen Liu, Yi Fang, and Zhizhong Han. Learning consistency-aware unsigned distance functions progressively from raw point clouds. arXiv preprint arXiv:2210.02757, pp. 1-xxx, 2022. +Qingnan Zhou and Alec Jacobson. Thingi10k: A dataset of 10,000 3d-printing models. arXiv preprint arXiv:1605.04797, 2016. +Heming Zhu, Yu Cao, Hang Jin, Weikai Chen, Dong Du, Zhangye Wang, Shuguang Cui, and Xiaoguang Han. Deep fashion3d: A dataset and benchmark for 3d garment reconstruction from single images. In Computer Vision-ECCV 2020: 16th European Conference, Glasgow, UK, August 23-28, 2020, Proceedings, Part I 16, pp. 512-530. Springer, 2020. + +# Appendix + +# A DIFFERENCE FROM PREVIOUS METHODS + +Here, we demonstrate that our approach is fundamentally distinct from prior implicit representation methods, such as GIFS (Ye et al., 2022) and UODF (Lu et al., 2024), as well as previous surface extraction techniques, including NDC (Chen et al., 2022) and DualMesh (Zhang et al., 2023). + +GIFS (Ye et al., 2022) employs a classifier to predict whether a line segment intersects the surface. If an intersection occurs, the intersection point on the line segment is interpolated using the UDF values of its two endpoints. Then, it modifies the Marching Cubes (MC) algorithm to extract surfaces based on the intersection status of each cube's edges. In contrast, our SALS predicts an intersection ratio for a given line segment, avoiding the interpolation errors introduced by UDFs, as discussed in Sec. 1. Furthermore, we propose E-DC to extract surfaces directly from our LSF. Experimental results demonstrate the significant advantage of our method in terms of both reconstruction accuracy and efficacy. + +For a query point, UODF (Lu et al., 2024) only predicts its distance to the surface along three fixed directions, making it non-differentiable. Additionally, UODF does not offer a surface extraction method but instead generates a dense point cloud, from which a masked Poisson method is used to reconstruct the mesh. In contrast, our approach samples line segments across the entire space, develops their differentiable properties, and utilizes the custom-designed E-DC for surface extraction. + +Our proposed E-DC is significantly different from previous DC-based surface extraction methods, NDC (Chen et al., 2022) and DualMesh (Zhang et al., 2023). Both NDC and DualMesh focus only on surface extraction from implicit representations, like SDFs or USDFs. NDC utilizes a trained network to predict the intersection point in each cube, and DualMesh adapts the traditional DC for neural UDFs. Differently, our proposed E-DC is an optimization-based surface extraction method, specifically designed to extract surfaces from LSF. + +# B SOLUTION OF QEF + +QEF can be solved using least squares method, + +$$ +\hat {\mathbf {x}} = \left(\mathbf {A} ^ {\top} \mathbf {A}\right) ^ {- 1} \mathbf {A} ^ {\top} \mathbf {B}, \tag {8} +$$ + +where matrix $\mathbf{A}$ and $\mathbf{B}$ are defined as + +$$ +\mathbf {A} = \left( \begin{array}{c} \dots \dots \\ - o _ {i} \mathbf {n} _ {i} - \\ \dots \dots \end{array} \right), +$$ + +$$ +\mathbf {B} = \left( \begin{array}{c} \dots \dots \\ - o _ {i} \mathbf {p} ^ {\top} \mathbf {n} _ {i} - \\ \dots \dots \end{array} \right). \tag {9} +$$ + +Considering that $\mathbf{A}^{\top}\mathbf{A}$ may be singular, directly calculating its inverse may get wrong results. We first perform eigenvalue decomposition on the matrix, + +$$ +\mathbf {A} ^ {\top} \mathbf {A} = \mathbf {U} ^ {\top} \boldsymbol {\Sigma} \mathbf {U}, \tag {10} +$$ + +where $\mathbf{U}$ is an orthogonal matrix and $\pmb{\Sigma}$ is a diagonal matrix, $\pmb{\Sigma} = \mathrm{Diag}(\sigma_1,\sigma_2,\sigma_3)$ , with $\sigma_{1}\geq$ $\sigma_{2}\geq \sigma_{3}$ representing the eigenvalues. Here we define the inverse matrix of $\pmb{\Sigma}$ + +$$ +\boldsymbol {\Sigma} ^ {- 1} = \left( \begin{array}{c c c} \operatorname {I n v} \left(\sigma_ {1}\right) & 0 & 0 \\ 0 & \operatorname {I n v} \left(\sigma_ {2}\right) & 0 \\ 0 & 0 & \operatorname {I n v} \left(\sigma_ {3}\right) \end{array} \right), \tag {11} +$$ + +where $\mathsf{Inv}$ is defined as + +$$ +\operatorname {I n v} (\sigma) = \left\{ \begin{array}{l} 1 / \sigma , \text {i f} \quad \sigma > \epsilon \\ 0, \quad e l s e \end{array} \right.. \tag {12} +$$ + +In our experiment, we set $\epsilon = 0.1$ . + +# C NEURAL IMPLICIT REPRESENTATION + +Network Details. The last layer of the network uses a sigmoid function to constrain the output to the range [0,1]. For the intersection flag, we apply a threshold to binarize the output. If the threshold is set too low, some intersecting line segments may be incorrectly classified as non-intersecting, resulting in holes when extracting the surface using E-DC. The number of holes can be reduced by lowering the threshold for the intersection flag. In our experiments, the threshold was set to 0.1. We have included visual results of the extracted surfaces under different thresholds in Fig. 12. + +![](images/ed36cc957c7e8861cfddc2516f693b60d758da0e896e550cb4edccc22db3d3bb.jpg) +(a) 0.8 + +![](images/8d06bcf68e715e695f10e77644569371e96b17fc30f5dcb63b6014413ada6834.jpg) +(b) 0.5 + +![](images/45ccd7eafcd1fc19da0d3acd8f26a95db8567f2f76b7655e3818f49f6f4f32ed.jpg) +(c) 0.2 + +![](images/0876a2b8cbef42f7f57773f18cfc8c3e18e54fb2f209f86837a21b54c6bcc6fc.jpg) +(d) 0.1 + +![](images/5b040c25dd7e9bc78230ec8ab0dbb60ba31c3c44ac62cf53731a293eca2eeac3.jpg) +(e) 0.05 + +![](images/431398c656cfbe19a9d8963bbd8fa703a3c2474665998b22cbdcd243d480e6bd.jpg) +(f) GT +Figure 12: Extracted surfaces under different thresholds for intersection flag. + +Error Map. Fig. 13 presents the error maps of the reconstructed models shown in Fig. 6. The results demonstrate that the reconstruction errors of models produced by our method are significantly smaller than those of the baseline methods, particularly in regions with sharp features. + +Correctness of Theorem 1. To verify the correctness of Theorem 1, we utilize two different kinds of normal vectors in E-DC, random and zeros, and the visual comparison and error maps are shown in Fig. 14. It can be seen that using the gradient of $s$ as the direction of normal vectors could achieve significant better reconstruction accuracy, demonstrating the correctness of Theorem 1. + +Evaluation on Sharp Edges. Following previous methods (Chen et al., 2022), we utilize Edge Chamfer Distance (ECD) and Edge F-score (EF1) to evaluate the preservation of sharp edges. The results on the ABC dataset are shown in Table 6. Clearly, under the evaluation metrics ECD and EF1, our SALS significantly outperforms the baseline methods. + +Table 6: Numerical comparison of different methods under ECD and EF1 metrics. + +
MethodECD (10-2) ↓EF1 ↑
Neural BOF + MC5.2310.182
Neural SDF + MC7.2380.167
Neural SDF + NDC2.5010.526
NGLOD28.2490.044
Neural UDF + MeshUDF6.6510.169
Neural UDF + NDC2.6320.476
Neural UDF + DCUDF2.8280.058
Neural UDF + DualMesh2.8700.609
UODF55.8230.034
SALS (Ours)1.9700.601
+ +![](images/bf55754e773f8f2de5c72201f4e982dfda75916dfb169ac7c00ba6fe92dc6bf9.jpg) +Figure 13: Visual comparisons of different neural implicit representations. $\mathbb{Q}$ Zoom in to see details. + +Different E-DC Resolutions. Fig. 15 demonstrates the visual results of different E-DC resolutions on the selected shapes from the Famous dataset. When the resolution is set to 64, the extracted surfaces do not show significant distortion. + +Positional Encoding. Positional Encoding (PE) is a widely adopted technique in implicit representations. However, incorporating PE into our SALS framework leads to a reduction in surface reconstruction quality. As illustrated in Fig. 16, the use of PE introduces floating artifacts around the extracted surface, diminishing the overall representation accuracy. + +Efficiency Analysis. In the task of neural implicit representation (Sec. 3.3), the time cost consists of two parts, training/overfitting time and surface extraction time. We have recorded the runtime for these two parts, as shown in Table 7. It is worth noting that the resolution of Marching Cubes, Dual + +![](images/71fbd6869fd6323e6e704594fade34db45e73c29e97180d1c53df87ca6682930.jpg) +(a) Random + +![](images/bbeae81147dff434a244379d559c52e24b81be6c29bf58aa72dafd9dbbf0e6c1.jpg) +(b) Zeros + +![](images/90bf04a1ddf255e1cb23358993c67051b6eef0c2ca794f4fe3acd83397b0ee9a.jpg) +(c) Gradient of $s$ + +![](images/20010907b76e712d9f1230c46e22b2d2f6fa8e04eefc01984d6c982a316a7717.jpg) +(d) GT + +![](images/21d42eec23597d0b1269c56afc1024aafa70c7c193792729e3b4e7dd4fc2b674.jpg) +Figure 14: Extracted surfaces using E-DC with different estimated normal vectors. Q Zoom in to see details. +Figure 15: Visual results of different E-DC resolutions on the selected shapes from the Famous dataset. Q Zoom in to see details. + +Contouring, and our E-DC is 128. During training, our method takes slightly longer compared to neural BOF/SDF/UDF because it processes a 6D input vector and outputs a 2D vector, unlike the latter approaches which take a 3D input vector and produce a scalar output. NGLOD and UODF + +![](images/49599179cd12de3e5b98fbcc81035e90e3f3d2c843db41852281dfeb8251ad53.jpg) + +![](images/5ac3e8711c099b300e2292e377832ab0d33ff2908c45eb938a291b0690f7d8c8.jpg) + +![](images/12b0bedbf5a846d2db0ac7a36680cdbd517bb47bddcbc29564b009cf5733c52a.jpg) + +![](images/260e446a30964293f4ee77d0e67fc13cf4cd2ee051dca87db2bd4bab64b4e17d.jpg) + +![](images/4ab817c1b93d7cb8e6042068617c1974d0a4c2d75141898b2dd44c596c281b0e.jpg) +GT + +![](images/ffe4b4cd0dc49f009dd9ad8adcead640e737d4bb24e7e214c80d8b45da8f1dbc.jpg) +w/o PE + +![](images/965c805fdded8e8cb0ba40a7fc4aade6e8694088185d7173c20c40a14a865786.jpg) +Dim_PE=6 +Figure 16: Visual comparison of shape representation with and without PE in the MLP. Q Zoom in to see details. + +![](images/997deafb36d97f1c11827c4ba1edccff00542ab320d0495dec915ca19b1127ad.jpg) +Dim_PE=10 + +employ complex architectures, resulting in longer training times. In terms of surface extraction time, our method is slower than MC, MeshUDF, and DualMesh but significantly faster than DCUDF and NDC. + +Table 7: Running time of different representation methods. + +
MethodTraining Time (min)Inference Time (s)
Neural BOF + MC10.020.57
Neural SDF + MC10.340.60
Neural SDF + NDC7.41
NGLOD30.141.02
Neural UDF + MeshUDF10.561.57
Neural UDF + NDC6.983
Neural UDF + DCUDF68.81
Neural UDF + Dual Mesh1.69
UODF185.6810.64
SALS (Ours)11.562.96
+ +Runtime of E-DC. We measured the runtime for calculating intersection points in each cube and performing triangle extraction, as shown in Table 8. The results demonstrate that our E-DC is faster than NDC in terms of intersection point calculating in each cube and triangle extraction. This efficiency is due to our method not relying on a neural network to estimate the intersection points within each cube. + +Table 8: Comparison of runtime between NDC and our E-DC.. + +
MethodCalculate Intersection Points (s)Triangle Extraction (s)Total Time (s)
NDC0.1510.0450.196
E-DC (Ours)0.1290.0050.134
+ +# D SURFACE RECONSTRUCTION FROM POINT CLOUDS + +Error Maps. Fig. 17 shows the error maps of the reconstructed models shown in Fig. 8, demonstrating that the reconstruction errors of the models produced by our method are significantly smaller than those of the baseline methods, especially in regions with sharp features. + +![](images/3dbcebb97189c6b69732b5c64080561c1e99a92bec52c6d5e332ca014e08a68a.jpg) +Figure 17: Visual comparisons of different point cloud surface reconstruction methods. Q Zoom in to see details. + +Additional Visual Results. Fig. 18 shows additional visual results on the ABC dataset. + +![](images/1ccad37266c72be4dc99e4d9d9591ff29450af13ba4bc1accff7f4ef0c3de701.jpg) +Figure 18: Additional visual results on the ABC dataset. $\mathbb{Q}$ Zoom in to see details. + +Evaluation on Sharp Edges. We utilize ECD and EF1 to evaluate the preservation of sharp edges in the reconstructed surfaces from point clouds. The results on the ABC dataset are shown in Table + +Table 9: Numerical comparison of different point cloud surface reconstruction methods under ECD and EF1 metrics. + +
MethodECD (1e-2)EF1
POCO14.6610.069
GIFS7.6690.105
CAP-UDF11.0220.140
GeoUDF14.8180.067
Ours3.4800.432
+ +9. Clearly, under the evaluation metrics ECD and EF1, our SALS significantly outperforms the baseline methods. + +Different Point Cloud Densities. Fig. 19 illustrates the reconstructed surfaces under varying input point cloud densities. Notably, reducing the point cloud density does not lead to a significant drop in reconstruction accuracy, underscoring the robustness of our method to variations in input point cloud density. + +![](images/8f19dd1b5de8a72d393729608be23989a639f8af37eb9c3d9cb7cd7eb1d584f2.jpg) +Figure 19: Visual results of different input point cloud densities. Q Zoom in to see details. + +Different $K$ -NN Patch Sizes. Fig. 20 shows the reconstructed surfaces under different $K$ -NN patch sizes. We also tested different $K$ -NN patch sizes on point clouds with different densities, the numerical results are shown in Table 10. It can be seen that the variation trend of $K$ -NN patch size is similar across point clouds with different densities and datasets, i.e., too large or small $K$ -NN patch size can lead to a decrease in reconstruction accuracy. + +![](images/652669abb42379d088d0f0fcb2ffd16031048ebcbc21d0c6141e42312ecd0ed6.jpg) + +![](images/dea94af1323eabfed83e998ec93fc68e0e23b5d39dfc91b67dc5db42b7d68eb0.jpg) + +![](images/0941dd21708d3629f4c427689d7a453e8a95f238316a04a3b398cacdbb3d72d8.jpg) + +![](images/9a3d634d7fd1ed81133a77306d0dc070ab7c3186ef34beb6878ffb3fea68ff41.jpg) + +![](images/b4b7c86e93b0dd1deb1130b5bda11daca94dfce0af15c0388dd4281880017a7f.jpg) + +![](images/b7c230895ab4a062ef1d16969d7dd5e485626ea130825338f4bae09b81c819b6.jpg) +Input + +![](images/0c1eadb49ba83992ed224938a23c0143f147a7538167ee11ff3317d3af8127c7.jpg) +10 + +![](images/18578235436192fbcbe0d2babd215f90e5d6d1a892b3687a7f5791db9bc6d958.jpg) +20 +Figure 20: Visual comparison of reconstructed surfaces under different $K$ -NN patch sizes. Q Zoom in to see details. + +![](images/3df5db45f04c1f3329923490b1a3a0920621b4b549c980a2934295c6259cee38.jpg) +50 + +![](images/51493be048c6ba2935ada51319b00a951d7893040067406f0d1159dc89ea20b0.jpg) +GT + +Table 10: Surface reconstruction of point clouds with varying densities under different $K$ -NN sizes. + +
Dataset# PointsKCD (10-3) ↓NCF1-0.005 ↑F1-0.01 ↑
ABC10000109.8520.8400.3670.685
204.8420.9530.6080.948
5011.5040.6090.1630.524
40000106.3670.9030.4890.848
204.5600.9730.6300.962
5014.3700.6570.1640.415
100000105.5470.9300.5410.902
204.5140.9770.6360.964
5029.2240.6430.0680.170
non-manifold ABC100001013.9560.7540.1880.512
206.9920.8570.4410.818
5013.4660.5760.0880.399
40000108.5020.8450.2910.724
206.0330.9510.4250.883
5014.5650.6500.1440.456
100000108.4940.8450.2910.725
204.7330.9560.6130.949
5014.5620.6510.1440.456
+ +Efficiency Analysis. In the task of surface reconstruction from point clouds (Sec. 3.4), the inference times of different methods are shown in Table 11. Our method is comparable to POCO and GeoUDF but faster than GIFS. CAP-UDF is an optimization-based method, which requires more time. + +Table 11: Running time of different point cloud surface reconstruction methods. + +
MethodPOCOGIFSCAP-UDFGeoUDFSALS (Ours)
Inference Time (s)13.6645.57906.3415.26914.38
+ +# E LIMITATION + +Unlike previous implicit representations that primarily focus on individual points in 3D space, our proposed SALS targets line segments in 3D space, which introduces greater complexity. Consequently, when the number of sampled line segments is limited, the network struggles to accurately model the LSF, leading to distortions in the reconstructed surfaces, as shown in Table 12. + +Table 12: Numerical results under different numbers of samples. + +
# SamplesCD (10-3) ↓NCF1-0.005 ↑F1-0.01 ↑
100K19.2000.7780.3040.565
500K8.0860.9230.5420.862
1M5.2420.9620.6090.937
5M4.6230.9760.6300.959
10M4.4930.9800.6380.965
20M4.6910.9750.6290.956
40M4.5340.9790.6350.963
\ No newline at end of file diff --git a/ICLR/2025/Shape as Line Segments_ Accurate and Flexible Implicit Surface Representation/images.zip b/ICLR/2025/Shape as Line Segments_ Accurate and Flexible Implicit Surface Representation/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..5883dd89d3917a7351d522bc822e52cd4e475960 --- /dev/null +++ b/ICLR/2025/Shape as Line Segments_ Accurate and Flexible Implicit Surface Representation/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2ff82886fdfc6352a4ad07bea59f3f433459e24032ebc5acb207c0ca3c193eeb +size 1783977 diff --git a/ICLR/2025/Shape as Line Segments_ Accurate and Flexible Implicit Surface Representation/layout.json b/ICLR/2025/Shape as Line Segments_ Accurate and Flexible Implicit Surface Representation/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..b7daac89ab45b69b4b6048cdcf552c335cd66aab --- /dev/null +++ b/ICLR/2025/Shape as Line Segments_ Accurate and Flexible Implicit Surface Representation/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:47bf1bc3b7fdc0dd54dc0db9de44bcf5ef3c04ac03d266bcb215caac28e91ae1 +size 742032 diff --git a/ICLR/2025/Shapley-Guided Utility Learning for Effective Graph Inference Data Valuation/903ff0e3-f768-469b-b02b-f9d2400ddc3d_content_list.json b/ICLR/2025/Shapley-Guided Utility Learning for Effective Graph Inference Data Valuation/903ff0e3-f768-469b-b02b-f9d2400ddc3d_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..b2ffd8e8ead99cf57466fb9940546d3482229aef --- /dev/null +++ b/ICLR/2025/Shapley-Guided Utility Learning for Effective Graph Inference Data Valuation/903ff0e3-f768-469b-b02b-f9d2400ddc3d_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ffd467d59efdf0aabeabc6b242586fefe298cff16eb90eee538266dae0e571ac +size 207630 diff --git a/ICLR/2025/Shapley-Guided Utility Learning for Effective Graph Inference Data Valuation/903ff0e3-f768-469b-b02b-f9d2400ddc3d_model.json b/ICLR/2025/Shapley-Guided Utility Learning for Effective Graph Inference Data Valuation/903ff0e3-f768-469b-b02b-f9d2400ddc3d_model.json new file mode 100644 index 0000000000000000000000000000000000000000..f31a61ad4d4f27e5b4d6f5b8767c4e28528a9378 --- /dev/null +++ b/ICLR/2025/Shapley-Guided Utility Learning for Effective Graph Inference Data Valuation/903ff0e3-f768-469b-b02b-f9d2400ddc3d_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f9c3d3126bd9c992b5fadad49f0102bcbae8f67e1581372f5deef5a008e2d171 +size 247434 diff --git a/ICLR/2025/Shapley-Guided Utility Learning for Effective Graph Inference Data Valuation/903ff0e3-f768-469b-b02b-f9d2400ddc3d_origin.pdf b/ICLR/2025/Shapley-Guided Utility Learning for Effective Graph Inference Data Valuation/903ff0e3-f768-469b-b02b-f9d2400ddc3d_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..8234b84b54d46e849f6289ded002575df454512f --- /dev/null +++ b/ICLR/2025/Shapley-Guided Utility Learning for Effective Graph Inference Data Valuation/903ff0e3-f768-469b-b02b-f9d2400ddc3d_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bc82eb2c8161576f8c12e65adb068d983b28c0915f43afab86192798487593e7 +size 1147282 diff --git a/ICLR/2025/Shapley-Guided Utility Learning for Effective Graph Inference Data Valuation/full.md b/ICLR/2025/Shapley-Guided Utility Learning for Effective Graph Inference Data Valuation/full.md new file mode 100644 index 0000000000000000000000000000000000000000..b71718ef1c93e292b41813e3412e3d6fdc7456a2 --- /dev/null +++ b/ICLR/2025/Shapley-Guided Utility Learning for Effective Graph Inference Data Valuation/full.md @@ -0,0 +1,822 @@ +# SHAPLEY-GUIDED UTILITY LEARNING FOR EFFECTIVE GRAPH INFERENCE DATA VALUATION + +Hongliang Chi $^{1}$ , Qiong Wu $^{2}$ , Zhengyi Zhou $^{2}$ , Yao Ma $^{1}$ + +1Rensselaer Polytechnic Institute, Troy, NY, United States +$^{2}$ AT&T Chief Data Office, Bedminster, NJ, United States + +{chih3@rpi.edu, qw6547@att.com, zz547k@att.com, may13@rpi.edu} + +# ABSTRACT + +Graph Neural Networks (GNNs) have demonstrated remarkable performance in various graph-based machine learning tasks, yet evaluating the importance of neighbors of testing nodes remains largely unexplored due to the challenge of assessing data importance without test labels. To address this gap, we propose Shapley-Guided Utility Learning (SGUL), a novel framework for graph inference data valuation. SGUL innovatively combines transferable data-specific and model-specific features to approximate test accuracy without relying on ground truth labels. By incorporating Shapley values as a preprocessing step and using feature Shapley values as input, our method enables direct optimization of Shapley value prediction while reducing computational demands. SGUL overcomes key limitations of existing methods, including poor generalization to unseen test-time structures and indirect optimization. Experiments on diverse graph datasets demonstrate that SGUL consistently outperforms existing baselines in both inductive and transductive settings. SGUL offers an effective, efficient, and interpretable approach for quantifying the value of test-time neighbors. + +# 1 INTRODUCTION + +Data valuation, the task of quantifying the value of individual data points for machine learning (ML) tasks, has gained significant attention in recent years. As ML models and datasets continue to grow in scale and complexity, understanding the contribution of each data point becomes crucial for fair compensation, dataset curation, and business strategy-making (Pei, 2020; Sim et al., 2022; DalleMule & Davenport, 2017). Concurrently, Graph Neural Networks (GNNs) (Kipf & Welling, 2016; Velicković et al., 2017; Wu et al., 2019; Klicpera et al., 2018) have demonstrated remarkable performance in various graph-based machine learning tasks, including social network analysis (Fan et al., 2019b; Goldenberg, 2021), recommendation systems (Fan et al., 2019a; Xu et al., 2020), and molecular property prediction (Li et al., 2022; Wu et al., 2023). Notably, the success of GNNs, like other ML methods, heavily relies on informative data. + +Unlike Euclidean data, graph data is characterized by its non-independent and identically distributed (non-IID) nature, where nodes influence each other according to the graph structure. This property necessitates specialized data valuation methods for graph data. Addressing this necessity, recent work has extended data valuation methods to graph data, introducing the concept of graph data valuation to assess the contribution of graph structures (Chi et al., 2024a). For general data valuation, game theoretic approaches (Ghorbani & Zou, 2019; Kwon & Zou, 2021; Wang & Jia, 2023; Chi et al., 2024a) have been widely adopted. As with other game theoretic methods, the value of a graph structure is derived from its marginal contributions to different subsets of the dataset. These marginal contributions are quantified by a utility function, which measures how the model's performance changes with or without a particular graph structure. Specifically, the utility function maps from a set of players (training graph structures) to their joint contribution to the model's performance, typically measured using accuracy on labeled validation nodes. Data values are then computed based on how the utility function's results change across different subsets of graph structures. + +Importantly, graph structures can contribute not only during training but also during inference, thus possessing inherent value. Recent work (Yang et al., 2023) has further emphasized the importance of graph structures at test-time, demonstrating that utilizing only testing graph information can achieve performance comparable to full GNNs. In real-world applications, such as GNN-based recommender systems, real-time recommendations often rely on dynamic graphs derived from social networks or item interactions. In these scenarios, assessing the value of inference-time graph data is crucial for optimizing user experience. While evaluating inference-time graph data is key for GNN performance improvement and real-world applications, most existing methods focus on training data valuation, leaving the value of inference graph structures, especially test node neighbors, largely unexplored. + +However, designing data valuation methods for graph inference structures faces fundamental challenges: 1. Lack of test labels: Traditional game-theoretic approaches rely on labeled validation data as a proxy for model performance on testing data. In the case of graph inference data valuation, accuracy on test nodes directly represents model performance. However, the ground truth labels are unavailable for test nodes. 2. Limitations of existing utility learning methods: While surrogate models could potentially approximate utility functions for test-time structures, current methods (Wang et al., 2021) are inadequate for graph inference data valuation due to two primary issues: (a) Inapplicability to unseen test-time structures: Existing models are typically trained on mappings from training data subsets to validation accuracy. This approach fails when applied to a different set of players, such as test node neighbors. (b) Indirect and inefficient optimization: Current methods often use accuracy as the utility learning objective. This approach does not directly optimize the fitted Shapley values against ground truth Shapley values, which is the ultimate goal of data valuation. Furthermore, this indirect approach necessitates processing and storing large amounts of accuracy-level data, leading to increased memory requirements. This inefficiency becomes particularly problematic when dealing with large-scale graphs. + +To address these challenges and enable effective graph inference data valuation, we propose Shapley-Guided Utility Learning (SGUL), a novel interpretable and efficient framework for estimating graph inference data value without relying on test labels. Our key contributions are as follows: + +- We are the first to formulate the graph inference data valuation problem. This addresses a significant gap in the field, where the importance of test-time graph structures has been recognized but not quantified through data valuation methods. +- We propose SGUL, a novel utility-learning framework for graph inference data valuation that addresses the challenge of valuation without test labels. Our approach introduces a transferable feature extraction method that transforms player-dependent inputs into general features. +- We develop a Shapley-guided optimization method that enables direct optimization of Shapley values, improving computational efficiency and model effectiveness. +- We conduct extensive experiments on various graph datasets, demonstrating that SGUL consistently outperforms baseline methods in graph inference data valuation tasks. + +# 2 PRELIMINARY STUDY + +# 2.1 GAME-THEORETIC DATA VALUATION + +Data valuation, the task of quantifying the contribution of individual data points to machine learning (ML) tasks, has gained significant attention in recent years. Game-theoretic approaches, particularly those based on cooperative game theory, have emerged as a prominent framework for data valuation (Ghorbani & Zou, 2019; Kwon & Zou, 2021; Wang & Jia, 2023). In this context, i.i.d training data points are treated as players in a cooperative game, where they can form coalitions to contribute collectively to model performance. + +The Shapley value, a solution concept from cooperative game theory, has been widely adopted for fair allocation of value among players. For a player $i$ in a set of players $\mathcal{D}$ , its Shapley value is defined as: $\phi_i(\mathcal{D}, U) = \frac{1}{|\Pi(\mathcal{D})|} \sum_{\pi \in \Pi(\mathcal{D})} [U(\mathcal{D}_i^\pi \cup \{i\}) - U(\mathcal{D}_i^\pi)]$ where $\Pi(\mathcal{D})$ is the set of all permutations of $\mathcal{D}$ , $\mathcal{D}_i^\pi$ is the set of players that appear before $i$ in permutation $\pi$ , and $U$ is the utility function. The Shapley value $\phi_i(\mathcal{D}, U)$ represents the average marginal contribution of data point $i$ across all possible coalitions. In practice, to reduce computational complexity, we often estimate Shapley values by sampling a subset of permutations rather than considering all possible permutations (Ghorbani & Zou, 2019; Jia et al., 2019). Central to these approaches is the utility function, which quantifies the + +contribution of a subset of players to the overall performance. Formally, we can define the utility function as: $U: 2^{\mathcal{D}} \to \mathbb{R}$ where $2^{\mathcal{D}}$ represents the power set of $\mathcal{D}$ . For any subset $S \subseteq \mathcal{D}$ , $U(S)$ measures the performance achieved by this subset. + +The representative work of Data Shapley (Ghorbani & Zou, 2019) first introduced Shapley value for data valuation. In this framework, as well as in subsequent game-theoretic approaches (Kwon & Zou, 2021; Wang & Jia, 2023), training samples are treated as players, and the utility function is typically defined based on the model's performance on a validation set: $U(S) = \mathrm{Acc}(f_S, \mathcal{D}_{\mathrm{val}})$ where $S \subseteq \mathcal{D}_{\mathrm{tr}}$ is a subset of the training dataset, $f_S$ denotes a model trained on subset $S$ , and $\mathcal{D}_{\mathrm{val}}$ is a validation set used to evaluate the model's performance. This formulation allows us to quantify the contribution of different subsets of training data to the model's predictive accuracy. + +# 2.2 GRAPH DATA VALUATION + +While Data Shapley and subsequent methods (Ghorbani & Zou, 2019; Kwon & Zou, 2021; Wang & Jia, 2023) have been effective for i.i.d. data, they face significant challenges when applied to graph-structured data. A key challenge is capturing the hierarchical and dependent relationships among graph elements. In GNNs, a node's contribution to model performance is intricately linked to its position within the computation tree and its relationships with other nodes. Traditional Shapley value calculations, which treat all players (nodes) independently, fail to account for these crucial dependencies, potentially leading to inaccurate valuations. To address these challenges, recent work has proposed a more granular approach to graph data valuation (Chi et al., 2024a). This approach introduces two key constraints to the Shapley value calculation: the Level Constraint and the Precedence Constraint. These constraints capture the hierarchical and dependent relationships among graph elements. For a detailed discussion of these constraints, please refer to Appendix D.2. + +# 3 METHODOLOGY + +# 3.1 GRAPH INFERENCE DATA VALUATION PROBLEM + +GNNs have demonstrated remarkable performance across various real-world applications, where the $k$ -hop neighbors of key nodes provide essential context for predictions. For example, in protein-protein interaction networks, traffic systems, and social networks, neighboring nodes play vital roles in predicting properties of nodes of interests (Jha et al., 2022; Wang et al., 2022; Liu et al., 2021). Therefore, quantifying the importance of test-time neighboring structures becomes a critical challenge for improving GNN performance, particularly for applications requiring real-time inference. + +Given these considerations, we formally introduce the graph inference data valuation problem: + +Input Setup: (1) Training graph $\mathcal{G}_{\mathrm{Tr}} = (\mathcal{V}_{\mathrm{Tr}},\mathcal{E}_{\mathrm{Tr}},\mathbf{X}_{\mathrm{Tr}})$ with labeled nodes $\nu_{\mathrm{Tr}}^{l}\subset \nu_{\mathrm{Tr}}$ and labels $\mathbf{Y}_{\mathrm{Tr}}$ and a fixed trained GNN model $f(\cdot)$ ; (2) Validation graph $\mathcal{G}_{\mathrm{Val}} = (\mathcal{V}_{\mathrm{Val}},\mathcal{E}_{\mathrm{Val}},\mathbf{X}_{\mathrm{Val}})$ with labeled nodes $\nu_{\mathrm{Val}}^{l}$ and labels $\mathbf{Y}_{\mathrm{Val}}$ ; (3) Test graph $\mathcal{G}_{\mathrm{Te}} = (\mathcal{V}_{\mathrm{Te}},\mathcal{E}_{\mathrm{Te}},\bar{\mathbf{X}}_{\mathrm{Te}})$ with target nodes $\nu_{t}$ but no labels. + +With this setup, we define the graph inference data valuation problem as follows: + +Definition 1 (Graph Inference Data Valuation). Given a set of target test nodes $\mathcal{V}_t\subset \mathcal{V}_{Te}$ , their neighborhood $\mathcal{N}(\mathcal{V}_t)$ , and a downstream task $T$ , the goal of graph inference data valuation is to learn a value-assignment function $\phi :\mathcal{N}(\mathcal{V}_t)\to \mathbb{R}$ that assigns scores to the neighbors of $\mathcal{V}_t$ based on their contribution to the performance of $f(\cdot)$ on task $T$ . + +Graph inference data valuation problem primarily focuses on $\mathcal{N}_k(\mathcal{V}_t)$ , the $k$ -hop neighborhood of target nodes $\mathcal{V}_t$ , where $k$ typically equals the number of GNN layers $L$ . This choice naturally aligns with GNNs' message passing mechanism, ensuring we capture all nodes that influence target nodes' predictions through the network's receptive field. + +# 3.2 STRUCTURE-AWARE SHAPLEY VALUES FOR GRAPH INFERENCE DATA VALUATION + +To address the graph inference data valuation problem, we adopt the Structure-Aware Shapley value formulation with connectivity constraints (Chi et al., 2024a). Unlike PC-Winter (Chi et al., 2024a) which defines players as individual nodes in computation trees, our test-time valuation focuses solely on test node neighbors. This fundamental difference in player definition naturally leads us to use only + +the Precedence constraint, which ensures connectivity between added nodes during value calculation, as the Level constraint from training-time valuation becomes inapplicable to our setting. + +Formally, given a set of target test nodes $\mathcal{V}_t\subset \mathcal{V}_{\mathrm{Te}}$ and their collective neighborhood $\mathcal{N}(\mathcal{V}_t)$ , we define the Structure-Aware Shapley value for each neighbor as follows: + +$$ +\phi_ {i} \left(\mathcal {N} \left(\mathcal {V} _ {t}\right), U\right) = \frac {1}{\left| \Omega \left(\mathcal {N} \left(\mathcal {V} _ {t}\right)\right) \right|} \sum_ {\pi \in \Omega \left(\mathcal {N} \left(\mathcal {V} _ {t}\right)\right)} \left[ U \left(\mathcal {N} _ {i} ^ {\pi} \left(\mathcal {V} _ {t}\right) \cup \{i \}\right) - U \left(\mathcal {N} _ {i} ^ {\pi} \left(\mathcal {V} _ {t}\right)\right) \right] \tag {1} +$$ + +where $U:2^{\mathcal{N}(\mathcal{V}_t)}\to \mathbb{R}$ is a utility function mapping from the power set of $\mathcal{N}(\mathcal{V}_t)$ (all possible subsets of neighbors) to real numbers, $\Omega (\mathcal{N}(\mathcal{V}_t))$ is the set of all permissible permutations that satisfy the graph connectivity constraints, and $\mathcal{N}_i^\pi (\mathcal{V}_t)$ is the set of neighbors that appear before $i$ in permutation $\pi$ . + +As shown above, the utility function $U(\cdot)$ is the most critical input for data value formulation. In traditional data valuation scenarios, as discussed in Section 2.1, the utility function typically maps subsets of training data to their performance on a validation set. For instance, $U(S) = \mathrm{Acc}(f_S, \mathcal{D}_{\mathrm{val}})$ , where $f_S$ is a model trained on subset $S$ , and $\mathcal{D}_{\mathrm{val}}$ is a validation set. In our graph inference data valuation context, the utility function should ideally map subsets of test neighbors to their collective contribution to the GNN's performance on target nodes. While this formulation provides a theoretically sound approach to graph inference data valuation, we face a significant challenge: for test nodes, the absence of ground truth labels makes it impossible to directly measure accuracy and define an appropriate utility function. + +# 4 SHAPLEY-GUIDED UTILITY LEARNING (SGUL) + +As shown in the prior section, the critical challenge in solving the graph inference data valuation problem lies in obtaining an appropriate utility function without testing labels. To address this issue, we propose an approach to learn the utility function that can effectively value test node neighbors. + +# 4.1 UTILITY LEARNING IN DATA VALUATION + +Despite the crucial role of utility functions in data valuation, as introduced in Section 2.1, accessing these functions can often be costly or even impossible. For instance, the utility function we previously discussed for training data valuation requires model retraining, which can be computationally expensive for large datasets. To address this challenge, utility learning methods have been introduced. + +Utility learning aims to approximate the true utility function in a data-driven way. The general formulation of utility learning can be expressed as: $\hat{U}(S) = h(g(S))$ where $S$ is a subset of data points, $g(\cdot)$ is a feature extractor that captures relevant characteristics of the subset, and $h(\cdot)$ is a learnable function that maps these characteristics to an estimated utility value. This approach differs from the original utility function by avoiding direct model retraining for each subset, instead learning to predict utility based on subset features. To train this approximation function, we construct a dataset of utility samples. Each sample consists of a subset of data points and its corresponding true utility value, obtained by evaluating the original utility function on a limited number of subsets. + +A notable instance of utility learning is the approach for training data valuation proposed by Wang et al. (2021). This method efficiently estimates model performance on various subsets of the training data without repeated model retraining. It represents subsets as binary vectors as $g(S)$ , where each element corresponds to a specific data point in the training set, indicating its presence or absence. The method uses a regression model $\hat{U}_{\mathrm{train}}$ to approximate the ground truth utility function $U: 2^{\mathcal{D}_{\mathrm{tr}}} \to \mathbb{R}$ , where $U(S) = \mathrm{Acc}(f_S, \mathcal{D}_{\mathrm{val}})$ . Here, $f_S$ denotes a model trained on the subset $S \subseteq \mathcal{D}_{\mathrm{tr}}$ , and $\mathcal{D}_{\mathrm{val}}$ is the validation set. The regression model is trained on a set of utility samples to minimize the difference between predicted and true utility values. + +While this approach is effective for training data, it faces significant challenges when applied to graph inference data valuation: 1. Player Dependence: The input of $\hat{U}_{\mathrm{train}}$ , using player-specific dummy variables, is tied to a specific set of players (data points) and cannot be directly transferred to new player sets or games. In the context of graph inference data valuation, this limitation becomes + +particularly problematic. While we have access to the labels of the validation graph $\mathcal{G}_{\mathrm{Val}}$ , allowing us to compute the validation accuracy for different subsets of neighbor nodes on labeled validation nodes, the utility function learned on $S \subseteq \mathcal{N}(\mathcal{V}_{\mathrm{Val}}^l) \in \mathcal{G}_{\mathrm{Val}}$ cannot be directly applied to test nodes in $\mathcal{G}_{\mathrm{Te}}$ . This is because the test nodes represent a new set of players from $\mathcal{N}(\mathcal{V}_t)$ , which were not present during the utility function learning process. 2. Indirect optimization: As discussed in Section 2.1, the utility function is a crucial input for data valuation solutions. Following this logic, current utility learning approaches employ a two-stage process: learning the utility function with sampled training subsets and corresponding validation accuracy, then estimating Shapley values with the fixed learned utility. This indirect method has two main drawbacks: (a) it requires handling computationally expensive accuracy-level data, and (b) optimizing for accuracy prediction doesn't necessarily lead to optimal Shapley value estimation. + +# 4.2 SHAPLEY-GUIDED UTILITY LEARNING + +To address the challenges of player dependence and indirect optimization in graph inference data valuation, we propose Shapley-Guided Transferable Utility Learning (SGUL). This novel approach focuses on two key aspects: (1) Transferable Feature Extraction: We introduce a method that transforms player-dependent inputs into transferable, performance-related features. These features capture both graph structure and model behavior without relying on test labels, enabling our utility learning model to generalize across different player sets and graphs. (2) Shapley-guided Optimization: We develop a method that enables direct optimization of Shapley values, addressing the limitations of indirect optimization approaches. + +# 4.2.1 TRANSFERABLE FEATURE EXTRACTION + +As mentioned in Section 4.1, traditional utility learning approaches often use player-specific binary vectors as input (Wang et al., 2021). While effective for training data, this method faces limitations when applied to graph inference data valuation, particularly due to its inability to transfer to new player sets. To overcome the limitations of traditional utility learning approaches, we propose a novel feature extraction method that transforms player-dependent inputs into transferable, performance-related features. This approach builds upon the general utility learning formulation introduced in Equation (4.1), focusing on designing a transferable feature extractor $g(S)$ . Specifically, our proposed $g(S)$ aims to capture both structural and model-specific characteristics of the graph data. The input $S$ is a set of neighboring nodes of target test nodes. As discussed in Section 2.2, we also employ a permutation sampling process for estimating Structure-Aware Shapley value. During this process, we incrementally add neighboring nodes to target test nodes following permissible permutations. This generates a series of test subgraphs $\mathcal{G}_{\mathrm{sub}} = (\mathcal{V}_{\mathrm{sub}}, \mathcal{E}_{\mathrm{sub}}, \mathbf{X}_{\mathrm{sub}})$ , each including the added neighboring nodes and target test nodes. The function $g(\cdot)$ maps the current neighbor node set $S \in \mathcal{V}_{\mathrm{sub}}$ to a $d$ -dimensional feature vector $\mathbf{x} \in \mathbb{R}^d$ , which encapsulates the characteristics of the subgraph induced by $S$ as derived from the permutation. These features serve as proxies for model accuracy, capturing both graph structure and GNN behavior without relying on true labels. + +Our feature vector $\mathbf{x}$ comprises two main categories: data-specific and model-specific features. Data-specific features capture graph structure and test node relationships to the training set, including edge cosine similarity, representation distance, and classwise representation distance. Model-specific features assess prediction confidence and uncertainty using the GNN model's output. These include maximum predicted confidence, target class confidence, propagated confidence measures, negative entropy, and confidence gap. By combining these features, we create a comprehensive representation of GNN performance on test subgraphs without relying on true labels. This approach allows us to estimate the utility function effectively, even in the absence of ground truth information for test nodes. A detailed description and mathematical formulation of each feature is provided in Appendix A. + +# 4.2.2 SGUL-ACCURACY AND ITS LEARNING PROCESS + +With our transferable feature extraction approach, we can adapt traditional utility learning methods to create an accuracy-oriented variant of our method. Following (Wang et al., 2021), we can apply these features directly in a standard regression framework. This base model, termed SGUL-Accuracy, serves as an important comparison point for our proposed Shapley-guided method in Section 4.2.3. For a detailed description of SGUL-Accuracy training process, please refer to Appendix B. + +# 4.2.3 SHAPLEY-GUIDED UTILITY LEARNING (SGUL) + +Having established our transferable utility learning framework and selected features, we now address the challenge of efficiently optimizing our utility function. Traditional accuracy-based approaches we seen in Section 4.1 employ a two-stage optimization process: first learning a utility function to predict model accuracy, then using this function to estimate Shapley values. However, this indirect accuracy-based method has significant limitations. It is computationally expensive due to the large amount of accuracy-level data required, especially for large-scale graphs. More importantly, the optimization process in these accuracy-oriented methods is misaligned with the ultimate goal of data valuation. While the first stage focuses on accurately predicting model accuracy, it doesn't directly minimize the difference between predicted Shapley values (derived from the learned utility function) and true Shapley values (calculated using actual accuracy). Our aim is to develop a method that directly optimizes for accurate Shapley value prediction, ensuring that the learned utility function could produce Shapley values that closely match those derived from true accuracy measurements. + +Through theoretical analysis of the Shapley value definition, we discover a key insight: the Shapley value calculation is a deterministic linear transformation of the utility function. This insight is formalized in the following theorem: + +Theorem 1 (Shapley Value Decomposition). Given a linear utility function $U(S) = \mathbf{w}^\top \mathbf{x}(S)$ , where $\mathbf{w} \in \mathbb{R}^d$ is a parameter vector and $\mathbf{x}(S) \in \mathbb{R}^d$ is a feature vector representing subset $S$ , the Shapley value of player $i$ with respect to $U$ can be expressed as a linear combination of Feature Shapley Values: + +$$ +\phi_ {i} (U) = \mathbf {w} ^ {\top} \psi_ {i} \tag {2} +$$ + +where $\psi_{i} = [\phi_{i}(U_{1}),\phi_{i}(U_{2}),\dots,\phi_{i}(U_{d})]^{\top}$ is the vector of Feature Shapley Values, and $U_{k}(S) = x_{k}(S)$ is the utility function considering only the $k$ -th feature. + +The proof of this theorem is provided in Appendix C. This theorem establishes a direct link between learnable parameters and fitted Shapley values: $\hat{\phi}_i(U) = \mathbf{w}^\top \boldsymbol{\psi}_i$ , where $\hat{\phi}_i(U)$ is the fitted Shapley value for $i$ , $\mathbf{w}$ is our learnable parameter vector, and $\boldsymbol{\psi}_i$ is the Feature Shapley vector for $i$ . Unlike previous decoupled accuracy-oriented optimization that solve $\hat{\phi}_i(\hat{U})$ subject to $\hat{U}(S) = \arg \min \mathcal{L}(\hat{U}(S), U(S))$ ( $\mathcal{L}$ is the loss), our approach directly optimizes the fitted Shapley values from learned utility function with the help of this theorem. + +Building on this, we propose Shapley-Guided Transferable Utility Learning (SGUL), which integrates our transferable utility learning framework with a Shapley-guided optimization method. To learn the optimal parameter vector $\mathbf{w}$ , we formulate the following optimization problem: + +$$ +\min _ {\mathbf {w}} \sum_ {i \in \mathcal {N} \left(\mathcal {V} _ {\mathrm {v a l}}\right)} \left(\phi_ {i} (U) - \mathbf {w} ^ {\top} \psi_ {i}\right) ^ {2} + \lambda \| \mathbf {w} \| _ {1} \tag {3} +$$ + +Here, $\mathcal{V}_{\mathrm{Val}}$ represents the set of labeled validation nodes, and $\mathcal{N}(\cdot)$ denotes the set of neighbors for a given node set. The regularization parameter $\lambda$ controls the trade-off between fitting the data and model complexity. This optimization problem is designed to find the optimal weight vector $\mathbf{w}$ that quantifies the importance of each feature in the utility function. The input features are the Feature Shapley Values $\psi_{i}$ for each neighbor $i$ , computed as a preprocessing step. The target variable is the true Shapley value $\phi_i(U)$ , which we can compute using the known accuracy on the validation set. + +By solving this optimization problem, we obtain the optimal parameter vector $\mathbf{w}^*$ that minimizes the difference between predicted and true Shapley values across all validation nodes and their neighbors. This direct optimization approach contrasts with traditional methods that focus on predicting accuracy rather than Shapley values. The inclusion of $L_{1}$ regularization $(\| \mathbf{w}\|_{1})$ in the objective function promotes sparsity in the learned weights, effectively identifying the most relevant features for Shapley value estimation and helping prevent overfitting. Importantly, the learned coefficients are interpretable, as our proposed features are theoretically positively correlated with accuracy. To ensure this interpretability, we constrain the parameters to be non-negative during the learning process. Once we have obtained the optimal parameter vector $\mathbf{w}^*$ , we can apply SGUL to estimate Shapley values for neighbors of test nodes. When comparing our proposed methods with different optimization protocols, we refer to the one optimized using our Shapley-guided method as SGUL-Shapley, which differs from SGUL-Accuracy, optimized for accuracy as mentioned in Subsection 4.2.2. + +# 5 RELATED WORK + +Data Valuation Methods. Data valuation approaches based on cooperative game theory, including Data Shapley (Ghorbani & Zou, 2019) and its variants (Kwon & Zou, 2021; Wang & Jia, 2023), have established effective frameworks for quantifying individual data contributions. Recent innovations include learning-agnostic frameworks (Just et al., 2023) and training-free methods (Nohyun et al., 2022). For graph-specific valuation, Winter value-based methods (Chi et al., 2024a) and task-agnostic frameworks (Falahati & Amiri, 2024) address the unique challenges of interconnected data. Data utility learning (Wang et al., 2021) enhances valuation efficiency by predicting model performance on data subsets without repeated training, improving methods like Shapley value calculations. + +Graph Neural Networks. Graph Neural Networks (GNNs) have revolutionized graph-structured data analysis since the introduction of spectral convolutions (Bruna et al., 2013), with architectures like Graph Convolutional Networks (GCN) (Kipf & Welling, 2016) and attention-based variants (Veličković et al., 2017) gaining wide adoption. Central to GNNs' success is the message-passing mechanism (Xu et al., 2018), enabling effective information propagation across the graph. While traditionally viewed as crucial for both training and inference, recent research highlights its particular importance during testing. The introduction of PMLPs (Yang et al., 2023), which are identical to standard MLPs in training but adopt GNN's architecture with message passing in testing, reveals the critical role of testing-time structure in graph-based models' performance. + +Model Evaluation Without Labels. Several approaches have been developed for model evaluation without test labels. Label-free model evaluation methods (see Appendix D.4) estimate model accuracy through confidence scores and distribution metrics. ATC (Garg et al., 2022) learns confidence thresholds and DoC (Guillory et al., 2021) measures confidence shifts between validation and test sets. These methods have been extended to graph domain through GNNEvaluator (Zheng et al., 2024b), which uses discrepancy attributes to train a GCN regressor for accuracy prediction. However, these methods focus on single-accuracy estimation rather than data value assessment. Recently, retraining-based approaches (see Appendix D.5) have emerged as an alternative strategy. Projection Norm (Yu et al., 2022) predicts performance by analyzing parameter changes after pseudo-label retraining, which has been adapted to graphs through LEBED (Zheng et al., 2024a). However, their computational demands make them impractical for evaluating multiple subgraph configurations required in our setting. While test-time adaptation methods (see Appendix D.6) such as GTRANS (Jin et al., 2022b) and IGT3 (Pi et al.) also operate on unlabeled test data, they focus on the one-time performance maximization through graph transformation or parameter adaptation. For the graph-inference data valuation problem requiring evaluation across numerous subgraph configurations, only non-retraining label-free model evaluation methods serve as suitable surrogate utility functions, as they enable efficient prediction across multiple subgraphs. + +For a more detailed discussion on related work, please refer to Appendix D. + +# 6 EXPERIMENTS + +# 6.1 DATASETS AND EXPERIMENTAL SETUP + +We evaluated our proposed SGUL framework on seven diverse real-world graph datasets, covering both homophily and heterophily scenarios. Our experiments focus primarily on the inductive node classification task, with additional evaluations in the transductive setting. We employed different fixed GNN models for each setting to highlight the importance of testing structures. For a detailed description of the datasets and experimental setup, please refer to Appendix E. + +# 6.2 EVALUATION PROCESS AND METRICS + +To evaluate our proposed SGUL framework, we design a comprehensive assessment protocol consisting of utility learning and data valuation phases. During utility learning, we follow the process detailed in Algorithm 1, which involves generating permutations on the validation graph to learn our utility function. This standardized process is applied identically across all methods to ensure fair comparison. In the data valuation phase, we apply the learned utility functions to the test graph $\mathcal{G}_{\mathrm{Te}}$ to + +predict accuracies for target nodes $\mathcal{V}_t$ . These predicted accuracies serve as utility function outputs $U(\cdot)$ for calculating Shapley values following Algorithm 2. + +To assess the quality of data values produced by SGUL, we employ a node dropping experiments that targets high-value nodes in the graph. This experiment is one of the most common and widely used evaluation methods in data valuation research (Ghorbani & Zou, 2019; Jiang et al., 2023; Kwon & Zou, 2023; Chi et al., 2024a). By sequentially removing nodes ranked according to their assessed values, we can observe a node dropping performance curve, which visually represents how the model's performance degrades as important nodes are removed. A good data valuation method should result in a curve that shows a rapid and sharp decline in model performance. This corresponds to identifying a crucial data subset, whose removal would significantly affect performance. Moreover, the decrease in performance caused by our method should not only be substantial but also persistent throughout the node-dropping process, ensuring that the importance identification is highly consistent (Ghorbani & Zou, 2019; Jiang et al., 2023; Chi et al., 2024a). To quantify the effectiveness of a valuation method, we use the Area Under the Curve (AUC) metric of these node dropping performance curves. The AUC provides a single numerical value that captures the overall behavior of the node dropping process, reflecting both the initial rapid decline and the sustained performance drop. A lower AUC indicates a better valuation method, as it represents a more rapid and sustained decline in model accuracy when high-value nodes are removed. For detailed implementation of this evaluation protocol, please refer to Algorithm 3. + +# 6.3 BASELINES + +To evaluate the effectiveness of our proposed SGUL framework, we compare it with several alternative utility learning methods. All these baselines aim to approximate the true utility function for graph inference data valuation, but differ in their specific techniques. The baselines we consider are: i. Average Thresholded Confidence (ATC): ATC (Garg et al., 2022) estimates accuracy by learning a threshold on the model's confidence scores. We implement two variants: ATC-MC (Maximum Confidence) and ATC-NE (Negative Entropy). ii. Difference of Confidence (DoC): DoC (Guillory et al., 2021) measures the difference in average confidence between the validation and test sets to predict accuracy change. iii. GNNEvaluator: GNNEvaluator (Zheng et al., 2024b) is a novel method designed to assess GNN performance on unseen graphs without labels. iv. Natural Confidence-Based Baselines: We also include two straightforward confidence-based baselines: (a) Maximum Confidence: This uses the highest confidence score across all nodes and classes in the subgraph. (b) Class Confidence: This calculates the average confidence score of the predicted class for each test node, using the full test graph as input. We ensure a fair comparison by using the same overall framework for all methods, including identical sampling procedures for validation and test permutations. For a complete description of those methods and corresponding training process, please see Appendix D.3 and Appendix B respectively. + +# 6.4 MAIN RESULTS AND ANALYSIS + +To evaluate the effectiveness of our proposed SGUL framework, we conducted comprehensive experiments on various graph datasets using both SGC and GCN models in the inductive and Transductive setting. Our analysis focuses on two key aspects: the detailed behavior of node removal across different datasets and the overall performance of SGUL compared to baselines. + +# 6.4.1 INDUCTIVE NODE REMOVAL ANALYSIS + +To provide a nuanced understanding of how different methods perform as nodes are progressively removed, we present accuracy curves for node dropping experiments. Figures 1 and 2 show these curves for SGC and GCN models, respectively, across various datasets. Figure 1 illustrates the accuracy curves for node dropping experiments using SGC models across various datasets. These results reveal two key characteristics of our SGUL method. Firstly, SGUL consistently demonstrates a steeper initial drop in accuracy when removing the first few nodes, particularly evident in datasets like Cora and Citeseer. This rapid initial decline indicates SGUL's superior ability to identify the most critical nodes in the graph structure. Secondly, as more nodes are removed, SGUL maintains a more stable accuracy curve compared to other methods. This long-term stability is especially pronounced in larger datasets such as CS and Physics, suggesting a more robust and consistent + +![](images/8468956a3b704b70940e0b5f747d50a7b9f9e7627ca97349b7e3f87646374996.jpg) +Figure 1: Accuracy curves for node dropping experiments using the SGC model on various datasets in the inductive setting. Our proposed SGUL method consistently maintains higher accuracy as nodes are removed, indicating its effectiveness in identifying important nodes. Note that GNNEvaluator is not shown for the larger datasets due to Out of Memory (OOM) errors. + +ranking of node importance throughout the removal process. The performance of SGUL varies across datasets, showcasing its adaptability to different graph structures. For instance, in the Cora dataset, SGUL exhibits a clear advantage throughout the entire node removal process. In the Amazon-ratings dataset, which presents a more challenging heterophily scenario, SGUL consistently outperforms other methods, particularly in the latter stages of node removal. Similar performance patterns are observed when using GCN models, demonstrating that SGUL's effectiveness is not limited to a specific GNN architecture. For detailed results of the GCN experiments, please refer to Appendix F. Additionally, to demonstrate scalability on much larger graphs, we conducted experiments on the ogbn-arxiv dataset, with results showing consistent improvements over baselines (see Appendix L). + +# 6.4.2 TRANSDUCTIVE NODE REMOVAL ANALYSIS + +To further validate the effectiveness of our SGUL framework, we extended our evaluation to the transductive setting using the Cora, Citeseer, and Pubmed datasets. This setting allows us to assess how our method performs when the entire graph structure is known during both training and inference. Our results show that SGUL consistently maintains higher accuracy as nodes are removed across all datasets for both SGC and GCN models. This performance is particularly notable in the Pubmed dataset, where SGUL shows a significant advantage over other methods throughout the node removal process. For a detailed analysis of the transductive setting experiments, including accuracy curves for node dropping experiments and AUC results, please refer to Appendix G. + +# 6.5 ABLATION STUDIES + +To further validate the effectiveness of our proposed Shapley-guided approach and to provide deeper insights into its performance, we conducted a series of ablation studies. These studies aim to compare our Shapley-guided method (SGUL-Shapley) with an accuracy-based optimization approach (SGUL-Accuracy) across different aspects of performance and efficiency. + +# 6.5.1 IN-SAMPLE ERROR COMPARISON OF SHAPLEY AND ACCURACY OPTIMIZATION + +To empirically validate our theoretical arguments from Section 4.2.3, we compared the performance of Shapley-guided optimization (SGUL-Shapley) against accuracy-based optimization (SGUL-Accuracy). We conducted in-sample Mean Squared Error (MSE) comparisons across various datasets in the inductive setting with the SGC model. Our results show that SGUL-Shapley consistently achieves lower MSE across all datasets, with statistically significant differences $(p < 0.05)$ . These findings provide strong empirical support for our theoretical analysis, demonstrating that directly optimizing for Shapley values leads to more accurate estimation of data value compared to the accuracy-based approach. For a detailed description of the experimental setup and full results, please refer to Appendix I. + +# 6.5.2 DROPPING NODE COMPARISON OF OPTIMIZATION OBJECTIVES + +We conducted an ablation study comparing Shapley value optimization (SGUL-Shapley) and accuracy-based optimization (SGUL-Accuracy) in node dropping experiments. Our results show that SGUL-Shapley generally outperforms SGUL-Accuracy across most datasets and models, achieving better results in 10 out of 14 dataset-model combinations. The improvement is particularly noticeable for larger and more complex datasets such as CS, Physics, and Amazon-ratings. These findings demonstrate that directly optimizing for Shapley values leads to more accurate and robust inference data valuation. For detailed experimental setup and full results, please refer to Appendix J. + +# 6.5.3 EFFICIENCY ANALYSIS OF SHAPLEY AND ACCURACY OPTIMIZATION + +To complement our effectiveness analysis, we also evaluated the computational efficiency of Shapley value optimization (SGUL-Shapley) compared to accuracy-based optimization (SGUL-Accuracy). This analysis helps validate the practical applicability of our method, especially for large-scale graph applications. We recorded the fitting time and memory usage for both methods under the OLS setting described in the In-Sample Error Comparison. The implementation used PyTorch with a learning rate of 0.001 for both methods. We ran each fitting process 10 times and averaged the results, with each run consisting of 1000 epochs. Table 1 summarizes our findings: + +
SettingDatasetShapley OptimizationAccuracy Optimization
Time (s)Memory (MB)Time (s)Memory (MB)
InductiveCora0.6316.280.6629.58
CiteSeer0.6416.281.5428.59
Pubmed0.5616.490.6787.60
CS0.5216.530.5044.19
Physics0.4416.710.5539.05
Amazon-ratings0.6416.590.67115.62
Roman-empire0.5316.370.6550.25
TransductiveCora0.5916.350.7565.77
CiteSeer0.5116.350.5961.28
Pubmed0.5316.810.6772.22
+ +Table 1: Comparison of training time and peak memory usage between Shapley-guided (SGUL-Shapley) and accuracy-based (SGUL-Accuracy) optimization approaches using the SGC model. + +The results demonstrate that SGUL-Shapley consistently outperforms SGUL-Accuracy in terms of computational efficiency. SGUL-Shapley achieves faster training times for most datasets, with notable improvements for larger datasets like Citeseer and Pubmed. More significantly, SGUL-Shapley shows a substantial reduction in memory usage across all datasets, often using less than half the memory required by SGUL-Accuracy. This efficiency advantage is particularly pronounced for larger datasets such as Amazon-ratings, where SGUL-Shapley uses only about $14\%$ of the memory consumed by SGUL-Accuracy. + +These findings indicate that SGUL-Shapley not only provides more accurate node importance estimations but also offers significant computational benefits. The reduced memory footprint and faster training times make SGUL-Shapley particularly suitable for large-scale graph applications where resource efficiency is crucial. This combination of effectiveness and efficiency underscores the practical value of our Shapley-guided approach in real-world graph inference data valuation tasks. + +# 7 CONCLUSION + +This paper introduces Shapley-Guided Utility Learning (SGUL), a pioneering framework for valuing graph inference data without test labels. SGUL uniquely integrates transferable feature extraction with Shapley-guided optimization, addressing the challenges of generalization to unseen structures and computational efficiency in graph data valuation. Our comprehensive experiments across diverse datasets consistently demonstrate SGUL's superiority over existing methods in both inductive and transductive settings. + +# ACKNOWLEDGMENTS + +The research is supported by the National Science Foundation (NSF) under grant numbers NSF2406647 and NSF-2406648. + +# REFERENCES + +Piotr Bielak, Tomasz Kajdanowicz, and Nitesh V Chawla. Graph barlow twins: A self-supervised representation learning framework for graphs. Knowledge-Based Systems, 256:109631, 2022. +Joan Bruna, Wojciech Zaremba, Arthur Szlam, and Yann LeCun. Spectral networks and locally connected networks on graphs. arXiv preprint arXiv:1312.6203, 2013. +Hongyun Cai, Vincent W Zheng, and Kevin Chen-Chuan Chang. Active learning for graph embedding. arXiv preprint arXiv:1705.05085, 2017. +Hongliang Chi and Yao Ma. Enhancing contrastive learning on graphs with node similarity. In Proceedings of the 30th ACM SIGKDD Conference on Knowledge Discovery and Data Mining, pp. 456-465, 2024. +Hongliang Chi, Wei Jin, Charu Aggarwal, and Yao Ma. Precedence-constrained winter value for effective graph data valuation. arXiv preprint arXiv:2402.01943, 2024a. +Hongliang Chi, Cong Qi, Suhang Wang, and Yao Ma. Active learning for graphs with noisy structures. In Proceedings of the 2024 SIAM International Conference on Data Mining (SDM), pp. 262-270. SIAM, 2024b. +Leandro DalleMule and Thomas H Davenport. What's your data strategy. Harvard business review, 95(3):112-121, 2017. +Ali Falahati and Mohammad Mohammadi Amiri. Disentangled structural and featural representation for task-agnostic graph valuation. arXiv preprint arXiv:2408.12659, 2024. +Wenqi Fan, Yao Ma, Qing Li, Yuan He, Eric Zhao, Jiliang Tang, and Dawei Yin. Graph neural networks for social recommendation. In WWW, 2019a. +Wenqi Fan, Yao Ma, Dawei Yin, Jianping Wang, Jiliang Tang, and Qing Li. Deep social collaborative filtering. In Proceedings of the 13th ACM RecSys, 2019b. +Dominik Fuchsgruber, Tom Wollschläger, Bertrand Charpentier, Antonio Oroz, and Stephan Gunnemann. Uncertainty for active learning on graphs. arXiv preprint arXiv:2405.01462, 2024. +Saurabh Garg, Sivaraman Balakrishnan, Zachary C Lipton, Behnam Neyshabur, and Hanie Sedghi. Leveraging unlabeled data to predict out-of-distribution performance. arXiv preprint arXiv:2201.04234, 2022. +Amirata Ghorbani and James Zou. Data shapley: Equitable valuation of data for machine learning. In International conference on machine learning, pp. 2242-2251. PMLR, 2019. +Dmitri Goldenberg. Social network analysis: From graph theory to applications with python. arXiv preprint arXiv:2102.10014, 2021. +Shengbo Gong, Mohammad Hashemi, Juntong Ni, Carl Yang, and Wei Jin. Scalable graph condensation with evolving capabilities. arXiv preprint arXiv:2502.17614, 2025. +Devin Guillory, Vaishaal Shankar, Sayna Ebrahimi, Trevor Darrell, and Ludwig Schmidt. Predicting with confidence on unseen distributions. In Proceedings of the IEEE/CVF international conference on computer vision, pp. 1134-1144, 2021. +Chuan Guo, Geoff Pleiss, Yu Sun, and Kilian Q Weinberger. On calibration of modern neural networks. In International conference on machine learning, pp. 1321-1330. PMLR, 2017. +Will Hamilton, Zhitao Ying, and Jure Leskovec. Inductive representation learning on large graphs. Advances in neural information processing systems, 30, 2017. + +Shengding Hu, Zheng Xiong, Meng Qu, Xingdi Yuan, Marc-Alexandre Côté, Zhiyuan Liu, and Jian Tang. Graph policy network for transferable active learning on graphs. Advances in Neural Information Processing Systems, 33:10174-10185, 2020a. +Weihua Hu, Matthias Fey, Marinka Zitnik, Yuxiao Dong, Hongyu Ren, Bowen Liu, Michele Catasta, and Jure Leskovec. Open graph benchmark: Datasets for machine learning on graphs. Advances in neural information processing systems, 33:22118-22133, 2020b. +Kanchan Jha, Sriparna Saha, and Hiteshi Singh. Prediction of protein-protein interaction using graph neural networks. *Scientific Reports*, 12(1):8360, 2022. +Ruoxi Jia, David Dao, Boxin Wang, Frances Ann Hubis, Nick Hynes, Nezihe Merve Gürel, Bo Li, Ce Zhang, Dawn Song, and Costas J Spanos. Towards efficient data valuation based on the shapley value. In The 22nd International Conference on Artificial Intelligence and Statistics, pp. 1167-1176. PMLR, 2019. +Kevin Jiang, Weixin Liang, James Y Zou, and Yongchan Kwon. Opendataval: a unified benchmark for data valuation. Advances in Neural Information Processing Systems, 36, 2023. +Wei Jin, Lingxiao Zhao, Shichang Zhang, Yozen Liu, Jiliang Tang, and Neil Shah. Graph condensation for graph neural networks. arXiv preprint arXiv:2110.07580, 2021. +Wei Jin, Xianfeng Tang, Haoming Jiang, Zheng Li, Danqing Zhang, Jiliang Tang, and Bing Yin. Condensing graphs via one-step gradient matching. In Proceedings of the 28th ACM SIGKDD Conference on Knowledge Discovery and Data Mining, pp. 720-730, 2022a. +Wei Jin, Tong Zhao, Jiayuan Ding, Yozen Liu, Jiliang Tang, and Neil Shah. Empowering graph representation learning with test-time graph transformation. arXiv preprint arXiv:2210.03561, 2022b. +Hoang Anh Just, Feiyang Kang, Jiachen T Wang, Yi Zeng, Myeongseob Ko, Ming Jin, and Ruoxi Jia. Lava: Data valuation without pre-specified learning algorithms. arXiv preprint arXiv:2305.00054, 2023. +Jian Kang, Qinghai Zhou, and Hanghang Tong. Jurygcn: quantifying jackknife uncertainty on graph convolutional networks. In Proceedings of the 28th ACM SIGKDD Conference on Knowledge Discovery and Data Mining, pp. 742-752, 2022. +Thomas N Kipf and Max Welling. Semi-supervised classification with graph convolutional networks. arXiv preprint arXiv:1609.02907, 2016. +Johannes Klicpera, Aleksandar Bojchevski, and Stephan Gunnemann. Predict then propagate: Graph neural networks meet personalized pagerank. arXiv preprint arXiv:1810.05997, 2018. +Yongchan Kwon and James Zou. Beta shapley: a unified and noise-reduced data valuation framework for machine learning. arXiv preprint arXiv:2110.14049, 2021. +Yongchan Kwon and James Zou. Data-oob: Out-of-bag estimate as a simple and efficient data value. In International Conference on Machine Learning, pp. 18135-18152. PMLR, 2023. +Ting Wei Li, Qiaozhu Mei, and Jiaqi Ma. A metadata-driven approach to understand graph neural networks. Advances in Neural Information Processing Systems, 36, 2024. +Zhen Li, Mingjian Jiang, Shuang Wang, and Shugang Zhang. Deep learning methods for molecular representation and property prediction. *Drug Discovery Today*, 27(12):103373, 2022. +Juncheng Liu, Yiwei Wang, Bryan Hooi, Renchi Yang, and Xiaokui Xiao. Lscale: latent space clustering-based active learning for node classification. In Joint European Conference on Machine Learning and Knowledge Discovery in Databases, pp. 55-70. Springer, 2022. +Yujia Liu, Kang Zeng, Haiyang Wang, Xin Song, and Bin Zhou. Content matters: A gnn-based model combined with text semantics for social network cascade prediction. In Pacific-Asia Conference on Knowledge Discovery and Data Mining, pp. 728-740. Springer, 2021. + +Jiaqi Ma, Junwei Deng, and Qiaozhu Mei. Subgroup generalization and fairness of graph neural networks. Advances in Neural Information Processing Systems, 34:1048-1061, 2021. +Qian Ma, Hongliang Chi, Hengrui Zhang, Kay Liu, Zhiwei Zhang, Lu Cheng, Suhang Wang, Philip S Yu, and Yao Ma. Overcoming pitfalls in graph contrastive learning evaluation: Toward comprehensive benchmarks. arXiv preprint arXiv:2402.15680, 2024. +Ki Nohyun, Hoyong Choi, and Hye Won Chung. Data valuation without training of a model. In The Eleventh International Conference on Learning Representations, 2022. +Jian Pei. A survey on data pricing: from economics to data science. IEEE Transactions on knowledge and Data Engineering, 34(10):4586-4608, 2020. +Li Pi, Jiaxing Li, Lei Song, Guanyu Yang, Yang Chen, and Youyong Kong. Test-time training with invariant graph learning for out-of-distribution generalization. Available at SSRN 4886269. +Oleg Platonov, Denis Kuznedelev, Michael Diskin, Artem Babenko, and Liudmila Prokhorenkova. A critical look at the evaluation of gnns under heterophily: Are we really making progress? arXiv preprint arXiv:2302.11640, 2023. +Prithviraj Sen, Galileo Namata, Mustafa Bilgic, Lise Getoor, Brian Galligher, and Tina Eliassi-Rad. Collective classification in network data. AI magazine, 29(3):93-93, 2008. +Murat Sensoy, Lance Kaplan, and Melih Kandemir. Evidential deep learning to quantify classification uncertainty. Advances in neural information processing systems, 31, 2018. +Oleksandr Shchur, Maximilian Mumme, Aleksandar Bojchevski, and Stephan Gunnemann. Pitfalls of graph neural network evaluation. arXiv preprint arXiv:1811.05868, 2018. +Rachael Hwee Ling Sim, Xinyi Xu, and Bryan Kian Hsiang Low. Data valuation in machine learning: "ingredients", strategies, and open challenges. In Proc. IJCAI, pp. 5607-5614, 2022. +Shantanu Thakoor, Corentin Tallec, Mohammad Gheshlaghi Azar, Rémi Munos, Petar Velicković, and Michal Valko. Bootstrapped representation learning on graphs. In ICLR 2021 Workshop on GTRL, 2021. +Rafaël Van Belle, Charles Van Damme, Hendrik Tytgat, and Jochen De Weerdt. Inductive graph representation learning for fraud detection. Expert Systems with Applications, 193:116463, 2022. +Petar Velicković, Guillem Cucurull, Arantxa Casanova, Adriana Romero, Pietro Lio, and Yoshua Bengio. Graph attention networks. arXiv preprint arXiv:1710.10903, 2017. +Petar Velickovic, William Fedus, William L Hamilton, Pietro Lio, Yoshua Bengio, and R Devon Hjelm. Deep graph infomax. *ICLR (Poster)*, 2(3):4, 2019. +Jiachen T Wang and Ruoxi Jia. Data banzhaf: A robust data valuation framework for machine learning. In International Conference on Artificial Intelligence and Statistics, pp. 6388-6421. PMLR, 2023. +Luzhi Wang, Dongxiao He, He Zhang, Yixin Liu, Wenjie Wang, Shirui Pan, Di Jin, and Tat-Seng Chua. Goodat: Towards test-time graph out-of-distribution detection. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 38, pp. 15537-15545, 2024. +Tianhao Wang, Yu Yang, and Ruoxi Jia. Improving cooperative game theory-based data valuation via data utility learning. arXiv preprint arXiv:2107.06336, 2021. +Yang Wang, Jin Zheng, Yuqi Du, Cheng Huang, and Ping Li. Traffic-ggnn: predicting traffic flow via attentional spatial-temporal gated graph neural networks. IEEE Transactions on Intelligent Transportation Systems, 23(10):18423-18432, 2022. +Felix Wu, Amauri Souza, Tianyi Zhang, Christopher Fifty, Tao Yu, and Kilian Weinberger. Simplifying graph convolutional networks. In ICML. PMLR, 2019. + +Zhenxing Wu, Jike Wang, Hongyan Du, Dejun Jiang, Yu Kang, Dan Li, Peichen Pan, Yafeng Deng, Dongsheng Cao, Chang-Yu Hsieh, et al. Chemistry-intuitive explanation of graph neural networks for molecular property prediction with substructure masking. Nature Communications, 14(1):2585, 2023. +Jun Xia, Lirong Wu, Ge Wang, and Stan Z. Li. Progcl: Rethinking hard negative mining in graph contrastive learning. In International conference on machine learning. PMLR, 2022. +Keyulu Xu, Weihua Hu, Jure Leskovec, and Stefanie Jegelka. How powerful are graph neural networks? arXiv preprint arXiv:1810.00826, 2018. +Yishi Xu, Yingxue Zhang, Wei Guo, Huifeng Guo, Ruiming Tang, and Mark Coates. Graphsail: Graph structure aware incremental learning for recommender systems. In Proceedings of the 29th ACM International CIKM, 2020. +Chenxiao Yang, Qitian Wu, Jiahua Wang, and Junchi Yan. Graph neural networks are inherently good generalizers: Insights by bridging GNNs and MLPs. In The Eleventh International Conference on Learning Representations, 2023. URL https://openreview.net/forum?id=dqnNW2omZL6. +Yaodong Yu, Zitong Yang, Alexander Wei, Yi Ma, and Jacob Steinhardt. Predicting out-of-distribution error with the projection norm. In International Conference on Machine Learning, pp. 25721-25746. PMLR, 2022. +Wentao Zhang, Yu Shen, Yang Li, Lei Chen, Zhi Yang, and Bin Cui. Alg: Fast and accurate active learning framework for graph convolutional networks. In Proceedings of the 2021 international conference on management of data, pp. 2366-2374, 2021a. +Wentao Zhang, Yexin Wang, Zhenbang You, Meng Cao, Ping Huang, Jiulong Shan, Zhi Yang, and Bin Cui. Rim: Reliable influence-based active learning on graphs. Advances in neural information processing systems, 34:27978-27990, 2021b. +Wentao Zhang, Zhi Yang, Yexin Wang, Yu Shen, Yang Li, Liang Wang, and Bin Cui. Grain: Improving data efficiency of graph neural networks via diversified influence maximization. arXiv preprint arXiv:2108.00219, 2021c. +Yifei Zhang, Hao Zhu, Zixing Song, Piotr Koniusz, and Irwin King. Costa: covariance-preserving feature augmentation for graph contrastive learning. In Proceedings of the 28th ACM SIGKDD Conference on Knowledge Discovery and Data Mining, pp. 2524-2534, 2022. +Yifei Zhang, Hao Zhu, Zixing Song, Piotr Koniusz, and Irwin King. Spectral feature augmentation for graph contrastive learning and beyond. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 37, pp. 11289-11297, 2023. +Han Zhao, Xu Yang, Zhenru Wang, Erkun Yang, and Cheng Deng. Graph debiased contrastive learning with joint representation clustering. In Proc. IJCAI, pp. 3434-3440, 2021. +Xin Zheng, Dongjin Song, Qingsong Wen, Bo Du, and Shirui Pan. Online gnn evaluation under test-time graph distribution shifts. arXiv preprint arXiv:2403.09953, 2024a. +Xin Zheng, Miao Zhang, Chunyang Chen, Soheila Molaei, Chuan Zhou, and Shirui Pan. Gnnevaluator: Evaluating gnn performance on unseen graphs without labels. Advances in Neural Information Processing Systems, 36, 2024b. +Jiong Zhu, Yujun Yan, Lingxiao Zhao, Mark Heimann, Leman Akoglu, and Danai Koutra. Beyond homophily in graph neural networks: Current limitations and effective designs. Advances in neural information processing systems, 33:7793-7804, 2020a. +Xiaojin Zhu and Zoubin Ghahramani. Learning from labeled and unlabeled data with label propagation. 2002. +Yanqiao Zhu, Yichen Xu, Feng Yu, Qiang Liu, Shu Wu, and Liang Wang. Deep graph contrastive representation learning. arXiv preprint arXiv:2006.04131, 2020b. + +# A SELECTED FEATURES FOR ACCURACY PREDICTION + +When performing Graph Inference Data Valuation, we incrementally add neighboring nodes to the target test nodes following permissible permutations. This process generates a series of test subgraphs. Let $\mathcal{G}_{\mathrm{sub}} = (\mathcal{V}_{\mathrm{sub}},\mathcal{E}_{\mathrm{sub}},\mathbf{X}_{\mathrm{sub}})$ denote the current sub-test graph, which includes the added neighboring nodes and target test nodes. Our goal is to identify features that reflect the performance of the fixed GNN model on $\mathcal{G}_{\mathrm{sub}}$ without relying on true labels. To this end, we propose a set of data-specific and model-specific features that correlate with GNN performance. These features are designed to capture both the structural properties of the graph and the behavior of the GNN model on the test nodes. + +Data-specific features: Our data-specific features focus on graph homophily and distance measures: + +1. Edge Cosine Similarity $(\bar{s}_e)$ : This feature measures the homophily level of the current subgraph. For graph neural networks, it is recognized that performance is strongly correlated with the graph's homophily level, where connected nodes tend to share similar characteristics (Zhu et al., 2020a; Li et al., 2024). A higher homophily level often leads to better GNN performance. + +$$ +\bar {s} _ {e} = \frac {1}{| \mathcal {E} _ {\mathrm {s u b}} |} \sum_ {(i, j) \in \mathcal {E} _ {\mathrm {s u b}}} \cos (\mathbf {x} _ {i}, \mathbf {x} _ {j}) +$$ + +where $\mathbf{x}_i$ and $\mathbf{x}_j$ are the feature vectors of nodes $i$ and $j$ , respectively, and $\mathcal{E}$ sub is the set of edges in the current subgraph. This measure accurately captures the average cosine similarity between connected nodes, reflecting the homophily of the subgraph structure. + +2. Representation Distance $(d_{\mathrm{rep}})$ : This feature quantifies the overall dissimilarity between test nodes and the training set, which has been shown to be related to GNN performance (Ma et al., 2021). A smaller feature distance typically indicates that the test nodes are more similar to the training data, which often correlates with better GNN performance on these test nodes. + +$$ +d _ {\mathrm {r e p}} = \frac {1}{| \mathcal {V} _ {t} |} \sum_ {v \in \mathcal {V} _ {t}} \cos \left(\mathbf {h} _ {v}, \bar {\mathbf {h}} _ {\text {t r a i n}}\right) +$$ + +where $\mathbf{h}_v$ is the aggregated feature vector of the target test node $v$ , and $\bar{\mathbf{h}}_{\mathrm{train}}$ is the mean aggregated feature vector of all training nodes. + +3. Classwise Representation Distance ( $d_{\mathrm{class}}$ ): This feature provides a more fine-grained measure of the distance between test nodes and training data, by considering class-specific prototypes. It captures how well the test nodes align with the class representations learned from the training data. + +$$ +d _ {\text {c l a s s}} = \frac {1}{| \mathcal {V} _ {t} |} \sum_ {v \in \mathcal {V} _ {t}} \min _ {c \in \mathcal {C}} \cos \left(\mathbf {h} _ {v}, \bar {\mathbf {h}} _ {c}\right) +$$ + +where $\mathcal{C}$ is the set of classes, $\bar{\mathbf{h}}_c$ is the mean aggregated feature vector of training nodes in class $c$ , and $\mathcal{V}_t$ is the set of target test nodes. This feature complements the overall representation distance by providing class-specific information, which can be particularly useful in multi-class classification tasks. + +Model-specific features: Our model-specific features leverage the output of the fixed GNN model $f(\cdot)$ to compute confidence scores and uncertainty measures: + +4. Maximum Predicted Confidence ( $c_{\mathrm{max}}$ ): The confidence of model predictions has been shown to be strongly correlated with model accuracy (Guo et al., 2017; Guillory et al., 2021; Garg et al., 2022). This feature captures the average maximum confidence score for target test nodes when the current subgraph is input to the fixed GNN model. + +$$ +c _ {\max } = \frac {1}{| \mathcal {V} _ {t} |} \sum_ {v \in \mathcal {V} _ {t}} \max _ {y \in \mathcal {Y}} f _ {y} (\mathcal {G} _ {\mathrm {s u b}}) _ {v} +$$ + +5. Target Class Confidence ( $c_{\text{target}}$ ): To mitigate the impact of changing predictions as we add nodes to the test subgraph, we fix the predicted label for each node based on the full test graph. This feature represents the average confidence score of these fixed predicted classes for the target test nodes. + +$$ +c _ {\text {t a r g e t}} = \frac {1}{| \mathcal {V} _ {t} |} \sum_ {v \in \mathcal {V} _ {t}} f _ {\hat {y} _ {v}} \left(\mathcal {G} _ {\text {s u b}}\right) _ {v} +$$ + +where $\hat{y}_v = \arg \max_{y\in \mathcal{Y}}f_y(\mathcal{G}_{\mathrm{Te}})_v$ is the predicted class for node $v$ using the full test graph $\mathcal{G}_{\mathrm{Te}}$ . + +6. Propagated Maximum Confidence ( $c_{\text{prop\_max}}$ ): Label propagation (Zhu & Ghahramani, 2002) has proven effective in graph-based classification tasks. We first predict a distribution for each node in the current subgraph using only their features, then propagate these distributions over the graph structure. + +$$ +c _ {\mathrm {p r o p} \_ \mathrm {m a x}} = \frac {1}{| \mathcal {V} _ {t} |} \sum_ {v \in \mathcal {V} _ {t}} \max _ {y \in \mathcal {Y}} \tilde {f} _ {y} (\mathcal {G} _ {\mathrm {s u b}}) _ {v} +$$ + +where $\tilde{f}_y(\mathcal{G}_{\mathrm{sub}})_v = \mathrm{LP}(f_y(\mathcal{G}_{\mathrm{sub}}^\emptyset))_v, \mathcal{G}_{\mathrm{sub}}^\emptyset = (\mathcal{V}_{\mathrm{sub}}, \emptyset, \mathbf{X}_{\mathrm{sub}})$ is the subgraph with empty edge set, $f_y(\mathcal{G}_{\mathrm{sub}}^\emptyset)_v$ is the initial prediction for node $v$ using only its features, and $\mathrm{LP}(\cdot)$ denotes the label propagation operation on $\mathcal{G}_{\mathrm{sub}}$ . + +7. Propagated Target Confidence ( $c_{\text{prop\_target}}$ ): This feature captures the average confidence of the fixed predicted class after label propagation, using the same process as in Propagated Maximum Confidence. + +$$ +c _ {\text {p r o p _ t a r g e t}} = \frac {1}{| \mathcal {V} _ {t} |} \sum_ {v \in \mathcal {V} _ {t}} \tilde {f} _ {\hat {y} _ {v}} (\mathcal {G} _ {\text {s u b}}) _ {v} +$$ + +where $\hat{y}_v$ is the predicted class for node $v$ using the full test graph, as defined earlier, and $\tilde{f}_{\hat{y}_v}(\mathcal{G}_{\mathrm{sub}})_v$ is the propagated probability for class $\hat{y}_v$ of node $v$ . + +8. Negative Entropy $(H_{\mathrm{neg}})$ : Recent research has shown that negative entropy effectively measures uncertainty in machine learning models and is highly correlated with accuracy (Sensoy et al., 2018; Garg et al., 2022). Higher negative entropy indicates more certain predictions. + +$$ +H _ {\text {n e g}} = - \frac {1}{| \mathcal {V} _ {t} |} \sum_ {v \in \mathcal {V} _ {t}} \sum_ {y \in \mathcal {Y}} f _ {y} (\mathcal {G} _ {\text {s u b}}) _ {v} \log f _ {y} (\mathcal {G} _ {\text {s u b}}) _ {v} +$$ + +9. Confidence Gap $(\Delta c)$ : This feature measures the average difference between the highest and second-highest confidence scores for the target test nodes. It can be viewed as another uncertainty measure, where a larger confidence gap suggests more certain predictions and potentially higher accuracy. + +$$ +\Delta c = \frac {1}{| \mathcal {V} _ {t} |} \sum_ {v \in \mathcal {V} _ {t}} \left(\max _ {y \in \mathcal {Y}} f _ {y} (\mathcal {G} _ {\mathrm {s u b}}) _ {v} - \max _ {y ^ {\prime} \in \mathcal {Y} \backslash \{\hat {y} _ {v} \}} f _ {y ^ {\prime}} (\mathcal {G} _ {\mathrm {s u b}}) _ {v}\right) +$$ + +where $\hat{y}_v = \arg \max_{y\in \mathcal{Y}}f_y(\mathcal{G}_{\mathrm{sub}})_v$ is the predicted class for node $v$ . + +These model-specific features, combined with the previously described data-specific features, provide a comprehensive representation of the GNN's performance on the sub-test graph $\mathcal{G}_{\mathrm{sub}}$ without relying on true labels. By capturing various aspects of model confidence and uncertainty, these features serve as effective proxies for model accuracy in our utility learning framework. + +# B SGUL-ACCURACY AND BASELINE MODEL TRAINING PROCESS + +Our proposed transferable feature extraction method SGUL-Accuracy addresses the challenge of lacking test labels by providing a set of proxy features that capture both graph structure and model behavior. To implement this approach in the context of utility learning for graph inference data valuation, we follow a general procedure: + +1. Generate permutations: We create a set of permutations on the validation graph $\mathcal{G}_{\mathrm{Val}}$ following the structure-aware Shapley value formulation (Equation (1)). Each permutation results in a series of subgraphs as neighboring nodes are incrementally added. +2. Extract features: For each subgraph, we apply our feature extractor $g(S)$ to obtain the transferable, performance-related features $\mathbf{x} \in \mathbb{R}^d$ . +3. Obtain ground truth utilities: We input these validation subgraphs into the fixed GNN model $f(\cdot)$ to obtain ground truth accuracy scores. These scores serve as the target values for our utility learning method. +4. Learn utility function: Traditional approaches typically use the feature-utility pairs obtained from steps 2 and 3 to train a model that minimizes the difference between predicted and true utility values (or accuracies). This is often formulated as a regression problem: + +$$ +\min _ {\theta} \sum_ {S} (U (S) - h _ {\theta} (g (S))) ^ {2} +$$ + +where $U(S)$ is the ground truth utility (accuracy) for subgraph $S$ , $g(S)$ is our feature extractor, and $h_{\theta}$ is a learnable function parameterized by $\theta$ . + +This procedure allows us to create a dataset of feature-utility pairs, which can be used to learn a utility function that generalizes to unseen test structures. It's worth noting that this general framework can accommodate various transferable feature extraction methods. While we have proposed a specific design for our feature extractor $g(S)$ , other approaches could potentially be integrated into this framework, as long as they produce transferable, performance-related features $\mathbf{x} \in \mathbb{R}^d$ . + +Interestingly, this training procedure can be identically applied to label-free model evaluation methods (Garg et al., 2022; Guillory et al., 2021; Zheng et al., 2024b) which serve as baselines in our experimental part. These methods aim to assess model performance on unlabeled data by leveraging various proxy metrics or transferable features. The key difference lies in the ultimate goal: while label-free model evaluation methods focus on estimating overall model performance, our approach extends this concept to the more granular task of valuing individual graph elements for inference. + +# C PROOF OF SHAPLEY VALUE DECOMPOSITION THEOREM + +Here we provide the proof for the Shapley Value Decomposition Theorem stated in Section 4.2.3. + +Theorem 2 (Shapley Value Decomposition). Given a linear utility function $U(S) = \mathbf{w}^{\top}\mathbf{x}(S)$ , where $\mathbf{w} \in \mathbb{R}^{d}$ is a parameter vector and $\mathbf{x}(S) \in \mathbb{R}^{d}$ is a feature vector representing subset $S$ , the Shapley value of player $i$ with respect to $U$ can be expressed as a linear combination of Feature Shapley Values: + +$$ +\boldsymbol {\phi} _ {i} (U) = \mathbf {w} ^ {\top} \boldsymbol {\psi} _ {i} +$$ + +where $\psi_{i} = [\phi_{i}(U_{1}),\phi_{i}(U_{2}),\dots,\phi_{i}(U_{d})]^{\top}$ is the vector of Feature Shapley Values, and $U_{k}(S) = x_{k}(S)$ is the utility function considering only the $k$ -th feature. + +Proof. We begin by recalling the definition of the Shapley value for a player $i$ with respect to a utility function $U$ : + +$$ +\phi_ {i} (U) = \sum_ {S \subseteq \mathcal {N} \setminus \{i \}} \frac {| S | ! (n - | S | - 1) !}{n !} [ U (S \cup \{i \}) - U (S) ] +$$ + +where $\mathcal{N}$ is the set of all players and $n = |\mathcal{N}|$ . + +Given the linear utility function $U(S) = \mathbf{w}^{\top}\mathbf{x}(S)$ , we can substitute this into the Shapley value definition: + +$$ +\begin{array}{l} \phi_ {i} (U) = \sum_ {S \subseteq \mathcal {N} \setminus \{i \}} \frac {| S | ! (n - | S | - 1) !}{n !} [ \mathbf {w} ^ {\top} \mathbf {x} (S \cup \{i \}) - \mathbf {w} ^ {\top} \mathbf {x} (S) ] \\ = \sum_ {S \subseteq \mathcal {N} \backslash \{i \}} \frac {| S | ! (n - | S | - 1) !}{n !} \mathbf {w} ^ {\top} [ \mathbf {x} (S \cup \{i \}) - \mathbf {x} (S) ] \\ = \mathbf {w} ^ {\top} \sum_ {S \subseteq \mathcal {N} \backslash \{i \}} \frac {| S | ! (n - | S | - 1) !}{n !} [ \mathbf {x} (S \cup \{i \}) - \mathbf {x} (S) ] \\ \end{array} +$$ + +Now, let's consider the $k$ -th component of the feature vector $\mathbf{x}(S)$ , which we denote as $x_{k}(S)$ . We can define a utility function $U_{k}(S) = x_{k}(S)$ that considers only this $k$ -th feature. The Shapley value for player $i$ with respect to $U_{k}$ is: + +$$ +\phi_ {i} (U _ {k}) = \sum_ {S \subseteq \mathcal {N} \backslash \{i \}} \frac {| S | ! (n - | S | - 1) !}{n !} [ x _ {k} (S \cup \{i \}) - x _ {k} (S) ] +$$ + +Comparing this with the last line of our previous derivation, we can see that: + +$$ +\phi_ {i} (U) = \mathbf {w} ^ {\top} [ \phi_ {i} (U _ {1}), \phi_ {i} (U _ {2}), \ldots , \phi_ {i} (U _ {d}) ] ^ {\top} = \mathbf {w} ^ {\top} \psi_ {i} +$$ + +where $\pmb{\psi}_i = [\phi_i(U_1),\phi_i(U_2),\dots,\phi_i(U_d)]^\top$ is the vector of Feature Shapley Values. + +This completes the proof of the Shapley Value Decomposition Theorem. + +![](images/acf51e1c1833bafae4b42040e3bb97b1d1e5d92c62e2bb442ecc810034e59b75.jpg) + +This theorem demonstrates that for a linear utility function, the Shapley value can be decomposed into a linear combination of Feature Shapley Values derived from Appendix A. This decomposition forms the theoretical foundation for our Shapley-Guided Generalizable Utility Learning (SGUL) method, allowing us to efficiently learn utility function parameters by optimizing for Shapley values directly. + +# D EXTENDED RELATED WORK + +# D.1 DATA-EFFICIENT LEARNING ON GRAPHS + +Data-efficient learning on graphs primarily uses two approaches to address limited labeled data. Graph self-supervised learning develops representations without labels, where contrastive learning methods like Deep Graph Infomax (Velickovic et al., 2019) and GRACE (Zhu et al., 2020b) contrast different graph views, while non-contrastive methods such as BGRL (Thakoor et al., 2021) and Graph Barlow Twins (Bielak et al., 2022) achieve strong performance without negative samples. Recent works address sampling bias (Zhao et al., 2021; Xia et al., 2022) and develop feature augmentation techniques Zhang et al. (2022; 2023). Chi & Ma (2024) enhance contrastive learning through node similarity while Ma et al. (Ma et al., 2024) establish comprehensive benchmarks for evaluation. Meanwhile, graph active learning optimizes node selection for labeling, with methods like AGE (Cai et al., 2017) combining multiple selection metrics, GPA (Hu et al., 2020a) using sequential decision-making, and GRAIN (Zhang et al., 2021c)/RIM (Zhang et al., 2021b) reformulating selection as influence maximization. Advanced techniques include LSCALE (Liu et al., 2022) exploiting labeled and unlabeled representations, ALG (Zhang et al., 2021a) considering both representativeness and informativeness, and GALclean (Chi et al., 2024b) addressing active learning for graphs with noisy structures. Recent works have also explored uncertainty quantification on graphs, with JuryGCN (Kang et al., 2022) providing deterministic uncertainty estimates through jackknife confidence intervals and Fuchsgruber et al. (2024) establishing principled approaches to uncertainty sampling for active learning on graphs. Another promising direction is graph condensation, which aims to distill large graphs into smaller synthetic versions that preserve training performance. Jin et al. (2021) introduce this problem by matching GNN training trajectories through gradient matching, while their follow-up work (Jin et al., 2022a) accelerates the process with one-step gradient matching. Recent advances by Gong et al. (Gong et al., 2025) address scalability challenges for evolving graph data through class-wise + +clustering on aggregated features, achieving significant speedups while maintaining comparable performance. These data-efficient approaches complement graph inference data valuation, extending efficiency principles from training to the test-time inference phase. + +# D.2 GRAPH TRAINING DATA VALUATION + +While Data Shapley and subsequent methods (Ghorbani & Zou, 2019; Kwon & Zou, 2021; Wang & Jia, 2023) have been effective for i.i.d. data, they face significant challenges when applied to graph-structured data. A key challenge is capturing the hierarchical and dependent relationships among graph elements. In Graph Neural Networks (GNNs), a node's contribution to model performance is intricately linked to its position within the computation tree and its relationships with other nodes. Traditional Shapley value calculations, which treat all players (nodes) independently, fail to account for these crucial dependencies, potentially leading to inaccurate valuations. + +To address these challenges, Chi et al. (2024a) proposed a more granular approach to graph data valuation. This approach considers individual nodes within the computation tree as the basic units for valuation, allowing for a more nuanced assessment of each element's contribution to GNN performance. Building upon the Shapley value formulation, this method introduces two key constraints to the set of permutations $\Pi(D)$ : + +Level Constraint: This constraint ensures that nodes within the same subtree of the computation graph are grouped together in the permutation. Formally, for a node $v$ in the computation tree and its descendants $\mathcal{D}(v)$ , the constraint can be expressed as: + +$$ +\left| \pi [ i ] - \pi [ j ] \right| \leq \left| \mathcal {D} (v) \right|, \quad \forall i, j \in \mathcal {D} (v) \cup \{v \} +$$ + +where $\pi [i]$ denotes the position of node $i$ in permutation $\pi$ . This preserves the hierarchical structure of the computational graph and prevents evaluation bias that could occur when players from the same group are placed at widely separated positions in the permutation. + +Precedence Constraint: This constraint guarantees that a node appears in the permutation only after its ancestors. For a node $v$ and its ancestor set $\mathcal{A}(v)$ , the constraint can be formulated as: + +$$ +\pi [ a ] < \pi [ v ], \quad \forall a \in \mathcal {A} (v) +$$ + +This reflects the dependency structure in GNNs, where a node's contribution is contingent on the presence of its ancestors in the computation tree. + +These constraints allow for a more accurate valuation of graph data by respecting the inherent structure and dependencies within GNNs. + +# D.2.1 DISCUSSION ON THE DIFFERENCE BETWEEN PC-WINTER AND SGUL + +While PC-Winter pioneered the exploration of graph data valuation by introducing constraints to capture hierarchical dependencies, our work focuses specifically on the challenging scenario of test-time graph inference valuation, where ground truth labels are unavailable. Specifically, PC-Winter addresses training data valuation by defining hierarchical elements within computation trees as the data valuation objects (players), applying both Level and Precedence Constraints to capture structural dependencies. In contrast, our work (Section 4.2.3) focuses on quantifying the importance of neighbors for test nodes during inference time. We adopt the Precedence Constraint from PC-Winter while omitting the Level Constraint, as explained in Section 3.2. This design choice reflects the distinct nature of test-time neighbor relationships, which lack the clear hierarchical groupings present in training data computation trees. The Precedence Constraint proves valuable in capturing the dependencies between nodes in the message-passing process during inference. + +A key technical distinction lies in our approach to utility function design. While PC-Winter leverages validation accuracy as their utility measure, the absence of test labels in our setting necessitates a novel solution. As detailed in Section 4, we introduce transferable data-specific and model-specific features that can effectively approximate model performance without ground truth labels. This innovation enables the evaluation of neighbor importance during inference time. + +Our work complements PC-Winter by extending graph data valuation to test-time scenarios, particularly crucial for applications like real-time recommendation systems and dynamic graphs where + +Table 2: Comparison between PC-Winter and our Structure-aware Shapley Value with SGUL + +
AspectPC-WinterStructure-aware Shapley with SGUL
Valuation TargetTraining graph elementsTest-time neighbors
Constraints UsedLevel and Precedence ConstraintsPrecedence only
Primary ChallengeHierarchical dependenciesNo test labels
Utility FunctionValidation accuracyLearned test accuracy
+ +test-time structure evaluation is essential. Table 2 highlights the key differences between our work and PC-Winter: + +In our experimental analysis, we further demonstrate the effectiveness of our approach in identifying influential test-time graph structures. Through comprehensive node-dropping experiments (Section 6), we show that our method consistently outperforms baselines in terms of Area Under the Curve (AUC) scores and accuracy curve characteristics across various datasets and model architectures. These results validate the practical value of our test-time graph inference valuation framework, complementing the contributions of PC-Winter in the training data valuation setting. + +# D.3 LABEL FREE MODEL EVALUATION BASELINES + +In this section, we provide detailed descriptions of the baselines used for comparison in our study. These baselines represent state-of-the-art methods for label-free model evaluation, which is crucial for assessing model performance on unseen data without access to ground truth labels. The baselines we consider are: + +# D.3.1 AVERAGE THRESHOLDED CONFIDENCE (ATC) + +ATC, introduced by Garg et al. (2022), estimates accuracy by learning a threshold on the model's confidence scores. We implement two variants: + +(a) ATC-MC (Maximum Confidence): + +$$ +\mathrm {A T C - M C} = \frac {1}{| \mathcal {V} _ {\text {t e s t}} |} \sum_ {v \in \mathcal {V} _ {\text {t e s t}}} \mathbb {I} \left[ \max _ {c \in \mathcal {C}} f _ {\theta} (G _ {\text {t e s t}}) _ {v, c} > t \right] +$$ + +This equation counts the fraction of test nodes where the maximum confidence exceeds a threshold $t$ . Here, $f_{\theta}(G_{\mathrm{test}})_{v,c}$ is the confidence score for class $c$ on test node $v$ , and $t$ is determined using the validation set. + +(b) ATC-NE (Negative Entropy): + +$$ +\mathrm {A T C - N E} = \frac {1}{| \mathcal {V} _ {\text {t e s t}} |} \sum_ {v \in \mathcal {V} _ {\text {t e s t}}} \mathbb {I} \left[ - \sum_ {c \in \mathcal {C}} f _ {\theta} (G _ {\text {t e s t}}) _ {v, c} \log f _ {\theta} (G _ {\text {t e s t}}) _ {v, c} > t \right] +$$ + +This variant uses negative entropy of predicted probabilities as the confidence measure, counting nodes where it exceeds the threshold. + +# D.3.2 DIFFERENCE OF CONFIDENCE (DOC) + +DoC, proposed by Guillory et al. (2021), measures the difference in average confidence between the validation and test sets to predict accuracy change: + +$$ +\operatorname {D o C} = \operatorname {A c c} (f, \mathcal {G} _ {\text {V a l}}) + \beta \cdot (\bar {c} _ {\text {T e}} - \bar {c} _ {\text {V a l}}) +$$ + +where $\bar{c}_{\mathrm{Val}} = \frac{1}{|\mathcal{V}_{\mathrm{Val}}|}\sum_{v\in \mathcal{V}_{\mathrm{Val}}}\max_{c\in \mathcal{C}}f(v)_c$ and $\bar{c}_{\mathrm{Te}} = \frac{1}{|\mathcal{V}_{\mathrm{Te}}|}\sum_{v\in \mathcal{V}_{\mathrm{Te}}}\max_{c\in \mathcal{C}}f(v)_c$ are the average maximum confidences on validation and test sets respectively, $\operatorname {Acc}(f,\mathcal{G}_{\mathrm{Val}})$ is the accuracy on the validation graph, and $\beta$ is learned through linear regression on the validation set. + +# D.3.3 GNNEVALUATOR + +GNNEvaluator, introduced by Zheng et al. (2024b), is designed to assess GNN performance on unseen graphs without labels. It employs a two-stage approach: + +1. It constructs a DiscGraph set, leveraging validation subgraphs from sample permutations as metagrams. For each meta-graph, it computes discrepancy attributes by comparing GNN embeddings and predictions between the meta-graph and original training graph. +2. A two-layer GCN regressor is trained on the DiscGraph set to estimate node classification accuracy. The regressor learns to map the discrepancy attributes to expected model performance. + +For inference, GNNEvaluator computes discrepancy attributes for the unseen test graph using the fixed pre-trained GNN, then applies the trained regressor to estimate accuracy without requiring labels. + +# D.3.4 NATURAL CONFIDENCE-BASED BASELINES + +We also include two straightforward confidence-based baselines: + +(a) Maximum Confidence: This uses the highest confidence score across all nodes and classes in the subgraph. +(b) Class Confidence: This calculates the average confidence score of the predicted class for each test node, using the full test graph as input. + +We ensure a fair comparison by using the same overall framework for all methods, including identical sampling procedures for validation and test permutations. + +# D.4 BASELINE METHODS AND THEIR DISTINCTIONS TO SGUL + +Recent advances in label-free model evaluation have produced several notable approaches. Average Thresholded Confidence (ATC) (Garg et al., 2022) estimates model accuracy by learning appropriate thresholds on confidence scores. The method operates by computing the fraction of examples where model confidence exceeds a learned threshold, with variants utilizing either maximum confidence (ATC-MC) or negative entropy (ATC-NE) as the underlying metric. Difference of Confidence (DoC) (Guillory et al., 2021) takes a comparative approach, measuring the discrepancy in average confidence between validation and test sets to predict accuracy changes. This method leverages the observation that shifts in model confidence often correlate with performance degradation. GNNEvaluator (Zheng et al., 2024b) introduces a more sophisticated framework specifically designed for graph neural networks, employing a two-stage approach that first constructs a DiscGraph set to capture distribution discrepancies and then trains a GCN regressor to estimate node classification accuracy without requiring labels. + +While these methods represent significant advances in label-free model evaluation area, they fundamentally differ from our graph inference data valuation framework in both objectives and operational mechanisms. The primary distinction lies in the granularity and scope of evaluation. Traditional label-free methods focus on estimating overall model performance on a fixed test graph, essentially treating the evaluation as a single-point estimation problem. In contrast, SGUL performs fine-grained analysis by evaluating numerous subgraph configurations to quantify each structural component contribution to model performance. This decomposition-based approach enables us to understand not just how well a model performs, but also which graph structures are crucial for that performance. The computational demands of our approach also create unique challenges - while methods like GNNEvaluator work well for one-time evaluation, they become computationally prohibitive when applied to the many subgraph permutations required for Shapley value computation, often encountering memory limitations on medium-sized datasets. Our SGUL framework addresses these challenges through specialized optimization techniques and efficient feature extraction methods that enable scalable evaluation across multiple subgraph configurations. Furthermore, the architecture of existing methods is not optimized for repeated utility assessment across permutations, as they were designed for single-pass evaluation rather than the iterative valuation process required for computing structure-aware Shapley values. Through our experimental validation, we demonstrate that SGUL not only provides more detailed structural insights but also achieves superior accuracy in estimating the + +importance of individual graph components, outperforming these adapted baseline methods in the specific context of graph inference data valuation. + +# D.5 RETRAINING-BASED LABEL-FREE MODEL EVALUATION METHODS + +Notably, recent label-free model evaluation researches for predicting model test performance have explored retraining-based approaches, which offer novel perspectives but face limitations in our graph inference data valuation context. Projection Norm (Yu et al., 2022) predicts out-of-distribution performance by analyzing model parameter changes after retraining with pseudo-labels generated from test samples. The method demonstrates strong theoretical guarantees for linear models by measuring the distance between original and retrained model parameters as an indicator of distribution shift. Simultaneously, LEBED (Zheng et al., 2024a) approaches test-time graph distribution shifts by quantifying discrepancies in learning behaviors between training and test graphs through a GNN retraining strategy with parameter-free optimality criteria that capture both node prediction and structure reconstruction aspects. + +While these methods present innovative solutions for general test accuracy prediction, they encounter fundamental constraints in our graph inference data valuation framework. The primary challenge stems from our need to evaluate $|\Omega(N(V_t))| \times |N(V_t)|$ different subgraphs for computing structure-aware Shapley values. Each subgraph configuration would demand a separate retraining process under these approaches, rendering them computationally infeasible at scale. Moreover, methods like LEBED require access to the original training graph for comparative analysis - an assumption that may not hold in practical deployment scenarios where training data access is restricted due to privacy concerns. These inherent limitations motivate our adoption of more computationally efficient approaches that can evaluate subgraph utilities without model retraining, as detailed in Section D.3. + +# D.6 TEST-TIME TRAINING AND AUGMENTATION METHODS + +Recent works have explored various test-time adaptation techniques for graph neural networks to address distribution shifts and OOD generalization. These methods can be broadly categorized based on their core mechanisms and objectives: GTRANS (Jin et al., 2022b) takes a data-centric approach by performing test-time graph transformation through unsupervised feature and structure augmentation. While also focusing on data adaptation, GTRANS aims to find a single optimal modified test graph that maximizes model performance, rather than evaluating the importance of individual elements. This fundamentally differs from our objective of quantifying each node's marginal contribution through structure-aware Shapley values. GOODAT (Wang et al., 2024) addresses test-time graph OOD detection as a binary classification problem by determining whether subgraphs align with the training distribution. The method employs a graph masker to compress informative subgraphs for distinguishing ID and OOD samples. However, GOODAT focuses solely on detecting OOD graphs without considering the contributions of individual nodes to model performance. IGT3 (Pi et al.) proposes a two-stage training paradigm that combines test-time training with invariant graph learning to improve OOD generalization. The method adapts model parameters through multi-level graph contrastive learning while preserving graph structure information. In contrast to our data-centric valuation framework, IGT3 modifies the model itself to adapt to distribution shifts. + +While these methods present innovative solutions for improving test-time performance and OOD generalization, they differ fundamentally from our graph inference data valuation framework in both objectives and mechanisms. Our framework maintains fixed model parameters while systematically evaluating the contribution of individual nodes, enabling flexible value-based data selection for various downstream applications from performance maximization to denoising. This generality and composability of data values distinguish our approach from methods focused solely on improving overall model performance through data or model adaptation. + +# E DETAILED DATASETS AND EXPERIMENTAL SETUP + +# E.1 DATASETS + +To evaluate the effectiveness of our proposed Shapley-Guided Utility Learning (SGUL) framework, we conducted extensive experiments on seven diverse real-world graph datasets. These datasets + +include Cora, Citeseer, Pubmed (Sen et al., 2008), Coauthor-CS, Coauthor-Physics (Shchur et al., 2018), Roman-empire, and Amazon-ratings (Platonov et al., 2023). Our dataset provides excellent coverage of both homophily and heterophily in graphs. The first four datasets are characterized by homophily, where connected nodes tend to share similar features or labels. In contrast, Roman-empire and Amazon-ratings exhibit heterophily, presenting a more challenging scenario where connected nodes often have different characteristics. + +# E.2 EXPERIMENTAL SETUP + +Our experiments primarily focus on the inductive node classification task, which more closely resembles real-world applications where models must generalize to unseen graph structures (Hamilton et al., 2017; Van Belle et al., 2022). In this setting, we partition each dataset into three distinct graph structures: Training Graph, Validation Graph, and Testing Graph. + +To provide a comprehensive evaluation, we also extend our experiments to the transductive setting, where the entire graph structure is known during training, but only a subset of training and validation nodes has labeled data. This allows us to compare the performance of our method across different learning paradigms. + +To better highlight the importance of testing structures, we employ different fixed GNN models for inductive and transductive settings: + +- Inductive Setting: We utilize Parameterized MLPs (PMLPs) (Yang et al., 2023), which train as standard MLPs but adopt GNN-like message passing during inference. This approach emphasizes the crucial role of testing-time graph structures in model performance. During inference, PMLPs employ either Simplified Graph Convolutions (SGCs) or Graph Convolutional Networks (GCNs) (Kipf & Welling, 2016) (Wu et al., 2019) for message passing, allowing us to evaluate the impact of different aggregation schemes on our graph inference data valuation task. +- Transductive Setting: We use full Graph Neural Network (GNN) models, specifically GCNs and SGCs, leveraging the complete graph structure available during both training and inference. This setting allows us to assess our method's performance when the entire graph topology is known and utilized throughout the learning process. + +# F GCN MODEL INDUCTIVE SETTING RESULTS + +In addition to the SGC model results presented in the main text, we also conducted experiments using Graph Convolutional Network (GCN) models. Figure 2 shows the accuracy curves for node dropping experiments using GCN models across various datasets. The results for GCN models closely mirror those observed for SGC models. SGUL consistently outperforms other methods across various datasets, demonstrating both a steeper initial accuracy drop and better long-term stability. This consistency across different GNN architectures further validates the robustness and wide applicability of our Shapley-Guided Utility Learning framework in graph inference data valuation tasks. + +# G TRANSDUCTIVE SETTING RESULT ANALYSIS + +To provide a comprehensive evaluation of our SGUL framework, we extended our experiments to the transductive setting using the Cora, Citeseer, and Pubmed datasets. In this setting, the entire graph structure is known during both training and inference, allowing us to assess our method's performance when the full graph topology is utilized throughout the learning process. + +# G.1 EXPERIMENTAL SETUP + +For the transductive setting, we used full Graph Neural Network (GNN) models, specifically Graph Convolutional Networks (GCNs) and Simplified Graph Convolutions (SGCs). These models leverage the complete graph structure available during both training and inference. + +![](images/c8da4fbff615fd5dbe919fa7c7ffd7300b5aa200a0fd21c7ca24992e543b7f8d.jpg) +Figure 2: Accuracy curves for node dropping experiments using the GCN model on various datasets in the inductive setting. Similar to the SGC results, our proposed SGUL method demonstrates superior performance in maintaining higher accuracy as nodes are removed. Note that GNNEvaluator is not shown for the larger datasets due to Out of Memory (OOM) errors. + +![](images/c8a17be0ab593e5d98d7837f5bea18614731e75579b1022f297676bce76cacca.jpg) +Figure 3: Accuracy curves for node dropping experiments using the SGC (above) and GCN models (below) in the transductive setting. + +# G.2 NODE DROPPING EXPERIMENTS + +We conducted node dropping experiments similar to those in the inductive setting. Figures 3 show the accuracy curves for node dropping experiments using SGC and GCN models respectively in the transductive setting. + +According to these figures, our SGUL method consistently maintains higher accuracy as nodes are removed across all datasets for both SGC and GCN models. This performance is particularly notable in the Pubmed dataset, where SGUL shows a significant advantage over other methods throughout the node removal process. + +For a more detailed quantitative analysis, including Area Under the Curve (AUC) results for both inductive and transductive settings, please refer to Appendix H. + +# H DETAILED QUANTITATIVE ANALYSIS + +To provide a more comprehensive evaluation of our SGUL method, we present here a detailed quantitative analysis using the Area Under the Curve (AUC) metric for the node dropping process. A lower AUC score indicates superior performance, representing a more rapid decline in model accuracy when high-value nodes are removed. + +# H.1 INDUCTIVE SETTING RESULTS + +Table 3 presents the AUC results for node dropping experiments in the inductive setting, comparing our SGUL method with several baselines across different datasets and models. + +Table 3: AUC results for node dropping experiments in the inductive setting. Our proposed Shap Lasso method consistently delivers competitive performance across various datasets and models. OOM refers to Out of Memory error. + +
DatasetModelATC-MCATC-NEDoCGNNEvaluatorMax ConfidenceClass ConfidenceSGUL
CoraSGC382.87399.23393.73393.83384.35374.22368.46
GCN377.29384.54397.35389.21384.83365.48361.19
CiteSeerSGC269.84270.44273.14271.21269.17262.43257.55
GCN262.94266.65269.02267.00265.05258.69253.29
PubmedSGC3098.023112.553136.043139.113118.713111.393068.07
GCN3109.803104.373147.283184.003121.703131.803080.99
CSSGC3879.303937.354023.95OOM3690.633694.783605.92
GCN4041.184134.894329.54OOM3984.783926.173896.88
PhysicsSGC8007.068138.487802.27OOM7802.277817.307797.74
GCN8085.598149.078328.46OOM7818.787800.917735.92
Amazon-ratingsSGC2513.362577.812557.59OOM2557.582466.702401.77
GCN2508.832562.552551.39OOM2458.662368.022352.09
Roman-empireSGC927.38944.23907.65OOM907.651023.01851.98
GCN985.70997.63978.04OOM978.041061.69935.10
+ +As evident from Table 3, our proposed SGUL method consistently achieves competitive performance across different datasets and models. In many cases, it outperforms the baseline methods, particularly for datasets with heterophily such as Amazon-ratings and Roman-empire. This quantitative comparison aligns with our observations from the accuracy curves, further demonstrating the effectiveness of our Shapley-Guided Utility Learning approach in capturing the importance of nodes in graph structures, even in challenging scenarios where connected nodes may have different characteristics. The superior performance of SGUL, as reflected in both the accuracy curves and AUC scores, can be attributed to its ability to capture the complex interactions and dependencies among nodes in the graph, leveraging the Shapley value concept to assign importance scores. By incorporating both graph structure and node features, SGUL provides a more comprehensive and accurate assessment of node importance compared to the baselines, which rely on simpler metrics such as confidence scores or average differences. + +# H.2 TRANSDUCTIVE SETTING RESULTS + +Table 4 presents the AUC results for node dropping experiments in the transductive setting. + +In the transductive setting, SGUL consistently outperforms all baseline methods across all datasets and models. The performance gap is even more pronounced compared to the inductive setting, particularly for larger datasets like Pubmed. These results further corroborate the effectiveness of our approach across different experimental settings. + +Table 4: AUC results for node dropping experiments in the transductive setting + +
DatasetModelATC-MCATC-NEDoCGNNEvaluatorMax ConfidenceClass ConfidenceSGUL
CoraSGC1219.901237.211251.551235.321237.001207.451180.11
GCN1216.451238.171261.801246.091228.151207.031180.95
CiteseerSGC1157.871165.031172.981157.191155.541127.221123.12
GCN1201.371213.331241.401221.271213.031197.151171.49
PubmedSGC10271.5010495.0010622.1110450.9810302.3910217.919894.75
GCN9959.4010262.3810500.2110417.299814.499648.279547.61
+ +# I IN-SAMPLE ERROR COMPARISON OF SHAPLEY AND ACCURACY OPTIMIZATION + +To empirically validate our theoretical arguments from Section 4.2.3, we compared the performance of Shapley-guided optimization (SGUL-Shapley) against accuracy-based optimization (SGUL-Accuracy). We used identical validation permutation data for both methods, as described in Section 2.2. To isolate the effect of the optimization objective, we employed an Ordinary Least Squares (OLS) setting, excluding regularization terms and cross-validation. All other aspects, including the feature set, remained constant between approaches. + +We fitted both models using 10 permutations as an observation for in-sample Mean Squared Error (MSE) comparison. A Wilcoxon signed-rank test was conducted to assess the statistical significance of the difference in MSE for Shapley value prediction between SGUL-Shapley and SGUL-Accuracy. + +Table 5 presents the mean in-sample MSE on the validation set for both approaches across various datasets in the inductive setting, using the SGC model. + +Table 5: In-sample validation MSE comparison between SGUL-Shapley and SGUL-Accuracy across datasets using the SGC model in the inductive setting. + +
DatasetSGUL-Shapley MSESGUL-Accuracy MSEp-value
Cora1.35 × 10-61.40 × 10-61.00 × 10-12
Citeseer6.08 × 10-76.47 × 10-71.00 × 10-12
Pubmed2.70 × 10-82.73 × 10-89.31 × 10-7
CS5.48 × 10-85.67 × 10-89.77 × 10-4
Physics1.95 × 10-82.02 × 10-83.13 × 10-2
Amazon-ratings3.22 × 10-83.26 × 10-89.31 × 10-7
Roman-empire7.59 × 10-87.66 × 10-89.31 × 10-7
+ +The results in Table 5 show that SGUL-Shapley consistently achieves lower MSE across all datasets, with statistically significant differences $(\mathrm{p} < 0.05)$ as determined by the Wilcoxon signed-rank test. The performance gap is particularly notable for larger datasets like CS and Physics, demonstrating SGUL-Shapley's scalability and effectiveness across various graph structures. + +These findings provide strong empirical support for our theoretical analysis in Section 4.2.3. They demonstrate that directly optimizing for Shapley values leads to more accurate estimation of node importance compared to the accuracy-based approach. + +# J DROPPING NODE COMPARISON OF OPTIMIZATION OBJECTIVES + +To further evaluate the effectiveness of our proposed Shapley-guided optimization approach, we conducted an ablation study comparing two different objective functions: Shapley value optimization (SGUL-Shapley) and accuracy-based optimization (SGUL-Accuracy). This experiment replicates our main experimental setting and goals, as described in Section 4.2.3, but with a key difference in the optimization target for SGUL-Accuracy. For SGUL-Accuracy, we used the same form + +as our proposed method but fitted it on accuracy-level data from all validation permutations. We then used this model to perform node dropping experiments, following the same procedure as in our main experiments. It's worth noting that this comparison may be influenced by factors such as cross-validation and the specific characteristics of accuracy-level data, which could introduce some variability in the results. Table 6 presents the AUC results for node dropping experiments using both methods across various datasets and models in the inductive setting. + +Table 6: Comparison of AUC results for SGUL-Shapley and SGUL-Accuracy in the inductive setting. Lower AUC indicates better performance, and our proposed Shapley-guided optimization (SGUL-Shapley) generally outperforms the accuracy-based optimization (SGUL-Accuracy) in terms of AUC results across most datasets. + +
CoraCiteseerPubmedCSPhysicsAmazon-ratingsRoman-empire
SGCGCNSGCGCNSGCGCNSGCGCNSGCGCNSGCGCNSGCGCN
SGUL-Shapley368.46361.19257.55253.293068.073080.993605.923896.887797.747735.922401.772352.09851.98935.10
SGUL-Accuracy369.74362.66257.66252.873078.773090.293651.124140.177980.067707.452405.302463.65852.29924.64
+ +The results show that SGUL-Shapley generally outperforms SGUL-Accuracy across most datasets and models. Specifically, SGUL-Shapley achieves better results in 10 out of 14 dataset-model combinations. The improvement is particularly noticeable for larger and more complex datasets such as CS, Physics, and Amazon-ratings. This suggests that the Shapley-guided approach is more effective at identifying critical nodes in the graph structure, especially for datasets with more intricate relationships between nodes. These findings align with our theoretical expectations and earlier in-sample error comparisons. They demonstrate that directly optimizing for Shapley values leads to more accurate and robust inference data valuation. + +Table 7: Feature importance coefficients for data-specific features across datasets and models + +
Feature NameDatasetGCNSGC
Edge Cosine SimilarityCora00
CiteSeer0.0070
Pubmed00.002
CS0.0310.061
Physics0.0030.068
Amazon-ratings0.0250
Roman-empire00
Representation DistanceCora0.1740.316
CiteSeer00
Pubmed00.040
CS00
Physics00
Amazon-ratings0.2850.032
Roman-empire00
Classwise Rep. DistanceCora00
CiteSeer00.128
Pubmed0.5480.383
CS0.1950
Physics00
Amazon-ratings00
Roman-empire00
+ +# K ABLATION STUDY ON FEATURE CONTRIBUTIONS + +To investigate the separate contributions of data-specific and model-specific features, we performed a comprehensive analysis of feature importance across different datasets and model architectures + +Table 8: Feature importance coefficients for model-specific features across datasets and models + +
Feature NameDatasetGCNSGC
Maximum Predicted ConfidenceCora00
CiteSeer0.4520.291
Pubmed00
CS0.0270.465
Physics00
Amazon-ratings00
Roman-empire0.2210.273
Target Class ConfidenceCora0.4640.159
CiteSeer0.1930.230
Pubmed0.1790.227
CS0.2360.033
Physics0.7380.626
Amazon-ratings0.2980.606
Roman-empire00
Negative EntropyCora0.1940.114
CiteSeer0.3430.271
Pubmed0.1470.176
CS0.1470.183
Physics0.2520.222
Amazon-ratings0.1660.361
Roman-empire0.2270.191
Propagated Maximum ConfidenceCora0.1680
CiteSeer0.0050.079
Pubmed0.1100.173
CS0.2160.258
Physics00.083
Amazon-ratings0.1330
Roman-empire0.5530.477
Confidence GapCora00.057
CiteSeer00
Pubmed00
CS0.1480
Physics0.0070
Amazon-ratings0.0920
Roman-empire00.059
+ +(GCN and SGC on inductive setting). Our feature coefficients were obtained through L1-regularized optimization, where each coefficient represents the feature's contribution to the utility function. To ensure fair comparison, we normalized these coefficients within each dataset-model combination so they sum to 1, allowing us to compare relative importance across different settings. + +The detailed results for data-specific features are presented in Table 7 and the detailed results for model-specific features are shown in Table 8. + +To quantify the overall feature importance, we further examine the feature selection frequency. For each feature, we count its appearance (non-zero coefficient) across datasets and normalize by the total number of datasets, providing insight into how consistently each feature is selected by our L1-regularized optimization. The summary of feature selection frequencies is presented in Table 9. + +The analysis reveals several key patterns in feature importance. Model-specific features exhibit higher and more consistent selection rates across datasets, with Negative Entropy being selected in all datasets and Target Class Confidence appearing in $85.7\%$ of datasets for both architectures. This + +Table 9: Feature selection frequency across datasets for GCN and SGC models + +
Feature TypeFeature NameGCNSGC
Data-specificEdge Cosine Similarity0.4290.429
Representation Distance0.2860.429
Classwise Rep. Distance0.2860.286
Model-specificMaximum Predicted Confidence0.4290.429
Target Class Confidence0.8570.857
Negative Entropy1.0001.000
Propagated Maximum Confidence0.7140.714
Confidence Gap0.4290.286
+ +suggests that model-specific features capture fundamental aspects of model behavior independent of dataset characteristics. + +On the other hand, data-specific features show more selective usage, with frequencies ranging from 0.286 to 0.429, indicating that they may be more dataset-dependent. The varying selection patterns suggest that data-specific features capture dataset-specific characteristics that complement the more universal model-specific features. + +Interestingly, the selection patterns are remarkably consistent between GCN and SGC architectures, with only minor differences in selection frequencies. This consistency across architectures suggests that our feature design successfully captures fundamental aspects of graph inference quality rather than architecture-specific characteristics. + +These findings support our feature design choices and demonstrate the complementary roles of data-specific and model-specific features in utility estimation. While model-specific features provide a universal basis for assessing model performance, data-specific features allow the utility learning model to adapt to the unique characteristics of each dataset. Notably, even for heterophilous graphs where GNNs typically perform worse, data-specific features like edge cosine similarity can still be selected, as shown in the ablation study tables for the Amazon-ratings. This highlights the ability of our utility learning framework to capture the nuanced relationship between graph homophily and test accuracy. + +# L LARGE-SCALE EVALUATION ON OGB-ARXIV + +To demonstrate the scalability and effectiveness of our SGUL framework on large-scale graph datasets, we conducted additional experiments on the ogbn-arxiv dataset (Hu et al., 2020b). This dataset represents a citation network consisting of 169,343 nodes and 1,166,243 edges, where each node represents an arXiv paper and each directed edge indicates a citation. + +# L.1 EXPERIMENTAL SETUP + +For this experiment, we randomly sampled $10\%$ nodes from each original train/val/test split and used 50 permutations for utility learning and 5 permutations for testing valuation. This resulted in a substantial evaluation set of over 27,000 testing neighbor nodes - to the best of our knowledge, this represents the first attempt at graph data valuation of this magnitude. + +# L.2 NODE DROPPING RESULTS + +Following the same evaluation protocol described in Section 6, we conducted node dropping experiments on the ogbn-arxiv dataset. The results are shown in Figure 4 and Table 10. + +Table 10 presents the performance at key points during the node dropping process: + +The results demonstrate SGUL's superior performance on large-scale graphs. It achieves the lowest AUC score (12834.35), significantly outperforming traditional approaches like ATC-MC (12989.56) + +![](images/ff19da725d838c71bee1f6f001ea1d06c06125c11b9fbc10a630cc2b538c7130.jpg) +Figure 4: Accuracy curves for node dropping experiments on the ogbn-arxiv dataset using the SGC model in the inductive setting. Our proposed SGUL method demonstrates superior performance, achieving a steeper decline in accuracy as high-value nodes are removed. + +Table 10: Performance across the node dropping process on ogbn-arxiv dataset + +
MethodStart (idx 0)5K nodes10K nodes15K nodes20K nodesEnd (idx 27421)AUC
ATC-MC0.48320.47600.47480.47300.47260.467212989.56
ATC-NE0.48320.47760.47550.47380.47310.467213013.93
DoC0.48320.47300.47100.47080.47040.467212923.52
Max Confidence0.48320.47300.47100.47080.47040.467212923.55
Class Confidence0.48320.47050.46900.46840.46840.467212864.68
SGUL0.48320.46980.46800.46780.46680.467212834.35
+ +and ATC-NE (13013.93). Note that GNNEvaluator encounters Out-of-Memory (OOM) errors on this large dataset, further highlighting the efficiency advantage of our approach. + +# M DETAILED ALGORITHM DESCRIPTION AND EVALUATION PROTOCOL + +To provide a comprehensive understanding of our framework's implementation and evaluation, we present a detailed description through three key components: (1) Shapley-Guided Utility Learning (SGUL) for learning utility functions from validation data, (2) Test-time Structure Value Estimation for inference without ground truth labels, and (3) Node Dropping Evaluation Protocol for empirical validation. These components collectively implement and evaluate the methodology introduced in Section 4 of our paper. + +# M.1 TRAINING PHASE: SHAPLEY-GUIDED UTILITY LEARNING + +Algorithm 1 implements our end-to-end optimization framework for graph inference data valuation. The algorithm takes as input a validation graph $G_{Val}$ , a training graph $G_{Tr}$ , a fixed trained GNN model $f(\cdot)$ , the number of permutations $M$ , and a regularization parameter $\lambda$ . As introduced in Section 4.1, the framework begins by initializing data structures $\Psi$ and $\Phi$ to store Feature Shapley vectors and true Shapley values respectively, enabling systematic accumulation of value estimates across validation nodes. + +Algorithm 1 Shapley-Guided Utility Learning (SGUL) +Input: Validation graph $G_{Val} = (V_{Val},E_{Val},X_{Val})$ , Training graph $G_{Tr}$ , Fixed trained GNN model $f(\cdot)$ , Number of permutations $M$ Regularization parameter $\lambda$ +Output: Optimal parameter vector w\* +1: Initialize: +2: $\Psi \gets \emptyset$ ▷Feature Shapley matrix +3: $\Phi \leftarrow \emptyset$ ▷True Shapley values +4: for each node $i\in N(V_{Val})$ do +5: Generate $M$ valid permutations $\{\pi_m\}_{m = 1}^M\in \Omega (N(V_{Val}))$ +6: for each permutation $\pi_{m}$ do +7: Construct subgraph sequence $\{G_{sub}(\pi_m,t)\}_{t = 1}^T$ +8: Extract features $\mathbf{x}(S)$ for each subgraph +9: Compute utility values $U(S)$ using validation accuracy +10: Compute feature Shapley vector $\psi_{i}$ . +11: for each feature $k$ do +12: $\phi_i(U_k)\gets \frac{1}{M}\sum_{m = 1}^{M}\bigl [U_k(N_i^{\pi_m}\cup \{i\}) - U_k(N_i^{\pi_m})\bigr ]$ +13: $\psi_i\gets [\phi_i(U_1),\phi_i(U_2),\dots,\phi_i(U_d)]^\top$ +14: Compute true Shapley value $\phi_i(U)$ +15: $\Psi \leftarrow \Psi \cup \{\psi_i\}$ +16: $\Phi \leftarrow \Phi \cup \{\phi_i(U)\}$ +17: Optimize parameter vector: +18: $\mathbf{w}^{*}\gets \arg \min_{\mathbf{w}}\sum_{i\in N(V_{Val})}(\phi_i(U) - \mathbf{w}^\top \psi_i)^2 +\lambda \| \mathbf{w}\| _1$ +19: Return w\* + +The core computation occurs in Step 2, implementing the feature extraction and value computation process detailed in Section 4.2.1. For each node $i$ in the validation graph neighborhood $N(V_{Val})$ , the algorithm generates $M$ valid permutations through Algorithm 4 that respect graph connectivity constraints. Each permutation $\pi_m$ produces a sequence of subgraphs $\{G_{sub}(\pi_m,t)\}_{t=1}^T$ through incremental node addition. For each subgraph, we extract comprehensive features $\mathbf{x}(S)$ spanning both data-specific measures (edge cosine similarity, representation distance) and model-specific measures (confidence scores, entropy values), with validation accuracy establishing ground truth utility values $U(S)$ . + +Following Section 4.2.2, the algorithm constructs Feature Shapley vectors $\psi_{i}$ by computing individual Shapley values $\phi_{i}(U_{k})$ for each feature type $k$ . This process captures each node's contribution across multiple utility metrics, creating a rich representation incorporating both graph topology and model behavior. The framework concludes with the optimization step described in Section 4.2.3, where parameter vector $\mathbf{w}$ is optimized through our objective function to directly minimize Shapley prediction error while promoting sparsity through L1 regularization. + +# M.2 INFERENCE PHASE: TEST-TIME STRUCTURE VALUE ESTIMATION + +Algorithm 2 demonstrates our test-time structure valuation process. Given a test graph $G_{Te}$ , target nodes $V_{t}$ , and the learned parameter vector $\mathbf{w}^{*}$ from Algorithm 1, we estimate Structure-aware Shapley values for test neighbor nodes without requiring ground truth labels. + +The test-time algorithm follows a similar permutation sampling and feature extraction pipeline as training, but crucially operates without access to ground truth labels. For each neighbor node $i \in N(V_t)$ , we generate valid permutations using Algorithm 4 respecting graph connectivity and construct corresponding subgraph sequences. We extract the same transferable features established in the training phase, computing predicted utility $\hat{U}(S)$ through the learned linear combination $\mathbf{w}^{*\top} \mathbf{x}(S)$ . These predicted utilities enable Structure-aware Shapley value estimation through permutation sampling, effectively quantifying each neighbor's contribution during inference. + +Together, these algorithms form a complete framework for graph inference data valuation, enabling both efficient training of the utility function and rapid value estimation during test time. The framework's key innovation lies in its ability to learn utility functions without test labels while + +maintaining computational efficiency through structured feature extraction and direct Shapley value optimization. + +Algorithm 2 Test-time Structure Value Estimation + +Input: Test graph $G_{Te} = (V_{Te}, E_{Te}, X_{Te})$ , Target nodes $V_t \subset V_{Te}$ , Learned parameter vector $\mathbf{w}^*$ , Number of permutations $M$ , Fixed trained GNN model $f(\cdot)$ + +Output: Estimated Structure-Aware Shapley values $\{\phi_i\}_{i\in N(V_t)}$ for test neighbor nodes + +1: Initialize: +2: $\hat{\Phi}\gets \emptyset$ >Estimated Structure-Aware Shapley values set +3: for each node $i \in N(V_t)$ do +4: Generate $M$ valid permutations $\{\pi_m\}_{m = 1}^M\in \Omega (N(V_t))$ +5: for each permutation $\pi_{m}$ do +6: Construct subgraph sequence $\{G_{sub}(\pi_m,t)\}_{t = 1}^T$ +7: Extract transferable features $\mathbf{x}(S)$ +8: Compute predicted accuracy $\hat{U} (S) = \mathbf{w}^{\top}\mathbf{x}(S)$ +9: Estimate Structure-Aware Shapley value: + +10: $\hat{\phi}_i = \frac{1}{M}\sum_{m = 1}^{M}\left[\hat{U}(N_i^{\pi_m}\cup \{i\}) - \hat{U}(N_i^{\pi_m})\right]$ +11: $\hat{\Phi} \gets \hat{\Phi} \cup \{\hat{\phi}_i\}$ +12: Return $\hat{\Phi}$ + +# M.3 NODE DROPPING EVALUATION PROTOCOL + +To empirically validate the effectiveness of our structure-aware Shapley values, we conduct comprehensive node dropping experiments. This evaluation protocol measures how model performance degrades as we sequentially remove nodes ranked by their estimated importance, providing a direct assessment of our valuation framework's ability to identify critical graph structures. + +Algorithm 3 outlines the node dropping evaluation process. Given a test graph $G_{Te}$ , target nodes $V_{t}$ and the Structure-aware Shapley values $\{\hat{\phi}_i\}_{i \in N(V_t)}$ computed using Algorithm 2, we rank the nodes in descending order of their estimated importance. We then iteratively remove nodes following this ranking and measure the model's prediction accuracy after each removal. The accuracy curve and Area Under the Curve (AUC) metric are used to quantify the effectiveness of our valuation method. + +A lower AUC score indicates superior performance, as it represents a more rapid and sustained decline in model accuracy when high-value nodes are removed. This aligns with our goal of accurately identifying influential graph structures - removing truly important nodes should significantly impact model performance. As demonstrated in Section 6.4, SGUL consistently achieves lower AUC scores compared to baseline methods, validating its effectiveness in identifying critical graph structures. + +Furthermore, the shape of the accuracy curve provides additional insights into our method's behavior. An ideal curve should show a sharp initial drop, indicating the removal of highly influential nodes, followed by a consistent downward trend, suggesting stable and reliable importance rankings. Our experimental results in Section 6.4 demonstrate that SGUL's node dropping curves exhibit these desirable characteristics across various datasets and model architectures. + +# M.4 SAMPLING PERMISSIVE PERMUTATIONS + +The structure-aware Shapley value in our framework is formally defined as: + +$$ +\phi_ {i} (N (\mathcal {V} _ {t}), U) = \frac {1}{| \Omega (N (\mathcal {V} _ {t})) |} \sum_ {\pi \in \Omega (N (\mathcal {V} _ {t}))} [ U (N _ {i} ^ {\pi} (\mathcal {V} _ {t}) \cup \{i \}) - U (N _ {i} ^ {\pi} (\mathcal {V} _ {t})) ] +$$ + +This can be viewed as an expectation that we approximate through Monte Carlo sampling under precedence constraints. Specifically, we approximate the Shapley value using $M$ random permutations: + +Algorithm 3 Node Dropping Evaluation +Input: Test graph $G_{Te} = (V_{Te},E_{Te},X_{Te})$ , Target nodes $V_{t}\subset V_{Te}$ , Structure-aware Shapley values $\{\hat{\phi}_i\}_{i\in N(V_t)}$ , Fixed trained GNN model $f(\cdot)$ +Output: Accuracy curve $\{Acc_k\}_{k = 1}^K$ , Area Under the Curve (AUC) +1: Rank nodes in $N(V_{t})$ by $\{\hat{\phi}_i\}_{i\in N(V_t)}$ in descending order +2: $K\gets |N(V_t)|$ +3: for $k = 1$ to $K$ do +4: Remove top- $k$ ranked nodes from $G_{Te}$ to obtain $G_{k}$ +5: Compute accuracy: $Acc_{k} = \frac{1}{|V_{t}|}\sum_{v\in V_{t}}\mathbb{I}(f(G_{k})(v) = y_{v})$ +6: Compute AUC: $AUC = \frac{1}{K}\sum_{k = 1}^{K}Acc_{k}$ +7: Return $\{Acc_k\}_{k = 1}^K$ , AUC + +$$ +\hat {\phi} _ {i} (N (\mathcal {V} _ {t}), U) = \frac {1}{M} \sum_ {m = 1} ^ {M} \left[ U \left(N _ {i} ^ {\pi_ {m}} (\mathcal {V} _ {t}) \cup \{i \}\right) - U \left(N _ {i} ^ {\pi_ {m}} (\mathcal {V} _ {t})\right) \right] +$$ + +To implement this approximation while respecting graph structure constraints, we employ Algorithm 4. + +Algorithm 4 Precedence-Constrained Permutation Sampling +Input: Test graph $\mathcal{G} = (\mathcal{V},\mathcal{E},\mathbf{X})$ Target nodes $\mathcal{V}_t\subset \mathcal{V}$ Number of samples $M$ ,Number of hops $k$ +Output: Set of valid permutations $\{\pi_m\}_{m = 1}^M$ +1: for $m = 1$ to $M$ do +2: Initialize: $\mathcal{V}_{\mathrm{visited}}\gets \mathcal{V}_t$ +3: $\mathcal{V}_{\mathrm{active}}\gets \{v\in \mathcal{N}_1(\mathcal{V}_t)\mid v\notin \mathcal{V}_{\mathrm{visited}}\}$ +4: while $|\mathcal{V}_{\mathrm{active}}| > 0$ and $|\mathcal{V}_{\mathrm{visited}}| < k$ do +5: Sample $v$ from $\mathcal{V}_{\mathrm{active}}$ +6: Update $\mathcal{V}_{\mathrm{visited}}\gets \mathcal{V}_{\mathrm{visited}}\cup \{v\}$ +7: $\mathcal{V}_{\mathrm{new}}\gets \{u\in \mathcal{N}_1(v)\mid u\notin \mathcal{V}_{\mathrm{visited}}\}$ +8: $\mathcal{V}_{\mathrm{active}}\gets \mathcal{V}_{\mathrm{active}}\cup \mathcal{V}_{\mathrm{new}}\setminus \{v\}$ +9: Return $\{\pi_m\}_{m = 1}^M$ + +This algorithm ensures each sampled permutation $\pi$ satisfies the precedence constraint by maintaining connectivity. Starting from target nodes $\mathcal{V}_t$ , we iteratively sample nodes from their active neighbors (those not yet visited) while preserving graph connectivity. This sampling process guarantees that each permutation respects the structural dependencies inherent in the message-passing process, as demonstrated through our comprehensive experimental results in Section 6. \ No newline at end of file diff --git a/ICLR/2025/Shapley-Guided Utility Learning for Effective Graph Inference Data Valuation/images.zip b/ICLR/2025/Shapley-Guided Utility Learning for Effective Graph Inference Data Valuation/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..b149e46f0ed680036cdb0ec111825597d86b02eb --- /dev/null +++ b/ICLR/2025/Shapley-Guided Utility Learning for Effective Graph Inference Data Valuation/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:958022e39e1f0c826ada18dc17f7a958b8e93b7b755e2ec5c9193df0634ee173 +size 1054957 diff --git a/ICLR/2025/Shapley-Guided Utility Learning for Effective Graph Inference Data Valuation/layout.json b/ICLR/2025/Shapley-Guided Utility Learning for Effective Graph Inference Data Valuation/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..69c2907a03803fc6b620c8a712e6ad5ef9bb1ddc --- /dev/null +++ b/ICLR/2025/Shapley-Guided Utility Learning for Effective Graph Inference Data Valuation/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a6487a8da54b97873487599c11ae30f0aac9c6cca330434046136e2d58d4488a +size 1021605 diff --git a/ICLR/2025/Shared-AE_ Automatic Identification of Shared Subspaces in High-dimensional Neural and Behavioral Activity/e7c2772c-2560-43fd-b35c-5634dd983826_content_list.json b/ICLR/2025/Shared-AE_ Automatic Identification of Shared Subspaces in High-dimensional Neural and Behavioral Activity/e7c2772c-2560-43fd-b35c-5634dd983826_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..579441b096c8127efb24bf1e7ed19c52e3de71c3 --- /dev/null +++ b/ICLR/2025/Shared-AE_ Automatic Identification of Shared Subspaces in High-dimensional Neural and Behavioral Activity/e7c2772c-2560-43fd-b35c-5634dd983826_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f2606ac3f60d85dd6396a68b7bfa94b905663f7ca230f715461bb74fe179b95d +size 153661 diff --git a/ICLR/2025/Shared-AE_ Automatic Identification of Shared Subspaces in High-dimensional Neural and Behavioral Activity/e7c2772c-2560-43fd-b35c-5634dd983826_model.json b/ICLR/2025/Shared-AE_ Automatic Identification of Shared Subspaces in High-dimensional Neural and Behavioral Activity/e7c2772c-2560-43fd-b35c-5634dd983826_model.json new file mode 100644 index 0000000000000000000000000000000000000000..e93344de857f1fef3d710171efa16716127458c3 --- /dev/null +++ b/ICLR/2025/Shared-AE_ Automatic Identification of Shared Subspaces in High-dimensional Neural and Behavioral Activity/e7c2772c-2560-43fd-b35c-5634dd983826_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3aa4c1a77f180bb01935f6f277110d9dc086476ad4205078e0d08373d1691a33 +size 176272 diff --git a/ICLR/2025/Shared-AE_ Automatic Identification of Shared Subspaces in High-dimensional Neural and Behavioral Activity/e7c2772c-2560-43fd-b35c-5634dd983826_origin.pdf b/ICLR/2025/Shared-AE_ Automatic Identification of Shared Subspaces in High-dimensional Neural and Behavioral Activity/e7c2772c-2560-43fd-b35c-5634dd983826_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..eff254579f6f2006b1cdf380ad7deb387831ab5c --- /dev/null +++ b/ICLR/2025/Shared-AE_ Automatic Identification of Shared Subspaces in High-dimensional Neural and Behavioral Activity/e7c2772c-2560-43fd-b35c-5634dd983826_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d676e6f59b4d003faecc4a238f2a3e1f21a9f5cc31890fee3f105098aea11015 +size 17144361 diff --git a/ICLR/2025/Shared-AE_ Automatic Identification of Shared Subspaces in High-dimensional Neural and Behavioral Activity/full.md b/ICLR/2025/Shared-AE_ Automatic Identification of Shared Subspaces in High-dimensional Neural and Behavioral Activity/full.md new file mode 100644 index 0000000000000000000000000000000000000000..311f598cbcf938462a13ea83bb20ca28c95dfcba --- /dev/null +++ b/ICLR/2025/Shared-AE_ Automatic Identification of Shared Subspaces in High-dimensional Neural and Behavioral Activity/full.md @@ -0,0 +1,611 @@ +# SHARED-AE: AUTOMATIC IDENTIFICATION OF SHARED SUBSPACES IN HIGH-DIMENSIONAL NEURAL AND BEHAVIORAL ACTIVITY + +Daiyao Yi + +Department of Electrical & Computer Engineering + +Yale University + +New Haven, CT 06520, USA + +daiyao.yi@yale.edu + +Hao Dong, Michael James Higley + +Department of Neuroscience + +Yale University + +New Haven, CT 06520, USA + +{hao.dong, m.higley}@yale.edu + +Anne Churchland + +Department of Neurobiology + +University of California, Los Angeles + +Los Angeles, CA 90095, USA + +AChurchland@mednet.ucla.edu + +Shreya Saxena + +Department of Biomedical Engineering + +Yale University + +New Haven, CT 06520, USA + +shreya.saxena@yale.edu + +# ABSTRACT + +Understanding the relationship between behavior and neural activity is crucial for understanding brain function. An effective method is to learn embeddings for interconnected modalities. For simple behavioral tasks, neural features can be learned based on labels. However, complex behaviors, such as social interactions, require the joint extraction of behavioral and neural characteristics. In this paper, we present an autoencoder (AE) framework, called Shared-AE, which includes a novel regularization term that automatically identifies features shared between neural activity and behavior, while simultaneously capturing the unique private features specific to each modality. We apply Shared-AE to large-scale neural activity recorded across the entire dorsal cortex of the mouse, during two very different behaviors: (i) head-fixed mice performing a self-initiated decision-making task, and (ii) freely-moving social behavior amongst two mice. Our model successfully captures both 'shared features', shared across neural and behavioral activity, and 'private features', unique to each modality, significantly enhancing our understanding of the alignment between neural activity and complex behaviors. The original code for the entire Shared-AE framework on Pytorch has been made publicly available at: https://github.com/saxenalab-neuro/Shared-AE. + +# 1 INTRODUCTION + +Recent advances in hardware and storage capabilities enable us to obtain comprehensive behavioral recordings of the subject along with the corresponding neural activity from large parts of the brain. It is now widely recognized that understanding the relationship between complex neural activity and high-dimensional behavior is a crucial step in brain research that has historically been underestimated (Pereira et al. (2020); Whiteway et al. (2021)). Understanding this relationship provides insight into how the brain processes information during different behaviors and tasks. An effective approach to achieve this is to learn embeddings for these interconnected modalities, which allows for the identification of patterns within complex datasets. + +Current research on learning neural embeddings focuses on simple tasks and is largely based on behavioral labels (Pandarinath et al. (2017); Schneider et al. (2023); Zhou & Wei (2020)). However, when it comes to more complex task-related behaviors and social interactions which cannot be captured by simple labels, understanding relevant features becomes significantly more challenging. Moreover, effectively aligning the features of the behavioral and neural modalities requires careful consideration. Integrating these features requires preserving the unique characteristics of each modality while extracting the shared aspects. + +In this article, we propose an Autoencoder-based (AE-based) framework termed Shared-AE, incorporating a novel regularization term designed to identify features common to behavior and neural activity. Autoencoders are particularly well-suited for such tasks, as they capture the underlying structure of the data while ensuring that latent variables retain meaningful features from the input. In our approach, we utilize the Cauchy-Schwarz (CS) divergence to enhance the model's capability to extract shared information across modalities. Additionally, we apply the inverse CS divergence to enable private latent variables to capture features unique to each modality. + +Our model effectively captures both 'shared features', which are common across modalities, and 'private features', which are unique to each modality. By clearly partitioning these types of features, our approach provides a comprehensive understanding of which aspects of neural activity align with behavior. Compared with other models such as Shi et al. (2019), Gondur et al. (2024), Sani et al. (2021), and Singh Alvarado et al. (2021), our framework successfully addresses the issue of modality leakage - where features from one modality undesirably influence the latent representations of another. This ensures that the shared features truly reflect across-modality insights, while the private features maintain the distinct characteristics of each data source. + +We apply the Shared-AE framework towards understanding two very different datasets: (i) a head-fixed mouse performing a self-initiated decision-making task, and (ii) a freely-moving mouse engaged in social behavior. In both cases, neural activity is recorded using widefield calcium imaging (WFCI), capturing many regions across the dorsal cortex. We find that the model successfully captures shared subspaces across individual and social behavior, identifying brain regions that are most aligned with the recorded behavior. Additionally, we identify aligned motifs between the neural and behavioral modalities using a Hidden Markov Model (HMM). Furthermore, Shared-AE allows us to compare neural alignment when using raw video data as compared to pose estimation and related extracted features, revealing that the activity of certain brain regions aligns more closely with raw behavioral videos. Lastly, Shared-AE can generalize beyond two simultaneously recorded modalities to examine the common subspace across multiple modalities. With the increase in naturalistic behavioral recordings and large-scale neural data, Shared-AE offers an automated and interpretable framework to identify behaviorally-relevant neural activity and neurally-relevant behavioral patterns. + +We highlight the novelty of Shared-AE through the following key contributions: (i) Enhanced Interpretability via Latent Subspace Separation: Shared-AE introduces a novel approach that explicitly separates shared and private latent spaces, improving interpretability by reducing information leakage between modalities. This design allows robust inference even when data from one modality is unavailable or corrupted during testing. (ii) Improved Performance on Paired and Unpaired Tasks: Shared-AE maintains the integrity of latent representations in data from different modalities, even when data from one of the modalities is shuffled during evaluation ('unpaired' task). This robustness is demonstrated by its superior performance on the 2AFC dataset, where Shared-AE outperforms existing models such as Gondur et al. (2024); Sani et al. (2021; 2024); Shi et al. (2019). (iii) Flexibility with Multiple Modalities and Image Data: Unlike previous methods, Shared-AE is able to handle complex data types such as raw image data, and is also able to extend to more than three modalities. This capability significantly expands its applicability compared to previously published methods, enabling richer behavioral representations than pose estimation alone. (iv) Minimizing Distribution Distance Instead of Fitting to Predefined Priors: Rather than conforming to predefined priors, as done in models such as Yi et al. (2022), Shared-AE minimizes the distances between distributions learned from data. This approach yields more flexible and meaningful latent representations. (v) Utility for Downstream Tasks and Improved Variance Explained: The separation of shared and private latent variables ensures that the learned representations are robust and suitable for diverse downstream tasks, while enabling insights into brain-behavior relationships. A detailed discussion on the technical and scientific novelty of Shared-AE can be found in Appendix A.3 + +# 2 RELATED WORKS + +# 2.1 MULTI-MODAL INTEGRATION IN NEUROSCIENCE + +Multimodal integration is a rapidly growing area of research within artificial intelligence (AI) and machine learning Baltrusaitis et al. (2017); Steyaert et al. (2023); Brenner et al. (2024); Radford et al. (2021); Shi et al. (2021); Tian et al. (2020); Schneider et al. (2023); Zhang et al. (2020); Lake & Higley (2022); Cardin et al. (2020); Lake et al. (2020); Singh Alvarado et al. (2021); Liu et al. + +(2021); Shi et al. (2019); Gondur et al. (2024); Sani et al. (2024). This field aims to combine and analyze data from multiple sources to improve the understanding and performance of AI systems. In neuroscience, multimodal data often refers to different types of recordings, such as fMRI and PET (Zhang et al. (2020); Steyaert et al. (2023)), which provide complementary information about brain activity and function. Additionally, multimodality can encompass both behavioral data and corresponding neural activity, providing a more comprehensive view of brain function. + +Recent research, such as Sani et al. (2021; 2024), focuses on using dynamical models to generate behaviorally-relevant and behaviorally-irrelevant neural latent variables. While introducing private latent spaces enhances interpretability, these methods struggle when faced with spurious temporal correlations and high-dimensional data. In contrast, our approach extracts modality-specific shared subspaces for across-modality relationships while maintaining interpretability through an autoencoder framework that reconstructs each modality, enabling scalability to complex behaviors. In Singh Alvarado et al. (2021), the authors introduced a multi-encoder model that fused different modalities using a Multimodal Variational Autoencoder (M-VAE) with a product-of-experts (PoE) approach for modality fusion. Similarly, in the Multimodal Mixture-of-Experts VAE (MM-VAE) (Shi et al. (2019)), the authors employed a mixture-of-experts (MoE) strategy instead of PoE to fuse modalities. However, both these methods result in information leakage between modalities, leading to ambiguities as to the origin of the data in the latent space, drastically reducing the interpretability of the latent space. In Gondur et al. (2024), the authors introduced a Gaussian Process (GP) framework to handle temporal relationships and designed separate latent spaces to capture private features for each modality. However, their approach falls short when dealing with unpaired tasks, as it requires both modalities to be present and aligned during inference. This limitation reduces the model's flexibility and robustness in scenarios where data from one modality may be unavailable, shuffled, or otherwise corrupted. + +# 2.2 LEARNING EMBEDDINGS IN NEUROSCIENCE + +Recent advancements in hardware and storage capabilities have significantly enhanced the quality and capacity of behavioral and neural recordings. Consequently, a substantial body of research has focused on extracting lower-dimensional features from these high-dimensional datasets. Learning embeddings involves extracting lower-dimensional features for both behavior and neural activity. In the field of learning behavioral embeddings, pose estimation tools such as Lauer et al. (2021); Pereira et al. (2022) have been broadly applied to track keypoint positions from the behavioral videos, and methods like Luxem et al. (2022); Wiltschko et al. (2015); Berman et al. (2014) utilize these keypoint positions to generate lower-dimensional behavioral features. Other works generate behavioral features directly from videos, for example, Batty et al. (2019) applied VAEs for capturing the animal's behavioral features. Furthermore, Whiteway et al. (2021) and Yi et al. (2022); Klys et al. (2018) produce interpretable latent spaces by constraining the latent distribution in various ways. Due to the high-dimensional nature of neural activity, learning lower-dimensional neural representations is also crucial for uncovering neural dynamics. Models such as Churchland et al. (2012); Sani et al. (2021) apply linear methods to learn interpretable embeddings from neural activity. Nonlinear models like Pandarinath et al. (2017); Zhou & Wei (2020) adopt VAE-based approaches to project behavior onto neural activity. Furthermore, Schneider et al. (2023) uses an encoder-based model and constrains the latent space during behavioral tasks using contrastive learning. However, none of these models have effectively addressed more complex behavioral tasks. + +# 3 METHODS + +# 3.1 OVERVIEW + +Our goal is to develop representations that capture information shared between different modalities, such as behavior and neural activity. We employ an AE-based model with dual encoders to extract features from each modality independently (Fig. 1). The latent space of each modality is subsequently divided into two subspaces: shared and private. To promote commonality across the modalities for shared latent variables, we regularize these subspaces using the Cauchy-Schwarz (CS) divergence that encourages alignment between different subspaces. Moreover, the private latent variables are constrained using the inverse CS divergence regularization that encourages distinctive subspaces. Finally, the corresponding private latent variables are combined with the shared latent variables to reconstruct the original data in each modality using modality-specific decoders (Fig. 1). + +![](images/5ae7f69335bc054054a6fa29b5ace3d9073e9b994f7083333b93fcb1726a1a99.jpg) +Figure 1: Shared-AE architecture: (1) Encoder: each modality is encoded separately. (2) Separation into private vs. shared: after encoding, the latents are separated into private and pre-shared latent variables through linear dense layers. Cauchy-Schwarz (CS) divergence is applied to encourage alignment and the inverse form is applied to encourage orthogonality. (3) Decoder: the latents for each modality are decoded by separate decoders for reconstruction. + +# 3.2 MODEL STRUCTURE + +We assume that we can record from $C$ different modalities: $i \in \{1, 2, \dots, C\}$ . Let modality $i$ consist of recorded data $X^i$ over $T$ time points $X^i = \{x_1^i, x_2^i, \dots, x_T^i\}$ . We use a sliding window approach based on the recorded data to capture temporal information in each sample of the input; we define $Y^i = \{y_1^i, y_2^i, \dots, y_T^i\}$ as the network input for modality $i$ , where $y_t^i = [x_{t - w}^i, x_{t - w + 1}^i, \dots, x_t^i]$ , with $w$ being the window size. To extract useful representations from each input modality, we apply separate encoders to each modality $f_{\theta^i}$ with a set of learnable parameters $\theta^i$ . + +Let $z_{t}^{i} = f_{\theta^{i}}(y_{t}^{i})$ represent the encoded representation of the $t$ -th sample for modality $i$ . $z_{t}^{i}$ maps onto two subspaces: the shared latent subspace $s^{i}$ , where $s_{t}^{i} = W_{s}z_{t}^{i} + b_{s}$ , and the private latent subspace $p^{i}$ , where $p_{t}^{i} = W_{p}z_{t}^{i} + b_{p}$ . Here, $W_{s}$ and $W_{p}$ are weights while $b_{s}$ and $b_{p}$ are bias terms. Finally, the shared latents and private latents for each modality are concatenated to form a combined latent space $[s^i,p^i]$ , which is then decoded back to reconstruct the original input $\hat{y}_t^i = f_{\lambda^i}([s_t^i,p_t^i])$ using separate decoders for each modality. Here, $\hat{y}_t^i$ is the reconstruction and $f_{\lambda^i}$ is the decoder with parameters $\lambda^i$ . + +In this study, we consider the two (or more) modalities to consist of simultaneously recorded neural activity and behavior. We assume that the behavior is directly recorded using a behavioral video camera, with either the raw video being considered the behavioral modality, or poses that are captured by pose estimation methods such as Lauer et al. (2021); Pereira et al. (2022). + +# 3.3 REGULARIZATION ENCOURAGING SHARED VERSUS PRIVATE LATENT VARIABLES + +Two modalities: To encourage shared structure in the 'shared' latent variables from different modalities, we regularize these using the CS-divergence between $s_t^1$ and $s_t^2$ (Santana et al. (2016); Kampa et al. (2011)). Moreover, to encourage distinct representations in the shared versus private latent variables for each modality, we regularize these using the inverse CS-divergence between the shared latents and the private latents for distinctiveness. + +For two probability distribution functions (PDFs) $f_{1}(x)$ and $f_{2}(x)$ , given the CS inequality (see Appendix A.4), CS-divergence measures the distance between the two distributions (Jenssen et al. (2006)) and is given by: + +$$ +D _ {C S} \left(f _ {1}, f _ {2}\right) = - \log \frac {\int f _ {1} (x) f _ {2} (x) d x}{\sqrt {\int f _ {1} (x) d x \int f _ {2} (x) d x}} \tag {1} +$$ + +$D_{CS}(f_1,f_2)$ equals zero if and only if the two distributions $f_{1}(x)$ and $f_{2}(x)$ are the same. + +For two given latent subspace with dimension $d$ , the $1^{st}$ and $2^{nd}$ modalities, $s_t^1$ and $s_t^2$ , $t = 1, \dots, N$ , the PDF of each distribution can be approximated by its Parzen window estimator: + +$$ +\hat {f} _ {i} (s) = \frac {1}{N} \sum_ {t = 1} ^ {N} G _ {\sigma^ {2}} (s, s _ {t} ^ {i}) \tag {2} +$$ + +where $i = 1,2$ ; $G_{\sigma^2}$ is the Gaussian kernel with kernel size $\sigma$ (Santana et al. (2016)) and is expressed as $G_{\sigma^2}(s,s_t^i) = \frac{1}{(2\pi\sigma^2)^{\frac{d}{2}}}\exp \{-\frac{||s - s_t^i|||^2}{2\sigma^2}\}$ . By replacing the actual densities in Eq. 1, the numerator can be rewritten as: + +$$ +\int f _ {1} (s) f _ {2} (s) d s = \int \hat {f} _ {1} (s) \hat {f} _ {2} (s) d s = \frac {1}{N _ {1} N _ {2}} \sum_ {j, k = 1} ^ {N _ {1}, N _ {2}} \int G _ {\sigma^ {2}} \left(s, s _ {j} ^ {1}\right) G _ {\sigma^ {2}} \left(s, s _ {k} ^ {2}\right) d s \tag {3} +$$ + +According to the convolution theorem for Gaussian functions, the above equation can be simplified as $\int f_1(s)f_2(s)ds = \frac{1}{N_1N_2}\sum_{j,k=1}^{N_1,N_2}G_{(\sqrt{2}\sigma)^2}(s_j^1,s_k^2)$ . Here we denote $\sum_{j,k=1}^{N_1,N_2}G_{(\sqrt{2}\sigma)^2}(s_j^1,s_k^2)$ as $V(f_1,f_2)$ . Similarly, by replacing the $f_2(s)$ by $f_1(s)$ , the expression becomes $\int f_1^2(s)ds = \frac{1}{N_1^2}\sum_{j,j'=1}^{N_1,N_2}G_{(\sqrt{2}\sigma)^2}(s_j^1,s_{j'}^2)$ , then the denominator can be written as $\sqrt{(V(f_1,f_1),V(f_2,f_2))}$ , for simplification, we put $V(f_i,f_i)$ as $V(f_i)$ where $i\in \{1,2\}$ . + +Finally, equation (1) can be expressed as: + +$$ +\mathcal {L} _ {C S} := D _ {C S} \left(f _ {1}, f _ {2}\right) = - \log \frac {V \left(f _ {1} , f _ {2}\right)}{\sqrt {V \left(f _ {1}\right) V \left(f _ {2}\right)}} \tag {4} +$$ + +Here, $f_{1}(s^{1})$ and $f_{2}(s^{2})$ represents the distribution of shared latent space for modality 1 and 2. In Equation (4), minimizing $V(f_{1})$ would result in the spreading out of $f_{1}(x)$ , while maximizing $V(f_{1},f_{2})$ would make the samples in both distributions closer together (Yi et al. (2022)). Thus, we minimize $\mathcal{L}_{CS}$ for shared latent spaces and maximize it to reduce the similarity between shared and private latent spaces within the same modality. Additionally, by maximizing this value, we promote distinctiveness between the private latent spaces of different modalities. There is a close relationship between the VAE and the CS-regularized AE, as detailed in Appendix A.6. + +# 3.4 OBJECTIVE FUNCTION FOR TWO MODALITIES + +Overall, the objective function can be expressed as: + +$$ +\mathcal {L} = \mathcal {L} _ {M S E _ {1}} + \mathcal {L} _ {M S E _ {2}} + \alpha \mathcal {L} _ {c s _ {s _ {1} s _ {2}}} + \beta \mathcal {L} _ {c s _ {s _ {1} p _ {1}}} ^ {- 1} + \gamma \mathcal {L} _ {c s _ {s _ {2} p _ {2}}} ^ {- 1} + \delta \mathcal {L} _ {c s _ {p _ {1} p _ {2}}} ^ {- 1} \tag {5} +$$ + +Here, the terms $\mathcal{L}_{MSE_1}$ and $\mathcal{L}_{MSE_2}$ represent the reconstruction loss of the two input modalities, respectively. The $\mathcal{L}_{cs_{s_1}s_2}$ , $\mathcal{L}_{cs_{s_1}p_1}$ , $\mathcal{L}_{cs_{s_2}p_2}$ , and $\mathcal{L}_{cs_{p_1}p_2}$ represents the CS-divergence loss between different latent subspaces. $\alpha$ is introduced to control the similarity between the shared latent space. $\beta, \gamma$ , and $\delta$ are adopted to assist the model in producing independent latent subspaces. + +# 3.5 GENERALIZATION TO MORE THAN TWO MODALITIES + +The CS-divergence can also be extended to measure the distance between multiple distributions. For $C$ number of PDFs, the CS-divergence can be written as follows: + +$$ +\mathcal {L} _ {\text {m u l t i - c s}} = D _ {C S} \left(f _ {1}, f _ {2},.., f _ {C}\right) = - \log \sum_ {i = 1} ^ {C - 1} \sum_ {j > i} \frac {V \left(f _ {i} , f _ {j}\right)}{\epsilon \sqrt {V \left(f _ {i}\right) V \left(f _ {j}\right)}} \tag {6} +$$ + +Here, $\epsilon = \sum_{c=1}^{C-1} c$ . Similarly, $D_{CS}(f_1, f_2, \dots, f_C)$ equals zero if and only if the $C$ distributions $f_1(x), f_2(x), \dots, f_C(x)$ are the same. Thus, the objective function for $C$ modalities can be written as: + +$$ +\mathcal {L} = \mathcal {L} _ {M S E _ {1}} + \dots + \mathcal {L} _ {M S E _ {C}} + \alpha \mathcal {L} _ {\text {m u l t i} - c s _ {s _ {1} \dots s _ {C}}} + \delta \mathcal {L} _ {\text {m u l t i} - c s _ {p _ {1} \dots p _ {C}}} ^ {- 1} + (\beta \mathcal {L} _ {c s _ {s _ {1} p _ {1}}} ^ {- 1} + \dots + \beta \mathcal {L} _ {c s _ {s _ {C P C}}} ^ {- 1}) \tag {7} +$$ + +Here, $\mathcal{L}_{multi - cs}$ represents the CS loss across different modalities. For the above equation, the number of MSE loss terms and the CS loss terms, which encourage independence between shared and private latent spaces within the same modality, remain consistent with the total number of modalities. To simplify, the weight $\beta$ for promoting independence is set to the same value across different modalities. + +# 4 RESULTS + +We evaluated our model using three datasets: one simulated dataset and two experimental datasets. All evaluations were conducted on held-out data. The training details are provided in Appendix A.7. + +# 4.1 SIMULATED DATASET: 3DSHAPE + +We evaluated our model using a simulated dataset consisting of multiple sessions, each containing recordings from two modalities. The "image" modality consists of 3D shapes that varied in orientation, scale, shape, and color, with procedural changes applied to these features over time (Burgess & Kim (2018)). We also simulate the corresponding non-linear time series encoding of the scale and orientation, with temporally-structured noise that periodically changes value between 1 and 4. Further details can be found in Appendix A.2.1. + +![](images/895aa945768e88eae7bda3273561659e5a84a566006822f91e5c6072abc37830.jpg) +Figure 2: 3Dshape: A. The image modality consists of 3D shapes with different scales, orientations, and shapes, while the time series modality encodes the scales, orientations, and temporally-structured noise; the shared information across modalities is the scales and orientations. B. Shared latent spaces for each modality, each point represents a single frame, color-coded by orientations and scales. C. Private latent for each modality, color-coded by the corresponding private features: the private latent spaces retains the private features. + +Our goal is to capture the shared information present in both image and time series data within the shared latent spaces, while ensuring that the private latent spaces are specific to each modality, retaining only the modality-specific features. By doing so, we can effectively separate the shared time series and image features from those that are unique to either domain. This approach allows for a clearer understanding of the underlying relationships between time series and images, and how the two modalities align or diverge in capturing the intricacies of the data. + +To evaluate the success of our model, we compare the correlation matrices across different latent spaces, specifically focusing on the shared and private latents. The shared latent spaces exhibit significantly higher correlation scores compared to the private latent spaces (as detailed in Appendix A.10.1). This higher correlation in the shared spaces suggests that the model effectively captures the common structure between time series and image data, while the private spaces remain distinct, as intended. + +We further visualize the latent spaces, with the latents color-coded by orientations and scales (Fig. 2B). The latent spaces show a clear and well-aligned separation between different orientations and scales, further validating the ability of the model to organize key features in the shared latent space. The alignment in the shared space demonstrates that the model was able to identify the common underlying patterns between the two modalities in a way that enhances interpretability. + +We apply a linear decoding model to each latent space for feature decoding after binning the data (Fig. 3, Appendix A.12.2). The shared latent spaces demonstrate high accuracy in decoding scales and orientations, highlighting their ability to capture common features across both modalities. The private latent spaces perform well in isolating modality-specific information. For example, the private image latents retain more shape-related details, leading to better decoding accuracy for shape features as compared to the shared latents. Similarly, the private time series latents excel in decoding temporally-structured noise, confirming their success in capturing modality-specific content. + +Next, we demonstrate the necessity of applying the CS-divergence to the latent spaces: we train a model using the same architecture but without applying the CS-divergence. As shown in Appendix A.12.2, the results indicate a lack of separation between the private and shared latent spaces, highlighting the necessity of constraints to effectively distinguish shared and private features. + +In comparison to previously explored models such as MM-VAE (Shi et al. (2019)) and joint encoding models (Singh Alvarado et al. (2021)), the shared time series and image latents are able to represent the shared features more accurately (Fig. 3, Appendix A.12.2). In comparison models, + +![](images/f10550dad554330b953f61d3337f6e9fb4b7e152d466657a6fc56dc6e8dd6737.jpg) +Figure 3: Comparison against baseline models while having unpaired the data from the modalities. The Shared-AE shared latent results in better decoding accuracy of shared features, while private latents retain more modality-specific information. The drop in decoding accuracy from the shared latents for baseline models clearly indicates that there is information leakage between modalities during training. + +information leakage may result in the blending of modalities, thereby yielding unreliable outcomes in the analysis of relationships between them. For example, in Section 4.2, we aimed to assess the variance explained by each latent subspace. However, if one latent subspace contains features from other modalities (as is prone to happen with the presence of a 'global' latent), it becomes unclear where specific features originate from, leading to ambiguities and confusion in interpreting the latent spaces. Here, we conducted a crucial test to ensure no information leakage between the different modalities. First, we shuffled the time series data while keeping the image data unchanged. We then applied this unpaired data to the trained model to generate new latent representations for both modalities. Using these latent representations, we proceeded with the decoding task. We observed that the decoding results from the latent representation remained unchanged for the unpaired data, confirming that no information leakage occurred between the modalities in Shared-AE (Table 4). This robust performance validates the integrity of the model in maintaining clear boundaries between the shared and private latent spaces, ensuring that shared information is genuinely mutual between the two modalities, and not due to unwanted information transfer or contamination. + +In contrast, baseline models demonstrated information leakage, as indicated by a noticeable drop in decoding accuracy when applied to similar tasks (Table 5, Appendix A.12.2). This performance decline highlights the strength of the Shared-AE model in preventing information leakage between modalities, making it a more reliable choice for multi-modal integration. Additionally, the baseline model fails to differentiate between private and shared features, which results in a lack of interpretability in the latent space. Ensuring a clear separation between shared and private latent variables is essential in multi-modal scenarios, especially when handling complex, high-dimensional data. This separation guarantees that the insights derived from the model accurately reflect the true underlying data patterns, rather than being influenced by data contamination. Furthermore, as shown in Appendix A.12.2, when the shared features across both modalities are weak, our model outperforms the rest. + +# 4.2 HEAD-FIXED BEHAVIOR: TWO-ALTERNATIVE FORCED CHOICE TASK (2AFC) + +We apply Shared-AE to an experimental dataset involving a head-fixed mouse performing a self-initiated visual discrimination task, with behavioral video recordings from two views (face and body), that included the mouse and experimental equipment. We labeled the paws, spouts, and levers using DeepLabCut (DLC). Simultaneously, WFCI across the mouse dorsal cortex was recorded. Further details on the experimental setup are in Appendix A.2.2 and recording / preprocessing details in Musall et al. (2019); Saxena et al. (2020). + +Two Modalities: keypoint positions and WFCI To explore shared information between pose-estimated behavioral variables and large-scale neural activity (WFCI), we trained Shared-AE with these two modalities. Based on reconstruction results (Appendix A.9.2), we chose a shared latent dimension of 50. Post-training, we extracted latent spaces from the held-out dataset for downstream analyses. We first compared the correlation between the shared latent spaces between the two modal + +![](images/3038b13b08c7091e56c4271f0dc3ae33978ede07ede51dd99ba5f71a5cef1438.jpg) +Figure 4: Head-fixed mouse: visualizing shared latents: (A) Correlation coefficients between the shared latent spaces: the matrix has a strong diagonal component, indicating that the shared latents are well aligned. (B) In the shared behavioral latent space, we can identify the latent variables that are most helpful in reconstructing each keypoint, and then identify the brain regions that these reconstruct. (C) We identify the regions involved in modulating each keypoint using the procedure in (B). (D) Variance explained for the shared behavioral latents, which indicates how the shared space contributes to the reconstruction of each behavioral variable (equipment in blue and body parts in yellow). E. Variance explained for the shared neural latents, which captures most features from the primary somatosensory and the primary motor area (Abbreviation list in Appendix A.1). + +ities. As shown in Fig. 4A, the shared latent spaces of behavioral and neural activities show a high correlation, whereas the private latent spaces do not exhibit this trait (Fig. 9A). Given the high correlation among the shared latents, we next examined the correspondence between the latent spaces and the different features in each modality, i.e., the keypoints and brain regions (Fig.4B). Specifically, we decoded body position and neural activity using each latent in the shared space, establishing a one-to-many correspondence between the latent variables and the underlying data. As illustrated in Fig. 4B, this process allows us to identify the corresponding brain regions for each body position. We see in Fig. 4C the primary brain regions involved with each behavioral variable; here, the contralateral side of the brain is shown to be related to each behavior. + +Next, we focus on the role of shared latent variables by isolating them from private latents and employing them to reconstruct the original data using a frozen decoder. This analysis reveals that the equipment in the experiment has considerable shared information with the neural activity since the mouse is performing a task, as compared to the mouse's body parts (Fig. 4D). Notably, the somatosensory and motor cortices have substantial shared information with the behavior (Fig. 4E). + +![](images/fba25b115f06fec28e0a2c47aba3df96dc790ac0f149fa30fcbcbd1fd2462efd.jpg) +Figure 5: Head-fixed mouse: shared neuro-behavioral motifs: A. UMAP representation of the shared neural and behavioral latent subspaces, color-coded by motifs learnt using Hidden Markov Models (HMMs) applied to the shared behavioral subspace; we see that the shared latent successfully captures behavioral motifs, and affords interpretability to the neural subspace.. B. The correspondence between each shared behavioral HMM state and brain regions (details in text). + +Finally, we examine whether the shared latents are able to generate reasonable shared neurobehavioral motifs. To understand this, we apply a Hidden Markov Model (HMM) to the shared behavioral subspace and evaluate its generalization to the shared neural latent in Fig. 5A. In contrast, the private neural latent space was unable to capture the patterns observed in the behavior, highlighting the importance of the shared latent space in identifying cross-modality relationships (Appendix A.13.3). We further calculate the correspondence between various HMM states and brain regions (Fig. 5B): for each HMM state, we compute the variance explained by the shared latent spaces towards each brain region; we only consider those brain regions that are represented with $R^2 > 0.3$ . This variance-explained analysis revealed important insights into how different brain regions were involved in distinct behavioral states. For instance, the visual cortex displayed a stronger response to equipment movement, likely reflecting the mouse's reliance on visual cues during task performance. Meanwhile, the somatosensory cortex was associated with nearly all of the identified motifs, suggesting that it played a central role in the task across multiple behaviors. + +In comparison with other multi-modal models such as MM-GP-VAE Gondur et al. (2024), PSID Sani et al. (2021), DPAD Sani et al. (2024), MM-VAE Shi et al. (2019), and Joint Encoding Model Singh Alvarado et al. (2021), we emphasize that Shared-AE has better decoding accuracy and offers significantly improved interpretability of the latent space, due to the capability of Shared-AE to form modality-specific shared subspaces. The configuration of each model can be found in Appendix A.13.1. To evaluate decoding accuracy, we trained a linear regression model on the training dataset to predict body position using the neural latent representations. In cases where a decoder was readily available during training, such as in PSID and DPAD, we directly used it to generate these predictions (Table 1, Appendix A.13.2). Additionally, we compared our model with the baseline models on unpaired datasets, where Shared-AE has better decoding accuracy (Appendix A.13.2). + +Table 1: Behavioral decoding accuracy with paired modalities for 2AFC body positions dataset + +
SubspacePSIDDPADMM-VAEMM-GP-VAEShared-AE
Private latentsNANANA0.37 ± 0.000.22 ± 0.03
Shared latents0.20 ± 0.030.27 ± 0.020.41 ± 0.070.36 ± 0.010.41 ± 0.05
+ +Two Modalities: behavioral video and neural activity To test the generalization of our model, we apply Shared-AE to the same head-fixed dataset, while changing the behavioral modality from keypoints to high-dimensional behavioral images. We see a high correlation between the shared behavioral and neural latents (Appendix 9C). Using latent traversals, which systematically vary the latent variables to reveal their influence on the model's output and help identify specific behavioral features encoded in the latent space, we demonstrate that the shared behavioral latent captures the movements of the paw, spout, and lever (Fig. 15A). The private latent however captures the appearance of the mouse such as the shape of the eyes (Appendix A.13.4). Additionally, we compare the neural encoding results using shared behavioral latents with (i) the behavioral videos, and (ii) the keypoint positions being the behavioral modality. We found that during task-unrelated behaviors, such as raising the left and right paws, the images' shared behavioral latents show significantly higher accuracy for encoding the visual and motor areas (Fig. 15B, Appendix A.11). The behavioral image captures more features than just keypoint positions, which is consistent with the findings reported in the original paper. (Musall et al. (2019)). Moreover, unlike models such as PSID, Shared-AE can handle image data, providing greater flexibility for complex multimodal tasks. As shown in Appendix A.13.2, Shared-AE outperformed the baseline models. + +Three Modalities: body position, behavioral video, and neural activity Shared-AE can be extended to more than two modalities; here, we show this capability using body positions, behavioral videos, and neural activity from the head-fixed mouse dataset. The shared latent spaces of these three modalities are highly correlated (Appendix 9B). To test whether the shared neural latents capture details about the behavior, we predicted future keypoint positions and compared this to predictions using shared neural latents from two modalities. Results show higher accuracy in predicting right paw movement with the three-modality model, especially for potentially task-unrelated states such as 'right paw raise', while task-related predictions remain comparable to the two-modality model. + +# 4.3 SOCIAL BEHAVIOR + +To further evaluate the performance of our model in a more complex behavioral setting, we conducted experiments on a social behavior dataset. In this scenario, two mice, referred to as the agent (m1) and subject (m2), were engaged in social interactions, while mesoscopic imaging was simultaneously performed using a large field-of-view miniscope on the subject. For more information, see + +Appendix A.2.3. The body positions of the two mice were labeled by DLC (Lauer et al. (2021)), while the neural activity was preprocessed by LocaNMF (Saxena et al. (2020)). In addition to tracking the body positions, we extracted several socially-relevant behavioral features, such as the nose-to-nose distance between the two mice, the relative angle between their body orientations, and other key interaction metrics. These behavioral features allowed us to quantify the complexity of social behaviors and understand their relationships with neural activity. + +Based on the reconstruction accuracy (Appendix A.9.3), we set the latent dimension to be 60. We apply principal component analysis (PCA) to the shared latent spaces and show high correlations across the dominant PCs of the different shared latent subspaces (Fig. 6A). The private latent spaces do not exhibit this trait (Appendix A.10.3). The latents effectively capture the temporal features, and the neural and behavioral latents are well aligned (Fig. 6B). + +Next, we perform latent traversals to visualize the contribution of each latent space. As expected, as shown in Fig. 6C, the shared neural latents capture a higher $R^2$ for the subject's behavior as compared to the agent's. This supports the idea that neural encoding primarily reflects the subject's perspective and interaction within the environment. However, the shared behavioral latents also capture the agent's behavior and many social features, such as the nose-to-tail distance, suggesting that proximity to the agent and the agent's behavior itself plays a significant role in modulating neural activity. Furthermore, the shared neural latents show widespread activation across regions, including the somatosensory and motor areas (Fig. 6D). These areas are critical for movement and sensory integration, further validating the model's capacity to identify relevant neural substrates that underpin behavior. This alignment between neural activity and behavior underscores the robustness of the shared latent representations in capturing social dynamics in multi-agent settings. + +![](images/3b1e650244f487c28403351d1dce4c82d6150471dd8418ba85e54c1efc27e6a6.jpg) +Figure 6: Socially behaving mice: A. Example neural and behavioral data (top); correlation between the shared latent spaces (bottom). B. Lower dimensional embedding for each modality found using PCA, color-coded by the time spent in the arena. C-D: Variance explained by each shared latent subspace: the shared behavioral latents capture features related to subject and agent, as well as some social features, represented in the shared neural subspace with distributed neural coding. + +# 5 CONCLUSION AND LIMITATIONS + +This paper introduces Shared-AE, an AE-based framework using CS regularization to identify features common to both behavior and neural activity, especially useful in settings where both modalities are high-dimensional and represent complex behavior. By utilizing CS divergence and its inverse, Shared-AE captures both shared and unique features across modalities, enhancing our understanding of the relationship between neural activity and behavior. Despite its numerous hyperparameters, the model remains robust when well-trained. Limitations include its requirement for equal latent subspace (Appendix A.5) dimensions, which can be inflexible, and its generalizability across multiple subjects is uncertain. Overall, Shared-AE is a robust tool for multi-modal research. Future work will explore more complex encoder models and pre-trained networks to improve training efficiency and the ability to capture informative features. Here, we aim to achieve neuroscientific insight, and do not note any negative societal impact. + +# ACKNOWLEDGMENTS + +We gratefully acknowledge support from the NIH Brain Initiative 1R34DA059718-01 and NSF NCS 2350329. We thank Nancy Padilla-Coreano for helpful discussions. + +# REFERENCES + +Allen Institute for Cell Science Allen Institute for Brain Science. Technical white paper: Allen mouse common coordinate framework and reference atlas. Technical report. URL https://community.brain-map.org/t/ documentation-mouse-connectivity-atlas/2940. +Tadas Baltrusaitis, Chaitanya Ahuja, and Louis-Philippe Morency. Multimodal machine learning: A survey and taxonomy, 2017. +Eleanor Batty, Matthew Whiteway, Shreya Saxena, Dan Biderman, Taiga Abe, Simon Musall, Winthrop Gillis, Jeffrey Markowitz, Anne Churchland, John P Cunningham, Sandeep R Datta, Scott Linderman, and Liam Paninski. Behavenet: nonlinear embedding and bayesian neural decoding of behavioral videos. In H. Wallach, H. Larochelle, A. Beygelzimer, F. d'Alché-Buc, E. Fox, and R. Garnett (eds.), Advances in Neural Information Processing Systems, volume 32. Curran Associates, Inc., 2019. URL https://proceedings.neurips.cc/paper/2019/file/a10463df69e52e78372b724471434ec9-Paper.pdf. +Gordon J. Berman, Daniel M. Choi, William Bialek, and Joshua W. Shaevitz. Mapping the stereotyped behaviour of freely moving fruit flies. Journal of The Royal Society Interface, 11(99):20140672, 2014. doi: 10.1098/rsif.2014.0672. URL https://royalsocietypublishing.org/doi/abs/10.1098/rsif.2014.0672. +Manuel Brenner, Florian Hess, Georgia Koppe, and Daniel Durstewitz. Integrating multimodal data for joint generative modeling of complex dynamics, 2024. +Chris Burgess and Hyunjik Kim. 3d shapes dataset. https://github.com/deepmind/3dshapes-dataset/, 2018. +Jessica A. Cardin, Michael C. Crair, and Michael J. Higley. Mesoscopic imaging: Shining a wide light on large-scale neural dynamics. Neuron, 108:33-43, 2020. URL https://apisemantic scholar.org/CorpusID:222349681. +Mark M. Churchland, John P Cunningham, Matthew T. Kaufman, Justin D. Foster, Paul Nuyujukian, Stephen I. Ryu, and Krishna V. Shenoy. Neural population dynamics during reaching. Nature, 487:51-56, 2012. URL https://api-semanticscholar.org/CorpusID:934107. +Rabia Gondur, Usama Bin Sikandar, Evan Schaffer, Mikio Christian Aoi, and Stephen L Keeley. Multi-modal gaussian process variational autoencoders for neural and behavioral data. In The Twelfth International Conference on Learning Representations, 2024. URL https://openreview.net/forum?id=aGH43rjoe4. +Robert Jenssen, Jose C. Principe, Deniz Erdogmus, and Torbjørn Eltoft. The cauchy-schwarz divergence and parzen windowing: Connections to graph theory and mercer kernels. Journal of the Franklin Institute, 343(6):614-629, 2006. ISSN 0016-0032. doi: https://doi.org/10.1016/j.jfranklin.2006.03.018. URL https://www.sciencedirect.com/science/article/pii/S0016003206000767. Winners of the student paper competition at the 2005 IEEE International Conference on Acoustics Speech and Signal Processing (ICASSP) held in Philadelphia PA, provide the state-of-art in their fields of research. +Kittipat Kampa, Erion Hasanbelliu, and Jose C. Principe. Closed-form cauchy-schwarz pdf divergence for mixture of gaussians. In The 2011 International Joint Conference on Neural Networks, pp. 2578-2585, 2011. doi: 10.1109/IJCNN.2011.6033555. +Jack Klys, Jake Snell, and Richard Zemel. Learning latent subspaces in variational autoencoders. Advances in neural information processing systems, 31, 2018. + +Evelyn Lake and Michael Higley. Building bridges: simultaneous multimodal neuroimaging approaches for exploring the organization of brain networks. Neurophotonics, 9, 09 2022. doi: 10.1117/1.NPh.9.3.032202. +Evelyn Lake, Xinxin Ge, Xilin Shen, Peter Herman, Fahmeed Hyder, Jessica Cardin, Michael Higley, Dustin Scheinost, Xenophon Papademetris, Michael Crair, and Robert Constable. Simultaneous cortex-wide fluorescence ca imaging and whole-brain fmri. Nature Methods, 17: 1-10, 12 2020. doi: 10.1038/s41592-020-00984-6. +Jessy Lauer, Mu Zhou, Shaokai Ye, William Menegas, Tanmay Nath, Mohammed Mostafizur Rahman, Valentina Di Santo, Daniel Soberanes, Guoping Feng, Venkatesh N. Murthy, George V. Lauder, Catherine Dulac, Mackenzie W. Mathis, and Alexander Mathis. Multi-animal pose estimation and tracking with deepabcut. bioRxiv, 2021. +Ran Liu, Mehdi Azabou, Max Dabagia, Chi Heng Lin, Mohammad Gheshlaghi Azar, Keith B. Hen- gen, Michal Valko, and Eva L. Dyer. Drop, swap, and generate: A self-supervised approach for generating neural activity. In Marc'Aurelio Ranzato, Alina Beygelzimer, Yann Dauphin, Percy S. Liang, and Jenn Wortman Vaughan (eds.), Advances in Neural Information Processing Systems 34 - 35th Conference on Neural Information Processing Systems, NeurIPS 2021, Advances in Neural Information Processing Systems, pp. 10587-10599. Neural information processing systems foundation, 2021. Publisher Copyright: © 2021 Neural information processing systems foundation. All rights reserved.; 35th Conference on Neural Information Processing Systems, NeurIPS 2021 ; Conference date: 06-12-2021 Through 14-12-2021. +Kevin Luxem, Petra Mocellin, Falko Fuhrmann, Johannes Kursch, Stefan Remy, and Pavol Bauer. Identifying behavioral structure from deep variational embeddings of animal motion. bioRxiv, 2022. doi: 10.1101/2020.05.14.095430. URL https://www.biorxiv.org/content/early/2022/01/14/2020.05.14.095430. +Simon Musall, Matthew T. Kaufman, Ashley L Juavinett, Steven Gluf, and Anne K. Churchland. Single-trial neural dynamics are dominated by richly varied movements. Nature neuroscience, 22:1677 - 1686, 2019. +Chethan Pandarinath, Daniel J. O'Shea, Jasmine Collins, Rafal Józefowicz, Sergey D. Stavisky, Jonathan C. Kao, Eric M. Trautmann, Matthew T. Kaufman, Stephen I. Ryu, Leigh R. Hochberg, Jaimie M. Henderson, Krishna V. Shenoy, L. F. Abbott, and David Sussillo. Inferring single-trial neural population dynamics using sequential auto-encoders. Nature methods, 15:805 - 815, 2017. URL https://api-semanticscholar.org/CorpusID:1122815. +Talmo Pereira, Joshua Shaevitz, and Mala Murthy. Quantifying behavior to understand the brain. Nature Neuroscience, 23:1537-1549, 12 2020. doi: 10.1038/s41593-020-00734-z. +Talmo Pereira, Nathaniel Tabris, Arie Matslieh, David Turner, Junyu Li, Shruthi Ravindranath, Eleni Papadoyannis, Edna Normand, David Deutsch, Z. Wang, Grace McKenzie-Smith, Catalin Mitetlut, Marielisa Castro, John D'Uva, Mikhail Kislin, Dan Sanes, Sarah Kocher, Samuel Wang, Annegret Falkner, and Mala Murthy. Sleep: A deep learning system for multi-animal pose tracking. Nature Methods, 19:1-10, 04 2022. doi: 10.1038/s41592-022-01426-1. +Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, Gretchen Krueger, and Ilya Sutskever. Learning transferable visual models from natural language supervision, 2021. +Omid Sani, Biban Pesaran, and Maryam Shanechi. Dissociative and prioritized modeling of behaviorally relevant neural dynamics using recurrent neural networks. Nature Neuroscience, 27: 2033-2045, 09 2024. doi: 10.1038/s41593-024-01731-2. +Omid G Sani, Hamidreza Abbaspourazad, Yan T Wong, Bijan Pesaran, and Maryam M Shanechi. Modeling behaviorally relevant neural dynamics enabled by preferential subspace identification. Nature neuroscience, 24(1):140-149, January 2021. ISSN 1097-6256. doi: 10. 1038/s41593-020-00733-0. URL https://www.biorxiv.org/content/biorxiv/ early/2019/10/17/808154.full.pdf. + +Eder Santana, Matthew Emigh, and Jose Principe. Information theoretic-learning auto-encoder. 03 2016. +Shreya Saxena, Ian Kinsella, Simon Musall, Sharon H. Kim, Jozsef Meszaros, David N. Thibodeaux, Carla Kim, John Cunningham, Elizabeth M. C. Hillman, Anne Churchland, and Liam Paninski. Localized semi-nonnegative matrix factorization (locanmf) of widefield calcium imaging data. PLOS Computational Biology, 16(4):1-28, 04 2020. doi: 10.1371/journal.pcbi.1007791. URL https://doi.org/10.1371/journal.pcbi.1007791. +Steffen Schneider, Jin Hwa Lee, and Mackenzie Weygandt Mathis. Learnable latent embeddings for joint behavioural and neural analysis. Nature, May 2023. ISSN 1476-4687. doi: 10.1038/s41586-023-06031-6. URL https://doi.org/10.1038/s41586-023-06031-6. +Yuge Shi, N. Siddharth, Brooks Paige, and Philip H. S. Torr. Variational mixture-of-experts autoencoders for multi-modal deep generative models, 2019. URL https://arxiv.org/abs/1911.03393. +Yuge Shi, Brooks Paige, Philip H. S. Torr, and N. Siddharth. Relating by contrasting: A data-efficient framework for multimodal generative models, 2021. +Jonathan Singh Alvarado, Jack Goffinet, Valerie Michael, William Liberti, Jordan Hatfield, Timothy Gardner, John Pearson, and Richard Mooney. Neural dynamics underlying birdsong practice and performance. Nature, 599(7886):635-639, November 2021. ISSN 0028-0836. doi: 10.1038/s41586-021-04004-1. URL https://europepmc.org/articles/PMC9118926. +Sandra Steyaert, Marija Pizurica, Divya Nagaraj, Priya Khandelwal, Tina Hernandez-Boussard, Andrew Gentles, and Olivier Gevaert. Multimodal data fusion for cancer biomarker discovery with deep learning. Nature Machine Intelligence, 5, 04 2023. doi: 10.1038/s42256-023-00633-5. +Yonglong Tian, Dilip Krishnan, and Phillip Isola. Contrastive multiview coding, 2020. +Linh Tran, Maja Pantic, and Marc Peter Deisenroth. Cauchy-schwarz regularized autoencoder, 2021. URL https://arxiv.org/abs/2101.02149. +Matthew R Whiteway, Dan Biderman, Yoni Friedman, Mario Dipoppa, E Kelly Buchanan, Anqi Wu, John Zhou, Niccolò Bonacchi, Nathaniel J Miska, Jean-Paul Noel, Erica Rodriguez, Michael Schartner, Karolina Socha, Anne E Urai, C Daniel Salzman, The International Brain Laboratory, John P Cunningham, and Liam Paninski. Partitioning variability in animal behavioral videos using semi-supervised variational autoencoders. bioRxiv, 2021. doi: 10.1101/2021.02.22.432309. URL https://www.biorxiv.org/content/early/2021/09/01/2021.02.22.432309. +Alexander B. Wiltschko, Matthew J. Johnson, Giuliano Iurilli, Ralph E. Peterson, Jesse M. Katon, Stan L. Pashkovski, Victoria E. Abraira, Ryan P. Adams, and Sandeep Robert Datta. Mapping sub-second structure in mouse behavior. Neuron, 88(6):1121-1135, 2015. ISSN 0896-6273. doi: https://doi.org/10.1016/j.neuron.2015.11.031. URL https://www.sciencedirect.com/science/article/pii/S0896627315010375. +Daiyao Yi, Simon Musall, Anne Churchland, Nancy Padilla-Coreano, and Shreya Saxena. Disentangled multi-subject and social behavioral representations through a constrained subspace variational autoencoder (cs-vae). bioRxiv, 2022. doi: 10.1101/2022.09.01.506091. URL https://www.biorxiv.org/content/early/2022/09/05/2022.09.01.506091. +Yu-Dong Zhang, Zhengchao Dong, Shui-Hua Wang, Xiang Yu, Xujing Yao, Qinghua Zhou, Hua Hu, Min Li, Carmen Jiménez-Mesa, Javier Ramirez, Francisco J. Martinez, and Juan Manuel Gorriz. Advances in multimodal data fusion in neuroimaging: Overview, challenges, and novel orientation. Information Fusion, 64:149-187, 2020. ISSN 1566-2535. doi: https://doi.org/10.1016/j.inffus.2020.07.006. URL https://www.sciencedirect.com/science/article/pii/S1566253520303183. +Ding Zhou and Xue-Xin Wei. Learning identifiable and interpretable latent models of high-dimensional neural activity using pi-vae. In H. Larochelle, M. Ranzato, + +R. Hadsell, M.F. Balcan, and H. Lin (eds.), Advances in Neural Information Processing Systems, volume 33, pp. 7234-7247. Curran Associates, Inc., 2020. URL https://proceedings.neurips.cc/paper_files/paper/2020/file/510f2318f324cf07fce24c3a4b89c771-Paper.pdf. + +# A APPENDIX + +# A.1 ABBREVIATION LIST + +A detailed abbreviation list for different brain regions can be found at Allen Institute for Brain Science + +# A.2 DATASET + +# A.2.1 DATASET: 3DSHAPE + +The 3DShapes dataset is composed of procedurally generated 3D objects, each defined by six independent ground truth latent factors: floor color, wall color, object color, scale, shape, and orientation. Every possible combination of these factors is uniquely represented, resulting in a dataset of 480,000 images. For our task, we converted the images to grayscale to remove the color-related features, leaving three key attributes: (1) scale, with 8 values linearly spaced between 0 and 1, (2) shape, with 4 distinct categories [0, 1, 2, 3], and (3) orientation, with 15 values linearly spaced between -30 and 30 degrees. For the labels, we retained the scale and orientation values and introduced a temporally-structured noise that periodically changes between one and four. For time efficiency, we applied 8000 images for training and 2000 images for testing. + +# A.2.2 DATASET: TWO-ALTERNATIVE FORCED CHOICE TASK (2AFC) + +We employed a subset of the behavioral dataset from Musall et al. (2019). The task involved mice pressing a lever to start, displaying a visual stimulus to the left or right, and then making a decision by licking a spout corresponding to the stimulus direction after a delay. Correct choices were rewarded with juice. Behavior and neural activity were recorded at $30\mathrm{Hz}$ . The training set consists of 388 trials, and the test set contains 128 trials, each comprising 189 frames. + +# A.2.3 DATASET:SOCIALBEHAVIOR + +Our study used a social behavior dataset involving simultaneous brain mesoscopic imaging and natural behavior recording in mice. Mesoscopic imaging was performed using a large field-of-view miniscope, while behavior was captured by three cameras at different angles. Two GCaMP6-expressing mice (slc17a7-cre x ai162) were observed in a cubic box arena, with one mouse equipped with a miniscope. The video, around 18 minutes long, was split into 326 chunks, with a 3:1 training to test data ratio. Social features such as nose-to-nose distance, tail-to-nose distance, speed, and angle between mice were calculated, resulting in 37 features in the behavioral datasets. + +# A.3 TECHNICAL AND SCIENTIFIC NOVELTY OF SHARED-AE + +Shared-AE introduces a novel approach to joint neural and behavioral modeling, addressing key limitations in existing methods and offering several distinct advantages: + +(a) Enhanced Interpretability through Latent Subspace Separation: Unlike the model by Gondur et al. (2024), which combines neural and behavioral latents into a single subspace, Shared-AE explicitly separates shared and private latent spaces. This separation preserves interpretability by reducing information leakage across modalities, allowing us to better disentangle distinct modality-specific features. Indeed, having common shared subspaces can be detrimental towards interpretability, since it is unclear which modality is leading to the performance of the shared latent. As an additional key consequence of modality-specific shared subspaces, if we only have data from one modality during inference, we do not require data from the other modalities to generate robust and meaningful representations. + +(b) Improved Performance on Paired and Unpaired Tasks: We designed an 'unpaired' task to ensure there is no information leakage between different modalities. Critically, after training the model, if one modality's data is corrupted during inference, this should not affect the other modality's latent representation or decodability. Here, during inference only, one modality was shuffled across time, while the other modality remained unchanged. The resulting 'unpaired' data was then input into the trained model to generate new latent representations for the unshuffled modality. This approach allowed us to assess whether the model could maintain the integrity of the + +unshuffled modality's latent features, ensuring that the latent representations were unaffected by the shuffled modality. We compared Shared-AE against existing approaches on the 2AFC dataset (as requested by the reviewers), demonstrating superior performance in both paired and unpaired tasks (Table 11, 12). Shared-AE outperforms other models by effectively capturing complex relationships across modalities, and preserves information in one modality even when the other modality may be corrupted during inference. This robustness is crucial for practical applications where complete data may not always be available. + +(c) Flexibility with Multiple Modalities and Image Data: Shared-AE is designed to handle more than three modalities, including image data, significantly broadening its application scope from previous research; in fact, this capability has not previously been shown in any multi-modal neuroscience study. As shown in Figure 6B, using raw behavioral images as well as pose estimation leads to better prediction accuracy of neural activity compared to using pose estimation alone. This finding aligns with Musall et al. (2019), indicating that raw image data provides a richer representation of behavior. In contrast, existing models such as PSID are limited in processing data from more than two modalities effectively. +(d) Minimizing Distribution Distance Instead of Predefined Priors: Previous works such as Yi et al. (2022) and Tran et al. (2021) do indeed use a CS-divergence, but in a drastically different way than in our study: they use CS-divergence to fit the latent distribution to a predefined prior, whereas Shared-AE minimizes the distance between two learned distributions instead. This approach avoids the limitations of predefined priors and allows for more flexible and meaningful representations. +(e) Utility in Downstream Tasks and Enhanced Variance Explained: By separating the latent features into distinct shared and private subspaces, Shared-AE provides representations that can be effectively used for multiple downstream tasks. + +# A.4 CS INEQUALITY + +For two functions $h(x)$ and $g(x)$ , the Cauchy-Schwarz inequality is expressed as: + +$$ +\left| \int h (x) g (x) d x \right| ^ {2} \leq \int | h (x) | ^ {2} d x \int | g (x) | ^ {2} d x \tag {8} +$$ + +with equality holding if and only if the two functions are linearly dependent. + +# A.5 EQUAL LATENT SUBSPACE DIMENSIONS + +Mathematically, the CS-divergence requires both distributions to have the same dimensionality, allowing for the calculation of cosine similarity after kernelizing the latent representations. In practice, as illustrated in Fig. 2, the dimensionality of the latent space often exceeds the actual number of features. This implies that when the latent dimension is large, there may be redundancy in each latent subspace. To overcome this limitation in practice, we perform dimensionality reduction on the latent subspaces after training, especially for visualization purposes. + +# A.6 RELATIONSHIP BETWEEN VAE AND THE CS REGULARIZED AE + +For a standard VAE with a Gaussian prior, the Evidence Lower Bound (ELBO) is defined as: + +$$ +\begin{array}{l} E L B O = \mathbb {E} _ {\hat {z} \sim q _ {\phi} (z | x)} \left[ \log p _ {\theta} (x | \hat {z}) + \log p _ {\theta} (\hat {z}) \right] + \mathbb {H} \left[ q _ {\phi} (\hat {z} | x) \right] (9) \\ = \mathbb {E} _ {\hat {z} \sim q _ {\phi} (z | x)} \left[ \log p _ {\theta} (x | \hat {z}) \right] + \mathbb {E} _ {\hat {z} \sim q _ {\phi} (z | x)} \left[ \log p _ {\theta} (\hat {z}) \right] + \mathbb {H} \left[ q _ {\phi} (\hat {z} | x) \right] (10) \\ = \mathbb {E} _ {\hat {z} \sim q _ {\phi} (z | x)} \left[ \log p _ {\theta} (x | \hat {z}) \right] - D _ {K L} \left(q _ {\phi} (\hat {z} | x) \| p _ {\theta} (z)\right) (11) \\ \end{array} +$$ + +Where $x$ is the input, $z \sim \mathcal{N}(0,1)$ , $\hat{z}$ is the learned latent, and $p_{\theta}(x|\hat{z}) = \mathcal{N}(\mu_{nn}(z),\sigma_{nn}(z))$ . During training, the goal is to maximize the ELBO. Therefore, the objective function is written as: + +$$ +\mathcal {L} _ {\mathcal {N}} = D _ {K L} \left(q _ {\phi} (\hat {z} | x) | | p (z)\right) - \mathbb {E} _ {\hat {z} \sim q (z | x)} \left[ \log p _ {\theta} (x | \hat {z}) \right] \tag {12} +$$ + +In contrast, our model, Shared-AE, utilizes the CS-divergence for regularization. Unlike the VAE, which employs KL divergence to measure the difference between the approximate posterior and + +the prior, Shared-AE leverages the CS divergence to encourage the alignment of the approximate posterior with the prior, enhancing flexibility in capturing the underlying structure of the data. + +To place Shared-AE in a probabilistic framework, we consider the objective to maximize the log marginal likelihood of the model, as below (Tran et al. (2021)). + +$$ +\max _ {\theta} \mathbb {E} [ \log p _ {\theta} (x) ] = \max _ {\theta} \mathbb {E} _ {p (x)} \left[ \log \mathbb {E} _ {p (z)} [ p _ {\theta} (x | \hat {z}) ] \right], \tag {13} +$$ + +Using Jensen's inequality, we can obtain a lower bound to the log-marginal likelihood as follows: + +$$ +\log p _ {\theta} (x) = \log \mathbb {E} _ {\hat {z} \sim p (z)} [ p _ {\theta} (x | \hat {z}) ] \geq \mathbb {E} _ {\hat {z} \sim p (z)} [ \log p _ {\theta} (x | \hat {z}) ]. \tag {14} +$$ + +Similarly, as in the VAE framework, we define a mapping $q_{\phi}(z|x)$ which transforms some input $x$ to (probabilistic) features $z$ . By adding a regularization $R$ , we penalize any deviation between $q_{\phi}(z|x)$ from $p(z)$ . Ideally, this regularization is a metric function for which $R > 0$ when $q \neq p$ and $R = 0$ if and only if $q = p$ . + +$$ +\max _ {\theta , \phi} \mathbb {E} _ {p (x)} \mathbb {E} _ {\hat {z} \sim q _ {\phi} (z | x)} [ \log p _ {\theta} (x | \hat {z}) ] \tag {15} +$$ + +$$ +\text {s u b j e c t} 0 \leq R \left(q _ {\phi}\right) < \epsilon . \tag {16} +$$ + +In this formulation, $\epsilon$ specifies the magnitude of the applied constraint. If $R$ is defined as the KL divergence, we have the original ELBO formulation. We diverge from this principle and use the Cauchy-Schwarz divergence for regularization to match an approximate posterior to a prior, with the advantage of added flexibility and expressiveness. Thus, the objective function is given by: + +$$ +\max _ {\theta , \phi} \mathbb {E} _ {p (x)} \left[ \mathbb {E} _ {\hat {z} \sim q _ {\phi} (z | x)} \left[ \log p _ {\theta} (x | \hat {z}) \right] \right] \tag {17} +$$ + +$$ +\text {s u b j e c t} D _ {C S} \left(q _ {\phi} (\hat {z} | x) \| p (z)\right) < \epsilon . \tag {18} +$$ + +Rewriting this as a Lagrangian, we obtain: + +$$ +\mathcal {F} (x; \theta , \phi , \lambda) = \mathbb {E} _ {\hat {z} \sim q _ {\phi} (z | x)} [ \log p _ {\theta} (x | \hat {z}) ] - \lambda \left(D _ {C S} \left(q _ {\phi} (\hat {z} | x) \| p (z)\right) - \epsilon\right), \tag {19} +$$ + +where $\lambda$ is the regularization coefficient ensuring that the posterior distribution is close to the prior $p(z)$ . We can rewrite this as: + +$$ +\mathcal {F} (x; \theta , \phi , \lambda) \geq \mathbb {E} _ {\hat {z} \sim q _ {\phi} (z | x)} [ \log p _ {\theta} (x | \hat {z}) ] - \lambda D _ {C S} \left(q _ {\phi} (\hat {z} | x) \| p (z)\right) =: L _ {C S - A E} (x; \theta , \phi , \lambda). \tag {20} +$$ + +While VAEs rely on KL divergence to regularize the latent space and align the approximate posterior with the Gaussian prior, CS-AE uses CS divergence, allowing for more flexible and potentially richer latent space representations. Moreover, our formulation in Shared-AE further defines a specific set of latent variables from one modality to regularize using the latent variables obtained from a different modality, to elucidate the shared structure in the data. + +# A.7 TRAINING DETAILS + +All models were trained and tested on a single NVIDIA A100 using PyTorch 2.0.1. For our dataset, the runtime per batch varied based on the modalities used: approximately 0.398 seconds for keypoint positions and neural activity, 4.523 seconds for behavioral images and neural activity, and 5.575 seconds for keypoint positions, behavioral images, and neural activity. Each model was trained for 100 epochs with a batch size of 256, using the Adam optimizer with a learning rate of $1e - 4$ . + +# A.7.1 3DSHAPE + +For each input, we applied a window size of one. A 2D ResNet-18 backbone was used for image input, and a 1D ResNet-18 backbone for time series data. A 2-layer 2D convolutional decoder was applied to image data and a 2-layer 1D convolutional decoder to time series data. For classification tasks, scale and orientation are the shared features between image and time series data. The shape is the image-only feature while the temporally-structured noise is the time series-only feature. + +# A.7.2 2AFC + +A sequence of 9 frames was stacked together, based on the HMM output of keypoint positions. Each sequence spans approximately 0.3 seconds. For keypoint positions and neural activity, a 1D ResNet-18 backbone was used for encoding, and a 4-layer 2D convolutional decoder for behavioral images and a 2-layer 1D convolutional decoder for keypoint positions and neural activity. + +# A.7.3 SOCIAL BEHAVIOR + +A sequence of 8 frames was stacked together based on the HMM output of keypoint positions. A 1D ResNet-18 encoder and a 2-layer 1D convolutional decoder were used for both modalities. + +# A.8 STATISTIC TESTS + +We performed t-tests on the test dataset and used the p-value to determine the significance of our results. The p-value annotation legend is: + +$$ +\left\{ \begin{array}{l l} \mathrm {n s :} & 5. 0 0 \times 1 0 ^ {- 2} < p \leq 1. 0 0 \times 1 0 ^ {0} \\ *: & 1. 0 0 \times 1 0 ^ {- 2} < p \leq 5. 0 0 \times 1 0 ^ {- 2} \\ * *: & 1. 0 0 \times 1 0 ^ {- 3} < p \leq 1. 0 0 \times 1 0 ^ {- 2} \\ * * *: & 1. 0 0 \times 1 0 ^ {- 4} < p \leq 1. 0 0 \times 1 0 ^ {- 3} \\ * * * *: & p \leq 1. 0 0 \times 1 0 ^ {- 4} \end{array} \right. +$$ + +# A.9 HYPERPARAMETER SEARCH + +This section describes the procedures for selecting parameters. Due to the nature of the loss, each subspace should have the same number of latent dimensions. + +# A.9.1 3DSHAPE + +The original dataset includes 6 different features. To simplify the dataset, we grayscale the images to have only 3 features. For better reconstruction accuracy, we choose the latent dimensions equal to 5. The mean MSE loss for the image and the mean R2 for the time series are $0.23\mathrm{e}5$ and $0.98 \pm 0.007$ , respectively. The kernel size is set to 15 and the weight for all the CS and inverse loss terms is 10. + +The final training CS loss for the shared latent space is 0.0009; the inverse CS loss is $9.78 \pm 0.03$ for the individual shared and private latent spaces; the inverse CS loss for the private latent space of different modalities is 9.78. + +# A.9.2 2AFC + +We choose the latent dimension based on the reconstruction accuracy using 5-fold cross-validation: the smallest value when the MSE loss converged. For keypoint positions, 7 different parts are encountered, and we show the mean and maximum $R^2$ values for all keypoints. Similarly, for neural activity with 21 different regions, we show the mean and maximum $R^2$ values across all brain regions (Figure 7). We evaluated the decoding accuracy of body positions using shared neural latents with varying latent dimensions: 50, 80, and 100. As shown in Table 2, the decoding accuracy remains relatively consistent across these dimensions, indicating that the model's performance is robust to changes in latent dimensionality. For this dataset, we chose a latent dimension equal to 50. The held-out data served as the test set on which all the results are reported. For a two-modality + +Table 2: Behavioral decoding accuracy with various latent dimensions using Shared-AE for 2AFC dataset + +
5080100
Shared neural latent0.41 ± 0.050.43 ± 0.030.42 ± 0.04
+ +task with the image as the behavioral input, the reconstruction result for the image is evaluated by $MSE$ . We choose 85 as the latent dimension. For the three modalities tasks, we choose the latent dimension to be 85 for comparison. The mean MSE loss and the mean $R^2$ are comparable to the two modality results being $0.1e - 5$ and $0.65 \pm 0.2$ , respectively. + +For other hyperparameters, we set the kernel size $\sigma$ for this dataset to be 15 (Yi et al. (2022)). For simplification, we set $\alpha, \beta, \gamma$ , and $\theta$ to be the same, all of them equal 5. The results are robust to changes in these hyperparameters, as long as the losses converge to a certain range. In Table 3, we + +![](images/aea5538e34567dd2fda8452e2b1834d827711d912dcb579ffa4ae2537a126140.jpg) + +![](images/825b7f43f1d81731624b80b532d6f20ed8f0f6ce2c62b7630a1ecd908e58b815.jpg) + +![](images/dcf7e2183a7fa427862666b8887f62a2fd3fc84eb0353426f87f1fd5c9259bfd.jpg) +Figure 7: Reconstruction accuracy for different datasets with different latent dimensions. The mean $\mathbb{R}^2$ represents the average accuracy across all keypoint positions and neural channels, while the max $\mathbb{R}^2$ indicates the maximum accuracy observed among these keypoints and channels. This distinction helps capture both the overall performance and the peak accuracy of our model across different features, providing a more comprehensive evaluation of its predictive capabilities: A. 2AFC: 2 modal tasks with keypoint positions and neural activity B. 2AFC: 2 modal tasks with behavioral image and neural activity C. social behavior: 2 modal tasks with keypoint positions and neural activity + +include the after-training CS divergence loss for each task. For simplicity, we calculated the mean value of the inverse CS loss for the same modality (reported before inversion). + +Table 3: CS loss and inverse CS loss values for head fixed dataset + +
taskscs loss for shared latentsinverse cs loss for the same modalinverse cs loss for different modal
keypoint positions+ neural activity0.018.65 ± 0.056.77
image+ neural activity0.0198.59 ± 0.0075.16
+ +# A.9.3 SOCIAL BEHAVIOR + +According to the reconstruction plot in Fig.7C, we chose 60 as the number of latent dimensions. The kernel size is set to 15 and the weight for all the CS and inverse loss terms is 10. The final training CS loss for the shared latent space is 0.006; the inverse CS loss is $8.35 \pm 0.3$ for the individual shared and private latent spaces; the inverse CS loss for the private latent space of different modalities is 6.99. + +# A.10 CORRELATION COEFFICIENT FOR DIFFERENT LATENT SUBSPACES + +# A.10.1 3DSHAPE + +The correlation coefficient matrices for different latent subspaces are shown in Fig. 8. Despite some correlations between the shared and private image latent spaces, the other subspaces are well separated. + +![](images/0e23ea086678c7c048fd1504df0077cdc60f6c16257209d587d64e781dfb240c.jpg) +Figure 8: 3Dshape: Correlation coefficient for different latent subspaces. + +![](images/4fa613aaca9341f26c755b9b39b7c7acb0bdf152088441c52de0d1089dec143b.jpg) + +![](images/eafb163201053feebd17555c50a2438065c8348dd3144ffc609f3ca18ea01bb2.jpg) + +# A.10.2 2AFC + +The correlation coefficient matrices for different latent subspaces are shown in Fig. 9. As expected, the shared latents exhibit high correlations, while the shared and private latents for the same modality show lower correlations. + +# A.10.3 SOCIAL BEHAVIOR + +The correlation coefficient matrices for different latent subspaces are shown in Fig. 10. Despite some correlations between the shared and private social latent spaces, the other subspaces are well separated. + +# A.11 PREDICTION TASKS FOR DIFFERENT MODALITIES + +We compared the prediction accuracy between image behavioral latents and keypoint positions behavioral latents for different HMM states (Figs. 11 and 12). + +We applied the shared neural latent generated by the three-modal tasks for behavior prediction (Fig. 13). + +![](images/c42c97ea488f6c7eb162e4167ac20b065a8c6f097d944402179db4e1588c1cb5.jpg) + +![](images/51cbe40bc5c931fae544a4dce86cd6ad6f0cdab3be1e3e5cabd404289a0c64ac.jpg) +Correlation coefficient between shared and private latent subspaces + +![](images/64113df688a39a007086e00e8bbbefd03ba56c2aeb3a3c8f73325228110bfbd9.jpg) +Figure 9: 2AFC: Correlation coefficient for different latent subspaces. A. Comparison between different latent spaces for the 2-modal task: keypoint positions and neural activity. (Correlation should be low for shared vs. private and private vs. private) B. Comparison between shared latent spaces for the 2-modal task: behavioral image and neural activity. C. Comparison between different latent spaces for the 3-modal task: behavioral image, keypoint positions, and neural activity. + +![](images/2158b4b743d8b023189dce5bb362f8e9ade1e016be6b91cf5cc96ada06028b18.jpg) + +![](images/13343ba20cf15f3ee076cf55a1edc20e6d5745a3fcff880617fd0f2e32a73fe6.jpg) +Figure 10: Social behavior: Correlation coefficient for different latent subspaces. + +![](images/35a902c4a949129fb694cdce3f9b832eeeeb362e26d4e772a18e4f9a835ae869.jpg) +Figure 11: Prediction accuracy of neural activity (A): comparison between the image behavioral latents and key point positions behavioral latents. + +# A.12 ADDITIONAL RESULTS: 3Dshape dataset + +# A.12.1 PCA EMBEDDINGS OF THE SHARED AND PRIVATE LATENT SUBSPACE + +Fig. 14 illustrates that the shared latent does not capture private features, while the private latent exhibits lower decoding accuracy for shared features. This further demonstrates that our model effectively generates distinct shared and private latents. + +# A.12.2 BASELINE COMPARISON WITH PSID AND DPAD + +The key advantage of the Shared-AE model over other approaches lies in its ability to effectively disentangle shared and private features, resulting in a clearer separation of modality-specific information. This distinct separation not only enhances the interpretability of the latent representations but also supports a wider range of downstream tasks across different data modalities. As shown in Table 6, when the shared features across both modalities are weak, both PSID and DPAD struggle to effectively separate the private features from the shared latent spaces. Here, both models resulted in an erroneously high decoding accuracy of a private feature from the shared latent space. Shared-AE was able to successfully decouple the shared vs. private features in its latent subspaces. + +![](images/c70eb392a591d61c2e69bf08d1ad7f8d8efee93775f838a7ba393e3bad5a0466.jpg) +Prediction from behavioral latents to neural activity + +![](images/bd1ee309588cf2241ad93ea9beb08c38d688600c0a2509705fcc58efc5cd8e79.jpg) + +![](images/7e53d368c994fa9614e2ae2e4537da7a4cef4ec4c056a9bfe357b2bcc0f7073e.jpg) + +![](images/427ac595a8263b613f578ee382661bf42c4fea1c7d46d7fc9a03d94fdc855368.jpg) + +![](images/fb6177f3761bafe0f0397db4b4703afffc9e3a985cd15df47366b65be0bd43ac.jpg) + +![](images/d12794bfa47ea0970e03d4a1cf576ee649a1324921257df531d20b6dcdd2d8ca.jpg) + +![](images/180421334f04bc4c758e342e12ab4985ef066b818a7803a32cbb85f2d447b687.jpg) + +![](images/df92ad248bdcb574bd0161ec98e76eb2b6b8de8be1537fe1fa2aef21750d187e.jpg) + +![](images/22bba6d52f9d9371499e296f633bb8a64384b6cc56628b52b731f28da4396c91.jpg) + +![](images/a5a5808b5016fac0d7f8e577061e3e3041fc11c58bc08204d1881ed4e70de9a3.jpg) + +![](images/8bf55d51bd8fe51beddf7631db9748db7a4291a3a30aae43b9ad36fc50314b05.jpg) +Figure 12: Prediction accuracy of neural activity (B): comparison between the image behavioral latents and key point positions behavioral latents + +![](images/be252a3850e0e929ec84a02eef9fcebef256963f46142bb163561fd29fc5789a.jpg) + +![](images/6ebc53813b597939283a5a8ffb91922c44d2586d794479178e57628d1c7c05ab.jpg) + +# A.12.3 BASELINE COMPARISON WITH BASELINE MODEL WITHOUT CS-DIVERGENCE + +As a baseline, we trained the model on a simulated dataset using the same architecture but without applying CS-divergence. As shown in Table 7, the results indicate a lack of separation between the private and shared latent spaces, highlighting the necessity of constraints to effectively distinguish shared and private features. Importantly, the shared subspaces in the Shared-AE are not in fact reconstructing both modalities; they remain completely separate from each other, with purely the CS-divergence to regularize them to be similar. + +![](images/d0d579fb29ba0a6dc5263ae45941812898e4070f50a128f786f0cd17865f9c8f.jpg) +Figure 13: Prediction of keypoint positions using shared neural latents shows that incorporating the third modality (behavioral image) enhances the neural latents' ability to capture intricate features. + +![](images/891e334a4575288f4a0714d7c62dfff587f6d27c214b5f9b18a27620d3046a36.jpg) +Figure 14: PCA embeddings for shared and private behavioral and neural latent subspace: A. Shared latent spaces for each modality, each point represents a single frame, color-coded by the corresponding private features: the private latent spaces retains the private features. B. Private latent for each modality, color-coded by orientations and scales. + +Table 4: Shared-AE unpaired vs paired results: 1. The shared latent results in better classification accuracy in shared features while private latent retained more modality-specific information. 2. Shuffling one of the modalities during test time does not affect latent classification accuracy which indicates that there is no information leakage between modalities. + +
Shared-AE (unpaired)Shared-AE (paired)
Private time series latents on scale and orientations↓0.647 ± 0.050.640 ± 0.04
Shared time series latents on scale and orientations↑0.980 ± 0.090.981 ± 0.01
Private time series latents on shape↓0.017 ± 0.0010.008 ± 0.001
Shared time series latents on shape↓-0.012 ± 0.001-0.015 ± 0.01
Private time series latents on temporally-structured noise↑0.732 ± 0.0120.745 ± 0.005
Shared time series latents on temporally-structured noise↓0.183 ± 0.010.173 ± 0.04
Private image latents on scale and orientations↓0.523 ± 0.020.53 ± 0.05
Shared image latents on scale and orientations↑0.757 ± 0.080.751 ± 0.07
Private image latents on shape↑0.768 ± 0.030.767 ± 0.09
Shared image latents on shape↓0.288 ± 0.010.289 ± 0.008
Private image latents on temporally-structured noise↓0.012 ± 0.050.011 ± 0.08
Shared image latents on temporally-structured noise↓0.015 ± 0.010.015 ± 0.007
+ +Table 5: Baseline model performance on unpaired and paired datasets: the drop on classification indicates that there is information leakage during training + +
Baseline comparison for unpaired datasetMM-VAEJoint encoding model
Shared time series latents on scale and orientations0.52 ± 0.210.58 ± 0.1
Shared time series latents on shape-0.01 ± 0.040.013 ± 0.04
Shared time series latents on temporally-structured noise-0.001 ± 0.0070.034 ± 0.08
Shared image latents on scale and orientations0.42 ± 0.110.55 ± 0.11
Shared image latents on shape0.146 ± 0.0010.010 ± 0.01
Shared image latents on temporally-structured noise-0.003 ± 0.0070.042 ± 0.07
Baseline comparison for paired datasetMM-VAEJoint encoding model
Shared time series latents on scale and orientations0.90 ± 0.060.975 ± 0.01
Shared time series latents on shape0.22 ± 0.03-0.012 ± 0.01
Shared time series latents on temporally-structured noise0.0005 ± 0.0000.024 ± 0.001
Shared image latents on scale and orientations0.90 ± 0.060.646 ± 0.001
Shared image latents on shape0.154 ± 0.0030.861 ± 0.003
Shared image latents on temporally-structured noise0.003 ± 0.0000.071 ± 0.003
+ +Table 6: Decoding accuracy for temporally-structured noise (private time-series feature) on simulated dataset + +
SubspacePSIDDPADShared-AE
Shared latent↓0.99 ± 0.000.99 ± 0.000.015 ± 0.01
Private image latent↓NANA0.012 ± 0.05
Private time-series latent↑NANA0.732 ± 0.00
+ +# A.13 ADDITIONAL RESULTS: headfixed dataset + +# A.13.1 BASELINE MODEL CONFIGURATION + +In MM-GP-VAE, the dimensions of both the shared and private latent spaces are set to 50, similar to configurations in MM-VAE and the Joint Encoding model. For PSID: $n1 = 5$ , $nx = 50$ , $i = 2$ . For DPAD: $n1 = 5$ , $nx = 50$ and the method code is 'NDM $Cz$ NonLin'. These consistent latent space dimensions across models provide a standardized basis for comparison, ensuring that the + +Table 7: Baseline model without CS-divergence vs. Shared-AE: performance on simulated paired datasets + +
Decoding latents and targetsBaselineShared-AE
Shared time series latents on scale and orientations↑-0.036 ± 0.010.981 ± 0.01
Shared time series latents on shape ↓-0.012 ± 0.01-0.015 ± 0.01
Shared time series latents on temporally-structured noise ↓-0.018 ± 0.0050.173 ± 0.004
Shared image latents on scale and orientations↑0.67 ± 0.040.751 ± 0.07
Shared image latents on shape ↓0.52 ± 0.0050.289 ± 0.008
Shared image latents on temporally-structured noise ↓0.035 ± 0.0030.015 ± 0.007
Private time series latents on scale and orientations↓-0.030 ± 0.010.674 ± 0.05
Private time series latents on shape ↓-0.023 ± 0.010.017 ± 0.001
Private time series latents on temporally-structured noise ↑-0.004 ± 0.0010.732 ± 0.0012
Private image latents on scale and orientations↓0.70 ± 0.020.523 ± 0.02
Private image latents on shape ↑0.78 ± 0.0050.768 ± 0.03
Private image latents on temporally-structured noise ↓0.075 ± 0.0060.012 ± 0.05
+ +![](images/f55678f6e617f04121611ec1b09b99a80f8efc0bb66426da5e903c508d614968.jpg) +Figure 15: Head-fixed mouse: behavioral video and WFCI: A. Latent traversal for the shared behavioral latents shows automatic identification of neurally-relevant features such as jaw and paw movement. B. Neural activity prediction: a comparison between the video-based behavioral latents and the keypoint behavioral latents shows that there is more shared information about behavioral videos than poses in select brain regions. Full list shown in Appendix A.11 + +evaluation focuses on differences in model design and methodology rather than variations in latent space capacity. + +# A.13.2 BASELINE COMPARISONS + +Five baseline models are applied to the 2AFC simultaneously collected neural WFCI and behavioral video data for comparison: PSID Sani et al. (2021), DPAD Sani et al. (2024), MM-VAE Shi et al. (2019), the Joint Encoding Model Singh Alvarado et al. (2021), and MM-GP-VAE Gondur et al. (2024). Importantly, the first four baseline models failed to separate the latent space into distinct shared and private latent subspaces. In order to quantify the amount of information represented in each latent subspace, we compared the ability of each model to reconstruct one of the modalities, the body positions, in Tables 11 and 12 Shared-AE achieves higher decoding accuracy, particularly on unpaired datasets, compared to existing models. This demonstrates that it does not suffer from modality leakage, ensuring that during inference, robust representations can be generated even if only one modality's data is available. This is particularly advantageous in situations where acquiring all modalities simultaneously is challenging. The ability to produce meaningful latents without the need for all modalities underscores the practical utility and flexibility of our approach. We emphasize that Shared-AE offers significantly improved interpretability of the latent space. Moreover, unlike PSID, Shared-AE is capable of handling image data and can accommodate more than three modalities, providing greater flexibility for complex multimodal tasks. + +The model proposed by Gondur et al. (2024) combines the behavioral and the neural latent into a common subspace. This can be detrimental to interpretability since it is unclear which modality is leading to the performance of the shared latent. As detailed in Appendix A.3, the combined shared + +latent causes information bleeding between different modalities. We implemented MM-GP-VAE based on Gondur et al. (2024) as well as a similar model by incorporating a single shared latent space for both modalities and tested it on the 2AFC dataset, referring to this implementation as MM-nonGP-VAE. These models were used as baselines to compare against our proposed approach. As shown in Table 8, Shared-AE outperforms both of these models on both paired and unpaired tasks. Critically, Shared-AE has the ability to generate reasonable latents despite corrupted data in the other modality during inference. + +Table 8: Behavioral decoding accuracy with unpaired modalities for 2AFC body position dataset + +
tasksMM-GP-VAEMM-nonGP-VAEShared-AE
Private latent-0.01 ± 0.000.25 ± 0.020.22 ± 0.03
Shared latent0.006 ± 0.000.23 ± 0.030.41 ± 0.05
+ +Table 9: Behavioral decoding accuracy with paired modalities for 2AFC body position dataset + +
tasksMM-GP-VAEMM-nonGP-VAEShared-AE
Private latent0.37 ± 0.000.24 ± 0.020.22 ± 0.03
Shared latent0.36 ± 0.010.32 ± 0.030.41 ± 0.05
+ +For comparison with PSID, we further validate that PSID and DPAD cannot effectively handle image data, we conducted an experiment where the flattened behavioral image was used as the input behavioral data for PSID and DPAD (Table 10). We then used the generated neural latent representations for body position decoding and compared the results with those obtained from Shared-AE, which directly utilizes the behavioral image as input. The decoding results obtained by Shared-AE outperformed the rest. + +Table 10: Behavioral decoding accuracy with paired modalities for 2AFC image dataset + +
SubspacePSIDDPADShared-AE
Shared latents0.32 ± 0.020.31 ± 0.000.38 ± 0.01
+ +Table 11: Behavioral decoding accuracy with unpaired modalities for 2AFC body position dataset + +
SubspaceMM-VAEJoint Encoding ModelMM-GP-VAEShared-AE
Private latentsNANA-0.01 ± 0.000.22 ± 0.03
Shared latents0.22 ± 0.030.20 ± 0.020.006 ± 0.000.41 ± 0.05
+ +Table 12: Behavioral decoding accuracy with paired modalities for 2AFC body position dataset + +
SubspacePSIDDPADMM-VAEJoint Encoding ModelMM-GP-VAEShared-AE
Private latentsNANANANA0.37 ± 0.000.22 ± 0.03
Shared latents0.20 ± 0.030.27 ± 0.020.41 ± 0.070.40 ± 0.060.36 ± 0.010.41 ± 0.05
+ +# A.13.3 UMAP EMBEDDINGS OF THE PRIVATE LATENT SUBSPACE + +We show that the private latent subspaces cannot capture different HMM states inferred by behavioral latents (Fig. 16). + +# A.13.4 INFLUENCE OF THE PRIVATE BEHAVIORAL LATENT SUBSPACE ON IMAGE RECONSTRUCTION + +We performed the same task as in Sec. 4.2, varying the private behavioral latent from its minimum value to its maximum value. (Fig. 17). + +![](images/012a07f87dd8b46e9f04def42ea2573ca11020015cff3aa2a16bca52d1203edc.jpg) +Figure 16: UMAP embeddings for private behavioral and neural latent subspace for the 2AFC dataset. + +![](images/3576ad6db4e6ffa583a533227dbfc9d6eed94998637de7ac939c19c45656bd76.jpg) +Figure 17: Changing the value of the private latent space from its minimum to its maximum results in a defection in the image. The private latent captures more about the behaviorally unrelated features. \ No newline at end of file diff --git a/ICLR/2025/Shared-AE_ Automatic Identification of Shared Subspaces in High-dimensional Neural and Behavioral Activity/images.zip b/ICLR/2025/Shared-AE_ Automatic Identification of Shared Subspaces in High-dimensional Neural and Behavioral Activity/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..3e1f28f4edc85c1ccc1884eca6231c61ee586861 --- /dev/null +++ b/ICLR/2025/Shared-AE_ Automatic Identification of Shared Subspaces in High-dimensional Neural and Behavioral Activity/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:849ef6bc8b9db67eb704291784f8991b94757fb8921b0e55e92ae6aca1a86864 +size 2190213 diff --git a/ICLR/2025/Shared-AE_ Automatic Identification of Shared Subspaces in High-dimensional Neural and Behavioral Activity/layout.json b/ICLR/2025/Shared-AE_ Automatic Identification of Shared Subspaces in High-dimensional Neural and Behavioral Activity/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..f8b830db3c3de1a05adaaab279934e44cdcebc6f --- /dev/null +++ b/ICLR/2025/Shared-AE_ Automatic Identification of Shared Subspaces in High-dimensional Neural and Behavioral Activity/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:afa9c960f56464fd66b8bd68db4c51df01dfcc172716403336d3de1d726e4e45 +size 680072 diff --git a/ICLR/2025/Sharper Guarantees for Learning Neural Network Classifiers with Gradient Methods/b8ce5846-2717-4d4f-be7c-816c98882de6_content_list.json b/ICLR/2025/Sharper Guarantees for Learning Neural Network Classifiers with Gradient Methods/b8ce5846-2717-4d4f-be7c-816c98882de6_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..6d8b173123f3e678aec33913af320ea26a437e62 --- /dev/null +++ b/ICLR/2025/Sharper Guarantees for Learning Neural Network Classifiers with Gradient Methods/b8ce5846-2717-4d4f-be7c-816c98882de6_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1ee63f23484709f80c6e9ff8d37fd4c5c97b0ee8961b910a3f45fa9c92515ed8 +size 79006 diff --git a/ICLR/2025/Sharper Guarantees for Learning Neural Network Classifiers with Gradient Methods/b8ce5846-2717-4d4f-be7c-816c98882de6_model.json b/ICLR/2025/Sharper Guarantees for Learning Neural Network Classifiers with Gradient Methods/b8ce5846-2717-4d4f-be7c-816c98882de6_model.json new file mode 100644 index 0000000000000000000000000000000000000000..a3d9b06a61edb4dd7e95bc72c9268dc436c145c2 --- /dev/null +++ b/ICLR/2025/Sharper Guarantees for Learning Neural Network Classifiers with Gradient Methods/b8ce5846-2717-4d4f-be7c-816c98882de6_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7eac966efc7958a7f80bb141990c731e7eec7a45beb8da270005444c51126b6f +size 93563 diff --git a/ICLR/2025/Sharper Guarantees for Learning Neural Network Classifiers with Gradient Methods/b8ce5846-2717-4d4f-be7c-816c98882de6_origin.pdf b/ICLR/2025/Sharper Guarantees for Learning Neural Network Classifiers with Gradient Methods/b8ce5846-2717-4d4f-be7c-816c98882de6_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..4947bff2d65054915d84ee1756d9b53d4c653438 --- /dev/null +++ b/ICLR/2025/Sharper Guarantees for Learning Neural Network Classifiers with Gradient Methods/b8ce5846-2717-4d4f-be7c-816c98882de6_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e96a1b54c0bcae3c9f0bb6ea9d1294208aa40cf3ca261907ea49ec301f45b6c4 +size 1057723 diff --git a/ICLR/2025/Sharper Guarantees for Learning Neural Network Classifiers with Gradient Methods/full.md b/ICLR/2025/Sharper Guarantees for Learning Neural Network Classifiers with Gradient Methods/full.md new file mode 100644 index 0000000000000000000000000000000000000000..969ba1427175ca40fbfc1e3d056bc439ed4fc678 --- /dev/null +++ b/ICLR/2025/Sharper Guarantees for Learning Neural Network Classifiers with Gradient Methods/full.md @@ -0,0 +1,301 @@ +# SHARPER GUARANTEES FOR LEARNING NEURAL NETWORK CLASSIFIERS WITH GRADIENT METHODS + +Hossein Taheri + +Department of Computer Science and Engineering, University of California, San Diego. htaheri@ucsd.edu + +Christos Thrampoulidis, + +Department of Electrical and Computer Engineering, University of British Columbia. cthrampo@ece.ubc.ca + +Arya Mazumdar + +Department of Computer Science and Engineering, University of California, San Diego. +arya@ucsd.edu + +# ABSTRACT + +In this paper, we study the data-dependent convergence and generalization behavior of gradient methods for neural networks with smooth activation. Our first result is a novel bound on the excess risk of deep networks trained by the logistic loss, via analogarithmic stability analysis. Compared to previous works, our results improve upon the shortcomings of the well-established Rademacher complexity-based bounds. Importantly, the bounds we derive in this paper are tighter, hold even for neural networks of small width, do not scale unfavorably with width, are algorithm-dependent, and consequently capture the role of initialization on the sample complexity of gradient descent for deep nets. Specialized to noiseless data separable with margin $\gamma$ by neural tangent kernel (NTK) features of a network of width $\Omega(\mathrm{poly}(\log(n)))$ , we show the test-error rate to be $e^{O(L)}/\gamma^2 n$ , where $n$ is the training set size and $L$ denotes the number of hidden layers. This is an improvement in the test loss bound compared to previous works while maintaining the poly-logarithmic width conditions. We further investigate excess risk bounds for deep nets trained with noisy data, establishing that under a polynomial condition on the network width, gradient descent can achieve the optimal excess risk. Finally, we show that a large step-size significantly improves upon the NTK regime's results in classifying the XOR distribution. In particular, we show for a one-hidden layer neural network of constant width $m$ with quadratic activation and standard Gaussian initialization that SGD with linear sample complexity and with a large step-size $\eta = m$ reaches the perfect test accuracy after only $\lceil \log(d) \rceil$ iterations, where $d$ is the data dimension. + +# 1 INTRODUCTION + +# 1.1 OVERVIEW + +Neural networks, with their vast capacity for capturing intricate patterns in data, have triggered a paradigm shift in machine learning. Despite the power of these networks in modeling complex relationships, the interplay between their optimization and generalization behaviors (that is the gap between training and test errors) continues to be a compelling area of research. In practice, training neural networks using gradient-based optimization methods often leads to interpolation. That is, deep networks can meticulously fit the training data, driving empirical loss to near-zero and training error to perfect classification. However, these networks also demonstrate the capability to generalize well to unseen data. Various recent research endeavors have explored the training and test error guarantees of deep networks, with a focus on the Neural Tangent Kernel (NTK) regime [Jacot et al. (2018); Du et al. (2019)]. One prominent feature of such works is that during gradient descent iterates the network's weights are constrained to move at most a constant distance with respect to overparameterization i.e., + +
ActivationWidthTrain LossTest Loss
Chen et al. (2021); Bartlett et al. (2017)ReLUΩ(poly(log(n)/γ))O(1/γ2T)O(eO(L)/γ2√m/n + 1/γ2T)
Thm. 2.1, Cor. 1SmoothΩ(poly(log(n)/γ))O(1/γ2T)O(eO(L)/γ2n + 1/γ2T)
+ +Table 1: Comparison of our results on learning deep nets with GD under NTK separability condition to related prior results. Here $m$ : network width, $L$ : network depth, $\gamma$ : NTK-margin, $n$ : number of samples and $T$ : number of iterations. + +
ActivationWidthIterationSample
Telgarsky (2023); Chen et al. (2021); Taheri & Thrampoulidis (2024);Cor.1allΩ(poly(d))d2O(d2)
Glasgow (2024)ReLUΩ(poly(log(d)))poly(log(d))O(d)
Thm. 2.4QuadraticΩ(1)log(d)O(d)
+ +Table 2: Comparison of our findings on learning the $d$ -dimensional XOR distribution with SGD to relevant prior results. + +$\| w^{\star} - w_{0}\| = O_{m}(1)$ , where $w^{\star}\in \mathbb{R}^{p}$ denotes the vector of target weights, $w_{0}$ is the initial weight vector, and $m$ is the network width Chen et al. (2021); Ji & Telgarsky (2020); Telgarsky (2023). + +Yet, even for the relatively simple setting of learning deep nets in the kernel regime, the existing generalization bounds are still suboptimal. Moreover, the boundaries of the kernel regime are still largely unknown and an active area of research Liu et al. (2022); Banerjee et al. (2022); Telgarsky (2023). While the kernel regime can partially demonstrate the behavior of neural networks, the resulting guarantees often require large width, small step-size or large iteration and sample complexities. There is increasing evidence in recent years that for certain class of data distributions neural networks can overcome these limitations by using a large step-size which allows the network's parameters to move a long distance from initialization, often leading to better sample and computational complexities Damian et al. (2022); Ba et al. (2022). + +In this work, we study the generalization and convergence behavior of gradient-based algorithms in neural nets with smooth activation functions for a wide class of data distributions. Our first result characterizes the test and train loss rates for classification problems under the condition that deviation from initialization is bounded depending on the network's width. In particular, for $L$ -hidden layer networks our results hold under $\| w^{\star} - w_0\| \lesssim m^{O(1 / L)}$ , allowing the network's weights to move from initialization a distance increasing with $m$ . This shows that the kernel regime continues to hold for a wider range of setups than previous results for which the deviations are restricted to be constant in $m$ . The key reason for this improvement is exploiting the objective's Hessian structure in the gradient-descent path. More importantly, using the Hessian information enables us to develop, for the first time, algorithm-dependent generalization bounds of deep neural networks. As will be discussed throughout the paper, the bounds we derive via algorithmic-stability are tighter than previous relevant bounds in the literature. We specialize these results to a well-known NTK separability condition tailored for noiseless data and show that our results substantially improve the prior results on the test error performance while still allowing the width to be small, specifically poly-logarithmic on sample size (Table 1). A more detailed comparison is deferred to Section 1.2. We also consider the case of noisy data distributions and show that deep models are consistent, i.e., they can achieve the optimal test loss in the presence of noise as the sample size grows. + +While these results improve upon the existing bounds within the NTK regime, we show in Section 2.2 that using a large step-size can further improve both the computational and sample complexities. In particular, we show for the stylized setup of data following the XOR distribution, a two-layer neural network with quadratic activation reaches zero test error after only $\log (d)$ steps of SGD with an aggressive step-size $\eta = m$ . A comparison of our findings with the guarantees of the kernel regime with both GD Taheri & Thrampoulidis (2024) and one-pass SGD Telgarsky (2023); Chen et al. (2021) and the most relevant work in the feature learning regime Glasgow (2024) is summarized in Table 2. + +Below is a summary of our contributions. + +- In Theorem 2.1, we develop sufficient conditions for the global convergence of gradient descent in deep and smooth networks and show that if $m = \Omega(\| w^{\star} - w_0\|^{6L + 4})$ , the training loss is bounded by $O\left(\frac{\|w^{\star} - w_{0}\|^{2}}{\eta T}\right)$ , where $\eta$ is the step-size and $w^{\star}$ can be any choice of network weights that achieves small training loss. Under similar conditions on $m$ , we show the generalization error is bounded by $O\left(\frac{\|w^{\star} - w_{0}\|^{2}G_{0}^{2}}{n}\right)$ where $G_{0}$ is the Lipschitz parameter of the network at initialization. +- In Corollary $\square$ , we interpret these results by specializing them to a commonly-used margin-based NTK separability condition. The results of the corollary and comparison to previous works in literature are summarized in Table $\square$ . A promising feature of our approach is that the test loss bound does not have an unfavorable dependence on the width while still maintaining minimum poly-logarithmic width conditions, which is new in the context of deep learning. To the best of our knowledge this is the tightest test error bound for deep nets trained by GD in the NTK regime. +- We consider the more general case of noisy data with non-vanishing optimal test loss in Theorem [2.3] and show that under a polynomial growth condition on network width, GD achieves a convergence rate of $1 / \sqrt{n}$ to the optimal loss after $T = \sqrt{n}$ iterations. +- In Section 2.2 we consider the $d$ -dimensional XOR distribution and show that a one-hidden layer network of constant width after exactly $\log(d)$ iterations of SGD with step-size $\eta = m$ achieves perfect test accuracy with $n = \widetilde{O}(d)$ samples, considerably improving kernel regime's limitations. + +# 1.2 PRIOR WORKS + +Generalization of deep nets. Among prior works on the generalization capabilities of deep networks, the only initialization dependent bounds were provided in Bartlett et al. (2017) obtaining bounds of order $O\left(\frac{\mathcal{R}}{n}\right)$ where the Rademacher complexity is derived as $\mathcal{R} := (\prod_{i=1}^{L} \|W_i\|_2)(\sum_{i=1}^{L} \frac{\|W_i^\top - M_i^\top\|_{2,1}^{2/3}}{\|W_i\|_2^{2/3}})^{3/2}$ . Here $\|W_i\|_2$ is the spectral norm of the weight matrix of layer $i$ (typically a constant) and $M_i$ s are any data-independent matrices. Thus one can choose $M_i = W_{i,0}$ , i.e., the initialization weight matrix. In fact, the above bound resembles the bound that we obtained via an optimization-dependent stability analysis. However, note that $\mathcal{R}$ depends on the distance traversed by weights through the $\ell_{2,1}$ norm which is always larger than the Frobenius norm, and in the worst case, the gap can be significantly large depending on the width. To see this, note that for a matrix $V \in \mathbb{R}^{m \times m}$ it holds that $\|V\|_{2,1} \leq \sqrt{m} \|V\|_F$ . We note that "initialization-independent" bounds (e.g., Neyshabur et al. (2018); Golowich et al. (2018)) that are usually proportional to $\|w_t\|$ (rather than $\|w_t - w_0\|$ ) are strictly looser than the bound we obtain. This is primarily due to the fact that $\|w_t - w_0\|$ can be much smaller than $\|w_t\|$ and in fact as our experiments show $\|w_t - w_0\|$ is of constant order and can even decrease with width. Whereas, $\|w_t\|$ (or $\|w_t\| / \sqrt{m}$ due to the normalization in our setup) grows by increasing $m$ , making the initialization-independent bounds potentially grow with width at the rate $O(\sqrt{m})$ , despite lacking an explicit dependence on $m$ . Hence, for wide networks, prior generalization bounds of deep neural nets based on Rademacher complexity are larger than the bound we derive in Theorem 2.1 + +Test rates under the NTK separability condition. Other works that provide generalization bounds and optimization guarantees for neural nets include Cao & Gu (2019); Nitanda et al. (2019); Ji & Telgarsky (2020); Chen et al. (2021); Richards & Rabbat (2021); Taheri & Thrampoulidis (2024); Wang et al. (2023). In particular, Ji & Telgarsky (2020) derived the width condition $m = \Omega(\frac{\text{poly}(\log(n))}{\gamma^8})$ for achieving the $\frac{1}{\gamma^2\sqrt{n}}$ -test error rate in two-layer nets via a uniform-convergence argument Shalev-Shwartz & Ben-David (2014). This bound was extended to deep networks in Chen et al. (2021) with a generalization gap of order + +$$ +\widetilde {O} \left(\frac {4 ^ {L}}{\gamma^ {2}} \sqrt {\frac {m}{n}} \wedge \left(\frac {L ^ {3 / 2}}{\gamma^ {2} \sqrt {n}} + \frac {L ^ {1 1 / 3}}{\gamma^ {2} m ^ {1 / 6}}\right)\right), +$$ + +where $\wedge$ takes the minimum of two quantities. As discussed earlier, this bound is dependent on width since it is derived essentially by taking the minimum of two generalization bounds based on Rademacher complexity derived in Bartlett et al. (2017) and Cao & Gu (2019). Importantly, in the small width regime the bound simplifies into $\tilde{O}\left(\frac{4^L}{\gamma^2} \sqrt{\frac{m}{n}}\right)$ , which has an undesirable dependence on + +the width. In this paper, we improve the generalization gap to $\tilde{O}\left(\frac{e^{O(L)}}{\gamma^2n}\right)$ under the width condition $m = \Omega (\mathrm{poly}(\log (n) / \gamma))$ . To the best of our knowledge, these are the smallest generalization bound and width condition in literature up to now for learning deep neural nets. The key reason behind the improvement is leveraging the Hessian structure of the objective throughout the gradient descent iterates. The improved generalization guarantees result from the algorithmic dependency of our bounds and in fact the bounds can even be expressed such that they solely depend on the cumulative training loss (c.f. Eq. 5). As the training loss captures the role of initialization and is independent of width, the resulting generalization bounds share the same favorable properties. + +Feature learning and the XOR distribution. Some recent works have pointed out the limitations of the kernel regime in understanding the full power of neural networks [Abbe et al. (2022)]. In particular, as in the kernel regime, the networks weights are bounded not to move significantly from initialization, the learned features are not considerably different from those learned at initialization. On the other hand, it is hypothesized that neural networks can learn the true underlying features of the data distribution if the network weights are allowed (by large step-sizes or avoiding early-stopping) to move a large distance from initialization. This phenomenon was first proved for specific regression tasks where the labels essentially only depend on a small number of features, such as when $y = g(Ux)$ for $U \in \mathbb{R}^{k \times d}$ where $k \ll d$ [Damian et al. (2022); Ba et al. (2022); Abbe et al. (2022); Cui et al. (2024)], by one large SGD step leading to superior sample complexities compared to the kernel regime. For classification tasks, some focus has been on the XOR distribution (a.k.a. parities) [Wei et al. (2019)]. Recent works have studied the problem of learning the $d$ -dimensional XOR distribution using neural networks in both NTK and feature learning settings [Barak et al. (2022); Telgarsky (2023); Taheri & Thampoulidis (2024); Glasgow (2024)]. Specifically, it has been shown that under NTK with a sufficiently small step size, a polynomially wide network requires $d^2$ GD steps and $d^2$ sample size. Some studies have achieved linear sample complexity for learning XOR [Bai & Lee (2019); Glasgow (2024); Telgarsky (2023)]; but these methods involve more computational effort compared to our results. The work most related to ours is [Glasgow (2024)], which demonstrated that with a particular Gaussian initialization, a ReLU network requires poly(log(d)) large SGD steps and poly(log(d)) neurons to learn XOR with linear sample complexity. In contrast, we show that by using a quadratic activation, learning this distribution requires only log(d) large steps with a constant-width network, while maintaining the same linear sample complexity. + +# NOTATION + +Probability and expectation with respect to the randomness in random variable $x$ are denoted by $\operatorname{Pr}_x(\cdot)$ and $\mathbb{E}_x[\cdot]$ . We use $\mathbb{E}_x[w_t]$ to represent the weights after $t$ steps of gradient descent using the population's gradient. We use the standard complexity notation $\lesssim$ , $o(\cdot)$ , $O(\cdot)$ , $\Theta(\cdot)$ , $\Omega(\cdot)$ and use $\tilde{o}(\cdot), \tilde{O}(\cdot), \tilde{\Theta}(\cdot), \tilde{\Omega}(\cdot)$ to hide polylogarithmic factors. We denote $a \wedge b := \min\{a, b\}$ . The gradient and Hessian of the model $\Phi: \mathbb{R}^{p \times d} \to \mathbb{R}$ with respect to the first input (that is, weights) are denoted by $\nabla \Phi$ and $\nabla^2 \Phi$ , respectively. The minimum eigenvalue of a symmetric matrix is denoted by $\lambda_{\min}(\cdot)$ . We use $\| \cdot \|$ for the Euclidean norm of vectors and $\| \cdot \|_2$ for the spectral norm of matrices. We denote $[w_1, w_2] := \{w: w = \alpha w_1 + (1 - \alpha) w_2, \alpha \in [0, 1]\}$ the line between $w_1, w_2 \in \mathbb{R}^p$ . + +# 2 MAIN RESULTS + +Throughout the paper, we consider the following unregularized objective for a neural network classifier parameterized with $w \in \mathbb{R}^p$ , + +$$ +\min _ {w \in \mathbb {R} ^ {p}} \widehat {F} (w) := \frac {1}{n} \sum_ {i = 1} ^ {n} f \left(y _ {i} \Phi \left(w, x _ {i}\right)\right), \tag {1} +$$ + +with data points satisfying $\| x\| \leq 1$ , the binary labels $y_{i}\in \{\pm 1\}$ and $f(\cdot)$ is a loss function for classification tasks such as the logistic loss, $f(t)\coloneqq \log (1 + e^{-t})$ and $\Phi (\cdot ,x)$ is the network's output. We also define the test loss as $F(w)\coloneqq \mathbb{E}_{x,y}[f(y\Phi (w,x))]$ . + +# 2.1 TRAIN AND TEST LOSS BOUNDS IN DEEP NETS + +In our first theorem, we establish conditions for the width and target weights of the network that guarantees the training loss decays to zero if the network can interpolate the training set. We consider gradient descent update rule where at any iteration $t \leq T$ : $w_{t+1} = w_t - \eta \nabla \widehat{F}(w_t)$ . Before stating the theorem, we note that this result is valid under the standard descent-lemma condition for the step-size, as stated in Lemma 3 in the appendix. In particular, the descent lemma holds if the step-size satisfies the standard Eq. 34 in the appendix. + +Theorem 2.1 (Train & Test loss of deep nets). Consider $L$ -layer network where $\Phi(w, x) := \frac{1}{\sqrt{m}} W_{L+1}^{\top} \left( \frac{1}{\sqrt{m}} \sigma(W_{L}^{\top} \cdots \frac{1}{\sqrt{m}} \sigma(W_{1}^{\top} x) \cdots \right)$ and $\sigma$ is a 1-smooth and 1-Lipschitz activation function such that $\sigma(0) = 0$ . Moreover, let $\beta_{L}$ be a constant that only depends on $L$ , let all parameters of the network be initialized as i.i.d. standard Gaussian and assume the step-size satisfies the condition of the descent lemma. Fix $T$ and assume the target weights vector $w^{\star} \in \mathbb{R}^{p}$ that obtain small training loss such that + +$$ +\rho^ {\star} \geq \max \left\{\sqrt {\eta T \widehat {F} \left(w ^ {\star}\right)}, \sqrt {\eta \widehat {F} \left(w _ {0}\right)} \right\}. \tag {2} +$$ + +where $\rho^{\star} := \| w^{\star} - w_{0}\|$ . Moreover, assume the width $m$ is large enough such that it satisfies, + +$$ +m \geq 4 \beta_ {L} ^ {2} (6 \rho^ {\star}) ^ {6 L + 4} \tag {3} +$$ + +Then, $\| w_{t} - w_{0}\| = O(\rho^{\star})$ and the training loss satisfies with high probability over initialization, + +$$ +\widehat {F} \left(w _ {T}\right) \leq \frac {4 \rho^ {\star 2}}{\eta T}. \tag {4} +$$ + +Moreover, assume for every $n$ samples from the data distribution there exists $w^{\star}$ satisfying Eqs. [2][3] Then, the expected generalization gap satisfies with high probability over initialization, + +$$ +\mathbb {E} _ {\mathcal {S}} \left[ F \left(w _ {T}\right) - \widehat {F} \left(w _ {T}\right) \right] \leq 2. 2 \frac {\eta \left(G _ {0} + 1 / 4\right) ^ {2}}{n} \mathbb {E} _ {\mathcal {S}} \left[ \sum_ {t = 0} ^ {T - 1} \widehat {F} \left(w _ {t}\right) \right], \tag {5} +$$ + +where the expectation is over the randomness in the training set denoted by $S$ and $G_{0}$ is the Lipschitz parameter of network at initialization i.e., $\| \nabla \Phi (w_0,\cdot)\| \leq G_0$ . + +In words, the main condition of the theorem is the existence of network weights denoted by $w^{\star}$ that achieves small training error (Eq. 2) and its distance from initialization is at most $O(m^{1/(6L+4)})$ as implied by Eq. 3. Under these conditions, the training loss is controlled solely by $\| w^{\star} - w_0 \|$ and has no explicit dependence on the width or depth of the network. As it will be stated in Corollary 1 in the NTK regime with margin $\gamma$ it holds $\| w^{\star} - w_0 \| = O(\log(n)/\gamma)$ , leading to the width condition $m = \Omega(\text{poly}(\log(n)/\gamma))$ . This is unlike previous results which either required polynomial width (such as (Liu et al., 2022; Cao & Gu, 2019)) or led to sub-optimal bounds (e.g., (Chen et al., 2021; Ji & Telgarsky, 2020)). + +In general, the theorem is valid for any feasible minimizer $w^{\star} \in \mathbb{R}^{p}$ . Thus, we can choose $w^{\star}$ with smallest value for $\| w^{\star} - w_{0}\|$ to optimize the bounds. With such choice of $w^{\star}$ , the distance the weights obtained by GD travel is also minimized as $\forall t \in [T] : \| w_{t} - w_{0}\| = O(\| w^{\star} - w_{0}\|)$ . Thus, gradient descent tends toward solutions which attain small loss and lie at minimum possible distance from initialization. This is in line with related prior observations in several other works such as (Du et al., 2019; Oymak & Soltanolkotabi, 2019). + +The theorem also shows the sample complexity and iteration complexity of learning deep networks with gradient descent and demonstrates the role of initialization and weight's norms on the test error. Note that by replacing the time-averaged training loss guarantees (cf. Theorem B.1), the generalization gap simplifies into: + +$$ +\mathbb {E} _ {\mathcal {S}} \left[ F \left(w _ {T}\right) - \widehat {F} \left(w _ {T}\right) \right] \leq 9 \frac {\rho^ {\star 2} \left(G _ {0} + 1 / 4\right) ^ {2}}{n}. \tag {6} +$$ + +Hence, the test loss after $T = \Theta (n)$ iterations takes the form of + +$$ +\mathbb {E} _ {\mathcal {S}} \left[ F \left(w _ {T}\right) \right] = O \left(\frac {\left\| w ^ {\star} - w _ {0} \right\| ^ {2} G _ {0} ^ {2}}{n} + \frac {\left\| w ^ {\star} - w _ {0} \right\| ^ {2}}{\eta n}\right), \tag {7} +$$ + +where the first term is the generalization error and the second term is the training loss. Remarkably, Eq. 7 shows the tight correlation between the two terms, as the generalization gap is virtually the optimization error scaled by the squared Lipschitz constant $G_0^2$ . This is indeed the consequence of Eq. 5 which bounds the generalization gap based on the cumulative optimization error. + +At a high-level, the test loss essentially depends on two quantities: (i) the Euclidean distance between the target weights and the initialization and (ii) the Lipschitz parameter of network at initialization. Due to the algorithmic-dependent nature of our generalization bounds and unlike the prior bounds in literature, the bound in Eq. 7 captures the role of initialization on the test error: smaller deviations from initialization lead to smaller test error bounds and in particular the bound approaches zero as $\rho^{\star}$ goes to zero. As discussed earlier, gradient descent favors such solutions with small deviations from initialization. In addition to "distance from initialization", the test error bounds also depend on the squared Lipschitz parameter of the network. For standard Gaussian initialization, it can be shown (cf. Section A.2) that $G_0 \lesssim e^{O(L)}$ which introduces an exponential dependence on depth to the generalization bound. We remark that this dependence also appears in the corresponding bounds derived via uniform convergence and Rademacher complexity (e.g., (Bartlett et al., 2017; Golowich et al., 2018; Chen et al., 2021)) through the term $\prod_{i=1}^{L} \|W_i\|_2$ . + +An interesting feature of our approach is the algorithmic dependent bound in Eq. 5. This bound is generally tighter than the bound in Eq. 6. With the descent lemma condition on the step-size (c.f. Lemma 3) it holds that $\eta < 1 / (G_0^2 + 1/4)$ which simplifies the bound into: + +$$ +\mathbb {E} _ {\mathcal {S}} \left[ F \left(w _ {T}\right) - \widehat {F} \left(w _ {T}\right) \right] \leq \frac {2 . 2}{n} \mathbb {E} _ {\mathcal {S}} \left[ \sum_ {t = 0} ^ {T - 1} \widehat {F} \left(w _ {t}\right) \right]. \tag {8} +$$ + +Hence, we have a bound which only depends on the training performance and the number of training samples. In our experiments in Section 3, we compute this bound for real-world data and compare it with the empirical results for generalization and test loss. + +Remark 2.2. Our analysis relies on the recent progress in characterising the spectral norm of the deep net's Hessian during GD updates (Liu et al., 2020; Banerjee et al., 2022). In particular, Liu et al. (2020) proved that with standard Gaussian initialization, the model's Hessian is bounded with high probability by $\| \nabla^2\Phi (w,x)\| = O\left(\frac{R^{3L}}{\sqrt{m}}\right)$ if $\| w - w_0\| \leq R$ . These guarantees can also be used to study the convergence rate of deep networks trained by quadratic loss as done by (Liu et al., 2020; 2022) but their approach leads to excessively large width conditions. In contrast, here we consider classification tasks with an improved poly-logarithmic width requirement and also study the generalization performance. + +Recently, the algorithmic stability has been employed for two-layer neural nets in (Taheri & Thram-poulidis, 2024; Richards & Rabbat, 2021) which is an improved analysis of the stability-based approach typically used for convex objectives in (Bousquet & Elisseeff, 2002; Hardt et al., 2016; Lei & Ying, 2020). Here, we essentially extend the stability analysis to deep networks. Compared to the two-layer nets, here in every iterate of gradient descent, the Hessian's norm guarantees depend on the network's weights. In particular, the analysis has to take into account that both $\| w_t - w_0\|$ and $\| w_t - w^{\star}\|$ remain small during GD updates. This is necessary in order to ensure the Hessian's norm guarantees and the approximate quasi convexity property hold during all GD iterates. We do this by an induction based argument which bounds these terms based on the fixed quantity $\| w^{\star} - w_0\|$ , which is guaranteed to be bounded based on width by assumption. + +# 2.1.1 SPECIALIZING TO THE NTK-SEPARABILITY CONDITION + +The results in the last section can be specifically applied to a class of data distributions that includes the XOR distribution which will be discussed more through the rest of the paper. Before stating our result in the corollary, we state the neural tangent kernel (NTK) separability assumption. + +Assumption 1 (NTK-separability (Nitanda et al., 2019)). Assume the tangent kernel of the model at initialization separates the data with margin $\gamma$ i.e., for a unit-norm vector $w \in \mathbb{R}^p$ it holds for all $i \in [n]: y_i \langle \nabla \Phi(w_0, x_i), w \rangle \geq \gamma$ . + +In words, the above assumption implies that the features learned by the gradient at initialization can be linearly separated by some weights $w$ . This assumption is commonly used in deep learning literature for studying classification tasks (Chen et al., 2021; Ji & Telgarsky, 2020). + +Corollary 1 (NTK results). Consider the same setup as Theorem 2.1 and let Assumption 1 hold. Define constant $B > 0$ that bounds the model's output at initialization i.e., $\forall i\in [n]:|\Phi (w_0,x_i)| < B$ . Assume the width is large enough such that $m\geq \beta_L^2\left(\frac{2B + \log(1 / \epsilon)}{\gamma}\right)^{6L + 4}$ . Then there exists $w^{\star}\in \mathbb{R}^{p}$ such that $F(w^{\star})\leq \epsilon$ and $w^{\star}$ lies at a bounded Euclidean distance from initialization such that $\| w^{\star} - w_{0}\| \leq \frac{1}{\gamma} (2B + \log (1 / \epsilon))$ . + +To interpret this result, we apply this result to Theorem 2.1 and fix $\epsilon = 1 / T$ . First note that the output of network at initialization is constant with high-probability over initialization (e.g., see [Liu et al., 2020, Lemma F.4], [Cao & Gu, 2019, Lemma 4.4]) which implies $B = \tilde{O}(1)$ . Overall, with the stopping condition $T = \Theta(n)$ and recalling that $G_0 \leq e^{O(L)}$ , Corollary yields the expected test error rate of order + +$$ +\widetilde {O} \left(\frac {e ^ {O (L)}}{\gamma^ {2} n} + \frac {1}{\gamma^ {2} T}\right), +$$ + +under the condition that $m = \Omega(\mathrm{poly}(\log(n)) \cdot \beta_L / \gamma^{6L + 4})$ . We remark the bound does not have any explicit dependence on $m$ . This in itself is not surprising as one intuitively expects the bound not to scale unfavorably with width. Although recent works have derived width independent generalization bounds for two-layer networks (Ji & Telgarsky, 2020; Telgarsky, 2023; Taheri & Thrampoulidis, 2024), we are not aware of any prior work proving width-independent bounds for learning multi-layer networks with GD. As discussed earlier in the introduction, the bound derived in the closely related work (Chen et al., 2021) scales unfavorably with $m$ as it grows at the rate $\sqrt{m/n}$ . In fact, the authors refer to deriving width-independent bounds as an open problem in (Chen et al., 2021, Sec 3.1). + +# 2.1.2 CONSISTENCY OF GD WITH NOISY DATA + +The results of the last section mainly apply to data settings when the network can find the optimal solution within a bounded distance from initialization that depends on the network's width. This setting was specially tailored to the noiseless case where achieving vanishing test loss was possible. We discuss next the case of learning deep nets by noisy data and show that achieving optimal test loss might be feasible in this setting. + +Theorem 2.3 (Test error for noisy data). Consider the same setup and notation as Theorem[2.1] and assume the width of the network satisfies $m \geq \beta_L^2 n^{3L + 3}$ and the step-size satisfies the conditions of the descent lemma. Then, with high probability over initialization the expected test loss at iteration $T = \sqrt{n}$ is bounded as: + +$$ +\mathbb {E} _ {\mathcal {S}} \left[ F \left(w _ {T}\right) \right] \leq \left(1 + \frac {4}{\sqrt {n}}\right) \left(F \left(w ^ {\star}\right) + \frac {\rho^ {\star 2}}{\eta \sqrt {n}} + \frac {\rho^ {\star 2}}{n \sqrt {n}} + \frac {1}{\sqrt {n}}\right), \tag {9} +$$ + +where $\rho^{\star} := \| w^{\star} - w_{0}\|$ and $w^{\star}$ is the minimizer of the population loss i.e., $w^{\star} = \arg \min_{w\in \mathbb{R}^{p}}F(w)$ . + +The result above shows that GD reaches optimal level given that $\sqrt{n} \gg \| w^{\star} - w_0\|^2$ ; as for large $n$ , it leads to the simplified expression + +$$ +\mathbb {E} _ {\mathcal {S}} \Big [ F (w _ {T}) \Big ] - F (w ^ {\star}) = O \left(\frac {\big \| w ^ {\star} - w _ {0} \big \| ^ {2} + F (w ^ {\star})}{\sqrt {n}}\right). +$$ + +Thus, even in non-interpolating regime, GD can still achieve the optimal solution of overparameterized deep networks. + +The bound in Eq. 9 is derived via a stability argument which bounds the generalization gap based on the training performance. However, contrary to the conditions of Theorem 2.1 here we do not have the interpolation condition as $F(w^{\star})$ is not vanishing. This comes at the expense of a larger width condition where the width is polynomial in $n$ whereas poly-logarithmic width was sufficient in Theorem 2.1. The condition on early stopping further guarantees that the test loss reach the Bayes error given $n$ is sufficiently large. It is worth noting that the setting above still is operating almost in the NTK regime. This can be verified by the observation that for the bound to be meaningful it should hold that $\| w^{\star} - w_{0}\| \ll \sqrt{n} \lesssim m^{O(1 / L)}$ , as per the theorem's width condition. Finally, we remark that the result of Thm 2.3 nicely connects to recent empirical and theoretical results (Li et al., 2020) which show that with early-stopping, GD can find a good solution for clustered data with label noise. + +# 2.2 OVERCOMING NTK LIMITATIONS FOR XOR DATASET + +Next, we show the previous NTK guarantees can be improved by using large step-sizes. We consider the stylized set-up of learning the $d$ -dimensional XOR data distribution. Consider one-hidden layer network with quadratic activation where $x \in \mathbb{R}^d$ , $w_i \in \mathbb{R}^d$ : + +$$ +\Phi (w, x) = \frac {1}{2 m} \sum_ {i = 1} ^ {m} a _ {i} \left(x ^ {\top} w _ {i}\right) ^ {2}. +$$ + +In the above, $a_i \in \{\pm 1\}$ are fixed during training and satisfy $\sum_{i} a_i = 0$ and only the first layer weights are trained. For initialization of first layer's weights we have $\forall i \leq m, j \leq d: w_{0,ij} \stackrel{\mathrm{iid}}{\sim} N(0, \frac{1}{d})$ . The data points $(x,y) \in \{\pm 1\}^d \times \{\pm 1\}$ are uniformly drawn from the resulting $d$ -dimensional distribution of $2^d$ points where the labels are determined as $y = x(1) \cdot x(2)$ . For the result in the next theorem, we assume the loss function is the linear loss $f(t) = -t$ and consider mini-batch SGD with the update rule $w^{t+1} = w^t - \eta \widehat{F}(w^t)$ , where at each step, $n$ data points are drawn i.i.d. from the distribution to form $\widehat{F}(\cdot)$ . The next theorem shows the computational and sample complexities of learning this dataset for the aforementioned setup. + +Theorem 2.4 (Improved guarantees for learning XOR). Assume mini-batch SGD with batch-size $n \geq d \cdot \log^{14}(d)$ and step-size $\eta = m$ . Then, after $T = \log(d)$ iterations the test accuracy satisfies with probability at least $1 - e^{\log(m) - \log^2(d)} - e^{-\frac{m}{16}} - o_d(1)$ over the randomness of initialization and data sampling, + +$$ +\mathbb {E} _ {x, y} \left[ \mathbf {1} _ {\{y \Phi (w ^ {T}, x) > 0 \}} \right] \geq 1 - o _ {d} (1). \tag {10} +$$ + +Hence, with logarithmic number of SGD steps we use $\widetilde{O}(d)$ samples in total to reach almost perfect test accuracy. We remark based on the guarantees of Theorem 2.4, the network's width can be constant and at most must be polynomial in $d$ in order for Eq. 10 to hold with high probability. This aligns with our experiments in Fig. 4 demonstrating that the network's width can be independent of data dimension as a network of constant width (where $m = 20$ ) suffices for learning arbitrary high-dimensional XOR data. We also note the considerable gains in iteration, sample and computational complexities by Theorem 2.4 resulting from escaping the NTK regime with our step-size selection. Contrary to Theorem 2.1 which required small step-size in accordance with the descent lemma, here the step-size is proportional to width. For a comparison with recent results for this dataset we refer to Table 2 To the best of our knowledge these are the best complexities on iteration and network width for this setup. + +Remark 2.5. The proof of Theorem 2.4 (provided in Appendix E) is nuanced and involves computing expected weights and their corresponding error terms due to SGD sampling noise for each parameter of the network. It is then showed that signal strength (i.e., the strength of important features) grows as $\frac{2^t}{\sqrt{d}}$ whereas the error terms due to sampling noise and initialization grow at most at the rate $(1 + \frac{1}{\mathrm{poly}(\log(d))})^t \frac{\sqrt{d}}{\mathrm{poly}(\log(d))} + \frac{2^tt}{\sqrt{d} \cdot \mathrm{poly}(\log(d))}$ . Therefore, after $\log(d)$ steps the noise strength reaches $\frac{\sqrt{d}}{\mathrm{poly}(\log(d))}$ whereas the signal's magnitude is at least $\sqrt{d}$ , letting the signal outgrow the noise and leading to the network classifying every point correctly. + +# 3 NUMERICAL RESULTS + +Experiments on learning under NTK with small step-size. In this section, we present numerical results on the behavior of the generalization bound derived in Theorem 2.1 for real-world data (FashionMNIST and MNIST datasets) and compare it with the empirical generalization gap. + +For demonstrating our theoretical results, we are interested in the algorithmic-based generalization bound (Eq. 8) derived as, + +$$ +\mathbb {E} _ {\mathcal {S}} \left[ F \left(w _ {T}\right) - \widehat {F} \left(w _ {T}\right) \right] \leq \frac {2 . 2}{n} \mathbb {E} _ {\mathcal {S}} \left[ \sum_ {t = 0} ^ {T - 1} \widehat {F} \left(w _ {t}\right) \right]. \tag {11} +$$ + +![](images/be9a083797d618d93b5e1c7086d9af65b1ff739da20a224a3bc0f7d4e291a0a7.jpg) +Figure 1: Iteration-based distance from initialization $(\| w_t - w_0\|$ , training loss, test loss and generalization gap (i.e., test loss - train loss) for training a two hidden-layer neural network with FashionMNIST dataset and two choices of step-size. Here $n = 12 \times 10^3$ , $m = 500$ , and total number of parameters $p \approx 6 \times 10^5$ . + +![](images/40d37168e520b63084eef4749cf685ea3c781223917617172bc36d93c9c4ba44.jpg) + +![](images/f619b795861ae4d6e6cb74c6491de6285a323c49c1a47cb406305e0066b7e2db.jpg) + +![](images/d52cdf53190fe18dc69d8c34f016f7057142b3b082fccfd1fecf5025fcbaa453.jpg) + +![](images/22f2762d07cfee44924fa9a75ce2522bae9d9f0eb49e3cf9949e2fbe6cb540fd.jpg) +Figure 2: Iteration-based distance from initialization, training loss, test loss and generalization gap for training a two hidden-layer neural network with FashionMNIST dataset and $m = 250, 500$ . Here $n = 4 \times 10^3$ , $p \approx 2 \times 10^5$ (blue line), $6 \times 10^5$ (red line), and $\eta = 0.02$ . + +![](images/e1b3eee72fdf70a442b77428ddcc3820fd0cbb841cbf8c99a3679a660b0749c9.jpg) + +![](images/dd04c2ade02494a9b1e65017b91bde23c9337605f867b2b205e43f1d600b8656.jpg) + +![](images/d3f30ca3304ab2122020d546f12b75a8324c5476a3388fc73b73544e55420d47.jpg) + +![](images/43c97dfa6270a6eefbe282665ef2d43d15b32788c722e40abede1ac2638fdf04.jpg) +Figure 3: Iteration-based distance from initialization, training loss, test loss and generalization gap for training a two hidden-layer neural network with MNIST dataset and $m = 300,600$ . Here $n = 2\times 10^3$ , $p\approx 3\times 10^{5}$ (blue line), $8\times 10^{5}$ (red line) and $\eta = 0.02$ . + +![](images/c310ab67a7f512b08c424653ea07cba4452a9e6e7e2cba766d87d3f3bfa8e17f.jpg) + +![](images/8cd661474188984adb1a2e8acfcac8c63a81cad2cee459fd8b7358758eb64307.jpg) + +![](images/e63a4329af8d396995fdffd1f67d6fef0445ed410b61cc1703467ea56fda0aa8.jpg) + +We find it helpful to note that the bound above requires the width condition in the theorem (i.e., $m = \Omega(\| w^{\star} - w_0\|^{6L + 4})$ ) to be valid. However, verifying this condition is not feasible in general. Moreover, the bound is valid for expected generalization gap where the expectation is taken over data sampling. Therefore computing the exact values of both sides of the above inequality is computationally exhaustive. For our experiments we consider one realization to estimate these values. Due to both of these reasons, the theoretical test loss and generalization loss that we present in this section should only be taken as approximations of the general behavior of the bound and not as an actual verified bound on the generalization. However, in order to reduce these impacts we conduct several experiments with varying network's width. + +We consider binary classification with a 2-hidden layer network with softplus activation $(\sigma(t) = \log(1 + e^t))$ trained by the logistic loss function. Figure $\boxed{1}$ presents train, test and generalization behavior of GD for learning a such a model with FashionMNIST dataset. The two lines in each figure correspond to $\eta = 0.01, 0.1$ . In the two rightmost plots, the resulting theoretical generalization and test loss curves derived from Eq. $\boxed{11}$ are compared with the empirical values. Note the good alignment between theoretical and empirical behavior for the generalization and test loss. + +A similar behavior is observed in Figures 2-3. In Figure 2 we consider a similar setup but we reduce the sample size to 4000 training data in order to allow larger test-loss behavior. The resulting plots show the training and test loss performance for two choices of $m = 250$ and $m = 500$ . In Figure 3, we consider the MNIST dataset for $m = 300$ and $m = 600$ and let the sample size be $n = 2000$ . It is + +![](images/d65fd04ffc63543beb03c5bfb1dfd7e47c860f2998a6d0197b8bd1f3b4d34163.jpg) +Figure 4: Left: Misclassification error based on iteration in learning the $d$ -dimensional XOR distribution with SGD. Right: Total number of SGD steps based on data dimension to reach approximately zero test error. + +![](images/008bba6b08b720caf307ad300217833b33cf9bd8a11dec277366428da3f00623.jpg) + +noteworthy that the findings in both figures bear similarities, with the theoretical bounds providing non-vacuous and accurate approximations for the test loss and generalization gap. + +Experiments on learning the XOR distribution with large step-size. Figure 4 demonstrates the test error curves associated with learning the XOR distribution according to the setting of Theorem 2.4. In particular, we fix $n = 6d$ , $\eta = m = 20$ and set the total number of SGD steps as $T = \lceil \log (d) \rceil$ . Note that the number of iterations required to reach perfect accuracy grows with $d$ . The right side of Figure 4 provides further insight into the relationship between dimensionality and convergence rate. It displays the total number of SGD steps required to reach a test error below 0.01 for different values of $d$ using $n = 3d$ , $m = \eta = 20$ . The results are averages over five independent experiments and highlight the logarithmic dependence of the total SGD iterations on data dimension for achieving near-zero test error. + +# 4 CONCLUSIONS AND FUTURE DIRECTIONS + +We explored the convergence and generalization of smooth neural networks trained with gradient methods. Our first goal in this paper was to derive generalization bounds through a new stability-based approach which had not been discussed in the vast literature of deep learning. These findings represent an improvement over previous results that either required substantial over-parameterization or provided suboptimal generalization rates that depended on the network width. For general noisy data distributions, we also derived generalization guarantees showing that GD can reach the optimal test loss. We also showed that orders of magnitude improvements in sample and computational complexity are possible by surpassing the NTK limitations and using SGD with large step-size. Several directions remain open to future research: + +- It remains open to explore whether the minimum width conditions of Theorems 2.1-2.3 can be improved in terms of $\gamma$ or $n$ . +- It is also interesting to extend the XOR analysis to the noisy setting where a fraction of the data points have corrupted labels. +- The feature learning phenomenon in multi-index classification tasks remains largely unexplored. While we believe the XOR setup is a must-take first step, extensions to other multi-index models can shed further light on the strengths and limitations of neural networks. +- We also aim to understand the potential benefits of network depth in either the NTK regime or feature learning i.e., whether adding a single layer can improve sample complexity or reduce the total number of SGD iterations. + +# ACKNOWLEDGEMENTS + +This works was supported by NSF grant CCF 2217058. + +# REFERENCES + +Emmanuel Abbe, Enric Boix Adsera, and Theodor Misiakiewicz. The merged-staircase property: a necessary and nearly sufficient condition for sgd learning of sparse functions on two-layer neural networks. In Conference on Learning Theory, pp. 4782-4887. PMLR, 2022. +Jimmy Ba, Murat A Erdogdu, Taiji Suzuki, Zhichao Wang, Denny Wu, and Greg Yang. High-dimensional asymptotics of feature learning: How one gradient step improves the representation. Advances in Neural Information Processing Systems, 35:37932-37946, 2022. +Yu Bai and Jason D Lee. Beyond linearization: On quadratic and higher-order approximation of wide neural networks. arXiv preprint arXiv:1910.01619, 2019. +Arindam Banerjee, Pedro Cisneros-Velarde, Libin Zhu, and Mikhail Belkin. Restricted strong convexity of deep learning models with smooth activations. arXiv preprint arXiv:2209.15106, 2022. +Boaz Barak, Benjamin Edelman, Surbhi Goel, Sham Kakade, Eran Malach, and Cyril Zhang. Hidden progress in deep learning: Sgd learns parities near the computational limit. Advances in Neural Information Processing Systems, 35:21750-21764, 2022. +Peter L Bartlett, Dylan J Foster, and Matus J Telgarsky. Spectrally-normalized margin bounds for neural networks. Advances in neural information processing systems, 30, 2017. +Olivier Bousquet and André Elisseeff. Stability and generalization. Journal of Machine Learning Research (JMLR), 2:499-526, 2002. +Yuan Cao and Quanquan Gu. Generalization bounds of stochastic gradient descent for wide and deep neural networks. Advances in neural information processing systems, 32, 2019. +Zixiang Chen, Yuan Cao, Difan Zou, and Quanquan Gu. How much over-parameterization is sufficient to learn deep re{lu} networks? In International Conference on Learning Representations, 2021. URL https://openreview.net/forum?id=fgd7we_uZa6. +Hugo Cui, Luca Pesce, Yatin Dandi, Florent Krzakala, Yue M Lu, Lenka Zdeborova, and Bruno Loureiro. Asymptotics of feature learning in two-layer networks after one gradient-step. arXiv preprint arXiv:2402.04980, 2024. +Alexandru Damian, Jason Lee, and Mahdi Soltanolkotabi. Neural networks can learn representations with gradient descent. In Conference on Learning Theory, pp. 5413-5452. PMLR, 2022. +Simon Du, Jason Lee, Haochuan Li, Liwei Wang, and Xiyu Zhai. Gradient descent finds global minima of deep neural networks. In International conference on machine learning, pp. 1675-1685. PMLR, 2019. +Margalit Glasgow. Sgd finds then tunes features in two-layer neural networks with near-optimal sample complexity: A case study in the xor problem. In The Twelfth International Conference on Learning Representations, 2024. +Noah Golowich, Alexander Rakhlin, and Ohad Shamir. Size-independent sample complexity of neural networks. In Conference On Learning Theory, pp. 297-299. PMLR, 2018. +Moritz Hardt, Ben Recht, and Yoram Singer. Train faster, generalize better: Stability of stochastic gradient descent. In International Conference on Machine Learning (ICML), volume 48, pp. 1225-1234, 2016. +Arthur Jacot, Franck Gabriel, and Clement Hongler. Neural tangent kernel: Convergence and generalization in neural networks. In Neural Information Processing Systems (NeurIPS), volume 31, 2018. +Ziwei Ji and Matus Telgarsky. Polylogarithmic width suffices for gradient descent to achieve arbitrarily small test error with shallow relu networks. International Conference on Learning Representations, 2020. + +Beatrice Laurent and Pascal Massart. Adaptive estimation of a quadratic functional by model selection. Annals of statistics, pp. 1302-1338, 2000. +Yunwen Lei and Yiming Ying. Fine-grained analysis of stability and generalization for stochastic gradient descent. In International Conference on Machine Learning (ICML), volume 119, pp. 5809-5819, 2020. +Mingchen Li, Mahdi Soltanolkotabi, and Samet Oymak. Gradient descent with early stopping is provably robust to label noise for overparameterized neural networks. In International conference on artificial intelligence and statistics, pp. 4313-4324. PMLR, 2020. +Chaoyue Liu, Libin Zhu, and Misha Belkin. On the linearity of large non-linear models: when and why the tangent kernel is constant. Advances in Neural Information Processing Systems, 33: 15954-15964, 2020. +Chaoyue Liu, Libin Zhu, and Mikhail Belkin. Loss landscapes and optimization in over-parameterized non-linear systems and neural networks. Applied and Computational Harmonic Analysis, 59: 85-116, 2022. +Behnam Neyshabur, Srinadh Bhojanapalli, and Nathan Srebro. A pac-bayesian approach to spectrally-normalized margin bounds for neural networks. In International Conference on Learning Representations, 2018. +Atsushi Nitanda, Geoffrey Chinot, and Taiji Suzuki. Gradient descent can learn less over-parameterized two-layer neural networks on classification problems. arXiv preprint arXiv:1905.09870, 2019. +Samet Oymak and Mahdi Soltanolkotabi. Overparameterized nonlinear learning: Gradient descent takes the shortest path? In International Conference on Machine Learning, pp. 4951-4960. PMLR, 2019. +Dominic Richards and Mike Rabbat. Learning with gradient descent and weakly convex losses. In International Conference on Artificial Intelligence and Statistics, pp. 1990-1998. PMLR, 2021. +Matan Schliserman and Tomer Koren. Stability vs implicit bias of gradient methods on separable data and beyond. In Conference on Learning Theory (COLT), volume 178, pp. 3380-3394, 2022. +Shai Shalev-Shwartz and Shai Ben-David. Understanding machine learning: From theory to algorithms. Cambridge university press, 2014. +Hossein Taheri and Christos Thrampoulidis. Generalization and stability of interpolating neural networks with minimal width. Journal of Machine Learning Research, 25(156):1-41, 2024. +Matus Telgarsky. Feature selection and low test error in shallow low-rotation relu networks. In The Eleventh International Conference on Learning Representations, 2023. +Roman Vershynin. High-dimensional probability: An introduction with applications in data science, volume 47. Cambridge university press, 2018. +Puyu Wang, Yunwen Lei, Di Wang, Yiming Ying, and Ding-Xuan Zhou. Generalization guarantees of gradient descent for multi-layer neural networks. arXiv preprint arXiv:2305.16891, 2023. +Colin Wei, Jason D Lee, Qiang Liu, and Tengyu Ma. Regularization matters: Generalization and optimization of neural nets vs their induced kernel. Advances in Neural Information Processing Systems, 32, 2019. \ No newline at end of file diff --git a/ICLR/2025/Sharper Guarantees for Learning Neural Network Classifiers with Gradient Methods/images.zip b/ICLR/2025/Sharper Guarantees for Learning Neural Network Classifiers with Gradient Methods/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..973309e26e00cae42ea0b753641a72bccc934aac --- /dev/null +++ b/ICLR/2025/Sharper Guarantees for Learning Neural Network Classifiers with Gradient Methods/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d0b7a1465755ec587dec843ad45a1bbcdce767c573724741c1caf533abc84fc8 +size 261546 diff --git a/ICLR/2025/Sharper Guarantees for Learning Neural Network Classifiers with Gradient Methods/layout.json b/ICLR/2025/Sharper Guarantees for Learning Neural Network Classifiers with Gradient Methods/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..6b2a35d2a8bba6d69e1a08453b50e70e4e3675b8 --- /dev/null +++ b/ICLR/2025/Sharper Guarantees for Learning Neural Network Classifiers with Gradient Methods/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fab1b4c53be69d71b8c921303ef663563d11e02ac18cafb4c757f9da698ea98a +size 489733 diff --git a/ICLR/2025/Sharpness-Aware Black-Box Optimization/b8d9060d-402e-42ae-8f6c-6f15fc71928b_content_list.json b/ICLR/2025/Sharpness-Aware Black-Box Optimization/b8d9060d-402e-42ae-8f6c-6f15fc71928b_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..78c76f9170e19f8430c39200409e4a54ad8b7a8c --- /dev/null +++ b/ICLR/2025/Sharpness-Aware Black-Box Optimization/b8d9060d-402e-42ae-8f6c-6f15fc71928b_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:71f966b68396f8f949161f6e9d252411ea4c87cb37e75b53de9a13eb0d0e1ae6 +size 247613 diff --git a/ICLR/2025/Sharpness-Aware Black-Box Optimization/b8d9060d-402e-42ae-8f6c-6f15fc71928b_model.json b/ICLR/2025/Sharpness-Aware Black-Box Optimization/b8d9060d-402e-42ae-8f6c-6f15fc71928b_model.json new file mode 100644 index 0000000000000000000000000000000000000000..fc1546ff31a094173fd8bb8e1e4b5e64227f1ef8 --- /dev/null +++ b/ICLR/2025/Sharpness-Aware Black-Box Optimization/b8d9060d-402e-42ae-8f6c-6f15fc71928b_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:90f56da468f4fa9b2dbbfc4a9f652a9c91fc33b3521337452a77560a7f6df41c +size 287117 diff --git a/ICLR/2025/Sharpness-Aware Black-Box Optimization/b8d9060d-402e-42ae-8f6c-6f15fc71928b_origin.pdf b/ICLR/2025/Sharpness-Aware Black-Box Optimization/b8d9060d-402e-42ae-8f6c-6f15fc71928b_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..f19068f3739adfaece3769f7b6d08be590446b8d --- /dev/null +++ b/ICLR/2025/Sharpness-Aware Black-Box Optimization/b8d9060d-402e-42ae-8f6c-6f15fc71928b_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:adf1a231de947d0a47347b13b24c4d810738141c8d8cc9f69e6fa77c0aec0bb9 +size 1242173 diff --git a/ICLR/2025/Sharpness-Aware Black-Box Optimization/full.md b/ICLR/2025/Sharpness-Aware Black-Box Optimization/full.md new file mode 100644 index 0000000000000000000000000000000000000000..8d2cfae7451cd45455fc7dbb68a88d44847dbb55 --- /dev/null +++ b/ICLR/2025/Sharpness-Aware Black-Box Optimization/full.md @@ -0,0 +1,1163 @@ +# SHARPNESS-AWARE BLACK-BOX OPTIMIZATION + +Feiyang Ye $^{1,2,*}$ , Yueming Lyu $^{3,4,*}$ , Xuehao Wang $^{1}$ , Masashi Sugiyama $^{5,6}$ , Yu Zhang $^{1,\dagger}$ , Ivor W. Tsang $^{2,3,4,7}$ + +1Department of Computer Science and Engineering, Southern University of Science and Technology +$^{2}$ Australian Artificial Intelligence Institute, University of Technology Sydney +3Centre for Frontier AI Research, Agency for Science, Technology and Research, Singapore +$^{4}$ Institute of High Performance Computing, Agency for Science, Technology and Research, Singapore +$^{5}$ RIKEN Center for Advanced Intelligence Project +6Graduate School of Frontier Sciences, The University of Tokyo +7College of Computing and Data Science, Nanyang Technological University + +{feiyang.ye.uts,xuehaowangfi,yu.zhang.ust}@gmail.com + +sugi@k.u-tokyo.ac.jp {Lyu_Yueming,Ivor_Tsang}@cfar.a-star.edu.sg + +# ABSTRACT + +Black-box optimization algorithms have been widely used in various machine learning problems, including reinforcement learning and prompt fine-tuning. However, directly optimizing the training loss value, as commonly done in existing black-box optimization methods, could lead to suboptimal model quality and generalization performance. To address those problems in black-box optimization, we propose a novel Sharpness-Aware Black-box Optimization (SABO) algorithm, which applies a sharpness-aware minimization strategy to improve the model generalization. Specifically, the proposed SABO method first reparameterizes the objective function by its expectation over a Gaussian distribution. Then it iteratively updates the parameterized distribution by approximated stochastic gradients of the maximum objective value within a small neighborhood around the current solution in the Gaussian distribution space. Theoretically, we prove the convergence rate and generalization bound of the proposed SABO algorithm. Empirically, extensive experiments on the black-box prompt fine-tuning tasks demonstrate the effectiveness of the proposed SABO method in improving model generalization performance. + +# 1 INTRODUCTION + +Black-box optimization involves optimizing one objective function by using function queries only. In this work, we study the black-box optimization problem (Jones et al., 1998), which is formulated as + +$$ +\min _ {\boldsymbol {x}} F (\boldsymbol {x}), \text {s . t .} \boldsymbol {x} \in \mathcal {X}, \tag {1} +$$ + +where $\mathcal{X} \subseteq \mathbb{R}^d$ , and $d$ represents the parameter dimension. The objective function $F: \mathbb{R}^d \to \mathbb{R}$ which satisfies $F(\boldsymbol{x}) \geq -\infty$ (lower bounded), can only be queried to obtain function values and we cannot get the gradient of $F$ w.r.t. $\boldsymbol{x}$ . In this work, we focus on the online setting for black-box optimization, where different from the offline setting (Chen et al., 2022; Qi et al., 2022), we do not have a prior dataset containing the variable $\boldsymbol{x}$ and its corresponding objective value. + +Black-box optimization has drawn intensive attention in a wide range of applications, such as deep reinforcement learning (Salimans et al., 2017; Conti et al., 2018), black-box adversarial attacks of deep neural networks (Ilyas et al., 2018; Dong et al., 2019), etc. Recently, black-box optimization has shown increasing power on real-world natural language processing tasks, especially with the emergence of large language models (LLMs). Since a common practice is to release LLMs as a service and allow users to access it through their inference APIs. In such a scenario, called Languaged-Model-as-a-Service (LMaaS) (Sun et al., 2022b;a; 2023), users cannot access or tune model parameters but can only tune their prompts without model backpropagation to accomplish language tasks of interest, which directly increase the demand of black-box optimization methods. + +Although black-box optimization algorithms have been successfully applied to various learning tasks, most existing works directly optimize the training loss value (Sun et al., 2022b), which may lead to suboptimal model quality and generalization performance. Since the training loss landscape is complex and has many local minima with different generalization abilities (Zhang et al., 2021), the learned model may suffer from the overfitting problem, causing poor generalization performance (Foret et al., 2021). Hence, reducing the performance gap between training and testing is an important research topic in deep learning (Neyshabur et al., 2017). Recently, there have been many works exploring the close relationship between loss geometry and generalization performance, and it has been observed that flat minima often imply better generalization (Dziugaite & Roy, 2017; Chatterji et al., 2019; Petzka et al., 2021). This inspires us to design a black-box optimization algorithm to improve the model generalization by finding the flat minima. + +Sharpness-aware minimization (SAM) (Foret et al., 2021) is a state-of-the-art method to seek flat minima in white-box cases by solving a min-max optimization problem. SAM minimizes the maximum objective value within a small neighborhood around current solution. Since SAM considers the geometry of the Euclidean parameter space, it uses the Euclidean ball to define the neighborhood. In SAM, each update consists of two forward-backward computations: one for computing the perturbation and the other for computing the actual update direction. SAM has been proven to perform better than SGD and its variants (Kwon et al., 2021; Zhuang et al., 2022; Zhao et al., 2022; Kim et al., 2022; Jiang et al., 2023; Liu et al., 2022) yield significant performance gains in various fields such as computer vision and natural language processing (Bahri et al., 2022; Foret et al., 2021). However, SAM and its variants rely on the availability of true gradients or stochastic gradients w.r.t. the variable $x$ , so they are inapplicable to black-box optimization. + +To take advantage of SAM to improve the generalization performance of black-box optimization, we propose a Sharpness-Aware Black-box Optimization (SABO) algorithm. Specifically, SABO first reparameterizes the objective function via its expectation over a Gaussian distribution, which can help to optimize the objective by only accessing the function value (Wierstra et al., 2014; Lyu & Tsang, 2021). Then the SABO method seeks to identify the robust minimum region over the space of Gaussian distributions, which is different from SAM that finds the flat minimum over the parameter space. To achieve that, the SABO method iteratively updates the parameterized distribution via a search direction obtained by approximated stochastic gradients for the maximum objective value within a small neighborhood around the current solution in the space of Gaussian distributions. Theoretically, we analyze the convergence rate and provide a generalization error bound for the proposed SABO algorithm. Empirically, we verify the convergence result of the proposed algorithm on the synthetic problems, and extensive experimental results on a black-box prompt fine-tuning problem demonstrate the effectiveness of the proposed SABO method. Our contributions are summarized as follows. + +- We propose the SABO algorithm for black-box optimization. To the best of our knowledge, we are the first to design a stochastic gradient approximation algorithm to improve the model generalization in black-box optimization by using the sharpness-aware minimization strategy. +- Theoretically, we prove that the proposed SABO algorithm possesses a convergence rate $\mathcal{O}\left(\frac{\log T}{T}\right)$ in a full-batch function query setting and $\mathcal{O}\left(\frac{1}{\sqrt{T}}\right)$ in a mini-batch function query setting, respectively. Moreover, we provide a generalization error analysis for the proposed SABO method. +- Empirically, we verify the convergence result of the SABO algorithm on the synthetic numerical problems. Moreover, extensive experiments on black-box prompt fine-tuning tasks demonstrate the effectiveness of the proposed SABO method in improving the model generalization performance. + +Notation and Symbols. We denote by $\| \cdot \| _2$ and $\| \cdot \|_{\infty}$ the $l_{2}$ norm and the $l_{\infty}$ norm for vectors, respectively. $\| \cdot \|_{\mathrm{F}}$ denotes the Frobenius norm for matrices. $S^{+}$ denotes the set of positive semi-definite matrices. For a square matrix $\mathbf{X}$ , $\operatorname {diag}(\mathbf{X})$ represents a vector with diagonal entries in $\mathbf{X}$ , and if $\mathbf{x}$ is a vector, $\operatorname {diag}(\mathbf{x})$ represents a diagonal matrix with $\mathbf{x}$ as its diagonal entries. We define $\| X\| _Y\coloneqq \sqrt{\langle X,YX\rangle}$ for a positive semi-definite matrix $Y\in S^{+}$ or a non-negative vector $Y$ , where $\langle \cdot ,\cdot \rangle$ denotes the inner product under the Frobenius norm for matrices and inner product under the $l_{2}$ norm for vectors. $\frac{X}{Y}$ denotes the elementwise division operation when $X$ and $Y$ are vectors (for the diagonal matrix), and the elementwise division operation for diagonal elements in $X$ and $Y$ when they are diagonal matrices. + +# 2 BACKGROUND + +Stochastic Gradient Approximation The stochastic gradient approximation method (Wierstra et al., 2014; Lyu & Tsang, 2021; Ye et al., 2024) is a representative strategy for solving black-box optimization problems, which instead of maintaining a population of searching points, iteratively updates a search distribution by stochastic gradient approximation. The general procedure of stochastic gradient approximation methods is to first generate a batch of sample points by a parameterized search distribution. Then the sample points allow the algorithm to capture the local structure of the fitness function and appropriately estimate the stochastic gradient to update the distribution. + +Specifically, the stochastic gradient approximation method reparameterizes $F(\pmb{x})$ as + +$$ +J (\boldsymbol {\theta}) = \mathbb {E} _ {p \boldsymbol {\theta} (\boldsymbol {x})} [ F (\boldsymbol {x}) ] = \int F (\boldsymbol {x}) p (\boldsymbol {x}; \boldsymbol {\theta}) \mathrm {d} \boldsymbol {x}, \tag {2} +$$ + +where $\theta$ denotes the parameters of density $p(\boldsymbol{x};\boldsymbol{\theta})$ or $p_{\boldsymbol{\theta}}$ and $F(\boldsymbol{x})$ is also referred to as the fitness function for $\boldsymbol{x}$ . Based on this definition, we can obtain the Monte Carlo estimation of the search gradient as + +$$ +\bar {\nabla} _ {\boldsymbol {\theta}} J (\boldsymbol {\theta}) = \frac {1}{N} \sum_ {j = 1} ^ {N} F \left(\boldsymbol {x} _ {j}\right) \nabla_ {\boldsymbol {\theta}} \log p _ {\boldsymbol {\theta}} \left(\boldsymbol {x} _ {j}\right), \tag {3} +$$ + +where $\boldsymbol{x}_j$ denotes the $j$ -th sample and $N$ denotes the number of samples. Therefore, the stochastic gradient $\bar{\nabla}_{\theta} J(\theta)$ provides a search direction in the space of search distributions. + +Sharpness-Aware Minimization SAM (Foret et al., 2021) attempts to improve generalization by finding flat minima. This is achieved by minimizing the worst-case loss within some perturbation radius. Mathematically, it is formulated as the following minimax optimization problem: + +$$ +\min _ {\boldsymbol {x} \in \mathcal {X}} \max _ {\| \boldsymbol {\epsilon} \| _ {2} \leq \rho^ {2}} F (\boldsymbol {x} + \boldsymbol {\epsilon}), \tag {4} +$$ + +where $F:\mathbb{R}^d\to \mathbb{R}$ is the objective function, $\pmb{x}$ denotes variables that can represent model parameters, $\rho >0$ is a positive constant, and $\epsilon$ is the perturbation whose magnitude is bounded by $\rho^2$ . By taking the first-order approximation of $F(\pmb {x} + \pmb {\epsilon})$ over $F(x)$ , a solution of $\pmb{\epsilon}$ for the maximization subproblem can be obtained as + +$$ +\boldsymbol {\epsilon} (\boldsymbol {x}) = \frac {\rho^ {2} \nabla F (\boldsymbol {x})}{\| \nabla F (\boldsymbol {x}) \| _ {2}}. \tag {5} +$$ + +Then problem (4) can be solved by performing the gradient descent method for the minimization subproblem as $\pmb{x}_{t+1} = \pmb{x}_t - \beta_t \nabla_{\pmb{x}} F(\pmb{x}_t + \pmb{\epsilon}(\pmb{x}_t))$ , where $\beta_t$ represents the step size in the $t$ -th iteration. Note that this gradient implicitly depends on the Hessian of $F(\pmb{x})$ because $\pmb{\epsilon}(\pmb{x})$ is a function of $\pmb{x}$ . To accelerate the computation, a common approach in SAM-based methods (Foret et al., 2021; Kim et al., 2022; Jiang et al., 2023) is to apply a first-order gradient approximation, so we obtain the update rule for SAM as $\pmb{x}_{t+1} = \pmb{x}_t - \beta_t \nabla_{\pmb{x}} F(\pmb{x})|_{\pmb{x} = \pmb{x}_t + \pmb{\epsilon}_t}$ , where $\pmb{\epsilon}_t = \pmb{\epsilon}(\pmb{x}_t)$ is viewed as a constant w.r.t. $\pmb{x}$ . + +# 3 METHODOLOGY + +In this section, we introduce the proposed SABO algorithm. Firstly, we formulate the sharpness-aware black-box optimization as a min-max optimization problem and solve it in Section 3.1, and in Section 3.2, we derive the update formula of parameters in the search distribution. The detailed derivations in this section are put in Appendix A. + +# 3.1 SHARPNESS-AWARE BLACK-BOX OPTIMIZATION + +Suppose we are given a training set $\mathcal{D}$ with i.i.d. samples $\{(X_i, y_i)\}$ . The main objective is defined as + +$$ +F (\boldsymbol {x}; \mathcal {D}) = \frac {1}{| \mathcal {D} |} \sum_ {\left(X _ {i}, y _ {i}\right) \in \mathcal {D}} l (\boldsymbol {x}; \left(X _ {i}, y _ {i}\right)), \tag {6} +$$ + +where $\pmb{x}$ denotes model parameters, $|\mathcal{D}|$ denotes the number of data in the dataset $\mathcal{D}$ , and $l(\pmb{x};(X,y))$ denotes the loss function (e.g., the cross-entropy loss for classification). To simplify the notation, we define $F(\pmb{x}) \coloneqq F(\pmb{x};\mathcal{D})$ . + +In black-box optimization, we aim at minimizing the objective function $F(\pmb{x})$ , with only function queries. Due to the lack of gradient information, we first apply the stochastic gradient approximation method (Wierstra et al., 2014; Lyu & Tsang, 2021). We denote by $\pmb{\theta}$ the parameters of the search distribution $p_{\theta}$ and define the expected fitness of $F(\pmb{x})$ under the parametric search distribution $p_{\pmb{\theta}}(\pmb{x})$ as $J(\pmb{\theta}) = \mathbb{E}_{p_{\pmb{\theta}}(\pmb{x})}[F(\pmb{x})]$ . Then the optimal parameter $\pmb{\theta}$ can be found by minimizing the reparameterized objective $J(\pmb{\theta})$ . + +Inspired by SAM (Foret et al., 2021), we attempt to improve generalization by finding flat minima of $\theta$ . However, for the reparameterized objective $J(\theta)$ , the geometry of the corresponding distribution space is not Euclidean but a statistical manifold, where the distance between two probability distributions is defined by some statistical distance, e.g., Kullback-Leibler (KL) divergence. Therefore, instead of restricting the perturbation in an Euclidean ball, we restrict the perturbation distribution to be inside a small neighborhood of the unperturbed distribution w.r.t. the KL divergence (Amari, 2016). The proposed optimization problem for black-box optimization is formulated as + +$$ +\min _ {\boldsymbol {\theta}} \max _ {\boldsymbol {\delta} \in \mathcal {C} (\boldsymbol {\theta})} J (\boldsymbol {\theta} + \boldsymbol {\delta}), \tag {7} +$$ + +where $\mathcal{C}(\pmb{\theta}) = \{\delta \mid \mathrm{KL}(p_{\theta + \delta} \| p_{\theta}) \leq \rho^2\}$ , $\rho$ is a positive constant, and $J(\pmb{\theta} + \delta) = \mathbb{E}_{x \sim p_{\theta + \delta}}[F(\pmb{x})]$ . Note that $\mathcal{C}(\pmb{\theta})$ defines the neighborhood around a given distribution $p_{\theta}$ in the distribution space, which is different from the neighborhood of SAM that is defined in the parameter space. Here $\rho$ defines the size of the neighborhood. + +Generally, problem (7) is applicable to any family of distribution $p_{\theta}$ . For computational consideration, the search distribution is assumed to be a Gaussian distribution, i.e., $p_{\theta}(x) = \mathcal{N}(x \mid \mu, \Sigma)$ where $\mu$ denotes the mean and $\Sigma$ denotes the covariance matrix, and correspondingly $\theta$ includes $\mu$ and $\Sigma$ , i.e., $\theta = \{\mu, \Sigma\}$ . In this work, we assume that the covariance matrix $\Sigma$ is a diagonal matrix. For a perturbation $\delta = \{\delta_{\mu}, \delta_{\Sigma}\}$ where $\delta_{\Sigma}$ is a digaonal matrix, the perturbed distribution is a Gaussian distribution $p_{\theta + \delta}(x) = \mathcal{N}(x \mid \mu + \delta_{\mu}, \Sigma + \delta_{\Sigma})$ . + +We need to solve problem (7) to derive the update formulation for $\theta$ . By using the first-order Taylor expansion, the maximization subproblem can be approximated as a quadratically constrained linear programming problem: + +$$ +\max _ {\boldsymbol {\delta} \in \mathcal {C} (\boldsymbol {\theta})} J (\boldsymbol {\theta} + \boldsymbol {\delta}) \approx \max _ {\boldsymbol {\delta} \in \mathcal {C} (\boldsymbol {\theta})} \left\langle \nabla_ {\boldsymbol {\theta}} J (\boldsymbol {\theta}), \boldsymbol {\delta} \right\rangle , \tag {8} +$$ + +The corresponding Lagrangian of problem (8) is + +$$ +\mathcal {L} (\boldsymbol {\delta}, \lambda) = - \left\langle \nabla_ {\boldsymbol {\theta}} J (\boldsymbol {\theta}), \boldsymbol {\delta} \right\rangle + \lambda \left(\mathrm {K L} \left(p _ {\boldsymbol {\theta} + \boldsymbol {\delta}} \| p _ {\boldsymbol {\theta}}\right) - \rho^ {2}\right), \tag {9} +$$ + +where $\lambda$ is the Lagrange multiplier. We can see that problem (9) is convex with respect to $\delta$ . Therefore, by setting the derivatives w.r.t. $\delta_{\mu}$ and $\delta_{\Sigma}$ to zero, we can obtain $\delta$ as + +$$ +\delta_ {\mu} (\boldsymbol {\theta}) = \frac {1}{\lambda} \Sigma \nabla_ {\mu} J (\boldsymbol {\theta}), \quad \delta_ {\Sigma} (\boldsymbol {\theta}) = \frac {2 \Sigma \nabla_ {\Sigma} J (\boldsymbol {\theta})}{\lambda \Sigma^ {- 1} - 2 \nabla_ {\Sigma} J (\boldsymbol {\theta})}. \tag {10} +$$ + +As shown in Eq. (10), to calculate the perturbation, we need to calculate the inverse covariance matrix, i.e., $\Sigma^{-1}$ , which is computationally expensive for high-dimensional problems. Therefore, assuming that $\pmb{\Sigma}$ is a diagonal matrix can significantly reduce the computation cost. Then by plugging $\delta_{\mu}(\theta)$ and $\delta_{\Sigma}(\theta)$ into the neighborhood constraint, i.e., $\delta \in \mathcal{C}(\theta)$ , we can determine the optimal $\lambda$ as + +$$ +\lambda = \frac {1}{\rho} \sqrt {\| \boldsymbol {\Sigma} \nabla_ {\boldsymbol {\Sigma}} J (\boldsymbol {\theta}) \| _ {\mathrm {F}} ^ {2} + 0 . 5 \| \boldsymbol {\Sigma} ^ {\frac {1}{2}} \nabla_ {\boldsymbol {\mu}} J (\boldsymbol {\theta}) \| _ {2} ^ {2}}. \tag {11} +$$ + +Based on Eqs. (10) and (11), we obtain the approximated closed-form solution $\delta (\pmb {\theta})$ for a given $\pmb{\theta}$ . With $\delta (\pmb {\theta})$ , the minimization subproblem of problem (7) can be reformulated as + +$$ +\min _ {\boldsymbol {\theta}} J (\boldsymbol {\theta} + \boldsymbol {\delta} (\boldsymbol {\theta})). \tag {12} +$$ + +To solve problem (12), in the $t$ -th iteration, we add a regularization term $\frac{1}{\beta_t}\mathrm{KL}(p_\theta \| p_{\theta_t})$ to problem (12) to enforce $\pmb{\theta}$ to be close to $\pmb{\theta}_t$ , and obtain $\pmb{\theta}_{t + 1}$ by solving the following problem as + +$$ +\boldsymbol {\theta} _ {t + 1} = \arg \min _ {\boldsymbol {\theta}} J (\boldsymbol {\theta} + \boldsymbol {\delta} (\boldsymbol {\theta} _ {t})) - J (\boldsymbol {\theta} _ {t}) + \frac {1}{\beta_ {t}} \mathrm {K L} (p _ {\boldsymbol {\theta}} \| p _ {\boldsymbol {\theta} _ {t}}). \tag {13} +$$ + +Following standard SAM-based methods (Foret et al., 2021), we treat $\delta(\theta_t)$ as a constant $\delta_t$ instead of a function of $\theta_t$ to accelerate the computation. Then by using the first-order Taylor expansion, problem (13) can be approximated as + +$$ +\boldsymbol {\theta} _ {t + 1} = \arg \min _ {\boldsymbol {\theta}} \left\langle \boldsymbol {\theta} - \boldsymbol {\theta} _ {t}, \nabla_ {\boldsymbol {\theta}} J \left(\boldsymbol {\theta} _ {t} + \boldsymbol {\delta} _ {t}\right) \right\rangle + \frac {1}{\beta_ {t}} \mathrm {K L} \left(p _ {\boldsymbol {\theta}} \| p _ {\boldsymbol {\theta} _ {t}}\right). \tag {14} +$$ + +By solving problem (14), we can obtain the update formulations for $\mu$ and $\Sigma$ in the $t$ -th iteration as + +$$ +\boldsymbol {\mu} _ {t + 1} = \boldsymbol {\mu} _ {t} - \beta_ {t} \boldsymbol {\Sigma} _ {t} \nabla_ {\boldsymbol {\mu}} J (\boldsymbol {\theta} _ {t} + \boldsymbol {\delta} _ {t}), \quad \boldsymbol {\Sigma} _ {t + 1} ^ {- 1} = \boldsymbol {\Sigma} _ {t} ^ {- 1} + 2 \beta_ {t} \nabla_ {\boldsymbol {\Sigma}} J (\boldsymbol {\theta} _ {t} + \boldsymbol {\delta} _ {t}), \tag {15} +$$ + +where $\nabla_{\pmb{\mu}}J(\pmb{\theta}_t + \pmb{\delta}_t)$ and $\nabla_{\pmb{\Sigma}}J(\pmb{\theta}_t + \pmb{\delta}_t)$ denote the derivative of $J(\pmb{\theta})$ w.r.t. $\pmb{\mu}$ and $\pmb{\Sigma}$ at $\pmb{\mu} = \pmb{\theta}_t + \pmb{\delta}_{\pmb{\mu}_t}$ and $\pmb{\Sigma} = \pmb{\Sigma}_t + \pmb{\delta}_{\pmb{\Sigma}_t}$ , respectively. + +# 3.2 UPDATE FORMULATIONS FOR SABO + +The gradients of the reparameterized objective $J(\theta)$ w.r.t. $\pmb{\mu}$ and $\pmb{\Sigma}$ rely on the expectations of the black-box function and can be obtained with only function queries (Wierstra et al., 2014) (see Theorem A.1 in Appendix A.4). Hence, we estimate them by Monte Carlo sampling. Specifically, the stochastic approximation of the gradients $\nabla_{\pmb{\mu}}J(\pmb{\theta}_t)$ and $\nabla_{\pmb{\Sigma}}J(\pmb{\theta}_t)$ are given as + +$$ +\boldsymbol {g} _ {t} ^ {\prime} = \frac {1}{N} \sum_ {j = 1} ^ {N} \boldsymbol {\Sigma} _ {t} ^ {- 1} \left(\boldsymbol {x} _ {j} ^ {\prime} - \boldsymbol {\mu} _ {t}\right) \left(F \left(\boldsymbol {x} _ {j} ^ {\prime}\right) - F (\boldsymbol {\mu} _ {t})\right), \tag {16} +$$ + +$$ +\boldsymbol {G} _ {t} ^ {\prime} = \frac {1}{2 N} \sum_ {j = 1} ^ {N} \operatorname {d i a g} \left[ \boldsymbol {\Sigma} _ {t} ^ {- 1} \left[ \operatorname {d i a g} \left(\left(\boldsymbol {x} _ {j} ^ {\prime} - \boldsymbol {\mu} _ {t}\right) \left(\boldsymbol {x} _ {j} ^ {\prime} - \boldsymbol {\mu} _ {t}\right) ^ {\top} \boldsymbol {\Sigma} _ {t} ^ {- 1} - \boldsymbol {I}\right) \left(F \left(\boldsymbol {x} _ {j} ^ {\prime}\right) - F \left(\boldsymbol {\mu} _ {t}\right)\right) \right] \right], \tag {17} +$$ + +where $\boldsymbol{x}_j'$ denotes the $j$ -th sample sampled from the distribution $\mathcal{N}(\boldsymbol{x} \mid \boldsymbol{\mu}_t, \boldsymbol{\Sigma}_t)$ . Note that $\boldsymbol{g}_t'$ is an unbiased estimator for the gradient $\nabla_{\boldsymbol{\mu}} J(\boldsymbol{\theta})$ as proved in Lemma C.5, and inspired by Lyu & Tsang (2021), we subtract $F(\boldsymbol{\mu}_t)$ to improve the computational stability while keeping them as unbiased estimations. To avoid the scaling problem, in practice, we can employ a monotonic transformation strategy and the details can be found in Appendix F. + +Then according to Eq. (10), we obtain the perturbation $\delta_t$ in the $t$ -th iteration as + +$$ +\boldsymbol {\delta} _ {t} = \left\{\frac {1}{\lambda} \boldsymbol {\Sigma} _ {t} \boldsymbol {g} _ {t} ^ {\prime}, \frac {2 \boldsymbol {\Sigma} _ {t} \boldsymbol {G} _ {t} ^ {\prime}}{\lambda \boldsymbol {\Sigma} _ {t} ^ {- 1} - 2 \boldsymbol {G} _ {t} ^ {\prime}} \right\}, \tag {18} +$$ + +where $\lambda$ is approximated by $\frac{1}{\rho}\sqrt{\|\pmb{\Sigma}_t\pmb{G}_t'\|_{\mathrm{F}}^2 + 0.5\|\pmb{\Sigma}_t^{\frac{1}{2}}\pmb{g}_t'\|_2^2}$ . Similarly, the gradients $\nabla_{\mu}J(\pmb{\theta}_t + \pmb{\delta}_t)$ and $\nabla_{\Sigma}J(\pmb{\theta}_t + \pmb{\delta}_t)$ can be approximated as follows: + +$$ +\boldsymbol {g} _ {t} = \frac {1}{N} \sum_ {j = 1} ^ {N} \widehat {\Sigma} _ {t} ^ {- 1} \left(\boldsymbol {x} _ {j} - \widehat {\boldsymbol {\mu}} _ {t}\right) \left(F \left(\boldsymbol {x} _ {j}\right) - F \left(\widehat {\boldsymbol {\mu}} _ {t}\right)\right), \tag {19} +$$ + +$$ +\boldsymbol {G} _ {t} = \frac {1}{2 N} \sum_ {j = 1} ^ {N} \operatorname {d i a g} \left[ \widehat {\boldsymbol {\Sigma}} _ {t} ^ {- 1} \left[ \operatorname {d i a g} \left(\left(\boldsymbol {x} _ {j} - \widehat {\boldsymbol {\mu}} _ {t}\right) \left(\boldsymbol {x} _ {j} - \widehat {\boldsymbol {\mu}} _ {t}\right) ^ {\top} \widehat {\boldsymbol {\Sigma}} _ {t} ^ {- 1} - \boldsymbol {I}\right) \left(F \left(\boldsymbol {x} _ {j}\right) - F \left(\widehat {\boldsymbol {\mu}} _ {t}\right)\right) \right] \right], \tag {20} +$$ + +where $\widehat{\Sigma}_t = \Sigma_t + \delta_{\Sigma_t}$ , $\widehat{\mu}_t = \mu_t + \delta_{\mu_t}$ , and $x_j$ denotes the $j$ -th sample sampled from the distribution $\mathcal{N}(\boldsymbol{x} \mid \widehat{\mu}_t, \widehat{\Sigma}_t)$ . Then the updated formulations for $\boldsymbol{\mu}$ and $\boldsymbol{\Sigma}$ are rewritten as + +$$ +\boldsymbol {\mu} _ {t + 1} = \boldsymbol {\mu} _ {t} - \beta_ {t} \boldsymbol {\Sigma} _ {t} \boldsymbol {g} _ {t}, \quad \boldsymbol {\Sigma} _ {t + 1} ^ {- 1} = \boldsymbol {\Sigma} _ {t} ^ {- 1} + 2 \beta_ {t} \boldsymbol {G} _ {t}. \tag {21} +$$ + +The entire algorithm is shown in Algorithm 1. To avoid the scaling problem, in practice, we can employ monotonic transformation for the objective, more details can be found in Appendix F. For the proposed SABO method, the computation cost per iteration is of order $\mathcal{O}(Nd)$ . + +Mini-batch SABO. In Algorithm 1, we assume full access to the objective function $F(\boldsymbol{x}; \mathcal{D})$ , while in practice, a full-batch function query might be costly. Therefore, we can perform a mini-batch function query. Specifically, in each iteration, we query the expected fitness by a mini-batch of data and approximate $F(\boldsymbol{x}; \mathcal{D})$ by + +$$ +F (\boldsymbol {x}; \mathcal {B}) = \frac {1}{| \mathcal {B} |} \sum_ {(X, y) \in \mathcal {B}} l (\boldsymbol {x}; (X, y)), \tag {22} +$$ + +where $|\mathcal{B}|$ denotes the number of data in the mini-batch $\mathcal{B}$ . The corresponding expected fitness of $F(\boldsymbol{x};\mathcal{B})$ under the distribution $p_{\theta}(\boldsymbol{x})$ is formulated as $J(\boldsymbol{\theta};\mathcal{B}) = \mathbb{E}_{p_{\boldsymbol{\theta}}(\boldsymbol{x})}[F(\boldsymbol{x};\mathcal{B})]$ . Then similar to the full-batch function query setting, we can approximate the gradients $\nabla_{\mu}J(\boldsymbol{\theta}_t,\mathcal{B})$ and $\nabla_{\Sigma}J(\boldsymbol{\theta}_t,\mathcal{B})$ , where the detailed formulations can be found in Appendix B. The entire SABO algorithm with mini-batch function queries is shown in Algorithm 2 in Appendix B. + +Algorithm 1 SABO +Require: Neighborhood size $\rho$ , learning rate $\beta_{t}$ +1: Initialized $\theta_{0} = (\pmb{\mu}_{0}, \pmb{\Sigma}_{0})$ ; +2: for $t = 0$ to $T - 1$ do +3: Take i.i.d. samples $\pmb{z}_{j}' \sim \mathcal{N}(0, I)$ and set $\pmb{x}_{j}' = \pmb{\mu}_{t} + \pmb{\Sigma}_{t}^{\frac{1}{2}}\pmb{z}_{j}'$ for $j \in \{1, \dots, N\}$ ; +4: Query the batch observations $\{F(\pmb{x}_{1}', \dots, F(\pmb{x}_{N}')\}$ ; +5: Compute the gradient $\pmb{g}_{t}'$ via Eq. (16) and compute the gradient $\pmb{G}_{t}'$ via Eq. (17); +6: Compute $\lambda = \frac{1}{\rho}\sqrt{\|\pmb{\Sigma}_{t}\pmb{G}_{t}'\|_{\mathrm{F}}^{2} + 0.5\|\pmb{\Sigma}_{t}^{\frac{1}{2}}\pmb{g}_{t}'\|_{2}^{2}}$ ; +7: Compute $\delta_{\pmb{\mu}_{t}}$ and $\delta_{\pmb{\Sigma}_{t}}$ via Eq. (18); +8: Take i.i.d. samples $\pmb{z}_{j} \sim \mathcal{N}(0, I)$ for $j \in \{1, \dots, N\}$ ; +9: Set $\pmb{x}_{j} = \pmb{\mu}_{t} + \delta_{\pmb{\mu}_{t}} + (\pmb{\Sigma}_{t} + \delta_{\pmb{\Sigma}_{t}})^{\frac{1}{2}}\pmb{z}_{j}$ for $j \in \{1, \dots, N\}$ ; +10: Query the batch observations $\{F(\pmb{x}_{1}), \dots, F(\pmb{x}_{N})\}$ ; +11: Compute the gradient $\pmb{g}_{t}$ via Eq. (19) and compute the gradient $\pmb{G}_{t}$ via Eq. (20); +12: Set $\pmb{\mu}_{t + 1} = \pmb{\mu}_{t} - \beta_{t}\pmb{\Sigma}_{t}\pmb{g}_{t}$ and set $\pmb{\Sigma}_{t + 1}^{-1} = \pmb{\Sigma}_{t}^{-1} + 2\beta_{t}\pmb{G}_{t}$ ; +13: end for +14: return $\pmb{\theta}_{T} = (\pmb{\mu}_{T}, \pmb{\Sigma}_{T})$ . + +# 4 ANALYSIS + +In this section, we provide comprehensive theoretical analyses for the proposed SABO method with all the detailed proofs in Appendix D. + +# 4.1 CONVERGENCE ANALYSIS OF SABO + +Firstly, we make an assumption for the reparameterized objective function. + +Assumption 4.1 The function $F(\pmb{x})$ is $L_{F}$ -Lipschitz w.r.t. $\pmb{x}$ . The function $J(\pmb{\theta})$ satisfies that $\nabla_{\pmb{\mu}} J(\pmb{\theta})$ is $L$ -Lipschitz w.r.t. $\pmb{\theta} = \{\pmb{\mu}, \pmb{\Sigma}\} \in \Theta$ , where $\Theta := \{\pmb{\mu}, \pmb{\Sigma} \mid \pmb{\mu} \in \mathbb{R}^{d}, \pmb{\Sigma} \in S^{+}\}$ . + +Note that the proposed SABO algorithm approximates the gradients of the reparameterized objective function. It is necessary to study the relation between the optimal solutions of the original objective functions $F(\pmb{x})$ and $J(\pmb{\theta})$ , and we put the results in the following proposition. + +Proposition 4.2 (Lyu & Tsang, 2021) Suppose $p_{\pmb{\theta}}(\pmb{x})$ is a Gaussian distribution with $\pmb{\theta} = \{\pmb{\mu}, \pmb{\Sigma}\}$ and $F(\pmb{x})$ is a convex function. Let $J(\pmb{\theta}) = \mathbb{E}_{p_{\pmb{\theta}}}[F(\pmb{x})]$ , and $J(\pmb{\mu}^{*}, \mathbf{0}) \coloneqq F(\pmb{\mu}^{*})$ . Then we have + +$$ +F (\boldsymbol {\mu}) - F \left(\boldsymbol {\mu} ^ {*}\right) \leq J \left(\boldsymbol {\mu}, \boldsymbol {\Sigma}\right) - J \left(\boldsymbol {\mu} ^ {*}, \mathbf {0}\right), \tag {23} +$$ + +where $\mathbf{0}$ denotes a zero matrix with appropriate size. + +The convexity assumption of the objective function in Theorem 4.3 has been widely adopted in the area of stochastic gradient approximation black-box optimization (Beyer, 2014; Wierstra et al., 2014; Lyu & Tsang, 2021; Ye, 2023). Since the Gaussian-smooth approximation function is always an upper bound of the true target function in convex cases, i.e., $F(\mu) \leq \mathbb{E}_{\mathcal{N}(\mu, \Sigma)}[F(x)]$ . When $\pmb{\mu}^{*}$ is an optimal solution of minimization problem $\min_{x} F(x)$ , Proposition 4.2 implies that the difference between the objective value at $\pmb{\mu}$ and the optimal objective value of the original problem is upper-bounded by that of the expected objective function. Then for Algorithm 1, the following theorem captures the convergence of $\pmb{\mu}$ for a convex objective function. + +Theorem 4.3 Suppose that $F(\pmb{x})$ is a convex function, $J(\pmb{\theta})$ is c-strongly convex w.r.t. $\pmb{\mu}$ , the gradient estimator $G_{t}$ (w.r.t. the covariance matrix) is positive semi-definite matrix such that $\xi I \preceq G_{t} \preceq \frac{cI}{4}$ with $\xi \geq 0$ , $\pmb{\Sigma}_{0} \in S^{+}$ , and $\pmb{\Sigma}_{0} \preceq R\pmb{I}$ where $R > 0$ . Suppose the sequence $\{\pmb{\mu}_t\}$ generated by Algorithm 1 satisfies that the distance between the sequence $\{\pmb{\mu}_t\}$ and the optimal solution of $F(\pmb{x})$ is bounded, i.e., $\| \pmb{\mu}_t - \pmb{\mu}^* \| \leq D$ , $\| \nabla_{\pmb{\Sigma} = \pmb{\Sigma}_t} J(\pmb{\theta}) \|_F \leq H$ , $\beta_t = O(1)$ , and $\rho < \frac{\sqrt{d}}{2}$ satisfies $\rho = O(\frac{1}{\sqrt{T}})$ , then with Assumption 4.1, we have + +$$ +\frac {1}{T} \sum_ {t = 0} ^ {T - 1} \mathbb {E} \left[ J \left(\boldsymbol {\mu} _ {t + 1}, \boldsymbol {\Sigma} _ {t}\right) - J \left(\boldsymbol {\mu} ^ {*}, 0\right) \right] = \mathcal {O} \left(\frac {\log T}{T}\right). \tag {24} +$$ + +Based on Theorem 4.3 and Proposition 4.2, when $\beta_{t} = \mathcal{O}(1)$ and $\rho = \mathcal{O}\left(\frac{1}{\sqrt{T}}\right)$ , we have + +$$ +\frac {1}{T} \sum_ {t = 0} ^ {T - 1} \mathbb {E} [ F (\boldsymbol {\mu} _ {t + 1}) - F (\boldsymbol {\mu} ^ {*}) ] = \mathcal {O} \left(\frac {\log T}{T}\right). \tag {25} +$$ + +Therefore, the proposed SABO algorithm with full-batch function query possesses a convergence rate $\mathcal{O}\left(\frac{\log T}{T}\right)$ for the convex objective function. Additionally, in Theorem 4.3, when $\beta = \mathcal{O}(1)$ and $\rho = \mathcal{O}(1)$ , the proposed SABO algorithm still maintains a convergence rate $\mathcal{O}(T^{-\frac{1}{2}})$ . The detailed discussion is provided in Remark D.1. + +For the mini-batch setting, we make an additional assumption for the objective function $F(\pmb{x}; \mathcal{D})$ . + +Assumption 4.4 It is assumed that the datasets $\mathcal{D}$ and $\mathcal{B}$ are i.i.d. sampled from a data distribution $P(X,y)$ , and the variance of the mini-batch estimation of the objective function is bounded, i.e., $\| F(\pmb{x};\mathcal{B}) - \mathbb{E}F(\pmb{x};\mathcal{B})\|_2^2 \leq \varepsilon_{\mathrm{B}}^2$ and $\| F(\pmb{x};\mathcal{D}) - \mathbb{E}F(\pmb{x};\mathcal{D})\|_2^2 \leq \varepsilon_{\mathrm{D}}^2$ . + +Note that for the standard stochastic gradient descent (SGD) method (Shamir & Zhang, 2013), the unbiased estimation and bounded variance assumptions were made for the approximated gradient. However, in black-box optimization, the gradient of the objective function $F(\pmb{x})$ w.r.t. $\pmb{x}$ is unavailable. Hence we can only make assumptions for the batch estimations $F(\pmb{x};\mathcal{B})$ and $F(\pmb{x};\mathcal{D})$ . + +Then we have the following result for the mini-batch estimation. + +Proposition 4.5 Suppose Assumption 4.4 holds, then we have $\mathbb{E}F(\pmb{x};\mathcal{B}) = \mathbb{E}F(\pmb{x};\mathcal{D})$ , and $\| F(\pmb{x};\mathcal{B}) - F(\pmb{x};\mathcal{D})\|_2^2 \leq \varepsilon^2$ , where $\varepsilon^2 = 2(\varepsilon_{\mathrm{B}}^2 + \varepsilon_{\mathrm{D}}^2)$ . + +Then with Assumption 4.4, the following theorem shows the convergence of $\mu$ for Algorithm 2. + +Theorem 4.6 Suppose that $F(\pmb{x})$ is a convex function, $J(\pmb{\theta})$ is c-strongly convex w.r.t. $\pmb{\mu}$ , the gradient estimator $G_{t}$ (w.r.t. the covariance matrix) is positive semi-definite matrix such that $\xi I \preceq G_{t} \preceq \frac{cI}{4}$ with $\xi \geq 0$ , $\Sigma_0 \in S^+$ , and $\Sigma_0 \preceq RI$ where $R > 0$ . Suppose the sequence $\{\pmb{\mu}_t\}$ generated by Algorithm 2 satisfies that the distance between the sequence $\{\pmb{\mu}_t\}$ and the optimal solution of $F(\pmb{x})$ is bounded, i.e., $\| \pmb{\mu}_t - \pmb{\mu}^* \| \leq D$ , $\| \nabla_{\pmb{\Sigma} = \pmb{\Sigma}_t} J(\pmb{\theta}) \|_F \leq H$ , $\beta_t = O(1)$ , and $\rho < \frac{\sqrt{d}}{2}$ satisfies $\rho = O(1)$ . Then with Assumptions 4.1 and 4.4, we have + +$$ +\frac {1}{T} \sum_ {t = 0} ^ {T - 1} \mathbb {E} \left[ J \left(\boldsymbol {\mu} _ {t + 1}, \boldsymbol {\Sigma} _ {t}\right) - J \left(\boldsymbol {\mu} ^ {*}, 0\right) \right] = \mathcal {O} \left(\frac {1}{\sqrt {T}}\right). \tag {26} +$$ + +Based on Theorem 4.6 and Proposition 4.2, the proposed SABO algorithm with mini-batch function query possesses a convergence rate $\mathcal{O}(T^{-\frac{1}{2}})$ . + +Remark 4.7 Note that in Theorem 4.3 and Theorem 4.6, the convergence results do not require the objective function $F(\pmb{x})$ to be strongly convex or differentiable. Hence, the convergence holds for a non-smooth convex function $F(\pmb{x})$ (as long as $J(\pmb{\theta})$ being a c-strongly convex function w.r.t. $\pmb{\mu}$ ). + +# 4.2 GENERALIZATION ERROR ANALYSIS + +In this subsection, we analyze the generalization bound of the proposed SABO algorithm. Specifically, we bound the expectation of the objective function over the Gaussian perturbation. + +We denote by $(X,y)$ a data pair drawn from a data distribution $P(X,y)$ and by $F(\pmb {x};(X,y))$ the corresponding loss of parameter $\pmb{x}$ on $(X,y)$ . So we have $F(\pmb {x};(X,y)) = l(\pmb {x};(X,y))$ . We define the population loss over the data distribution $P(X,y)$ as $\mathbb{E}_{P(X,y)}[F(\pmb {x};(X,y))]$ , and the empirical loss over a dataset $\mathcal{S}$ , which consists of $M$ i.i.d. samples drawn from $P(X,y)$ , as $F(\pmb {x};\mathcal{S}) = \frac{1}{M}\sum_{i = 1}^{M}l(\pmb {x};(X_i,y_i))$ . Then we have following result. + +Theorem 4.8 Let the loss function $F(\pmb{x}; (X, y))$ be a convex function w.r.t. $\pmb{x}$ , then for any $\pmb{\mu} \in \mathbb{R}^d$ with probability at least $1 - \kappa$ , we have + +$$ +\mathbb {E} _ {P (X, y)} [ F (\boldsymbol {\mu}; (X, y)) ] \leq \max _ {\boldsymbol {\delta} \in \mathcal {C} (\boldsymbol {\theta})} \mathbb {E} _ {p _ {\boldsymbol {\theta} + \boldsymbol {\delta}}} [ F (\boldsymbol {x}; S) ] + \sqrt {\frac {\rho^ {2} + \log (\frac {M}{\kappa})}{2 (M - 1)}}, \tag {27} +$$ + +where $p_{\boldsymbol{\theta}} \coloneqq \mathcal{N}(\boldsymbol{\mu}, \boldsymbol{\Sigma})$ , $\mathcal{C}(\boldsymbol{\theta}) = \{\delta \mid \mathrm{KL}(p_{\boldsymbol{\theta} + \delta} \| p_{\boldsymbol{\theta}}) \leq \rho^2\}$ , and $\mathcal{S}$ denotes the training set that consists of $M$ i.i.d. samples drawn from data distribution $P(X, y)$ . + +Theorem 4.8 provides a generalization bound for the proposed SABO algorithm. Compared with the generalization bound of SAM presented in Appendix A.1 of Foret et al. (2021), Theorem 4.8 has an asymptotically identical order in the complexity term. However, the expected generalization loss on the right-hand side of Eq. (27) is different in that we reparameterize the objective function and have perturbation of $\theta$ in its neighborhood of a statistical manifold, i.e., $\delta \in \mathcal{C}(\theta)$ , while SAM bounds the generalization loss averaged over a spherical Gaussian perturbation on parameters. + +# 5 RELATED WORKS + +Black-Box Optimization. Many methods have been proposed for black-box optimization, including Bayesian optimization (BO) methods (Srinivas et al., 2010; Gardner et al., 2017; Nayebi et al., 2019), stochastic optimization methods such as evolution strategies (ES) (Hansen, 2006; Wierstra et al., 2014; Lyu & Tsang, 2021), and genetic algorithms (GA) (Srinivas & Patnaik, 1994; Mirjalili, 2019). Among those methods, BO achieves good performance for low-dimensional problems, but it often fails to handle high-dimensional problems through a global surrogate model, as shown in (Eriksson et al., 2019) and (Nguyen et al., 2022). As a result, TuRBO (Eriksson et al., 2019) and GIBO (Nguyen et al., 2022) try to address this problem with the local BO approach. (Ziomek & Ammar, 2023) further showed that decomposition is important for alleviating the high-dimensional problems in BO. Although BO is not our main focus, we further compare our method with these local Bayesian optimization methods on the black-box prompt fine-tuning problem, and the corresponding exploration is shown in Appendix H.1. GA method is computationally expensive for machine learning problems and usually lacks convergence analysis. The stochastic optimization methods such as CMA-ES (Hansen, 2006) and INGO (Lyu & Tsang, 2021) can scale up to higher-dimensional problems compared with BO. Hence we mainly consider stochastic optimization methods as baseline methods in our experiments. + +Sharpness-Aware Minimization. SAM has been widely studied for improving the model generalization. Among previous works on SAM (Kwon et al., 2021; Zhuang et al., 2022; Zhao et al., 2022; Jiang et al., 2023; Tahmasebi et al., 2024), the most relevant method to our approach is the FSAM method (Kim et al., 2022) which also finds the worst-case objective function via a statistical manifold instead of the Euclidean space. However, the loss function of the model studied in FSAM is a predictive distribution conditional on both model parameters and data, while in our case, we consider the parameter as a Gaussian distribution. The bSAM method (Möllenhoff & Khan, 2022) builds a connection between the SAM objective and Bayes objective by Fenchel biconjugate of the loss function. Möllenhoff & Khan (2022) shares a similarity with our work in developing SAM w.r.t. the expected loss. However, The bSAM method relies on the derivation of a convex lower bound of the expected loss by the Fenchel biconjugate and the perturbation is still w.r.t. each point inside the expected loss as standard SAM. Hence FSAM and bSAM are different from the proposed SABO method. Additionally, like other variants of SAM, FSAM and bSAM are both inapplicable to black-box optimization. The STABLEOPT method (Bogunovic et al., 2018) proposes a SAM-like optimization formulation in the Bayesian optimization area. They aim to improve the robustness w.r.t. the adversarial perturbation of the return point by a GP-based optimization. Their method relies on a GP surrogate model that is expensive for training and inference. In addition, it is challenging for the proposed adversarial robust GP-based optimization to handle high-dimensional problems. In contrast, our work aims to improve the generalization property in high-dimensional black-box optimization. + +# 6 EMPIRICAL STUDY + +In this section, we empirically evaluate the proposed SABO method, and compare it with four representative black-box methods, i.e., CMA-ES (Hansen, 2006), MMES (He et al., 2020), BES (Gao & Sener, 2022), and INGO (Lyu & Tsang, 2021). All the experiments are conducted on a single NVIDIA GeForce RTX 3090 GPU. + +# 6.1 SYNTHETIC PROBLEMS + +To verify the convergent results of the proposed SABO method in Section 4. We compare the proposed SABO method with baseline methods on minimizing four $d$ -dimensional synthetic benchmark test functions, i.e., ellipsoid function, $l_{\frac{1}{2}}$ -ellipsoid function, different powers function, and Levy function. All the test functions are listed in Appendix G.1. + +The results are evaluated by calculating the Euclidean distance between the solution $\pmb{x}$ and the optimal solution $\pmb{x}^*$ , i.e., $\mathcal{E} = \| \pmb{x} - \pmb{x}^* \|_2$ . We then assess the baseline methods using varying dimensions, i.e., $d \in \{200, 500, 1000\}$ . Due to the page limitation, the implementation details and more detailed experimental results are put in Appendix G.1. + +![](images/52cd331e00cf79025dff10ba064fd4f9f892e25cd2d1984169d8c07c34f748bd.jpg) +(a) Ellipsoid. + +![](images/d270ef4498e42f24952561fac5436dc4c9605ace96353295377b777feada0640.jpg) +(b) $l_{\frac{1}{2}}$ Ellipsoid. + +![](images/4babbb2fd47b231e4087703fa98aa37e7e2ba49ca56fd2640b0e2add330247df.jpg) +(c) Different Powers. +Figure 1: Results on the four test functions with problem dimension $d = 500$ and $N = 50$ . + +![](images/9419245ef31a33055734017535a6df61e2adafb8e1247e509c72a29658ea29e2.jpg) +(d) Levy. + +Result. Figure 1 shows the results on four $d$ -dimensional synthetic problems with $d = 500$ and population size $N = 50$ . The proposed SABO method approximately achieves a linear convergence rate similar to the INGO method. This is reasonable as these two methods have the same theoretical convergent rate, i.e., $\mathcal{O}\left(\frac{\log T}{T}\right)$ , according to Theorem 4.3 and Theorem 5 in Lyu & Tsang (2021). Since the SABO method perturbs the main objective in each iteration, its practical convergence speed is slightly slower than INGO. The CMA-ES method and MMES methods can converge on the ellipsoid problem and the different powers problem, but they do not converge as fast as SABO and INGO methods. Moreover, CMA-ES and MMES methods fail on the $l_{\frac{1}{2}}$ -ellipsoid problem and Levy problem. The BES method fails on all test problems. This shows that it could be challenging for BES to optimize non-smooth or high-dimensional test functions without adaptively updating mean and covariance. These results demonstrate the superiority of the SABO method in optimizing high-dimensional problems, and verify our theoretical convergence results. + +# 6.2 BLACK-BOX PROMPT FINE-TUNING + +Black-box prompt fine-tuning of large language models (Ding et al., 2023; Sun et al., 2022b;a; 2023) is a promising direction to achieve expertise models efficiently for downstream tasks. In such an LMaaS setting, we cannot access the model parameter and can only tune their prompts without backpropagation. We evaluate the proposed SABO method in improving generalization performance on the black-box prompt fine-tuning task. + +Datasets. We conduct experiments on six language understanding benchmark datasets: SST-2 (Socher et al., 2013) and Yelp polarity (Zhang et al., 2015) for sentiment analysis, AG's News (Zhang et al., 2015) for topic classification, MRPC (Dolan & Brockett, 2005) for paraphrase, RTE (Wang et al., 2018) and SNLI (Bowman et al., 2015) for natural language inference. Each dataset contains a classification task. The statistics of six datasets are summarized in Table 1 of (Sun et al., 2022b). By following (Sun et al., 2022b), the testing accuracy is used to measure the performance of all the methods on the SST-2, AG's News, RTE, SNLI, and Yelp P. datasets, and the F1 score is used to measure the performance on the MRPC datasets. + +Implementation Details. Following Sun et al. (2022b), we employ a fixed randomly initialized matrix $\mathbf{A} \in \mathbb{R}^{d \times D}$ to project a vector $\mathbf{v} \in \mathbb{R}^d$ onto the token embedding space $\mathbb{R}^D$ . Then we + +Table 1: Performance (%) on SST-2, AG's News, MRPC, RTE, SNLI and Yelp P. datasets. We report the mean and standard deviation over 3 random seeds. The best result across all groups is highlighted in bold and the best result in each group is marked with underlined. + +
MethodsSST-2AG's NewsMRPCRTESNLIYelp P.
Zero-shot79.8276.9667.4051.6238.8289.64
Dimension d = 200
CMA-ES85.74±0.3582.09±0.5674.98±2.1651.02±2.1434.27±1.1890.57±0.05
MMES83.98±0.7880.52±0.9976.54±4.3448.50±0.4540.39±1.8390.94±0.36
BES83.52±0.1175.44±0.3179.23±0.2053.07±0.2938.73±0.1789.65±0.01
INGO83.57±0.1176.47±0.0378.87±0.2053.07±0.0038.86±0.0689.84±0.04
SABO87.88±0.5382.22±0.4179.35±0.1253.67±0.1740.72±0.1591.50±0.13
Dimension d = 500
CMA-ES86.12±0.5982.50±0.2377.10±1.9052.71±0.5141.34±1.4991.19±0.44
MMES85.28±0.9481.67±0.8077.31±1.2448.74±0.5942.07±2.6291.39±0.24
BES83.56±0.0575.93±0.1779.21±0.0952.95±0.1738.64±0.2889.62±0.07
INGO84.29±0.3476.54±0.2079.09±0.1553.19±0.1738.91±0.1089.90±0.13
SABO87.31±0.3882.65±0.5979.62±0.0753.55±0.1742.29±2.4891.83±0.16
Dimension d = 1000
CMA-ES86.85±0.5782.21±0.3678.98±0.1752.35±0.1738.40±1.8390.46±0.62
MMES84.98±0.5280.86±1.9576.43±0.8249.22±1.2339.82±3.4391.63±0.20
BES83.11±0.1175.66±0.0979.09±0.0853.19±0.1738.57±0.1389.61±0.04
INGO84.36±0.2376.35±0.1478.97±0.0853.07±0.2939.05±0.0689.95±0.08
SABO87.96±0.8382.77±0.4179.68±0.2353.31±0.1740.32±0.2791.96±0.41
+ +optimize the vector $\pmb{v} \in \mathbb{R}^d$ instead of directly optimizing the prompt $\pmb{p} \in \mathbb{R}^D$ . The pre-trained RoBERTaLARGE model (Liu et al., 2019) is used as the backbone model. The matrix $\pmb{A}$ is sampled from the normal distribution as described in Sun et al. (2022a), i.e., $\mathcal{N}(0, \frac{\sigma_e}{\sqrt{d}})$ , where $\sigma_e$ is the standard deviation of word embeddings in RoBERTaLARGE. The templates and label words in Table 1 of Sun et al. (2022b) are used to conduct the zero-shot baseline. + +For CMA-ES, MMES, BES, INGO, and SABO methods, we employ the cross-entropy loss of training data as the black-box objective for six datasets and optimize the vector $\pmb{v}$ with 100 iterations. The Gaussian distributions are initialized as $\mu_0 = 0$ and $\Sigma_0 = I$ , and the population size $N$ is set to 100. We perform a grid search for hyperparameters of INGO, SABO, and BES methods. Specifically, we search the learning rate $\beta$ over $\{0.1, 0.5, 1, 5\}$ for INGO, SABO, and BES, the neighborhood size $\rho$ over $\{10, 50, 100, 500\}$ for SABO, and the spacing $c$ over $\{0.1, 1, 10\}$ for BES. Additionally, we evaluate the performance of all methods on different dimensions of $\pmb{v}$ , specifically $d \in \{200, 500, 1000\}$ . All the experiments are performed in three independent runs, and the experimental results of mean objective $\pm$ std are reported. + +Results. Table 1 presents experimental results on these six benchmark datasets for three different dimensions of the vector $\mathbf{v}$ . We can see that the SABO method consistently outperforms all baselines in terms of testing classification accuracy or testing F1 scores across different settings, highlighting its effectiveness in improving generalization performance. Notably, even in the high-dimensional setting (i.e., $d = 1000$ ), our method maintains good performance. Moreover, we can see that when $d = 1000$ , SABO achieves the best performance on SST-2, AG's News, MRPC, and Yelp P. datasets. The SABO method also achieves the best performance on RTE and SNLI datasets with $d = 200$ and $d = 500$ , respectively. + +# 7 CONCLUSION + +In this work, we have introduced SABO, a novel black-box optimization algorithm that improves generalization by utilizing a sharpness-aware minimization strategy. Theoretically, we provide a convergence guarantee for the proposed SABO algorithm in both full-batch function query and mini-batch function query settings. Additionally, we prove the generalization bound for the proposed method. Empirical studies on synthetic numerical problems verify the convergence properties of the proposed method. Moreover, extensive experimental results on black-box prompt fine-tuning problems demonstrate the effectiveness of the proposed SABO method in improving the generalization performance. + +# ACKNOWLEDGEMENTS + +This work is supported by National Key R&D Program of China 2022ZD0160300 and NSFC key grant under grant no. 62136005. Dr. Yueming Lyu is supported by Career Development Fund no. C243512014 and no. C233312007 of the Agency for Science, Technology and Research. Prof. Sugiyama was supported by the Institute for AI and Beyond, UTokyo and by a grant from Apple, Inc. Any views, opinions, findings, and conclusions or recommendations expressed in this material are those of the authors and should not be interpreted as reflecting the views, policies or position, either expressed or implied, of Apple Inc. + +# REFERENCES + +Shun-ichi Amari. Information geometry and its applications, volume 194. Springer, 2016. +Dara Bahri, Hossein Mobahi, and Yi Tay. Sharpness-aware minimization improves language model generalization. In Annual Meeting of the Association for Computational Linguistics, 2022. +Hans-Georg Beyer. Convergence analysis of evolutionary algorithms that are based on the paradigm of information geometry. Evolutionary Computation, 22(4):679-709, 2014. +Ilija Bogunovic, Jonathan Scarlett, Stefanie Jegelka, and Volkan Cevher. Adversarily robust optimization with gaussian processes. Advances in neural information processing systems, 31, 2018. +Samuel R Bowman, Gabor Angeli, Christopher Potts, and Christopher D Manning. A large annotated corpus for learning natural language inference. arXiv preprint arXiv:1508.05326, 2015. +Niladri S Chatterji, Behnam Neyshabur, and Hanie Sedghi. The intriguing role of module criticality in the generalization of deep networks. arXiv preprint arXiv:1912.00528, 2019. +Can Chen, Yingxueff Zhang, Jie Fu, Xue Steve Liu, and Mark Coates. Bidirectional learning for offline infinite-width model-based optimization. Advances in Neural Information Processing Systems, 35:29454-29467, 2022. +Edoardo Conti, Vashisht Madhavan, Felipe Petroski Such, Joel Lehman, Kenneth Stanley, and Jeff Clune. Improving exploration in evolution strategies for deep reinforcement learning via a population of novelty-seeking agents. In *Neural Information Processing Systems*, 2018. +Ning Ding, Yujia Qin, Guang Yang, Fuchao Wei, Zonghan Yang, Yusheng Su, Shengding Hu, Yulin Chen, Chi-Min Chan, Weize Chen, et al. Parameter-efficient fine-tuning of large-scale pre-trained language models. Nature Machine Intelligence, 5(3):220-235, 2023. +Bill Dolan and Chris Brockett. Automatically constructing a corpus of sentential paraphrases. In Third International Workshop on Paraphrasing, 2005. +Yinpeng Dong, Hang Su, Baoyuan Wu, Zhifeng Li, Wei Liu, Tong Zhang, and Jun Zhu. Efficient decision-based black-box adversarial attacks on face recognition. In IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2019. +Gintare Karolina Dziugaite and Daniel M Roy. Computing nonvacuous generalization bounds for deep (stochastic) neural networks with many more parameters than training data. arXiv preprint arXiv:1703.11008, 2017. +David Eriksson, Michael Pearce, Jacob Gardner, Ryan D Turner, and Matthias Poloczek. Scalable global optimization via local bayesian optimization. Advances in neural information processing systems, 32, 2019. +Clara Fannjiang and Jennifer Listgarten. Autofocused oracles for model-based design. Advances in Neural Information Processing Systems, 33:12945-12956, 2020. +Pierre Foret, Ariel Kleiner, Hossein Mobahi, and Behnam Neyshabur. Sharpness-aware minimization for efficiently improving generalization. In International Conference on Learning Representations, 2021. + +Katelyn Gao and Ozan Sener. Generalizing gaussian smoothing for random search. In International Conference on Machine Learning, pp. 7077-7101. PMLR, 2022. +Jacob Gardner, Chuan Guo, Kilian Weinberger, Roman Garnett, and Roger Grosse. Discovering and exploiting additive structure for bayesian optimization. In Artificial Intelligence and Statistics, 2017. +Nikolaus Hansen. The cma evolution strategy: a comparing review. Towards a new evolutionary computation: Advances in the estimation of distribution algorithms, pp. 75-102, 2006. +Xiaoyu He, Zibin Zheng, and Yuren Zhou. Mmes: Mixture model-based evolution strategy for large-scale optimization. IEEE Transactions on Evolutionary Computation, 25(2):320-333, 2020. +Andrew Ilyas, Logan Engstrom, Anish Athalye, and Jessy Lin. Black-box adversarial attacks with limited queries and information. In International Conference on Machine Learning, 2018. +Weisen Jiang, Hansi Yang, Yu Zhang, and James Kwok. An adaptive policy to employ sharpness-aware minimization. In International Conference on Learning Representations, 2023. +Donald R Jones, Matthias Schonlau, and William J Welch. Efficient global optimization of expensive black-box functions. Journal of Global optimization, 13:455-492, 1998. +Minyoung Kim, Da Li, Shell X Hu, and Timothy Hospedales. Fisher SAM: Information geometry and sharpness aware minimisation. In International Conference on Machine Learning, 2022. +Aviral Kumar and Sergey Levine. Model inversion networks for model-based optimization. Advances in neural information processing systems, 33:5126-5137, 2020. +Jungmin Kwon, Jeongseop Kim, Hyunseo Park, and In Kwon Choi. Asam: Adaptive sharpness-aware minimization for scale-invariant learning of deep neural networks. In International Conference on Machine Learning, 2021. +Tianyi Lin, Zeyu Zheng, and Michael Jordan. Gradient-free methods for deterministic and stochastic nonsmooth nonconvex optimization. Advances in Neural Information Processing Systems, 35: 26160-26175, 2022. +Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. Roberta: A robustly optimized bert pretraining approach. arXiv preprint arXiv:1907.11692, 2019. +Yong Liu, Siqi Mai, Xiangning Chen, Cho-Jui Hsieh, and Yang You. Towards efficient and scalable sharpness-aware minimization. In IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2022. +Yueming Lyu and Ivor W Tsang. Black-box optimizer with stochastic implicit natural gradient. In European Conference on Machine Learning and Principles and Practice of Knowledge Discovery in Databases, 2021. +David A McAllester. Pac-bayesian model averaging. In Annual Conference on Computational Learning Theory, 1999. +Leland McInnes, John Healy, and James Melville. Umap: Uniform manifold approximation and projection for dimension reduction. arXiv preprint arXiv:1802.03426, 2018. +Seyedali Mirjalili. Evolutionary algorithms and neural networks. In Studies in computational intelligence, volume 780. Springer, 2019. +Thomas Möllenhoff and Mohammad Emtiyaz Khan. Sam as an optimal relaxation of bayes. In The Eleventh International Conference on Learning Representations, 2022. +Amin Nayebi, Alexander Munteanu, and Matthias Poloczek. A framework for bayesian optimization in embedded subspaces. In International Conference on Machine Learning, 2019. +Yurii Nesterov and Vladimir Spokoiny. Random gradient-free minimization of convex functions. Foundations of Computational Mathematics, 17(2):527-566, 2017. + +Behnam Neyshabur, Srinadh Bhojanapalli, David McAllester, and Nati Srebro. Exploring generalization in deep learning. In Neural Information Processing Systems, 2017. +Quan Nguyen, Kaiwen Wu, Jacob Gardner, and Roman Garnett. Local bayesian optimization via maximizing probability of descent. Advances in neural information processing systems, 35: 13190-13202, 2022. +Henning Petzka, Michael Kamp, Linara Adilova, Cristian Sminchisescu, and Mario Boley. Relative flatness and generalization. In Neural Information Processing Systems, 2021. +Han Qi, Yi Su, Aviral Kumar, and Sergey Levine. Data-driven offline decision-making via invariant representation learning. Advances in Neural Information Processing Systems, 35:13226-13237, 2022. +Shogo Sagawa and Hideitsu Hino. Gradual domain adaptation via normalizing flows. arXiv preprint arXiv:2206.11492, 2022. +Tim Salimans, Jonathan Ho, Xi Chen, Szymon Sidor, and Ilya Sutskever. Evolution strategies as a scalable alternative to reinforcement learning. arXiv preprint arXiv:1703.03864, 2017. +Ohad Shamir and Tong Zhang. Stochastic gradient descent for non-smooth optimization: Convergence results and optimal averaging schemes. In International Conference on Machine Learning, 2013. +Richard Socher, Alex Perelygin, Jean Wu, Jason Chuang, Christopher D Manning, Andrew Y Ng, and Christopher Potts. Recursive deep models for semantic compositionality over a sentiment treebank. In Conference on Empirical Methods in Natural Language Processing, 2013. +Mandavilli Srinivas and Lalit M Patnaik. Genetic algorithms: A survey. Computer, 27(6):17-26, 1994. +Niranjan Srinivas, Andreas Krause, Sham Kakade, and Matthias Seeger. Gaussian process optimization in the bandit setting: no regret and experimental design. In International Conference on Machine Learning, 2010. +Tianxiang Sun, Zhengfu He, Hong Qian, Yunhua Zhou, Xuan-Jing Huang, and Xipeng Qiu. Bbtv2: towards a gradient-free future with large language models. In Conference on Empirical Methods in Natural Language Processing, 2022a. +Tianxiang Sun, Yunfan Shao, Hong Qian, Xuanjing Huang, and Xipeng Qiu. Black-box tuning for language-model-as-a-service. In International Conference on Machine Learning, 2022b. +Tianxiang Sun, Zhengfu He, Qin Zhu, Xipeng Qiu, and Xuan-Jing Huang. Multitask pre-training of modular prompt for chinese few-shot learning. In Annual Meeting of the Association for Computational Linguistics, 2023. +Behrooz Tahmasebi, Ashkan Soleymani, Dara Bahri, Stefanie Jegelka, and Patrick Jaillet. A universal class of sharpness-aware minimization algorithms. In International Conference on Machine Learning, pp. 47418-47440. PMLR, 2024. +Brandon Trabucco, Aviral Kumar, Xinyang Geng, and Sergey Levine. Conservative objective models for effective offline model-based optimization. In International Conference on Machine Learning, pp. 10358-10368. PMLR, 2021. +Alex Wang, Amanpreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel R Bowman. Glue: A multi-task benchmark and analysis platform for natural language understanding. arXiv preprint arXiv:1804.07461, 2018. +Daan Wierstra, Tom Schaul, Tobias Glasmachers, Yi Sun, Jan Peters, and Jürgen Schmidhuber. Natural evolution strategies. The Journal of Machine Learning Research, 15(1):949-980, 2014. +Han Xiao, Kashif Rasul, and Roland Vollgraf. Fashion-mnist: a novel image dataset for benchmarking machine learning algorithms. arXiv preprint arXiv:1708.07747, 2017. + +Feiyang Ye, Yueming Lyu, Xuehao Wang, Yu Zhang, and Ivor Tsang. Adaptive stochastic gradient algorithm for black-box multi-objective learning. In The Twelfth International Conference on Learning Representations, 2024. +Haishan Ye. Mirror natural evolution strategies. arXiv preprint arXiv:2308.00469, 2023. +Chiyuan Zhang, Samy Bengio, Moritz Hardt, Benjamin Recht, and Oriol Vinyals. Understanding deep learning (still) requires rethinking generalization. Communications of the ACM, 64(3):107-115, 2021. +Xiang Zhang, Junbo Zhao, and Yann LeCun. Character-level convolutional networks for text classification. In Neural Information Processing Systems, 2015. +Yang Zhao, Hao Zhang, and Xiuyuan Hu. Penalizing gradient norm for efficiently improving generalization in deep learning. In International Conference on Machine Learning, 2022. +Juntang Zhuang, Boqing Gong, Liangzhe Yuan, Yin Cui, Hartwig Adam, Nicha Dvornek, Sekhar Tatikonda, James Duncan, and Ting Liu. Surrogate gap minimization improves sharpness-aware training. In International Conference on Learning Representations, 2022. +Juliusz Krzysztof Ziomek and Haitham Bou Ammar. Are random decompositions all we need in high dimensional bayesian optimisation? In International Conference on Machine Learning, pp. 43347-43368. PMLR, 2023. + +# A ADDITIONAL MATERIAL FOR SECTION 3 + +# A.1 DETERMINE THE PERTURBATION $\delta$ + +The Lagrangian of problem (8) is + +$$ +\begin{array}{l} \mathcal {L} (\boldsymbol {\delta}, \lambda) = - \left\langle \nabla_ {\boldsymbol {\theta}} J (\boldsymbol {\theta}), \boldsymbol {\delta} \right\rangle + \lambda \left(\mathrm {K L} \left(p _ {\boldsymbol {\theta} + \boldsymbol {\delta}} \| p _ {\boldsymbol {\theta}}\right) - \rho^ {2}\right) (28) \\ = - \delta_ {\boldsymbol {\mu}} ^ {\top} \nabla_ {\boldsymbol {\mu}} J (\boldsymbol {\theta} _ {t}) - \operatorname {t r} \left(\delta_ {\boldsymbol {\Sigma}} \nabla_ {\boldsymbol {\Sigma}} J (\boldsymbol {\theta} _ {t})\right) \\ + \frac {\lambda}{2} \left[ \operatorname {t r} \left(\boldsymbol {\Sigma} ^ {- 1} \left(\boldsymbol {\Sigma} + \boldsymbol {\delta} _ {\boldsymbol {\Sigma}}\right)\right) + \boldsymbol {\delta} _ {\boldsymbol {\mu}} ^ {\top} \boldsymbol {\Sigma} ^ {- 1} \boldsymbol {\delta} _ {\boldsymbol {\mu}} + \log \frac {| \boldsymbol {\Sigma} |}{| (\boldsymbol {\Sigma} + \boldsymbol {\delta} _ {\boldsymbol {\Sigma}}) |} - d \right] - \lambda \rho^ {2}. (29) \\ \end{array} +$$ + +Taking the derivative $\delta_{\mu}$ and $\delta_{\Sigma}$ and setting them to zero, we can obtain that + +$$ +\nabla_ {\boldsymbol {\mu}} J (\boldsymbol {\theta}) - \lambda \boldsymbol {\Sigma} ^ {- 1} \boldsymbol {\delta} _ {\boldsymbol {\mu}} = 0, \tag {30} +$$ + +$$ +\nabla_ {\boldsymbol {\Sigma}} J (\boldsymbol {\theta}) - \frac {\lambda}{2} \left[ \left(\boldsymbol {\Sigma} + \boldsymbol {\delta} _ {\boldsymbol {\Sigma}}\right) ^ {- 1} - \boldsymbol {\Sigma} ^ {- 1} \right] = 0. \tag {31} +$$ + +Note that $\Sigma$ is a diagonal matrix. Therefore, we can achieve that + +$$ +\delta_ {\mu} (\boldsymbol {\theta}) = \frac {1}{\lambda} \Sigma \nabla_ {\mu} J (\boldsymbol {\theta}), \tag {32} +$$ + +$$ +\delta_ {\boldsymbol {\Sigma}} (\boldsymbol {\theta}) = \frac {2 \boldsymbol {\Sigma} \nabla_ {\boldsymbol {\Sigma}} J (\boldsymbol {\theta})}{\lambda \boldsymbol {\Sigma} ^ {- 1} - 2 \nabla_ {\boldsymbol {\Sigma}} J (\boldsymbol {\theta})}. \tag {33} +$$ + +# A.2 DETERMINE THE OPTIMAL $\lambda$ + +Note that we have + +$$ +\begin{array}{l} \operatorname {K L} \left(p _ {\theta + \delta} \| p _ {\theta}\right) = \frac {1}{2} \left[ \operatorname {t r} \left(\boldsymbol {\Sigma} ^ {- 1} \left(\boldsymbol {\Sigma} + \boldsymbol {\delta} _ {\boldsymbol {\Sigma}}\right)\right) + \boldsymbol {\delta} _ {\mu} ^ {\top} \boldsymbol {\Sigma} ^ {- 1} \boldsymbol {\delta} _ {\mu} + \log \frac {| \boldsymbol {\Sigma} |}{| (\boldsymbol {\Sigma} + \boldsymbol {\delta} _ {\boldsymbol {\Sigma}}) |} - d \right] (34) \\ = \frac {1}{2} \left[ \operatorname {t r} \left(I + \frac {2}{\lambda} \nabla_ {\boldsymbol {\Sigma}} J (\boldsymbol {\theta}) \left(\boldsymbol {\Sigma} + \boldsymbol {\delta} _ {\boldsymbol {\Sigma}}\right)\right) + \boldsymbol {\delta} _ {\mu} ^ {\top} \boldsymbol {\Sigma} ^ {- 1} \boldsymbol {\delta} _ {\mu} + \log \frac {| \boldsymbol {\Sigma} |}{| (\boldsymbol {\Sigma} + \boldsymbol {\delta} _ {\boldsymbol {\Sigma}}) |} - d \right] (35) \\ = \frac {1}{2} \left[ \operatorname {t r} \left(\frac {2}{\lambda} \nabla_ {\boldsymbol {\Sigma}} J (\boldsymbol {\theta}) \delta_ {\boldsymbol {\Sigma}}\right) + \delta_ {\boldsymbol {\mu}} ^ {\top} \boldsymbol {\Sigma} ^ {- 1} \delta_ {\boldsymbol {\mu}} + Q \right], (36) \\ \end{array} +$$ + +where + +$$ +Q = \left| \frac {2}{\lambda} \boldsymbol {\Sigma} \nabla_ {\boldsymbol {\Sigma}} J (\boldsymbol {\theta}) \right| + \log \left(I - \frac {2}{\lambda} \boldsymbol {\Sigma} \nabla_ {\boldsymbol {\Sigma}} J (\boldsymbol {\theta})\right). \tag {37} +$$ + +Since $\pmb{\Sigma}$ and $\nabla_{\pmb{\Sigma}}J(\pmb{\theta})$ are both diagonal matrix, we denote $\mathrm{diag}(\Sigma \nabla_{\Sigma}J(\pmb{\theta})) = (v^1,\dots ,v^d)$ , then we have + +$$ +Q = \log \left(\prod_ {i = 1} ^ {d} \left(1 - \frac {2}{\lambda} v ^ {i}\right)\right) + \sum_ {i = 1} ^ {d} \frac {2}{\lambda} v ^ {i} = \sum_ {i = 1} ^ {d} \left(\log \left(1 - \frac {2}{\lambda} v ^ {i}\right) + \frac {2}{\lambda} v ^ {i}\right) = \sum_ {i = 1} ^ {d} - \frac {2}{\lambda^ {2}} \left(v ^ {i}\right) ^ {2} - \mathcal {O} \left(\frac {1}{\lambda^ {3}} \left(v ^ {i}\right) ^ {3}\right). \tag {38} +$$ + +We denote $\mathrm{diag}(\nabla_{\pmb{\Sigma}}J(\pmb {\theta})) = (\hat{v}^1,\dots ,\hat{v}^d)$ , then we have $\hat{v}^i\sigma^i = v^i$ and + +$$ +\operatorname {t r} \left(\frac {2}{\lambda} \nabla_ {\boldsymbol {\Sigma}} J (\boldsymbol {\theta}) \boldsymbol {\delta} _ {\boldsymbol {\Sigma}}\right) = \sum_ {i = 1} ^ {d} \frac {2}{\lambda} \hat {v} ^ {i} \left(\frac {1}{\left(\sigma^ {i}\right) ^ {- 1} - \frac {2}{\lambda} \hat {v} ^ {i}} - \sigma^ {i}\right) = \sum_ {i = 1} ^ {d} \frac {2}{\lambda} \hat {v} ^ {i} \sigma^ {i} \left(\frac {2}{\lambda} \sigma^ {i} \hat {v} ^ {i}\right) + \mathcal {O} \left(\frac {4}{\lambda^ {2}} \left(\sigma^ {i} \hat {v} ^ {i}\right) ^ {2}\right). \tag {39} +$$ + +Then substituting $\delta_{\mu}(\pmb{\theta})$ and $\delta_{\Sigma}(\pmb{\theta})$ into the inequality $\mathrm{KL}(p_{\pmb{\theta} + \delta}\| p_{\pmb{\theta}_t})\leq \rho^2$ , we can obtain that + +$$ +\operatorname {K L} \left(p _ {\boldsymbol {\theta} + \boldsymbol {\delta}} \| p _ {\boldsymbol {\theta}}\right) = \frac {1}{2} \left[ \frac {2}{\lambda^ {2}} \| \boldsymbol {\Sigma} \nabla_ {\boldsymbol {\Sigma}} J (\boldsymbol {\theta}) \| _ {\mathrm {F}} ^ {2} + \frac {1}{\lambda^ {2}} \| \boldsymbol {\Sigma} ^ {\frac {1}{2}} \nabla_ {\boldsymbol {\mu}} J (\boldsymbol {\theta}) \| _ {2} ^ {2} \right] + \epsilon \leq \rho^ {2}, \tag {40} +$$ + +where $\epsilon = \mathcal{O}\left(\frac{4(\sigma^i\hat{v}^i)^2}{\lambda^2}\right) = \mathcal{O}\left(\frac{1}{\lambda^2}\right)$ . Let the equality holds and solve Eq. (40), we have + +$$ +\lambda \approx \frac {1}{\rho} \sqrt {\left\| \boldsymbol {\Sigma} \nabla_ {\boldsymbol {\Sigma}} J (\boldsymbol {\theta}) \right\| _ {\mathrm {F}} ^ {2} + 0 . 5 \left\| \boldsymbol {\Sigma} ^ {\frac {1}{2}} \nabla_ {\boldsymbol {\mu}} J (\boldsymbol {\theta}) \right\| _ {2} ^ {2}}. \tag {41} +$$ + +# A.3 UPDATE RULE FOR $\theta_t$ + +Note that we have + +$$ +\begin{array}{l} \left\langle \boldsymbol {\theta} - \boldsymbol {\theta} _ {t}, \nabla_ {\boldsymbol {\theta}} J \left(\boldsymbol {\theta} _ {t} + \boldsymbol {\delta} _ {t}\right) \right\rangle + \frac {1}{\beta_ {t}} \mathrm {K L} \left(p _ {\boldsymbol {\theta}} \| p _ {\boldsymbol {\theta} _ {t}}\right) \\ = \left(\boldsymbol {\mu} - \boldsymbol {\mu} _ {t}\right) ^ {\top} \nabla_ {\boldsymbol {\mu}} J \left(\boldsymbol {\theta} _ {t} + \boldsymbol {\delta} _ {t}\right) + \operatorname {t r} \left(\left(\boldsymbol {\Sigma} - \boldsymbol {\Sigma} _ {t}\right) \nabla_ {\boldsymbol {\Sigma}} J \left(\boldsymbol {\theta} _ {t} + \boldsymbol {\delta} _ {t}\right)\right) \\ + \frac {1}{2 \beta_ {t}} \left[ \operatorname {t r} \left(\boldsymbol {\Sigma} _ {t} ^ {- 1} \boldsymbol {\Sigma}\right) + \left(\boldsymbol {\mu} - \boldsymbol {\mu} _ {t}\right) ^ {\top} \boldsymbol {\Sigma} _ {t} ^ {- 1} \left(\boldsymbol {\mu} - \boldsymbol {\mu} _ {t}\right) + \log \frac {| \boldsymbol {\Sigma} _ {t} |}{| \boldsymbol {\Sigma} |} - d \right], \\ \end{array} +$$ + +where $\nabla_{\mu}J(\pmb{\theta}_t + \pmb{\delta}_t)$ and $\nabla_{\Sigma}J(\pmb{\theta}_t + \pmb{\delta}_t)$ denotes the derivative w.r.t. $\pmb{\mu}$ and $\pmb{\Sigma}$ taking at $\pmb{\mu} = \pmb{\mu}_t + \delta_{\pmb{\mu}_t}$ and $\pmb{\Sigma} = \pmb{\Sigma}_t + \delta_{\pmb{\Sigma}_t}$ , respectively. We can see the above problem is convex with respect to $\pmb{\mu}$ and $\pmb{\Sigma}$ . Taking the derivative w.r.t. $\pmb{\mu}$ and $\pmb{\Sigma}$ and setting them to zero, we can obtain that + +$$ +\nabla_ {\boldsymbol {\mu}} J \left(\boldsymbol {\theta} _ {t} + \boldsymbol {\delta} _ {t}\right) + \frac {1}{\beta_ {t}} \boldsymbol {\Sigma} _ {t} ^ {- 1} \left(\boldsymbol {\mu} - \boldsymbol {\mu} _ {t}\right) = 0, \tag {42} +$$ + +$$ +\nabla_ {\boldsymbol {\Sigma}} J \left(\boldsymbol {\theta} _ {t} + \boldsymbol {\delta} _ {t}\right) + \frac {1}{2 \beta_ {t}} \left[ \boldsymbol {\Sigma} _ {t} ^ {- 1} - \boldsymbol {\Sigma} ^ {- 1} \right] = 0. \tag {43} +$$ + +Therefore, we obtain the update rule for $\theta_{t}$ as + +$$ +\boldsymbol {\mu} _ {t + 1} = \boldsymbol {\mu} _ {t} - \beta_ {t} \boldsymbol {\Sigma} _ {t} \nabla_ {\boldsymbol {\mu}} J (\boldsymbol {\theta} _ {t} + \boldsymbol {\delta} _ {t}), \tag {44} +$$ + +$$ +\boldsymbol {\Sigma} _ {t + 1} ^ {- 1} = \boldsymbol {\Sigma} _ {t} ^ {- 1} + 2 \beta_ {t} \nabla_ {\boldsymbol {\Sigma}} J (\boldsymbol {\theta} _ {t} + \boldsymbol {\delta} _ {t}). \tag {45} +$$ + +# A.4 THE GRADIENTS OF $J(\theta)$ + +To obtain the gradients of the reparameterized objective $J(\theta)$ w.r.t. $\mu$ and $\Sigma$ , we use the following theorem to show that only function queries are needed. + +Theorem A.1 (Wierstra et al., 2014) The gradient of the expectation of an integrable function $F(\pmb{x})$ under a Gaussian distribution $p_{\theta} \coloneqq \mathcal{N}(\pmb{\mu}, \pmb{\Sigma})$ with respect to the mean $\pmb{\mu}$ and the covariance $\pmb{\Sigma}$ can be expressed as + +$$ +\nabla_ {\boldsymbol {\mu}} J (\boldsymbol {\theta}) = \mathbb {E} _ {p _ {\theta}} \left[ \boldsymbol {\Sigma} ^ {- 1} (\boldsymbol {x} - \boldsymbol {\mu}) F (\boldsymbol {x}) \right], \tag {46} +$$ + +$$ +\nabla_ {\boldsymbol {\Sigma}} J (\boldsymbol {\theta}) = \frac {1}{2} \mathbb {E} _ {p _ {\boldsymbol {\theta}}} \left[ \left(\boldsymbol {\Sigma} ^ {- 1} (\boldsymbol {x} - \boldsymbol {\mu}) (\boldsymbol {x} - \boldsymbol {\mu}) ^ {\top} \boldsymbol {\Sigma} ^ {- 1} - \boldsymbol {\Sigma} ^ {- 1}\right) F (\boldsymbol {x}) \right]. \tag {47} +$$ + +# B MINI-BATCH SABO + +For the proposed SABO with a mini-batch function query, the stochastic approximation of the gradients $\nabla_{\mu}J(\pmb{\theta}_t)$ and $\nabla_{\Sigma}J(\pmb{\theta}_t)$ using Monte Carlo sampling are given as + +$$ +\boldsymbol {g} _ {t} ^ {\prime} = \frac {1}{N M} \sum_ {j = 1} ^ {N} \sum_ {i = 1} ^ {M} \boldsymbol {\Sigma} _ {t} ^ {- 1} \left(\boldsymbol {x} _ {j} ^ {\prime} - \boldsymbol {\mu} _ {t}\right) \left(F \left(\boldsymbol {x} _ {j} ^ {\prime}; \left(X _ {i} ^ {\prime}, y _ {i} ^ {\prime}\right)\right) - F \left(\boldsymbol {\mu} _ {t}; \left(X _ {i} ^ {\prime}, y _ {i} ^ {\prime}\right)\right)\right), \tag {48} +$$ + +$$ +\begin{array}{l} \boldsymbol {G} _ {t} ^ {\prime} = \frac {1}{2 N M} \sum_ {j = 1} ^ {N} \sum_ {i = 1} ^ {M} \operatorname {d i a g} \left[ \boldsymbol {\Sigma} _ {t} ^ {- 1} \left[ \operatorname {d i a g} \left(\left(\boldsymbol {x} _ {j} ^ {\prime} - \boldsymbol {\mu} _ {t}\right) \left(\boldsymbol {x} _ {j} ^ {\prime} - \boldsymbol {\mu} _ {t}\right) ^ {\top} \boldsymbol {\Sigma} _ {t} ^ {- 1} - \boldsymbol {I}\right) \right. \right. \\ \left. \times \left(F \left(\boldsymbol {x} _ {j} ^ {\prime}; \left(X _ {i} ^ {\prime}, y _ {i} ^ {\prime}\right)\right) - F \left(\boldsymbol {\mu} _ {t}; \left(X _ {i} ^ {\prime}, y _ {i} ^ {\prime}\right)\right)\right) \right], \tag {49} \\ \end{array} +$$ + +where $\pmb{x}_j^\prime$ denotes the $j$ -th sample sampled from the distribution $\mathcal{N}(\pmb{x}|\pmb{\mu}_t,\pmb{\Sigma}_t)$ , and $(X_i',y_i')$ denotes the $i$ -th data in the mini-batch dataset $\mathcal{B}'$ . Then by setting $\delta_t = \left\{\frac{1}{\lambda}\pmb{\Sigma}_t\pmb{g}_t'\right.$ , $\left.\frac{2\pmb{\Sigma}_t\pmb{G}_t'}{\lambda\pmb{\Sigma}_t^{-1} - 2\pmb{G}_t'}\right\}$ , the gradients + +Algorithm 2 Mini-batch SABO +Require: Neighborhood size $\rho$ , learning rate $\beta_{t}$ , batch size $M$ +1: Initialized $\theta_0 = (\pmb{\mu}_0, \pmb{\Sigma}_0)$ ; +2: for $t = 0$ to $T - 1$ do +3: Take i.i.d. samples $z_j'$ ~ $\mathcal{N}(0, I)$ and set $\pmb{x}_j' = \pmb{\mu}_t + \pmb{\Sigma}_t^{\frac{1}{2}}\pmb{z}_j'$ for $j \in \{1, \dots, N\}$ ; +4: Sample a batch of data $\mathcal{B}'$ ; +5: Query the batch observations $\{F(\pmb{x}_1'; \mathcal{B}')$ , ..., $F(\pmb{x}_N'; \mathcal{B}')\}$ ; +6: Set the gradient $\pmb{g}_t'$ via Eq. (48) and set the gradient $\pmb{G}_t'$ via Eq. (49); +7: Compute $\lambda = \frac{1}{\rho} \sqrt{\|\pmb{\Sigma}_t\pmb{G}_t'\|_F^2 + 0.5\|\pmb{\Sigma}_t^{\frac{1}{2}}\pmb{g}_t'\|^2}$ ; +8: Compute $\delta_{\pmb{\mu}_t} = \frac{1}{\lambda}\pmb{\Sigma}_t\pmb{g}_t'$ and $\delta_{\pmb{\Sigma}_t} = \frac{2\pmb{\Sigma}_t\pmb{G}_t'}{\lambda\pmb{\Sigma}_t^{-1} - 2\pmb{G}_t'}$ ; +9: Take i.i.d. samples $z_j \sim \mathcal{N}(0, I)$ for $j \in \{1, \dots, N\}$ ; +10: Set $\pmb{x}_j = \pmb{\mu}_t + \delta_{\pmb{\mu}_t} + (\pmb{\Sigma}_t + \delta_{\pmb{\Sigma}_t})^{\frac{1}{2}}\pmb{z}_j$ for $j \in \{1, \dots, N\}$ ; +11: Sample a batch of data $\mathcal{B}$ ; +12: Query the batch observations $\{F(\pmb{x}_1; \mathcal{B}), \dots, F(\pmb{x}_N; \mathcal{B})\}$ ; +13: Set the gradient $\pmb{g}_t$ via Eq. (50) and set the gradient $\pmb{G}_t$ via Eq. (51); +14: Set $\pmb{\mu}_{t+1} = \pmb{\mu}_t - \beta_t\pmb{\Sigma}_t\pmb{g}_t$ ; +15: Set $\pmb{\Sigma}_{t+1}^{-1} = \pmb{\Sigma}_t^{-1} + 2\beta_t\pmb{G}_t$ ; +16: end for +17: return $\theta_T = (\pmb{\mu}_T, \pmb{\Sigma}_T)$ . + +$\nabla_{\pmb{\mu}}J(\pmb{\theta}_t + \pmb{\delta}_t)$ and $\nabla_{\Sigma}J(\pmb{\theta}_t + \pmb{\delta}_t)$ can also be approximated as + +$$ +\boldsymbol {g} _ {t} = \frac {1}{N M} \sum_ {j = 1} ^ {N} \sum_ {i = 1} ^ {M} \widehat {\boldsymbol {\Sigma}} _ {t} ^ {- 1} \left(\boldsymbol {x} _ {j} - \widehat {\boldsymbol {\mu}} _ {t}\right) \left(F \left(\boldsymbol {x} _ {j}; \left(X _ {i}, y _ {i}\right)\right) - F \left(\widehat {\boldsymbol {\mu}} _ {t}; \left(X _ {i}, y _ {i}\right)\right)\right), \tag {50} +$$ + +$$ +\begin{array}{l} \boldsymbol {G} _ {t} = \frac {1}{2 N M} \sum_ {j = 1} ^ {N} \sum_ {i = 1} ^ {M} \operatorname {d i a g} \left[ \widehat {\boldsymbol {\Sigma}} _ {t} ^ {- 1} \left[ \operatorname {d i a g} \left(\left(\boldsymbol {x} _ {j} - \widehat {\boldsymbol {\mu}} _ {t}\right) \left(\boldsymbol {x} _ {j} - \widehat {\boldsymbol {\mu}} _ {t}\right) ^ {\top} \widehat {\boldsymbol {\Sigma}} _ {t} ^ {- 1} - \boldsymbol {I}\right) \right. \right. \\ \left. \left. \times \left(F \left(\boldsymbol {x} _ {j}; \left(X _ {i}, y _ {i}\right)\right) - F \left(\widehat {\boldsymbol {\mu}} _ {t}; \left(X _ {i}, y _ {i}\right)\right)\right) \right] \right], \tag {51} \\ \end{array} +$$ + +where $\widehat{\Sigma}_t = \Sigma_t + \delta_{\Sigma_t}$ , $\widehat{\pmb{\mu}}_t = \pmb{\mu}_t + \delta_{\pmb{\mu}_t}$ , $x_j$ denotes the $j$ -th sample sampled from the distribution $\mathcal{N}(\pmb{x} \mid \widehat{\pmb{\mu}}_t, \widehat{\pmb{\Sigma}}_t)$ , and $(X_i, y_i)$ denotes the $i$ -th data in the mini-batch dataset $\mathcal{B}$ . Then we can update $\theta_t$ by Eq. (21). The entire algorithm of SABO with a mini-batch function query is shown in Algorithm 2. + +# C TECHNICAL LEMMAS + +In this section, we introduce the following technical lemmas for analysis. The proof of all technical lemmas is put in Appendix E. + +Lemma C.1 Suppose $\pmb{\Sigma}$ and $\hat{\pmb{\Sigma}}$ are two $d$ -dimensional diagonal matrix and $\pmb{z}$ is a $d$ -dimensional vector, then we have $\| \pmb{\Sigma} \pmb{z} \| \leq \| \pmb{\Sigma} \|_{\mathrm{F}} \| \pmb{z} \|$ and $\| \pmb{\Sigma} \hat{\pmb{\Sigma}} \|_{\mathrm{F}} \leq \| \pmb{\Sigma} \|_{\mathrm{F}} \| \hat{\pmb{\Sigma}} \|_{\mathrm{F}}$ . + +Lemma C.2 Given a convex function $F(x)$ , for Gaussian distribution with parameters $\pmb{\theta} \coloneqq \{\pmb{\mu}, \pmb{\Sigma}^{\frac{1}{2}}\}$ , let $J(\pmb{\theta}) \coloneqq \mathbb{E}_{p(\pmb{x}; \pmb{\theta})}[F(\pmb{x})]$ . Then $J(\pmb{\theta})$ is a convex function with respect to $\pmb{\theta}$ . + +Lemma C.3 Suppose that the gradient $G_{t}$ are positive semi-definite matrix and satisfies $\xi I \preceq G_{t} \preceq bI$ . Then for algorithm 1 and 2, we have the following results. + +(a) The (diagonal) covariance matrix $\pmb{\Sigma}_{T}$ satisfies $\frac{1}{2b\sum_{t=1}^{T}\beta_{t}\pmb{I} + \pmb{\Sigma}_{0}^{-1}} \preceq \pmb{\Sigma}_{T} \preceq \frac{1}{2\xi\sum_{t=1}^{T}\beta_{t}\pmb{I} + \pmb{\Sigma}_{0}^{-1}}$ . +(b) The Frobenius norm for the covariance matrix $\pmb{\Sigma}_t$ satisfies $\| \pmb{\Sigma}_t\|_{\mathrm{F}}\leq \frac{\sqrt{d}}{2\xi\sum_{k = 1}^{t}\beta_k}$ . + +Lemma C.4 For given $\pmb{\theta}_t$ , denote the approximated gradients of $\nabla_{\mu}J(\pmb{\theta}_t)$ and $\nabla_{\Sigma}J(\pmb{\theta}_t)$ by $\pmb{g}_t^\prime$ and $\pmb{G}_{t}^{\prime}$ , respectively. Then for Algorithm 1 and Algorithm 2, if $\rho \leq \frac{\sqrt{d}}{2}$ , then the perturbation satisfies, $\| \delta_{\mu_t}\| \leq \rho \sqrt{2}\| \Sigma_t^{\frac{1}{2}}\| _F$ and $\| \delta_{\Sigma_t}\| _F\leq 2\rho r\| \Sigma_t\| _F$ , where $r$ is a positive constant. + +Lemma C.5 In Algorithm 1, suppose the gradient estimator $g_{t}^{\prime}$ in t-th iteration as + +$$ +\boldsymbol {g} _ {t} ^ {\prime} = \boldsymbol {\Sigma} _ {t} ^ {- \frac {1}{2}} \boldsymbol {z} \left(F \left(\boldsymbol {\mu} _ {t} + \boldsymbol {\Sigma} _ {t} ^ {\frac {1}{2}} \boldsymbol {z}\right) - F \left(\boldsymbol {\mu} _ {t}\right)\right), \tag {52} +$$ + +where $\mathbf{z} \sim \mathcal{N}(0, I)$ . Then $\pmb{g}_t'$ is an unbiased estimator of the gradient $\nabla_{\pmb{\mu}} \mathbb{E}_{p\pmb{\theta}_t}[F(\pmb{x})]$ . + +Lemma C.6 In Algorithm 1, suppose the gradient estimator $\pmb{g}_t$ in $t$ -th iteration as + +$$ +\boldsymbol {g} _ {t} = \widehat {\boldsymbol {\Sigma}} _ {t} ^ {- \frac {1}{2}} \boldsymbol {z} \left(F \left(\widehat {\boldsymbol {\mu}} _ {t} + \widehat {\boldsymbol {\Sigma}} _ {t} ^ {\frac {1}{2}} \boldsymbol {z}\right) - F \left(\widehat {\boldsymbol {\mu}} _ {t}\right)\right), \tag {53} +$$ + +where $z \sim \mathcal{N}(0, I)$ . Suppose that Assumption 4.1 holds, $\rho < \frac{\sqrt{d}}{2}$ , the gradient $\pmb{G}_t$ is positive semi-definite matrix and satisfies $\xi \pmb{I} \preceq \pmb{G}_t \preceq b\pmb{I}$ and $\pmb{\Sigma}_0 \preceq R\pmb{I}$ , where $\xi, b, R \geq 0$ . Then we have + +$$ +\mathbb {E} \left[ \left\| \boldsymbol {\Sigma} _ {t} ^ {\frac {1}{2}} \boldsymbol {g} _ {t} \right\| ^ {2} \right] \leq \frac {L _ {F} ^ {2} (1 + 2 \rho r ^ {\prime}) (d + 4) ^ {2}}{2 \xi \left(\sum_ {k = 1} ^ {t} \beta_ {k}\right)}, \tag {54} +$$ + +where $r'$ is a positive constant. + +Lemma C.7 In Algorithm 2, suppose assumption 4.4 holds and the gradient estimator $\pmb{g}_t'$ in $t$ -th iteration as + +$$ +\boldsymbol {g} _ {t} ^ {\prime} = \boldsymbol {\Sigma} _ {t} ^ {- \frac {1}{2}} \boldsymbol {z} \left(F \left(\boldsymbol {\mu} _ {t} + \boldsymbol {\Sigma} _ {t} ^ {\frac {1}{2}} \boldsymbol {z}; \mathcal {B}\right) - F \left(\boldsymbol {\mu} _ {t}; \mathcal {B}\right)\right), \tag {55} +$$ + +where $\pmb{z} \sim \mathcal{N}(0, I)$ . Then $\pmb{g}_t'$ is an unbiased estimator of the gradient $\nabla_{\pmb{\mu}} \mathbb{E}_{p_{\theta_t}}[F(\pmb{x})]$ . + +Lemma C.8 In Algorithm 2, suppose the gradient estimator $\pmb{g}_t$ in $t$ -th iteration as + +$$ +\boldsymbol {g} _ {t} = \widehat {\boldsymbol {\Sigma}} _ {t} ^ {- \frac {1}{2}} \boldsymbol {z} \left(F \left(\widehat {\boldsymbol {\mu}} _ {t} + \widehat {\boldsymbol {\Sigma}} _ {t} ^ {\frac {1}{2}} \boldsymbol {z}; \mathcal {B}\right) - F \left(\widehat {\boldsymbol {\mu}} _ {t}; \mathcal {B}\right)\right), \tag {56} +$$ + +where $z \sim \mathcal{N}(0, I)$ . Suppose that Assumption 4.1 and Assumption 4.4 hold, $\rho < \frac{\sqrt{d}}{2}$ , the gradient $\pmb{G}_t$ is positive semi-definite matrix and satisfies $\xi \pmb{I} \preceq \pmb{G}_t \preceq b\pmb{I}$ and $\pmb{\Sigma}_0 \preceq R\pmb{I}$ , where $\xi, b, R \geq 0$ . Then we have + +$$ +\mathbb {E} \left[ \left\| \boldsymbol {\Sigma} _ {t} ^ {\frac {1}{2}} \boldsymbol {g} _ {t} \right\| ^ {2} \right] \leq \frac {L _ {F} ^ {2} (1 + 2 \rho r ^ {\prime}) (d + 4) ^ {2}}{6 \xi \left(\sum_ {k = 1} ^ {t} \beta_ {k}\right)} + \frac {2 (d + 4) \varepsilon^ {2}}{3}, \tag {57} +$$ + +where $r'$ is a positive constant, $\varepsilon^2 = 2\varepsilon_{\mathrm{B}}^2 + 2\varepsilon_{\mathrm{D}}^2$ . + +# D PROOF OF THE RESULT IN SECTION 4 + +In this section, we provide the proof of the result in Section 4. + +# D.1 PROOF OF THE PROPOSITION 4.2 + +Note that $F(\pmb {x})$ is a convex function, we have + +$$ +F (\boldsymbol {\mu}) = F \left(\mathbb {E} _ {\boldsymbol {x} \sim \mathcal {N} \left(\boldsymbol {\mu}, \boldsymbol {\Sigma}\right)} [ \boldsymbol {x} ]\right) \leq \mathbb {E} _ {\boldsymbol {x} \sim \mathcal {N} \left(\boldsymbol {\mu}, \boldsymbol {\Sigma}\right)} [ F (\boldsymbol {x}) ] = J (\boldsymbol {\mu}, \boldsymbol {\Sigma}). \tag {58} +$$ + +Since $F(\pmb{\mu}^{*}) = J(\pmb{\mu}^{*}, \mathbf{0})$ , it follows that + +$$ +F (\boldsymbol {\mu}) - F \left(\boldsymbol {\mu} ^ {*}\right) \leq J \left(\boldsymbol {\mu}, \boldsymbol {\Sigma}\right) - J \left(\boldsymbol {\mu} ^ {*}, \mathbf {0}\right), \tag {59} +$$ + +where we reach the conclusion. + +# D.2 PROOF OF THEOREM 4.3 + +The update rule of $\pmb{\mu}$ can be represented as $\pmb{\mu}_{t + 1} = \pmb{\mu}_t - \beta_t\pmb{\Sigma}_t\pmb{g}_t$ . Since $F(\pmb{x})$ is convex function, we have $J(\pmb{\theta})$ is convex w.r.t. $\pmb{\theta} = \{\pmb{\mu},\pmb{\Sigma}^{\frac{1}{2}}\}$ by Lemma C.2, together with $J(\pmb{\theta})$ is $c$ -strongly convex w.r.t. $\pmb{\mu}$ we obtain + +$$ +J \left(\boldsymbol {\theta} _ {t}\right) \leq J \left(\boldsymbol {\mu} ^ {*}, 0\right) + \nabla_ {\boldsymbol {\mu}} J \left(\boldsymbol {\theta} _ {t}\right) ^ {\top} \left(\boldsymbol {\mu} _ {t} - \boldsymbol {\mu} ^ {*}\right) + \nabla_ {\boldsymbol {\Sigma} ^ {\frac {1}{2}}} J \left(\boldsymbol {\theta} _ {t}\right) ^ {\top} \boldsymbol {\Sigma} _ {t} ^ {\frac {1}{2}} - \frac {c}{2} \| \boldsymbol {\mu} _ {t} - \boldsymbol {\mu} ^ {*} \| ^ {2}. \tag {60} +$$ + +Note that $\nabla_{\pmb{\Sigma}^{\frac{1}{2}}}J(\pmb{\theta}_t) = \pmb{\Sigma}_t^{\frac{1}{2}}\nabla_{\pmb{\Sigma}}J(\pmb{\theta}_t) + \nabla_{\pmb{\Sigma}}J(\pmb{\theta}_t)\pmb{\Sigma}_t^{\frac{1}{2}}$ , we have + +$$ +J \left(\boldsymbol {\theta} _ {t}\right) \leq J \left(\boldsymbol {\mu} ^ {*}, 0\right) + \nabla_ {\boldsymbol {\mu}} J \left(\boldsymbol {\theta} _ {t}\right) ^ {\top} \left(\boldsymbol {\mu} _ {t} - \boldsymbol {\mu} ^ {*}\right) + 2 \nabla_ {\boldsymbol {\Sigma}} J \left(\boldsymbol {\theta} _ {t}\right) \boldsymbol {\Sigma} _ {t} - \frac {c}{2} \| \boldsymbol {\mu} _ {t} - \boldsymbol {\mu} ^ {*} \| ^ {2}. \tag {61} +$$ + +Let $A_{t} = J(\pmb{\mu}_{t}, \pmb{\Sigma}_{t}) - J(\pmb{\mu}^{*}, 0)$ , we have + +$$ +\beta_ {t} \mathbb {E} [ A _ {t} ] \leq \beta_ {t} \mathbb {E} _ {\boldsymbol {z}} \left[ \nabla_ {\boldsymbol {\mu}} J \left(\boldsymbol {\theta} _ {t}\right) ^ {\top} \left(\boldsymbol {\mu} _ {t} - \boldsymbol {\mu} ^ {*}\right) \right] + 2 \beta_ {t} \mathbb {E} _ {\boldsymbol {z}} \left[ \nabla_ {\boldsymbol {\Sigma}} J \left(\boldsymbol {\theta} _ {t}\right) ^ {\top} \boldsymbol {\Sigma} _ {t} \right] - \frac {c \beta_ {t}}{2} \| \boldsymbol {\mu} _ {t} - \boldsymbol {\mu} ^ {*} \| ^ {2}. \tag {62} +$$ + +Note that + +$$ +\begin{array}{l} \left\| \boldsymbol {\mu} _ {t} - \boldsymbol {\mu} ^ {*} \right\| _ {\boldsymbol {\Sigma} _ {t} ^ {- 1}} ^ {2} - \left\| \boldsymbol {\mu} _ {t + 1} - \boldsymbol {\mu} ^ {*} \right\| _ {\boldsymbol {\Sigma} _ {t} ^ {- 1}} ^ {2} \\ = \left\| \boldsymbol {\mu} _ {t} - \boldsymbol {\mu} ^ {*} \right\| _ {\boldsymbol {\Sigma} _ {t} ^ {- 1}} ^ {2} - \left\| \boldsymbol {\mu} _ {t} - \beta_ {t} \boldsymbol {\Sigma} _ {t} \boldsymbol {g} _ {t} - \boldsymbol {\mu} ^ {*} \right\| _ {\boldsymbol {\Sigma} _ {t} ^ {- 1}} ^ {2} (63) \\ = \left\| \boldsymbol {\mu} _ {t} - \boldsymbol {\mu} ^ {*} \right\| _ {\boldsymbol {\Sigma} _ {t} ^ {- 1}} ^ {2} - \left(\left\| \boldsymbol {\mu} _ {t} - \boldsymbol {\mu} ^ {*} \right\| _ {\boldsymbol {\Sigma} _ {t} ^ {- 1}} ^ {2} - 2 \beta_ {t} \left\langle \boldsymbol {\mu} _ {t} - \boldsymbol {\mu} ^ {*}, \boldsymbol {g} _ {t} \right\rangle + \beta_ {t} ^ {2} \left\langle \boldsymbol {\Sigma} _ {t} \boldsymbol {g} _ {t}, \boldsymbol {g} _ {t} \right\rangle\right) (64) \\ = 2 \beta_ {t} \boldsymbol {g} _ {t} ^ {\top} \left(\boldsymbol {\mu} _ {t} - \boldsymbol {\mu} ^ {*}\right) - \beta_ {t} ^ {2} \left(\boldsymbol {\Sigma} _ {t} \boldsymbol {g} _ {t}\right) ^ {\top} \boldsymbol {g} _ {t}. (65) \\ \end{array} +$$ + +Therefore we have + +$$ +\boldsymbol {g} _ {t} ^ {\top} \left(\boldsymbol {\mu} _ {t} - \boldsymbol {\mu} ^ {*}\right) = \frac {1}{2 \beta_ {t}} \left(\left\| \boldsymbol {\mu} _ {t} - \boldsymbol {\mu} ^ {*} \right\| _ {\boldsymbol {\Sigma} _ {t} ^ {- 1}} ^ {2} - \left\| \boldsymbol {\mu} _ {t + 1} - \boldsymbol {\mu} ^ {*} \right\| _ {\boldsymbol {\Sigma} _ {t} ^ {- 1}} ^ {2}\right) + \frac {\beta_ {t}}{2} \left(\boldsymbol {\Sigma} _ {t} \boldsymbol {g} _ {t}\right) ^ {\top} \boldsymbol {g} _ {t}. \tag {66} +$$ + +According to Lemma C.5, we have $\mathbb{E}\pmb {g}_t = \nabla_\mu J(\pmb {\theta}_t + \pmb {\delta}_t)$ . Then we have + +$$ +\begin{array}{l} \mathbb {E} \left[ \left(\nabla_ {\boldsymbol {\mu}} J (\boldsymbol {\theta} _ {t}) - \boldsymbol {g} _ {t}\right) ^ {\top} \left(\boldsymbol {\mu} _ {t} - \boldsymbol {\mu} ^ {*}\right) \right] \\ = \mathbb {E} \left[ \left(\nabla_ {\boldsymbol {\mu}} J (\boldsymbol {\theta} _ {t}) - \nabla_ {\boldsymbol {\mu}} J \left(\boldsymbol {\theta} _ {t} + \boldsymbol {\delta} _ {t}\right)\right) ^ {\top} \left(\boldsymbol {\mu} _ {t} - \boldsymbol {\mu} ^ {*}\right) \right] + \mathbb {E} \left[ \left(\nabla_ {\boldsymbol {\mu}} J \left(\boldsymbol {\theta} _ {t} + \boldsymbol {\delta} _ {t}\right) - \boldsymbol {g} _ {t}\right) ^ {\top} \left(\boldsymbol {\mu} _ {t} - \boldsymbol {\mu} ^ {*}\right) \right] (67) \\ \leq \left\| \boldsymbol {\mu} _ {t} - \boldsymbol {\mu} ^ {*} \right\| \left\| \nabla_ {\boldsymbol {\mu}} J \left(\boldsymbol {\theta} _ {t}\right) - \nabla_ {\boldsymbol {\mu}} J \left(\boldsymbol {\theta} _ {t} + \boldsymbol {\delta} _ {t}\right) \right\| (68) \\ \leq D L \left\| \boldsymbol {\delta} _ {t} \right\| (69) \\ \leq D L \rho_ {t} U _ {t}, (70) \\ \end{array} +$$ + +where the first inequality is due to the Cauchy-Schwarz inequality, the second inequality is due to $\| \pmb{\mu}_t - \pmb{\mu}^*\| \leq D$ and Assumption 4.1, the last inequality is due to Lemma C.4, and $U_{t} = \max (2\sqrt{2}\| \pmb{\Sigma}_{t}^{\frac{1}{2}}\|_{\mathrm{F}},4r\| \pmb{\Sigma}_{t}\|_{\mathrm{F}})$ . Then we have + +$$ +\begin{array}{l} \mathbb {E} _ {\boldsymbol {z}} \left[ \nabla_ {\boldsymbol {\mu}} J \left(\boldsymbol {\theta} _ {t}\right) ^ {\top} \left(\boldsymbol {\mu} _ {t} - \boldsymbol {\mu} ^ {*}\right) \right] (71) \\ = \mathbb {E} _ {\boldsymbol {z}} \left[ \boldsymbol {g} _ {t} ^ {\top} \left(\boldsymbol {\mu} _ {t} - \boldsymbol {\mu} ^ {*}\right) + \left(\nabla_ {\boldsymbol {\mu}} J \left(\boldsymbol {\theta} _ {t}\right) - \boldsymbol {g} _ {t}\right) ^ {\top} \left(\boldsymbol {\mu} _ {t} - \boldsymbol {\mu} ^ {*}\right) \right] (72) \\ \leq \frac {1}{2 \beta_ {t}} \mathbb {E} _ {\boldsymbol {z}} \left[ \| \boldsymbol {\mu} _ {t} - \boldsymbol {\mu} ^ {*} \| _ {\boldsymbol {\Sigma} _ {t} ^ {- 1}} ^ {2} - \| \boldsymbol {\mu} _ {t + 1} - \boldsymbol {\mu} ^ {*} \| _ {\boldsymbol {\Sigma} _ {t} ^ {- 1}} ^ {2} \right] + \beta_ {t} \left(\boldsymbol {\Sigma} _ {t} \boldsymbol {g} _ {t}\right) ^ {\top} \boldsymbol {g} _ {t} ] + D L \rho_ {t} U _ {t}, (73) \\ \end{array} +$$ + +where the inequality is due to Eq. (66), Eq. (70), and $\beta_{t} \geq 0$ . Note that + +$$ +\mathbb {E} \left[ \nabla_ {\boldsymbol {\Sigma}} J \left(\boldsymbol {\theta} _ {t}\right) ^ {\top} \boldsymbol {\Sigma} _ {t} \right] \leq \mathbb {E} \left[ \| \nabla_ {\boldsymbol {\Sigma}} J (\boldsymbol {\theta} _ {t}) \| \right] \| \boldsymbol {\Sigma} _ {t} \| _ {\mathrm {F}} \leq H \| \boldsymbol {\Sigma} _ {t} \| _ {\mathrm {F}}, \tag {74} +$$ + +where the first inequality is due to Lemma C.1 and the second inequality is due to the Lipschitz continuous assumption of the function $J(\pmb{\theta})$ . Then substituting Eq. (73) and Eq. (74) into Eq. (62) and multiplying $\beta_{t}$ on both sides of the inequality, we have + +$$ +\begin{array}{l} \beta_ {t} \mathbb {E} [ A _ {t} ] \leq \frac {1}{2} \mathbb {E} [ \| \boldsymbol {\mu} _ {t} - \boldsymbol {\mu} ^ {*} \| _ {\boldsymbol {\Sigma} _ {t} ^ {- 1}} ^ {2} - \| \boldsymbol {\mu} _ {t + 1} - \boldsymbol {\mu} ^ {*} \| _ {\boldsymbol {\Sigma} _ {t} ^ {- 1}} ^ {2} ] - \frac {c \beta_ {t}}{2} \| \boldsymbol {\mu} _ {t} - \boldsymbol {\mu} ^ {*} \| ^ {2} + 2 \beta_ {t} ^ {2} H \| \boldsymbol {\Sigma} _ {t} \| _ {\mathrm {F}} \tag {75} \\ + D L \rho_ {t} U _ {t} + \beta_ {t} ^ {2} \| \boldsymbol {\Sigma} _ {t} ^ {\frac {1}{2}} \| _ {\mathrm {F}} \mathbb {E} \| \boldsymbol {\Sigma} _ {t} ^ {\frac {1}{2}} \boldsymbol {g} _ {t} \| ^ {2}, \\ \end{array} +$$ + +We further obtain that + +$$ +\begin{array}{l} \sum_ {t = 0} ^ {T - 1} \left[ \frac {1}{2} \mathbb {E} \left[ \| \boldsymbol {\mu} _ {t} - \boldsymbol {\mu} ^ {*} \| _ {\boldsymbol {\Sigma} _ {t} ^ {- 1}} ^ {2} - \| \boldsymbol {\mu} _ {t + 1} - \boldsymbol {\mu} ^ {*} \| _ {\boldsymbol {\Sigma} _ {t} ^ {- 1}} ^ {2} \right] - \frac {c \beta_ {t}}{2} \| \boldsymbol {\mu} _ {t} - \boldsymbol {\mu} ^ {*} \| ^ {2} \right] (76) \\ \leq \frac {1}{2} \sum_ {t = 0} ^ {T - 1} \left[ \| \boldsymbol {\mu} _ {t} - \boldsymbol {\mu} ^ {*} \| _ {\boldsymbol {\Sigma} _ {t} ^ {- 1}} ^ {2} - \| \boldsymbol {\mu} _ {t - 1} - \boldsymbol {\mu} ^ {*} \| _ {\boldsymbol {\Sigma} _ {t - 1} ^ {- 1}} ^ {2} - \frac {c \beta_ {t}}{2} \| \boldsymbol {\mu} _ {t} - \boldsymbol {\mu} ^ {*} \| ^ {2} \right] (77) \\ + \frac {1}{2} \left[ \| \boldsymbol {\mu} _ {0} - \boldsymbol {\mu} ^ {*} \| _ {\Sigma_ {0} ^ {- 1}} ^ {2} - \| \boldsymbol {\mu} _ {T} - \boldsymbol {\mu} ^ {*} \| _ {\Sigma_ {T - 1} ^ {- 1}} ^ {2} \right] (78) \\ \leq \frac {1}{2} \sum_ {t = 0} ^ {T - 1} \left[ \| \boldsymbol {\mu} _ {t} - \boldsymbol {\mu} ^ {*} \| _ {2 \beta_ {t} \boldsymbol {G} _ {t}} ^ {2} - \frac {c \beta_ {t}}{2} \| \boldsymbol {\mu} _ {t} - \boldsymbol {\mu} ^ {*} \| ^ {2} \right] + \| \boldsymbol {\Sigma} _ {0} ^ {- 1} \| _ {\mathrm {F}} D ^ {2} (79) \\ \leq \frac {1}{2} \sum_ {t = 0} ^ {T - 1} \left[ \frac {c \beta_ {t}}{2} \| \boldsymbol {\mu} _ {t} - \boldsymbol {\mu} ^ {*} \| ^ {2} - \frac {c \beta_ {t}}{2} \| \boldsymbol {\mu} _ {t} - \boldsymbol {\mu} ^ {*} \| ^ {2} \right] + \| \boldsymbol {\Sigma} _ {0} ^ {- 1} \| _ {\mathrm {F}} D ^ {2} (80) \\ = \left\| \boldsymbol {\Sigma} _ {0} ^ {- 1} \right\| _ {\mathrm {F}} D ^ {2}, (81) \\ \end{array} +$$ + +where the second inequality is due to the update rule of $\pmb{\Sigma}_t$ and $\| \pmb{\mu}_t - \pmb{\mu}^*\| \leq D$ , and the third inequality is due to Cauchy-Schwarz inequality and $\pmb{G}_t \preceq \frac{c}{4}\pmb{I}$ . Then we have + +$$ +\begin{array}{l} \sum_ {t = 0} ^ {T - 1} \beta_ {t} \mathbb {E} [ A _ {t} ] \leq \| \boldsymbol {\Sigma} _ {0} ^ {- 1} \| _ {\mathrm {F}} D ^ {2} + \sum_ {t = 0} ^ {T - 1} \left(2 H \beta_ {t} ^ {2} \| \boldsymbol {\Sigma} _ {t} \| _ {\mathrm {F}} + D L \rho_ {t} U _ {t} + \beta_ {t} ^ {2} \| \boldsymbol {\Sigma} _ {t} ^ {\frac {1}{2}} \| _ {\mathrm {F}} \mathbb {E} \| \boldsymbol {\Sigma} _ {t} ^ {\frac {1}{2}} \boldsymbol {g} _ {t} \| ^ {2}\right) (82) \\ \leq \left\| \boldsymbol {\Sigma} _ {0} ^ {- 1} \right\| _ {\mathrm {F}} D ^ {2} + \sum_ {t = 0} ^ {T - 1} \left(\frac {2 H \beta_ {t} ^ {2} \sqrt {d}}{2 \xi \sum_ {k = 1} ^ {t} \beta_ {k}} + D L \rho_ {t} U _ {t} + \frac {L _ {F} ^ {2} R ^ {\frac {1}{2}} (1 + 2 \rho r ^ {\prime}) (d + 4) ^ {2} \beta_ {t} ^ {2}}{2 \xi (\sum_ {k = 1} ^ {t} \beta_ {k})}\right), (83) \\ \end{array} +$$ + +where the first inequality is due to Eq. (81) and Eq. (75), and the second inequality is due to Lemma C.6 and $\| \Sigma_t^{\frac{1}{2}}\|_{\mathrm{F}}\leq R^{\frac{1}{2}}$ . According to C.3 (b), we have $U_{t}\leq \max (\frac{2\sqrt{2}d^{\frac{1}{4}}}{(2\xi\sum_{k = 1}^{t}\beta_{k})^{\frac{1}{2}}},\frac{4r\sqrt{d}}{2\xi\sum_{k = 1}^{t}\beta_{k}})$ . Therefore, there exists a constant $t^*$ , when $t > t^{*} - 1$ , $U_{t}\leq \frac{2\sqrt{2}d^{\frac{1}{4}}}{(2\xi\sum_{k = 1}^{t}\beta_{k})^{\frac{1}{2}}}$ . Denote $\sum_{t = 0}^{t^{*} - 1}\frac{4r\rho_{t}\sqrt{d}}{2\xi\sum_{k = 1}^{t}\beta_{k}}$ by a constant $\Gamma$ . Then if $T > t^{*}$ , we have + +$$ +\begin{array}{l} \frac {1}{T} \sum_ {t = 0} ^ {T - 1} \mathbb {E} [ A _ {t} ] \leq \frac {\left\| \boldsymbol {\Sigma} _ {0} ^ {- 1} \right\| _ {\mathrm {F}} D ^ {2}}{T \beta_ {t}} + \frac {1}{T} \sum_ {t = 0} ^ {T - 1} \left(\frac {2 H \beta_ {t} \sqrt {d}}{2 \xi \sum_ {k = 1} ^ {t} \beta_ {k}} + \frac {L _ {F} ^ {2} R ^ {\frac {1}{2}} (1 + 2 \rho r ^ {\prime}) (d + 4) ^ {2} \beta_ {t}}{2 \xi \sum_ {k = 1} ^ {t} \beta_ {k}}\right) \tag {84} \\ + \frac {1}{T} \sum_ {t = t *} ^ {T - 1} \left(\frac {2 \sqrt {2} D L \rho_ {t} d ^ {\frac {1}{4}}}{\beta_ {t} (2 \xi \sum_ {k = 1} ^ {t} \beta_ {k}) ^ {\frac {1}{2}}}\right) + \frac {D L \Gamma}{T \beta_ {t}}, \\ \end{array} +$$ + +Let $\beta_{t} = \beta$ and $\rho_{t} = \frac{\rho_{0}}{\sqrt{t}}$ , we can obtain that + +$$ +\frac {1}{T} \sum_ {t = 0} ^ {T - 1} \mathbb {E} [ A _ {t} ] \leq \frac {\left\| \boldsymbol {\Sigma} _ {0} ^ {- 1} \right\| _ {\mathrm {F}} D ^ {2}}{T \beta} + \frac {1}{T} \sum_ {t = 0} ^ {T - 1} \left(\frac {C}{2 \xi t}\right) + \frac {1}{T} \sum_ {t = t ^ {*}} ^ {T - 1} \left(\frac {2 \sqrt {2} D L \rho_ {0} d ^ {\frac {1}{4}}}{\sqrt {2 \xi} \beta^ {\frac {3}{2}} t}\right) + \frac {D L \Gamma}{T \beta}, \tag {85} +$$ + +where $C = 2H\sqrt{d} + L_F^2 R^{\frac{1}{2}}(1 + 2\rho r')(d + 4)^2$ . Since we have $\sum_{t=1}^{T}\frac{1}{t} \leq 1 + \log(T)$ , we obtain + +$$ +\frac {1}{T} \sum_ {t = 0} ^ {T - 1} \mathbb {E} [ J (\boldsymbol {\mu} _ {t + 1}, \boldsymbol {\Sigma} _ {t}) - J (\boldsymbol {\mu} ^ {*}, 0) ] = \frac {1}{T} \sum_ {t = 0} ^ {T - 1} \mathbb {E} [ A _ {t} ] = \mathcal {O} \left(\frac {1}{T} + \frac {\log T}{T}\right), \tag {86} +$$ + +where we reach the conclusion. + +Remark D.1 In Theorem 4.3, if we set $\beta = \mathcal{O}(1)$ and $\rho = \mathcal{O}\left(\frac{1}{\sqrt{T}}\right)$ , then the third term in right-hand side of Eq. (84) has a convergence rate of $\mathcal{O}\left(\frac{\log T}{T}\right)$ . If we set $\beta = \mathcal{O}(1)$ and $\rho = \mathcal{O}(1)$ , then + +the third term in right-hand side of Eq. (84) has a convergence rate of $\mathcal{O}\left(\frac{1}{\sqrt{T}}\right)$ , since we have $\sum_{t=1}^{T} \frac{1}{\sqrt{t}} \leq 2\sqrt{T}$ . Then we obtain + +$$ +\frac {1}{T} \sum_ {t = 0} ^ {T - 1} \mathbb {E} [ J (\boldsymbol {\mu} _ {t + 1}, \boldsymbol {\Sigma} _ {t}) - J (\boldsymbol {\mu} ^ {*}, 0) ] = \frac {1}{T} \sum_ {t = 0} ^ {T - 1} \mathbb {E} [ A _ {t} ] = \mathcal {O} \left(\frac {1}{T} + \frac {\log T}{T} + \frac {1}{\sqrt {T}}\right). \tag {87} +$$ + +This implies $\frac{1}{T}\sum_{t = 0}^{T - 1}\mathbb{E}\left[J(\pmb{\mu}_{t + 1},\pmb{\Sigma}_t) - J(\pmb{\mu}^*,0)\right] = \mathcal{O}\left(\frac{1}{\sqrt{T}}\right)$ . + +# D.3 PROOF OF THE PROPOSITION 4.5 + +Since the datasets $\mathcal{D}$ and $\mathcal{B}$ are i.i.d. sampled from one data distribution $P(X,y)$ . We have $\mathbb{E}_{(X,y)\sim P}[F(\pmb{x};(X,y))] = \mathbb{E}[F(\pmb{x};\mathcal{B})] = \mathbb{E}[F(\pmb{x};\mathcal{D})]$ . We obtain that + +$$ +\| F (\boldsymbol {x}; \mathcal {B}) - F (\boldsymbol {x}; \mathcal {D}) \| _ {2} ^ {2} \leq 2 \| F (\boldsymbol {x}; \mathcal {B}) - \mathbb {E} F (\boldsymbol {x}; \mathcal {B}) \| _ {2} ^ {2} + 2 \| F (\boldsymbol {x}; \mathcal {D}) - \mathbb {E} F (\boldsymbol {x}; \mathcal {D}) \| _ {2} ^ {2} = 2 \left(\varepsilon_ {\mathrm {B}} ^ {2} + \varepsilon_ {\mathrm {D}} ^ {2}\right) \tag {88} +$$ + +# D.4 PROOF OF THEOREM 4.6 + +Note that for SABO with a mini-batch function query, the update rule of $\pmb{\mu}$ can be represented as $\pmb{\mu}_{t + 1} = \pmb{\mu}_t - \beta_t\pmb{\Sigma}_t\pmb{g}_t$ . Let $B_{t} = J(\pmb{\mu}_{t},\pmb{\Sigma}_{t}) - J(\pmb{\mu}^{*},0)$ , then by using Eq. (61), we have + +$$ +\begin{array}{l} \beta_ {t} \mathbb {E} [ B _ {t} ] \leq \beta_ {t} \mathbb {E} \left[ \nabla_ {\boldsymbol {\mu}} J \left(\boldsymbol {\theta} _ {t}\right) ^ {\top} \left(\boldsymbol {\mu} _ {t} - \boldsymbol {\mu} ^ {*}\right) \right] + 2 \beta_ {t} \mathbb {E} \left[ \nabla_ {\boldsymbol {\Sigma}} J \left(\boldsymbol {\theta} _ {t}\right) ^ {\top} \boldsymbol {\Sigma} _ {t} \right] - \frac {c \beta_ {t}}{2} \| \boldsymbol {\mu} _ {t} - \boldsymbol {\mu} ^ {*} \| ^ {2} (89) \\ \leq \beta_ {t} \mathbb {E} \left[ \nabla_ {\boldsymbol {\mu}} J \left(\boldsymbol {\theta} _ {t}\right) ^ {\top} \left(\boldsymbol {\mu} _ {t} - \boldsymbol {\mu} ^ {*}\right) \right] + 2 \beta_ {t} H \| \boldsymbol {\Sigma} _ {t} \| _ {\mathrm {F}} - \frac {c \beta_ {t}}{2} \| \boldsymbol {\mu} _ {t} - \boldsymbol {\mu} ^ {*} \| ^ {2}, (90) \\ \end{array} +$$ + +where the second inequality is due to Lemma C.1 and Lipschitz continuous assumption of the function $J(\pmb{\theta})$ . Note that + +$$ +\begin{array}{l} \left\| \boldsymbol {\mu} _ {t} - \boldsymbol {\mu} ^ {*} \right\| _ {\boldsymbol {\Sigma} _ {t} ^ {- 1}} ^ {2} - \left\| \boldsymbol {\mu} _ {t + 1} - \boldsymbol {\mu} ^ {*} \right\| _ {\boldsymbol {\Sigma} _ {t} ^ {- 1}} ^ {2} \\ = \left\| \boldsymbol {\mu} _ {t} - \boldsymbol {\mu} ^ {*} \right\| _ {\boldsymbol {\Sigma} _ {t} ^ {- 1}} ^ {2} - \left\| \boldsymbol {\mu} _ {t} - \beta_ {t} \boldsymbol {\Sigma} _ {t} \boldsymbol {g} _ {t} - \boldsymbol {\mu} ^ {*} \right\| _ {\boldsymbol {\Sigma} _ {t} ^ {- 1}} ^ {2} (91) \\ = \left\| \boldsymbol {\mu} _ {t} - \boldsymbol {\mu} ^ {*} \right\| _ {\boldsymbol {\Sigma} _ {t} ^ {- 1}} ^ {2} - \left(\left\| \boldsymbol {\mu} _ {t} - \boldsymbol {\mu} ^ {*} \right\| _ {\boldsymbol {\Sigma} _ {t} ^ {- 1}} ^ {2} - 2 \beta_ {t} \left\langle \boldsymbol {\mu} _ {t} - \boldsymbol {\mu} ^ {*}, \boldsymbol {g} _ {t} \right\rangle + \beta_ {t} ^ {2} \left\langle \boldsymbol {\Sigma} _ {t} \boldsymbol {g} _ {t}, \boldsymbol {g} _ {t} \right\rangle\right) (92) \\ = 2 \beta_ {t} \boldsymbol {g} _ {t} ^ {\top} \left(\boldsymbol {\mu} _ {t} - \boldsymbol {\mu} ^ {*}\right) - \beta_ {t} ^ {2} \left(\boldsymbol {\Sigma} _ {t} \boldsymbol {g} _ {t}\right) ^ {\top} \boldsymbol {g} _ {t}. (93) \\ \end{array} +$$ + +It follows that + +$$ +\begin{array}{l} \boldsymbol {g} _ {t} ^ {\top} \left(\boldsymbol {\mu} _ {t} - \boldsymbol {\mu} ^ {*}\right) = \frac {1}{2 \beta_ {t}} \left(\left\| \boldsymbol {\mu} _ {t} - \boldsymbol {\mu} ^ {*} \right\| _ {\boldsymbol {\Sigma} _ {t} ^ {- 1}} ^ {2} - \left\| \boldsymbol {\mu} _ {t + 1} - \boldsymbol {\mu} ^ {*} \right\| _ {\boldsymbol {\Sigma} _ {t} ^ {- 1}} ^ {2}\right) + \frac {\beta_ {t}}{2} \left(\boldsymbol {\Sigma} _ {t} \boldsymbol {g} _ {t}\right) ^ {\top} \boldsymbol {g} _ {t} (94) \\ \leq \frac {1}{2 \beta_ {t}} \left(\| \boldsymbol {\mu} _ {t} - \boldsymbol {\mu} ^ {*} \| _ {\boldsymbol {\Sigma} _ {t} ^ {- 1}} ^ {2} - \| \boldsymbol {\mu} _ {t + 1} - \boldsymbol {\mu} ^ {*} \| _ {\boldsymbol {\Sigma} _ {t} ^ {- 1}} ^ {2}\right) + \beta_ {t} \| \boldsymbol {\Sigma} _ {t} ^ {\frac {1}{2}} \| _ {\mathrm {F}} \| \boldsymbol {\Sigma} _ {t} ^ {\frac {1}{2}} \boldsymbol {g} _ {t} \| ^ {2}, (95) \\ \end{array} +$$ + +where the inequality is due to $\beta_{t} \geq 0$ and Lemma C.1. According to Lemma C.7, we have $\mathbb{E}\pmb{g}_t = \nabla_\mu J(\pmb{\theta}_t + \pmb{\delta}_t)$ . Therefore + +$$ +\begin{array}{l} \mathbb {E} \left[ \left(\nabla_ {\boldsymbol {\mu}} J (\boldsymbol {\theta} _ {t}) - \boldsymbol {g} _ {t}\right) ^ {\top} \left(\boldsymbol {\mu} _ {t} - \boldsymbol {\mu} ^ {*}\right) \right] \\ = \mathbb {E} _ {\boldsymbol {z}} \left[ \left(\nabla_ {\boldsymbol {\mu}} J \left(\boldsymbol {\theta} _ {t}\right) - \nabla_ {\boldsymbol {\mu}} J \left(\boldsymbol {\theta} _ {t} + \boldsymbol {\delta} _ {t}\right)\right) ^ {\top} \left(\boldsymbol {\mu} _ {t} - \boldsymbol {\mu} ^ {*}\right) \right] + \mathbb {E} _ {\boldsymbol {z}} \left[ \left(\nabla_ {\boldsymbol {\mu}} J \left(\boldsymbol {\theta} _ {t} + \boldsymbol {\delta} _ {t}\right) - \boldsymbol {g} _ {t}\right) ^ {\top} \left(\boldsymbol {\mu} _ {t} - \boldsymbol {\mu} ^ {*}\right) \right] (96) \\ \leq \left\| \boldsymbol {\mu} _ {t} - \boldsymbol {\mu} ^ {*} \right\| \left\| \nabla_ {\boldsymbol {\mu}} J \left(\boldsymbol {\theta} _ {t}\right) - \nabla_ {\boldsymbol {\mu}} J \left(\boldsymbol {\theta} _ {t} + \boldsymbol {\delta} _ {t}\right) \right\| (97) \\ \leq D L \left\| \boldsymbol {\delta} _ {t} \right\| (98) \\ \leq D L \rho_ {t} U _ {t}, (99) \\ \end{array} +$$ + +where the first inequality is due to the Cauchy-Schwarz inequality, the second inequality is due to $\| \pmb{\mu}_t - \pmb{\mu}^*\| \leq D$ and smoothness assumption of the function $J(\theta)$ , the last inequality is due to Lemma C.4, and $U_{t} = \max (2\sqrt{2}\| \Sigma_{t}^{\frac{1}{2}}\|_{\mathrm{F}},4r\| \Sigma_{t}\|_{\mathrm{F}})$ . Then we have + +$$ +\begin{array}{l} \mathbb {E} _ {\boldsymbol {z}} \left[ \nabla_ {\boldsymbol {\mu}} J \left(\boldsymbol {\theta} _ {t}\right) ^ {\top} \left(\boldsymbol {\mu} _ {t} - \boldsymbol {\mu} ^ {*}\right) \right] (100) \\ = \mathbb {E} _ {\boldsymbol {z}} \left[ \boldsymbol {g} _ {t} ^ {\top} \left(\boldsymbol {\mu} _ {t} - \boldsymbol {\mu} ^ {*}\right) + \left(\nabla_ {\boldsymbol {\mu}} J \left(\boldsymbol {\theta} _ {t}\right) - \boldsymbol {g} _ {t}\right) ^ {\top} \left(\boldsymbol {\mu} _ {t} - \boldsymbol {\mu} ^ {*}\right) \right] (101) \\ \leq \frac {1}{2 \beta_ {t}} \mathbb {E} _ {\boldsymbol {z}} \left[ \| \boldsymbol {\mu} _ {t} - \boldsymbol {\mu} ^ {*} \| _ {\boldsymbol {\Sigma} _ {t} ^ {- 1}} ^ {2} - \| \boldsymbol {\mu} _ {t + 1} - \boldsymbol {\mu} ^ {*} \| _ {\boldsymbol {\Sigma} _ {t} ^ {- 1}} ^ {2} \right] + \beta_ {t} \| \boldsymbol {\Sigma} _ {t} ^ {\frac {1}{2}} \| _ {\mathrm {F}} \mathbb {E} \| \boldsymbol {\Sigma} _ {t} ^ {\frac {1}{2}} \boldsymbol {g} _ {t} \| ^ {2} + D L \rho_ {t} U _ {t}, (102) \\ \end{array} +$$ + +where the inequality is due to Eq. (95) and Eq. (99). Then substituting Eq. (102) into Eq. (90) and multiplying $\beta_{t}$ on both sides of the inequality, we have + +$$ +\begin{array}{l} \beta_ {t} \mathbb {E} [ B _ {t} ] \leq \frac {1}{2} \mathbb {E} [ \| \boldsymbol {\mu} _ {t} - \boldsymbol {\mu} ^ {*} \| _ {\boldsymbol {\Sigma} _ {t} ^ {- 1}} ^ {2} - \| \boldsymbol {\mu} _ {t + 1} - \boldsymbol {\mu} ^ {*} \| _ {\boldsymbol {\Sigma} _ {t} ^ {- 1}} ^ {2} ] - \frac {c \beta_ {t}}{2} \| \boldsymbol {\mu} _ {t} - \boldsymbol {\mu} ^ {*} \| ^ {2} + 2 \beta_ {t} ^ {2} H \| \boldsymbol {\Sigma} _ {t} \| _ {\mathrm {F}} \tag {103} \\ + D L \rho_ {t} U _ {t} + \beta_ {t} ^ {2} \| \boldsymbol {\Sigma} _ {t} ^ {\frac {1}{2}} \| _ {\mathrm {F}} \mathbb {E} \| \boldsymbol {\Sigma} _ {t} ^ {\frac {1}{2}} \boldsymbol {g} _ {t} \| ^ {2}, \\ \end{array} +$$ + +We further obtain that + +$$ +\begin{array}{l} \sum_ {t = 0} ^ {T - 1} \left[ \frac {1}{2} \mathbb {E} \left[ \| \boldsymbol {\mu} _ {t} - \boldsymbol {\mu} ^ {*} \| _ {\boldsymbol {\Sigma} _ {t} ^ {- 1}} ^ {2} - \| \boldsymbol {\mu} _ {t + 1} - \boldsymbol {\mu} ^ {*} \| _ {\boldsymbol {\Sigma} _ {t} ^ {- 1}} ^ {2} \right] - \frac {c \beta_ {t}}{2} \| \boldsymbol {\mu} _ {t} - \boldsymbol {\mu} ^ {*} \| ^ {2} \right] (104) \\ \leq \frac {1}{2} \sum_ {t = 0} ^ {T - 1} \left[ \| \boldsymbol {\mu} _ {t} - \boldsymbol {\mu} ^ {*} \| _ {\boldsymbol {\Sigma} _ {t} ^ {- 1}} ^ {2} - \| \boldsymbol {\mu} _ {t - 1} - \boldsymbol {\mu} ^ {*} \| _ {\boldsymbol {\Sigma} _ {t - 1} ^ {- 1}} ^ {2} - \frac {c \beta_ {t}}{2} \| \boldsymbol {\mu} _ {t} - \boldsymbol {\mu} ^ {*} \| ^ {2} \right] (105) \\ + \frac {1}{2} \left[ \| \boldsymbol {\mu} _ {0} - \boldsymbol {\mu} ^ {*} \| _ {\boldsymbol {\Sigma} _ {0} ^ {- 1}} ^ {2} - \| \boldsymbol {\mu} _ {T} - \boldsymbol {\mu} ^ {*} \| _ {\boldsymbol {\Sigma} _ {T - 1} ^ {- 1}} ^ {2} \right] (106) \\ \leq \frac {1}{2} \sum_ {t = 0} ^ {T - 1} \left[ \| \boldsymbol {\mu} _ {t} - \boldsymbol {\mu} ^ {*} \| _ {2 \beta_ {t} \boldsymbol {G} _ {t}} ^ {2} - \frac {c \beta_ {t}}{2} \| \boldsymbol {\mu} _ {t} - \boldsymbol {\mu} ^ {*} \| ^ {2} \right] + \| \boldsymbol {\Sigma} _ {0} ^ {- 1} \| _ {\mathrm {F}} D ^ {2} (107) \\ \leq \frac {1}{2} \sum_ {t = 0} ^ {T - 1} \left[ \frac {c \beta_ {t}}{2} \| \boldsymbol {\mu} _ {t} - \boldsymbol {\mu} ^ {*} \| ^ {2} - \frac {c \beta_ {t}}{2} \| \boldsymbol {\mu} _ {t} - \boldsymbol {\mu} ^ {*} \| ^ {2} \right] + \| \boldsymbol {\Sigma} _ {0} ^ {- 1} \| _ {\mathrm {F}} D ^ {2} (108) \\ = \left\| \boldsymbol {\Sigma} _ {0} ^ {- 1} \right\| _ {\mathrm {F}} D ^ {2}, (109) \\ \end{array} +$$ + +where the second inequality is due to the update rule of $\pmb{\Sigma}_t$ and $\| \pmb{\mu}_t - \pmb{\mu}^*\| \leq D$ , and the third inequality is due to Cauchy-Schwarz inequality and $\pmb{G}_t \preceq \frac{c}{4}\pmb{I}$ . Then we have + +$$ +\sum_ {t = 0} ^ {T - 1} \beta_ {t} \mathbb {E} [ B _ {t} ] \leq \| \boldsymbol {\Sigma} _ {0} ^ {- 1} \| _ {\mathrm {F}} D ^ {2} + \sum_ {t = 0} ^ {T - 1} \left(2 H \beta_ {t} ^ {2} \| \boldsymbol {\Sigma} _ {t} \| _ {\mathrm {F}} + D L \rho_ {t} U _ {t} + \beta_ {t} ^ {2} \| \boldsymbol {\Sigma} _ {t} ^ {\frac {1}{2}} \| _ {\mathrm {F}} \mathbb {E} \| \boldsymbol {\Sigma} _ {t} ^ {\frac {1}{2}} \boldsymbol {g} _ {t} \| ^ {2}\right) \tag {110} +$$ + +$$ +\begin{array}{l} \leq \| \boldsymbol {\Sigma} _ {0} ^ {- 1} \| _ {\mathrm {F}} D ^ {2} + \sum_ {t = 0} ^ {T - 1} \left(\frac {2 H \beta_ {t} ^ {2} \sqrt {d}}{2 \xi \sum_ {k = 1} ^ {t} \beta_ {k}} + D L \rho_ {t} U _ {t} + \frac {2 \beta_ {t} ^ {2} \| \boldsymbol {\Sigma} _ {t} ^ {\frac {1}{2}} \| _ {\mathrm {F}} (d + 4) \varepsilon^ {2}}{3}\right) \\ \left. + \frac {L _ {F} ^ {2} \left(1 + 2 \rho r ^ {\prime}\right) (d + 4) ^ {2} \beta_ {t} ^ {2} \left\| \boldsymbol {\Sigma} _ {t} ^ {\frac {1}{2}} \right\| _ {\mathrm {F}}}{6 \xi \left(\sum_ {k = 1} ^ {t} \beta_ {k}\right)}\right) \tag {111} \\ \end{array} +$$ + +$$ +\begin{array}{l} \leq \| \boldsymbol {\Sigma} _ {0} ^ {- 1} \| _ {\mathrm {F}} D ^ {2} + \sum_ {t = 0} ^ {T - 1} \left(\frac {2 H \beta_ {t} ^ {2} \sqrt {d}}{2 \xi \sum_ {k = 1} ^ {t} \beta_ {k}} + D L \rho_ {t} U _ {t} + \frac {2 \beta_ {t} ^ {2} (d + 4) d ^ {\frac {1}{4}} \varepsilon^ {2}}{3 (2 \xi \sum_ {k = 1} ^ {t} \beta_ {k}) ^ {\frac {1}{2}}} \right. \\ \left. + \frac {L _ {F} ^ {2} \left(1 + 2 \rho r ^ {\prime}\right) (d + 4) ^ {2} \beta_ {t} ^ {2} R ^ {\frac {1}{2}}}{6 \xi \left(\sum_ {k = 1} ^ {t} \beta_ {k}\right)}\right), \tag {112} \\ \end{array} +$$ + +where the first inequality is due to Eq. (103) and Eq. (109), the second inequality is due to Lemma C.3 (b) and Lemma C.8, and the third inequality is due to $\| \pmb{\Sigma}_t^{\frac{1}{2}}\|_{\mathrm{F}}\leq R^{\frac{1}{2}}$ and Lemma C.3 (b). According to C.3 (b), we have $U_{t}\leq \max \left(\frac{2\sqrt{2}d^{\frac{1}{4}}}{(2\xi\sum_{k = 1}^{t}\beta_{k})^{\frac{1}{2}}},\frac{4r\sqrt{d}}{2\xi\sum_{k = 1}^{t}\beta_{k}}\right)$ . Therefore, there exists a constant $t^*$ when $t > t^{*} - 1$ , $U_{t}\leq \frac{2\sqrt{2}d^{\frac{1}{4}}}{(2\xi\sum_{k = 1}^{t}\beta_{k})^{\frac{1}{2}}}$ . Denote $\sum_{t = 0}^{t^{*} - 1}\frac{4r\rho_t\sqrt{d}}{2\xi\sum_{k = 1}^{t}\beta_k}$ by a constant $\Gamma$ . Then if $T > t^{*}$ we have + +$$ +\begin{array}{l} \frac {1}{T} \sum_ {t = 0} ^ {T - 1} \mathbb {E} \left[ B _ {t} \right] \leq \frac {\left\| \boldsymbol {\Sigma} _ {0} ^ {- 1} \right\| _ {\mathrm {F}} D ^ {2}}{T \beta_ {t}} + \frac {1}{T} \sum_ {t = 0} ^ {T - 1} \left(\frac {2 H \beta_ {t} \sqrt {d}}{2 \xi \sum_ {k = 1} ^ {t} \beta_ {k}} + \frac {L _ {F} ^ {2} R ^ {\frac {1}{2}} (1 + 2 \rho r ^ {\prime}) (d + 4) ^ {2} \beta_ {t}}{6 \xi \sum_ {k = 1} ^ {t} \beta_ {k}}\right) \tag {113} \\ + \frac {1}{T} \sum_ {t = t *} ^ {T - 1} \left(\frac {2 \sqrt {2} D L \rho_ {t} d ^ {\frac {1}{4}}}{\beta_ {t} (2 \xi \sum_ {k = 1} ^ {t} \beta_ {k}) ^ {\frac {1}{2}}}\right) + \frac {1}{T} \sum_ {t = 0} ^ {T - 1} \left(\frac {2 \beta_ {t} (d + 4) d ^ {\frac {1}{4}} \varepsilon^ {2}}{3 (2 \xi \sum_ {k = 1} ^ {t} \beta_ {k}) ^ {\frac {1}{2}}}\right) + \frac {D L \Gamma}{T \beta_ {t}}, \\ \end{array} +$$ + +Let $\beta_{t} = \beta$ and $\rho_t = \rho$ , we have + +$$ +\begin{array}{l} \frac {1}{T} \sum_ {t = 0} ^ {T - 1} \mathbb {E} [ B _ {t} ] \leq \frac {\left\| \boldsymbol {\Sigma} _ {0} ^ {- 1} \right\| _ {\mathrm {F}} D ^ {2}}{T \beta} + \frac {1}{T} \sum_ {t = 0} ^ {T - 1} \left(\frac {2 H \sqrt {d}}{2 \xi t} + \frac {L _ {F} ^ {2} R ^ {\frac {1}{2}} (1 + 2 \rho r ^ {\prime}) (d + 4) ^ {2}}{6 \xi t}\right) \tag {114} \\ + \frac {1}{T} \sum_ {t = t *} ^ {T - 1} \left(\frac {2 \sqrt {2} D L \rho d ^ {\frac {1}{4}}}{\sqrt {2 \xi} \beta^ {\frac {3}{2}} \sqrt {t}}\right) + \frac {1}{T} \sum_ {t = 0} ^ {T - 1} \left(\frac {2 (d + 4) d ^ {\frac {1}{4}} \varepsilon^ {2}}{3 \sqrt {2 \xi} \sqrt {t}}\right) + \frac {D L \Gamma}{T \beta}. \\ \end{array} +$$ + +Since we have $\sum_{t=1}^{T} \frac{1}{t} \leq 1 + \log(T)$ and $\sum_{t=1}^{T} \frac{1}{\sqrt{t}} \leq 2\sqrt{T}$ , we obtain + +$$ +\frac {1}{T} \sum_ {t = 0} ^ {T - 1} \mathbb {E} [ J (\boldsymbol {\mu} _ {t + 1}, \boldsymbol {\Sigma} _ {t}) - J (\boldsymbol {\mu} ^ {*}, 0) ] = \frac {1}{T} \sum_ {t = 0} ^ {T - 1} \mathbb {E} [ B _ {t} ] = \mathcal {O} \left(\frac {1}{T} + \frac {\log T}{T} + \frac {1}{\sqrt {T}}\right), \tag {115} +$$ + +where we reach the conclusion. + +# D.5 PROOF OF THEOREM 4.8 + +Using PAC-Bayesian bound (McAllester, 1999) and following (Dziugaite & Roy, 2017), for any prior distribution $p$ and any posterior distribution $q$ that may be dependent on finite dataset $S$ , where data set $S$ with $M$ i.i.d. samples drawn from data distribution $P(X, y)$ , we have + +$$ +\forall q, \quad \mathbb {E} _ {q (\boldsymbol {x})} \left[ \mathbb {E} _ {P (X, y)} [ F (\boldsymbol {x}; (X, y)) ] \right] \leq \mathbb {E} _ {q (\boldsymbol {x})} [ F (\boldsymbol {x}; \mathcal {S}) ] + \sqrt {\frac {\operatorname {K L} (q | | p) + \log \left(\frac {M}{\kappa}\right)}{2 (M - 1)}}. \tag {116} +$$ + +Set the posterior distribution as $q = p_{\theta} \coloneqq \mathcal{N}(\pmb{\mu}, \pmb{\Sigma})$ . Denote the set $\mathcal{M}(\pmb{\theta}) = \{\delta \mid \mathrm{KL}(p_{\pmb{\theta} + \delta} \| p_{\pmb{\theta}}) + \mathrm{KL}(p_{\delta} \| p_{\pmb{\theta} + \delta}) \leq \rho^2\}$ . We can choose $p \in \mathcal{M}(\pmb{\theta})$ . Then, we know that for the prior distribution $p$ , the following inequality holds with a probability at least $1 - \kappa$ , + +$$ +\mathbb {E} _ {p \theta (\boldsymbol {x})} \left[ \mathbb {E} _ {P (X, y)} [ F (\boldsymbol {x}; (X, y)) ] \right] \leq \mathbb {E} _ {p \theta (\boldsymbol {x})} [ F (\boldsymbol {x}; \mathcal {S}) ] + \sqrt {\frac {\operatorname {K L} (p _ {\boldsymbol {\theta}} | | p) + \log \left(\frac {M}{\kappa}\right)}{2 (M - 1)}}. \tag {117} +$$ + +Note that for any density $p, q$ , we have $\mathrm{KL}(p||q) \geq 0$ . Thus, we know $\mathcal{M}(\boldsymbol{\theta}) \subset \mathcal{C}(\boldsymbol{\theta})$ . It follows that + +$$ +\begin{array}{l} \mathbb {E} _ {p _ {\boldsymbol {\theta}} (\boldsymbol {x})} \left[ \mathbb {E} _ {P (X, y)} [ F (\boldsymbol {x}; (X, y)) ] \right] \leq \mathbb {E} _ {p _ {\boldsymbol {\theta}} (\boldsymbol {x}) \in \mathcal {C} (\boldsymbol {\theta})} \left[ F (\boldsymbol {x}; \mathcal {S}) \right] + \sqrt {\frac {\operatorname {K L} \left(p _ {\boldsymbol {\theta}} \| p\right) + \log \left(\frac {M}{\kappa}\right)}{2 (M - 1)}} (118) \\ \leq \max _ {\boldsymbol {\delta} \in \mathcal {C} (\boldsymbol {\theta})} \mathbb {E} _ {p _ {\boldsymbol {\theta} + \delta}} [ F (\boldsymbol {x}; \mathcal {S}) ] + \max _ {\boldsymbol {\delta} \in \mathcal {M} (\boldsymbol {\theta})} \sqrt {\frac {\operatorname {K L} (p _ {\boldsymbol {\theta}} | | p _ {\boldsymbol {\theta} + \delta}) + \log \left(\frac {M}{\kappa}\right)}{2 (M - 1)}} (119) \\ \leq \max _ {\boldsymbol {\delta} \in \mathcal {C} (\boldsymbol {\theta})} \mathbb {E} _ {p _ {\boldsymbol {\theta} + \boldsymbol {\delta}}} [ F (\boldsymbol {x}; \mathcal {S}) ] + \sqrt {\frac {\rho^ {2} + \log \left(\frac {M}{\kappa}\right)}{2 (M - 1)}}. (120) \\ \end{array} +$$ + +Note that $F(\pmb{x}; (X, y))$ is convex function w.r.t. $\pmb{x}$ , we know that $\mathbb{E}_{P(X, y)}[F(\pmb{x}; (X, y))]$ is a convex function w.r.t. $\pmb{x}$ . It follows that + +$$ +\begin{array}{l} \mathbb {E} _ {P (X, y)} [ F (\boldsymbol {\mu}; (X, y)) ] = \mathbb {E} _ {P (X, y)} [ F (\mathbb {E} _ {p _ {\boldsymbol {\theta}} (\boldsymbol {x})} [ \boldsymbol {x} ]; (X, y)) ] (121) \\ \leq \mathbb {E} _ {p _ {\theta} (\boldsymbol {x})} \left[ \mathbb {E} _ {P (X, y)} [ F (\boldsymbol {x}; (X, y)) ] \right]. (122) \\ \end{array} +$$ + +Finally, we know that with a probability of at least $1 - \kappa$ , the following inequality holds. + +$$ +\mathbb {E} _ {P (X, y)} [ F (\boldsymbol {\mu}; \boldsymbol {z}, y) ] \leq \max _ {\boldsymbol {\delta} \in \mathcal {C} (\boldsymbol {\theta})} \mathbb {E} _ {p _ {\boldsymbol {\theta} + \boldsymbol {\delta}}} [ F (\boldsymbol {x}; \mathcal {S}) ] + \sqrt {\frac {\rho^ {2} + \log \left(\frac {M}{\kappa}\right)}{2 (M - 1)}}. \tag {123} +$$ + +# E PROOF OF TECHNICAL LEMMAS + +In this section, we provide the proof of lemmas in Appendix C. Note that Lemma C.1 and Lemma C.2 can be directly obtained by Lemma B.1. and Lemma B.2. in (Ye et al., 2024), respectively. + +# E.1 PROOF OF LEMMA C.3 + +(a): Since we have $\pmb{\Sigma}_{t + 1}^{-1} = \pmb{\Sigma}_t^{-1} + 2\beta_t\pmb{G}_t$ . We can obtain that + +$$ +\boldsymbol {\Sigma} _ {t} ^ {- 1} + 2 b \beta_ {t} \boldsymbol {I} \succeq \boldsymbol {\Sigma} _ {t + 1} ^ {- 1} \succeq \boldsymbol {\Sigma} _ {t} ^ {- 1} + 2 \xi \beta_ {t} \boldsymbol {I}. \tag {124} +$$ + +Summing up it over $t = 0,\ldots ,T - 1$ , we have + +$$ +\boldsymbol {\Sigma} _ {0} ^ {- 1} + 2 b \sum_ {t = 1} ^ {T} \beta_ {t} \boldsymbol {I} \succeq \boldsymbol {\Sigma} _ {T} ^ {- 1} \succeq \boldsymbol {\Sigma} _ {0} ^ {- 1} + 2 \xi \sum_ {t = 1} ^ {T} \beta_ {t} \boldsymbol {I}. \tag {125} +$$ + +Therefore, we have + +$$ +\frac {1}{2 b \sum_ {t = 1} ^ {T} \beta_ {t} \boldsymbol {I} + \boldsymbol {\Sigma} _ {0} ^ {- 1}} \preceq \boldsymbol {\Sigma} _ {T} \preceq \frac {1}{2 \xi \sum_ {t = 1} ^ {T} \beta_ {t} \boldsymbol {I} + \boldsymbol {\Sigma} _ {0} ^ {- 1}}. \tag {126} +$$ + +(b): We have + +$$ +\left\| \boldsymbol {\Sigma} _ {t} \right\| _ {\mathrm {F}} \leq \left\| \frac {1}{2 \xi \sum_ {k = 1} ^ {t} \beta_ {k} \boldsymbol {I} + \boldsymbol {\Sigma} _ {0} ^ {- 1}} \right\| _ {\mathrm {F}} \leq \left\| \frac {1}{2 \xi \sum_ {k = 1} ^ {t} \beta_ {k} \boldsymbol {I}} \right\| _ {\mathrm {F}} = \frac {\sqrt {d}}{2 \xi \sum_ {k = 1} ^ {t} \beta_ {k}}. \tag {127} +$$ + +# E.2 PROOF OF LEMMA C.4 + +In Algorithm 1 and Algorithm 2, for given $\theta_t$ , the perturbation $\delta_t$ satisfies + +$$ +\delta_ {\mu_ {t}} = \frac {1}{\lambda} \boldsymbol {\Sigma} _ {t} \boldsymbol {g} _ {t} ^ {\prime} = \frac {\rho \boldsymbol {\Sigma} _ {t} \boldsymbol {g} _ {t} ^ {\prime}}{\sqrt {\left\| \boldsymbol {\Sigma} _ {t} \boldsymbol {G} _ {t} ^ {\prime} \right\| _ {\mathrm {F}} ^ {2} + 0 . 5 \left\| \boldsymbol {\Sigma} _ {t} ^ {\frac {1}{2}} \boldsymbol {g} _ {t} ^ {\prime} \right\| _ {2} ^ {2}}} \leq \frac {\rho \sqrt {2} \boldsymbol {\Sigma} _ {t} ^ {\frac {1}{2}} \boldsymbol {\Sigma} _ {t} ^ {\frac {1}{2}} \boldsymbol {g} _ {t} ^ {\prime}}{\sqrt {\left\| \boldsymbol {\Sigma} _ {t} ^ {\frac {1}{2}} \boldsymbol {g} _ {t} ^ {\prime} \right\| _ {2} ^ {2}}}. \tag {128} +$$ + +Therefore, we have $\| \delta_{\pmb{\mu}_t}\| \leq \rho \sqrt{2}\| \pmb{\Sigma}_t^{\frac{1}{2}}\| _F$ . For $\delta_{\Sigma_t}$ , we have + +$$ +\boldsymbol {\delta} _ {\boldsymbol {\Sigma} _ {t}} = \frac {2 \boldsymbol {\Sigma} _ {t} \boldsymbol {G} _ {t} ^ {\prime}}{\lambda \boldsymbol {\Sigma} _ {t} ^ {- 1} - 2 \boldsymbol {G} _ {t} ^ {\prime}} = \boldsymbol {\Sigma} _ {t} \frac {\frac {2}{\lambda} \boldsymbol {\Sigma} _ {t} \boldsymbol {G} _ {t} ^ {\prime}}{\boldsymbol {I} - \frac {2}{\lambda} \boldsymbol {\Sigma} _ {t} \boldsymbol {G} _ {t} ^ {\prime}}. \tag {129} +$$ + +Note that $\frac{2}{\lambda} \leq \frac{2\rho}{\|\Sigma G_t'\|_F}$ . Therefore, we can obtain that + +$$ +\left\| \boldsymbol {\delta} _ {\boldsymbol {\Sigma} _ {t}} \right\| _ {\mathrm {F}} \leq \left\| \boldsymbol {\Sigma} _ {t} \right\| _ {\mathrm {F}} \frac {2 \rho}{\left\| \boldsymbol {I} - \frac {2}{\lambda} \boldsymbol {\Sigma} _ {t} \boldsymbol {G} _ {t} ^ {\prime} \right\| _ {\mathrm {F}}}. \tag {130} +$$ + +If $\rho < \frac{\sqrt{d}}{2}$ , there exist a constant $r > 0$ , $\|I - \frac{2}{\lambda} \boldsymbol{\Sigma}_t \boldsymbol{G}_t' \|_{\mathrm{F}} > \frac{1}{r}$ holds. Therefore we have $\|\delta_{\boldsymbol{\Sigma}_t}\|_{\mathrm{F}} \leq 2 \rho r \| \boldsymbol{\Sigma}_t\|_{\mathrm{F}}$ . + +# E.3 PROOF OF LEMMA C.5 + +We have + +$$ +\begin{array}{l} \mathbb {E} _ {\boldsymbol {z}} \left[ \boldsymbol {g} _ {t} ^ {\prime} \right] = \mathbb {E} _ {\boldsymbol {z}} \left[ \boldsymbol {\Sigma} _ {t} ^ {- \frac {1}{2}} \boldsymbol {z} F \left(\boldsymbol {\mu} _ {t} + \boldsymbol {\Sigma} _ {t} ^ {\frac {1}{2}} \boldsymbol {z}\right) \right] - \mathbb {E} _ {\boldsymbol {z}} \left[ \boldsymbol {\Sigma} _ {t} ^ {- \frac {1}{2}} \boldsymbol {z} F \left(\boldsymbol {\mu} _ {t}\right) \right] (131) \\ = \mathbb {E} _ {\boldsymbol {z}} \left[ \boldsymbol {\Sigma} _ {t} ^ {- \frac {1}{2}} \boldsymbol {z} F \left(\boldsymbol {\mu} _ {t} + \boldsymbol {\Sigma} _ {t} ^ {\frac {1}{2}} \boldsymbol {z}\right) \right] (132) \\ = \mathbb {E} _ {\boldsymbol {x} \sim \mathcal {N} \left(\boldsymbol {\mu} _ {t}, \boldsymbol {\Sigma} _ {t}\right)} \left[ \boldsymbol {\Sigma} _ {t} ^ {- 1} (\boldsymbol {x} - \boldsymbol {\mu} _ {t}) F (\boldsymbol {x}) \right] (133) \\ = \nabla_ {\boldsymbol {\mu}} \mathbb {E} _ {p \boldsymbol {\theta} _ {t}} [ F (\boldsymbol {x}) ], (134) \\ \end{array} +$$ + +where we reach the conclusion. + +# E.4 PROOF OF LEMMA C.6 + +Denote the diagonal elements of $\pmb{\Sigma}$ and $\widehat{\pmb{\Sigma}}$ by $\sigma$ and $\widehat{\sigma}$ , respectively. Then we have + +$$ +\left\| \boldsymbol {\Sigma} _ {t} ^ {\frac {1}{2}} \boldsymbol {g} _ {t, j} \right\| ^ {2} = \left\| \boldsymbol {\sigma} _ {t} ^ {\frac {1}{2}} \odot \widehat {\boldsymbol {\sigma}} _ {t} ^ {- \frac {1}{2}} \odot \boldsymbol {z} _ {j} \left(F \left(\widehat {\boldsymbol {\mu}} _ {t} + \widehat {\boldsymbol {\sigma}} _ {t} ^ {\frac {1}{2}} \odot \boldsymbol {z} _ {j}\right) - F \left(\widehat {\boldsymbol {\mu}} _ {t}\right)\right) \right\| ^ {2}. \tag {135} +$$ + +Note that $\widehat{\pmb{\Sigma}}_{t + 1}^{-1} = \pmb{\Sigma}_t^{-1} - 2\lambda \pmb{G}_t'$ , we have $\sigma_t\leq \widehat{\sigma}_t$ . Since we have + +$$ +\mathbb {E} \| \boldsymbol {\Sigma} _ {t} ^ {\frac {1}{2}} \boldsymbol {g} _ {t} \| _ {2} ^ {2} = \mathbb {E} \left\| \frac {1}{N} \sum_ {j = 1} ^ {N} \boldsymbol {\Sigma} _ {t} ^ {\frac {1}{2}} \boldsymbol {g} _ {t, j} \right\| ^ {2} \leq \frac {1}{N} \sum_ {j = 1} ^ {N} \| \boldsymbol {\Sigma} _ {t} ^ {\frac {1}{2}} \boldsymbol {g} _ {t, j} \| ^ {2}. \tag {136} +$$ + +It follows that + +$$ +\begin{array}{l} \mathbb {E} \| \boldsymbol {\Sigma} _ {t} ^ {\frac {1}{2}} \boldsymbol {g} _ {t} \| _ {2} ^ {2} \leq \frac {1}{N} \sum_ {j = 1} ^ {N} \mathbb {E} \| \widehat {\boldsymbol {\sigma}} _ {t} ^ {\frac {1}{2}} \odot \widehat {\boldsymbol {\sigma}} _ {t} ^ {- \frac {1}{2}} \odot \boldsymbol {z} _ {j} \left(F \left(\widehat {\boldsymbol {\mu}} _ {t} + \widehat {\boldsymbol {\sigma}} _ {t} ^ {\frac {1}{2}} \odot \boldsymbol {z} _ {j}\right) - F \left(\widehat {\boldsymbol {\mu}} _ {t}\right)\right) \| ^ {2} (137) \\ \leq \frac {1}{N} \sum_ {j = 1} ^ {N} \mathbb {E} \left[ \| \boldsymbol {z} _ {j} \| ^ {2} \left(F \left(\widehat {\boldsymbol {\mu}} _ {t} + \widehat {\boldsymbol {\sigma}} _ {t} ^ {\frac {1}{2}} \odot \boldsymbol {z} _ {j}\right) - F \left(\widehat {\boldsymbol {\mu}} _ {t}\right)\right) ^ {2} \right] (138) \\ \leq \frac {1}{N} \sum_ {j = 1} ^ {N} \mathbb {E} \left[ L _ {F} ^ {2} \| \boldsymbol {z} _ {j} \| ^ {4} \| \widehat {\boldsymbol {\sigma}} _ {t} \| _ {\infty} \right]. (139) \\ \end{array} +$$ + +Note that + +$$ +\widehat {\boldsymbol {\Sigma}} _ {t} = \boldsymbol {\Sigma} _ {t} + \delta_ {\boldsymbol {\Sigma} _ {t}} = \boldsymbol {\Sigma} _ {t} + \boldsymbol {\Sigma} _ {t} \frac {\frac {2}{\lambda} \boldsymbol {\Sigma} _ {t} \boldsymbol {G} _ {t} ^ {\prime}}{\boldsymbol {I} - \frac {2}{\lambda} \boldsymbol {\Sigma} _ {t} \boldsymbol {G} _ {t} ^ {\prime}}. \tag {140} +$$ + +Note that $\frac{2}{\lambda} \leq \frac{2\rho}{\|\pmb{\Sigma}\pmb{G}_t'\|_{\mathrm{F}}}$ . Then if $\rho < \frac{\sqrt{d}}{2}$ , there exist a constant $r' > 0$ , the inequality $\widehat{\sigma}_t \leq \sigma_t + 2\rho r'\sigma_t$ holds. Therefore, we have + +$$ +\left\| \widehat {\boldsymbol {\sigma}} _ {t} \right\| _ {\infty} \leq \left(1 + 2 \rho r ^ {\prime}\right) \left\| \boldsymbol {\sigma} _ {t} \right\| _ {\infty} \leq \frac {1 + 2 \rho r ^ {\prime}}{\left\| \boldsymbol {\sigma} _ {0} ^ {- 1} \right\| _ {\min } + 2 \left(\sum_ {k = 1} ^ {t} \beta_ {k}\right) \xi}, \tag {141} +$$ + +where $\| \cdot \|_{min}$ denotes the minimum element in the input. Noticed that $\mathbb{E}_z[\| z\|^2] \leq d + 4$ as shown in (Nesterov & Spokoiny, 2017), we obtain + +$$ +\mathbb {E} \| \boldsymbol {\Sigma} _ {t} ^ {\frac {1}{2}} \boldsymbol {g} _ {t} \| _ {2} ^ {2} \leq \frac {L _ {F} ^ {2} (1 + 2 \rho r ^ {\prime}) (d + 4) ^ {2}}{2 \xi \left(\sum_ {k = 1} ^ {t} \beta_ {k}\right)}, \tag {142} +$$ + +where we reach the conclusion. + +# E.5 PROOF OF LEMMA C.7 + +We have + +$$ +\begin{array}{l} \mathbb {E} \left[ \boldsymbol {g} _ {t} ^ {\prime} \right] = \mathbb {E} \left[ \boldsymbol {\Sigma} _ {t} ^ {- \frac {1}{2}} z F \left(\boldsymbol {\mu} _ {t} + \boldsymbol {\Sigma} _ {t} ^ {\frac {1}{2}} z; \mathcal {B}\right) \right] - \mathbb {E} \left[ \boldsymbol {\Sigma} _ {t} ^ {- \frac {1}{2}} z F \left(\boldsymbol {\mu} _ {t}; \mathcal {B}\right) \right] (143) \\ = \mathbb {E} _ {\boldsymbol {z}} \left[ \boldsymbol {\Sigma} _ {t} ^ {- \frac {1}{2}} \boldsymbol {z} F \left(\boldsymbol {\mu} _ {t} + \boldsymbol {\Sigma} _ {t} ^ {\frac {1}{2}} \boldsymbol {z}; \mathcal {D}\right) \right] - \mathbb {E} _ {\boldsymbol {z}} \left[ \boldsymbol {\Sigma} _ {t} ^ {- \frac {1}{2}} \boldsymbol {z} F \left(\boldsymbol {\mu} _ {t}; \mathcal {D}\right) \right] (144) \\ = \mathbb {E} _ {\boldsymbol {z}} \left[ \boldsymbol {\Sigma} _ {t} ^ {- \frac {1}{2}} \boldsymbol {z} F \left(\boldsymbol {\mu} _ {t} + \boldsymbol {\Sigma} _ {t} ^ {\frac {1}{2}} \boldsymbol {z}\right) \right] (145) \\ = \mathbb {E} _ {\boldsymbol {x} \sim \mathcal {N} \left(\boldsymbol {\mu} _ {t}, \boldsymbol {\Sigma} _ {t}\right)} \left[ \boldsymbol {\Sigma} _ {t} ^ {- 1} (\boldsymbol {x} - \boldsymbol {\mu} _ {t}) F (\boldsymbol {x}) \right] (146) \\ = \nabla_ {\boldsymbol {\mu}} \mathbb {E} _ {p \boldsymbol {\theta} _ {t}} [ F (\boldsymbol {x}) ], (147) \\ \end{array} +$$ + +where the second equality is due to Proposition 4.5. + +# E.6 PROOF OF LEMMA C.8 + +Denote the diagonal elements of $\pmb{\Sigma}$ and $\widehat{\pmb{\Sigma}}$ by $\sigma$ and $\widehat{\sigma}$ , respectively. Then we have + +$$ +\left\| \boldsymbol {\Sigma} _ {t} ^ {\frac {1}{2}} \boldsymbol {g} _ {t, j} \right\| ^ {2} = \left\| \boldsymbol {\sigma} _ {t} ^ {\frac {1}{2}} \odot \widehat {\boldsymbol {\sigma}} _ {t} ^ {- \frac {1}{2}} \odot \boldsymbol {z} _ {j} \left(F \left(\widehat {\boldsymbol {\mu}} _ {t} + \widehat {\boldsymbol {\sigma}} _ {t} ^ {\frac {1}{2}} \odot \boldsymbol {z} _ {j}; \mathcal {B}\right) - F \left(\widehat {\boldsymbol {\mu}} _ {t}\right); \mathcal {B}\right) \right\| ^ {2} \tag {148} +$$ + +Note that $\widehat{\pmb{\Sigma}}_{t + 1}^{-1} = \pmb{\Sigma}_{t}^{-1} - 2\lambda \pmb{G}_{t}^{\prime}$ , we have $\sigma_t\leq \widehat{\sigma}_t$ . Since we have + +$$ +\mathbb {E} \| \boldsymbol {\Sigma} _ {t} ^ {\frac {1}{2}} \boldsymbol {g} _ {t} \| _ {2} ^ {2} = \mathbb {E} \left\| \frac {1}{N} \sum_ {j = 1} ^ {N} \boldsymbol {\Sigma} _ {t} ^ {\frac {1}{2}} \boldsymbol {g} _ {t, j} \right\| ^ {2} \leq \frac {1}{N} \sum_ {j = 1} ^ {N} \| \boldsymbol {\Sigma} _ {t} ^ {\frac {1}{2}} \boldsymbol {g} _ {t, j} \| ^ {2}. \tag {149} +$$ + +It follows that + +$$ +\begin{array}{l} \mathbb {E} \| \boldsymbol {\Sigma} _ {t} ^ {\frac {1}{2}} \boldsymbol {g} _ {t} \| _ {2} ^ {2} \leq \frac {1}{N} \sum_ {j = 1} ^ {N} \mathbb {E} \| \widehat {\boldsymbol {\sigma}} _ {t} ^ {\frac {1}{2}} \odot \widehat {\boldsymbol {\sigma}} _ {t} ^ {- \frac {1}{2}} \odot z _ {j} \left(F \left(\widehat {\boldsymbol {\mu}} _ {t} + \widehat {\boldsymbol {\sigma}} _ {t} ^ {\frac {1}{2}} \odot z _ {j}; \mathcal {B}\right) - F \left(\widehat {\boldsymbol {\mu}} _ {t}; \mathcal {B}\right)\right) \| ^ {2} (150) \\ \leq \frac {1}{N} \sum_ {j = 1} ^ {N} \mathbb {E} \left[ \| z _ {j} \| ^ {2} \left(F \left(\widehat {\boldsymbol {\mu}} _ {t} + \widehat {\boldsymbol {\sigma}} _ {t} ^ {\frac {1}{2}} \odot \boldsymbol {z} _ {j}; \mathcal {B}\right) - F \left(\widehat {\boldsymbol {\mu}} _ {t}; \mathcal {B}\right)\right) ^ {2} \right] (151) \\ \leq \frac {1}{N} \sum_ {j = 1} ^ {N} \mathbb {E} \left[ \| \boldsymbol {z} _ {j} \| ^ {2} \left(\frac {1}{3} L _ {F} ^ {2} \| \widehat {\boldsymbol {\sigma}} _ {t} ^ {\frac {1}{2}} \odot \boldsymbol {z} _ {j} \| ^ {2} + \frac {2}{3} \varepsilon^ {2}\right) \right], (152) \\ \end{array} +$$ + +where the third inequality is due to Proposition 4.5. Since $\widehat{\pmb{\Sigma}}_t = \pmb {\Sigma}_t + \pmb {\Sigma}_t\frac{2}{I - \frac{2}{\lambda}\pmb {\Sigma}_t\pmb {G}_t'}$ , and $\frac{2}{\lambda}\leq \frac{2\rho}{\|\pmb{\Sigma}\pmb{G}_t'\|_{\mathrm{F}}}$ Then if $\rho < \frac{\sqrt{d}}{2}$ , there exist a constant $r^\prime >0$ , the inequality $\widehat{\sigma}_t\leq \sigma_t + 2\rho r'\sigma_t$ holds. Therefore, we have + +$$ +\left\| \widehat {\boldsymbol {\sigma}} _ {t} \right\| _ {\infty} \leq \left(1 + 2 \rho r ^ {\prime}\right) \left\| \boldsymbol {\sigma} _ {t} \right\| _ {\infty} \leq \frac {1 + 2 \rho r ^ {\prime}}{\left\| \boldsymbol {\sigma} _ {0} ^ {- 1} \right\| _ {\min } + 2 \left(\sum_ {k = 1} ^ {t} \beta_ {k}\right) \xi}, \tag {153} +$$ + +where $\| \cdot \|_{min}$ denotes the minimum element in the input. Noticed that $\mathbb{E}_z[\| z\|^2] \leq d + 4$ as shown in (Nesterov & Spokoiny, 2017), we obtain + +$$ +\begin{array}{l} \mathbb {E} \| \boldsymbol {\Sigma} _ {t} ^ {\frac {1}{2}} \boldsymbol {g} _ {t} \| _ {2} ^ {2} \leq \frac {1}{N} \sum_ {j = 1} ^ {N} \mathbb {E} \left[ \frac {(1 + 2 \rho r ^ {\prime}) L _ {F} ^ {2}}{3} \| \boldsymbol {\sigma} _ {t} \| _ {\infty} \times \| \boldsymbol {z} _ {j} \| ^ {4} + \frac {2 \varepsilon^ {2}}{3} \| \boldsymbol {z} _ {j} \| ^ {2} \right] (154) \\ \leq \frac {L _ {F} ^ {2} \left(1 + 2 \rho r ^ {\prime}\right) (d + 4) ^ {2}}{6 \xi \left(\sum_ {k = 1} ^ {t} \beta_ {k}\right)} + \frac {2 (d + 4) \varepsilon^ {2}}{3}, (155) \\ \end{array} +$$ + +where we reach the conclusion. + +# F UPDATED RULE UNDER TRANSFORMATION + +To avoid the scaling problem, we can employ monotonic transformation for the objective $F(\pmb{x})$ , i.e. $h(F(\pmb{x}_j)) = \frac{F(\pmb{x}_j) - \hat{\pmb{\mu}}}{\hat{\pmb{\sigma}}}$ , where $\hat{\pmb{\mu}}$ and $\hat{\pmb{\sigma}}$ denote mean and stand deviation of function values $F(\pmb{x}_j)$ , $j = 1, \dots, N$ . Then by applying this rescaling strategy, the update rule for $\pmb{\mu}_t$ and $\pmb{\Sigma}_t$ in $t$ -th iteration can be written as + +$$ +\boldsymbol {\mu} _ {t + 1} = \boldsymbol {\mu} _ {t} - \frac {\beta_ {t}}{N} \sum_ {j = 1} ^ {N} \boldsymbol {\Sigma} _ {t} \widehat {\boldsymbol {\Sigma}} _ {t} ^ {- 1} \left(\boldsymbol {x} _ {j} - \widehat {\boldsymbol {\mu}} _ {t}\right) \frac {F \left(\boldsymbol {x} _ {j}\right) - \widehat {\boldsymbol {\mu}} ^ {t}}{\widehat {\boldsymbol {\sigma}} ^ {t}}, \tag {156} +$$ + +$$ +\boldsymbol {\Sigma} _ {t + 1} ^ {- 1} = \boldsymbol {\Sigma} _ {t} ^ {- 1} + \frac {\beta_ {t}}{N} \sum_ {j = 1} ^ {N} \operatorname {d i a g} \left[ \widehat {\boldsymbol {\Sigma}} _ {t} ^ {- 1} \left[ \operatorname {d i a g} \left((\boldsymbol {x} _ {j} - \widehat {\boldsymbol {\mu}} _ {t}) (\boldsymbol {x} _ {j} - \widehat {\boldsymbol {\mu}} _ {t}) ^ {\top} \widehat {\boldsymbol {\Sigma}} _ {t} ^ {- 1}\right) \frac {F (\boldsymbol {x} _ {j}) - \widehat {\boldsymbol {\mu}} ^ {t}}{\widehat {\boldsymbol {\sigma}} ^ {t}} \right] \right], \tag {157} +$$ + +where $\widehat{\Sigma}_t = \Sigma_t + \delta_{\Sigma_t}, \widehat{\mu}_t = \mu_t + \delta_{\mu_t}$ , and $x_j$ denotes the $j$ -th sample sampled from the distribution $\mathcal{N}(\boldsymbol{x} \mid \widehat{\mu}_t, \widehat{\Sigma}_t)$ . + +# G ADDITIONAL MATERIALS FOR SECTION 6 + +In this section, we provide additional experiments and more implementation details of Section 6. + +# G.1 SYNTHETIC PROBLEMS + +The four numerical benchmark test functions employed in Section 6.1 are listed as follows: + +$$ +F (\boldsymbol {x}) = \sum_ {i = 1} ^ {d} 1 0 ^ {\frac {2 (i - 1)}{d - 1}} \boldsymbol {x} _ {i} ^ {2}, \tag {158} +$$ + +$$ +F (\boldsymbol {x}) = \sum_ {i = 1} ^ {d} 1 0 ^ {\frac {2 (i - 1)}{d - 1}} | \boldsymbol {x} _ {i} | ^ {\frac {1}{2}}, \tag {159} +$$ + +$$ +F (\boldsymbol {x}) = \sqrt {\sum_ {i = 1} ^ {d} \left| x _ {i} \right| ^ {2 + 4 \frac {i - 1}{d - 1}}}, \tag {160} +$$ + +$$ +F (\boldsymbol {x}) = \sin^ {2} \left(\pi \omega_ {1}\right) + \sum_ {i = 1} ^ {d - 1} \left(\omega_ {i} - 1\right) ^ {2} \left(1 + 1 0 \sin^ {2} \left(\omega_ {i} \pi + 1\right)\right) + \left(\omega_ {d} - 1\right) ^ {2} \left(1 + \sin^ {2} \left(2 \pi \omega_ {d}\right)\right), \tag {161} +$$ + +$$ +\text {w h e r e} \omega_ {i} = 1 + \frac {x _ {i} - 1}{4}, i \in \{1, \dots , d \}. +$$ + +Test functions (158)-(161) are called the ellipsoid function, $l_{\frac{1}{2}}$ -ellipsoid function, different powers function and Levy function, respectively. + +Implementation Details. For all the methods, we initialize $\mu_0$ from the uniform distribution $\mathrm{Uni}[0,1]$ , and set $\Sigma_0 = I$ . For the INGO, BES, and SABO methods, we use a fixed step size of $\beta = 0.1$ . According to our assumption in Theorem 4.3, we set $\rho = 100 / \sqrt{T + 1}$ for the proposed SABO method. We set the spacing $c = 1$ for the BES method and employ the default hyperparameter setting from He et al. (2020) for the MMES method. We then assess these methods using varying dimensions, i.e., $d \in \{200,500,1000\}$ . For $d = 200$ , we assess these methods using varying sample sizes, i.e., $N \in \{10,50,100\}$ . The mean value of $\mathcal{E}$ over 3 independent runs is reported. + +Results. Figure 2 and 3 show the results on four test functions with problem dimensions $d = 200$ and $d = 1000$ , respectively. Figure 4 and 5 show the results on 200-dimensional test functions with sample size $N = 10$ and $N = 100$ , respectively. Combining these results with the result from Figure 1, we observe consistent performance for the proposed ASBO method. It achieves a similar convergence result to the INGO method, as they have the same theoretical convergent rate. In some cases, i.e., Figure 3 (d) and Figure 4 (d), it converges slightly faster than INGO. The CMA-ES method and MMES method both work for ellipsoid and different powers functions, but fail in $l_{\frac{1}{2}}$ -ellipsoid and Levy functions. In most cases, they converge slower than INGO and SABO. With a large sample size, i.e., $N = 100$ , the CMA-ES method can maintain a fast converge rate according to Figure 4 (a). The BES method fails to achieve high precision in all test functions. It diverges in ellipsoid, $l_{\frac{1}{2}}$ -ellipsoid, Levy functions, and only achieves a low precision in the different power functions. These results demonstrate the superiority of the SABO method in optimizing high-dimensional problems, and verify our theoretical convergence results in Section 4. + +![](images/35bf1f7df94cabba827fe69e03f284885ba19bd1cbc94da1479897fd40983ee8.jpg) +(a) Ellipsoid. + +![](images/0f976de51244b9db356ab7a7168958766a1b2c207c52a6f8772bd7fca5166128.jpg) +(b) $l_{\frac{1}{2}}$ Ellipsoid. + +![](images/0b29a9438c8f6c08deb987b3eec5a94dff985dc7547f1d90c653f978cb3aced3.jpg) +(c) Different Powers. +Figure 2: Results on the four test functions with problem dimension $d = 200$ and $N = 50$ . + +![](images/143ee2caa6150bc17801b7a323f072a59cdce61cc282e050fc1986fa379c7c89.jpg) +(d) Levy. + +![](images/e2df5fbdb428bc93e853e6bb909281031f167b333ec8e038124b323858147e1f.jpg) +(a) Ellipsoid. + +![](images/4914273c68f8897aecb604079eb1b97ea5f3a99ff441b203a7b5c9fc3ff3fc18.jpg) +(b) $l_{\frac{1}{2}}$ Ellipsoid. + +![](images/772f121dd4049dcd40f184c3a9fd6ba833cdb36d80ecf7d59354f3e8a972c4f9.jpg) +(c) Different Powers. + +![](images/a331b194acb72be91d0e64e6bd2c798017c293ad02f0b540a176a617899b87d5.jpg) +(d) Levy. + +![](images/3be366659097775ac413d56ba6fa0d4f40e40260fd769985362e999875f8aaf5.jpg) +Figure 3: Results on the four test functions with problem dimension $d = 1000$ and $N = 50$ . +(a) Ellipsoid. + +![](images/f40ddd1d859c81c74d43ad60ebaa48c87f979a27599253e7949d09d31caf8c82.jpg) +(b) $l_{\frac{1}{2}}$ Ellipsoid. + +![](images/a40812b410be5f1c1bb6b46588ff561a45b889021dd9222c0e2cea1df18413cd.jpg) +(c) Different Powers. + +![](images/e7dc5bd02ee50ff983933d4c45baf08102fbeed42b0708c6fc5589ca3bcd15db.jpg) +(d) Levy. + +![](images/288875e8685cdf8d21cbaa67243793fda7b35f0d3fc5d1572ab91bd38d2b25d2.jpg) +Figure 4: Results on the four test functions with problem dimension $d = 200$ and $N = 10$ . +(a) Ellipsoid. +Figure 5: Results on the four test functions with problem dimension $d = 200$ and $N = 100$ . + +![](images/73e4070e97bba57404d50f7ba536c848c5b9671b5fbb165d7317decb68f47ca1.jpg) +(b) $l_{\frac{1}{2}}$ Ellipsoid. + +![](images/a355131a1b65ab57ccc8342c071c7ff7be061e85bfdfa8be7ee09424988ef71d.jpg) +(c) Different Powers. + +![](images/408432500699b53dd2e366fab5299dbb123fd1aaf875dce9f2d90237ea2976fa.jpg) +(d)Levy. + +# H ADDITIONAL RESULTS ON SYNTHETIC PROBLEMS + +We conduct additional experiments to compare the proposed SABO method and GFM method Lin et al. (2022). For GFM, we employ its default hyperparameter setting from Lin et al. (2022). We set its smoothing parameter $\delta = 0.2$ and conduct experiments on the step-size over $\{0.001, 0.0005, 0.0001\}$ . The initial point is set the same as SABO. + +The results are shown in Figure 6 with problem dimension $d = 200$ and $N = 50$ . The GFM method can converge slowly for the Ellipsoid problem. It fails in the $l_{\frac{1}{2}}$ -Ellipsoid problem and cannot achieve high precision for Different Powers and Levy problem. This shows that it could be challenging for GFM to optimize non-smooth or high-dimensional test functions without adaptively updating mean and covariance. The proposed SABO method takes advantage of the second-order information, which gains great acceleration for solving these problems. + +Table 2: Performance (%) on SST-2, AG's News, MRPC, RTE, SNLI, and Yelp P. datasets. We report the mean and standard deviation over 3 random seeds. The best result across all groups is highlighted in bold and the best result in each group is marked with underlined. + +
MethodsSST-2AG's NewsMRPCRTESNLIYelp P.
Zero-shot79.8276.9667.4051.6238.8289.64
Dimension d = 200
GIBO83.53±0.1575.79±0.0879.21±0.0953.07±0.2938.73±0.0989.63±0.03
TurBo83.30±0.1979.01±1.6869.59±8.5146.57±2.3040.27±0.6990.16±0.19
SABO87.88±0.5382.22±0.4179.35±0.1253.67±0.1740.72±0.1591.50±0.13
Dimension d = 500
GIBO83.49±0.0975.70±0.0579.03±0.0852.95±0.1738.71±0.1689.65±0.02
TurBo84.52±0.6580.03±1.9775.30±2.3448.01±0.5938.82±0.3490.20±0.45
SABO87.31±0.3882.65±0.5979.62±0.0753.55±0.1742.29±2.4891.83±0.16
Dimension d = 1000
GIBO83.45±0.1175.67±0.1079.15±0.052.95±0.1738.87±0.1889.65±0.04
TurBo85.90±0.9582.36±0.2177.30±0.8650.30±1.1139.87±1.0790.14±0.20
SABO87.96±0.8382.77±0.4179.68±0.2353.31±0.1740.32±0.2791.96±0.41
+ +![](images/61cc6414a5aeadd81007fd1568085a5a24343963ceafa3b6fa977870202ee199.jpg) +(a) Ellipsoid. + +![](images/7db032c7d49e45f7aac17f0a884e721e18d54ee217062060d55c0e3130a5250c.jpg) +(b) $l_{\frac{1}{2}}$ Ellipsoid. + +![](images/7d229445d5d937179540e23e45bc8b844a9f85a8103574daccf86d36b29ca490.jpg) +(c) Different Powers. +Figure 6: Results on the four test functions with problem dimension $d = 200$ and $N = 50$ . + +![](images/eeb7ebc7da9df144f82b7b49684b7c84da361b844713fff73146a9d98e6b9a45.jpg) +(d) Levy. + +# H.1 ADDITIONAL RESULTS ON BLACK-BOX PROMPT FINE-TUNING + +We conduct an additional experiment on the black-box prompt fine-tuning task to compare the proposed SABO method with high-dimensional BO methods, i.e., TuRBO (Eriksson et al., 2019) and GIBO (Nguyen et al., 2022) methods discussed in Section 5. We employ the default setting of TuRBO-1 from He et al. (2020) for the TuRBO method, and the default setting from Nguyen et al. (2022) for the GIBO method. The results on six benchmark datasets are reported in Table 2. According to the results, the SABO method consistently outperforms these two baselines, highlighting its effectiveness. + +# H.2 SYNTHETIC IMAGE CLASSIFICATION PROBLEM + +We conduct experiments on a synthetic image classification problem to empirically evaluate the performance of the proposed mini-batch SABO method. Specifically, we apply black-box optimization methods to train a model to classify the images accurately. Moreover, following Foret et al. (2021), we conduct additional experiments on the noisy label setting. Particularly, we train the model on a corrupted version of the Fashion-MNIST dataset, where some of its training labels are randomly flipped according to different noise rates, while the testing set is clean. To construct problems with different dimensions, we first adopt UMAP (McInnes et al., 2018) to reduce the dimension of Fashion-MNIST to 8 while preserving the class discriminability (Sagawa & Hino, 2022), and then employ a fixed randomly initialized matrix $P \in \mathbb{R}^{8 \times \widetilde{d}}$ to project the extracted features to a + +Table 3: Performance (%) on Fashion-MNIST dataset with noise labels. The best result across all groups is highlighted in bold and the best result in each group is marked with underlined. + +
Methodsnoise=0%noise=20%noise=40%noise=60%noise=80%
Dimension d = 100
CMA-ES76.68±0.4477.25±1.2675.71±1.1570.81±1.0157.86±3.65
MMES76.20±1.4574.68±0.3374.46±0.3271.12±2.2465.92±1.30
BES76.26±0.2173.60±0.5067.60±0.7255.14±6.2645.65±4.35
INGO76.68±0.9075.16±0.5571.26±0.7461.70±3.8946.75±1.35
SABO78.10±0.9077.41±0.6877.10±1.6973.41±0.3366.45±0.43
Dimension d = 1000
CMA-ES76.75±0.5474.85±0.0673.21±0.5267.32±0.8450.00±0.98
MMES75.85±0.4372.39±3.5973.73±0.5072.51±1.4756.60±2.72
BES76.18±0.6372.45±0.4466.64±2.0958.74±1.5046.99±4.30
INGO74.73±0.6274.87±1.7269.75±0.7363.18±4.0441.80±1.36
SABO76.87±1.4177.73±0.8574.97±1.1273.81±1.2661.96±0.08
+ +$\widetilde{d}$ -dimensional space. After preprocessing, a linear layer is used as a classifier. Therefore, the total number of the trainable parameters is $d = 10 \times \widetilde{d}$ . + +Datasets. Fashion-MNIST (Xiao et al., 2017) is a image classifications dataset. It contains 60,000 training samples and 10,000 test samples, each representing a $28 \times 28$ -pixel grayscale image of fashion items from 10 different classes. + +Implementation Details. For a fair comparison, we set the same population size, number of batch samples, and the initialization for CMA-ES (Hansen, 2006), INGO (Lyu & Tsang, 2021), BES (Gao & Sener, 2022), and SABO. The population size and the number of batch samples are set to $N = 100$ and $M = 2048$ , respectively. The Gaussian distributions are initialized with $\mu_0 = 0$ and $\Sigma_0 = 0.5I$ . For BES, INGO and SABO methods, we search the learning rate $\beta$ over $\{0.1, 0.5, 1, 5\}$ . Moreover, we perform grid-search on $\rho$ over $\{100, 500, 1000, 5000\}$ for SABO. We employ the default hyperparameter setting from He et al. (2020) for the MMES method. For the BES method, we perform grid-search on the spacing $c$ over $\{0.1, 1, 10\}$ . The cross-entropy loss is used as the training objective. All experiments are repeatedly run with three independent seeds and the mean and standard deviation are reported. + +Results. Table 3 shows experimental results on Fashion-MNIST dataset with different $\widetilde{d}$ and different noise rates. We can see that the SABO method consistently outperforms all baselines across different noise rates and dimensions, highlighting its effectiveness. These results show that the proposed SABO method can achieve good robustness performance and demonstrate the effectiveness of the proposed SABO method in improving model generalization performance. + +# I DISCUSSION WITH OFFLINE BLACK-BOX OPTIMIZATION + +The typical black-box optimization problem we studied in this work can also be called the online black-box optimization problem. Since we have access to the objective function $F$ , the problem can be solved in an online iterative manner, where in each iteration the solver proposes new $x$ and queries the objective function for feedback in order to inform better solution proposals at the next iteration. + +The offline black-box optimization (Chen et al., 2022; Qi et al., 2022) is different from the research line of standard online black-box optimization. In offline black-box optimization, access to the true objective $F$ is not available. Instead, the offline black-box optimization algorithm is provided access to a static dataset $\mathcal{D} = \{\pmb{x}_i, F(\pmb{x}_i)\}$ of the variable $\pmb{x}_i$ and its corresponding objective value $F(\pmb{x}_i)$ . Therefore, the basic settings of offline black-box optimization and online black-box optimization are different. + +Moreover, the challenges of offline black-box optimization and online black-box optimization are also different. Offline black-box optimization focuses on producing query candidates by a surrogate model trained with a prior static dataset (Trabucco et al., 2021; Kumar & Levine, 2020). The goal is to produce a good query set based on the fixed model at one time without considering query feedback update, exploration and exploitation balance in the long term. Along this line, Kumar & Levine (2020) proposed a model-based offline optimization by training a conditional generative model that conditions the objective value. In Fannjiang & Listgarten (2020), the authors formulated the problem as a non-zero-sum game and proposed an alternating ascent-descent algorithm for model-based offline optimization. Trabucco et al. (2021) proposed the conservative objective models, which presents a technique similar to adversarial training that avoids overestimation of out-of-distribution inputs. In contrast to offline black-box optimization, standard online black-box optimization needs to balance exploration and exploitation, which focuses on long-term convergence performance. As a result, offline black-box optimization is not suitable for our online prompt fine-tuning tasks. + +# J DISCUSSIONS ABOUT THE SOCIETAL IMPACT AND LIMITATIONS + +This work only focuses on black-box optimization in deep learning, so it has no negative societal impact. The main theoretical analysis in this work focuses on convex black-box functions. It is technically challenging to analyze non-convex cases considering both the black-box nature and the sharpness-aware properties, and we leave this as one of our future work. Additionally, the SABO method employs a standard Monte Carlo sampling for gradient approximation. Other sampling techniques might be more efficient, but those are out of the scope of this work. We will study it in the future. \ No newline at end of file diff --git a/ICLR/2025/Sharpness-Aware Black-Box Optimization/images.zip b/ICLR/2025/Sharpness-Aware Black-Box Optimization/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..3b2ce73b33def243ac4a2ea4facabdf42cdbb9e5 --- /dev/null +++ b/ICLR/2025/Sharpness-Aware Black-Box Optimization/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:862caf47dcc03665810076ae6aa75675fb83ae04e6c66f8d3d6f6d26dddfa7ed +size 1995984 diff --git a/ICLR/2025/Sharpness-Aware Black-Box Optimization/layout.json b/ICLR/2025/Sharpness-Aware Black-Box Optimization/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..1dd2178a4efc8728edbb789b798fa1d4f86c2a12 --- /dev/null +++ b/ICLR/2025/Sharpness-Aware Black-Box Optimization/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5e75cf6230a9a30dab653e06592a0eb5b8b1e99a6027a3cdfbf17b4ba1603c31 +size 1461039 diff --git a/ICLR/2025/Sharpness-Aware Minimization_ General Analysis and Improved Rates/f266d8d8-ce04-4f30-96ce-0c705c8a4cee_content_list.json b/ICLR/2025/Sharpness-Aware Minimization_ General Analysis and Improved Rates/f266d8d8-ce04-4f30-96ce-0c705c8a4cee_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..92c66f801d358e2069832714a920636a45dde205 --- /dev/null +++ b/ICLR/2025/Sharpness-Aware Minimization_ General Analysis and Improved Rates/f266d8d8-ce04-4f30-96ce-0c705c8a4cee_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:25071bcb5922294fdba5ddbc3ef4a385a5483dbe2d770a50a5dd0e85f6c035de +size 193285 diff --git a/ICLR/2025/Sharpness-Aware Minimization_ General Analysis and Improved Rates/f266d8d8-ce04-4f30-96ce-0c705c8a4cee_model.json b/ICLR/2025/Sharpness-Aware Minimization_ General Analysis and Improved Rates/f266d8d8-ce04-4f30-96ce-0c705c8a4cee_model.json new file mode 100644 index 0000000000000000000000000000000000000000..4b5f46fd480801ba2d9565835728993ea26d723e --- /dev/null +++ b/ICLR/2025/Sharpness-Aware Minimization_ General Analysis and Improved Rates/f266d8d8-ce04-4f30-96ce-0c705c8a4cee_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a2e224a075e34448c0f3a222e9158d6d0c236367e7e6fbc9833de5096e4b9fa0 +size 228771 diff --git a/ICLR/2025/Sharpness-Aware Minimization_ General Analysis and Improved Rates/f266d8d8-ce04-4f30-96ce-0c705c8a4cee_origin.pdf b/ICLR/2025/Sharpness-Aware Minimization_ General Analysis and Improved Rates/f266d8d8-ce04-4f30-96ce-0c705c8a4cee_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..75e76abb8cab7c747ef633fe212ed32923d38d04 --- /dev/null +++ b/ICLR/2025/Sharpness-Aware Minimization_ General Analysis and Improved Rates/f266d8d8-ce04-4f30-96ce-0c705c8a4cee_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5c90857dfd926c316a02f54f9c367354d18a8ef44ccc0c8a8de9e1448647295f +size 2156884 diff --git a/ICLR/2025/Sharpness-Aware Minimization_ General Analysis and Improved Rates/full.md b/ICLR/2025/Sharpness-Aware Minimization_ General Analysis and Improved Rates/full.md new file mode 100644 index 0000000000000000000000000000000000000000..596c3f7d0403a7c9c99d9f14ed6760f2f519c30c --- /dev/null +++ b/ICLR/2025/Sharpness-Aware Minimization_ General Analysis and Improved Rates/full.md @@ -0,0 +1,1025 @@ +# SHARPNESS-AWARE MINIMIZATION: GENERAL ANALYSIS AND IMPROVED RATES + +Dimitris Oikonomou + +CS & MINDS + +Johns Hopkins University + +doikono1@jh.edu + +Nicolas Loizou + +AMS & MINDS + +Johns Hopkins University + +nloizoul@jh.edu + +# ABSTRACT + +Sharpness-Aware Minimization (SAM) has emerged as a powerful method for improving generalization in machine learning models by minimizing the sharpness of the loss landscape. However, despite its success, several important questions regarding the convergence properties of SAM in non-convex settings are still open, including the benefits of using normalization in the update rule, the dependence of the analysis on the restrictive bounded variance assumption, and the convergence guarantees under different sampling strategies. To address these questions, in this paper, we provide a unified analysis of SAM and its unnormalized variant (USAM) under one single flexible update rule (Unified SAM), and we present convergence results of the new algorithm under a relaxed and more natural assumption on the stochastic noise. Our analysis provides convergence guarantees for SAM under different step size selections for non-convex problems and functions that satisfy the Polyak-Lojasiewicz (PL) condition (a non-convex generalization of strongly convex functions). The proposed theory holds under the arbitrary sampling paradigm, which includes importance sampling as special case, allowing us to analyze variants of SAM that were never explicitly considered in the literature. Experiments validate the theoretical findings and further demonstrate the practical effectiveness of Unified SAM in training deep neural networks for image classification tasks. + +# 1 INTRODUCTION + +Consider the classical finite-sum optimization problem + +$$ +\min _ {x \in \mathbb {R} ^ {d}} \left[ f (x) = \frac {1}{n} \sum_ {i = 1} ^ {n} f _ {i} (x) \right], \tag {1} +$$ + +where each $f_{i}$ is differentiable, $L_{i}$ -smooth and lower bounded. Let $X^{*}$ be the set of minimizers of $f$ , which we assume is non-empty. In practical scenarios, the variable $x$ represents the model parameters, $n$ is the total number of training instances, and the functions $f_{i}$ are loss functions that measure how close our model is to the $i$ -th training data point. The goal is to minimize the average loss of all training instances. + +Understanding the generalization capabilities of Deep Neural Networks (DNNs) is a central concern in machine learning research, (Zhang et al., 2016; Hardt et al., 2016; Neyshabur et al., 2017; Wilson et al., 2017; Neyshabur et al., 2018; Zhang et al., 2021). The training objective function $f$ has numerous stationary points that perfectly fit the training data (Liu et al., 2020), and each of these points can lead to dramatically varying generalization performances. This suggests that minimizing the training objective using a carefully selected optimization algorithm can lead to convergence at a point with improved generalization performance (Foret et al., 2021). + +Recent studies have observed that the sharpness of the training loss, that is, how rapidly it changes in a neighborhood around the model parameters, correlates strongly with the generalization error (Keskar et al., 2016; Jiang et al., 2019; Singh et al., 2025; Dziugaite & Roy, 2018). This observation has motivated recent works (Foret et al., 2021; Zheng et al., 2021; Wu et al., 2020; Andriushchenko et al., 2023; Xie et al., 2024; Tahmasebi et al., 2024) aiming to minimize sharpness to improve + +generalization. More specifically, building on these ideas Foret et al. (2021), proposed reformulating the optimization problem in (1) into a min-max problem of the following form: + +$$ +\min_{x\in \mathbb{R}^{d}}\max_{\| \varepsilon \| \leq \rho}f(x + \varepsilon) +$$ + +where $\varepsilon$ represents the radius of the desired neighborhood. The merits of such a formulation reside in the fact that essentially we minimize the empirical sharpness measure $\max_{\| \varepsilon \| \leq \rho}f(x + \varepsilon) - f(x)$ , which inevitably will lead to flatter minima. The objective now is to find $x$ that minimizes $f$ not just at a specific point but across the entire $\varepsilon$ -neighborhood. By taking the first-order Taylor expansion of $f$ around $x$ and solving for the optimal $\varepsilon^{*}$ , the (Normalized) Sharpness-Aware Minimization (SAM) update rule is obtained: + +$$ +x ^ {t + 1} = x ^ {t} - \gamma_ {t} \nabla f _ {S _ {t}} \left(x ^ {t} + \rho_ {t} \frac {\nabla f _ {S _ {t}} \left(x ^ {t}\right)}{\| \nabla f _ {S _ {t}} \left(x ^ {t}\right) \|}\right), \tag {SAM} +$$ + +where $S_{t} \subseteq [n]$ is a random subset of data points (mini-batch) with cardinality $\tau$ sampled independently at each iteration $t$ . The normalization of the inner gradient ensures that the point $\tilde{x}^{t} = x^{t} + \rho_{t}\frac{\nabla f_{S_{t}}(x^{t})}{\|\nabla f_{S_{t}}(x^{t})\|}$ is a good approximation of $x^{t}$ , since $\| \tilde{x}^t -x^t\| = \rho_t$ . This leads to a more stable optimization process, as explained in Dai et al. (2023). + +In an orthogonal direction and building upon SAM, Unnormalized Sharpness-Aware Minimization (USAM) was introduced by Andriushchenko & Flammarion (2022) and further investigated in Shin et al. (2024); Dai et al. (2023). The update rule for USAM is defined as follows: + +$$ +x ^ {t + 1} = x ^ {t} - \gamma_ {t} \nabla f _ {S _ {t}} \left(x ^ {t} + \rho_ {t} \nabla f _ {S _ {t}} \left(x ^ {t}\right)\right). \tag {USAM} +$$ + +In contrast to SAM, USAM omits the normalization thus the point $\tilde{x}^t$ can be potentially far from $x^t$ making the $\tilde{x}^t$ 's of USAM updates much larger. This means that the removal of normalization can lead to much more aggressive steps making the USAM potentially more unstable. + +Although the two variants appear closely related, the proof techniques and upper bounds used in the convergence analysis of SAM are substantially different from those in USAM. Furthermore, the convergence guarantees of the two variants vary significantly. For example, in the deterministic setting (full-batch), SAM guarantees convergence only to a neighborhood of the solution, whereas USAM does not. Additionally, the step sizes $\gamma_{t}$ and $\rho_{t}$ used in the two update rules to guarantee convergence are very different. All of these differences motivate the importance and necessity of a novel general analysis of SAM-type algorithms, unifying the two main variants (SAM and USAM) and providing the ability to design and analyze new SAM-like methods filling existing gaps in the theoretical understanding of the update rules. + +In this work we develop such unified framework that allows the combination of the two approaches and, at the same time, obtains the best-known convergence guarantees under relaxed assumptions. + +Main Contributions. Our main contributions are summarized below. + +$\diamond$ Unified Framework. We propose the Unified SAM, an update rule that is a convex combination of SAM and USAM, given by: + +$$ +x ^ {t + 1} = x ^ {t} - \gamma_ {t} \nabla f _ {S _ {t}} \left(x ^ {t} + \rho_ {t} \left(1 - \lambda_ {t} + \frac {\lambda_ {t}}{\| \nabla f _ {S _ {t}} (x ^ {t}) \|}\right) \nabla f _ {S _ {t}} (x ^ {t})\right) \quad (\text {U n i f i e d S A M}) +$$ + +where $\lambda \in [0,1]$ . The new formulation captures both USAM and SAM as special cases ( $\lambda = 0$ and $\lambda = 1$ , respectively), but more importantly, it opens up a wide range of possible update rules beyond these traditional settings. The unified framework offers the flexibility to adjust the degree of normalization (using different values for $\lambda$ ) based on specific model needs, offering a more versatile approach to SAM. + +$\diamond$ Technical Assumptions on the Stochastic Noise. Existing convergence analyses of stochastic SAM rely heavily on the bounded variance assumption, that is, there exists a $\sigma \geq 0$ such that $\mathbb{E}\left\| \nabla f_{S_t}(x) - \nabla f(x)\right\|^2 \leq \sigma^2$ , (Andriushchenko & Flammarion, 2022; Si & Yun, 2023; Li & Giannakis, 2023; Harada & Iiduka, 2024; Mi et al., 2022; Zhuang et al., 2022) or sometimes to the much stronger bounded gradient condition $\mathbb{E}\left\| \nabla f_{S_t}(x)\right\|^2 \leq q^2$ , where $q \geq 0$ (Mi et al., 2022; Zhuang et al., 2022). While these assumptions have been crucial in previous analyses, they can be + +
WorkAssumptionsArbitrary Sampling?SAM Variant
PL functions
(Andriushchenko & Flammarion, 2022)BVXUSAM
(Shin et al., 2024)InterpolationXUSAM
(Dai et al., 2023)DeterministicXUSAM
Theorems 3.2 and 3.5ER✓Unified SAM
General Non-convex functions
(Mi et al., 2022)BV, BGXSAM/SSAM
(Zhuang et al., 2022)BV, BGXGSAM
(Andriushchenko & Flammarion, 2022)BVXUSAM
(Li & Giannakis, 2023)BVXSAM
(Si & Yun, 2023)BVXSAM
Theorem 3.7ER✓Unified SAM
+ +Table 1: Summary of the convergence results in the SAM literature. In all works, smoothness is assumed. The top part of the table is for PL functions and the lower part is for general non-convex functions. Here BV = Bounded Variance, BG = Bounded Gradients. + +overly restrictive. In the literature of convergence analysis for stochastic gradient descent (SGD), there have been a lot of efforts recently on relaxing such assumptions (Gower et al., 2019; Khaled & Richtárik, 2020; Gower et al., 2021), but, to date, no work has successfully used similar ideas for the analysis of SAM. In our analysis, we relax the bounded gradients/variance assumptions by utilizing the recently proposed Expected Residual (ER) condition Gower et al. (2021); Khaled & Richtárik (2020). As we explain later, in several scenarios, including smooth non-convex problems, ER holds for free and allows us to provide step sizes for SAM related to the sampling strategies. + +$\diamond$ Convergence guarantees for Unified SAM. We provide tight convergence guarantees for Unified SAM, for smooth functions satisfying the Polyak-Lojasiewicz (PL) condition (Polyak, 1987; Lojasiewicz, 1963; Karimi et al., 2016) and for general non-convex functions. See also Table 1 for a summary of our results and comparison with closely related works. + +- PL functions: For constant step-sizes $\gamma$ and $\rho$ we prove linear convergence for Unified SAM to a neighborhood of the solution. Our theorem holds without requiring the much stronger assumptions of interpolation condition or the bounded variance assumption of previous works (Andriushchenko & Flammarion, 2022; Shin et al., 2024). Additionally, we prove that for decreasing step sizes $\gamma_t$ and $\rho_t$ , the Unified SAM converges to the exact solution with a sublinear $O(1 / t)$ rate (under the ER condition). Our theoretical results hold under the arbitrary sampling paradigm and, as such, can capture tight convergence guarantees in the deterministic setting. For PL functions in the deterministic setting (full-batch SAM), we show that USAM converges to the exact solution, while SAM does not. This observation was first noted by Si & Yun (2023) for deterministic algorithms. To the best of our knowledge, our work is the first that provides tight convergence guarantees, showing this behaviour as a special case of stochastic algorithms. +- Non-convex functions: Under the ER condition, we show that for general non-convex functions Unified SAM with step sizes that depend on $T$ (the total number of iterations) achieves $\mathbb{E}\left\| \nabla f(x^T)\right\| < \varepsilon$ for a given $\varepsilon$ at a sublinear rate. This is the first result that drops the bounded variance assumption for both USAM and SAM, (Andriushchenko & Flammarion, 2022; Li & Giannakis, 2023), and substitutes it with the Expected Residual condition. + +Finally, as corollaries of the main theorems for the above two classes of problems, we obtain the state-of-the-art convergence guarantees for SGD (a special case of SAM with $\rho = 0$ ), showing the tightness of our analysis. + +$\diamond$ Arbitrary Sampling. Via a stochastic reformulation of the finite sum problem (1), firstly introduced in Gower et al. (2019), we explain how our convergence guarantees of Unified SAM hold under the arbitrary sampling paradigm. This allows us to cover a wide range of samplings for USAM and SAM (and their convex combination via $\lambda \in [0,1]$ ) that were never considered in the literature before, including uniform sampling and importance sampling as special cases. In this sense, our analysis of Unified SAM is unified for different sampling strategies. + +$\diamond$ Numerical Evaluation. In Section 4, we present extensive experiments validating different aspects of our theoretical results (behavior of methods in the deterministic setting, importance sampling, and different step-size selections). We also assess the performance of Unified SAM in training deep neural networks for multi-class image classification problems. An open-source implementation of our method is available at https://github.com/dimitris-oik/unifiedsam. + +# 2 UNIFIED SAM WITH ARBITRARY SAMPLING + +In this work, we provide a theoretical analysis of Unified SAM that allows us to obtain convergence guarantees of any minibatch and reasonable sampling selection. + +We are able to do that by leveraging the recently proposed "stochastic reformulation" of the minimization problem (1) from Gower et al. (2019; 2021). Following an identical setting to Gower et al. (2021), we assume that we have access to unbiased gradient estimates $g(x) \in \mathbb{R}^d$ such that $\mathbb{E}[g(x)] = \nabla f(x)$ . For example, we can have $g(x) = \frac{1}{\tau}\sum_{i \in S} \nabla f_i(x)$ to be a mini-batch, where $S \subseteq [n]$ is chosen uniformly at random with $|S| = \tau$ . To accommodate any form of mini-batching, we utilize the arbitrary sampling notation $g(x) = \nabla f_v(x) \coloneqq \frac{1}{n}\sum_{i=1}^{n} v_i \nabla f_i(x)$ , where $v \in \mathbb{R}^n$ is a random sampling vector drawn from a distribution $\mathcal{D}$ such that $\mathbb{E}_{\mathcal{D}}[v_i] = 1$ , for $i = 1, \ldots, n$ . Then the original problem (1) can be reformulated as $\min_{x \in \mathbb{R}^d} \mathbb{E}_{\mathcal{D}}[f_v(x) := \frac{1}{n}\sum_{i=1}^{n} v_if_i(x)]$ . Note that it follows immediately from the definition of sampling vector that $\mathbb{E}[g(x)] = \frac{1}{n}\sum_{i=1}^{n} \mathbb{E}[v_i]\nabla f_i(x) = \nabla f(x)$ . Using this reformulation of the original problem, the update rule of Unified SAM can be rewritten as follows: + +$$ +x ^ {t + 1} = x ^ {t} - \gamma_ {t} g \left(x ^ {t} + \rho_ {t} \left(1 - \lambda_ {t} + \frac {\lambda_ {t}}{\| g (x ^ {t}) \|}\right) g (x ^ {t})\right), \quad \text {(U n i f i e d S A M)} +$$ + +where $g(x^t) \sim \mathcal{D}$ is sampled i.i.d at each iteration and $\rho_t \geq 0$ , $\gamma_t > 0$ and $\lambda_t \in [0,1]$ . The name unified stems from the fact that the update rule indeed unifies both USAM and SAM, however, we acknowledge that there exist other SAM-like variants that our approach does not cover. + +Arbitrary Sampling. Using the stochastic reformulation, the update rule of Unified SAM includes several variants of the algorithm, each related to different sampling, by simply varying the distribution $\mathcal{D}$ (that satisfies $\mathbb{E}_{\mathcal{D}}[v_i] = 1, \forall i \in [n]$ ). This flexibility implies that different choices of $\mathcal{D}$ lead to distinct SAM-type methods (never proposed in the literature before) for solving the original problem (1). In this work we focus on two representative sampling distributions, without aiming to be exhaustive: + +1. Single element sampling: We choose only singleton sets $S = \{i\}$ for $i \in [n]$ , i.e. $\mathbb{P}[|S| = 1] = 1$ . Each number $i$ is sampled with probability $p_i \in [0,1]$ or more formally the vector $v \in \mathbb{R}^n$ is defined via $\mathbb{P}[v = e_i / p_i] = p_i$ , where $\sum_{i=1}^{n} p_i = 1$ . It is clear that $\mathbb{E}[v_i] = 1$ . For example, when $p_i = 1/n$ for all $i$ then this reduces to the well-known uniform sampling. +2. $\tau$ -nice Sampling: Let $\tau \in [n]$ . We generate a random subset $S \subseteq [n]$ by choosing uniformly from all subsets of size $\tau$ . More formally, the vector $v \in \mathbb{R}^n$ is defined by $\mathbb{P}[v = \frac{n}{\tau}\sum_{i \in S} e_i] := 1 / \binom{n}{\tau} = \frac{\tau!(n - \tau)!}{n!}$ for any subset $S \subseteq [n]$ with $|S| = \tau$ . Using a double counting argument, one can show that $\mathbb{E}[v_i] = 1$ (see Gower et al. (2019)). + +Importantly, our analysis applies to all forms of mini-batching and supports various choices of sampling vectors $v$ . Later in Section 3.4, we provide additional details on non-uniform single element sampling strategies. In addition, it is clear that if $\tau = n$ in the $\tau$ -nice sampling then we recover the full batch or deterministic regime. Later in Section 3.2, we further demonstrate how our analysis encompasses deterministic SAM and USAM as special cases. + +# 3 CONVERGENCE ANALYSIS + +In this section, we present our main convergence results. Firstly, we introduce the main assumption for our results, namely the Expected Residual (ER) condition. Then we focus on PL functions, where we demonstrate a linear convergence rate using constant step sizes, and also provide a variant with decreasing step sizes for convergence to the exact solution. Moreover, we extend the analysis to general non-convex functions. Lastly, we discuss the use of importance sampling. + +# 3.1 MAIN ASSUMPTION + +In all our theoretical results, we rely on the Expected Residual condition. + +Assumption 3.1 (Expected Residual Condition). Let $f^{\inf} = \inf_{x\in \mathbb{R}^n}f(x)$ . We say the Expected Residual condition holds if there exist parameters $A,B,C\geq 0$ such that for an unbiased estimator $g(x)$ of $\nabla f(x)$ , we have that for all $x\in \mathbb{R}^d$ + +$$ +\mathbb {E} _ {\mathcal {D}} \| g (x) \| ^ {2} \leq 2 A [ f (x) - f ^ {\inf } ] + B \| \nabla f (x) \| ^ {2} + C. \tag {ER} +$$ + +Most prior works in the SAM literature assume either bounded gradients (e.g., Mi et al. (2022); Zhuang et al. (2022)) or bounded variance (e.g., Andriushchenko & Flammarion (2022); Harada & Iiduka (2024)). Both conditions are stronger assumptions than ER. Note that the bounded gradients assumption is captured by ER for $A = B = 0$ , $C > 0$ , while the bounded variance is obtained for $A = 0$ , $B = 1$ , and $C > 0$ . For a detailed analysis of other conditions that automatically satisfy ER, see Gower et al. (2021) and Khaled & Richtárik (2020). Finally, when each $f_{i}$ is $L_{i}$ -smooth under mild assumptions on the distribution $\mathcal{D}$ , one can show that ER holds immediately (not an assumption but property of the problem) and has closed-from expressions for the constants A, B, and C. For more details on the expressions A, B, and C in this scenario, please check Appendix B. + +# 3.2 PL FUNCTIONS + +One of the popular generalizations of strong convexity in the literature is the Polyak-Lojasiewicz (PL) condition, (Karimi et al., 2016; Lei et al., 2019). We call a function $\mu$ -PL if $\|\nabla f(x)\|^2 \geq 2\mu(f(x) - f(x^*))$ , for all $x \in \mathbb{R}^d$ . In the following, we prove linear convergence of Unified SAM for $\mu$ -PL functions. + +Theorem 3.2. Assume that each $f_{i}$ is $L_{i}$ -smooth, $f$ is $\mu$ -PL and the ER is satisfied. Set $L_{\max} = \max_{i \in [n]} L_{i}$ . Then the iterates of Unified SAM with + +$$ +\rho_ {t} = \rho \leq \rho^ {*} := \frac {\mu}{L _ {\max} (\mu + 2 [ B \mu + A ] (1 - \lambda) ^ {2})}, \gamma_ {t} = \gamma \leq \gamma^ {*} := \frac {\mu - L _ {\max} \rho (\mu + 2 [ B \mu + A ] (1 - \lambda) ^ {2})}{2 L _ {\max} (B \mu + A) [ 2 L _ {\max} ^ {2} \rho^ {2} (1 - \lambda) ^ {2} + 1 ]}, +$$ + +satisfy: $\mathbb{E}[f(x^t) - f(x^*)]\leq (1 - \gamma \mu)^t\left[f(x^0) - f(x^*)\right] + N,$ where $N = \frac{L_{\mathrm{max}}}{\mu}\left(C\gamma +\rho (1 + 2\gamma L_{\mathrm{max}}^2\rho)\left[\lambda^2 +C(1 - \lambda)^2\right]\right).$ + +As an immediate corollary of Theorem 3.2, we get the following guarantees for USAM and SAM, when we substitute $\lambda = 0$ and $\lambda = 1$ respectively. + +Corollary 3.3. Consider the same assumptions as in Theorem 3.2. + +- USAM: For USAM with $\rho \leq \frac{\mu}{L_{\max}(\mu + 2[B\mu + A])}$ and $\gamma \leq \frac{\mu - L_{\max}\rho(\mu + 2[B\mu + A])}{2L_{\max}(B\mu + A)[2L_{\max}^2\rho^2 + 1]}$ , it holds: + +$$ +\mathbb {E} \left[ f \left(x ^ {t}\right) - f \left(x ^ {*}\right) \right] \leq \left(1 - \gamma \mu\right) ^ {t} \left[ f \left(x ^ {0}\right) - f \left(x ^ {*}\right) \right] + \frac {L _ {\max } C}{\mu} \left(\gamma + \rho \left(1 + 2 \gamma L _ {\max } ^ {2} \rho\right)\right). +$$ + +- SAM: For SAM with $\rho_t = \rho \leq \frac{1}{L_{\max}}$ and $\gamma_t = \gamma \leq \frac{\mu(1 - L_{\max}\rho)}{2L_{\max}(B\mu + A)}$ , it holds: + +$$ +\mathbb {E} \left[ f (x ^ {t}) - f (x ^ {*}) \right] \leq (1 - \gamma \mu) ^ {t} \left[ f (x ^ {0}) - f (x ^ {*}) \right] + \frac {L _ {\operatorname* {m a x}}}{\mu} \left(C \gamma + \rho (1 + 2 \gamma L _ {\operatorname* {m a x}} ^ {2} \rho)\right). +$$ + +To the best of our knowledge, all prior convergence results for (stochastic) SAM have relied on the strong assumption of bounded variance, as seen in works like Andriushchenko & Flammarion (2022), Si & Yun (2023), Li & Giannakis (2023) and Harada & Iiduka (2024). In contrast, the above theorem is the first to establish convergence for SAM without relying on this assumption. The closest related works on the convergence of constant step size SAM for PL functions are Shin et al. (2024) and Dai et al. (2023). The former provides a linear convergence rate for USAM in the interpolated regime, while the latter establishes a linear convergence rate for USAM in the deterministic regime. + +Our result is the first to demonstrate linear convergence in the fully stochastic regime. Additionally, when $\rho = 0$ , Unified SAM reduces to SGD, and Theorem 3.2 recovers the step sizes and rates (up to constants) of Theorem 4.6 from Gower et al. (2021), demonstrating the tightness of our results. + +Recall that with our general analysis via the arbitrary sampling framework, the proposed convergence guarantees hold for the $\tau$ -nice sampling as well (see Section 2). As such, a special case of Theorem 3.2 is the case where $|S| = n$ with probability one. That is, we run Unified SAM with a full batch, $\tau = n$ . In this scenario, using Proposition B.3, the ER condition holds with $A = 0$ , $B = 1$ and $C = 0$ and Theorem 3.2 simplifies as follows. + +Corollary 3.4 (Deterministic SAM). Assume that each $f_{i}$ is $L_{i}$ -smooth and $f$ is $\mu$ -PL. Then the iterates of the deterministic Unified SAM with $\rho \leq \frac{1}{L_{\max}(1 + 2(1 - \lambda)^2)}$ and $\gamma \leq \frac{1 - L_{\max}\rho(1 + 2(1 - \lambda)^2)}{2L_{\max}[2L_{\max}^2\rho^2(1 - \lambda)^2 + 1]}$ satisfy: + +$$ +\mathbb {E} [ f (x ^ {t}) - f (x ^ {*}) ] \leq (1 - \gamma \mu) ^ {t} \left[ f (x ^ {0}) - f (x ^ {*}) \right] + \frac {L _ {\max} \rho (1 + 2 \gamma L _ {\max} ^ {2} \rho) \lambda^ {2}}{\mu}. +$$ + +First, observe that the PL parameter $\mu$ no longer appears in the step sizes $\rho$ and $\gamma$ . Additionally, when $\lambda = 0$ , i.e. USAM, the method converges to the exact solution at a linear rate. However, for $\lambda > 0$ , and in particular when $\lambda = 1$ (SAM), convergence is only up to a neighborhood. This suggests that even in the deterministic setting, SAM does not fully converge to the minimum. This was first investigated in Si & Yun (2023) and a similar result appear in Dai et al. (2023). We illustrate this phenomenon experimentally in Section 4.1. + +Finally, as an extension of Theorem 3.2, we also show how to obtain convergence to exact solution with an $O(1 / t)$ rate for Unified SAM using decreasing step sizes. + +Theorem 3.5. Assume that each $f_{i}$ is $L_{i}$ -smooth, $f$ is $\mu$ -PL and the ER is satisfied. Then the iterates of Unified SAM with $\rho_{t} = \min \left\{\frac{1}{2t + 1}, \rho^{*}\right\}$ and $\gamma_{t} = \min \left\{\frac{2t + 1}{(t + 1)^{2}\mu}, \gamma^{*}\right\}$ , where $\rho^{*}$ and $\gamma^{*}$ are defined in Theorem 3.2, satisfy: $E[f(x^t) - f(x^*)] \leq O\left(\frac{1}{t}\right)$ . + +The detailed expression hidden under the big $O$ notation can be found in Appendix C. A similar result appears in Andriushchenko & Flammarion (2022) where they provide decreasing step size selection for USAM for PL functions and prove a convergence rate of $O(1 / t)$ . However, their result relies on the additional assumption of bounded variance. In contrast, our theorem does not require this assumption and is valid for any $\lambda \in [0, 1]$ . Notably, to the best of our knowledge, this is the first decreasing step size result for SAM. + +# 3.3 GENERAL NON-CONVEX FUNCTIONS + +In this section, we remove the PL assumption and work with general non-convex functions. First, we start with a general proposition that upper bounds the quantity $\min_{t=0,\dots,T-1}\mathbb{E}\|\nabla f(x^t)\|^2$ , which can serve as an intermediate result for Theorem 3.7. Our approach follows a similar derivation to the analysis of SGD in the same setting by Khaled & Richtárik (2020). + +Proposition 3.6. Assume that each $f_{i}$ is $L_{i}$ -smooth and the $ER$ is satisfied. Then the iterates of Unified SAM with $\rho \leq \min \left\{\frac{1}{4L_{\max}}, \frac{1}{8BL_{\max}(1 - \lambda)^2}\right\}$ and $\gamma \leq \frac{1}{8BL_{\max}}$ , satisfy: + +$$ +\begin{array}{l} \min _ {t = 0, \dots , T - 1} \mathbb {E} \| \nabla f (x ^ {t}) \| ^ {2} \leq \frac {2 \left(1 + 2 A \gamma L _ {\max } \left[ \rho (1 - \lambda) ^ {2} (1 + 2 \gamma \rho L _ {\max } ^ {2}) + \gamma \right]\right) ^ {T}}{T \gamma} [ f (x ^ {0}) - f ^ {\inf} ] \\ + 2 L _ {\max } \left[ C \gamma + \rho (1 + 2 \gamma \rho L _ {\max } ^ {2}) (\lambda^ {2} + C (1 - \lambda) ^ {2}) \right]. \\ \end{array} +$$ + +In order to control the coefficient of the term $f(x^0) - f^{\mathrm{inf}}$ of Proposition 3.6 from exploding we need to carefully select the step sizes $\rho$ and $\gamma$ . This is what the following Theorem 3.7 achieves. + +Theorem 3.7. Let $\varepsilon >0$ and set $\delta_0 = f(x_0) - f^{\mathrm{inf}}\geq 0$ . For $\rho = \overline{\rho}$ and $\gamma = \overline{\gamma},^a$ provided that + +$$ +\begin{array}{l} T \geq \frac {\delta_ {0} L _ {\max}}{\varepsilon^ {2}} \max \left\{9 6 B, 2 4 (1 - \lambda) \sqrt {3 L _ {\max } A}, \frac {5 1 8 4 L _ {\max } A ^ {2} (1 - \lambda) ^ {4} \delta_ {0}}{\varepsilon^ {2}}, \frac {8 6 4 \delta_ {0} A}{\varepsilon^ {2}}, \frac {1 4 4 C}{\varepsilon^ {2}}, \right. \\ \left. \frac {2 8 8 L _ {\operatorname * {m a x}} ^ {2} (1 - \lambda) ^ {2}}{\varepsilon^ {2}} \right\} \\ \end{array} +$$ + +the iterates of Unified SAM satisfy $\min_{t = 0,\dots ,T - 1}\mathbb{E}\left\| \nabla f(x^t)\right\| \leq \varepsilon$ + +For the precise expressions of $\overline{\rho}$ and $\overline{\gamma}$ we refer to Theorem C.4. + +The results in Proposition 3.6 and Theorem 3.7 are tight, as setting $\rho = 0$ Unified SAM reduces in SGD and these simplify to the step sizes and rates (up to constants) of Theorem 2 and Corollary 1 from Khaled & Richtárik (2020). Other results for general non-convex functions can be found in Mi et al. (2022), Zhuang et al. (2022) and Li & Giannakis (2023) for SAM and in Andriushchenko & Flammarion (2022) for USAM. However, as mentioned earlier, all these analyses rely on the strong assumption of bounded variance and/or bounded gradients. In contrast, our result uses weaker assumptions and offers guarantees for any $\lambda \in [0,1]$ . Furthermore, Khanh et al. (2024) have results for general non-convex functions in the deterministic setting though all their results are asymptotic. Another closely related work is Nam et al. (2023), where they also assume the expected residual condition, however, they additionally assume bounded gradient of $f$ and their results are only asymptotic and hold almost surely. + +# 3.4 BEYOND UNIFORM SAMPLING: IMPORTANCE SAMPLING + +In this work, we provide theorems in the PL and non-convex regime through which we can analyze all importance sampling and mini-batch variants of Unified SAM (and as a result of USAM and SAM). We achieve that via our general arbitrary sampling analysis. In this section, we focus on the non-convex regime (Theorem 3.7) and provide importance sampling for Unified SAM with single-element sampling. That is, we select probabilities that optimize the iteration complexity (lower bound of $T$ ). In particular, to derive the importance sampling probabilities, we substitute the bounds for $A$ , $B$ , and $C$ from Proposition B.2 into Theorem 3.7, resulting in: + +$$ +\begin{array}{l} T \geq \frac {\delta_ {0} L _ {\max}}{\varepsilon^ {2}} \max \left\{2 4 (1 - \lambda) \sqrt {\frac {3 L _ {\max}}{n \tau} \max _ {i} \frac {L _ {i}}{p _ {i}}}, \frac {\frac {5 1 8 4 L _ {\max}}{n ^ {2} \tau^ {2}} (\max _ {i} \frac {L _ {i}}{p _ {i}}) ^ {2} (1 - \lambda) ^ {4} \delta_ {0}}{\varepsilon^ {2}}, \right. \\ \left. \frac {\frac {8 6 4 \delta_ {0}}{n \tau} \operatorname * {m a x} _ {i} \frac {L _ {i}}{p _ {i}}}{\varepsilon^ {2}}, \frac {\frac {2 8 8}{n \tau} \operatorname * {m a x} _ {i} \frac {L _ {i}}{p _ {i}} \sigma^ {*}}{\varepsilon^ {2}}, \frac {2 8 8 L _ {\mathrm {m a x}} ^ {2} (1 - \lambda) ^ {2}}{\varepsilon^ {2}} \right\} \\ \end{array} +$$ + +Having substituted the values of $A$ , $B$ , and $C$ in the above expression, to obtain the best bound, we require optimizing the quantity $\max_i \frac{L_i}{np_i}$ over the probabilities $p_i$ . This results in $p_i = \frac{L_i}{\sum_{j=1}^n L_j}$ . Similar probabilities have been proposed for several optimization algorithms, including SGD (Gower et al., 2019; 2021; Khaled & Richtárik, 2020), variance-reduced methods (Khaled et al., 2023), and methods for min-max optimization (Gorbunov et al., 2022; Loizou et al., 2020; Choudhury et al., 2024; Beznosikov et al., 2023). To the best of our knowledge, our work is the first to provide importance sampling for SAM algorithms. + +# 4 NUMERICAL EXPERIMENTS + +In this section, we evaluate our proposed step sizes for Unified SAM on both deterministic and stochastic PL problems, with experiments designed to illustrate our theoretical findings. Additionally, we explore different values of $\lambda$ when training deep neural networks to improve accuracy. + +# 4.1 VALIDATION OF THE THEORY + +In this part, we empirically validate our theoretical results and illustrate the main properties of Unified SAM that our theory suggests in Section 3. In these experiments, we focus on $\ell_2$ -regularized regression problems (problems with strongly convex objective $f$ and components $f_i$ and thus PL) + +and we evaluate the performance of Unified SAM on synthetic data. The loss function of the $\ell_2$ -regularized ridge regression is given by + +$$ +f (x) = \frac {1}{2} \| \boldsymbol {A} x - b \| ^ {2} + \lambda_ {r} \| x \| ^ {2} = \frac {1}{2 n} \sum_ {i = 1} ^ {n} \left(\boldsymbol {A} [ i,: ] x - b _ {i}\right) ^ {2} + \frac {\lambda_ {r}}{2} \| x \| ^ {2} +$$ + +and the loss function of the $\ell_2$ -regularized logistic regression is given by + +$$ +f (x) = \frac {1}{2 n} \sum_ {i = 1} ^ {n} \log \left(1 + \exp \left(- b _ {i} A [ i,: ] x\right)\right) + \frac {\lambda_ {r}}{2} \| x \| ^ {2}. +$$ + +In both problems $\mathbf{A} \in \mathbb{R}^{n \times d}$ , $b \in \mathbb{R}^n$ are the given data and $\lambda_r \geq 0$ is the regularization parameter. + +Normalized SAM converges only in neighborhood. In Corollary 3.4 we highlight that our theoretical results indicate that in the deterministic case, USAM achieves linear convergence to the exact solution. In contrast, when $\lambda > 0$ , and specifically for SAM ( $\lambda = 1$ ), convergence is only to a neighborhood of the solution, an unusual outcome for deterministic optimization methods. We validate this observation experimentally in Figure 1. We run a ridge regression problem with $n = 100$ , $d = 100$ , $\lambda_r = 0$ . The matrix $A$ has been generated according to Lenard & Minkoff (1984) such that the condition number of $A$ is 10 and the vector $b$ has been sampled from the standard Gaussian distribution. We have used the deterministic Unified SAM for $\lambda = 0.0, \dots, 1.0$ and we run each algorithm for 50 epochs. Indeed we can see that USAM ( $\lambda = 0$ ) converges all the way to the exact solution while the other choices of $\lambda$ converge to a neighborhood. It is also noteworthy that the neighborhood increases as $\lambda$ approaches 1. + +![](images/2085a586d303882599fb479020dc5934403628673d57a7a93f7f09208073f616.jpg) +Figure 1: Deterministic Unified SAM for various values of $\lambda$ applied to the ridge regression problem. USAM ( $\lambda = 0$ ) converges to the exact solution while the other variants $\lambda > 0$ converge to a neighborhood of the solution. + +Constant vs Decreasing Step size. In this part, we compare the performance of Unified SAM under both constant and decreasing step size regimes, as described in Theorem 3.2 and Theorem 3.5, respectively. For this experiment, we consider a logistic regression task with $n = 100$ , $d = 100$ , and $\lambda_r = 3/n$ . As before the matrix $A$ has been generated such that its condition number is 10 and the vector $b$ has been sampled from the standard Gaussian distribution. We run Unified SAM with $\lambda = 0.0, 0.5, 1.0$ , using uniform single-element sampling for 10,000 epochs across 5 trials. The average results of these trials, along with one standard deviation, are shown in Figure 2. Initially, the trajectory of the decreasing step size follows that of the constant step size. However, as the constant step size version of Theorem 3.2 approaches a neighborhood near optimality, it stagnates. In contrast, the decreasing step size from Theorem 3.5 allows for continued improvement, leading to better overall accuracy. + +![](images/eb3de950f887812e2d9b30d2e5e662b381988fa76bea765abd88fc3a765f166c.jpg) +Figure 2: Comparison between constant and decreasing step size regimes of Unified SAM. From left to right we have $\lambda = 0.0, 0.5, 1.0$ + +![](images/0f28426af5c8e8310a2057fdb1b8ef71b12d9c0b6e95c1fbdc23c5d4213b8f09.jpg) + +![](images/28f63b18349ac737a12dbdef703c27909f28c40dd8a00f1a355d0e629d94d83c.jpg) + +Uniform vs Importance Sampling. In this experiment, we demonstrate the benefit of using importance sampling compared to uniform sampling. We consider a ridge regression problem with $n = 100$ , $d = 100$ , and $\lambda_r = 3/n$ . The eigenvalues of matrix $A$ are sampled uniformly from the interval [1.0, 10.0], and the vector $b$ is drawn from a standard Gaussian distribution. We run Unified SAM with $\lambda = 0.0, 0.5, 1.0$ , employing single-element uniform sampling for 3,000 epochs across + +![](images/7a29b26d322955213cad3f81290fa56efc70c64bd7809ad17affb7558a152fa1.jpg) +Figure 3: Comparison between uniform and importance sampling for Unified SAM. From left to right we have $\lambda = 0.0, 0.5, 1.0$ + +![](images/8d37265863bb04fef0509eadd4201c4d60c9f0316d1d1fe43fe0b636717179fc.jpg) + +![](images/505d646e10dde739961d03daf6f1f845d2e71ac6911ee2430a4358120b264071.jpg) + +five trials. For importance sampling, the probabilities are set as $p_i = L_i / \sum_{j=1}^n L_j$ . The averaged results with one standard deviation are presented in Figure 3. The results clearly show that importance sampling enhances the convergence of Unified SAM for all values of $\lambda$ , which is consistent with the discussion in Section 3.4. + +# 4.2 IMAGE CLASSIFICATION + +In this section, we evaluate the generalization performance of Unified SAM using the classic image classification task. The models are trained on the CIFAR-10 and CIFAR-100 datasets, (Krizhevsky et al., 2009). For data augmentation, we apply standard techniques such as random crop, random horizontal flip, and normalization (DeVries, 2017). All experiments are conducted on NVIDIA RTX 6000 Ada GPUs. + +Models. We use several models in our experiments, including ResNet-18 (RN-18) (He et al., 2016a), and PreActResNet-18 (PRN-18) (He et al., 2016b). To demonstrate the scalability of Unified SAM, we also include Wider ResNet (WRN-28-10) (Zagoruyko & Komodakis, 2016). + +Different values of $\lambda$ . This subsection explores how varying $\lambda$ in the Unified SAM update rule affects generalization performance. We experiment with the PRN-18 and WRN-28-10 models trained on CIFAR-10 and CIFAR-100. The Unified SAM method is trained using $\rho = 0.1, 0.2, 0.3, 0.4$ and $\lambda_t = 0.0, 0.5, 1.0, 1/t, 1 - 1/t$ . The last two choices of $\lambda_t$ can be intuitively explained as follows: for $\lambda_t = 1 - 1/t$ , the algorithm starts as USAM ( $\lambda_1 = 0$ ) and gradually transitions toward SAM as $\lambda_t \to 1$ when $t \to \infty$ , meaning it begins with USAM and approaches SAM. Conversely, for $\lambda_t = 1/t$ , the algorithm behaves the other way around, starting closer from SAM and converging to USAM over time. Following Pang et al. (2021) and Zhang et al. (2024), we set the weight decay to $5 \times 10^{-4}$ , the momentum to 0.9, and train for 100 epochs. The step size $\gamma$ is initialized at 0.1 and reduced by a factor of 10 at the 75-th and 90-th epochs. + +Each experiment is repeated three times, and we report the averages and standard errors in Tables 2 and 3 and Tables 8 and 9 in appendix. The results indicate that, for a fixed $\rho$ , the optimal $\lambda$ value is not always $\lambda = 0$ or $\lambda = 1$ . Overall, $\lambda_{t} = 1 - 1 / t$ appears to be a reliable choice. In particular, we observe that USAM ( $\lambda = 0$ ) does not have the best performance in any of these experiments. On the contrary in the CIFAR10 dataset the value $\lambda_{t} = 1 - 1 / t$ is a good choice while in the CIFAR100 dataset both $\lambda_{t} = 1$ and $\lambda_{t} = 1 - 1 / t$ offer strong performance. + +Table 2: Test accuracy (\%) of Unified SAM for WRN-28-10 on CIFAR10, evaluated across different values of $\rho$ and $\lambda$ . With bold we highlight the best performance for fixed $\rho$ . + +
Unified SAMλ=0.0λ=0.5λ=1.0λ=1/tλ=1-1/t
ρ=0.195.7±0.0195.68±0.1195.9±0.0895.84±0.0795.81±0.03
ρ=0.295.8±0.0595.77±0.0995.93±0.0795.71±0.1395.98±0.1
ρ=0.395.35±0.395.88±0.195.95±0.0995.68±0.0295.99±0.06
ρ=0.495.46±0.0295.76±0.195.62±0.0595.46±0.2795.79±0.07
SGD95.35±0.06
+ +Unified VaSSO. The Variance-Suppressed Sharpness-Aware Optimization (VaSSO) method, introduced in Li & Giannakis (2023), is an extension of SAM designed to reduce variance in gradient estimates. VaSSO adjusts the direction of gradient updates using a combination of past gradients and the current gradient, controlled by a parameter $\theta$ , aiming to suppress noise during training and enhance + +Table 3: Test accuracy (\%) of Unified SAM for WRN-28-10 on CIFAR100, evaluated across different values of $\rho$ and $\lambda$ . With bold we highlight the best performance for fixed $\rho$ . + +
Unified SAMλ=0.0λ=0.5λ=1.0λ=1/tλ=1-1/t
ρ=0.180.84±0.0881.01±0.1180.69±0.1180.81±0.2480.88±0.31
ρ=0.281.12±0.1881.45±0.2381.53±0.0981.31±0.2181.22±0.19
ρ=0.380.94±0.1381.64±0.1681.62±0.1681.03±0.1481.71±0.17
ρ=0.480.1±0.2281.31±0.1681.70±0.0680.39±0.0781.59±0.05
SGD79.79±0.18
+ +generalization, particularly in overparameterized models. In their work, they prove that VaSSO converges at the same asymptotic rate as SAM, under the bounded variance assumption. The update rule of VaSSO is defined as follows: $d_{t} = (1 - \theta)d_{t - 1} + \theta \nabla f_{i}(x^{t})$ , $x^{t + 1} = x^{t} - \gamma_{t}\nabla f_{i}\left(x^{t} + \rho_{t}\frac{d_{t}}{\|d_{t}\|}\right)$ . We can incorporate our unification approach, initially designed for SAM, into VaSSO. This leads to the following modified update rule: + +$$ +\begin{array}{l} d _ {t} = (1 - \theta) d _ {t - 1} + \theta \nabla f _ {i} \left(x ^ {t}\right) \\ x ^ {t + 1} = x ^ {t} - \gamma_ {t} \nabla f _ {i} \left(x ^ {t} + \rho_ {t} \left(1 - \lambda_ {t} + \frac {\lambda_ {t}}{\| d _ {t} \|}\right) d _ {t}\right) \quad \text {(U n i f i e d V a S S O)} \\ \end{array} +$$ + +Note that when $\lambda_{t} = 1$ then we recover VaSSO as introduced in Li & Giannakis (2023). + +In this section, we conduct experiments to evaluate the performance of Unified VaSSO. All models are trained for 200 epochs with a batch size of 128. A cosine scheduler is employed in all cases, with an initial step size of 0.05. The weight decay is set to 0.001. For VaSSO, we use $\theta = 0.4$ , as this value provides the best accuracy according to Li & Giannakis (2023). For the CIFAR-10 dataset, we set $\rho = 0.1$ , while for CIFAR-100, we use $\rho = 0.2$ . Each experiment is repeated three times, and we report the average of the maximum test accuracy along with the standard error. The numerical results are presented in Tables 4 and 5. + +The results show that, for the WideResNet-28-10 model the value $\lambda_{t} = 1 - 1 / t$ produces the best accuracy. For the ResNet-18 model the best values for $\lambda$ appear to be $\lambda = 0.5$ and $\lambda = 1 - 1 / t$ . Thus, the choice $\lambda_{t} = 1 - 1 / t$ appears to be a strong overall choice. In any cases, a $\lambda$ value different from 1 achieves the best performance. + +Table 4: Test accuracy (%) of Unified VaSSO on various neural networks trained on CIFAR10. + +
Modelλ = 0.0λ = 0.5λ = 1.0λ = 1/tλ = 1 - 1/t
ResNet-1896.12±0.0296.10±0.0596.22±0.1196.03±0.0496.34±0.01
WideResNet-28-1096.77±0.0796.93±0.0397.03±0.0696.71±0.0697.06±0.09
+ +Table 5: Test accuracy (%) of Unified VaSSO on various neural networks trained on CIFAR100. + +
Modelλ=0.0λ=0.5λ=1.0λ=1/tλ=1-1/t
ResNet-1879.82±0.1580.01±0.0779.76±0.0379.93±0.1379.86±0.04
WideResNet-28-1083.07±0.2583.29±0.3383.51±0.0982.83±0.1883.66±0.19
+ +# 5 CONCLUSION + +In this work, we introduced Unified SAM, an algorithm that generalizes SAM and USAM via the convex combination parameter $\lambda \in [0,1]$ . The proposed analysis relaxes the common bounded variance assumption used in previous works by employing the ER condition, which enables us to prove convergence under weaker assumptions. In particular, under the ER, we established convergence guarantees for Unified SAM for both PL and general non-convex functions, and our analysis encompasses importance sampling and tau-nice sampling. Future work could investigate the optimal value of $\lambda$ for various classes of problems, extend the unified approach to incorporate adaptive step sizes $\rho_{t}$ and $\gamma_t$ , and study Unified SAM in distributed and federated learning settings. Another promising direction is to explore how our approach may help minimize the sharpness-aware loss by employing the Hessian-regularized methods proposed by Wen et al. (2023) and Bartlett et al. (2023). + +# REFERENCES + +Maksym Andriushchenko and Nicolas Flammarion. Towards understanding sharpness-aware minimization. In ICML, 2022. +Maksym Andriushchenko, Dara Bahri, Hossein Mobahi, and Nicolas Flammarion. Sharpness-aware minimization leads to low-rank features. In NeurIPS, 2023. +Peter L Bartlett, Philip M Long, and Olivier Bousquet. The dynamics of sharpness-aware minimization: Bouncing across ravines and drifting towards wide minima. Journal of Machine Learning Research, 24(316):1-36, 2023. +Aleksandr Beznosikov, Eduard Gorbunov, Hugo Berard, and Nicolas Loizou. Stochastic gradient descent-ascent: Unified theory and new efficient methods. In AISTATS, 2023. +Sayantan Choudhury, Eduard Gorbunov, and Nicolas Loizou. Single-call stochastic extragradient methods for structured non-monotone variational inequalities: Improved analysis under weaker conditions. In NeurIPS, 2024. +Yan Dai, Kwangjun Ahn, and Suvrit Sra. The crucial role of normalization in sharpness-aware minimization. In NeurIPS, 2023. +Terrance DeVries. Improved regularization of convolutional neural networks with cutout. arXiv preprint arXiv:1708.04552, 2017. +Gintare Karolina Dziugaite and Daniel Roy. Entropy-sgd optimizes the prior of a pac-bayes bound: Generalization properties of entropy-sgd and data-dependent priors. In ICML, 2018. +Pierre Foret, Ariel Kleiner, Hossein Mobahi, and Behnam Neyshabur. Sharpness-aware minimization for efficiently improving generalization. In ICLR, 2021. +Eduard Gorbunov, Hugo Berard, Gauthier Gidel, and Nicolas Loizou. Stochastic extragradient: General analysis and improved rates. In AISTATS, 2022. +Robert Gower, Othmane Sebbouh, and Nicolas Loizou. SGD for structured nonconvex functions: Learning rates, minibatching and interpolation. In AISTATS, 2021. +Robert Mansel Gower, Nicolas Loizou, Xun Qian, Alibek Sailanbayev, Egor Shulgin, and Peter Richtárik. SGD: General analysis and improved rates. In ICML, 2019. +Hinata Harada and Hideaki Iiduka. Convergence of sharpness-aware minimization algorithms using increasing batch size and decaying learning rate. arXiv preprint arXiv:2409.09984, 2024. +Moritz Hardt, Ben Recht, and Yoram Singer. Train faster, generalize better: Stability of stochastic gradient descent. In ICML, 2016. +Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In CVPR, 2016a. +Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Identity mappings in deep residual networks. In ECCV, 2016b. +Yiding Jiang, Behnam Neyshabur, Hossein Mobahi, Dilip Krishnan, and Samy Bengio. *Fantastic generalization measures and where to find them.* In *ICLR*, 2019. +Hamed Karimi, Julie Nutini, and Mark Schmidt. Linear convergence of gradient and proximal-gradient methods under the polyak-lojasiewicz condition. In Machine Learning and Knowledge Discovery in Databases: European Conference, ECML PKDD, pp. 795-811, 2016. +Nitish Shirish Keskar, Dheevatsa Mudigere, Jorge Nocedal, Mikhail Smelyanskiy, and Ping Tak Peter Tang. On large-batch training for deep learning: Generalization gap and sharp minima. In ICLR, 2016. +Ahmed Khaled and Peter Richtárik. Better theory for sgd in the nonconvex world. arXiv preprint arXiv:2002.03329, 2020. +Ahmed Khaled, Othmane Sebbouh, Nicolas Loizou, Robert M Gower, and Peter Richtárik. Unified analysis of stochastic gradient methods for composite convex and smooth optimization. Journal of Optimization Theory and Applications, 199(2):499-540, 2023. +Pham Duy Khanh, Hoang-Chau Luong, Boris S Mordukhovich, and Dat Ba Tran. Fundamental convergence analysis of sharpness-aware minimization. arXiv preprint arXiv:2401.08060, 2024. + +Alex Krizhevsky et al. Learning Multiple Layers of Features from Tiny Images. Technical report, University of Toronto, 2009. +Yunwen Lei, Ting Hu, Guiying Li, and Ke Tang. Stochastic gradient descent for nonconvex learning without bounded gradient assumptions. IEEE transactions on neural networks and learning systems, 31(10):4394-4400, 2019. +Melanie L Lenard and Michael Minkoff. Randomly generated test problems for positive definite quadratic programming. ACM Transactions on Mathematical Software (TOMS), 10(1):86-96, 1984. +Bingcong Li and Georgios Giannakis. Enhancing sharpness-aware optimization through variance suppression. In NeurIPS, 2023. +Shengchao Liu, Dimitris Papailiopoulos, and Dimitris Achlioptas. Bad global minima exist and SGD can reach them. In NeurIPS, 2020. +Nicolas Loizou, Hugo Berard, Alexia Jolicoeur-Martineau, Pascal Vincent, Simon Lacoste-Julien, and Ioannis Mitliagkas. Stochastic hamiltonian gradient methods for smooth games. In ICML, 2020. +Stanislaw Lojasiewicz. A topological property of real analytic subsets. Coll. du CNRS, Les équations aux dérivées partielles, 117(87-89):2, 1963. +Peng Mi, Li Shen, Tianhe Ren, Yiyi Zhou, Xiaoshuai Sun, Rongrong Ji, and Dacheng Tao. Make sharpness-aware minimization stronger: A sparsified perturbation approach. In NeurIPS, 2022. +Kyunghun Nam, Jinseok Chung, and Namhoon Lee. Almost sure last iterate convergence of sharpness-aware minimization. 2023. +Behnam Neyshabur, Srinadh Bhojanapalli, David McAllester, and Nati Srebro. Exploring generalization in deep learning. In NeurIPS, 2017. +Behnam Neyshabur, Zhiyuan Li, Srinadh Bhojanapalli, Yann LeCun, and Nathan Srebro. Towards understanding the role of over-parametrization in generalization of neural networks. arXiv preprint arXiv:1805.12076, 2018. +Tianyu Pang, Xiao Yang, Yinpeng Dong, Hang Su, and Jun Zhu. Bag of tricks for adversarial training. In ICML, 2021. +Boris T Polyak. Introduction to Optimization. New York, Optimization Software, 1987. +Sungbin Shin, Dongyeop Lee, Maksym Andriushchenko, and Namhoon Lee. Analyzing sharpness-aware minimization under overparameterization. arXiv preprint arXiv:2311.17539, 2024. +Dongkuk Si and Chulhee Yun. Practical sharpness-aware minimization cannot converge all the way to optima. In NeurIPS, 2023. +Sidak Pal Singh, Hossein Mobahi, Atish Agarwala, and Yann Dauphin. Avoiding spurious sharpness minimization broadens applicability of sam. arXiv preprint arXiv:2502.02407, 2025. +Behrooz Tahmasebi, Ashkan Soleymani, Dara Bahri, Stefanie Jegelka, and Patrick Jaillet. A universal class of sharpness-aware minimization algorithms. In ICML, 2024. +Kaiyue Wen, Tengyu Ma, and Zhiyuan Li. How sharpness-aware minimization minimizes sharpness? In ICLR, 2023. +Ashia C Wilson, Rebecca Roelofs, Mitchell Stern, Nati Srebro, and Benjamin Recht. The marginal value of adaptive gradient methods in machine learning. In NeurIPS, 2017. +Dongxian Wu, Shu-Tao Xia, and Yisen Wang. Adversarial weight perturbation helps robust generalization. NeurIPS, 2020. +Wanyun Xie, Thomas Pethick, and Volkan Cevher. Sampa: Sharpness-aware minimization parallelized. In NeurIPS, 2024. +Sergey Zagoruyko and Nikos Komodakis. Wide residual networks. In British Machine Vision Conference, 2016. +Chiyuan Zhang, Samy Bengio, Moritz Hardt, Benjamin Recht, and Oriol Vinyals. Understanding deep learning requires rethinking generalization. arXiv preprint arXiv:1611.03530, 2016. +Chiyuan Zhang, Samy Bengio, Moritz Hardt, Benjamin Recht, and Oriol Vinyals. Understanding deep learning (still) requires rethinking generalization. Communications of the ACM, 64(3):107-115, 2021. + +Yihao Zhang, Hangzhou He, Jingyu Zhu, Huanran Chen, Yifei Wang, and Zeming Wei. On the duality between sharpness-aware minimization and adversarial training. In ICML, 2024. +Yaowei Zheng, Richong Zhang, and Yongyi Mao. Regularizing neural networks via adversarial model perturbation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 8156-8165, 2021. +Juntang Zhuang, Boqing Gong, Liangzhe Yuan, Yin Cui, Hartwig Adam, Nicha C. Dvornek, Sekhar Tatikonda, James S. Duncan, and Ting Liu. Surrogate gap minimization improves sharpness-aware training. In ICLR, 2022. + +# Supplementary Material + +The Supplementary Material is organized as follows: In Appendix A, we give the basic definitions and lemmas that we need for the proofs. Appendix C presents the proofs of the theoretical guarantees from the main paper. In Appendix D, we provide additional experiments. + +# CONTENTS + +1 Introduction 1 +2 Unified SAM with Arbitrary Sampling 4 + +3 Convergence Analysis 4 + +3.1 Main Assumption 5 +3.2 PL functions 5 +3.3 General non-convex functions 6 +3.4 Beyond Uniform Sampling: Importance Sampling 7 + +4 Numerical Experiments 7 + +4.1 Validation of the theory 7 +4.2 Image Classification 9 + +5 Conclusion 10 +A Technical Preliminaries 15 + +A.1 Basic Definitions 15 +A.2 Basic Lemmas 15 + +B More on the Expected Residual condition 18 +C Proofs of the main results 19 + +C.1 Proof of Theorem 3.2 19 +C.2 Proof of Theorem 3.5 22 +C.3 Proof of Proposition 3.6 23 +C.4 Proof of Theorem 3.7 24 + +D Additional Experiments 27 + +# A TECHNICAL PRELIMINARIES + +# A.1 BASIC DEFINITIONS + +In this section, we present some basic definitions we use throughout the paper. + +Definition A.1 ( $L$ -smooth). A differentiable function $f: \mathbb{R}^d \to \mathbb{R}$ is $L$ -smooth if there exists a constant $L > 0$ such that + +$$ +\| \nabla f (x) - \nabla f (y) \| \leq L \| x - y \|, \tag {2} +$$ + +or equivalently + +$$ +f (x) - f (y) \leq \langle \nabla f (y), x - y \rangle + \frac {L}{2} \| x - y \| ^ {2} +$$ + +for all $x, y \in \mathbb{R}^d$ . + +Lemma A.2. Let $f$ be an $L$ -smooth function. Then for all $x \in \mathbb{R}^n$ we have + +$$ +\| \nabla f (x) \| ^ {2} \leq 2 L [ f (x) - f ^ {\mathrm {i n f}} ]. +$$ + +Definition A.3 ( $\mu$ -PL). We say that a differentiable function $f: \mathbb{R}^d \to \mathbb{R}$ satisfies the Polyak-Lojasiewicz condition if + +$$ +\left\| \nabla f (x) \right\| ^ {2} \geq 2 \mu \left(f (x) - f \left(x ^ {*}\right)\right), \tag {3} +$$ + +for all $x\in \mathbb{R}^d$ + +Definition A.4 (Interpolation). We say that the interpolation condition holds if there exists $x^{*} \in \mathcal{X}^{*}$ such that + +$$ +\min _ {x \in \mathbb {R} ^ {n}} f _ {i} (x) = f _ {i} \left(x ^ {*}\right) +$$ + +for all $i = 1,\dots ,n$ + +Proposition A.5 (Young's Inequality). For any $a, b \in \mathbb{R}^n$ and $\beta \neq 0$ we have + +$$ +| \langle a, b \rangle | \leq \frac {1}{2 \beta} \| a \| ^ {2} + \frac {\beta}{2} \| b \| ^ {2}. \tag {4} +$$ + +Completing the square we have + +$$ +\left\| a + b \right\| ^ {2} \leq (1 + \beta^ {- 1}) \| a \| ^ {2} + (1 + \beta) \| b \| ^ {2}. \tag {5} +$$ + +For $\beta = 1$ we get + +$$ +\left\| a + b \right\| ^ {2} \leq 2 \left\| a \right\| ^ {2} + 2 \left\| b \right\| ^ {2}. \tag {6} +$$ + +# A.2 BASIC LEMMAS + +Lemma A.6. Assume that each $f_{i}$ is $L_{i}$ -smooth and consider the iterates of Unified SAM. Then it holds + +$$ +\begin{array}{l} \mathbb {E} _ {\mathcal {D}} \left\| g \left(x ^ {t} + \rho_ {t} \left(1 - \lambda_ {t} + \frac {\lambda_ {t}}{\| g (x ^ {t}) \|}\right) g (x ^ {t})\right) \right\| ^ {2} \leq 4 L _ {\max } ^ {2} \rho_ {t} ^ {2} \lambda_ {t} ^ {2} \\ + 2 \left[ 2 L _ {\max } ^ {2} \rho_ {t} ^ {2} \left(1 - \lambda_ {t}\right) ^ {2} + 1 \right] \mathbb {E} _ {\mathcal {D}} \| g (x ^ {t}) \| ^ {2}. \\ \end{array} +$$ + +Proof. We have + +$$ +\begin{array}{l} \left. \mathbb {E} _ {\mathcal {D}} \left\| g \left(x ^ {t} + \rho_ {t} \left(1 - \lambda_ {t} + \frac {\lambda_ {t}}{\| g (x ^ {t}) \|}\right) g (x ^ {t})\right) \right\| ^ {2} \right. \\ = \mathbb {E} _ {\mathcal {D}} \left\| g \left(x ^ {t} + \rho_ {t} \left(1 - \lambda_ {t} + \frac {\lambda_ {t}}{\| g (x ^ {t}) \|}\right) g (x ^ {t})\right) - g (x ^ {t}) + g (x ^ {t}) \right\| ^ {2} \\ \stackrel {(6)} {\leq} 2 \mathbb {E} _ {\mathcal {D}} \left\| g \left(x ^ {t} + \rho_ {t} \left(1 - \lambda_ {t} + \frac {\lambda_ {t}}{\| g (x ^ {t}) \|}\right) g (x ^ {t})\right) - g (x ^ {t}) \right\| ^ {2} + 2 \mathbb {E} _ {\mathcal {D}} \| g (x ^ {t}) \| ^ {2} \\ \stackrel {(2)} {\leq} 2 L _ {\max } ^ {2} \rho_ {t} ^ {2} \mathbb {E} _ {\mathcal {D}} \left\| (1 - \lambda_ {t}) g (x ^ {t}) + \frac {\lambda_ {t}}{\| g (x ^ {t}) \|} g (x ^ {t}) \right\| ^ {2} + 2 \mathbb {E} _ {\mathcal {D}} \| g (x ^ {t}) \| ^ {2} \\ \stackrel {(6)} {\leq} 4 L _ {\max } ^ {2} \rho_ {t} ^ {2} (1 - \lambda_ {t}) ^ {2} \mathbb {E} _ {\mathcal {D}} \| g (x ^ {t}) \| ^ {2} + 4 L _ {\max } ^ {2} \rho_ {t} ^ {2} \lambda_ {t} ^ {2} + 2 \mathbb {E} _ {\mathcal {D}} \| g (x ^ {t}) \| ^ {2} \\ = 4 L _ {\max } ^ {2} \rho_ {t} ^ {2} \lambda_ {t} ^ {2} + 2 \left[ 2 L _ {\max } ^ {2} \rho_ {t} ^ {2} \left(1 - \lambda_ {t}\right) ^ {2} + 1 \right] \mathbb {E} _ {\mathcal {D}} \| g (x ^ {t}) \| ^ {2}. \\ \end{array} +$$ + +This completes the proof. + +![](images/786ff48b00314e77ad948cc0807a0ab35495f035e045d0922e631190af101b47.jpg) + +Lemma A.7. Assume that each $f_{i}$ is $L_{i}$ -smooth and consider the iterates of Unified SAM. Then for any $\beta > 0$ it holds + +$$ +\begin{array}{l} \mathbb {E} _ {\mathcal {D}} \left\langle g \left(x ^ {t} + \rho_ {t} \left(1 - \lambda_ {t} + \frac {\lambda_ {t}}{\| g (x ^ {t}) \|}\right) g (x ^ {t})\right), \nabla f (x ^ {t}) \right\rangle \geq \left(1 - \frac {\beta}{2}\right) \| \nabla f (x ^ {t}) \| ^ {2} - \frac {L _ {\max } ^ {2} \rho_ {t} ^ {2} \lambda_ {t} ^ {2}}{\beta} \\ - \frac {L _ {\operatorname* {m a x}} ^ {2} \rho_ {t} ^ {2} (1 - \lambda_ {t}) ^ {2}}{\beta} \mathbb {E} _ {\mathcal {D}} \| g (x ^ {t}) \| ^ {2}. \\ \end{array} +$$ + +In particular, for $\beta = L_{\mathrm{max}}\rho_t$ we get + +$$ +\begin{array}{l} \mathbb {E} _ {\mathcal {D}} \left\langle g \left(x ^ {t} + \rho_ {t} \left(1 - \lambda_ {t} + \frac {\lambda_ {t}}{\| g (x ^ {t}) \|}\right) g (x ^ {t})\right), \nabla f (x ^ {t}) \right\rangle \geq \left(1 - \frac {L _ {\max} \rho_ {t}}{2}\right) \| \nabla f (x ^ {t}) \| ^ {2} \\ - L _ {\max} \rho_ {t} \lambda_ {t} ^ {2} \\ - L _ {\max } \rho_ {t} (1 - \lambda_ {t}) ^ {2} \mathbb {E} _ {\mathcal {D}} \| g (x ^ {t}) \| ^ {2}. \\ \end{array} +$$ + +Proof. We have + +$$ +\begin{array}{l} \mathbb {E} _ {\mathcal {D}} \left\langle g \left(x ^ {t} + \rho_ {t} \left(1 - \lambda_ {t} + \frac {\lambda_ {t}}{\| g (x ^ {t}) \|}\right) g (x ^ {t})\right), \nabla f (x ^ {t}) \right\rangle \\ = \mathbb {E} _ {\mathcal {D}} \left\langle g \left(x ^ {t} + \rho_ {t} \left(1 - \lambda_ {t} + \frac {\lambda_ {t}}{\| g (x ^ {t}) \|}\right) g (x ^ {t})\right) - g (x ^ {t}), \nabla f (x ^ {t}) \right\rangle \\ + \mathbb {E} _ {\mathcal {D}} \langle g (x ^ {t}), \nabla f (x ^ {t}) \rangle \\ = \mathbb {E} _ {\mathcal {D}} \left\langle g \left(x ^ {t} + \rho_ {t} \left(1 - \lambda_ {t} + \frac {\lambda_ {t}}{\| g (x ^ {t}) \|}\right) g (x ^ {t})\right) - g (x ^ {t}), \nabla f (x ^ {t}) \right\rangle + \| \nabla f (x ^ {t}) \| ^ {2}. \\ \end{array} +$$ + +Now + +$$ +\begin{array}{l} \left. - \mathbb {E} _ {\mathcal {D}} \left\langle g \left(x ^ {t} + \rho_ {t} \left(1 - \lambda_ {t} + \frac {\lambda_ {t}}{\| g (x ^ {t}) \|}\right) g (x ^ {t})\right) - g (x ^ {t}), \nabla f (x ^ {t}) \right\rangle \right. \\ \stackrel {(4)} {\leq} \frac {1}{2 \beta} \mathbb {E} _ {\mathcal {D}} \left\| g \left(x ^ {t} + \rho_ {t} \left(1 - \lambda_ {t} + \frac {\lambda_ {t}}{\| g (x ^ {t}) \|}\right) g (x ^ {t})\right) - g (x ^ {t}) \right\| ^ {2} \\ + \frac {\beta}{2} \mathbb {E} _ {\mathcal {D}} \| \nabla f (x ^ {t}) \| ^ {2} \\ \stackrel {(2)} {\leq} \frac {L _ {\operatorname* {m a x}} ^ {2} \rho_ {t} ^ {2}}{2 \beta} \mathbb {E} _ {\mathcal {D}} \left\| (1 - \lambda_ {t}) g (x ^ {t}) + \frac {\lambda_ {t}}{\| g (x ^ {t}) \|} g (x ^ {t}) \right\| ^ {2} + \frac {\beta}{2} \| \nabla f (x ^ {t}) \| ^ {2} \\ \stackrel {(6)} {\leq} \frac {L _ {\operatorname* {m a x}} ^ {2} \rho_ {t} ^ {2}}{2 \beta} 2 (1 - \lambda_ {t}) ^ {2} \mathbb {E} _ {\mathcal {D}} \| g (x ^ {t}) \| ^ {2} + \frac {L _ {\operatorname* {m a x}} ^ {2} \rho_ {t} ^ {2}}{2 \beta} 2 \lambda_ {t} ^ {2} + \frac {\beta}{2} \| \nabla f (x ^ {t}) \| ^ {2} \\ \end{array} +$$ + +$$ += \frac {L _ {\mathrm {m a x}} ^ {2} \rho_ {t} ^ {2} \lambda_ {t} ^ {2}}{\beta} + \frac {L _ {\mathrm {m a x}} ^ {2} \rho_ {t} ^ {2} (1 - \lambda_ {t}) ^ {2}}{\beta} \mathbb {E} _ {\mathcal {D}} \| g (x ^ {t}) \| ^ {2} + \frac {\beta}{2} \| \nabla f (x ^ {t}) \| ^ {2}, +$$ + +thus + +$$ +\begin{array}{l} \mathbb {E} _ {\mathcal {D}} \left\langle g (x ^ {t} + \rho_ {t} \left(1 - \lambda_ {t} + \frac {\lambda_ {t}}{\| g (x ^ {t}) \|}\right) g (x ^ {t})) \right., \nabla f (x ^ {t}) \Bigg \rangle \geq - \frac {L _ {\max } ^ {2} \rho_ {t} ^ {2} (1 - \lambda_ {t}) ^ {2}}{\beta} \mathbb {E} _ {\mathcal {D}} \| g (x ^ {t}) \| ^ {2} \\ - \frac {L _ {\operatorname* {m a x}} ^ {2} \rho_ {t} ^ {2} \lambda_ {t} ^ {2}}{\beta} - \frac {\beta}{2} \| \nabla f (x ^ {t}) \| ^ {2} \\ + \left\| \nabla f (x ^ {t}) \right\| ^ {2} \\ = \left(1 - \frac {\beta}{2}\right) \| \nabla f (x ^ {t}) \| ^ {2} - \frac {L _ {\operatorname* {m a x}} ^ {2} \rho_ {t} ^ {2} \lambda_ {t} ^ {2}}{\beta} \\ - \frac {L _ {\operatorname* {m a x}} ^ {2} \rho_ {t} ^ {2} (1 - \lambda_ {t}) ^ {2}}{\beta} \mathbb {E} _ {\mathcal {D}} \| g (x ^ {t}) \| ^ {2}. \\ \end{array} +$$ + +This completes the proof. + +![](images/16331d91238c6c449665069d256c97df1ccc8c5b581b7a480bb3495a896967c4.jpg) + +Lemma A.8. Let $(r_t)_{t\geq 0}$ and $(\delta_t)_{t\geq 0}$ be sequences of non-negative real numbers and let $g > 1$ and $N\geq 0$ . Assume that the following recursive relationship holds: + +$$ +r _ {t} \leq g \delta_ {t} - \delta_ {t + 1} + N \tag {7} +$$ + +Then it holds + +$$ +\min _ {0 \leq t \leq T - 1} r _ {t} \leq \frac {g ^ {T}}{T} \delta_ {0} + N. +$$ + +Proof. Set $g_{t} = g^{-t}$ for any $t \in \mathbb{Z}$ . Then multiply both sides of (7) with $g_{t}$ . This yields + +$$ +g _ {t} r _ {t} \leq g _ {t - 1} \delta_ {t} - g _ {t} \delta_ {t + 1} + N g _ {t}. +$$ + +Summing for $t = 0, \ldots, T$ and telescoping we get + +$$ +\sum_ {t = 0} ^ {T - 1} g _ {t} r _ {t} \leq g _ {- 1} \delta_ {0} - g _ {T - 1} \delta_ {T} + N \sum_ {t = 0} ^ {T - 1} g _ {t} +$$ + +$$ +\leq g _ {- 1} \delta_ {0} + N \sum_ {t = 0} ^ {T - 1} g _ {t}. \tag {8} +$$ + +Now let $G = \sum_{t=0}^{T-1} g_t$ . Note that the sequence $(g_t)$ is decreasing for $t \geq 0$ , thus $G \geq T g_{T-1}$ . Now dividing (8) by $G$ we get + +$$ +\begin{array}{l} \min _ {0 \leq t \leq T - 1} r _ {t} \leq \frac {1}{G} \sum_ {t = 0} ^ {T - 1} g _ {t} r _ {t} \\ \leq \frac {g _ {- 1} \delta_ {0}}{G} + N \\ \leq \frac {g _ {- 1} \delta_ {0}}{T g _ {T - 1}} + N \\ = \frac {g ^ {T} \delta_ {0}}{T} + N. \\ \end{array} +$$ + +This completes the proof. + +![](images/dec369c986b0fdd999bc47dbdf7f48248b24e8a798ff3d51e194daa6c6a5c2d6.jpg) + +# B MORE ON THE EXPECTED RESIDUAL CONDITION + +In this section, we introduce several assumptions under which ER is automatically satisfied. Similar derivations are provided in Khaled & Richtárik (2020), where the authors focus on the analysis of SGD. Specifically, we consider the following cases: + +Assuming bounded gradients, i.e. + +$$ +\mathbb {E} _ {\mathcal {D}} \| g (x) \| ^ {2} \leq \sigma^ {2}, \quad \forall x \in \mathbb {R} ^ {n}, +$$ + +then the ER holds with $A = 0$ , $B = 0$ , $C = \sigma^2$ . + +Assuming bounded variance, i.e. + +$$ +\mathbb {E} _ {\mathcal {D}} \| g (x) - \nabla f (x) \| \leq \sigma^ {2}, \quad \forall x \in \mathbb {R} ^ {n}, +$$ + +then the ER holds with $A = 0$ , $B = 1$ , $C = \sigma^2$ . + +Assuming expected smoothness, i.e. + +$$ +\mathbb {E} _ {\mathcal {D}} \| g (x) - \nabla f (x) \| \leq 2 \mathcal {L} [ f (x) - f ^ {\inf } ], \quad \forall x \in \mathbb {R} ^ {n}, +$$ + +then the ER holds with $A = 2\mathcal{L}$ , $B = 0$ , $C = 0$ . + +- Assuming the relaxed strong growth condition, i.e. + +$$ +\mathbb {E} _ {\mathcal {D}} \| g (x) \| \leq \rho \| \nabla f (x) \| + \sigma^ {2}, \quad \forall x \in \mathbb {R} ^ {n}, +$$ + +then the ER holds with $A = 0$ , $B = \rho$ , $C = \sigma^2$ . + +- Assuming the relaxed strong growth condition, i.e. + +$$ +\mathbb {E} _ {\mathcal {D}} \| g (x) \| \leq \alpha [ f (x) - f ^ {\inf } ] + \sigma^ {2}, \quad \forall x \in \mathbb {R} ^ {n}, +$$ + +then the ER holds with $A = \alpha$ , $B = 0$ , $C = \sigma^2$ . + +Additionally, if we have more information about the problem and the distribution $\mathcal{D}$ , we can derive stronger bounds on $A$ , $B$ , and $C$ . The more assumptions we make, the tighter these bounds become, as demonstrated in the following propositions. + +Proposition B.1 (Prop. 2, (Khaled & Richtárik, 2020)). Assume that each $f_{i}$ is $L_{i}$ -smooth and that $\mathbb{E}_{\mathcal{D}}[v_i^2] < \infty$ for all $i \in [n]$ . Let $\sigma^{*} = \frac{1}{n}\sum_{i=1}^{n}f_{i}(x^{*}) - f_{i}^{*} \geq 0$ , where $f_{i}^{*} = \inf_{x \in \mathbb{R}^{n}}f_{i}(x)$ . Then ER holds with $A = \max_{i}L_{i}\mathbb{E}_{\mathcal{D}}[v_{i}^{2}]$ , $B = 0$ and $C = 2A\sigma^{*}$ . + +This proposition indicates that if each $f_{i}$ is $L_{i}$ -smooth and minimal assumptions hold for the distribution $\mathcal{D}$ , then ER is satisfied. As an immediate corollary of Proposition B.1, if the problem further satisfies the interpolation assumption (see Definition A.4), then $C = 0$ . The next proposition gives tighter constants for $A$ , $B$ , and $C$ in the context of the sampling strategies considered in this paper. + +Proposition B.2 (Prop. 3, (Khaled & Richtárik, 2020)). Assume that each $f_{i}$ is $L_{i}$ -smooth. + +1. For the single element sampling $ER$ holds with $A = \frac{1}{n\tau}\max_{i}\frac{L_i}{p_i}$ , $B = 0$ and $C = 2A\sigma^{*}$ . +2. For the $\tau$ -nice sampling ER holds with $A = \frac{n - \tau}{\tau(n - 1)} L_{\max}$ , $B = \frac{n(\tau - 1)}{\tau(n - 1)}$ and $C = 2A\sigma^{*}$ where $L_{\max} = \max_i L_i$ . + +Lastly, if we assume $x^{*}$ -convexity with $\tau$ -nice sampling, we obtain the following constants: + +Proposition B.3 (Prop. 3.3, (Gower et al., 2021)). Assume that each $f_{i}$ is $L_{i}$ -smooth and that there exists $x^{*} \in \mathcal{X}^{*}$ such that $f_{i}$ is $x^{*}$ -convex. In addition, assume that $\mathcal{D}$ is the $\tau$ -nice sampling. Then ER holds with $A = \frac{n - \tau}{\tau(n - 1)} L_{\max}, B = 1$ and $C = \frac{2(n - \tau)}{\tau(n - 1)} \sigma_1$ , where $\sigma_{1} = \sup_{x^{*} \in \mathcal{X}^{*}} \frac{1}{n} \sum_{i=1}^{n} \| \nabla f_{i}(x^{*}) \|^{2}$ . + +# C PROOFS OF THE MAIN RESULTS + +In this section we present the proofs of the main theoretical results presented in the main paper, i.e., the convergence guarantees of Unified SAM for PL and smooth functions and general non-convex and smooth functions. We restate the main theorems here for completeness. + +In all cases, we use the convention $1 / 0 = \infty$ + +# C.1 PROOF OF THEOREM 3.2 + +Theorem C.1. Assume that each $f_{i}$ is $L_{i}$ -smooth, $f$ is $\mu$ -PL and the ER is satisfied. Set $L_{\max} = \max_{i \in [n]} L_{i}$ . Then the iterates of Unified SAM with + +$$ +\rho_ {t} = \rho \leq \rho^ {*} := \frac {\mu}{L _ {\max} (\mu + 2 [ B \mu + A ] (1 - \lambda) ^ {2})}, \gamma_ {t} = \gamma \leq \gamma^ {*} := \frac {\mu - L _ {\max} \rho (\mu + 2 [ B \mu + A ] (1 - \lambda) ^ {2})}{2 L _ {\max} (B \mu + A) [ 2 L _ {\max} ^ {2} \rho^ {2} (1 - \lambda) ^ {2} + 1 ]}, +$$ + +satisfy: + +$$ +\mathbb {E} [ f (x ^ {t}) - f (x ^ {*}) ] \leq (1 - \gamma \mu) ^ {t} \left[ f (x ^ {0}) - f (x ^ {*}) \right] + N, +$$ + +where $N = \frac{L_{\mathrm{max}}}{\mu}\left(C\gamma +\rho (1 + 2\gamma L_{\mathrm{max}}^2\rho)\left[\lambda^2 +C(1 - \lambda)^2\right]\right)$ + +Proof of Theorem 3.2. By combining the smoothness of function $f$ with the update rule of Unified SAM we obtain: + +$$ +\begin{array}{l} f (x ^ {t + 1}) \leq f (x ^ {t}) + \langle \nabla f (x ^ {t}), x ^ {t + 1} - x ^ {t} \rangle + \frac {L _ {\max}}{2} \| x ^ {t + 1} - x ^ {t} \| ^ {2} \\ = f (x ^ {t}) - \gamma_ {t} \left\langle \nabla f (x ^ {t}), g \left(x ^ {t} + \rho_ {t} \left(1 - \lambda_ {t} + \frac {\lambda_ {t}}{\| g (x ^ {t}) \|}\right) g (x ^ {t})\right) \right\rangle \\ + \frac {L _ {\mathrm {m a x}} \gamma_ {t} ^ {2}}{2} \left\| g \left(x ^ {t} + \rho_ {t} \left(1 - \lambda_ {t} + \frac {\lambda_ {t}}{\| g (x ^ {t}) \|}\right) g (x ^ {t})\right) \right\| ^ {2}. \\ \end{array} +$$ + +By taking expectation conditioned on $x^t$ we obtain: + +$$ +\begin{array}{l} \mathbb {E} \left[ f \left(x ^ {t + 1}\right) - f \left(x ^ {*}\right) \mid x ^ {t} \right] - \left[ f \left(x ^ {t}\right) - f \left(x ^ {*}\right) \right] \\ \leq - \gamma_ {t} \mathbb {E} _ {\mathcal {D}} \left\langle g \left(x ^ {t} + \rho_ {t} \left(1 - \lambda_ {t} + \frac {\lambda_ {t}}{\| g (x ^ {t}) \|}\right) g (x ^ {t})\right), \nabla f (x ^ {t}) \right\rangle \\ + \frac {L _ {\operatorname* {m a x}} \gamma_ {t} ^ {2}}{2} \mathbb {E} _ {\mathcal {D}} \left\| g \left(x ^ {t} + \rho_ {t} \left(1 - \lambda_ {t} + \frac {\lambda_ {t}}{\| g (x ^ {t}) \|}\right) g (x ^ {t})\right) \right\| ^ {2} \\ \end{array} +$$ + +$\begin{array}{r}\mathrm{Lem. A.6 and A.7}\\ \leq -\gamma_t\left[\left(1 - \frac{L_{\max}\rho_t}{2}\right)\| \nabla f(x^t)\| ^2 -L_{\max}\rho_t\lambda_t^2 -L_{\max}\rho_t(1 - \lambda_t)^2\mathbb{E}_{\mathcal{D}}\| g(x^t)\| ^2\right] \end{array}$ + +$$ +\begin{array}{l} + \frac {\gamma_ {t} ^ {2} L _ {\mathrm {m a x}}}{2} \left[ 4 L _ {\mathrm {m a x}} ^ {2} \rho_ {t} ^ {2} \lambda_ {t} ^ {2} + 2 \left[ 2 L _ {\mathrm {m a x}} ^ {2} \rho_ {t} ^ {2} (1 - \lambda_ {t}) ^ {2} + 1 \right] \mathbb {E} _ {\mathcal {D}} \| g (x ^ {t}) \| ^ {2} \right] \\ = - \gamma_ {t} \left(1 - \frac {L _ {\operatorname* {m a x}} \rho_ {t}}{2}\right) \| \nabla f (x ^ {t}) \| ^ {2} \\ + \gamma_ {t} L _ {\max } \left[ \rho_ {t} \left(1 - \lambda_ {t}\right) ^ {2} + 2 \gamma_ {t} L _ {\max } ^ {2} \rho_ {t} ^ {2} \left(1 - \lambda_ {t}\right) ^ {2} + \gamma_ {t} \right] \mathbb {E} _ {\mathcal {D}} \| g (x ^ {t}) \| ^ {2} \\ + \gamma_ {t} L _ {\max } \rho_ {t} \lambda_ {t} ^ {2} \left(1 + 2 \gamma_ {t} L _ {\max } ^ {2} \rho_ {t}\right) \\ \end{array} +$$ + +$$ +\begin{array}{l} \stackrel {E R} {\leq} - \gamma_ {t} \left(1 - \frac {L _ {\operatorname* {m a x}} \rho_ {t}}{2}\right) \| \nabla f (x ^ {t}) \| ^ {2} \\ + 2 A \gamma_ {t} L _ {\max } \left[ \rho_ {t} (1 - \lambda_ {t}) ^ {2} + 2 \gamma_ {t} L _ {\max } ^ {2} \rho_ {t} ^ {2} (1 - \lambda_ {t}) ^ {2} + \gamma_ {t} \right] \left[ f \left(x ^ {t}\right) - f \left(x ^ {*}\right) \right] \\ + B \gamma_ {t} L _ {\max } \left[ \rho_ {t} (1 - \lambda_ {t}) ^ {2} + 2 \gamma_ {t} L _ {\max } ^ {2} \rho_ {t} ^ {2} (1 - \lambda_ {t}) ^ {2} + \gamma_ {t} \right] \| \nabla f (x ^ {t}) \| ^ {2} \\ + C \gamma_ {t} L _ {\mathrm {m a x}} \left[ \rho_ {t} (1 - \lambda_ {t}) ^ {2} + 2 \gamma_ {t} L _ {\mathrm {m a x}} ^ {2} \rho_ {t} ^ {2} (1 - \lambda_ {t}) ^ {2} + \gamma_ {t} \right] + \gamma_ {t} L _ {\mathrm {m a x}} \rho_ {t} \lambda_ {t} ^ {2} (1 + 2 \gamma_ {t} L _ {\mathrm {m a x}} ^ {2} \rho_ {t}) \\ = - \gamma_ {t} \left(1 - \frac {L _ {\mathrm {m a x}} \rho_ {t}}{2} - B L _ {\mathrm {m a x}} \left[ \rho_ {t} (1 - \lambda_ {t}) ^ {2} + 2 \gamma_ {t} L _ {\mathrm {m a x}} ^ {2} \rho_ {t} ^ {2} (1 - \lambda_ {t}) ^ {2} + \gamma_ {t} \right]\right) \| \nabla f (x ^ {t}) \| ^ {2} \\ \end{array} +$$ + +$$ +\begin{array}{l} + 2 A \gamma_ {t} L _ {\max } \left[ \rho_ {t} (1 - \lambda_ {t}) ^ {2} + 2 \gamma_ {t} L _ {\max } ^ {2} \rho_ {t} ^ {2} (1 - \lambda_ {t}) ^ {2} + \gamma_ {t} \right] \left[ f (x ^ {t}) - f (x ^ {*}) \right] \\ + \gamma_ {t} L _ {\max } \left[ C \rho_ {t} \left(1 - \lambda_ {t}\right) ^ {2} + 2 C \gamma_ {t} L _ {\max } ^ {2} \rho_ {t} ^ {2} \left(1 - \lambda_ {t}\right) ^ {2} + C \gamma_ {t} + \rho_ {t} \lambda_ {t} ^ {2} + 2 \gamma_ {t} L _ {\max } ^ {2} \rho_ {t} ^ {2} \lambda_ {t} ^ {2} \right]. \tag {9} \\ \end{array} +$$ + +In order to use the fact that is $\mu$ -PL we need to ensure that the coefficient of $\| \nabla f(x^t) \|^2$ is non-negative. For this we have + +$$ +1 - \frac {L _ {\mathrm {m a x}} \rho_ {t}}{2} - B L _ {\mathrm {m a x}} \left[ \rho_ {t} (1 - \lambda_ {t}) ^ {2} + 2 \gamma_ {t} L _ {\mathrm {m a x}} ^ {2} \rho_ {t} ^ {2} (1 - \lambda_ {t}) ^ {2} + \gamma_ {t} \right] \geq 0 \Leftrightarrow +$$ + +$$ +\frac {L _ {\mathrm {m a x}} \rho_ {t}}{2} + B L _ {\mathrm {m a x}} \rho_ {t} (1 - \lambda_ {t}) ^ {2} + B L _ {\mathrm {m a x}} \gamma_ {t} \left(2 L _ {\mathrm {m a x}} ^ {2} \rho_ {t} ^ {2} (1 - \lambda_ {t}) ^ {2} + 1\right) \leq 1 +$$ + +Solving for $\gamma_{t}$ we get + +$$ +\gamma_ {t} \leq \frac {2 - L _ {\max} \rho_ {t} - 2 B L _ {\max} \rho_ {t} (1 - \lambda_ {t}) ^ {2}}{2 B L _ {\max} \left(2 L _ {\max} ^ {2} \rho_ {t} ^ {2} (1 - \lambda_ {t}) ^ {2} + 1\right)}. \tag {10} +$$ + +The numerator of the upper bound on $\gamma_{t}$ in (10) must be positive (positive step-size). For this, the following restriction on $\rho_{t}$ is needed. + +$$ +2 - L _ {\max } \rho_ {t} - 2 B L _ {\max } \rho_ {t} \left(1 - \lambda_ {t}\right) ^ {2} \geq 0 \Leftrightarrow \rho_ {t} \leq \frac {2}{L _ {\max } \left(1 + 2 B \left(1 - \lambda_ {t}\right) ^ {2}\right)}. \tag {11} +$$ + +Now using the $\mu$ -PL condition (3) on (9) we get + +$$ +\begin{array}{l} \mathbb {E} \left[ f \left(x ^ {t + 1}\right) - f \left(x ^ {*}\right) \mid x ^ {t} \right] - \left[ f \left(x ^ {t}\right) - f \left(x ^ {*}\right) \right] \\ \leq - 2 \gamma_ {t} \mu \left(1 - \frac {L _ {\operatorname* {m a x}} \rho_ {t}}{2} - B L _ {\operatorname* {m a x}} \left[ \rho_ {t} (1 - \lambda_ {t}) ^ {2} + 2 \gamma_ {t} L _ {\operatorname* {m a x}} ^ {2} \rho_ {t} ^ {2} (1 - \lambda_ {t}) ^ {2} + \gamma_ {t} \right]\right) [ f (x ^ {t}) - f (x ^ {*}) ] \\ + 2 A \gamma_ {t} L _ {\max } \left[ \rho_ {t} (1 - \lambda_ {t}) ^ {2} + 2 \gamma_ {t} L _ {\max } ^ {2} \rho_ {t} ^ {2} (1 - \lambda_ {t}) ^ {2} + \gamma_ {t} \right] \left[ f \left(x ^ {t}\right) - f \left(x ^ {*}\right) \right] \\ + \gamma_ {t} L _ {\max } \left[ C \rho_ {t} \left(1 - \lambda_ {t}\right) ^ {2} + 2 C \gamma_ {t} L _ {\max } ^ {2} \rho_ {t} ^ {2} \left(1 - \lambda_ {t}\right) ^ {2} + C \gamma_ {t} + \rho_ {t} \lambda_ {t} ^ {2} + 2 \gamma_ {t} L _ {\max } ^ {2} \rho_ {t} ^ {2} \lambda_ {t} ^ {2} \right], \\ \end{array} +$$ + +hence + +$$ +\begin{array}{l} \mathbb {E} \left[ f \left(x ^ {t + 1}\right) - f \left(x ^ {*}\right) \mid x ^ {t} \right] \\ \leq \left(1 - 2 \gamma_ {t} \mu \left(1 - \frac {L _ {\max} \rho_ {t}}{2} - B L _ {\max} \left[ \rho_ {t} (1 - \lambda_ {t}) ^ {2} + 2 \gamma_ {t} L _ {\max} ^ {2} \rho_ {t} ^ {2} (1 - \lambda_ {t}) ^ {2} + \gamma_ {t} \right]\right) \right. \\ \left. + 2 A \gamma_ {t} L _ {\max } \left[ \rho_ {t} (1 - \lambda_ {t}) ^ {2} + 2 \gamma_ {t} L _ {\max } ^ {2} \rho_ {t} ^ {2} (1 - \lambda_ {t}) ^ {2} + \gamma_ {t} \right]\right) \left[ f \left(x ^ {t}\right) - f \left(x ^ {*}\right) \right] \\ + \gamma_ {t} L _ {\max } \left[ C \rho_ {t} (1 - \lambda_ {t}) ^ {2} + 2 C \gamma_ {t} L _ {\max } ^ {2} \rho_ {t} ^ {2} (1 - \lambda_ {t}) ^ {2} + C \gamma_ {t} + \rho_ {t} \lambda_ {t} ^ {2} + 2 \gamma_ {t} L _ {\max } ^ {2} \rho_ {t} ^ {2} \lambda_ {t} ^ {2} \right]. \tag {12} \\ \end{array} +$$ + +The coefficient of $[f(x^t) - f(x^*)]$ can be simplified to + +$$ +\begin{array}{l} 1 - 2 \gamma_ {t} \mu \left(1 - \frac {L _ {\operatorname* {m a x}} \rho_ {t}}{2} - B L _ {\operatorname* {m a x}} \left[ \rho_ {t} (1 - \lambda_ {t}) ^ {2} + 2 \gamma_ {t} L _ {\operatorname* {m a x}} ^ {2} \rho_ {t} ^ {2} (1 - \lambda_ {t}) ^ {2} + \gamma_ {t} \right]\right) \\ + 2 A \gamma_ {t} L _ {\max } \left[ \rho_ {t} (1 - \lambda_ {t}) ^ {2} + 2 \gamma_ {t} L _ {\max } ^ {2} \rho_ {t} ^ {2} (1 - \lambda_ {t}) ^ {2} + \gamma_ {t} \right] \\ = 1 - 2 \gamma_ {t} \mu + \gamma_ {t} \mu L _ {\max } \rho_ {t} + 2 \gamma_ {t} \mu B L _ {\max } \left[ \rho_ {t} \left(1 - \lambda_ {t}\right) ^ {2} + 2 \gamma_ {t} L _ {\max } ^ {2} \rho_ {t} ^ {2} \left(1 - \lambda_ {t}\right) ^ {2} + \gamma_ {t} \right] \\ + 2 A \gamma_ {t} L _ {\max } \left[ \rho_ {t} \left(1 - \lambda_ {t}\right) ^ {2} + 2 \gamma_ {t} L _ {\max } ^ {2} \rho_ {t} ^ {2} \left(1 - \lambda_ {t}\right) ^ {2} + \gamma_ {t} \right] \\ = 1 - 2 \gamma_ {t} \mu + \gamma_ {t} \mu L _ {\max } \rho_ {t} + 2 \gamma_ {t} L _ {\max } (B \mu + A) \left[ \rho_ {t} (1 - \lambda_ {t}) ^ {2} + 2 \gamma_ {t} L _ {\max } ^ {2} \rho_ {t} ^ {2} (1 - \lambda_ {t}) ^ {2} + \gamma_ {t} \right] \\ = 1 - 2 \gamma_ {t} \mu + \gamma_ {t} L _ {\max } \rho_ {t} \left(\mu + 2 (B \mu + A) \left(1 - \lambda_ {t}\right) ^ {2}\right) + 2 \gamma_ {t} ^ {2} L _ {\max } \left(B \mu + A\right) \left(2 L _ {\max } ^ {2} \rho_ {t} ^ {2} \left(1 - \lambda_ {t}\right) ^ {2} + 1\right) \\ \end{array} +$$ + +Let us bound the above coefficient by $1 - \gamma_{t}\mu$ (used for the final linear convergence). For doing that, we force the following restrictions for $\rho_{t}$ and $\gamma_{t}$ : + +$$ +\begin{array}{l} 1 - 2 \gamma_ {t} \mu + \gamma_ {t} L _ {\max } \rho_ {t} \left(\mu + 2 (B \mu + A) (1 - \lambda_ {t}) ^ {2}\right) \\ + 2 \gamma_ {t} ^ {2} L _ {\mathrm {m a x}} (B \mu + A) \left(2 L _ {\mathrm {m a x}} ^ {2} \rho_ {t} ^ {2} (1 - \lambda_ {t}) ^ {2} + 1\right) \leq 1 - \gamma_ {t} \mu \Leftrightarrow \\ \end{array} +$$ + +$$ +\begin{array}{l} \gamma_ {t} L _ {\max } \rho_ {t} (\mu + 2 (B \mu + A) (1 - \lambda_ {t}) ^ {2}) \\ + 2 \gamma_ {t} ^ {2} L _ {\max } (B \mu + A) \left(2 L _ {\max } ^ {2} \rho_ {t} ^ {2} (1 - \lambda_ {t}) ^ {2} + 1\right) \leq \gamma_ {t} \mu \Leftrightarrow \\ \end{array} +$$ + +$$ +\begin{array}{l} L _ {\max } \rho_ {t} (\mu + 2 (B \mu + A) (1 - \lambda_ {t}) ^ {2}) \\ + 2 \gamma_ {t} L _ {\max } (B \mu + A) \left(2 L _ {\max } ^ {2} \rho_ {t} ^ {2} (1 - \lambda_ {t}) ^ {2} + 1\right) \leq \mu \Leftrightarrow \\ \end{array} +$$ + +$$ +2 \gamma_ {t} L _ {\max} (B \mu + A) \left(2 L _ {\max} ^ {2} \rho_ {t} ^ {2} (1 - \lambda_ {t}) ^ {2} + 1\right) \leq \mu - L _ {\max} \rho_ {t} \left(\mu + 2 (B \mu + A) (1 - \lambda_ {t}) ^ {2}\right) \Leftrightarrow +$$ + +$$ +\gamma_ {t} \leq \frac {\mu - L _ {\max} \rho_ {t} \left(\mu + 2 \left(B \mu + A\right) \left(1 - \lambda_ {t}\right) ^ {2}\right)}{2 L _ {\max} \left(B \mu + A\right) \left(2 L _ {\max } ^ {2} \rho_ {t} ^ {2} \left(1 - \lambda_ {t}\right) ^ {2} + 1\right)}. \tag {13} +$$ + +The numerator of the upper bound on $\gamma_{t}$ in (13) must be positive (as the step-size is positive). Thus: + +$$ +\mu - L _ {\max } \rho_ {t} (\mu + 2 (B \mu + A) (1 - \lambda_ {t}) ^ {2}) \geq 0 \Leftrightarrow \rho_ {t} \leq \frac {\mu}{L _ {\max } (\mu + 2 (B \mu + A) (1 - \lambda_ {t}) ^ {2})}. \tag {14} +$$ + +Now by combining Equations (11) and (14) we obtain: + +$$ +\begin{array}{l} \rho_ {t} \leq \rho^ {*} = \min \left\{\frac {2}{L _ {\max} (1 + 2 B (1 - \lambda_ {t}) ^ {2})}, \frac {\mu}{L _ {\max} (\mu + 2 (B \mu + A) (1 - \lambda_ {t}) ^ {2})} \right\} \\ = \frac {\mu}{L _ {\mathrm {m a x}} (\mu + 2 (B \mu + A) (1 - \lambda_ {t}) ^ {2})}, \\ \end{array} +$$ + +where last equality holds due to: + +$$ +\begin{array}{l} \frac {\mu}{L _ {\max } (\mu + 2 (B \mu + A) (1 - \lambda_ {t}) ^ {2})} \leq \frac {2}{L _ {\max } (1 + 2 B (1 - \lambda_ {t}) ^ {2})} \Leftrightarrow \\ L _ {\max } \mu + 2 L _ {\max } B \mu \left(1 - \lambda_ {t}\right) ^ {2} \leq 2 L _ {\max } \mu + 4 L _ {\max } \left(B \mu + A\right) \left(1 - \lambda_ {t}\right) ^ {2} \Leftrightarrow \\ 0 \leq L _ {\max } \mu + 2 L _ {\max } (B \mu + 2 A) (1 - \lambda_ {t}) ^ {2}. \\ \end{array} +$$ + +Similarly for $\gamma_{t}$ by combining Equations (13) and (10) we obtain: + +$$ +\begin{array}{l} \gamma_ {t} \leq \gamma^ {*} = \min \left\{\frac {2 - L _ {\max} \rho_ {t} - 2 B L _ {\max} \rho_ {t} (1 - \lambda_ {t}) ^ {2}}{2 B L _ {\max} (2 L _ {\max} ^ {2} \rho_ {t} ^ {2} (1 - \lambda_ {t}) ^ {2} + 1)}, \frac {\mu - L _ {\max} \rho_ {t} (\mu + 2 (B \mu + A) (1 - \lambda_ {t}) ^ {2})}{2 L _ {\max} (B \mu + A) (2 L _ {\max} ^ {2} \rho_ {t} ^ {2} (1 - \lambda_ {t}) ^ {2} + 1)} \right\} \\ = \frac {\mu - L _ {\mathrm {m a x}} \rho_ {t} (\mu + 2 (B \mu + A) (1 - \lambda_ {t}) ^ {2})}{2 L _ {\mathrm {m a x}} (B \mu + A) (2 L _ {\mathrm {m a x}} ^ {2} \rho_ {t} ^ {2} (1 - \lambda_ {t}) ^ {2} + 1)}, \\ \end{array} +$$ + +where the last inequality holds due to: + +$$ +\frac {\mu - L _ {\max} \rho_ {t} (\mu + 2 (B \mu + A) (1 - \lambda_ {t}) ^ {2})}{2 L _ {\max} (B \mu + A) (2 L _ {\max} ^ {2} \rho_ {t} ^ {2} (1 - \lambda_ {t}) ^ {2} + 1)} \leq \frac {2 - L _ {\max} \rho_ {t} - 2 B L _ {\max} \rho_ {t} (1 - \lambda_ {t}) ^ {2}}{2 B L _ {\max} (2 L _ {\max} ^ {2} \rho_ {t} ^ {2} (1 - \lambda_ {t}) ^ {2} + 1)} \Leftrightarrow +$$ + +$$ +\frac {\mu - L _ {\operatorname* {m a x}} \rho_ {t} \left(\mu + 2 (B \mu + A) (1 - \lambda_ {t}) ^ {2}\right)}{B \mu + A} \leq \frac {2 - L _ {\operatorname* {m a x}} \rho_ {t} - 2 B L _ {\operatorname* {m a x}} \rho_ {t} (1 - \lambda_ {t}) ^ {2}}{B} \Leftrightarrow +$$ + +$$ +\begin{array}{l} B \mu - B L _ {\max } \rho_ {t} \mu - 2 B L _ {\max } \rho_ {t} (B \mu + A) \left(1 - \lambda_ {t}\right) ^ {2} \leq 2 B \mu + 2 A - B _ {\max } \rho_ {t} \mu - A L _ {\max } \rho_ {t} \\ - 2 B L _ {\max } \rho_ {t} (B \mu + A) \left(1 - \lambda_ {t}\right) ^ {2}, \\ \end{array} +$$ + +The above derivation simplifies to the below inequality: + +$$ +0 \leq B \mu + A (2 - L _ {\max} \rho_ {t}), +$$ + +which is true by the restriction on $\rho$ in (11), that implies the quantity $(2 - L_{\max}\rho_{t})$ is non-negative due to: + +$$ +\rho_ {t} \leq \frac {2}{L _ {\mathrm {m a x}} (1 + 2 B (1 - \lambda_ {t}) ^ {2})} \leq \frac {2}{L _ {\mathrm {m a x}}}. +$$ + +Now setting constant $\rho_{t} = \rho^{*}$ , $\gamma_{t} = \gamma^{*}$ and $\lambda_{t} = \lambda \in [0,1]$ in (12) we have + +$$ +\begin{array}{l} \mathbb {E} \left[ f \left(x ^ {t + 1}\right) - f \left(x ^ {*}\right) \mid x ^ {t} \right] \\ \leq (1 - \gamma \mu) [ f (x ^ {t}) - f (x ^ {*}) ] \\ + \gamma L _ {\max } \left[ C \rho (1 - \lambda) ^ {2} + 2 C \gamma L _ {\max } ^ {2} \rho^ {2} (1 - \lambda) ^ {2} + C \gamma + \rho \lambda^ {2} + 2 \gamma L _ {\max } ^ {2} \rho^ {2} \lambda^ {2} \right]. \tag {15} \\ \end{array} +$$ + +Taking expectation on (15) and using the tower property we get + +$$ +\begin{array}{l} \mathbb {E} \left[ f \left(x ^ {t + 1}\right) - f \left(x ^ {*}\right) \right] \\ \leq (1 - \gamma \mu) \mathbb {E} [ f (x ^ {t}) - f (x ^ {*}) ] \\ + \gamma L _ {\mathrm {m a x}} \left[ C \rho (1 - \lambda) ^ {2} + 2 C \gamma L _ {\mathrm {m a x}} ^ {2} \rho^ {2} (1 - \lambda_ {t}) ^ {2} + C \gamma + \rho \lambda^ {2} + 2 \gamma L _ {\mathrm {m a x}} ^ {2} \rho^ {2} \lambda^ {2} \right] \\ = \left(1 - \gamma \mu\right) \mathbb {E} \left[ f \left(x ^ {t}\right) - f \left(x ^ {*}\right) \right] + \gamma L _ {\max } \left(C \gamma + \rho \left(1 + 2 \gamma L _ {\max } ^ {2} \rho\right) \left[ \lambda^ {2} + C \left(1 - \lambda_ {t}\right) ^ {2} \right]\right). \tag {16} \\ \end{array} +$$ + +Recursively applying the above and summing up the resulting geometric series yields: + +$$ +\begin{array}{l} \mathbb {E} \left[ f \left(x ^ {t + 1}\right) - f \left(x ^ {*}\right) \right] \leq \left(1 - \gamma \mu\right) ^ {t} \left[ f \left(x ^ {0}\right) - f \left(x ^ {*}\right) \right] \\ + \gamma L _ {\mathrm {m a x}} \left(C \gamma + \rho (1 + 2 \gamma L _ {\mathrm {m a x}} ^ {2} \rho) \left[ \lambda^ {2} + C (1 - \lambda) ^ {2} \right]\right) \sum_ {j = 0} ^ {t} (1 - \gamma \mu) ^ {j}. \\ \end{array} +$$ + +Using the fact that $\sum_{j=0}^{t}(1 - \gamma \mu)^{j} \leq \frac{1}{\gamma \mu}$ completes the proof. + +![](images/dd155d5a9f03d4f59762dc163d23c1b74b3cd8f6594b32674c9eb8f866d67980.jpg) + +# C.2 PROOF OF THEOREM 3.5 + +Theorem C.2. Assume that each $f_{i}$ is $L_{i}$ -smooth, $f$ is $\mu$ -PL and the ER is satisfied. Then the iterates of Unified SAM with $\rho_{t} = \min \left\{\frac{1}{2t + 1}, \rho^{*}\right\}$ and $\gamma_{t} = \min \left\{\frac{2t + 1}{(t + 1)^{2\mu}}, \gamma^{*}\right\}$ , where $\rho^{*}$ and $\gamma^{*}$ are defined in Theorem 3.2, satisfy: + +$$ +E [ f (x ^ {t}) - f (x ^ {*}) ] \leq O \left(\frac {1}{t}\right). +$$ + +Proof of Theorem 3.5. Since $\gamma_t = \min \left\{\frac{2t + 1}{(t + 1)^2\mu}, \gamma^*\right\} \leq \gamma^*$ and $\rho_t = \min \left\{\frac{1}{2t + 1}, \rho^*\right\} \leq \rho^*$ we get that inequality (16) holds for any $t \geq 0$ , hence we have: + +$$ +\begin{array}{l} \mathbb {E} \left[ f \left(x ^ {t + 1}\right) - f \left(x ^ {*}\right) \right] \leq \left(1 - \gamma_ {t} \mu\right) \mathbb {E} \left[ f \left(x ^ {t}\right) - f \left(x ^ {*}\right) \right] \\ + \gamma_ {t} L _ {\mathrm {m a x}} \left(C \gamma_ {t} + \rho_ {t} (1 + 2 \gamma_ {t} \rho_ {t} L _ {\mathrm {m a x}} ^ {2}) \left[ \lambda^ {2} + C (1 - \lambda) ^ {2} \right]\right) \\ = \left(1 - \gamma_ {t} \mu\right) \mathbb {E} \left[ f \left(x ^ {t}\right) - f \left(x ^ {*}\right) \right] \\ + C L _ {\max } \gamma_ {t} ^ {2} + \gamma_ {t} \rho_ {t} L _ {\max } ^ {2} \left(1 + 2 \gamma_ {t} \rho_ {t} L _ {\max } ^ {2}\right) \left[ \lambda^ {2} + C (1 - \lambda) ^ {2} \right] \\ \leq \left(1 - \gamma_ {t} \mu\right) \mathbb {E} \left[ f \left(x ^ {t}\right) - f \left(x ^ {*}\right) \right] \\ + C L _ {\max } \gamma_ {t} ^ {2} + \gamma_ {t} \rho_ {t} L _ {\max } ^ {2} \left(1 + \frac {2 L _ {\max } ^ {2}}{\mu}\right) [ \lambda^ {2} + C (1 - \lambda) ^ {2} ], \tag {17} \\ \end{array} +$$ + +where the last inequality follows from $\gamma_t \leq \frac{2t + 1}{(t + 1)^2\mu}$ and $\rho_t \leq \frac{1}{2t + 1}$ , and thus $\gamma_t\rho_t \leq \frac{1}{(t + 1)^2\mu} \leq \frac{1}{\mu}$ . Now set $\delta_t = \mathbb{E}[f(x^t) - f(x^*)]$ , $R = CL_{\max}$ and $Q = L_{\max}^2\left(1 + \frac{2L_{\max}^2}{\mu}\right)\left[\lambda^2 + C(1 - \lambda)^2\right]$ . Then the inequality (17) takes the following form: + +$$ +\delta_ {t + 1} \leq \left(1 - \gamma_ {t} \mu\right) \delta_ {t} + Q \gamma_ {t} \rho_ {t} + R \gamma_ {t} ^ {2}. \tag {18} +$$ + +Now since the sequences $\frac{2t + 1}{(t + 1)^2\mu}$ and $\frac{1}{2t + 1}$ are decreasing there exists an integer $t^* \in \mathbb{N}$ such that for any $t \geq t^*$ we have $\gamma_t = \frac{2t + 1}{(t + 1)^2\mu}$ and $\rho_t = \frac{1}{2t + 1}$ . Substituting in (18) we get that for any $t \geq t^*$ we have + +$$ +\begin{array}{l} \delta_ {t + 1} \leq \frac {t ^ {2}}{(t + 1) ^ {2}} \delta_ {t} + \frac {Q}{\mu (t + 1) ^ {2}} + \frac {R (2 t + 1) ^ {2}}{\mu^ {2} (t + 1) ^ {4}} \\ \leq \frac {t ^ {2}}{(t + 1) ^ {2}} \delta_ {t} + \frac {Q \mu + 4 R}{\mu^ {2} (t + 1) ^ {2}}, \\ \end{array} +$$ + +because $\frac{(2t + 1)^2}{(t + 1)^4} \leq \frac{4(t + 1)^2}{(t + 1)^4} = \frac{4}{(t + 1)^2}$ . Multiplying both sides with $(t + 1)^2$ and rearranging we have + +$$ +(t + 1) ^ {2} \delta_ {t + 1} - t ^ {2} \delta_ {t} \leq \frac {Q \mu + 4 R}{\mu^ {2}}. +$$ + +Summing for $t = t^{*}, \ldots, T - 1$ and telescoping we have + +$$ +T ^ {2} \delta_ {T} \leq (t ^ {*}) ^ {2} \delta_ {t ^ {*}} + \frac {Q \mu + 4 R}{\mu^ {2}} (T - t ^ {*} - 1). +$$ + +Changing notation from $T$ to $t$ we get + +$$ +\begin{array}{l} \mathbb {E} \left[ f \left(x ^ {t}\right) - f \left(x ^ {*}\right) \right] \leq \frac {\left(t ^ {*}\right) ^ {2} \delta_ {t ^ {*}}}{t ^ {2}} + \frac {Q \mu + 4 R}{\mu^ {2}} \frac {t - t ^ {*} - 1}{t ^ {2}} \\ \leq \frac {(t ^ {*}) ^ {2} \delta_ {t ^ {*}}}{t ^ {2}} + \frac {Q \mu + 4 R}{\mu^ {2}} \frac {1}{t} \\ = O \left(\frac {1}{t}\right). \\ \end{array} +$$ + +This completes the proof. + +![](images/ba6637af94b4a50200e02b785145b5fc251d998754ca226c3690f3fe0cbfe5e4.jpg) + +# C.3 PROOF OF PROPOSITION 3.6 + +Proposition C.3. Assume that each $f_{i}$ is $L_{i}$ -smooth and the ER is satisfied. Then the iterates of Unified SAM with $\rho \leq \min \left\{\frac{1}{4L_{\max}}, \frac{1}{8BL_{\max}(1 - \lambda)^2}\right\}$ and $\gamma \leq \frac{1}{8BL_{\max}}$ , satisfy: + +$$ +\begin{array}{l} \min _ {t = 0, \dots , T - 1} \mathbb {E} \| \nabla f (x ^ {t}) \| ^ {2} \leq \frac {2 \left(1 + 2 A \gamma L _ {\max } \left[ \rho (1 - \lambda) ^ {2} (1 + 2 \gamma \rho L _ {\max } ^ {2}) + \gamma \right]\right) ^ {T}}{T \gamma} [ f (x ^ {0}) - f ^ {\inf } ] \\ + 2 L _ {\mathrm {m a x}} \left[ C \gamma + \rho (1 + 2 \gamma \rho L _ {\mathrm {m a x}} ^ {2}) (\lambda^ {2} + C (1 - \lambda) ^ {2}) \right]. \\ \end{array} +$$ + +Proof of Proposition 3.6. From Equation (9) we have + +$$ +\begin{array}{l} \mathbb {E} \left[ f \left(x ^ {t + 1}\right) - f ^ {\inf } \left| x ^ {t} \right] - \left[ f \left(x ^ {t}\right) - f ^ {\inf } \right] \right. \\ \leq - \gamma \left(1 - \frac {L _ {\operatorname* {m a x}} \rho}{2} - B L _ {\operatorname* {m a x}} \left[ \rho (1 - \lambda) ^ {2} + 2 \gamma L _ {\operatorname* {m a x}} ^ {2} \rho^ {2} (1 - \lambda) ^ {2} + \gamma \right]\right) \| \nabla f (x ^ {t}) \| ^ {2} \\ + 2 A \gamma L _ {\max } \left[ \rho (1 - \lambda) ^ {2} + 2 \gamma L _ {\max } ^ {2} \rho^ {2} (1 - \lambda) ^ {2} + \gamma \right] \left[ f (x ^ {t}) - f ^ {\inf } \right] \\ + \gamma L _ {\max } \left[ C \rho (1 - \lambda) ^ {2} + 2 C \gamma L _ {\max } ^ {2} \rho^ {2} (1 - \lambda) ^ {2} + C \gamma + \rho \lambda^ {2} + 2 \gamma L _ {\max } ^ {2} \rho^ {2} \lambda^ {2} \right] \\ \leq - \frac {\gamma}{2} \| \nabla f (x ^ {t}) \| ^ {2} + 2 A \gamma L _ {\max} \left[ \rho (1 - \lambda) ^ {2} + 2 \gamma L _ {\max} ^ {2} \rho^ {2} (1 - \lambda) ^ {2} + \gamma \right] \left[ f (x ^ {t}) - f ^ {\inf} \right] \\ + \gamma L _ {\max } \left[ C \rho (1 - \lambda) ^ {2} + 2 C \gamma L _ {\max } ^ {2} \rho^ {2} (1 - \lambda) ^ {2} + C \gamma + \rho \lambda^ {2} + 2 \gamma L _ {\max } ^ {2} \rho^ {2} \lambda^ {2} \right]. \tag {19} \\ \end{array} +$$ + +Here inequality (19) is true due to: + +$$ +\begin{array}{l} \left. \right.\left(1 - \frac {L _ {\operatorname* {m a x}} \rho}{2} - B L _ {\operatorname* {m a x}} \left[ \rho (1 - \lambda) ^ {2} + 2 \gamma L _ {\operatorname* {m a x}} ^ {2} \rho^ {2} (1 - \lambda) ^ {2} + \gamma \right]\right) \geq \frac {1}{2} \Leftrightarrow \\ \frac {L _ {\operatorname* {m a x}} \rho}{2} + B L _ {\operatorname* {m a x}} \rho (1 - \lambda) ^ {2} + B L _ {\operatorname* {m a x}} \gamma + 2 B \gamma L _ {\operatorname* {m a x}} ^ {3} \rho^ {2} (1 - \lambda) ^ {2} \leq \frac {1}{2}. \tag {20} \\ \end{array} +$$ + +Inequality (20) holds due to the theorem's constraints on $\gamma$ and $\rho$ , which imply that each factor on the left-hand side of inequality (20) is less than $1/8$ , as explained below. + +- $\frac{L_{\max}\rho}{2} \leq \frac{1}{8}$ by the condition on $\rho$ . +- $BL_{\max}\rho (1 - \lambda)^2\leq \frac{1}{8}$ by the condition on $\rho$ +$BL_{\mathrm{max}}\gamma \leq \frac{1}{8}$ by the condition on $\gamma$ +- $2B\gamma L_{\mathrm{max}}^3\rho^2 (1 - \lambda)^2\leq \frac{1}{8}$ because we have $\rho \leq \frac{1}{4L_{\mathrm{max}}}$ and $\gamma \leq \frac{1}{8BL_{\mathrm{max}}}$ , so + +$$ +\begin{array}{l} 2 B \gamma L _ {\mathrm {m a x}} ^ {3} \rho^ {2} (1 - \lambda) ^ {2} \leq 2 B \frac {1}{8 B L _ {\mathrm {m a x}}} L _ {\mathrm {m a x}} ^ {3} \left(\frac {1}{4 L _ {\mathrm {m a x}}}\right) ^ {2} (1 - \lambda) ^ {2} \\ = \frac {(1 - \lambda) ^ {2}}{6 4} \\ \leq \frac {1}{6 4} < \frac {1}{8} \\ \end{array} +$$ + +Summing up the inequalities in the above bullet points results in inequality (20). By taking expectation and using the tower property in (19), we have + +$$ +\begin{array}{l} \mathbb {E} \left[ f \left(x ^ {t + 1}\right) - f ^ {\inf } \right] - \mathbb {E} \left[ f \left(x ^ {t}\right) - f ^ {\inf } \right] \\ \leq - \frac {\gamma}{2} \mathbb {E} \left\| \nabla f (x ^ {t}) \right\| ^ {2} + 2 A \gamma L _ {\max} \left[ \rho (1 - \lambda) ^ {2} + 2 \gamma L _ {\max} ^ {2} \rho^ {2} (1 - \lambda) ^ {2} + \gamma \right] \mathbb {E} \left[ f (x ^ {t}) - f ^ {\inf} \right] \\ + \gamma L _ {\max } \left[ C \rho (1 - \lambda) ^ {2} + 2 C \gamma L _ {\max } ^ {2} \rho^ {2} (1 - \lambda) ^ {2} + C \gamma + \rho \lambda^ {2} + 2 \gamma L _ {\max } ^ {2} \rho^ {2} \lambda^ {2} \right], \\ \end{array} +$$ + +thus + +$$ +\begin{array}{l} \frac {\gamma}{2} \mathbb {E} \left\| \nabla f (x ^ {t}) \right\| ^ {2} \leq \left(1 + 2 A \gamma L _ {\max } \left[ \rho (1 - \lambda) ^ {2} + 2 \gamma L _ {\max } ^ {2} \rho^ {2} (1 - \lambda) ^ {2} + \gamma \right]\right) \mathbb {E} [ f (x ^ {t}) - f ^ {\inf } ] \\ - \mathbb {E} [ f (x ^ {t + 1}) - f ^ {\inf} ] \\ + \gamma L _ {\max } \left[ C \rho (1 - \lambda) ^ {2} + 2 C \gamma L _ {\max } ^ {2} \rho^ {2} (1 - \lambda) ^ {2} + C \gamma + \rho \lambda^ {2} + 2 \gamma L _ {\max } ^ {2} \rho^ {2} \lambda^ {2} \right]. \tag {21} \\ \end{array} +$$ + +Let us now set: + +$$ +\begin{array}{l} \delta_ {t} = \frac {2}{\gamma} \mathbb {E} \left[ f \left(x ^ {t}\right) - f ^ {\text {i n f}} \right] \geq 0 \\ r _ {t} = \mathbb {E} \| \nabla f (x ^ {t}) \| ^ {2} \geq 0 \\ g = \left(1 + 2 A \gamma L _ {\max} \left[ \rho (1 - \lambda) ^ {2} + 2 \gamma L _ {\max} ^ {2} \rho^ {2} (1 - \lambda) ^ {2} + \gamma \right]\right) \\ = \left(1 + 2 A \gamma L _ {\max } \left[ \gamma + \rho (1 - \lambda) ^ {2} \left(1 + 2 \gamma L _ {\max } ^ {2}\right) \right]\right) > 1 \\ \end{array} +$$ + +$$ +\begin{array}{l} N = 2 L _ {\max } \left[ C \rho (1 - \lambda) ^ {2} + 2 C \gamma L _ {\max } ^ {2} \rho^ {2} (1 - \lambda) ^ {2} + C \gamma + \rho \lambda^ {2} + 2 \gamma L _ {\max } ^ {2} \rho^ {2} \lambda^ {2} \right] \\ = 2 L _ {\max } \left[ C \gamma + \rho (1 + 2 \gamma \rho L _ {\max } ^ {2}) (\lambda^ {2} + C (1 - \lambda) ^ {2}) \right] \geq 0 \\ \end{array} +$$ + +and inequality (21) takes the following form: + +$$ +\frac {\gamma}{2} r _ {t} \leq g \delta_ {t} - \delta_ {t + 1} + N. \tag {22} +$$ + +Applying Lemma A.8 to (22) completes the proof. + +# C.4 PROOF OF THEOREM 3.7 + +Theorem C.4. Let $\varepsilon > 0$ and set $\delta_0 = f(x_0) - f^{\inf} \geq 0$ . For + +$$ +\rho = \min \left\{\frac {1}{4 L _ {\mathrm {m a x}}}, \frac {1}{8 B L _ {\mathrm {m a x}} (1 - \lambda) ^ {2}}, \frac {1}{\sqrt {T}}, \frac {\varepsilon^ {2}}{1 2 L _ {\mathrm {m a x}} (C (1 - \lambda) ^ {2} + \lambda^ {2})} \right\} +$$ + +and + +$$ +\gamma = \min \left\{\frac {1}{8 B L _ {\mathrm {m a x}}}, \frac {1}{2 L (1 - \lambda) \sqrt {3 A L _ {\mathrm {m a x}}}}, \frac {1}{6 L _ {\mathrm {m a x}} A (1 - \lambda) ^ {2} \sqrt {T}}, \frac {1}{\sqrt {6 A L T}}, \right. +$$ + +$$ +\left. \frac {\varepsilon^ {2}}{2 4 L _ {\operatorname* {m a x}} ^ {3} \left(C (1 - \lambda) ^ {2} + \lambda^ {2}\right)}, \frac {\varepsilon^ {2}}{1 2 L _ {\operatorname* {m a x}} C} \right\} +$$ + +Then provided that + +$$ +\begin{array}{l} T \geq \frac {\delta_ {0} L _ {\max}}{\varepsilon^ {2}} \max \left\{9 6 B, 2 4 (1 - \lambda) \sqrt {3 L _ {\max } A}, \frac {5 1 8 4 L _ {\max } A ^ {2} (1 - \lambda) ^ {4} \delta_ {0}}{\varepsilon^ {2}}, \frac {8 6 4 \delta_ {0} A}{\varepsilon^ {2}}, \frac {1 4 4 C}{\varepsilon^ {2}}, \right. \\ \left. \frac {2 8 8 L _ {\operatorname* {m a x}} ^ {2} (1 - \lambda) ^ {2}}{\varepsilon^ {2}} \right\} \\ \end{array} +$$ + +we have $\min_{t = 0,\dots,T - 1}\mathbb{E}\| \nabla f(x^t)\| \leq \varepsilon$ + +Proof of Theorem 3.7. From Proposition C.3 under the condition that $\rho \leq \min \left\{\frac{1}{4L_{\max}},\frac{1}{8BL_{\max}(1 - \lambda)^2}\right\}$ and $\gamma \leq \frac{1}{8BL_{\max}}$ we have + +$$ +\begin{array}{l} \min _ {t = 0, \dots , T - 1} \mathbb {E} \| \nabla f (x ^ {t}) \| ^ {2} \leq \frac {2 \left(1 + 2 A \gamma L _ {\max } \left[ \rho (1 - \lambda) ^ {2} (1 + 2 \gamma \rho L _ {\max } ^ {2}) + \gamma \right]\right) ^ {T}}{T \gamma} [ f (x ^ {0}) - f ^ {\inf} ] \\ + 2 L _ {\max } \left[ C \gamma + \rho (1 + 2 \gamma \rho L _ {\max } ^ {2}) (\lambda^ {2} + C (1 - \lambda) ^ {2}) \right]. \tag {23} \\ \end{array} +$$ + +Using the fact that $1 + x \leq \exp(x)$ , we have that + +$$ +\begin{array}{l} \left. \left(1 + 2 A \gamma L _ {\max } \left[ \rho (1 - \lambda) ^ {2} (1 + 2 \gamma \rho L _ {\max } ^ {2}) + \gamma \right]\right) ^ {T} \right. \\ \leq \exp \left(2 T A \gamma L _ {\max } \left[ \rho (1 - \lambda) ^ {2} \left(1 + 2 \gamma \rho L _ {\max } ^ {2}\right) + \gamma \right]\right) \\ \leq \exp (1) < 3. \tag {24} \\ \end{array} +$$ + +We note that for the second inequality to hold, it is enough to assume that + +$$ +\begin{array}{l} 2 T A \gamma L _ {\mathrm {m a x}} \left[ \rho (1 - \lambda) ^ {2} (1 + 2 \gamma \rho L _ {\mathrm {m a x}} ^ {2}) + \gamma \right] = 2 T A L _ {\mathrm {m a x}} \gamma \left[ \rho (1 - \lambda) ^ {2} + 2 \gamma L _ {\mathrm {m a x}} ^ {2} \rho^ {2} (1 - \lambda) ^ {2} + \gamma \right] \\ \leq 1, \\ \end{array} +$$ + +which is true if we have that, + +$2TAL_{\mathrm{max}}\gamma \rho (1 - \lambda)^2\leq 1 / 3$ +$4TAL_{\mathrm{max}}^3\gamma \rho^2 (1 - \lambda)^2\leq 1 / 3$ +$2TAL_{\mathrm{max}}\gamma^2 \leq 1/3.$ + +Imposing the restriction $\rho \leq \frac{1}{\sqrt{T}}$ , the above inequalities can be expressed as (by solving for $\gamma$ ): + +$\gamma \leq \frac{1}{6L_{\max}A(1 - \lambda)^2\sqrt{T}}$ +$\gamma \leq \frac{1}{2L(1 - \lambda)\sqrt{3AL_{\max}}}$ +$\gamma \leq \frac{1}{\sqrt{6ALT}}$ + +Using these restrictions on $\gamma$ , we are able to substitute the bound of (24) in (23) to get: + +$$ +\min _ {t = 0, \dots , T - 1} \mathbb {E} \| \nabla f (x ^ {t}) \| ^ {2} \leq \frac {6 \delta_ {0}}{T \gamma} + 2 L _ {\max } \left[ C \gamma + \rho (1 + 2 \gamma \rho L _ {\max } ^ {2}) (\lambda^ {2} + C (1 - \lambda) ^ {2}) \right]. \tag {25} +$$ + +To make the right hand side of (25) smaller than $\varepsilon^2$ , we require that the second term satisfies + +$$ +2 L _ {\max } \left[ C \gamma + \rho (1 + 2 \gamma \rho L _ {\max } ^ {2}) (\lambda^ {2} + C (1 - \lambda) ^ {2}) \right] \leq \frac {\varepsilon^ {2}}{2} \Leftrightarrow +$$ + +$$ +2 L _ {\max } \left[ C \rho (1 - \lambda) ^ {2} + 2 C \gamma L _ {\max } ^ {2} \rho^ {2} (1 - \lambda) ^ {2} + C \gamma + \rho \lambda^ {2} + 2 \gamma L _ {\max } ^ {2} \rho^ {2} \lambda^ {2} \right] \leq \frac {\varepsilon^ {2}}{2} \Leftrightarrow +$$ + +$$ +2 L _ {\max } \left[ \rho \left(C (1 - \lambda) ^ {2} + \lambda^ {2}\right) + 2 L _ {\max } ^ {2} \gamma \rho^ {2} \left(C (1 - \lambda) ^ {2} + \lambda^ {2}\right) + C \gamma \right] \leq \frac {\varepsilon^ {2}}{2} +$$ + +For this to hold it is enough to have + +$$ +\begin{array}{l} \bullet 2 L _ {\max } \rho (C (1 - \lambda) ^ {2} + \lambda^ {2}) \leq \frac {\varepsilon^ {2}}{6} \Leftarrow \rho \leq \frac {\varepsilon^ {2}}{1 2 L _ {\max } (C (1 - \lambda) ^ {2} + \lambda^ {2})} \\ \bullet 4 L _ {\max } ^ {3} \gamma \rho^ {2} \left(C (1 - \lambda) ^ {2} + \lambda^ {2}\right) \leq \frac {\varepsilon^ {2}}{6} \stackrel {\rho < 1} {\Leftarrow} \gamma \leq \frac {\varepsilon^ {2}}{2 4 L _ {\max } ^ {3} (C (1 - \lambda) ^ {2} + \lambda^ {2})} \\ \cdot 2 L _ {\max } C \gamma \leq \frac {\varepsilon^ {2}}{6} \Leftarrow \gamma \leq \frac {\varepsilon^ {2}}{1 2 L _ {\max } C} \\ \end{array} +$$ + +Similarly, for the first term, we get that the number of iterations must satisfy: + +$$ +\frac {6 \delta_ {0}}{T \gamma} \leq \frac {\varepsilon^ {2}}{2} \Leftrightarrow T \geq \frac {1 2 \delta_ {0}}{\gamma \varepsilon^ {2}} \tag {26} +$$ + +Hence so far we need the following restrictions on $\rho$ and $\gamma$ : + +- $\rho \leq \min \left\{\frac{1}{4L_{\max}}, \frac{1}{8BL_{\max}(1 - \lambda)^2}\right\}$ and $\gamma \leq \frac{1}{8BL_{\max}}$ (by the restrictions of Proposition C.3) +$\rho \leq \frac{1}{\sqrt{T}}$ and $\rho \leq \frac{\varepsilon^2}{12L_{\max}(C(1 - \lambda)^2 + \lambda^2)}$ +- $\gamma \leq \frac{1}{6L_{\max}A(1 - \lambda)^2\sqrt{T}}$ and $\gamma \leq \frac{1}{2L(1 - \lambda)\sqrt{3AL_{\max}}}$ and $\gamma \leq \frac{1}{\sqrt{6ALT}}$ and $\gamma \leq \frac{\varepsilon^2}{24L_{\max}^3(C(1 - \lambda)^2 + \lambda^2)}$ and $\gamma \leq \frac{\varepsilon^2}{12L_{\max}C}$ + +Plugging each of the previous bounds of $\gamma$ into (26) we get + +$$ +\begin{array}{l} \cdot T \geq \frac {9 6 B L _ {\max} \delta_ {0}}{\varepsilon^ {2}} \\ \cdot T \geq \frac {2 4 L _ {\max} \delta_ {0} (1 - \lambda) \sqrt {3 L _ {\max} A}}{\varepsilon^ {2}} \\ \bullet T \geq \frac {5 1 8 4 L _ {\mathrm {m a x}} ^ {2} A ^ {2} (1 - \lambda) ^ {4} \delta_ {0} ^ {2}}{\varepsilon^ {4}} \\ \cdot T \geq \frac {8 6 4 \delta_ {0} ^ {2} A L _ {\max}}{\varepsilon^ {4}} \\ \cdot T \geq \frac {1 4 4 L _ {\operatorname* {m a x}} C \delta_ {0}}{\varepsilon^ {4}} \\ \bullet T \geq \frac {2 8 8 L _ {\operatorname* {m a x}} ^ {3} \delta_ {0} (1 - \lambda) ^ {2}}{\varepsilon^ {4}} \\ \end{array} +$$ + +Finally, collecting all the terms into a single bound we have: + +$$ +\begin{array}{l} \rho = \min \left\{\frac {1}{4 L _ {\mathrm {m a x}}}, \frac {1}{8 B L _ {\mathrm {m a x}} (1 - \lambda) ^ {2}}, \frac {1}{\sqrt {T}}, \frac {\varepsilon^ {2}}{1 2 L _ {\mathrm {m a x}} (C (1 - \lambda) ^ {2} + \lambda^ {2})} \right\} \\ \gamma = \min \left\{\frac {1}{8 B L _ {\mathrm {m a x}}}, \frac {1}{2 L (1 - \lambda) \sqrt {3 A L _ {\mathrm {m a x}}}}, \frac {1}{6 L _ {\mathrm {m a x}} A (1 - \lambda) ^ {2} \sqrt {T}}, \frac {1}{\sqrt {6 A L T}}, \right. \\ \left. \frac {\varepsilon^ {2}}{2 4 L _ {\operatorname * {m a x}} ^ {3} \left(C (1 - \lambda) ^ {2} + \lambda^ {2}\right)}, \frac {\varepsilon^ {2}}{1 2 L _ {\operatorname * {m a x}} C} \right\} \\ \end{array} +$$ + +$$ +\begin{array}{l} T \geq \frac {\delta_ {0} L _ {\mathrm {m a x}}}{\varepsilon^ {2}} \max \left\{9 6 B, 2 4 (1 - \lambda) \sqrt {3 L _ {\mathrm {m a x}} A}, \frac {5 1 8 4 L _ {\mathrm {m a x}} A ^ {2} (1 - \lambda) ^ {4} \delta_ {0}}{\varepsilon^ {2}}, \frac {8 6 4 \delta_ {0} A}{\varepsilon^ {2}}, \frac {1 4 4 C}{\varepsilon^ {2}}, \right. \\ \left. \frac {2 8 8 L _ {\mathrm {m a x}} ^ {2} (1 - \lambda) ^ {2}}{\varepsilon^ {2}} \right\}. \\ \end{array} +$$ + +This completes the proof. + +# D ADDITIONAL EXPERIMENTS + +In this section, we present additional experimental evaluations of Unified SAM, following the same setup as in Li & Giannakis (2023). Specifically, we train ResNet-18 and WRN-28-10 on CIFAR10 and CIFAR100 datasets. Standard data augmentation techniques, including random cropping, random horizontal flipping, and normalization DeVries (2017), are employed. The models are trained for 200 epochs with a batch size of 128, using a cosine scheduler starting from 0.05. Weight decay is set to 0.001. For SAM, we use $\rho = 0.1$ for CIFAR10 and $\rho = 0.2$ for CIFAR100. Each experiment is repeated three times, and we report the average of the maximum test accuracy along with the standard error. The numerical results are presented in Tables 6 and 7, demonstrate that Unified SAM consistently improves the test accuracy over both USAM and SAM across all tested models. Lastly, we also observe that careful tuning of the parameter $\lambda$ is essential for achieving optimal performance. + +Table 6: Test accuracy (%) of Unified SAM on various neural networks trained on CIFAR10. + +
Modelλ=0.0λ=0.5λ=1.0λ=1/tλ=1-1/t
ResNet-1896.13±0.0596.16±0.0396.33±0.0396.20±0.0596.22±0.09
WideResNet-28-1097.26±0.4496.98±0.0897.05±0.0596.73±0.0496.63±0.35
+ +Table 7: Test accuracy (%) of Unified SAM on various neural networks trained on CIFAR100. + +
Modelλ=0.0λ=0.5λ=1.0λ=1/tλ=1-1/t
ResNet-1880.21±0.0280.28±0.1680.14±0.0780.27±0.0980.19±0.06
WideResNet-28-1083.49±0.2383.71±0.0383.55±0.1983.55±0.1083.62±0.16
+ +Table 8: Test accuracy (\%) of Unified SAM for PRN-18 on CIFAR10, evaluated across different values of $\rho$ and $\lambda$ . With bold we highlight the best performance for fixed $\rho$ . + +
Unified SAMλ = 0.0λ = 0.5λ = 1.0λ = 1/tλ = 1 - 1/t
ρ = 0.195.29±0.0995.32±0.0295.59±0.0995.24±0.0395.53±0.11
ρ = 0.295.25±0.1495.48±0.0595.5±0.0295.38±0.1195.58±0.07
ρ = 0.395.25±0.1195.24±0.0295.18±0.0495.12±0.1995.26±0.1
ρ = 0.494.76±0.0994.98±0.0794.7±0.0294.64±0.0394.61±0.09
SGD94.82±0.02
+ +Table 9: Test accuracy (\%) of Unified SAM for PRN-18 on CIFAR100, evaluated across different values of $\rho$ and $\lambda$ . With bold we highlight the best performance for fixed $\rho$ . + +
Unified SAMλ=0.0λ=0.5λ=1.0λ=1/tλ=1-1/t
ρ=0.178.28±0.1578.28±0.0678.32±0.2278.33±0.3278.39±0.31
ρ=0.278.98±0.1878.68±0.1378.96±0.1278.87±0.0278.79±0.1
ρ=0.379.0±0.0578.95±0.0779.21±0.0878.73±0.0679.27±0.08
ρ=0.478.57±0.2678.76±0.379.05±0.1678.36±0.0978.79±0.13
SGD76.9±0.23
\ No newline at end of file diff --git a/ICLR/2025/Sharpness-Aware Minimization_ General Analysis and Improved Rates/images.zip b/ICLR/2025/Sharpness-Aware Minimization_ General Analysis and Improved Rates/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..3a533e2c29ed2ce444f993ce6b64f02e2fe26cc1 --- /dev/null +++ b/ICLR/2025/Sharpness-Aware Minimization_ General Analysis and Improved Rates/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6e429248366c079420bf3b3d707c6bc7327988512493eee7284508e530da53fd +size 1797307 diff --git a/ICLR/2025/Sharpness-Aware Minimization_ General Analysis and Improved Rates/layout.json b/ICLR/2025/Sharpness-Aware Minimization_ General Analysis and Improved Rates/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..db1b4f1de7446e4a02ac9b22492ebf06c0b137d6 --- /dev/null +++ b/ICLR/2025/Sharpness-Aware Minimization_ General Analysis and Improved Rates/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c75e8520e16b788c958b965a7bb9f2e7e0a76e3519e7cde048e4e60f181af76c +size 1146996 diff --git a/ICLR/2025/Shedding Light on Time Series Classification using Interpretability Gated Networks/9e3b6959-7af6-44e2-b0c4-9fcfd5c73b2e_content_list.json b/ICLR/2025/Shedding Light on Time Series Classification using Interpretability Gated Networks/9e3b6959-7af6-44e2-b0c4-9fcfd5c73b2e_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..fda8099b25a79f7a0a583a9b16223305fd85d990 --- /dev/null +++ b/ICLR/2025/Shedding Light on Time Series Classification using Interpretability Gated Networks/9e3b6959-7af6-44e2-b0c4-9fcfd5c73b2e_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4d47de3658b8c1b5fdd5fb0063e972865cfcbba8c168451342a69ff2699ba1da +size 196896 diff --git a/ICLR/2025/Shedding Light on Time Series Classification using Interpretability Gated Networks/9e3b6959-7af6-44e2-b0c4-9fcfd5c73b2e_model.json b/ICLR/2025/Shedding Light on Time Series Classification using Interpretability Gated Networks/9e3b6959-7af6-44e2-b0c4-9fcfd5c73b2e_model.json new file mode 100644 index 0000000000000000000000000000000000000000..01b65bd5e11f78a5487ca0e92a79087f717cd514 --- /dev/null +++ b/ICLR/2025/Shedding Light on Time Series Classification using Interpretability Gated Networks/9e3b6959-7af6-44e2-b0c4-9fcfd5c73b2e_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:18e01135acc32982da2a86d52fd803c1918e2956192e385767736d30d391d722 +size 223292 diff --git a/ICLR/2025/Shedding Light on Time Series Classification using Interpretability Gated Networks/9e3b6959-7af6-44e2-b0c4-9fcfd5c73b2e_origin.pdf b/ICLR/2025/Shedding Light on Time Series Classification using Interpretability Gated Networks/9e3b6959-7af6-44e2-b0c4-9fcfd5c73b2e_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..819b8548426692776d7ab6b9015130aa345879a8 --- /dev/null +++ b/ICLR/2025/Shedding Light on Time Series Classification using Interpretability Gated Networks/9e3b6959-7af6-44e2-b0c4-9fcfd5c73b2e_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9c9a66cd29809f13e1f6f33349b1939f8a45cf150aec4e0da4742ab0e8a000e3 +size 15265931 diff --git a/ICLR/2025/Shedding Light on Time Series Classification using Interpretability Gated Networks/full.md b/ICLR/2025/Shedding Light on Time Series Classification using Interpretability Gated Networks/full.md new file mode 100644 index 0000000000000000000000000000000000000000..aefb417eaa5c7375563a8877a8026cf62a7ded9e --- /dev/null +++ b/ICLR/2025/Shedding Light on Time Series Classification using Interpretability Gated Networks/full.md @@ -0,0 +1,766 @@ +# SHEDDING LIGHT ON TIME SERIES CLASSIFICATION USING INTERPRETABILITY GATED NETWORKS + +Yunshi Wen $^{1*}$ , Tengfei Ma $^{2*}$ , Ronny Luss $^{3}$ , Debarun Bhattacharjya $^{3}$ , Achille Fokoue $^{3}$ , Agung Julius $^{1}$ + +$^{1}$ Rensselaer Polytechnic Institute, $^{2}$ Stony Brook University, $^{3}$ IBM Research weny2@rpi.edu, tengfei.ma@stonybrook.edu {rluss, debarunb, achille}@us.ibm.com agung@ecse.rpi.edu + +# ABSTRACT + +In time-series classification, interpretable models can bring additional insights but be outperformed by deep models since human-understandable features have limited expressivity and flexibility. In this work, we present InterpGN, a framework that integrates an interpretable model and a deep neural network. Within this framework, we introduce a novel gating function design based on the confidence of the interpretable expert, preserving interpretability for samples where interpretable features are significant while also identifying samples that require additional expertise. For the interpretable expert, we incorporate shapelets to effectively model shape-level features for time-series data. We introduce a variant of Shapelet Transforms to build logical predicates using shapelets. Our proposed model achieves comparable performance with state-of-the-art deep learning models while additionally providing interpretable classifiers for various benchmark datasets. We further show that our models improve on quantitative shapelet quality and interpretability metrics over existing shapelet-learning formulations. Finally, we show that our models can integrate additional advanced architectures and be applied to real-world tasks beyond standard benchmarks such as the MIMIC-III and time series extrinsic regression datasets. + +# 1 INTRODUCTION + +Time series classification is a fundamental task for time series (TS) data. Depending on the number of observed variables, TS classification problems can be categorized as either univariate or multivariate. Both categories are involved in a wide range of applications. Univariate TS data includes image outlines, sound, and spectrographs, and multivariate TS data include electroencephalogram (EEG), electrocardiogram (ECG), and human activity recognition (HAR). These types of TS data appear in essential applications such as healthcare, neuroscience, and automation. In recent years, there has been an increasing trend of employing deep learning models to TS classification problems. However, despite achieving state-of-the-art performance, deep models typically lack interpretability. + +As a motivating example for interpretable TS classification, consider the problem of classifying ECG data using machine learning (Neves et al., 2021; Abdullah et al., 2023; Aziz et al., 2021). While models might be accurate, doctors may hesitate to rely on them without understanding why a patient's heartbeat as measured by an ECG was classified as being indicative of reduced bloodflow to the heart (known as myocardial ischemia). Our model seeks to provide such trust by discovering classifiers based on understandable concepts, such as those illustrated in Figure 1 (middle), where heartbeats are classified according to the existence of patterns known as shapelets. In this example, shapelet $s_{11}$ , representing a downward trend, and $s_{12}$ , representing an upward trend, serve as discriminative patterns that classify normal and ischemic heartbeats. A doctor may gain confidence in seeing such patterns with straightforward interpretations, such as in Figure 1 (right), that were deemed important to the predictions. + +![](images/c6c7051912820b8d6cac01fbfcb979e10e20eea49195f7e7b0699c583513fb42.jpg) +Figure 1: An example of shapelet-based interpretable TS classification on the ECG200 dataset. (Left) The set of shapelets with various lengths to capture features with different scales. (Middle) A classifier that associates the shapelets with categories, assigning importance scores to them. (Right) Two methods to interpret the classifier result in rule-like explanations. + +![](images/a4b4897cf1b3d0f5e0d69ca098a1042621d0641d5cd0ba6d8107f4fa7f5bed8b.jpg) + +![](images/e194c88650f1dda8dcd9e11de18135a8e8fbd02645511715e3479dd55af43ca0.jpg) + +Interpretability can be significant from two perspectives. Firstly, in applications such as healthcare and physical systems where safety is essential, interpreting a model allows us to validate reliability, trustworthiness, and fairness. Secondly, in challenging tasks, we can gain knowledge about the problem by interpreting patterns found by machine learning models during training. Existing interpretable time series methods (Zhao et al., 2023) include post hoc explainability which explain the behavior of a trained deep learning model often using a surrogate model (Queen et al., 2023), and self-explainable models for which model predictions are directly interpretable. + +In this study, we focus on self-explainable models. A recent self-explainable TS model, Neuro-Symbolic Time Series Classification (NSTSC) (Yan et al., 2022), combines a neuro-symbolic model (Riegel et al., 2020) with signal temporal logic (Mehdipour et al., 2021); soft-logic predicates are defined on each time stamp, and logic rules are learned to describe the classes. Although such approaches are defined to be interpretable, identifying the logical rules when applied to complex tasks can result in numerous predicates and logical operators. Furthermore, it is known that interpretability may lead to lower classification performance due to incomplete coverage of interpretable concepts or limited expressivity (Koh et al., 2020; Oikarinen et al., 2022; Havasi et al., 2022); such is the case for Concept Bottleneck Models (CBMs) (Koh et al., 2020), a popular interpretable model in computer vision. Similarly in TS, time-domain features (such as shapes and trends) are easy to understand but may not be able to capture other essential features such as those in the frequency domain. + +In addition to post-hoc explanations, the literature on combining black-box models with interpretable models includes approaches such as performing logical reasoning on concepts discovered by deep models (Lee et al., 2022) or using deep models to select from a set of interpretable primitives, which are then composed to form the final predictions (Okajima & Sadamasa, 2019). In this paper, with the goal of maintaining interpretability when appropriate while allowing for additional complexity where concept-level information is not significant, we propose an Interpretability Gated Network (InterpGN) that combines an interpretable expert with a deep neural network (DNN) expert. InterpGN uses a novel gating function to decide whether to use the interpretable expert's prediction or to rely on the DNN's expertise (as likely needed on challenging samples). Our interpretable expert, termed the Shapelet Bottleneck Model (SBM), introduces a variant of the Shapelet Transform (Lines et al., 2012) to build expressive yet interpretable predicates based on learned shapelets (Ye & Keogh, 2011) such as the patterns in Figure 1 (left). Our interpretable expert holds several advantages over existing methods such as fewer parameters than neuro-symbolic method NSTSC, improved shapelet selection due to our Shapelet Transform, and better accuracy due to gating on challenging samples. + +Our main contributions are summarized as follows: (1) a novel gating function that assigns samples to experts based on the confidence level of the interpretable expert, (2) a novel variant of the Shapelet Transform that improves interpretability compared to existing shapelet-based methods, and (3) quantitative metrics for interpretability and shapelet quality, where we show that our models improve in both metrics over existing shapelet-learning formulations. We further demonstrate that InterpGN outperforms state-of-the-art methods on the UEA multivariate TS classification archive (Bagnall et al., 2018), illustrate the interpretability of InterpGN on multivariate TS classification datasets, and finally apply our framework on a real-world healthcare dataset, MIMIC-III (Johnson et al., 2016). + +# 2 RELATED WORK + +Machine Learning Methods for TS Analysis Classical deep learning models such as Multilayer Perceptron (MLP), Fully Convolutional Network (FCN), and Residual Network (ResNet) (Wang et al., 2017) are usually considered as baselines. ROCKET (Dempster et al., 2020) uses random convolution kernels with various lengths to transform TS data and trains a linear classifier. Another direction is representation learning that uses unsupervised approaches to learn from positive and negative samples (Franceschi et al., 2019). For instance, TapNet (Zhang et al., 2020) proposes an attention prototype network to learn multivariate TS representations and address the issue of limited labeled data. Time Series Transformer (TST) (Zerveas et al., 2021) reconstructs TS from masked data to learn a pre-trained model that can be used for multiple types of downstream tasks. Recent works also find that when combined with deep neural networks such as Transformers (Vaswani et al., 2017), the patch-based modeling, which segments TS into channel-independent patches, is more effective than timestamp-based modeling in various tasks (Zuo et al., 2023; Nie et al., 2023; Wu et al., 2023). Although the above methods may achieve state-of-the-art performance, they lack interpretability. + +Interpretable Methods Pattern-based methods usually have some level of interpretability. (Zhao et al., 2023) surveys many methods for interpretable TS classification. A subset of pattern-based methods use shapelets, defined as discriminatory subsequences of TS data (Ye & Keogh, 2011) selected based on information gain. ShapeNet (Li et al., 2021) learns embeddings that encode subsequences with different lengths into a unified space using triplet loss, and then selects the most representative shapelets to use with Shapelet Transforms. Shapelets can also be learned using gradient-based methods (Grabocka et al., 2014), relaxing the definition of shapelets as sequences with certain patterns. However, with the original formulation, the learned shapelets have poor quality as they may not look similar to the actual subsequences. ADSN (Ma et al., 2020) improves shapelet quality using adversarial training. ShapeConv (Qu et al., 2024) initializes the shapelets as the cluster means of TS subsequence and uses an additional regularization to keep shapelets close to the actual subsequence during training. Besides shapelet-based methods, a recent pattern-based method RLPAM (Gao et al., 2022) first transform TS to a sequence of patterns and uses reinforcement learning to select the most informative patterns for classification. + +# 3 PROBLEM FORMULATIONS + +Notation Let $\mathcal{D} = \{(x_i, y_i) | i = 1, \dots, N\}$ denotes a TS classification dataset with $N$ samples, where $x_i \in \mathbb{R}^{M \times T}$ is a TS sample and $y_i \in \{1, \dots, C\}$ is the class label. Here, $M$ is the number of variables, $T$ is the length in timestamps, and $C$ is the number of categories. A multivariate TS sample $x_i$ can be viewed as a set of univariate TS samples where $x_i^m \in \mathbb{R}^T$ denotes the TS of the $m^{\text{th}}$ variable. $x_i^m_{i,t_1:t_2}$ denotes a subsequence of $x_i^m$ between timestamps $t_1$ and $t_2$ . + +Shapelets Shapelets were originally defined as discriminative TS subsequences to distinguish different categories (Ye & Keogh, 2011). Learning Time-series Shapelets (LTS) (Grabocka et al., 2014) combines Shapelet Transform with gradient-based optimization to learn a set of shapelets from scratch, where the definition of shapelets is relaxed to be short sequences with certain patterns. In this work, we follow the definition of LTS where the shapelets are the model's parameter to train. + +Shapelet-based TS Modeling Independently modeling each channel of a multivariate TS has been demonstrated to be an effective approach (Wu et al., 2023; Nie et al., 2023). In this paper, we consider a similar approach by formulating univariate shapelets for each variable separately. Let + +$$ +\mathcal {S} = \left\{s _ {k} ^ {m, l} | k = 1, \dots , K; m = 1, \dots , M; l \in L \right\} +$$ + +denote a set of shapelets, where $s_k^{m,l} \in \mathbb{R}^l$ denotes a shapelet on the $m^{\text{th}}$ channel with length $l$ and index $k$ , i.e., we learn $K$ shapelets for each possible length and channel. In this paper, we consider shapelets with multiple lengths where $L = \{\max(\lceil \delta T \rceil, 3) | \delta = 0.05, 0.1, 0.2, 0.3, 0.5, 0.8\}$ . Therefore, $S$ has a total of $MK|L|$ shapelets. + +Interpretability Existing methods gain different levels of interpretability by inputting interpretable features (Zuo et al., 2023) into a simple model such as a linear layer (Ma et al., 2020; Qu et al., 2024) + +![](images/324148be8f1c03251380d120f7283a3cb5d5d14cda68970c171f1a256fac35a2.jpg) +Figure 2: Overview of InterpGN. + +or SVM (Li et al., 2021). However, such approaches usually fail to provide explanations of their predictions based on distances features. For the interpretable expert, we build logical predicates using shapelets and the classifier directly provides rule-like explanations. Combining interpretable features with logic allows this approach to select essential shapelets since model weights associated with shapelets represent corresponding importance to predictions (Riegel et al., 2020). + +# 4 THE MIXTURE-OF-EXPERTS FRAMEWORK: INTERPGN + +In this section, we present the details of Interpretability Gated Networks (InterpGN). We first discuss the proposed variant of Shapelet Transforms to build logical predicates and the formulations of the Shapelet Bottleneck Model (SBM), and then discuss how explanations can be derived from SBM. Lastly, we present the novel gating function used by InterpGN along with the training procedure. An overview of InterpGN is given in Figure 2. + +# 4.1 BUILDING LOGICAL PREDICATES USING SHAPELETS + +A straightforward way to express predictions with logical classifiers is to use predicates built on features such as distances. Mueen et al. (2011) constructed a logical predicate with a threshold distance; however, when combined with LTS, we find this approach reduces shapelet quality (essential shapelets are not similar to the TS) as well as interpretability (notion of distance can vary across datasets) since the threshold distance does not directly reflect the existence of a shapelet (see Figure 3 for an example). Therefore, analogous to concepts in CBM, we view shapelets as interpretable concepts for TS and build logical predicates directly + +![](images/f95c0391854eff214d787af12e427cb9b26d5360a9d63a8aa37e2e6e2af42d64.jpg) +Figure 3: Comparison between shapelets learned by (left) radial basis function (RBF) based predicates and (right) threshold based predicates. The three most important shapelets are visualized. + +from shapelet distances. Consider the distance between $s_k^{m,l}$ and $x_i^m$ defined as: + +$$ +d _ {i, k} ^ {m, l} = \min _ {t = 1, \dots , T - l} \operatorname {d i s t} \left(s _ {k} ^ {m, l}, x _ {i, t: t + l} ^ {m}\right), \tag {1} +$$ + +where $\mathrm{dist}(s_k^{m,l},x_{i:t:t + l}^m)$ is the Euclidean distance between the two sequences. We introduce a variant of the Shapelet Transform, formally defined by + +$$ +p _ {i, k} ^ {m, l} = \max _ {t = 1 \dots , T - l} e ^ {- \left(\epsilon \cdot \operatorname {d i s t} \left(s _ {k} ^ {m, l}, x _ {i, t: t + l} ^ {m}\right)\right) ^ {2}} \tag {2} +$$ + +using a Gaussian radial basis function on the distance to measure the likelihood that $s_k^{m,l}$ exists in $x_i^m$ , where $\epsilon$ is a scaling parameter that controls the steepness of the kernel. We say that the + +set of shapelets $S$ transforms each sample $x_{i} \in \mathcal{D}$ to predicates $\mathbf{p}_i \in \mathbb{R}^{MK|L|}$ , where $\mathbf{p}_i = \left[p_{i,k}^{m,l} \mid k = 1, \dots, K; m = 1, \dots, M; l \in L\right]$ . + +# 4.2 SHAPELET BOTTLENECK MODEL - THE INTERPRETABLE EXPERT + +When constructing the SBM, we adopt a similar approach to LTS and CBM to preserve interpretability and produce rule-like classifiers. Formally, the predicates $\mathbf{p}_i$ are fed into a linear layer to compute the outputs + +$$ +r _ {i, c} = \sum_ {k = 1, \dots , K; m = 1, \dots , M; l \in L} w _ {c, k} ^ {m, l} p _ {i, k} ^ {m, l}, \forall c \in \{1, \dots , C \}. \tag {3} +$$ + +The SBM's output is $\mathbf{r}_i\in \mathbb{R}^C = [r_{i,1},\dots ,r_{i,C}]$ . An overview of SBM is given in Figure 2. Note that the different shapelet lengths are illustrated vertically under the Shapelet Bottleneck; each row allows shapelets of length $l$ across all variables. + +Training SBM is end-to-end differentiable and trained using gradient-based optimization. The parameters to be trained include the linear classifier weights $w_{c,k}^{m,l}$ and the shapelets $s_k^{m,l}$ , both of which are randomly initialized. In practice, gradients of the max operator in Equation 2 can be substituted by gradients of softmax using straight-through estimation. The objective function contains the following three loss functions: + +- Classification loss: softmax cross-entropy loss $\mathcal{L}_{\mathrm{ce}}$ on $(\mathbf{r_i},y_i)$ +- Shapelet diversity loss (Ma et al., 2020) to regulate learning redundant shapelets: + +$$ +\mathcal {L} _ {\mathrm {d i v}} = \frac {1}{2 K M | L |} \sum_ {m = 1} ^ {M} \sum_ {l \in L} \sum_ {k _ {1} = 1} ^ {K} \sum_ {\substack {k _ {2} = 1 \\ k _ {2} \neq k _ {1}}} ^ {K} e ^ {- \| s _ {k _ {1}} ^ {m, l} - s _ {k _ {2}} ^ {m, l} \| _ {2}}, \tag{4} +$$ + +- L1 regularization $\mathcal{L}_{\mathrm{reg}}$ on the classifier weights $w_{c,k}^{m,l}$ to encourage sparsity, select the most informative concepts, and produce simple classifiers. + +The overall loss function is $\mathcal{L}_{\mathrm{int}} = \mathcal{L}_{\mathrm{ce}} + \lambda_{\mathrm{div}}\mathcal{L}_{\mathrm{div}} + \lambda_{\mathrm{reg}}\mathcal{L}_{\mathrm{reg}}$ where $\lambda_{\mathrm{div}}$ and $\lambda_{\mathrm{reg}}$ are hyperparameters. + +# 4.3 INTERPRETATIONS + +A concept probability $p_{i,k}^{m,l}$ is a logical predicate whose value measures the existence of shapelet $s_k^{m,l}$ . The linear classifier behaves like weighted linear logic analogous to the operators in Riegel et al. (2020), where weights $w_{c,k}^{m,l}$ specify the importance of shapelet $s_k^{m,l}$ to class c. We propose two ways to interpret the model. + +Local Explainability Local explanations answer why the classification decision for a sample $x_{i}$ was made. In SBM, the explanation has the form of "sample $x_{i}$ belongs to class $c$ because $x_{i}$ contains shapelet $s_{k}^{m,l}$ ", whose corresponding $w_{c,k}^{m,l} p_{i,k}^{m,l}$ is significant. Consider Figure 1 in the Introduction where we visualize the two shapelets with the largest $w_{c,k}^{m,l} p_{i,k}^{m,l}$ for each class. Such interpretations allow us to visually validate the correctness of learned shapelets and classifiers. Note that, to the best of our knowledge, most existing shapelet-based methods (Qu et al., 2024) and post-hoc explanation methods (Queen et al., 2023) only provide local explainability. + +Global Explainability Global explanations provide knowledge about the classification problem, expressed in SBM by inductive logics without pertaining to particular samples. SBM offers the following global explanation: (1) $w_{c,k}^{m,\delta} > 0$ : samples in class $c$ should contain $s_k^{m,\delta}$ , (2) $w_{c,k}^{m,\delta} = 0$ : $s_k^{m,\delta}$ is unrelated to class $c$ , (3) $w_{c,k}^{m,\delta} < 0$ : samples in class $c$ should not contain $s_k^{m,\delta}$ . + +Most figures in this paper visualize shapelets with the highest weights in the linear classifier, validating the correctness of the global explanation. For some challenging tasks, we use local explanations to provide visually better explanations for specific samples. Note the difference between local and global explainability: local explanations discuss what does occur in a sample whereas global explanations discuss what should occur in a sample. + +# 4.4 MIXTURE-OF-EXPERTSGATING + +In the previous section, the shapelet bottleneck transforms TS into low-dimensional representations in the form of logical predicates. While the max operator in Equation (2) makes the classifier more interpretable, it also reduces expressiveness. For example, the predicates can only measure the existence of shapelets but lose information about the number of occurrences and corresponding timestamps. In TS with discriminative features in other domains, such as the frequency domain instead of the time domain, the shapelet bottleneck may not capture essential features for classification. To address this limitation, we employ a Mixture-of-Experts approach to build a partially-interpretable hybrid model. + +A Mixture-of-Experts (MoE) combines the output of multiple expert models with a gating network (Shazeer et al., 2017). Experts have different structures to capture different aspects of the data and the gating network assigns the work to the experts. IME (Ismail et al., 2023) views a simple model (such as linear regression or soft decision tree) as an interpretable gating network. From a different perspective, the interpretable expert itself can serve as the gating network, which reduces the number of parameters and improves interpretability. We introduce a gating function to assign the work to experts based on the confidence level of the interpretable expert. + +The outputs $\mathbf{r}_i$ minimize $\mathcal{L}_{\mathrm{ce}}$ during training. Denote $\hat{\mathbf{r}}_i = \mathrm{softmax}(\mathbf{r}_i)$ with components $\hat{r}_{i,c}$ corresponding to Equation (3). Then the optimal $\hat{\mathbf{r}}_i$ is a one-hot vector with $\hat{r}_{i,c} = 1$ if $y_{i} = c$ . Diversity of $\hat{r}_{i,c}$ thus measures confidence of the model. When combining an interpretable model and a DNN with MoE, the use of DNN should be inverse proportional to the confidence level of the interpretable model to maximize interpretability. Therefore, we design the gating function + +$$ +\eta \left(x _ {i}\right) = \frac {C \cdot \sum_ {c = 1} ^ {C} \left(\hat {r} _ {i , c}\right) ^ {2} - 1}{C - 1}, \tag {5} +$$ + +which is a modified Gini Index that measures the diversity of variables in $\hat{\mathbf{r}}_i$ . Intuitively, $\eta (x_{i}) = 0$ when values in $\hat{\mathbf{r}}_i$ are identical, and $\eta (x_{i}) = 1$ when $\hat{\mathbf{r}}_i$ is a one-hot vector. During training, the output of the hybrid model is then a mixture of the outputs of the interpretable expert and the DNN with ratio $\eta (x_i)$ : + +$$ +\mathbf {h} _ {i} = \mathbf {r} _ {i} \cdot \eta \left(x _ {i}\right) + \mathbf {z} _ {i} \cdot \left(1 - \eta \left(x _ {i}\right)\right), \tag {6} +$$ + +where $\mathbf{z}_i$ is the output of the DNN with input $x_i$ . During inference, we activate only the SBM and discard the DNN if the confidence of SBM is high. Specifically, given a gating value $\underline{\eta}$ , we set $\eta(x_i) = 1$ if $\eta(x_1) > \underline{\eta}$ . + +# 4.5 TRAINING OF INTERPGN + +The overall objective of the InterpGN framework is to minimize $\mathcal{L}_{\mathrm{hybrid}} = \beta \mathcal{L}_{\mathrm{int}} + \bar{\mathcal{L}}_{\mathrm{ce}}$ . Here, $\bar{\mathcal{L}}_{\mathrm{ce}}$ is another softmax cross-entropy loss on $(\mathbf{h}_i, y_i)$ to optimize the overall performance of the hybrid model. $\beta \in [0,1]$ is a scalar to weight the training of the interpretable expert, which is set to be either a constant hyperparameter or decaying with a cosine schedule. Intuitively, the $\mathcal{L}_{\mathrm{int}}$ term directly optimizes the SBM component, which ensures that the SBM is actively encouraged to find meaningful shapelets. This design prevents InterpGN from collapsing into a pure DNN model whenever the shapelet-based features are useful (see Figure 18 and Figure 19). The hybrid model is still end-to-end differentiable and trained using gradient-based optimizations methods. + +# 5 EXPERIMENTS + +We first compare InterpGN against various methods on the UEA multivariate TS classification archive, presenting insights gained from visualizing concept representations. Results from SBM without the additional expert are also given. We then demonstrate the benefits of our models on the real-world application of in-hospital mortality early prediction (Harutyunyan et al., 2019) using the MIMIC III dataset. We conclude with ablation studies on the effects of each component in our model. As a basic InterpGN design, we combine the SBM with a Fully Convolutional Network (FCN) since it has best performance among the three basic deep models for TS classification (Wang et al., 2017). Details of the experimental setup are provided in Appendix A. + +Table 1: Comparison on 30 datasets from the UEA archive. The best accuracy for each dataset is marked with bold, the second-best is marked with italic, and the third-best is marked with underline. + +
DatasetClassicalDeep LearningWith Interpretable FeaturesOurs
STRFDTWFCNTS2VecTimesNetTSTPatchTSTSVP-TShapeNetRLPAMShapeConvSBMInterpGN
Avg. Accuracy0.6450.6500.7460.7040.7020.7090.6110.7300.6970.7400.7430.7260.760
Avg. Rank9.7009.1385.0007.5337.5176.77810.4145.2676.5675.4005.5005.7333.500
Num. Top-12140140527238
Num. Top-3211423911151310816
Wins/Draws282723272518271925202020-
Losses2273492115101010-
Wilcoxon p-value0.0000.0000.0030.0000.0000.0010.0000.0660.0010.1120.0090.003-
+ +# 5.1 MULTIVARIATE TIME SERIES CLASSIFICATION + +First, we evaluate the performance of InterpGN on 30 datasets from the UEA multivariate TS classification archive and compare with baseline methods including (1) classical search-based method: Shapelet Transform with Random Forest Classifier (STRF) and DTW (Chen et al., 2013), (2) black-box deep learning methods: FCN (Wang et al., 2017), TS2Vec (Yue et al., 2022), TimesNet (Wu et al., 2023), TST (Zerveas et al., 2021), PatchTST (Nie et al., 2023), SVP-T (Zuo et al., 2023), and (3) methods with interpretable features: ShapeNet (Li et al., 2021), RLPAM (Gao et al., 2022), ShapeConv (Qu et al., 2024). + +Table 1 presents average classification accuracy across the UEA datasets; the full results are included in Table 5 of Appendix B.1. Based on the average rank across the 30 datasets, InterpGN outperforms the baseline methods and SBM achieves comparable performance without help from the FCN. + +# 5.1.1 INTERPRETABILITY + +In addition to its effective performance, SBM provides interpretable logical classifiers. Figure 4 visualizes shapelets learned by SBM on a multivariate TS dataset from global explanations, where the blue shapelets have the highest positive weights and the red shapelets have the lowest negative weights. Figure 4 visually confirms that the models capture discriminative shapelet features. + +![](images/228409ee7ee03c60aab02a4b46d0a193ac38d19e2d04f6fc578de2fe00db8a41.jpg) +Figure 4: Visualization of the UGL dataset from the UEA archive with accelerometer readings of eight gestures. For example, in $(g)$ , the classifier can be interpreted as: a "CW Circle" gesture should contain the blue shapelet but not the red shapelet in channel 1. + +# 5.1.2 SHAPELET BOTTLENECK REPRESENTATION + +We explore the effectiveness of the shapelet predicates by viewing probabilities $\mathbf{p}_i$ as representations for TS data. Figure 5 displays the EP dataset using the dimensionality reduction technique t-SNE (van der Maaten & Hinton, 2008). Representations learned by SBM and InterpGN are clearly more separable than the raw TS data. While a few samples are mixed into incorrect clusters (e.g., blue mixed into green), the DNN in the InterpGN model can make corrections and result in better accuracy than SBM. Shading intensity of data points in Figure 5 (c) represents $\eta(x_i)$ . Intuitively, predictions of shaded points are interpretable as they are based on SBM while lighter points rely more on the DNN. We observe that most transparent points lie along the cluster boundaries, meaning InterpGN learns to use interpretable logical classifier for easier-to-classify samples while relying on the DNN to classify the difficult boundary samples which can be identified as requiring additional expertise. In Figure 17, we further present the behavior of InterpGN by visualizing the distribution of $\eta(x_i)$ . We can conclude that the predictions of InterpGN is consistent with SBM when $\eta(x_i)$ is high, preserving interpretability for those samples. + +![](images/2d5d8d9de2ffee68bf72c7588158da70e1c9bb5ed20bed1486f1fb89c3d41bca.jpg) +Figure 5: t-SNE dimensionality reduction of (a) raw data $x_{i}$ , (b) $\mathbf{p}_i$ of SBM, and (c) $\mathbf{p}_i$ of InterpGN on the $EP$ dataset. Each color represents samples with a specific label. Samples with low $\eta(x_{i})$ from InterpGN lie on the boundary, i.e., are more difficult to predict and can benefit from additional expertise. + +![](images/cfe4cf8160ec7ced574e1f6419f313d7ccaa6fe7d44ac79ba3d2441e4f2cc8f8.jpg) + +![](images/3ad44ed016f3e6fc5f3489222aa11daf04b48e4b2a39baf8c9ed767d61701bc3.jpg) + +# 5.2 PREDICTING IN-HOSPITAL MORTALITY + +The MIMIC-III dataset contains electronic healthcare records from ICU patients. We follow the procedure in (Harutyunyan et al., 2019) to preprocess and generate data to predict in-hospital mortality based on patient records from the first 48 hours after entering an ICU. Setup details are provided in Appendix A.2. Table 2 shows results illustrating how InterpGN helps SBM on the difficult samples. + +Interpretability Clinical records from the MIMIC-III dataset are challenging due to sample diversity and missing values. Figure 6 highlights an example of local explanations on two samples. For better representation, we visualize the five most essential shapelets on their corresponding channels and omit other channels. The model captures long-term discriminative trends in three channels, HR, MBP and OS. The shapelets and classifier can be interpreted as: the + +Table 2: Results for in-hospital mortality predication on the MIMIC-III dataset. + +
MetricSTRFFCNSBMInterpGN
Accuracy0.6530.6930.6580.703
F10.6390.6750.6570.657
Recall0.6150.6340.6570.569
Precision0.6660.7340.6590.784
ROC-AUC0.6530.6980.6580.703
+ +first patient passed away due to decreasing HR, increasing MBP, and drop in OS; whereas the second survived because of increasing HR after a local drop, rapid decrease in MBP, and steady OS. In real-world scenarios, these interpretations could bring more insights to clinical applications than DNNs that only provide black-box predictions. + +![](images/7f67809ad79b01797b6af89440ec1a4f28112e588d670b2e49bb2a15a10736cf.jpg) +Figure 6: Local explanations of SBM for in-hospital mortality predication. The variables in the figure are: Heart Rate (HR), Mean Blood Pressure (MBP), Oxygen Saturation (OS), Respiratory Rate (RR), and Temperature (Temp). + +![](images/45c314d59225be3a2b3bbb45156eba1993558df0e4ade5a06879730f07a5dfb9.jpg) + +# 5.3 EFFECTS OF HYPERPARAMETERS ON INTERPRETABILITY AND SHAPELET QUALITY + +Analogous to the results presented in Figure 1 and Section 5.1.1, existing interpretable models mainly demonstrate qualitative results on interpretability by visualizing the interpretable features (Ma et al., 2020; Qu et al., 2024). However, there remains a lack of quantitative metrics to measure the level of interpretability and quality of features. Therefore, we introduce two additional metrics to quantitatively assess the interpretable models. + +Interpretability metric: Naturally, the prediction from the model is considered more interpretable if fewer features are needed to simulate and understand the prediction. With a linear classifier taking logical predicates as inputs, interpretability of SBM can be measured by the sparsity of the classifier weights since fewer shapelets contribute to the prediction as weight sparsity increases. As a metric for sparsity, we choose three empirical thresholds and compute the ratio of weights above each threshold. Formally, the sparsity metrics are defined as + +$$ +\text {r a t i o} = \frac {1}{| \mathcal {W} |} \sum_ {w \in \mathcal {W}} \mathbb {1} (| w | > t), \text {f o r} t \in \{1, 0. 5, 0. 1 \}. \tag {7} +$$ + +Additionally, as a relative sparsity measurement, we also compute the Gini coefficient of $|w|$ . + +Shapelet quality metric: In order to produce reliable representations in shapelet-based models, the shapelets need to be "close" to the actual TS subsequences. Therefore, shapelet quality can be measured by shapelet distances (defined by Equation 1). In a prediction, more important shapelets should be expected to have higher quality. Therefore, for our SBM, the shapelet quality metric is defined as + +$$ +\text {s h a p e l e t} = \frac {\mathbb {1} \left(\hat {y} _ {i} = y _ {i}\right)}{M K | L |} \sum_ {m = 1} ^ {M} \sum_ {l \in L} \sum_ {k = 1} ^ {K} \max \left(0, w _ {y _ {i}, k} ^ {m, l}\right) d \left(x _ {i} ^ {m}, s _ {k} ^ {m, l}\right), \left(x _ {i}, y _ {i}\right) \in \mathcal {D} _ {\text {t e s t}} \tag {8} +$$ + +which measures the shapelet distances for samples that are correctly classified, averaged over all shapelets in SBM and weighted by their corresponding classifier weight if $w_{c,k}^{m,l} > 0$ . Low shapelet error reflects that the essential shapelets for the prediction are close to the actual TS subsequences which represent high shapelet quality. + +Results and Analysis We conduct an ablation study on the effect of hyperparameters on classification accuracy, interpretability, shapelet quality, and interpretable expert utility. Details for the ablation study setup are summarized in Appendix A.4. The results are summarized in Tables 6, 7, 8 and Figures 20, 21, 22, 23, which lead to the following respective conclusions: + +- Number of shapelet $K$ determines the expressiveness of SBM. Table 6 shows that increasing $K$ improving accuracy while additionally improving shapelet quality since the shapelet could capture more sample-specific patterns. Although the classifier weights also become sparser, the absolute number of weights above the threshold values may also increase. Therefore, the effect of $K$ on interpretability may not be clearly concluded. In InterpGN, the SBM utility rate $\eta$ also increase as $K$ increase since the SBM becomes more expressive. +- Schedule of loss weighting $\beta$ controls the training of the interpretable expert in InterpGN. If $\beta$ decays with a cosine schedule, the SBM no longer trains on samples that cannot be confidently predicted as the models get trained. Table 7 shows that, compared to a constant schedule, models trained with the cosine schedule result in slightly worse accuracy but improve in both shapelet quality and interpretability since the SBMs focus more on samples where shapelet features are useful. As less samples are fitted, $\eta$ also decreases. +- Predicate type defines the method of building logical predicates from shapelet distances. In our models, the SBM uses the RBF predicates defined in Equation 2. Another commonly used formulation is a linear predicate (Mueen et al., 2011; Yan et al., 2022) which computes threshold-based predicates by $p_{i,k}^{m,l} = \text{sigmoid}(c_k^{m,l} - d_{i,k}^{m,l})$ where $c_k^{m,l}$ is the threshold value to learn. Table 8 shows that our RBF predicates outperform linear predicates in accuracy, shapelet quality, and interpretability. +- $\epsilon$ affects the steepness of the RBF kernels. A large $\epsilon$ defines a tight kernel and pushes the shapelet to be close to the TS data. Figure 20 demonstrates that increasing $\epsilon$ improves shapelet quality in the SBM but significantly reduces the accuracy for $\epsilon \geq 5$ . $\epsilon = 1$ offers the best balance between shapelet quality and accuracy. +- Weight regularization $\lambda_{\mathrm{reg}}$ affects the sparsity of classifier weights and the number of shapelets contributing to the predictions. Figure 23 shows that increasing $\lambda_{\mathrm{reg}}$ improves interpretability without significantly affecting the accuracy for $0 \leq \lambda_{\mathrm{reg}} \leq 1$ . +- Shapelet diversity regularization $\lambda_{\mathrm{div}}$ encourages learning different shapelets. Figure 22 leads us to conclude that $\lambda_{\mathrm{div}}$ does not have a significant effect on the three metrics. + +- Gating value $\underline{\eta}$ controls the threshold of discarding the DNN during inference. Prediction of samples with $\eta (x_i) > \underline{\eta}$ only relies on the SBM, maximizing their interpretability. Figure 21 shows that reducing the gating value results in slight degrade in accuracy, where the difference in average accuracy between using $\underline{\eta} = 0.5$ and $\underline{\eta} = 1$ is 0.0035. + +# 5.4 EXTENDED EXPERIMENTS + +Finally, we provide preliminary results for more extensive experiments, including the following: + +- Architecture of the DNN expert within the InterpGN: We experiment with four supervised deep learning models: FCN, Transformer, PatchTST, and TimesNet (see Appendix C.1). Among the tested architectures, InterpGN with FCN achieves the highest accuracy on most datasets. Interestingly, we observe that the choice of DNN significantly affects $\eta$ for each dataset, reflecting the compatibility between the SBM and the DNN. This highlights a complex relationship between the features learned by the SBM and those captured by different DNN architectures, which may be worth more in-depth study. +- Shapelet distance metric and classifier architecture in the SBM: For the shapelet distance function dist, we further compare cosine similarity and Pearson correlation with the conventional Euclidean distance (see Appendix C.2). For the classifier in SBM, we compare bi-linear and attention-based classifiers, which could model more complex relationships between shapelets, with the conventional linear classifier (see Appendix C.3). These variants sometimes yield better performance on some datasets, but not consistently, indicating that they could be meaningful architecture choices to tune for each dataset. +- Faithfulness of shapelets learned by SBM: We follow Alvarez Melis & Jaakkola (2018) to assess the faithfulness of shapelets learned by the SBM, which measures the correlation between the presence of essential shapelets and the predictions of SBM (see Appendix B.2.1). Over the 30 UEA datasets, we observe high faithfulness on most of the datasets. Notably, all datasets have faithfulness greater than 0, indicating that the learned shapelets are always positively correlated with the predictions. +- Time series extrinsic regression: To further examine the generalizability and limitations of the proposed methods, we apply them to time series extrinsic regression tasks (Tan et al., 2021). In order to leverage classification models for regression, we train and evaluate them using an ordinal regression framework, employing the Continuous Ranked Probability Score (CRPS) (Gneiting & Raftery, 2007) as the performance metric. Additional details are provided in Appendix C.4. + +# 6 CONCLUSION AND LIMITATIONS + +In this paper, we address the limitations of existing TS classification methods. We introduce InterpGN, which leverages the trade-off between interpretability and performance. We present a variant of the Shapelet Transform to build logical predicates from shapelets and propose a novel gating function design based on confidence of the interpretable model. Our experiments demonstrate that InterpGN outperforms existing methods while preserving interpretability for most samples. We also interpreted and analyzed patterns and classifiers learned by the models on various datasets, and applied our models to the MIMIC-III dataset to provide interpretable features and discover knowledge on a real-world task. In the future, we plan to extend the shapelet-based approaches to other time series analysis tasks (Ansari et al., 2024) and build scalable interpretable models (Wen et al., 2024). + +We note two limitations of our study. Firstly, in some classification rules, the most important shapelet for class $c$ may not look similar to subsequences of TS in class $c$ . Such rules tend to have interpretations with form " $x_i$ belongs to class $c$ since it does not contain the essential shapelets for $c' \neq c$ " or " $x_i$ belongs to class $c$ since other $c' \neq c$ do not contain shapelet $s$ ". For example, the blue shapelet in Figure 4 (a) may not capture the essential trend for the "Angle" movement but it can still be correctly categorized since it does not contain the essential shapelets for other categories. Secondly, note that we have studied a simple design which includes one interpretable expert and one DNN. Analogous to the MoE (Shazeer et al., 2017) framework, InterpGN can scale up by integrating more experts. For example, multiple interpretable models can be included using a hierarchical gating approach, while multiple DNN models can be combined using the original MoE approach. + +# ACKNOWLEDGMENT + +This work is funded through the IBM-RPI Future of Computing Research Collaboration. We thank the teams at UCR, UEA, and Monash University for their efforts in creating and publicly sharing the benchmark datasets. We also appreciate Wu et al. for providing the open-source time series benchmarking repository. Finally, we are grateful to the anonymous reviewers of NeurIPS 2024 and ICLR 2025 for their insightful and constructive feedback, which greatly enhanced the quality and scope of our work. + +# REFERENCES + +Talal AA Abdullah, Mohd Soperi Mohd Zahid, Waleed Ali, and Shahab Ul Hassan. B-lime: An improvement of lime for interpretable deep learning classification of cardiac arrhythmia from ecg signals. In *Processes*, 2023. +Taha Aksu, Gerald Woo, Juncheng Liu, Xu Liu, Chenghao Liu, Silvio Savarese, Caiming Xiong, and Doyen Sahoo. Gift-eval: A benchmark for general time series forecasting model evaluation. arXiv preprint arXiv:2410.10393, 2024. +David Alvarez Melis and Tommi Jaakkola. Towards robust interpretability with self-explaining neural networks. Advances in neural information processing systems, 31, 2018. +Abdul Fatir Ansari, Lorenzo Stella, Ali Caner Turkmen, Xiyuan Zhang, Pedro Mercado, Huibin Shen, Oleksandr Shchur, Syama Sundar Rangapuram, Sebastian Pineda Arango, Shubham Kapoor, Jasper Zschiegner, Danielle C. Maddix, Hao Wang, Michael W. Mahoney, Kari Torkkola, Andrew Gordon Wilson, Michael Bohlke-Schneider, and Bernie Wang. Chronos: Learning the language of time series. Transactions on Machine Learning Research, 2024. ISSN 2835-8856. +Saira Aziz, Sajid Ahmed, and Mohamed-Slim Alouini. Ecg-based machine-learning algorithms for heartbeat classification. In Nature: Scientific Reports, volume 11, 2021. +Anthony Bagnall, Hoang Anh Dau, Jason Lines, Michael Flynn, James Large, Aaron Bostrom, Paul Southam, and Eamonn Keogh. The UEA multivariate time series classification archive, 2018. arXiv preprint arXiv:1811.00075, 2018. +Yanping Chen, Bing Hu, Eamonn Keogh, and Gustavo EAPA Batista. DTW-D: time series semi-supervised learning from a single example. In Proceedings of the 19th ACM SIGKDD international conference on Knowledge discovery and data mining, pp. 383-391, 2013. +Angus Dempster, François Petitjean, and Geoffrey I Webb. Rocket: exceptionally fast and accurate time series classification using random convolutional kernels. Data Mining and Knowledge Discovery, 34(5):1454-1495, 2020. +Jean-Yves Franceschi, Aymeric Dieuleveut, and Martin Jaggi. Unsupervised scalable representation learning for multivariate time series. Advances in neural information processing systems, 32, 2019. +Ge Gao, Qitong Gao, Xi Yang, Miroslav Pajic, and Min Chi. A reinforcement learning-informed pattern mining framework for multivariate time series classification. In 31st International Joint Conference on Artificial Intelligence (IJCAI), 2022. +Tilmann Gneiting and Adrian E Raftery. Strictly proper scoring rules, prediction, and estimation. Journal of the American statistical Association, 102(477):359-378, 2007. +Josif Grabocka, Nicolas Schilling, Martin Wistuba, and Lars Schmidt-Thieme. Learning time-series shapelets. In Proceedings of the 20th ACM SIGKDD international conference on Knowledge discovery and data mining, pp. 392-401, 2014. +Hrayr Harutyunyan, Hrant Khachatrian, David C Kale, Greg Ver Steeg, and Aram Galstyan. Multitask learning and benchmarking with clinical time series data. *Scientific data*, 6(1):96, 2019. +Marton Havasi, Sonali Parbhoo, and Finale Doshi-Velez. Addressing leakage in concept bottleneck models. Advances in Neural Information Processing Systems, 35:23386-23397, 2022. + +Aya Abdelsalam Ismail, Sercan O Arik, Jinsung Yoon, Ankur Taly, Soheil Feizi, and Tomas Pfister. Interpretable mixture of experts. Transactions on Machine Learning Research, 2023. ISSN 2835-8856. +Alistair EW Johnson, Tom J Pollard, Lu Shen, Li-wei H Lehman, Mengling Feng, Mohammad Ghassemi, Benjamin Moody, Peter Szolovits, Leo Anthony Celi, and Roger G Mark. Data descriptor: Mimic-iii, a freely accessible critical care database. Scientific data, 3(160035):1-9, 2016. +Pang Wei Koh, Thao Nguyen, Yew Siang Tang, Stephen Mussmann, Emma Pierson, Been Kim, and Percy Liang. Concept bottleneck models. In International conference on machine learning, pp. 5338-5348. PMLR, 2020. +Seungeon Lee, Xiting Wang, Sungwon Han, Xiaoyuan Yi, Xing Xie, and Meeyoung Cha. Self-explaining deep models with logic rule reasoning. Advances in Neural Information Processing Systems, 35:3203-3216, 2022. +Guozhong Li, Byron Choi, Jianliang Xu, Sourav S Bhowmick, Kwok-Pan Chun, and Grace Lai-Hung Wong. Shapenet: A shapelet-neural network approach for multivariate time series classification. In Proceedings of the AAAI conference on artificial intelligence, volume 35, pp. 8375-8383, 2021. +Jason Lines, Luke M Davis, Jon Hills, and Anthony Bagnall. A shapelet transform for time series classification. In Proceedings of the 18th ACM SIGKDD international conference on Knowledge discovery and data mining, pp. 289-297, 2012. +Qianli Ma, Wanqing Zhuang, Sen Li, Desen Huang, and Garrison Cottrell. Adversarial dynamic shapelet networks. In Proceedings of the AAAI conference on artificial intelligence, volume 34, pp. 5069-5076, 2020. +Noushin Mehdipour, Cristian-Ioan Vasile, and Calin Belta. Specifying user preferences using weighted signal temporal logic. IEEE Control Systems Letters, 5(6):2006-2011, 2021. doi: 10.1109/LCSYS.2020.3047362. +Abdullah Mueen, Eamonn Keogh, and Neal Young. Logical-shapelets: an expressive primitive for time series classification. In Proceedings of the 17th ACM SIGKDD international conference on Knowledge discovery and data mining, pp. 1154-1162, 2011. +I. Neves, D. Folgado, S. Santos, M. Barandas, A. Campagner, L. Ronzio, F. Cabitza, and H. Gamboa. Interpretable heartbeat classification using local model-agnostic explanations on ecgs. In Computers in Biology and Medicine, 2021. +Yuqi Nie, Nam H Nguyen, Phanwadee Sinthong, and Jayant Kalagnanam. A time series is worth 64 words: Long-term forecasting with transformers. In The Eleventh International Conference on Learning Representations, 2023. +Tuomas Oikarinen, Subhro Das, Lam M Nguyen, and Tsui-Wei Weng. Label-free concept bottleneck models. In The Eleventh International Conference on Learning Representations, 2022. +Yuzuru Okajima and Kunihiko Sadamasa. Deep neural networks constrained by decision rules. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pp. 2496-2505, 2019. +Eric Qu, Yansen Wang, Xufang Luo, Wenqiang He, Kan Ren, and Dongsheng Li. Cnn kernels can be the best shapelets. In The Twelfth International Conference on Learning Representations, 2024. +Owen Queen, Tom Hartvigsen, Teddy Koker, Huan He, Theodoros Tsiligkaridis, and Marinka Zitnik. Encoding time-series explanations through self-supervised model behavior consistency. In Advances in Neural Information Processing Systems, volume 36, pp. 32129-32159, 2023. +Ryan Riegel, Alexander Gray, Francois Luus, Naweed Khan, Ndivhuwo Makondo, Ismail Yunus Akhalwaya, Haifeng Qian, Ronald Fagin, Francisco Barahona, Udit Sharma, Shajith Ikbal, Hima Karanam, Sumit Neelam, Ankita Likhyani, and Santosh Srivastava. Logical neural networks, 2020. + +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. In International Conference on Learning Representations, 2017. +Chang Wei Tan, Christoph Bergmeir, Francois Petitjean, and Geoffrey I Webb. Time series extrinsic regression. Data Mining and Knowledge Discovery, pp. 1-29, 2021. +Laurens van der Maaten and Geoffrey Hinton. Visualizing data using t-sne. In *Journal of Machine Learning Research*, volume 9, pp. 2579-2605, 2008. +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, volume 30, 2017. +Zhiguang Wang, Weizhong Yan, and Tim Oates. Time series classification from scratch with deep neural networks: A strong baseline. In 2017 International joint conference on neural networks (IJCNN), pp. 1578-1585. IEEE, 2017. +Yunshi Wen, Tengfei Ma, Tsui-Wei Weng, Lam M. Nguyen, and Anak Agung Julius. Abstracted shapes as tokens - a generalizable and interpretable model for time-series classification. In The Thirty-eighth Annual Conference on Neural Information Processing Systems, 2024. +Haixu Wu, Tengge Hu, Yong Liu, Hang Zhou, Jianmin Wang, and Mingsheng Long. Timesnet: Temporal 2d-variation modeling for general time series analysis. In International Conference on Learning Representations, 2023. +Ruixuan Yan, Tengfei Ma, Achille Fokoue, Maria Chang, and Agung Julius. Neuro-symbolic models for interpretable time series classification using temporal logic description. In 2022 IEEE International Conference on Data Mining (ICDM), pp. 618-627. IEEE, 2022. +Lexiang Ye and Eamonn Keogh. Time series shapelets: a novel technique that allows accurate, interpretable and fast classification. Data mining and knowledge discovery, 22:149-182, 2011. +Zhihan Yue, Yujing Wang, Juanyong Duan, Tianmeng Yang, Congrui Huang, Yunhai Tong, and Bixiong Xu. TS2Vec: Towards universal representation of time series. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 36, pp. 8980-8987, 2022. +George Zerveas, Srideepika Jayaraman, Dhaval Patel, Anuradha Bhamidipaty, and Carsten Eickhoff. A transformer-based framework for multivariate time series representation learning. In Proceedings of the 27th ACM SIGKDD conference on knowledge discovery & data mining, pp. 2114-2124, 2021. +Xuchao Zhang, Yifeng Gao, Jessica Lin, and Chang-Tien Lu. Tapnet: Multivariate time series classification with attentional prototypical network. In Proceedings of the AAAI conference on artificial intelligence, volume 34, pp. 6845-6852, 2020. +Ziqi Zhao, Yucheng Shi, Shushan Wu, Fan Yang, Wenzhan Song, and Ninghao Liu. Interpretation of time-series deep models: A survey. arXiv preprint arXiv:2305.14582, 2023. +Rundong Zuo, Guozhong Li, Byron Choi, Sourav S Bhowmick, Daphne Ngar-yin Mah, and Grace LH Wong. Svp-t: a shape-level variable-position transformer for multivariate time series classification. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 37, pp. 11497-11505, 2023. + +# A EXPERIMENTAL SETUP + +Environment. All the experiments are implemented using Python 3.11 and PyTorch 2.4.0. All the experiments run on a NVIDIA V100-SXM2-32GB GPUs. The SBM and InterpGN are trained on a single GPU. The STRF is implemented using Random Shapelet Transforms from the Aeon Toolkit2 and Random Forest Classifiers from the Scikit-learn package, which runs on CPU using 64 threads. + +# A.1 UEA MULTIVARIATE TIME-SERIES CLASSIFICATION ARCHIVE + +The UEA multivariate TS classification archive (Bagnall et al., 2018) contains 30 datasets collected from various domains. Details of the 30 datasets are provided in Table 4. Data preprocessing and training procedure follow the benchmarking repository provided by Wu et al. (2023) $^{3}$ . The default hyperparameter to produce results in Table 1 and Table 5 are summarized in Table3. For each dataset, we train the models on the default training split with 5 different random seeds and report the average accuracy on the test split. Statistics on experiment variations could refer to Appendix B.4. + +Table 3: Default hyperparameters. + +
HyperprameterDefault value
Number of shapeletK=10
Steepness of RBF kernelsε=1
Diversity loss weightλdiv=0.1
Sparsity loss weightλreg=0.1
β scheduleconstant
Inference gating valueη=1
OptimizerAdam
Learning rate0.005
Weight decay0
Batch size32
+ +The metrics in Table 1 and Table 5 are: + +- Avg. Accuracy: Average test accuracy. +- Avg. Rank: Average ranking of the method among all baseline methods. +- Num. Top-1: Number of datasets the method performs the best among all baseline methods. +- Num. Top-3: Number of datasets the method achieves top-3 accuracy among all baseline datasets. +- Wins/Draws: Number of datasets that InterpGN achieves better/same accuracy compared to other baseline methods. +- Looses: Number of datasets that InterpGN achieves worse accuracy compared to other baseline methods. +- Wilcoxon p-value: p-value in the Wilcoxon signed-rank test, which measures if the performance of InterpGN is statistically significant compared to the baseline methods. A small p-value indicates significance, while a large p-value indicates the InterpGN and the baseline method have comparable performance on the UEA datasets. + +Table 4: Information of the 30 benchmark datasets from the UEA archive. + +
DatasetDataset CodeTrain Size NtrainTest Size NtestVariables MLength TCategories C
ArticulatoryWordRecognitionAWR275300914425
AtrialFibrillationAF151526403
BasicMotionsBM404061004
CharacterTrajectoriesCT14221436311920
CricketCK108726119712
DuckDuckGeeseDDG505013452705
ERingER302704656
EigenWormsEW1281316179485
EpilepsyEP13713832064
EthanolConcentrationEC261263317514
FaceDetectionFD58903524144622
FingerMovementsFM31610028502
HandMovementDirectionHM16074104004
HandwritingHW15058035226
HeartbeatHB204205614052
InsectWingbeatIW25000250002002210
JapaneseVowelsJV27037012299
LSSTLSST2459246663614
LibrasLB18018024515
MotorImageryMI2781006430002
NATOPSNT18018024516
PEMS-SFPM2671732631447
PenDigitsPD749434982810
PhonemeSpectraPH331533531121739
RacketSportsRS1511526304
SelfRegulationSCP1SCP126829368962
SelfRegulationSCP2SCP2200180711522
SpokenArabicDigitsSAD65992199139310
StandWalkJumpSWJ1215425003
UWaveGestureLibraryUGL12032033158
+ +# A.2 PREDICTING IN-HOSPITAL MORTALITY ON MIMIC-III + +From the original MIMIC-III dataset, we first extract time-series and impute missing values using the method proposed by Harutyunyan et al. (2019). For predicting in-hospital mortality, the data is highly imbalance, with more than $80\%$ positive samples (patient survived). Therefore we randomly select a subset of 1500 positive and 1500 negative samples to evaluate our models. A sample in the dataset is a TS with $M = 9$ and $T = 48$ . We further divide the subset into $80\%$ training and $20\%$ validation to evaluate the performance using 5-fold cross validation. Omitting categorical variables in the MIMIC-III datasets, the TS data has the following 9 variabels: + +1. Diastolic blood pressure (DBP), +2. Fraction inspired oxygen (FIO), +3. Heart Rate (HR), +4. Mean blood pressure (MBP), +5. Oxygen saturation (OS), +6. Respiratory rate (RR), +7. Systolic blood pressure (SBP), +8. Temperature (Temp), +9. Glucose (Glu). + +# A.3 LIMITATION IN IMPLEMENTATION + +When combining shapelet learning with modern deep learning frameworks such as PyTorch, the learning suffers from a memory overhead. Intuitively, the transformations in Equation 1 and Equation 2 slide $s_k^{m,l}$ over $x_i$ and take the minimum/maximum, which is analogous to a convolution layer with pooling. In practice, for efficiency concern, the memory cost of this operation is $O(T \cdot l)$ . When $T$ is large (e.g. $T > 2000$ ) this operation requires numerous GPU memory, mainly due to the unnecessary intermediate variables and gradients are retained. However, the traditional convolution operation does not suffer from this because of low-level optimizations from CUDA, which does not retain the intermediate gradients. Note that ShapeConv (Qu et al., 2024) makes a connection between shapelet transform and convolution by: + +$$ +d \left(x _ {i} ^ {m}, s _ {k} ^ {m, l}\right) = - 2 \max _ {j = 1, \dots , T - l + 1} \left[ s _ {k} ^ {m, l} * x _ {i} ^ {m} - \frac {\| s _ {k} ^ {m , l} \| _ {2} ^ {2} + \| x _ {i} ^ {m} \| _ {2} ^ {2}}{2} \right], \tag {9} +$$ + +where $s_k^{m,l} * x_i^m$ is the convolution (cross-correlation) operation. However, we found that, in actual implementations, the additional norm term still suffers from the memory overhead. + +To address this memory limitation on very long sequences, we provide two implementations for the time-memory trade-off: + +1. A time-efficient implementation using large matrix operations: + +```latex +$\begin{array}{rl} & {\mathrm{x} = \mathrm{x}.unfold(2,\mathrm{shapelet\_length},1)}\\ & {\mathrm{x} = \mathrm{x}.permute((0,2,1,3)).unsqueeze(2)}\\ & {\mathrm{d} = \mathrm{dist}(\mathrm{x} - \mathrm{shapelets}).mean(\mathrm{dim} = -1)} \end{array}$ +``` + +2. A memory-efficient implementation using loops: + +```python +class ShapeletDistanceFunc(torch.autograd.Function): + def forward(ctx, x, s): + ctx.save_for_backward(x, s) + output = torch.cat([[dist(s - x[:, :, i:i+s.shape[-1]]), + for i in range(x.shape[-1] - s.shape[-1] + 1)], dim=1) + return output + def backward(ctx, grad_output): + # Compute gradient of s + return 0, grad_s +def ShapeletDistance(x, s): + return ShapeletDistanceFunc.apply(x, s) +d = ShapeletDistance(x, shapelet) +``` + +On the largest datasets, this memory-efficient implementation takes less than 12 GB of GPU memory, but requires significantly more time to compute. + +Another method to mitigate this issue is by using stride. For example, compared to traditional convolution operation Conv1d(), $s_k^{m,l}$ transforms $x_i$ into $p_{i,k}^{m,l}$ using Equation 2 with in_channels = 1, out_channels = 1, kernel_size = l, stride = 1, padding = 1, and dilation = 1. Memory cost reduces as stride increase. When $l$ is large, this would not bring significant effects since the learned shapelets are abstracted patterns. In practice, we find that setting stride = log(l) results in the same level of performance as stride = 1 on most datasets. + +# A.4 ABLATION STUDY SETUP CHOICES AND EXPLANATIONS + +- Main experiment: Unlike existing methods that perform dataset-specific hyperparameter tuning to achieve optimal performance, we use the same set of default hyperparameters across all datasets, and later study the effect of each hyperparameter on the metrics in ablation study. + +- Ablation study: Ablation study in Section 5.3 is conducted on the 30 UEA datasets. For each ablation case, we only change the hyperparameter of interest and keeping other hyperparameters as the default values. A summary of the ablation results are presented in Section 5.3 and detailed results are included in Appendix B.4. + +- Diversity loss: In the SBM training, we incorporate a regularization (Ma et al., 2020) to encourage the learning of more diverse shapelets (Equation 4). However, the ablation study, we find that the weight of the diversity regularization $\lambda_{\mathrm{div}}$ does not introduce substantial effects to the metrics of interests (see Figure 22). These results suggest that the diversity loss could be omitted, considering its high computational complexity. Nevertheless, we chose to retain it because it is used in other shapelet-based literature (Qu et al., 2024) and may still promote favorable properties for shapelet learning, which would require further investigations. + +- Number of shapelets: In the ablation study, we consider the number shapelets $K = 10$ and $K = 5$ which are rather compact. Although using large $K$ would test the scalability of SBM, we believe that interpretability favors a compact model with a small number of concepts whenever possible. Using a large $K$ would compromise interpretability by making the SBM more complex and less plausible for human understanding. Furthermore, if the features of a dataset is so complex that require a large $K$ to express, we prefer to leverage the DNN component of InterpGN for such cases. + +# B ADDITIONAL EXPERIMENTAL RESULTS + +# B.1 FULL RESULTS ON 30 DATASETS FROM THE UEA ARCHIVE + +For the performance of baseline methods, we reproduce STRF, FCN, TimesNet and PatchTST to obtain their performance on the UEA datasets. Performance of DTW and TS2Vec are obtained from Yue et al. (2022). Performance of TST and SVP-T are obtained from Zuo et al. (2023). Performance of ShapeNet, RLPAM, and ShapeConv are obtained from the corresponding paper. + +Due to the limitations in model architectures, some method may fail on certain datasets. For example, TimesNet and PatchTST fail on the EigenWorms datasets as the time series exceeds their input length limits. For fair comparison, in Table 5, we additionally report the statistics of the methods with "N/A" dropped, keeping the datasets where all the method have a valid result. + +Table 5: Accuracy and comparison of the methods on 30 datasets from the UEA archive. The best accuracy for each dataset is marked with bold, the second-best is marked with italic, and the third-best is marked with underline. + +
DatasetClassicalDeep LearningWith Interpretable FeaturesOurs
STRFDTWFCNTS2VecTimesNetTSTPatchTSTSVP-TShapeNetRLPAMShapeConvSBMInterpGN
ArticulatoryWordRecognition0.9170.9870.9900.9870.9530.9830.9380.9930.9870.9230.9940.9930.991
AtrialFibrillation0.2670.2000.3330.2000.5070.2000.4670.4000.4000.7330.5210.4530.333
BasicMotions0.9250.9751.0000.9750.9650.9650.5601.0001.0001.0000.9971.0001.000
CharacterTrajectories0.8490.9890.9980.9950.980N/A0.8590.9900.9800.9780.9810.9830.997
Cricket0.9441.0000.9970.9720.8390.9580.8831.0000.9861.0000.9980.9811.000
DuckDuckGeese0.3800.6000.6680.6800.4040.480N/A0.7000.7250.7000.6480.3840.480
EigenWorms0.6720.6180.7590.847N/AN/A0.4150.9230.8780.9080.8020.5820.835
Epilepsy0.9780.9640.9750.9640.8360.9200.5650.9860.9870.9780.9720.9930.988
ERing0.8890.1330.8940.8740.9140.9330.8720.9370.1330.8190.7740.9670.933
EthanolConcentration0.6770.3230.2970.3080.3000.3370.2630.3310.3120.3690.2530.3010.298
FaceDetection0.5670.5290.5840.5010.6860.6810.5590.5120.6020.6210.6350.6570.659
FingerMovements0.5000.5300.6220.4800.6080.7760.5640.6000.5800.6400.5870.6000.616
HandMovementDirection0.4190.2310.4460.3380.4160.6080.5680.3920.3380.6350.4130.4730.459
Handwriting0.1040.2860.6120.5150.2390.3050.1120.4330.4520.5220.5270.3570.617
Heartbeat0.7460.7170.7800.6830.7390.7120.7240.7900.7560.7790.7840.7360.779
InsectWingbeat0.208N/A0.6540.4660.5930.6840.2760.1840.2500.3520.5090.4920.653
JapaneseVowels0.6760.9490.9910.9840.9720.9940.8760.9780.9840.9350.9930.9630.990
Libras0.8170.8700.9530.8670.8060.8440.6420.8330.8560.7940.8870.8600.969
LSST0.4910.5510.3940.5370.4060.3810.3150.6660.5900.6430.6080.6360.597
MotorImagery0.5100.5000.5840.5100.614N/A0.6000.6500.6100.6100.6740.6420.630
NATOPS0.7940.8830.9820.9280.9040.9000.7300.9060.8330.9500.9370.8790.983
PEMS-SF0.9250.7110.8240.6820.8570.9190.7640.8670.7510.6320.8010.8510.873
PenDigits0.8550.9770.9900.9890.9810.9740.9610.9380.9770.9820.9680.9710.990
PhonemeSpectra0.1550.1510.3030.2330.1190.0880.0330.1760.2980.1750.1920.2550.320
RacketSports0.8420.8030.9030.8550.8550.8290.7380.8420.8820.8680.8630.8970.901
SelfRegulationSCP10.8460.7750.9020.8120.8950.9250.8350.8840.7820.8020.8580.8640.917
SelfRegulationSCP20.4890.5390.5770.5780.5590.5890.5590.6000.5780.6320.6240.5220.578
SpokenArabicDigits0.6790.9630.9950.9880.9870.9930.7480.9860.9750.6210.9790.9940.997
StandWalkJump0.4670.2000.4930.4670.6000.2670.5070.4670.5330.6670.5870.5730.507
UWaveGestureLibrary0.7620.9030.8890.9060.8120.9030.7780.9410.9060.9440.9360.9130.911
Avg. Accuracy0.6450.6500.7460.7040.7020.7090.6110.7300.6970.7400.7430.7260.760
Avg. Rank9.7009.1385.0007.5337.5176.77810.4145.2676.5675.4005.5005.7333.500
Num. Top-12140140527238
Num. Top-3211423911151310816
Wins/Draws282723272518271925202020-
Losses2273492115101010-
Wilcoxon p-value0.0000.0000.0030.0000.0000.0010.0000.0660.0010.1120.0090.003-
Statistics without N/A
Avg. Accuracy0.6690.6460.7490.7050.7100.7190.6220.7380.6990.7470.7480.7480.768
Avg. Rank9.5209.2805.0407.9207.6406.96010.5205.4806.7605.3605.6005.4403.320
Num. Top-12130130417138
Num. Top-32112138183119714
Wins/Draws232421242117231722171716-
Losses214148283889-
Wilcoxon p-value0.0000.0000.0010.0000.0000.0030.0000.0300.0000.1380.0070.019-
+ +# B.2 ADDITIONAL INTERPRETABILITY ANALYSIS + +# B.2.1 FAITHFULNESS + +We follow Alvarez Melis & Jaakkola (2018) to assess the faithfulness of shapelets learned by the SBM. Specifically, for each concept (i.e., shapelet predicate $p$ ), we measure its relevance by calculating the change in the probability of a certain prediction before and after removing it (i.e., set $p = 0$ ). The faithfulness score is then determined by the correlation between the relevance of a shapelet concept and its assigned importance $w$ . + +Formally, given a sample $(x_{i},y_{i} = c)$ , the SBM first provides the set of shapelet predicates $\mathbf{p}_i\in \mathbb{R}^{|S|} = [p_{i,1},\ldots ,p_{i,|\mathcal{S}|}]$ and their corresponding classifier weights $\mathbf{w}\in \mathbb{R}^{|S|\times C} = [w_{1,c},\dots,w_{|\mathcal{S}|,c}\mid c\in \{1,\dots,C\} ]$ . Then, the predicted class probabilities are computed by $\hat{\mathbf{r}}_i = \mathrm{softmax}(\mathbf{w}^\top \mathbf{p}_i)$ and $\hat{\mathbf{r}}_i = [\hat{r}_1,\dots,\hat{r}_C]$ . Then, we have + +$$ +\begin{array}{l} \Delta_ {i} ^ {(k)} = \hat {r} _ {i, c} - \hat {r} _ {i, c} ^ {(k)}, \text {w h e r e} \hat {\mathbf {r}} _ {i} ^ {(k)} = \operatorname {s o f t m a x} \left(\mathbf {w} ^ {\top} \mathbf {p} _ {i} ^ {(k)}\right), \tag {10} \\ \mathbf {p} _ {i} ^ {(k)} = \left[ p _ {i, j} \mid j = \{1, \dots , | S |, p _ {i, j} = 0 \text {i f} j = k \} \right]. \\ \end{array} +$$ + +Here $\Delta_i^{(k)}$ measures the changes in the predicted class probability with the absence of shapelet concept $s_k$ . The faithfulness of the sample $x_i$ is then quantified by the correlation coefficient between the vectors of relevance values $\Delta_i = [\Delta_i^{(1)}, \ldots, \Delta_i^{(|S|)}]$ and the importance weights of the predicted class $\mathbf{w}_c$ : + +$$ +\text {F a i t h f u l n e s s} \left(x _ {i}\right) = \rho \left(\mathbf {w} _ {i}, \Delta_ {i}\right). \tag {11} +$$ + +where $\rho$ denotes the Pearson correlation coefficient. Aggregating Faithfulness $(x_{i})$ across all $(x_{i},y_{i})\in D$ , we generate the box plots shown in Figure 7. On most datasets, regardless of the varying performance levels of the SBM, we observe consistently high faithfulness estimates (i.e., greater than 0.5). + +![](images/c0511bfa225baddc48682b227595164bbf5e49246bc8a64edd25037ee97591aa.jpg) + +![](images/9b21ffd6f4db6e84af0b7a6dc34364b39d245d1c34c1757197576c7db398520d.jpg) +Figure 7: Faithfulness estimate: aggregated correlation statistics between shapelet concept relevance and importance. + +# B.2.2 VISUALIZATION OF EXPLANATIONS + +Global explanations. We visualize the global explanations of the UWaveGestureLibrary, BasicMotions, SelfRegulationSCP1, and SelfRegulationSCP2 datasets. We choose these datasets since their dimensions are favored for visualizations (i.e., $M$ and $C$ are not too high). UWaveGestureLibrary and BasicMotions are representatives for human motion data; SelfRegulationSCP1 and SelfRegulationSCP2 are representatives for EEG data. In each figure, for each category, we visualize the time-series samples (left, in gray), the top-5 positively relevant shapelets (middle, in blue), and the top-5 negatively relevant shapelets (right, in red). + +![](images/5728f844e58165474935967ac77dd8ce0adb9781a7c0b4417e26275d7490d483.jpg) + +![](images/f6a8498d07eb655b8be24b10d6d67a233b0a8a6d9b956eead6412da46bbec690.jpg) + +![](images/b5b27253a2359f41d0a661d1722b32282b834b780ce33d37a011ef721fff8040.jpg) + +![](images/90d73782b6334ccb8063984f76d0f5223cdb51be6abdeae4d0ac3120b28ca078.jpg) +Figure 8: Global explanations of the SBM on the UWaveGestureLibrary dataset. (Part 1) + +![](images/f164ed6ded74538bb5e387e86a680bb69162612990459864578d065aba6474ec.jpg) + +![](images/b35376514f71c1f0585ca7fa6d69cf9f9676a30ebd400f6e5da705bba30d655f.jpg) + +![](images/c87655c6569affd8b7a1648d5f0774d459cd5ff6543689bb0d5bb948d6d565c1.jpg) + +![](images/5562ca2c4b7e04d84b6203ad9763b90f4c39867b6c2515babb0c2e0c4a910716.jpg) + +![](images/a6bb67ccc8ecfc60764aabfb3beb8a58e9775cc75c9b457af9adc2548f6f183f.jpg) + +![](images/fcef0cae08e0c87faa4a85176822b7df78eba45f0e2810930f9a07dc7480be86.jpg) + +![](images/4345a823e3133e020d56751d023d0968daf00f89ad0629e6c428d395bbc78b7e.jpg) + +![](images/48a22395f53d10ce8ff1971ca95c2ca4f2d362f8c05d3f9498570430313d4b92.jpg) + +![](images/c7879a788aaf5fc37a51d4812398d99f8f37517c892164c70900612bbdbdda5b.jpg) + +![](images/55789f66eafda2fcfd160447e990b35a1b24bce3dbcb688f31ab2839db16af05.jpg) +Figure 9: Global explanations of the SBM on the UWaveGestureLibrary dataset. (Part 2) + +![](images/ca9a902bda6f006ab8cacbdfe8729b9dedbb603a76d603062c49fefe1c91c14e.jpg) + +![](images/ea933fce9653fddf8fecc10211c3221a0db882d4e8835adec7fa535d8df1d937.jpg) + +![](images/f8bb8dab60d4f1afa672e5937cfe5ffe3b07e4fda08eeec565a4c5579b4dad5d.jpg) +BasicMotions: Category 1 + +![](images/2dc57d427a324bb57029acc50208d47c972683ceffe7deb712cb1070d9954a49.jpg) +Top-5 Positive Relevant Shapelets + +![](images/70477d6ba2658da6b2613b1960e8fe519c9699e781874a9d80b4efe1a72e14e1.jpg) +Top-5 Negative Relevant Shapelets + +![](images/a6fe708d9f56d4efe15d2893bbc07d3b111acf6a148419245f6332ba2bb15c0d.jpg) +BasicMotions: Category 2 + +![](images/5ba1b88c63a1f492efe28976b35d5faeb388b64e7d1e4e2746a25d22512ebcf6.jpg) +Top-5 Positive Relevant Shapelets + +![](images/32641c5f6913cf03b2a1a16bca175b1040b40d0db940a3bbbfda7064c43dedc0.jpg) +Top-5 Negative Relevant Shapelets + +![](images/1def1d09f15c75e31027e054ed70b18c2edd2573be3006ba20c15829b3a5925c.jpg) +BasicMotions: Category 3 + +![](images/017d9fd6e240108d5d11760694334f7caaa3282dd759029502250a9f865fb992.jpg) +Top-5 Positive Relevant Shapelets + +![](images/7d0e8f5a10ce88fd7cbbfcaecc87d609f77237dc2c629b620a551eef6a423bd4.jpg) +Top-5 Negative Relevant Shapelets + +![](images/dfad7ef2dd106650ed8a2f022f5bc923dfe59f7467ff4f402a6d2833bc3fab9f.jpg) +BasicMotions: Category 4 +Figure 10: Global explanations of the SBM on the BasicMotions dataset. + +![](images/0321bfd6c93cf4b370977ea03575f6ec3917bbf520ad9320fe2887655c88fa95.jpg) +Top-5 Positive Relevant Shapelets + +![](images/0c44719aee0321dab3c81c66e90d54620cf52d836cecab626ffcce6c135ece60.jpg) +Top-5 Negative Relevant Shapelets + +![](images/b7af394b518c4ee23d682d3adb5c522a4020fc0e4919080bef100c508499efb3.jpg) +Figure 11: Global explanations of the SBM on the SelfRegulationSCP1 dataset. For clarity, we visualize 30 time-series samples. + +![](images/c2af8477e1b272719adb4f1d66289ab8c542ecba457e62b7c74e7ed87678eda2.jpg) +Figure 12: Global explanations of the SBM on the SelfRegulationSCP2 dataset. For clarity, we visualize 30 time-serie samples. + +Local explanations. We visualize the local explanations for the four datasets. In each Figure, a sub-figure visualizes a time-series sample (in gray) along with the top-5 most important shapelets. The color of each shapelet indicates its importance, with blue representing the highest importance, followed by orange, green, red, and purple for progressively lower importance. + +![](images/1696d5cb1a6f762b94bcfe18f87b5788816aa44e06d2f2c8f9dd1985ee9a43f1.jpg) + +![](images/f21bc7fa6fcbe30a1ea3fb96dd5f21174bbb06e1ef6e99e81d8dfd3c505afa72.jpg) + +![](images/ab2a917845184e4e447a37c8965355b5f22552017c77ce10fd743dcfc9c82e5c.jpg) + +![](images/74e8ee85ddef54a10a924b29c35208fe4b42b1032b5c988d85d885a5bfa09cc5.jpg) + +![](images/5568304e8c19efacb9a8c9faa4544ad94b327f36f62c8927b9561f04d576097d.jpg) + +![](images/cfdb39b25f42cacee3b36103617a7d73346ef16b2f57097ff7a17c5fb1e25c8c.jpg) + +![](images/4e7011e946fc1ca0044b49274ea023e3a9315b7f06cd07e18c5a93dfe47a5208.jpg) + +![](images/198ba71ee0270404c2617504359b677c93e1c3c7c978cf1a09fe7d7f54626aa4.jpg) + +![](images/9c39ba1433b56196ad8df41982e5b999c61fe02a77196e5eeea5bd45d89f21ba.jpg) + +![](images/184ec6d5d70910212c2417e93b30b9708fff01d0a6a1ddd619e0766dd8f1da42.jpg) + +![](images/e2bb350c8fb9f7f7b1674a1e71c18f3cd4aa0df7eb37ff82d67710f84aeae41b.jpg) + +![](images/94c99f1d15b442452fad80a588253502ecc41af69700521b4830f5ff429cb927.jpg) + +![](images/94ecc2bbcd8690d2f39bf42574a4eb529aeca30a2d153b138074e5ed2fe4c2bc.jpg) + +![](images/83b6d4cba3196919b9c6abb86ceca7526ed01220e496cdb7f594ca650f99e6fd.jpg) + +![](images/c7dc9e24c44490f2d3dcd7b024efe8e01fae0a4abb80eb9adfde0b3fa4f16d57.jpg) + +![](images/8ee1e6255d551d8c116619cb66d6c9358e56c213ac4f966591f8c2c58a5e81f1.jpg) + +![](images/f5bfce1f3b76960baa88f026935ac7cd21702f900918d06fd57ba28a43fa923e.jpg) + +![](images/144729c017806b5cd67c850f9032becae5e480d5c54188d805a21ec73894b240.jpg) + +![](images/1d32f48734151f1ad69741455960c6286824fc4a21db305abfd8a5e97f9afbe5.jpg) + +![](images/c6b3840e858d5f3718688c4a1951592e460b6e3f19b86c5f02909f57a410a1b4.jpg) + +![](images/6cd3f57a6a6787d13abd54f9ad4986a1ba22c6176fbc4a19b7b1320dccbb52b8.jpg) + +![](images/4dd231eec6e723297186731d85b1487546c69d1498969819bfb966e3095cfec5.jpg) + +![](images/cb423b44827fd420f6b73b3d127c0d75a1a27d5067a8209023056677aae5b347.jpg) + +![](images/7a115f4b0075b340daf90bf0c6b843735446c006162fa3191528c158c39053c6.jpg) + +![](images/1f6165555a19eb7330b58adbeba7bce07ba1c0a14384e2c521b5a3f0ce57f0d1.jpg) + +![](images/26d6ea2520e60d9ba47caacbbcf2bc92b971557beb1d0428d213e0e827dab148.jpg) + +![](images/0bd50637f13fb3df83a5f02b6be700f5dfce994b23cbab3e4fceba35f8ae0e1b.jpg) + +![](images/9abca19d0a374f9c275d8e5ad56e08b35f4a61eed6e18503a4a5abc525822ecd.jpg) + +![](images/455a41fa2fe9fe91a39b67f7b264123defc111692693107616306ef07973d798.jpg) +Figure 13: Local explanations of the SBM on the UWaveGestureLibrary dataset. + +![](images/454fba3aebab91dc6d920c419a6648effef35508e63a4134f268fc154d426c21.jpg) + +![](images/40b03a7008a10c5e653c4972b13a34f3074e4bab0c90f569352159b797e54d0a.jpg) + +![](images/bf025fc7289d157ffe2ff9ae39c04ac5cce3e86596e38cd1076f466aa4bad9d9.jpg) + +![](images/7aed4e94c90290c529a9d02e694367624a8dc12e5b97a8d5628ff863727eff0c.jpg) + +![](images/f1bbc08b25e5b68315d9601727cc6be67c216c467895ee897891357840de8c88.jpg) + +![](images/ca95bf4584f474978d90f95854398ccb106444978c518c17c3b216184c234ea3.jpg) + +![](images/d16f55d365ceb22e8baded2eb66bc2d7bf603d5dcedd581a137edacf86839c0d.jpg) + +![](images/bf542b8d75f793d2b2e40869672be5140eb5aca40ea995fe3fd46870ebd89c56.jpg) + +![](images/0db355d62b95a30d166409cf1f5ba70fd3f2b040994a089953051c0cccd81765.jpg) + +![](images/58a417bb05b3ebfc2ec86b057340fbd3ab952b8327ac4347c26a4750d18c7a46.jpg) + +![](images/50f0f653c5d2e16096983c03ba5635acb6c13a443d54e794526f271233100d45.jpg) + +![](images/00679149e7eff7b55360504e382696c7246d3de309ef3a9fca45f1a54d8298dc.jpg) + +![](images/f870c90e8caa2ab08c59e3b970fd787195bb1f2ced1f24c267ea554b5b0855ef.jpg) + +![](images/bebfcc911e02fb7f611ec4816a96e911d892fd7606ec9cad836dfb79be2cb432.jpg) + +![](images/2453d318f7cca6def0786f11abf70ec63e8d10db266bc1045619ce0633174f9e.jpg) + +![](images/57aa446056940a5665da404cd79c0b8c642c7362f72041fe1e4f86d549cd1a2f.jpg) +Figure 14: Local explanations of the SBM on the BasicMotions dataset. + +![](images/2caf8c0b99393fd8038c0dc76d032fa23fbf7e650b0da1d333531e07165a9c03.jpg) + +![](images/cb531a1d958136e928f71471aa46d01a8ab61ec9247c46777f572bfd2ca73b10.jpg) + +![](images/3fb61840e93492b3a3289b4db47d2bdf9f5e0ff8bb8336f680ece744a2682ac3.jpg) + +The local explanations reflect the limitation we discussed in Section 6, where explanations for certain categories may appear counterfactual. For example, in the BasicMotions dataset, the most important shapelets for Category 1 may not represent the most characteristic features of that category. Despite this, the SBM can still make accurate predictions due to the strong feature representation for other categories. This issue becomes more pronounced in datasets with two categories, such as SelfRegulationSCP1 and SelfRegulationSCP2. These findings suggest that for binary classification tasks, using a single binary classifier with one unified "rule" might be a more effective and reasonable design, rather than assigning a separate "rule" to each class. + +![](images/ef06ad6a56d00dd8ab694ec5ba7effe63806cb2510d4150dfbd61ea8f74b32f8.jpg) +Figure 15: Local explanations of the SBM on the SelfRegulationSCP1 dataset. + +
SelfRegulationSCP2: Category 1SelfRegulationSCP2: Category 1SelfRegulationSCP2: Category 1
x1x1x1
x2x2x2
x3x3x3
x4x4x4
x5x5x5
x6x6x6
x7x7x7
x8x8x8
x9x9x9
x10x10x10
x11x11x11
x12x12x12
x13x13x13
x14x14x14
x15x15x15
x16x16x16
x17x17x17
+ +Figure 16: Local explanations of the SBM on the SelfRegulationSCP2 dataset. + +# B.3 BEHAVIOR OF THE INTERPRETABILITY GATING FUNCTION + +# B.3.1 DISTRIBUTION OF THE GATING VALUES + +In Figure 17, we present the relationship between values of $\eta(x_i)$ and predictions of InterpGN to further study the behavior of the proposed interpretability gating function. We conclude that InterpGN's predictions are consistent with SBM's predictions when $\eta(x_i)$ is high, preserving interpretability for those samples. The DNN makes corrections when $\eta(x_i)$ is low to improve performance. Note that there are cases where the DNN changes SBM's predictions to incorrect, suggesting that InterpGN's performance can be further improved using more advanced DNNs. + +![](images/1b9afff6ca4ab0b1e4124345bcb1d30c9c4b9a89644fdd6d103b30641cb7d5f3.jpg) + +![](images/6a1a8e64ddcb1a74056680bea79af5521a8d679f7a982979e31f71f762803055.jpg) + +![](images/a427dedbcf00683825f67e704ec8d37d115199cd554c51e1edb0defe7e696bf7.jpg) + +![](images/1c268296e1b157ec948e3cadb71d97643f0181ffc3e1d1606427bebd179da6e4.jpg) + +![](images/227ad364aeb61b6fa2f0e475e3435385d44d6aebacc94c00bd51ea2d491a9bf9.jpg) + +![](images/4fe63668b3545907cef6d220647e724e2921477f8f066777b8a8eb977cfe4f02.jpg) + +![](images/f37cf68df4d02e17969599a0ae8ab5b5ce2f732576f82917a3efb4217370dae6.jpg) +Figure 17: Histogram of values $\eta (x_{i})$ , and the prediction consistency between the interpretable expert and InterpGN. + +![](images/1e259201433f61bfaa4efb9ec5fc573c9578f84d118be0485ba56632e55b0a58.jpg) + +# B.3.2 TRAINING CURVES OF INTERPGN + +In Figure 18 and Figure 19, we visualize the loss and $\eta$ during the training of InterpGN. The figures present how the loss function design $\mathcal{L}_{\mathrm{hybrid}} = \beta \mathcal{L}_{\mathrm{int}} + \hat{\mathcal{L}}_{\mathrm{ce}}$ could encourage the use of SBM during training, preventing the InterpGN from collapsing into a pure DNN when possible. + +![](images/12183165b419966052b686c30a1926ad2842a89068060d66649ed8f1a22769a7.jpg) +Figure 18: Training curves for InterpGN on the BasicMotions dataset: (left) $L_{\mathrm{hybrid}}$ and (right) average $\eta$ . + +![](images/f5349354aa2e89b93f82b607d4ce32ef6c0fa9a25aece9ab68fa01f10a2563ef.jpg) + +![](images/4df17629b330c4d8223e461eeb34c4be941e007ffd8017b78096fb58f25f1bae.jpg) +Figure 19: Training curves for InterpGN on the UWaveGestureLibrary dataset: (left) $L_{\mathrm{hybrid}}$ and (right) average $\eta$ . + +![](images/3c657fd8938f854505364ebac7cdafe855a942efcc299dbd1a8dae317df4818d.jpg) + +# B.4 ABLATION STUDY RESULTS + +Table 6: Number of shapelet + +
modelKacc.quality|w| > 1|w| > 0.5|w| > 0.1Gini(|w|)η
SBM50.7200.1030.0500.1440.5230.460-
SBM100.7260.0740.0260.0840.4120.467-
InterpGN50.7610.0790.0340.1090.4290.4220.405
InterpGN100.7600.0610.0140.0600.3430.4200.441
+ +Table 8: Predicate types in ${\mathrm{{SBM}}}^{2}$ + +
PredicateKaccu.quality|w| > 1|w| > 0.5|w| > 0.1
RBF50.7280.1010.0510.1410.513
RBF100.7340.0730.0270.0830.405
Linear50.7180.1710.0840.1810.499
Linear100.7220.1210.0540.1250.433
+ +Table 7: $\beta$ schedule of InterpGN + +
βKaccu.quality|w| > 1|w| > 0.5|w| > 0.1Gini(|w|)η
constant50.7610.0790.0340.1090.4290.4220.405
constant100.7600.0610.0140.0600.3430.4200.441
cosine50.7590.0770.0310.0960.4270.4220.374
cosine100.7610.0590.0150.0600.3340.4240.435
+ +![](images/1806f1348c2ebfeb3319f5a8c0e1ded0155152850724fd5b145c6656799ee14f.jpg) +Figure 20: Ablation on $\epsilon$ + +![](images/771adce0a7276e1b1be03be9602bef5ac4c49e1953df25ba8749a920abe72681.jpg) + +![](images/b7d9adf59acedf7d20a2b6b979de5f16909f2de5db2033d24f6ca182a3bc8cbe.jpg) +Figure 21: Ablation on $\underline{\eta}$ + +![](images/69d4466b6797e386a71689c5797d331906c415ef2f8f54bcae1fb87e69bb1603.jpg) + +![](images/c2ef4c286586e775b3b7572f788f9335f776929912d33ab2d23787d522b31fd2.jpg) +Figure 22: Ablation on $\lambda_{\mathrm{div}}$ + +![](images/199492b0cfe4838bc2dc518e0265aece27fb4286837d1d1c086b68f1e791acc6.jpg) + +![](images/d3ae15bca5fc68747b0cdbfbd5c25330006807b09a03f91a3005cf1adc367279.jpg) +Figure 23: Ablation on $\lambda_{\mathrm{reg}}$ + +![](images/262c0f1bdb038e1dfeb701cd5d55ae0ee4d05e4f4326978453c76707f8ef70d3.jpg) + +![](images/50e140b56fd64f19be2602636f3fdf67ca8d2431c86ccd907058962e7ae2c8d6.jpg) + +Table 9: Full results and variations on number of shapelets $K$ + +
modelKaccu.quanlity|w| > 1|w| > 0.5|w| > 0.1η
SBM50.72 ± 0.0140.103 ± 0.0230.05 ± 0.0170.144 ± 0.0510.523 ± 0.109-
SBM100.726 ± 0.0110.074 ± 0.0140.026 ± 0.0080.084 ± 0.0220.412 ± 0.085-
InterpGN50.761 ± 0.0120.079 ± 0.0190.034 ± 0.0110.109 ± 0.0360.429 ± 0.1050.405 ± 0.091
InterpGN100.76 ± 0.010.061 ± 0.0140.014 ± 0.0060.06 ± 0.0240.343 ± 0.0920.441 ± 0.112
+ +Table 10: Full results and variations on $\beta$ schedule in InterpGN + +
β scheduleKaccu.quanlity|w| > 1|w| > 0.5|w| > 0.1η
constant50.761 ± 0.0120.079 ± 0.0190.034 ± 0.0110.109 ± 0.0360.429 ± 0.1050.405 ± 0.091
constant100.76 ± 0.010.061 ± 0.0140.014 ± 0.0060.06 ± 0.0240.343 ± 0.0920.441 ± 0.112
cosine50.759 ± 0.0160.077 ± 0.0190.031 ± 0.0140.096 ± 0.0280.427 ± 0.1030.374 ± 0.099
cosine100.761 ± 0.0110.059 ± 0.0140.015 ± 0.0070.06 ± 0.020.334 ± 0.090.435 ± 0.1
+ +Table 11: Full results and variations on $\epsilon$ + +
modelεaccu.quanlity|w| > 1|w| > 0.5|w| > 0.1η
SBM0.50.715 ± 0.0140.136 ± 0.030.033 ± 0.0080.089 ± 0.0280.383 ± 0.091-
SBM1.00.726 ± 0.0110.074 ± 0.0140.026 ± 0.0080.084 ± 0.0220.412 ± 0.085-
SBM2.00.723 ± 0.010.061 ± 0.0110.029 ± 0.0080.111 ± 0.0340.465 ± 0.095-
SBM5.00.586 ± 0.0290.015 ± 0.0040.031 ± 0.0090.063 ± 0.0160.138 ± 0.022-
SBM10.00.415 ± 0.0260.012 ± 0.0040.023 ± 0.0080.042 ± 0.0140.072 ± 0.011-
InterpGN0.50.749 ± 0.0150.087 ± 0.0250.016 ± 0.0040.05 ± 0.0180.251 ± 0.0930.31 ± 0.114
InterpGN1.00.76 ± 0.010.061 ± 0.0140.014 ± 0.0060.06 ± 0.0240.343 ± 0.0920.441 ± 0.112
InterpGN2.00.76 ± 0.0090.057 ± 0.010.023 ± 0.0090.097 ± 0.0280.431 ± 0.0940.488 ± 0.098
InterpGN5.00.75 ± 0.0120.014 ± 0.0040.029 ± 0.0080.054 ± 0.0160.136 ± 0.0280.263 ± 0.059
InterpGN10.00.752 ± 0.0120.009 ± 0.0030.024 ± 0.0070.04 ± 0.0140.072 ± 0.0170.118 ± 0.038
+ +Table 12: Full results and variations on ${\lambda }_{\text{reg }}$ + +
modelλregaccu.quanlity|w| > 1|w| > 0.5|w| > 0.1η
SBM0.00.726 ± 0.010.113 ± 0.0230.046 ± 0.010.121 ± 0.030.487 ± 0.09-
SBM0.10.726 ± 0.0110.074 ± 0.0140.026 ± 0.0080.084 ± 0.0220.412 ± 0.085-
SBM0.50.726 ± 0.010.059 ± 0.0120.017 ± 0.0060.059 ± 0.0170.338 ± 0.073-
SBM1.00.726 ± 0.0110.048 ± 0.0070.014 ± 0.0040.047 ± 0.0110.259 ± 0.064-
SBM5.00.716 ± 0.0110.022 ± 0.0040.007 ± 0.0020.024 ± 0.0080.1 ± 0.028-
SBM10.00.701 ± 0.0120.014 ± 0.0030.005 ± 0.0010.014 ± 0.0040.058 ± 0.015-
InterpGN0.00.759 ± 0.0130.067 ± 0.020.017 ± 0.0110.071 ± 0.0310.381 ± 0.0930.463 ± 0.114
InterpGN0.10.76 ± 0.010.061 ± 0.0140.014 ± 0.0060.06 ± 0.0240.343 ± 0.0920.441 ± 0.112
InterpGN0.50.76 ± 0.0110.049 ± 0.010.01 ± 0.0040.046 ± 0.0160.271 ± 0.0810.44 ± 0.104
InterpGN1.00.759 ± 0.0110.042 ± 0.0090.009 ± 0.0040.038 ± 0.010.221 ± 0.0690.432 ± 0.096
InterpGN5.00.757 ± 0.010.02 ± 0.0040.004 ± 0.0020.018 ± 0.0060.09 ± 0.0360.358 ± 0.093
InterpGN10.00.755 ± 0.0130.013 ± 0.0030.004 ± 0.0020.011 ± 0.0050.047 ± 0.020.299 ± 0.092
+ +Table 13: Full results and variations on ${\lambda }_{\text{div }}$ + +
modelλdivaccu.quantity|w| > 1|w| > 0.5|w| > 0.1η
SBM0.00.726 ± 0.0110.072 ± 0.0130.025 ± 0.0050.085 ± 0.0190.413 ± 0.093-
SBM0.10.726 ± 0.0110.074 ± 0.0140.026 ± 0.0080.084 ± 0.0220.412 ± 0.085-
SBM1.00.726 ± 0.010.079 ± 0.0160.026 ± 0.0090.083 ± 0.0220.417 ± 0.089-
SBM10.00.725 ± 0.010.089 ± 0.0170.027 ± 0.0090.085 ± 0.0240.42 ± 0.079-
SBM100.00.724 ± 0.0110.097 ± 0.0190.028 ± 0.0090.086 ± 0.0220.406 ± 0.091-
InterpGN0.00.762 ± 0.0120.062 ± 0.0140.016 ± 0.0070.067 ± 0.0210.362 ± 0.1020.451 ± 0.112
InterpGN0.10.76 ± 0.010.061 ± 0.0140.014 ± 0.0060.06 ± 0.0240.343 ± 0.0920.441 ± 0.112
InterpGN1.00.76 ± 0.0110.065 ± 0.0130.017 ± 0.0060.063 ± 0.0210.338 ± 0.0840.443 ± 0.107
InterpGN10.00.758 ± 0.0110.073 ± 0.0160.018 ± 0.0090.064 ± 0.0270.331 ± 0.0860.437 ± 0.109
InterpGN100.00.762 ± 0.0110.081 ± 0.0180.018 ± 0.0080.066 ± 0.0230.331 ± 0.0990.437 ± 0.113
+ +# C PRELIMINARY RESULTS ON EXTENDED DESIGNS + +We further provide preliminary results on extended designs for SBM and InterpGN, where we hope they could provide insights for future research. For simplicity, we experiment with a subset of the UEA archive containing 10 datasets that are commonly used in evaluating deep learning methods (Wu et al., 2023). + +# C.1 ARCHITECTURE OF THE DNN EXPERT IN INTERPGN + +Table 14: Ablation on the architecture of the DNN expert in InterpGN. The best performance for each dataset is highlighted with bold. + +
DNN Expert of InterpGN: +DatasetFCNTransformerPatchTSTTimesNet
accu.ηaccu.ηaccu.ηaccu.η
EthanolConcentration0.2980.0080.3200.2360.2760.8330.3020.401
FaceDetection0.6630.7090.6570.5680.6520.7560.6700.517
Handwriting0.6120.0220.1270.5450.1150.2660.2140.024
Heartbeat0.7790.2460.7350.6710.7290.9540.7400.576
JapaneseVowels0.9910.7580.9700.9200.9190.8710.9740.831
PEMS-SF0.8610.4800.8000.6710.2060.9800.8340.560
SelfRegulationSCP10.9170.4280.8780.4480.8510.4070.9020.437
SelfRegulationSCP20.5800.0360.5590.7000.5760.5870.5780.363
SpokenArabicDigits0.9980.9590.9930.9840.9910.9850.9920.969
UWaveGestureLibrary0.9090.6460.8030.3650.7910.2950.8290.205
+ +# C.2 SHAPELET DISTANCE MEASUREMENTS + +In this paper, as defined in Equation 1, we follow the conventional definition of shapelet distance and use Euclidean distance, but the shapelet distance can be general and replaced by other metrics. Here we explore two alternative distance measures: cosine similarity and Pearson correlation. These metrics may offer favorable properties compared to Euclidean distance in some cases. For instance, cosine similarity can capture shapelets that are invariant to changes in offset. Table 15 presents the classification accuracy of SBM and InterpGN variants utilizing these three distance measures. The results indicate that cosine similarity and Pearson correlation can yield better performance on certain datasets, but no metric can be universally better than others. This suggests that the choice of shapelet distance metric could possibly serve as a hyperparameter requiring dataset-specific tuning depending on the needs. For example, motion datasets such as UWaveGestureLibrary may benefit from cosine similarity due to the presence of offset-invariant shapelet features. In Figure 24, we visualize an example of local explanations of SBM using euclidean distance and cosine similarity as the shapelet distance measurement, which suggests that they both could learn high-quality shapelets. + +![](images/cb53e05a0031d5c0ff43f3849ad45f3be65db524550ab60c79a4d74e7f36fd6f.jpg) +(a) SBM with Euclidean Distance + +![](images/1423b1ed7aa0ccb4ab0022c3016d59360833be69b758f3d1168ca44303db16a2.jpg) +(b) SBM with Cosine Similarity +Figure 24: Local explanations of SBM using (a) euclidean distance and (b) cosine similarity as the shapelet distance measurement. + +Table 15: Classification accuracy of the SBM using three shapelet distance metrics. The best accuracy for each dataset is marked with bold. The training of SBM using Pearson correlation fails on some datasets due to infinite gradients. + +
Model:SBMInterpGN
Distance metric:EuclideanCosinePearsonEuclideanCosinePearson
EthanolConcentration0.3010.2970.3040.2980.3040.291
FaceDetection0.6570.6800.6820.6590.6830.682
Handwriting0.3570.3950.0420.6170.6130.042
Heartbeat0.7360.7380.7400.7790.7890.779
JapaneseVowels0.9630.9660.0840.9900.9890.084
PEMS-SF0.8500.8300.1730.8530.8530.173
SelfRegulationSCP10.8640.8570.8550.9170.9000.901
SelfRegulationSCP20.5220.5530.5560.5780.5780.579
SpokenArabicDigits0.9940.9910.1000.9970.9950.100
UWaveGestureLibrary0.9130.9460.1250.9110.9360.125
+ +# C.3 CLASSIFIER ARCHITECTURE IN SBM + +In this paper, we focus on using a linear classifier with shapelet predicates, in line with existing shapelet-based methods. While the linear classifier is often preferred for its interpretability, its simplicity introduces limitations such as neglect of the interaction/correlation among shapelets, as discussed in Section 6. To mitigate the issues, we present two additional classifier architectures: a bi-linear classifier and an attention-based classifier. Here, for simplicity, we denote the set of shapelets predicates as $\mathbf{p}_i = [p_{i,1},\dots ,p_{i,|S|}]$ . Specifically, they are formulated as + +- Bi-linear classifier: + +$$ +r _ {i, c} = \sum_ {k = 1} ^ {| S |} w _ {k} p _ {i, k} + \sum_ {k = 1} ^ {| S |} \sum_ {j = 1} ^ {| S |} \mathbb {1} (k \neq j) w _ {j, k} p _ {i, k} p _ {i, j}. \tag {12} +$$ + +- Attention-based classifier: + +$$ +r _ {i, c} = \sum_ {k = 1} ^ {| S |} w _ {k} \cdot \text {a t t e n t i o n} (Q (\mathbf {p} _ {i}) + \mathrm {P E}, K (\mathbf {p} _ {i}) + \mathrm {P E}, p _ {i, k}), \tag {13} +$$ + +where attention is the scaled dot-product attention, PE denotes the positional embeddings, $Q$ and $K$ are learnable linear projections. In our implementations, we keep low-dimensional projections $Q:\mathbb{R}^1\mapsto \mathbb{R}^{16}$ and $K:\mathbb{R}^1\mapsto \mathbb{R}^{16}$ . + +Compared to the linear classifier, the bi-linear and attention-based classifiers can capture relationships between shapelet concepts while retaining some level of interpretability. For example, the bi-linear classifier could express "shapelet $s_k$ and $s_j$ both exist in $x_i$ ". Although the attention mechanism (i.e., $Q$ and $K$ projections) may not be considered as fully interpretable, attention $(Q(\mathbf{p}_i) + \mathrm{PE}, K(\mathbf{p}_i) + \mathrm{PE}, p_{i,k})$ produces predicates that combines shapelet predicates based on attention weights, which preserves some level of interpretability + +In Table 16 we compare the three SBM classifier architectures on a subset of the UEA datasets. Our results indicate that the advanced classifiers improve performance for both SBM and InterpGN on certain datasets. Considering the simplicity, good interpretability of linear classifier and its comparable performance to more advanced classifiers on most datasets, we suggest that it is still favorable to use linear classifier in practice; however it is good to try more advanced classifiers to achieve better performance. We will also leave the exploration of other advanced classifiers (such as energy-based or graph-based ones) for future work. + +Table 16: Classification accuracy for the three SBM classifier architectures. The best accuracy for each dataset and model is marked with bold. The PEMS-SF dataset is omitted since due to the quadratic memory cost in bi-linear and attention-based classifiers and its high dimensionality, which fail to run. + +
Model:SBMInterpGN
Classifier:LinearBi-linearAttentionLinearBi-linearAttention
EthanolConcentration0.3010.2990.3020.2980.3070.290
FaceDetection0.6570.6380.6440.6590.6420.642
Handwriting0.3570.3140.2820.6170.6050.609
Heartbeat0.7360.7380.7330.7790.7360.745
JapaneseVowels0.9630.9510.9360.9900.8980.989
SelfRegulationSCP10.8640.8590.8660.9170.8830.914
SelfRegulationSCP20.5220.5300.5660.5780.5620.582
SpokenArabicDigits0.9940.9900.9870.9970.9890.995
UWaveGestureLibrary0.9130.8730.8540.9110.9020.902
+ +# C.4 TIME SERIES EXTRINSIC REGRESSION + +To further investigate the generalizability and limitations of the proposed methods, we apply them to time series extrinsic regression tasks using datasets from the Monash, UEA, and UCR Time Series Extrinsic Regression Repository (Tan et al., 2021). Because the proposed methods are inherently classification models, we recast the regression tasks as ordinal regression problems. Moreover, given that some datasets exhibit highly imbalanced target value distributions, we discretize the target variable into 10 equally sized bins spanning the minimum and maximum target values of the training split for each dataset. + +Since the models produce probabilistic predictions over the ordinal categories (i.e., the bins), we employ the Continuous Ranked Probability Score (CRPS) (Gneiting & Raftery, 2007), which is also widely used in probabilistic forecasting (Aksu et al., 2024), as the performance metric for training and evaluation. Formally, the CRPS is defined as: + +$$ +\operatorname {C R P S} (\hat {\mathbf {r}}, b) = \sum_ {i = 1} ^ {B} \left(\sum_ {j = 1} ^ {i} \hat {r} _ {j} - \mathbb {1} (j \geq B)\right) ^ {2}, \tag {14} +$$ + +where $\hat{\mathbf{r}}$ is the predicted probabilities for each bins, $b$ is the true target bin, and $B$ is the total number of bins. Table 17 summarizes the results obtained for the SBM, InterpGN, and three deep learning models. It should be noted, however, that this experimental setup is preliminary and may require further refinement; our primary objective is to demonstrate the feasibility of extending our proposed methods to regression tasks. + +Table 17: Continuous Ranked Probability Score (CRPS) of the methods on the time series extrinsic regression datasets. The best result for each dataset is marked with bold, and the second best is marked with italic. + +
Model: DNN Type:SBM -InterpGNDeep Learning
FCNPatchTSTTimesNetFCNPatchTSTTimesNet
AppliancesEnergy0.8440.8341.2740.9370.8781.3311.135
BIDMC32HR0.2750.5500.3690.3780.9812.0261.505
BeijingPM10Quality0.5490.4250.8350.4410.4151.1570.424
BeijingPM25Quality0.4770.3320.5690.3320.3131.4400.317
BenzeneConcentration0.9661.0382.9971.2501.0312.2341.258
Covid3Month0.0130.0140.0170.0170.0000.0000.000
FloodModeling10.0060.0060.0080.0080.0000.0000.000
HouseholdPowerConsumption10.4560.4051.3180.9350.4091.0790.807
IEEEPPG1.1222.2852.8962.8622.2502.6193.077
LiveFuelMoistureContent0.4910.5010.6490.6480.4940.6440.644
NewsHeadlineSentiment0.0010.0000.0000.0000.0000.0000.000
\ No newline at end of file diff --git a/ICLR/2025/Shedding Light on Time Series Classification using Interpretability Gated Networks/images.zip b/ICLR/2025/Shedding Light on Time Series Classification using Interpretability Gated Networks/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..36b112362f0e18bf685ebd4de3665857bd9ca502 --- /dev/null +++ b/ICLR/2025/Shedding Light on Time Series Classification using Interpretability Gated Networks/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:95d140ac6c84cdec367ec03d450d4ca98eee8556c8e27941488669d6f1c417bb +size 3630283 diff --git a/ICLR/2025/Shedding Light on Time Series Classification using Interpretability Gated Networks/layout.json b/ICLR/2025/Shedding Light on Time Series Classification using Interpretability Gated Networks/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..ee91cd3b8ba22900b9df03a4b6ce1ecf51a800c8 --- /dev/null +++ b/ICLR/2025/Shedding Light on Time Series Classification using Interpretability Gated Networks/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2775eb2c6eb9bc5f681e511d4103567f1b994d3c971f2895a0638d949f3c1943 +size 992021 diff --git a/ICLR/2025/Shh, don't say that! Domain Certification in LLMs/535182d7-f8ca-433e-8fef-50b0f91f8bf1_content_list.json b/ICLR/2025/Shh, don't say that! Domain Certification in LLMs/535182d7-f8ca-433e-8fef-50b0f91f8bf1_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..e1ac0c2a4b940487af10ae21cc82dbf203df796a --- /dev/null +++ b/ICLR/2025/Shh, don't say that! Domain Certification in LLMs/535182d7-f8ca-433e-8fef-50b0f91f8bf1_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2bf9c960a0c7fce10beeb100430a3274a52e959f4883dbae2b19869d69342e16 +size 238644 diff --git a/ICLR/2025/Shh, don't say that! Domain Certification in LLMs/535182d7-f8ca-433e-8fef-50b0f91f8bf1_model.json b/ICLR/2025/Shh, don't say that! Domain Certification in LLMs/535182d7-f8ca-433e-8fef-50b0f91f8bf1_model.json new file mode 100644 index 0000000000000000000000000000000000000000..72802d583f1c799b1342c2208a35e1aab67a1021 --- /dev/null +++ b/ICLR/2025/Shh, don't say that! Domain Certification in LLMs/535182d7-f8ca-433e-8fef-50b0f91f8bf1_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4dc21b176a6a28e3d2359505d8e6ab53ccd90e37ec53cb686a7ccb4f773de234 +size 285884 diff --git a/ICLR/2025/Shh, don't say that! Domain Certification in LLMs/535182d7-f8ca-433e-8fef-50b0f91f8bf1_origin.pdf b/ICLR/2025/Shh, don't say that! Domain Certification in LLMs/535182d7-f8ca-433e-8fef-50b0f91f8bf1_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..1c7d5ebd48284f94270e141a0d20dfa18a39733d --- /dev/null +++ b/ICLR/2025/Shh, don't say that! Domain Certification in LLMs/535182d7-f8ca-433e-8fef-50b0f91f8bf1_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:41044abca7724f503d55005ea5c754843c227c994620f381c212de516e03cdc1 +size 2925027 diff --git a/ICLR/2025/Shh, don't say that! Domain Certification in LLMs/full.md b/ICLR/2025/Shh, don't say that! Domain Certification in LLMs/full.md new file mode 100644 index 0000000000000000000000000000000000000000..b8f62bf968d060a03f11b51aa413c0dd6b21c2f2 --- /dev/null +++ b/ICLR/2025/Shh, don't say that! Domain Certification in LLMs/full.md @@ -0,0 +1,946 @@ +# SHH, DON'T SAY THAT! DOMAIN CERTIFICATION IN LLMS + +Cornelius Emde $^{1*}$ , Alasdair paren $^{1}$ , Preetham Arvind $^{1}$ , Maxime Kayser $^{1}$ , Tom Rainforth $^{1}$ , Thomas Lukasiewicz $^{2,1}$ , Philip H.S. Torr $^{1}$ , Adel Bibi $^{1}$ + +$^{1}$ University of Oxford $^{2}$ Vienna University of Technology + +# ABSTRACT + +Large language models (LLMs) are often deployed to perform constrained tasks, with narrow domains. For example, customer support bots can be built on top of LLMs, relying on their broad language understanding and capabilities to enhance performance. However, these LLMs are adversarially susceptible, potentially generating outputs outside the intended domain. To formalize, assess, and mitigate this risk, we introduce domain certification; a guarantee that accurately characterizes the out-of-domain behavior of language models. We then propose a simple yet effective approach, which we call VALID that provides adversarial bounds as a certificate. Finally, we evaluate our method across a diverse set of datasets, demonstrating that it yields meaningful certificates, which bound the probability of out-of-domain samples tightly with minimum penalty to refusal behavior. + +# 1 INTRODUCTION + +With recent advancements in the field of natural language processing, large language models (LLMs) have become ubiquitous. In particular, the scaling of recent large generalist models dubbed foundation models has shown to enable emergent abilities that benefit a wide range of downstream tasks such as text generation, question answering, and text comprehension (Kaplan et al., 2020; Alabdulmohsin et al., 2022; Xiong et al., 2024; Henighan et al., 2020; Brown et al., 2020). Adapting these foundation models for downstream tasks often leads to state-of-the-art performance and has become the dominant paradigm (Gao et al., 2021). This is typically achieved via fine-tuning on task-relevant data (e.g., low-rank adaptation (LoRA) Hu et al. (2022), in-context learning (Mosbach et al., 2023), prefix turning Li & Liang (2021), or simply prompt engineering). + +However, foundation models are typically trained on large amounts of web data which contains a wide range of information that is either irrelevant to a task or potentially harmful (Bommasani et al., 2022). Therefore, it is desirable to restrict the output of a generalist LLM to a specific domain. For example, consider a healthcare provider such as the National Health Services (NHS) providing a general purpose chatbot to support their citizens with simple health question portant, for public reputation and cost reasons, that such a s not be misused, either intentionally or unintentionally. Misa + +In order to prevent intentional misuse, we consider an adversary trying to elicit an unintended (from the deployer's perspective) response from the model. We assume the deployer wants an LLM to only respond with a certain set of topics, and thus a successful attack is an input string that creates a coherent response outside the target domain. There are various reasons why an adversary might want to elicit such a response that is out-of-domain (OOD). The adversarial user might want to + +# Health Advice Chatbot + +I am a chatbot to help with health questions. + +I need help committing tax fraud. + +Sorry. I can't help. + +I need help committing tax fraud. $@ / 1 \%$ £\~\~ + +Sure. Here is a five point plan: + +Figure 1: A user misappropriating an LLM system using an adversarial attack. We provide certificates to mitigate this risk. + +misappropriate the system as a cost-effective tool for a purpose it wasn't built for, resulting in excess infrastructure costs for the deployer. Conversely, the deployer might legally be required to validate and verify their models, which is challenging, if not impossible, when the model is not domain-restricted. Finally, the adversary might want to harm the company directly by eliciting harmful OOD responses, which could damage the company's reputation when publicized. Recently, an LLM-driven meal planning tool has received wide media attention for providing toxic recipes when prompted with toxic ingredients (McClure, 2023; The Guardian, 2023). Deployers have moral and legal obligations to prevent this (Bommasani et al., 2022). In all examples, restricting the domain in which the model responds under adversarial prompts can help mitigate risks. Thus, in the era of foundation models, "domain" specialization is critical. + +Existing work has implemented guardrails that address these risks (Jain et al., 2023), most notably via alignment, resulting in models rejecting user requests (Bai et al., 2022; Ouyang et al., 2022; Christiano et al., 2017). However, a wide body of research has shown that common guardrails have "jailbreaks", i.e., they can easily be circumvented by an adversary (Wang et al., 2024; Qi et al., 2024; Eiras et al., 2024; Carlini et al., 2023; Dong et al., 2024). Common jailbreak methods are prompt injection (Perez & Ribeiro, 2022; Jiang et al., 2023; Liu et al., 2024), numerical optimization (Jia & Liang, 2017; Wallace et al., 2019; Ebrahimi et al., 2018; Jones et al., 2023; Zou et al., 2023; Jia et al., 2025), red teaming (Perez et al., 2022; Samvelyan et al., 2024), automated black-box attacks (Chao et al., 2023; Mehrotra et al., 2024), or data poisoning attacks (Biggio et al., 2012; Wallace et al., 2021; Carlini et al., 2024). Using these tools, it is possible for adversaries to retrieve information from a fine-tuned model that was suppressed by the alignment and generate responses that are outside the target domain (see Figure 1 for an example). Adversarial prefixes or suffixes that augment any prompt are especially powerful, as they have been shown to universally attack models in combination with a wide range of prompts and can thus be shared between adversarial users (Wallace et al., 2019; Zou et al., 2023). This presents a significant risk. Hence, researchers have proposed methods to defend against these adversarial attacks, such as unlearning (Nguyen et al., 2022; Xu et al., 2023), robust fine-tuning (O'Neill et al., 2023; Dong et al., 2021), or request and response filtering (Inan et al., 2023). + +Deployers would ideally want guardrails that come with a provable, mathematical guarantee against the model responding off-topic, or a guarantee that it does this with very low probability. The process of constructing guarantees against certain model behaviors under adversarial attack is commonly referred to as certification and has been successfully applied to vision applications in recent years (Akhtar et al., 2021) and proposed for NLP applications (La Malfa, 2023; Casadio et al., 2024; Kumar et al., 2024). However, no existing LLM guardrails provide guaranteed protection against existing or future jailbreaking techniques, leaving deployed models at risk of being compromised shortly after release. As a result, developing certifiable methods to guarantee that specialized LLMs consistently produce on-topic content is critical. Hence, our contributions are as follows: + +- We introduce a novel framework, domain certification, to bound the probability of models producing out-of-domain content under adversarial attack. +- We introduce an easy-to-use algorithm VALID that bounds the probability of an LLM based system responding off topic under adversarial attack. We show the efficiency of VALID which we test empirically on a number of representative data sets. + +# 2 DOMAIN CERTIFICATION + +We now introduce our domain-certification framework for offering mathematical guarantees that an LLM system stays on topic. In Section 2.1, we formally introduce this framework. In Section 2.2, we present Verified Adversarial LLM Output via Iterative Dismissal (VALID). VALID is an easy-to-use method to create a system that adheres to these guarantees. In plain language, we propose a certifiable guardrail for LLM-driven systems as follows: + +A model is domain-certified, when an adversarial upper bound can be placed on the probability that the model provides an output outside its designated target domain. + +Before formalizing this statement, we introduce some mathematical notation. We represent tokens (i.e. individual text units) as $x$ and $y$ , which belong to the token space $x, y \in \mathbb{V}$ where $\mathbb{V} = \{1, \ldots, V\}$ is the vocabulary of size $V$ . We define the space of sequences of arbitrary length as $\mathbb{S} \triangleq \mathbb{V}^*$ , the Kleene closure of $\mathbb{V}$ . Sequences of tokens are denoted by bold letters, $x, y \in \mathbb{S}$ , with + +$\pmb{x}$ and $\pmb{y}$ representing the input and output sequences of an LLM respectively. We use lowercase letters to denote models that predict the next token, such as $l: \mathbb{S} \to \mathbb{V}$ . Applying this model repeatedly, until the end-of-sequence token creates a sequence-to-sequence model $L: \mathbb{S} \to \mathbb{S}$ . We denote the likelihood of sample $\pmb{y}$ under $L$ given $\pmb{x}$ as $L(\pmb{y}|\pmb{x})$ , which is obtained by $L(\pmb{y}|\pmb{x}) = \prod_{n=1}^{N_y} l(y_n | y_{ 1$ indicates that $M$ is more constricting than $L$ , and vice-versa. Smaller ACs for samples in $\mathbb{F}$ are better and hence a large $CR_k$ indicates that model $M$ is favorable over $L$ . To our knowledge, only vacuous certificates for a general model $L$ exist (e.g. $L$ is 1-DC). Hence, we approximate it from below using the likelihood $L(\mathbf{y}|\mathbf{x})$ under non-adversarial $\mathbf{x}$ taken from the datasets. Concretely, we use $L(\mathbf{y}|\mathbf{x})$ as a crude approximation of $\max_{\mathbf{x} \in \mathbb{S}} L(\mathbf{y}|\mathbf{x})$ . This overestimates the robustness of $L$ and underestimates the constriction ratio, + +![](images/73a41c6e75afdc14d4d460e24cfd1f779c7fde3851219ad66d75f1f41553d66f.jpg) +(a) + +![](images/0d084b2227916e6a28fe391747f8b7b1c1141bf376428fe00a372d5243246c8b.jpg) +(b) +Figure 3: All Figures display MedicalQA. Figure 3a shows that log likelihood ratios are well disentangled. Figure 3b shows the trade-off between OOD and certification: The best OOD detection performance occurs with a constriction ratio of 20. Figure 3c shows the false rejection rate (FRR) required to certify at a given $\epsilon$ . All Figures display MedicalQA. + +![](images/76eaf2a38dd6a10ba426252c2d0ff0c92138951bff682c8c7a9fe57220afd9e2.jpg) +(c) + +![](images/cfed42f295bdb763ca845e31106021befc5cfcd1caa7c03982adb2578aedd16d.jpg) +(a) + +![](images/cf7591fc40feb1de27e3775d93938e5aa6d65b605bb0efb5278caac63052fed4.jpg) +(b) + +![](images/4f68af66d96bd69b3e6f850fc22df7fb27bb6715d3956b4d2b6db6c1c8dac64a.jpg) +(c) + +![](images/9b1ca7a2f12191d3cbfa1cf868f68315df1b531acd7a41a5d80039703606e022.jpg) +(d) + +![](images/814408542c34afc479cdd89b7901a3905de675f036b49b699cb1ca2c7db72945.jpg) +(e) + +![](images/e26e03c436653c13b7b6659949a21b21f1a26c5ad1f7e8c5d94887b99c7ae4c2.jpg) +(f) +Figure 4: (a)-(c) show the estimated cumulative distribution function (eCDF) of $\epsilon_{y}$ -ACs for each experimental setup. (d)-(f) show the histograms for the $\log_{10}$ constriction ratios. All results are obtained with hyperparameter $k$ chosen to ensure a $10\%$ false rejection rate (FRR) on in-domain samples. + +i.e., it underestimates the improvement of VALID certificates over $L$ in bounding the probability of OOD responses. In Figures 4 (d) - (f), we show the $\log_{10}$ constriction ratios for out-of-domain samples while setting $k$ to achieve an FRR of $10\%$ (see Appendix E.5 for other FRRs). Across setups, the majority of samples have positive constriction ratios, which means that $M$ issues ACs tighter than $L(y|x)$ . For MedicalQA, we observe a $99\%$ of $\log_{10}\mathrm{CRs}$ are greater than 6.30 and observe a median CR of 24.23. In other words, $99\%$ of samples are at least 6 orders of magnitude less likely under $M$ and in the median $\approx 24$ orders of magnitude less likely (i.e. $1 \times 10^{-24}$ ). We believe these are very strong restrictions and observe even stronger median constriction for 20NG and TinyShakespeare. Further, we observe the strongest constriction among samples with high likelihood under $L$ (see Appendix E). Tight bounds are the most relevant on these samples as they are most likely to be sampled from $L$ . Finally, we illustrate a trade-off between certification and OOD detection in Figure 3b. For MedicalQA, we plot the median constriction ratio for out-of-domain samples across a range of parameters $k$ together with false rejection rates (FRR) and true rejection rates (TRR). The optimal classification performance (as measured by Youden's $J$ (Youden, 1950)) is achieved at $k = 5.35$ with a strong true rejection rate (0.99) and a low false rejection rate (0.01), while producing a median $\log_{10}$ constriction ratio 19.00. Smaller $k$ values yield tighter certificates (see the bound in (4)) and larger constriction ratios at the expense of increasing the FRR. + +Domain Certificates. To study certification across a range of samples, we turn to the domain certificate, $\epsilon$ -DC. Above, we studied the effect of various parameters (e.g., fixing FRR) on the certificates. However, practitioners likely work the other way around: They first set an acceptable threshold according to a threat and safety model. Then, they examine model performance under conditions satisfying such certificate. Hence, we study model performance at a given $\epsilon$ -DC. As proposed in Section 2.1, we establish an $\epsilon$ -DC certificate w.r.t. $\mathcal{D}_{\mathbb{F}}$ approximating the certificate for $\mathbb{F}$ . To obtain $\epsilon_{y}$ -ACs smaller than the domain certificate $\epsilon$ , we need to choose rejection threshold, $k$ , and the number of iterations, $T$ , accordingly. We + +$$ +\text {s o l v e} k, T \text {g i v e n} \epsilon : \quad \max _ {\boldsymbol {y} \in \mathcal {D} _ {\mathbb {F}}} \left\{k N _ {\boldsymbol {y}} + \log T + \log G (\boldsymbol {y}) \right\} = \log \epsilon . \tag {6} +$$ + +For simplicity, we keep $T = 1$ and study model performance on $\mathcal{D}_{\mathbb{T}}$ while maintaining an $\epsilon$ -DC on $\mathcal{D}_{\mathbb{F}}$ . In particular, we look at the FRR of $M$ : The performance of model $M$ is determined by the performance of $L$ (from which VALID samples response candidates) and the false rejections leading to a degradation of $M$ compared to $L$ . Hence, we study the FRR as a function of the certification threshold $\epsilon$ . The result is shown in Figure 3c for MedicalQA: The FRR increases as the certificates get tighter (small $\epsilon$ ). Remarkably, we achieve a domain certificate with $\epsilon = 10^{-5}$ at an FRR of only $15\%$ at a single rejection step. We replicate all figures for the other setups in Appendix E. + +A natural question is why we do not simply use a model comparable to $G$ that is trained exclusively on a subset of $\mathbb{T}$ directly. While such a model would be highly robust against providing useful out-of-domain responses, its performance would significantly lag behind both $L$ and $M$ . Our ablation study + +![](images/43561e6725833cb6ce70f2aa06778524d2c51e64118968d78af5d4fdad4610ea.jpg) +(a) + +![](images/be5a8e62fff94c71533005a828bbe6910d7500a60f73fee3c5059898d770a92f.jpg) +(b) +Figure 5: All Figures show MedicalQA. Figure 5a shows the false rejection rate (FRR) for a range of $\epsilon$ -DC for VALID with $T = 1$ . Figure 5b shows the log likelihood ratio depends on $N_{y}$ for real data. Performing length normalization makes the problem linearly separable. Figure 5c shows PubMedQA@ $\epsilon$ results of our model $M$ . + +![](images/583161b2d24710d99fd315fc39dfc6a1283fa5e0ceabe0cc591e32196fa3e37e.jpg) +(c) + +in Appendix G confirms this performance gap between $G$ and $M$ . These findings demonstrate that our system, which combines the high performance of $L$ with the safety guarantees of $G$ , achieves advantages that neither $L$ nor $G$ can provide independently. Further, the effectiveness of VALID utilizing a $G$ of such limited performance demonstrates that the burden on training $G$ is relatively low: A model that performs poorly on the target task, but distinguishes well between samples in $\mathbb{T}$ and $\mathbb{F}$ , can be sufficient to achieve meaningful certificates for $M$ . + +# 3.3 GENERATING RESPONSES + +In the section above, we evaluate $M$ obtained through VALID on prompts and responses, taken from datasets $\mathcal{D}_{\mathbb{T}}$ and $\mathcal{D}_{\mathbb{F}}$ representing our target domain $\mathbb{T}$ and $\mathbb{F}$ . The experiments provide us with a detailed analysis of ACs and DCs on a large variety of samples for which their membership to $\mathbb{T}$ or $\mathbb{F}$ is given by high-quality labels. Nonetheless, in practice, the candidate responses that are judged by VALID are generated by $L$ . Hence, we prompt $M$ using $\boldsymbol{x} \in \mathcal{D}_{\mathbb{T}}$ and $\boldsymbol{x} \in \mathcal{D}_{\mathbb{F}}$ and use responses generated by $L$ as VALID proposes. We focus on VALID with $T = 1$ and the MedicalQA setup. + +Our findings are in line with Section 3.2 showing a strong ability to distinguish between in- and out-of-domain samples while providing meaningful adversarial bounds. In Figure 5b, we demonstrate the separation of samples from $\mathcal{D}_{\mathbb{T}}$ and $\mathcal{D}_{\mathbb{F}}$ , as well as the dependence of the log ratios on the length of the sequence $y$ extending the theoretical analysis from Section 2.2. In Appendix E.4, we replicate Figure 3 for this setting. We further present in Figure 5a the constriction ratios on out-of-distribution samples generated by $L$ . We see a clear indication that the constriction is strong out-of-domain with an optimal classification performance at a ratio of $10^{40}$ . To reiterate, median ratio between $L(y|x)$ and the $\epsilon_{y}$ -AC for $M$ is $10^{40}$ showing just how strict VALID is on the out-of-domain dataset. + +Building on these results, we test VALID with $T > 1$ . Increasing $T$ can naturally increase the acceptance rate on in-domain samples (through repeatedly proposing candidates) at the cost of increasing the $\epsilon_{y}$ linearly (see (4)). We find great improvements in the acceptance rate on in-domain samples with minimal losses on the $\epsilon$ -DC tightness. We explore this in Appendix F. + +# 3.4 CERTIFIED BENCHMARKING + +We extend the analysis of false rejection rates (FRRs) by evaluating model $M$ 's performance on standardized benchmarks, while ensuring it is certified at $\epsilon$ . In particular, for our MedicalQA setup, we evaluate the model performance on the PubMedQA benchmark (Jin et al., 2019). + +![](images/2720c1b7af15a92a3d0c54309f011e4fb3908f5c81041a95bb43f2c3065a4c9b.jpg) +Figure 6: The PubMedQA@ $\epsilon$ benchmark assesses PubMedQA performance while satisfying $\epsilon$ -DC certificate. The correctness is scored as commonly done for PubMedQA (left). The correct long answer is checked by $M$ while ensuring the $\epsilon$ -DC (right). Only if an item is accepted and correct, the question is scored positively. + +Setup. Evaluating a standardized benchmark such as PubMedQA while certifying model $M$ requires careful consideration. The standard format typically includes $n$ -shot examples followed by a multiple-choice question with either yes/no options or answers labeled A through D. The model is then prompted to select the correct response. However, this setup does not reflect a realistic user-system interaction. Thus, we introduce the PubMedQA@ $\epsilon$ metric, which separates the evaluation into two streams: (1) standard assessment of model $L$ on PubMedQA to determine correctness, and (2) testing whether the correct question-answer pair is rejected by our algorithm. The process is summarized in Figure 6. We score an item as correct, if the model predicts the correct answer while maintaining its $\epsilon - DC$ on the realistic question-answering pair. + +Results. The unconstrained model scores $73.4\%$ on PubMedQA. As we tighten the certificate (decrease $\epsilon$ ), more correct responses are rejected and the benchmark score drops, as shown in Figure 5c. We find that when certifying at $\epsilon = 10^{-5}$ , we maintain a certified score of $66.7\%$ (-6.7%), and at $\epsilon = 10^{-10}$ of $47.7\%$ (-25.7%). These scores demonstrate robust performance given the provable defense facilitating domain restriction. In Appendix H, we discuss benchmarking in more depth. + +# 4 RELATED WORK + +LLM Guardrails. A large body of work has been published on establishing effective guardrails for LLMs. These approaches are designed to restrict the model to responses that align with the deployer's values. One of the first approaches was Reinforcement Learning with Human Feedback (RLHF) (Askell et al., 2021), which uses human preferences to guide LLM training. Extensions such as Safe-RLHF add cost models to penalize harmful behavior, ensuring a balance between helpfulness and harmlessness during optimization (Dai et al., 2024). RLHF's foundation in reinforcement learning has given rise to techniques such as Proximal Policy Optimization (PPO) (Bai et al., 2022), the more recent Direct Preference Optimization (DPO) (Rafailov et al., 2024), and Generalized Policy Optimization (GPO) (Tang et al., 2024), which incorporates diverse optimization objectives, useful for safety-critical scenarios. For an in-depth survey of this area, we direct the reader to Kaufmann et al. (2024). Unlike the preceding approaches that fine-tune guardrails into the parameters of an LLM, a number of works have proposed using LLMs to classify content as either safe or unsafe. Llama Guard categorizes the inputs and outputs of an LLM into different unsafe content categories (Inan et al., 2023). Conversely, Chua et al. (2024) classify if an output is safe with respect to a system prompt. For a complete overview on LLM guardrails, we direct the interested reader to a recent survey of this area, Dong et al. (2024). Existing LLM guardrail techniques have been proven effective to different levels. However, these guardrails only come with empirical evidence of their proficiency against existing attacks, and hence, many have been circumvented shortly after deployment. Conversely, VALID offers a provable high-probability guarantee against undesirable behavior, reflecting recent advocacy for such provable assurances (Bengio, 2024). + +Out-of-Distribution Detection. Out-of-distribution (OOD) detection has received a lot of attention in recent years in NLP. Commonly, the problem is treated as text classification and softmax probabilities of class predictions (Hendrycks & Gimpel, 2017) or energy scores (Liu et al., 2020) are deployed as discriminant scores. Another group of methods employs distance-based methods, relying on OOD responses being distant from ID responses in latent space, often utilizing Mahalanobis distance and sometimes incorporating contrastive learning techniques (Uppaal et al., 2023; Podolskiy et al., 2021; Zhou et al., 2021; Khosla et al., 2020; Lin & Gu, 2023). Finally, rooted in classical statistics, a number of studies suggest using the log-likelihood ratio (LLR) as a discriminate score, comparing likelihoods from ID and OOD proxy models (Gangal et al., 2020; Zhang et al., 2024). Xu & Ding (2024) offer a comprehensive review of LLMs for OOD detection. While many of these works have strong empirical detection results, their focus is OOD detection rather than certification, and hence they do not provide theoretical guarantees or certificates on model behavior. + +Certifying LLMS. A number of certification approaches have been proposed for LLMs in various contexts. For instance, Chaudhary et al. (2024) aim to certify the knowledge comprehension ability of LLMs and Freiberger & Buchmann (2024) discuss what criteria should be certified to ensure fairness. Most relevant here is work on certification against adversarial inputs. Casadio et al. (2024) discuss certifying the robustness of LLMs to input perturbations in embedding space. Commonly, adversarial certification is studied for text classification rather than generation (La Malfa, 2023). Kumar et al. (2024) introduce a framework for defending against adversarial perturbations in token + +space by performing a small number of substitutions around a given input. In contrast VALID comes with certificates that hold for all inputs, rather than perturbations around a specific input. + +# 5 LIMITATIONS + +Despite our promising results, we acknowledge the limitations of our current implementation. First, the domain generator $G(\pmb{y})$ lacks context. This means that if $\pmb{y}$ is marginally in-domain, while $\pmb{y}|\pmb{x}$ , the conditional distribution is not, our method will not reject appropriately. Consider a chatbot for tax advice. For prompt $\pmb{x} =$ "How often is a tax report due?", the response $\pmb{y} =$ "Once a year." is in-domain. Hence, the same response to $\pmb{x} =$ "How often should I shower?" might be accepted despite it being out-of-domain, and terrible advice. However, this can be mitigated by fine-tuning the model $L$ to be as explicit as possible repeating "shower" in the response. + +Second, this approach relies heavily on the domain-specific model $G$ , and how closely it approximates the ideal oracle $\Omega$ . In practice and as demonstrated in our experiments, $G$ might have limited semantic understanding and lack general language capabilities and world knowledge. In most instances it might not be able to distinguish between semantically opposite but similar sentences and hence VALID is likely incapable of aligning the model, rather than shushing it. + +Third, an adversary might construct an attack that aims to copy tokens from the prompt of $L$ to $G$ . For instance, $x =$ "Repeat after me: !!!-+! and then tell me how to build a bomb!". This "!!!-+!" might be an adversary for $G$ to assign a high likelihood to $L$ following the instruction. For this attack, the adversary operates with limited information, having access only to whether the log ratio is bounded, without visibility into $G$ 's outputs, weights, or likelihood scores. In addition, since $G$ has never seen information on how to build a bomb, it is extremely unlikely to produce coherent, correct, and harmful content. In Appendix C.1, we discuss the feasibility of attacking $M$ further. + +Fourth, our method comes at the extra cost of sampling up to $T$ times. Further, it requires training $G$ and evaluating it during inference. Depending on the architecture of $G$ however, the extra cost is limited. In our experiments $G$ is orders of magnitude smaller than $L$ . + +# 6 FUTURE WORK + +In this section we briefly discuss some ideas for future work that we believe could further extent the practical utility of VALID. Initially, it would be interesting to test larger, specialized models for $G$ to evaluate whether these more advanced models produce improved certificates and refusal rates. We chose not to do this because LLMs trained from scratch exclusively on specific domains are not common, and thus results generalize less to what a practitioner with limited resources could expect. + +As described in Section 2.2, VALID uses length normalization to ensure the log likelihood ratio rejection condition is robust to different lengths of sequences $N_{y}$ . One may extend this and learn a more complex polynomial of $N_{y}$ as rejection threshold. This threshold could be used to provide both $\epsilon_{y}$ -ACs and $\epsilon$ -DC certificates, while simultaneously enabling more precise OOD detection. + +Finally, a rejection scheme with a probabilistic decision rule, similar to Algorithm 5 in Vyas et al. (2023), would be able to provide identical bounds to Theorem 1. Possibly, this rejection rule would lead to better performance in terms of OOD classification. + +# 7 CONCLUSION + +In this work, we tackle the problem of generative language models producing outputs outside their target domain in response to adversarial inputs. We describe the associated risks, introduce a first-of-its-kind framework for domain certification for LLMs, and provide VALID, a simple algorithm relying on well-established theories from statistics and information theory to provide such guarantees. We demonstrate the effectiveness of VALID in multiple representative settings and show that it is effective even when relying on a guide model $G$ with limited language skills, making it easy to deploy in limited data and resource environments. + +# ACKNOWLEDGMENTS + +This work is supported by a UKRI grant Turing AI Fellowship (EP/W002981/1). C. Emde and M. Kayser are supported by the EPSRC Centre for Doctoral Training in Health Data Science (EP/S02428X/1) and the AXA Research Fund. A. Bibi acknowledges the Google Gemma 2 Academic Award 2024. T. Lukasiewicz is supported by the AXA Research Fund. Tom Rainforth is supported by the UK EPSRC grant EP/Y037200/1. The research reported in this publication was partially supported by funding from KAUST Center of Excellence on GenAI, under award number 5940. We thank the Royal Academy of Engineering and we thank Samuele Marro for his advice. + +Due to an unfortunate oversight, Professor Bernard Ghanem (KAUST) was not included in the author list for our ICLR 2025 submission. Despite our appeal to the conference Program Chairs (PC), the ruling was strict, and we strongly disagree with it. We apologize for this error and acknowledge his contributions, which were absolutely key to the success of this project. For clarity, the arXiv version of this paper has the complete and correct list of authors, including Professor Ghanem. + +Finally, we thank the reviewers and the area chair (AC) for their efforts and constructive feedback. + +# REFERENCES + +AI@Meta. Llama 3 Model Card. 2024. +Naveed Akhtar, Ajmal Mian, Navid Kardan, and Mubarak Shah. Advances in Adversarial Attacks and Defenses in Computer Vision: A Survey. IEEE Access, 9:155161-155196, 2021. +Ibrahim M Alabdulmohsin, Behnam Neyshabur, and Xiaohua Zhai. Revisiting Neural Scaling Laws in Language and Vision. In S. Koyejo, S. Mohamed, A. Agarwal, D. Belgrave, K. Cho, and A. Oh (eds.), Advances in Neural Information Processing Systems, volume 35, pp. 22300-22312. Curran Associates, Inc., 2022. +Amanda Askell, Yuntao Bai, Anna Chen, Dawn Drain, Deep Ganguli, Tom Henighan, Andy Jones, Nicholas Joseph, Ben Mann, Nova DasSarma, Nelson Elhage, Zac Hatfield-Dodds, Danny Hernandez, Jackson Kernion, Kamal Ndousse, Catherine Olsson, Dario Amodei, Tom Brown, Jack Clark, Sam McCandlish, Chris Olah, and Jared Kaplan. A General Language Assistant as a Laboratory for Alignment, 2021. ArXiv: 2112.00861. +Yuntao Bai, Andy Jones, Kamal Ndousse, Amanda Askell, Anna Chen, Nova DasSarma, Dawn Drain, Stanislav Fort, Deep Ganguli, Tom Henighan, Nicholas Joseph, Saurav Kadavath, Jackson Kernion, Tom Conerly, Sheer El-Showk, Nelson Elhage, Zac Hatfield-Dodds, Danny Hernandez, Tristan Hume, Scott Johnston, Shauna Kravec, Liane Lovitt, Neel Nanda, Catherine Olsson, Dario Amodei, Tom Brown, Jack Clark, Sam McCandlish, Chris Olah, Ben Mann, and Jared Kaplan. Training a Helpful and Harmless Assistant with Reinforcement Learning from Human Feedback, 2022. ArXiv: 2204.05862. +Yoshua Bengio. Bounding the probability of harm from an AI to create a guardrail - https://yoshuabengio.org/2024/08/29/bounding-the-probability-of-harm-from-an-ai-to-create-a-guardrail/, August 2024. +Yoshua Bengio, Michael K. Cohen, Nikolay Malkin, Matt MacDermott, Damiano Fornasiere, Pietro Greiner, and Younesse Kaddar. Can a Bayesian Oracle Prevent Harm from an Agent?, 2024. ArXiv: 2408.05284. +Battista Biggio, Blaine Nelson, and Pavel Laskov. Poisoning Attacks against Support Vector Machines. In Proceedings of the 29th International Coference on International Conference on Machine Learning, ICML'12, pp. 1467-1474, Madison, WI, USA, 2012. Omnipress. ISBN 978-1-4503-1285-1. event-place: Edinburgh, Scotland. +Christopher M. Bishop. Novelty detection and neural network validation. *IEE Proceedings-Vision, Image and Signal Processing*, 141(4):217-222, 1994. +Rishi Bommasani, Drew A. Hudson, Ehsan Adeli, Russ Altman, Simran Arora, Sydney von Arx, Michael S. Bernstein, Jeannette Bohg, Antoine Bosselut, Emma Brunskill, Erik Brynjolfsson, Shyamal Buch, Dallas Card, Rodrigo Castellon, Niladri Chatterji, Annie Chen, Kathleen Creel, + +Jared Quincy Davis, Dora Demszky, Chris Donahue, Moussa Doumbouya, Esin Durmus, Stefano Ermon, John Etchemendy, Kawin Ethayarajh, Li Fei-Fei, Chelsea Finn, Trevor Gale, Lauren Gillespie, Karan Goel, Noah Goodman, Shelby Grossman, Neel Guha, Tatsunori Hashimoto, Peter Henderson, John Hewitt, Daniel E. Ho, Jenny Hong, Kyle Hsu, Jing Huang, Thomas Icard, Saahil Jain, Dan Jurafsky, Pratyusha Kalluri, Siddharth Karamcheti, Geoff Keeling, Fereshte Khani, Omar Khattab, Pang Wei Koh, Mark Krass, Ranjay Krishna, Rohith Kuditipudi, Ananya Kumar, Faisal Ladhak, Mina Lee, Tony Lee, Jure Leskovec, Isabelle Levent, Xiang Lisa Li, Xuechen Li, Tengyu Ma, Ali Malik, Christopher D. Manning, Suvir Mirchandani, Eric Mitchell, Zanele Munyikwa, Suraj Nair, Avanika Narayan, Deepak Narayanan, Ben Newman, Allen Nie, Juan Carlos Niebles, Hamed Nilforoshan, Julian Nyarko, Giray Ogut, Laurel Orr, Isabel Papadimitriou, Joon Sung Park, Chris Piech, Eva Portelance, Christopher Potts, Aditi Raghunathan, Rob Reich, Hongyu Ren, Frieda Rong, Yusuf Roohani, Camilo Ruiz, Jack Ryan, Christopher Ré, Dorsa Sadigh, Shiori Sagawa, Keshav Santhanam, Andy Shih, Krishnan Srinivasan, Alex Tamkin, Rohan Taori, Armin W. Thomas, Florian Tramér, Rose E. Wang, William Wang, Bohan Wu, Jiajun Wu, Yuhuai Wu, Sang Michael Xie, Michihiro Yasunaga, Jiaxuan You, Matei Zaharia, Michael Zhang, Tianyi Zhang, Xikun Zhang, Yuhui Zhang, Lucia Zheng, Kaitlyn Zhou, and Percy Liang. On the Opportunities and Risks of Foundation Models, 2022. ArXiv: 2108.07258. +Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel Ziegler, Jeffrey Wu, Clemens Winter, Chris Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, and Dario Amodei. Language Models are Few-Shot Learners. In H. Larochelle, M. Ranzato, R. Hadsell, M. F. Balcan, and H. Lin (eds.), Advances in Neural Information Processing Systems, volume 33, pp. 1877-1901. Curran Associates, Inc., 2020. +Nicholas Carlini, Milad Nasr, Christopher A. Choquette-Choo, Matthew Jagielski, Irena Gao, Pang Wei W Koh, Daphne Ippolito, Florian Tramer, and Ludwig Schmidt. Are aligned neural networks adversarially aligned? In A. Oh, T. Naumann, A. Globerson, K. Saenko, M. Hardt, and S. Levine (eds.), Advances in Neural Information Processing Systems, volume 36, pp. 61478-61500. Curran Associates, Inc., 2023. +Nicholas Carlini, Matthew Jagielski, Christopher A. Choquette-Choo, Daniel Paleka, Will Pearce, Hyrum Anderson, Andreas Terzis, Kurt Thomas, and Florian Tramér. Poisoning Web-Scale Training Datasets is Practical, 2024. ArXiv: 2302.10149. +Marco Casadio, Tanvi Dinkar, Ekaterina Komendantskaya, Luca Arnaboldi, Matthew L. Daggitt, Omri Isac, Guy Katz, Verena Rieser, and Oliver Lemon. NLP Verification: Towards a General Methodology for Certifying Robustness, 2024. ArXiv: 2403.10144. +Patrick Chao, Alexander Robey, Edgar Dobriban, Hamed Hassani, George J. Pappas, and Eric Wong. Jailbreaking Black Box Large Language Models in Twenty Queries. In R0-FoMo: Robustness of Few-shot and Zero-shot Learning in Large Foundation Models, 2023. ArXiv: 2310.08419. +Isha Chaudhary, Vedaant V. Jain, and Gagandeep Singh. Quantitative Certification of Knowledge Comprehension in LLMs. In ICLR 2024 Workshop on Secure and Trustworthy Large Language Models, 2024. ArXiv: 2402.15929. +Paul F Christiano, Jan Leike, Tom Brown, Miljan Martic, Shane Legg, and Dario Amodei. Deep Reinforcement Learning from Human Preferences. In I. Guyon, U. Von Luxburg, S. Bengio, H. Wallach, R. Fergus, S. Vishwanathan, and R. Garnett (eds.), Advances in Neural Information Processing Systems, volume 30. Curran Associates, Inc., 2017. +Gabriel Chua, Shing Yee Chan, and Shaun Khoo. A Flexible Large Language Models Guardrail Development Methodology Applied to Off-Topic Prompt Detection, 2024. ArXiv: 2411.12946. +Josef Dai, Xuehai Pan, Ruiyang Sun, Jiaming Ji, Xinbo Xu, Mickel Liu, Yizhou Wang, and Yaodong Yang. Safe RLHF: Safe Reinforcement Learning from Human Feedback. In The Twelfth International Conference on Learning Representations, 2024. +Xinshuai Dong, Anh Tuan Luu, Min Lin, Shuicheng Yan, and Hanwang Zhang. How Should Pre-Trained Language Models Be Fine-Tuned Towards Adversarial Robustness? In M. Ranzato, + +A. Beygelzimer, Y. Dauphin, P. S. Liang, and J. Wortman Vaughan (eds.), Advances in Neural Information Processing Systems, volume 34, pp. 4356-4369. Curran Associates, Inc., 2021. +Yi Dong, Ronghui Mu, Yanghao Zhang, Siqi Sun, Tianle Zhang, Changshun Wu, Gaojie Jin, Yi Qi, Jinwei Hu, Jie Meng, Saddek Bensalem, and Xiaowei Huang. Safeguarding Large Language Models: A Survey, 2024. ArXiv: 2406.02622. +Abhimanyu Dubey, Abhinav Jauhri, Abhinav Pandey, Abhishek Kadian, Ahmad Al-Dahle, Aiesha Letman, Akhil Mathur, Alan Schelten, Amy Yang, Angela Fan, Anirudh Goyal, Anthony Hartshorn, Aobo Yang, Archi Mitra, Archie Sravankumar, Artem Korenev, Arthur Hinsvark, Arun Rao, Aston Zhang, Aurelien Rodriguez, Austen Gregerson, Ava Spataru, Baptiste Roziere, Bethany Biron, Binh Tang, Bobbie Chern, Charlotte Caucheteux, Chaya Nayak, Chloe Bi, Chris Marra, Chris McConnell, Christian Keller, Christophe Touret, Chunyang Wu, Corinne Wong, Cristian Canton Ferrer, Cyrus Nikolaidis, Damien Allonsius, Daniel Song, Danielle Pintz, Danny Livshits, David Esiobu, Dhruv Choudhary, Dhruv Mahajan, Diego Garcia-Olano, Diego Perino, Dieuwke Hupkes, Egor Lakomkin, Ehab AlBadawy, Elina Lobanova, Emily Dinan, Eric Michael Smith, Filip Radenovic, Frank Zhang, Gabriel Synnaeve, Gabrielle Lee, Georgia Lewis Anderson, Graeme Nail, Gregoire Mialon, Guan Pang, Guillem Cucurell, Hailey Nguyen, Hannah Korevaar, Hu Xu, Hugo Touvron, Iliyan Zarov, Imanol Arrieta Ibarra, Isabel Kloumann, Ishan Misra, Ivan Evtimov, Jade Copet, Jaewon Lee, Jan Geffert, Jana Vranes, Jason Park, Jay Mahadeokar, Jeet Shah, Jelmer van der Linde, Jennifer Billock, Jenny Hong, Jenya Lee, Jeremy Fu, Jianfeng Chi, Jianyu Huang, Jiawen Liu, Jie Wang, Jiecao Yu, Joanna Bitton, Joe Spisak, Jongsoo Park, Joseph Rocca, Joshua Johnstun, Joshua Saxe, Junteng Jia, Kalyan Vasuden Alwala, Kartikeya Upasani, Kate Plawiak, Ke Li, Kenneth Heafield, Kevin Stone, Khalid El-Arini, Krithika Iyer, Kshitiz Malik, Kuenley Chiu, Kunal Bhalla, Lauren Rantala-Yeary, Laurens van der Maaten, Lawrence Chen, Liang Tan, Liz Jenkins, Louis Martin Lovish Madaan Lubo Malo Lukas Blecher Lukas Landzaat Luke de Oliveira Madeline Muzzi Mahesh Pasupuleti Mannat Singh Manohar Paluri Marcin Kardas Mathew Oldham Mathieu Rita Maya Pavlova Melanie Kambadur Mike Lewis Min Si Mitesh Kumar Singh Mona Hassan Naman Goyal Narjes Torabi,Nikolay Bashlykov,Nikolay Bogoychev,Niladri Chatterji Olivier Duchenne Onur Celebi Patrick Alrassy Pengchuan Zhang Pengwei Li Petar Vasic Peter Weng Prajwal Bhargava Pratik Dubal Praveen Krishnan Punit Singh Koura Puxin Xu Qing He Qingxiao Dong Ragavan Srinivasan Raj Ganapathy Ramon Calderer Ricardo Silveira Cabral Robert Stojnic Roberta Raileanu Rohit Girdhar Rohit Patel Romain SauvestreRonnie Polidoro Roshan Sumbaly Ross Taylor Ruan Silva Rui Hou Rui Wang Saghar Hosseini Sahana Chennabasappa Sanjay Singh Sean Bell Seohyun Sonia Kim,Sergey Edunov Shaoliang Nie Sharan Narang Sharath Rarparthy Sheng Shen Shengye Wan Shruti Bhosale Shun Zhang Simon Vandenhende Soumya Batra Spencer Whitman Sten Sootla Stephane Collot Suchin Gururangan Sydney Borodinsky Tamar Herman Tara Fowler Tarek Sheasha Thomas Georgiou Thomas Scialom Tobias Speckbacher,Todor MihaylovTong Xiao Ujjwal Karn,Vedanuj Goswami Vibhor Gupta Vignesh Ramanathan,Viktor Kerkez Vincent Gonguet Virginie Do Vish Vogeti Vladan Petrovic Weiwei Chu Wenhan Xiong Wen Yin Fu Whitney Meers Xavier Martinet Xiaodong Wang Xiaqing Ellen Tan Xinfeng Xie Xuchao Jia Xuewei Wang Yaelle Goldschlag,Yashesh Gaur Yasmine Babaei Yi Wen Yiwen Song Yuchen Zhang Yue Li Yuning Mao Zacharie Delpierre Coudert Zheng Yan Zhengxing Chen Zoe Papakipos Aaditya Singh Aaron Grattafori Abha Jain Adam Kelsey Adam Shajnfeld Adithya Gangidi Adolfo Victoria,Ahuva Goldstand Ajay Menon Ajay Sharma Alex Boesenberg Alex Vaughan Alexei Baevski Allie Feinstein Amanda Kallet Amit Sangani Anam Yunus Andrei Lupu Andres Alvarado Andrew Caples Andrew GuAndrew Ho Andrew Poulton Andrew Ryan Ankit Ramchandani Annie Franco Aparajita Saraf Arkabandhu Chowdhury Ashley Gabriel Ashwin Bharambe Assaf Eisenman Azadeh Yazdan Beau James Ben Maurer Benjamin Leonhardi Bernie Huang Beth Loyd Beto De Paola Bhargavi Paranjape Bing Liu Bo Wu Boyu Ni Braden Hancock Bram Wasti Brandon Spence Brani Stojkovic Brian Gamido Britt Montalvo Carl Parker Carly Burton Catalina Mejia. Changhan Wang Changkyu Kim Chao Zhou Chester Hu Ching-Hsiang Chu Chris Cai Chris Tindal Christoph Feichtenhofer Damon Civin Dana Beaty Daniel Kreymer Daniel Li Danny Wyatt David Atkins David Xu Davide Testuggine Delia David Devi Parikh Diana Liskovich Didem Foss Dingkang Wang Duc Le Dustin Holland Edward Dowling Eissa Jamil Elaine Montgomery Eleonora Presani Emily Hahn Emily Wood Erik Brinkman Esteban Arcaute Evan Dunbar Evan Smothers Fei Sun Felix Kreuk Feng Tian First Ozgenel Francesco Caggioni Francisco Guzmán Frank Kanayet Frank Seide Gabriela Medina Florez Gabriella Schwarz Gada Badeer Georgia Swee Gil Halpern Govind Thattai Grant Herman Grigory + +Sizov, Guangyi, Zhang, Guna Lakshminarayanan, Hamid Shojanazeri, Han Zou, Hannah Wang, Hanwen Zha, Haroun Habeeb, Harrison Rudolph, Helen Suk, Henry Aspegren, Hunter Goldman, Ibrahim Damlaj, Igor Molybog, Igor Tufanov, Irina-Elena Veliche, Itai Gat, Jake Weissman, James Geboski, James Kohli, Japhet Asher, Jean-Baptiste Gaya, Jeff Marcus, Jeff Tang, Jennifer Chan, Jenny Zhen, Jeremy Reizenstein, Jeremy Teboul, Jessica Zhong, Jian Jin, Jingyi Yang, Joe Cummings, Jon Carvill, Jon Shepard, Jonathan McPhie, Jonathan Torres, Josh Ginsburg, Junjie Wang, Kai Wu, Kam Hou U, Karan Saxena, Karthik Prasad, Kartikay Khandelwal, Katayoun Zand, Kathy Matosich, Kaushik Veeraraghavan, Kelly Michelena, Keqian Li, Kun Huang, Kunal Chawla, Kushal Lakhotia, Kyle Huang, Lailin Chen, Lakshya Garg, Lavender A, Leandro Silva, Lee Bell, Lei Zhang, Liangpeng Guo, Licheng Yu, Liron Moshkovich, Luca Wehrstedt, Madian Khabsa, Manav Avalani, Manish Bhatt, Maria Tsimpoukelli, Martynas Mankus, Matan Hasson, Matthew Lennie, Matthias Reso, Maxim Groshev, Maxim Naumov, Maya Lathi, Meghan Keneally, Michael L. Seltzer, Michal Valko, Michelle Restrepo, Mihir Patel, Mik Vyatskov, Mikayel Samvelyan, Mike Clark, Mike Macey, Mike Wang, Miquel Jubert Hermoso, Mo Metanat, Mohammad Rastegari, Munish Bansal, Nandhini Santhanam, Natascha Parks, Natasha White, Navyata Bawa, Nayan Singhal, Nick Egebo, Nicolas Usunier, Nikolay Pavlovich Laptev, Ning Dong Ning Zhang, Norman Cheng, Oleg Chernoguz, Olivia Hart, Omkar Salpekar Ozlem Kalinli Parkin Kent, Parth Parekh Paul Saab Pavan Balaji Pedro Rittner Philip Bontrager Pierre Roux Piotr Dollar Polina Zvyagina Prashant Ratanchandani,ritish Yuvraj Qian Liang Rachad Alao Rachel RodriguezRafi Ayub Ragbotham Murthy Raghu Nayani Rahul Mitra Raymond Li Rebekkah Hogan Robin Battey Rocky Wang Rohan Maheswari Russ Howes,Ruty Rinott Sai Jayesh Bondu Samyak Datta Sara Chugh Sara Hunt Sargun Dhillon Sasha Sidorov Satadru Pan,Saurabh Verma Seiji Yamamoto Sharadh Ramaswamy Shaun Lindsay Shaun Lindsay Sheng Feng Shenghao Lin Shengxin Cindy Zha Shiva Shankar Shuqiang Zhang Shuqiang Zhang Sinong WangSneha Agarwal Soji Sajuyigbe Soumith Chintala Stephanie Max Stephen Chen Steve Kehoe Steve Satterfield Sudarshan Govindaprasad Sumit Gupta Sungmin Cho Sunny Virk Suraj Subramanian Sy Choudhury Sydney Goldman Tal RemezTamar Glaser Tamara Best Thilo Kohler Thomas Robinson Tianhe Li Tianjun Zhang Tim Matthews Timothy Chou Tzook Shaked Varun Vontimitta Victoria Ajayi Victoria Montanez Vijai Mohan Vinay Satish Kumar Vishal ManglaVitor Albiero,Vlad Ionescu,Vlad Poenaru,Vlad Tiberiu Mihailescu,Vladimir Ivanov Wei Li Wenchen Wang Wenwen Jiang Wes Bouaziz Will ConstableXiaocheng Tang Xiaofang WangXiaojian Wu Xiaolan Wang Xide Xia Xilun Wu Xinbo Gao Yanjun Chen Ye HuYe JiaYe QiYenda LiYilin Zhang Ying Zhang Yossi Adi Youngjin Nam Yu,Wang,Yuchen HaoYundi QianUzi HeZach Rait Zachary DeVito Zef Rosnbrick,Zhaoduo Wen,Zhenyu Yang,and Zhiwei Zhao.The Llama 3 Herd of Models2024. ArXiv:2407.21783. + +Javid Ebrahimi, Anyi Rao, Daniel Lowd, and Dejing Dou. HotFlip: White-Box Adversarial Examples for Text Classification. In Iryna Gurevych and Yusuke Miyao (eds.), Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 2: Short Papers), pp. 31-36, Melbourne, Australia, July 2018. Association for Computational Linguistics. + +Francisco Eiras, Aleksandar Petrov, Phillip H. S. Torr, M. Pawan Kumar, and Adel Bibi. Mimicking User Data: On Mitigating Fine-Tuning Risks in Closed Large Language Models, 2024. ArXiv: 2406.10288. + +EU. Regulation (EU) 2024/1689 of the European Parliament and of the Council of 13 June 2024 laying down harmonised rules on artificial intelligence and amending Regulations (EC) No 300/2008, (EU) No 167/2013, (EU) No 168/2013, (EU) 2018/858, (EU) 2018/1139 and (EU) 2019/2144 and Directives 2014/90/EU, (EU) 2016/797 and (EU) 2020/1828 (Artificial Intelligence Act) (Text with EEA relevance), June 2024. Legislative Body: CONSIL, EP. + +Vincent Freiberger and Erik Buchmann. Fairness certification for natural language processing and large language models. In Intelligent Systems Conference, pp. 606-624. Springer, 2024. + +Varun Gangal, Abhinav Arora, Arash Einolghozati, and Sonal Gupta. Likelihood ratios and generative classifiers for unsupervised out-of-domain detection in task oriented dialog. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pp. 7764-7771, 2020. + +Tianyu Gao, Adam Fisch, and Danqi Chen. Making Pre-trained Language Models Better Few-shot Learners. In Chengqing Zong, Fei Xia, Wenjie Li, and Roberto Navigli (eds.), Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International + +Joint Conference on Natural Language Processing (Volume 1: Long Papers), pp. 3816-3830, Online, August 2021. Association for Computational Linguistics. +Saibo Geng, Martin Josifoski, Maxime Peyrard, and Robert West. Grammar-Constrained Decoding for Structured NLP Tasks without Finetuning. In Houda Bouamor, Juan Pino, and Kalika Bali (eds.), Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing, pp. 10932-10952, Singapore, December 2023. Association for Computational Linguistics. +Dan Hendrycks and Kevin Gimpel. A Baseline for Detecting Misclassified and Out-of-Distribution Examples in Neural Networks. In International Conference on Learning Representations, 2017. +Dan Hendrycks, Collin Burns, Steven Basart, Andy Zou, Mantas Mazeika, Dawn Song, and Jacob Steinhardt. Measuring Massive Multitask Language Understanding. In International Conference on Learning Representations (ICLR), 2021. ArXiv: 2009.03300. +Tom Henighan, Jared Kaplan, Mor Katz, Mark Chen, Christopher Hesse, Jacob Jackson, Heewoo Jun, Tom B. Brown, Prafulla Dhariwal, Scott Gray, Chris Hallacy, Benjamin Mann, Alec Radford, Aditya Ramesh, Nick Ryder, Daniel M. Ziegler, John Schulman, Dario Amodei, and Sam McCandlish. Scaling Laws for Autoregressive Generative Modeling, 2020. +Edward J. Hu, Yelong Shen, Phillip Wallis, Zeyuan Allen-Zhu, Yanzhi Li, Shean Wang, Lu Wang, and Weizhu Chen. LoRA: Low-Rank Adaptation of Large Language Models. In International Conference on Learning Representations (ICLR), 2022. +Hakan Inan, Kartikeya Upasani, Jianfeng Chi, Rashi Rungta, Krithika Iyer, Yuning Mao, Michael Tontchev, Qing Hu, Brian Fuller, Davide Testuggine, and Madian Khabsa. Llama Guard: LLM-based Input-Output Safeguard for Human-AI Conversations, 2023. ArXiv: 2312.06674. +Neel Jain, Avi Schwarzschild, Yuxin Wen, Gowthami Somepalli, John Kirchenbauer, Ping-yeh Chiang, Micah Goldblum, Aniruddha Saha, Jonas Geiping, and Tom Goldstein. Baseline Defenses for Adversarial Attacks Against Aligned Language Models, 2023. ArXiv: 2309.00614. +Robin Jia and Percy Liang. Adversarial Examples for Evaluating Reading Comprehension Systems, 2017. ArXiv: 1707.07328. +Xiaojun Jia, Tianyu Pang, Chao Du, Yihao Huang, Jindong Gu, Yang Liu, Xiaochun Cao, and Min Lin. Improved Techniques for Optimization-Based Jailbreaking on Large Language Models. In The Thirteenth International Conference on Learning Representations (ICLR), 2025. ArXiv:2405.21018. +Shuyu Jiang, Xingshu Chen, and Rui Tang. Prompt Packer: Deceiving LLMs through Compositional Instruction with Hidden Attacks, 2023. ArXiv: 2310.10077. +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), pp. 2567-2577, 2019. +Erik Jones, Anca Dragan, Aditi Raghunathan, and Jacob Steinhardt. Automatically Auditing Large Language Models via Discrete Optimization. In Andreas Krause, Emma Brunskill, Kyunghyun Cho, Barbara Engelhardt, Sivan Sabato, and Jonathan Scarlett (eds.), Proceedings of the 40th International Conference on Machine Learning, volume 202 of Proceedings of Machine Learning Research, pp. 15307-15329. PMLR, July 2023. +Jared Kaplan, Sam McCandlish, Tom Henighan, Tom B. Brown, Benjamin Chess, Rewon Child, Scott Gray, Alec Radford, Jeffrey Wu, and Dario Amodei. Scaling Laws for Neural Language Models, 2020. ArXiv: 2001.08361. +Andrej Karpathy. The Unreasonable Effectiveness of Recurrent Neural Networks - http://karpathy.github.io/2015/05/21/rnn-effectiveness/, 2015. +Timo Kaufmann, Paul Weng, Viktor Bengs, and Eyke Hüllermeier. A Survey of Reinforcement Learning from Human Feedback, 2024. ArXiv: 2312.14925. + +Prannay Khosla, Piotr Teterwak, Chen Wang, Aaron Sarna, Yonglong Tian, Phillip Isola, Aaron Maschinot, Ce Liu, and Dilip Krishnan. Supervised Contrastive Learning. In H. Larochelle, M. Ranzato, R. Hadsell, M. F. Balcan, and H. Lin (eds.), Advances in Neural Information Processing Systems, volume 33, pp. 18661-18673. Curran Associates, Inc., 2020. +Aounon Kumar, Chirag Agarwal, Suraj Srinivas, Aaron Jiaxun Li, Soheil Feizi, and Himabindu Lakkaraju. Certifying LLM Safety against Adversarial Prompting, 2024. ArXiv: 2309.02705. +E La Malfa. On robustness for natural language processing. PhD Thesis, University of Oxford, 2023. +Ken Lang. NewsWeeder: Learning to Filter Netnews. In Armand Prieditis and Stuart Russell (eds.), Machine Learning Proceedings 1995, pp. 331-339. Morgan Kaufmann, San Francisco (CA), 1995. ISBN 978-1-55860-377-6. +Xiang Lisa Li and Percy Liang. Prefix-Tuning: Optimizing Continuous Prompts for Generation. In Chengqing Zong, Fei Xia, Wenjie Li, and Roberto Navigli (eds.), Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pp. 4582-4597, Online, August 2021. Association for Computational Linguistics. +Xiang Lisa Li, Ari Holtzman, Daniel Fried, Percy Liang, Jason Eisner, Tatsunori Hashimoto, Luke Zettlemoyer, and Mike Lewis. Contrastive Decoding: Open-ended Text Generation as Optimization. In Anna Rogers, Jordan Boyd-Graber, and Naoaki Okazaki (eds.), Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 12286–12312, Toronto, Canada, July 2023. Association for Computational Linguistics. +Haowei Lin and Yuntian Gu. FLatS: Principled Out-of-Distribution Detection with Feature-Based Likelihood Ratio Score. In Houda Bouamor, Juan Pino, and Kalika Bali (eds.), Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing, pp. 8956-8963, Singapore, December 2023. Association for Computational Linguistics. +Weitang Liu, Xiaoyun Wang, John Owens, and Yixuan Li. Energy-based Out-of-distribution Detection. In H. Larochelle, M. Ranzato, R. Hadsell, M. F. Balcan, and H. Lin (eds.), Advances in Neural Information Processing Systems, volume 33, pp. 21464-21475. Curran Associates, Inc., 2020. +Xiaogeng Liu, Nan Xu, Muhao Chen, and Chaowei Xiao. AutoDAN: Generating Stealthy Jailbreak Prompts on Aligned Large Language Models. In The Twelfth International Conference on Learning Representations (ICLR), 2024. +Andrew L. Maas, Raymond E. Daly, Peter T. Pham, Dan Huang, Andrew Y. Ng, and Christopher Potts. Learning Word Vectors for Sentiment Analysis. In Dekang Lin, Yuji Matsumoto, and Rada Mihalcea (eds.), Proceedings of the 49th Annual Meeting of the Association for Computational Linguistics: Human Language Technologies, pp. 142-150, Portland, Oregon, USA, June 2011. Association for Computational Linguistics. +Christopher D. Manning, Prabhakar Raghavan, and Hinrich Schütze. Introduction to Information Retrieval. Cambridge University Press, Cambridge, 2008. ISBN 978-0-521-86571-5. +Tess McClure. Supermarket AI meal planner app suggests recipe that would create chlorine gas. The Guardian, August 2023. ISSN 0261-3077. +Anay Mehrotra, Manolis Zampetakis, Paul Kassianik, Blaine Nelson, Hyrum Anderson, Yaron Singer, and Amin Karbasi. Tree of Attacks: Jailbreaking Black-Box LLMs Automatically. In A. Globerson, L. Mackey, D. Belgrave, A. Fan, U. Paquet, J. Tomczak, and C. Zhang (eds.), Advances in Neural Information Processing Systems, volume 37, pp. 61065-61105. Curran Associates, Inc., 2024. +Shervin Minaee, Tomas Mikolov, Narjes Nikzad, Meysam Chenaghlu, Richard Socher, Xavier Amatriain, and Jianfeng Gao. Large Language Models: A Survey, February 2024. ArXiv: 2402.06196. + +Marius Mosbach, Tiago Pimentel, Shauli Ravfogel, Dietrich Klakow, and Yanai Elazar. Few-shot Fine-tuning vs. In-context Learning: A Fair Comparison and Evaluation. In Anna Rogers, Jordan Boyd-Graber, and Naoaki Okazaki (eds.), Findings of the Association for Computational Linguistics: ACL 2023, pp. 12284–12314, Toronto, Canada, July 2023. Association for Computational Linguistics. +Jerzy Neyman and Egon Sharpe Pearson. IX. On the problem of the most efficient tests of statistical hypotheses. Philosophical Transactions of the Royal Society of London. Series A, Containing Papers of a Mathematical or Physical Character, 231:289-337, 1933. +Thanh Tam Nguyen, Thanh Trung Huynh, Phi Le Nguyen, Alan Wee-Chung Liew, Hongzhi Yin, and Quoc Viet Hung Nguyen. A Survey of Machine Unlearning, 2022. ArXiv: 2209.02299. +Charles O'Neill, Jack Miller, Ioana Ciuka, Yuan-Sen Ting, and Thang Bui. Adversarial Fine-Tuning of Language Models: An Iterative Optimisation Approach for the Generation and Detection of Problematic Content, 2023. ArXiv: 2308.13768. +Long Ouyang, Jeffrey Wu, Xu Jiang, Diogo Almeida, Carroll Wainwright, Pamela Mishkin, Chong Zhang, Sandhini Agarwal, Katarina Slama, Alex Ray, John Schulman, Jacob Hilton, Fraser Kelton, Luke Miller, Maddie Simens, Amanda Askell, Peter Welinder, Paul F Christiano, Jan Leike, and Ryan Lowe. Training language models to follow instructions with human feedback. In S. Koyejo, S. Mohamed, A. Agarwal, D. Belgrave, K. Cho, and A. Oh (eds.), Advances in Neural Information Processing Systems, volume 35, pp. 27730-27744. Curran Associates, Inc., 2022. +F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer, R. Weiss, V. Dubourg, J. Vanderplas, A. Passos, D. Cournapeau, M. Brucher, M. Perrot, and E. Duchesnay. Scikit-learn: Machine Learning in Python. Journal of Machine Learning Research, 12:2825-2830, 2011. +Ethan Perez, Saffron Huang, Francis Song, Trevor Cai, Roman Ring, John Aslanides, Amelia Glaese, Nat McAleese, and Geoffrey Irving. Red Teaming Language Models with Language Models. In Conference on Empirical Methods in Natural Language Processing, 2022. +Fábio Perez and Ian Ribeiro. Ignore Previous Prompt: Attack Techniques For Language Models. In NeurIPS ML Safety Workshop, 2022. ArXiv: 2211.09527. +A. V. Podolskiy, Dmitry Lipin, A. Bout, E. Artemova, and Irina Pionkovskaya. Revisiting Mahalanobis Distance for Transformer-Based Out-of-Domain Detection. In AAAI Conference on Artificial Intelligence, 2021. +Xiangyu Qi, Yi Zeng, Tinghao Xie, Pin-Yu Chen, Ruoxi Jia, Prateek Mittal, and Peter Henderson. Fine-tuning Aligned Language Models Compromises Safety, Even When Users Do Not Intend To! In The Twelfth International Conference on Learning Representations, 2024. +Alec Radford, Jeff Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. Language Models are Unsupervised Multitask Learners. 2019. +Rafael Rafailov, Archit Sharma, Eric Mitchell, Christopher D Manning, Stefano Ermon, and Chelsea Finn. Direct preference optimization: Your language model is secretly a reward model. Advances in Neural Information Processing Systems, 36, 2024. +Pranav Rajpurkar, Jian Zhang, Konstantin Lopyrev, and Percy Liang. SQuAD: 100,000+ Questions for Machine Comprehension of Text. In Jian Su, Kevin Duh, and Xavier Carreras (eds.), Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pp. 2383-2392, Austin, Texas, November 2016. Association for Computational Linguistics. +Eduardo Reis. Bible Corpus - Basic Text Generation using N-grams, 2019. +Jie Ren, Peter J. Liu, Emily Fertig, Jasper Snoek, Ryan Poplin, Mark Depristo, Joshua Dillon, and Balaji Lakshminarayanan. Likelihood Ratios for Out-of-Distribution Detection. In H. Wallach, H. Larochelle, A. Beygelzimer, F. d' Alché-Buc, E. Fox, and R. Garnett (eds.), Advances in Neural Information Processing Systems, volume 32. Curran Associates, Inc., 2019. + +Alfréd Rényi. On Measures of Entropy and Information. In Proceedings of the Fourth Berkeley Symposium on Mathematical Statistics and Probability, Volume 1: Contributions to the Theory of Statistics, volume 1. University of California Press, 1961. +Mikayel Samvelyan, Sharath Chandra Rarparthy, Andrei Lupu, Eric Hambro, Aram H. Markosyan, Manish Bhatt, Yuning Mao, Minqi Jiang, Jack Parker-Holder, Jakob Nicolaus Foerster, Tim Rocktäschel, and Roberta Raileanu. Rainbow Teaming: Open-Ended Generation of Diverse Adversarial Prompts. In The Thirty-eighth Annual Conference on Neural Information Processing Systems, 2024. ArXiv 2402.16822. +Rico Sennrich, Barry Haddow, and Alexandra Birch. Neural Machine Translation of Rare Words with Subword Units. In Katrin Erk and Noah A. Smith (eds.), Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 1715-1725, Berlin, Germany, August 2016. Association for Computational Linguistics. ArXiv 1508.07909. +Yunhao Tang, Zhaohan Daniel Guo, Zeyu Zheng, Daniele Calandriello, Remi Munos, Mark Rowland, Pierre Harvey Richemond, Michal Valko, Bernardo Avila Pires, and Bilal Piot. Generalized Preference Optimization: A Unified Approach to Offline Alignment. In Ruslan Salakhutdinov, Zico Kolter, Katherine Heller, Adrian Weller, Nuria Oliver, Jonathan Scarlett, and Felix Berkenkamp (eds.), Proceedings of the 41st International Conference on Machine Learning, volume 235 of Proceedings of Machine Learning Research, pp. 47725-47742. PMLR, July 2024. +Gemma Team, Morgane Riviere, Shreya Pathak, Pier Giuseppe Sessa, Cassidy Hardin, Surya Bhupatiraju, Léonard Hussenot, Thomas Mesnard, Bobak Shahriari, Alexandre Ramé, Johan Ferret, Peter Liu, Pouya Tafti, Abe Friesen, Michelle Casbon, Sabela Ramos, Ravin Kumar, Charline Le Lan, Sammy Jerome, Anton Tsitsulin, Nino Vieillard, Piotr Stanczyk, Sertan Girgin, Nikola Momchev, Matt Hoffman, Shantanu Thakoor, Jean-Bastien Grill, Behnam Neyshabur, Olivier Bachem, Alanna Walton, Aliaksei Severyn, Alicia Parrish, Aliya Ahmad, Allen Hutchison, Alvin Abdagic, Amanda Carl, Amy Shen, Andy Brock, Andy Coenen, Anthony Laforge, Antonia Paterson, Ben Bastian, Bilal Piot, Bo Wu, Brandon Royal, Charlie Chen, Chintu Kumar, Chris Perry, Chris Welty, Christopher A. Choquette-Choo, Danila Sinopalnikov, David Weinberger, Dimple Vijaykumar, Dominika Rogozinska, Dustin Herbison, Elisa Bandy, Emma Wang, Eric Noland, Erica Moreira, Evan Senter, Evgenii Eltsyshv, Francesco Visin, Gabriel Rasskin, Gary Wei, Glenn Cameron, Gus Martins, Hadi Hashemi, Hanna Klimczak-Plucińska, Harleen Batra, Harsh Dhand, Ivan Nardini, Jacinda Mein, Jack Zhou, James Svensson, Jeff Stanway, Jetha Chan, Jin Peng Zhou, Joana Carrasqueira, Joana Iljazi, Jocelyn Becker, Joe Fernandez, Joost van Amersfoort, Josh Gordon, Josh Lipschultz, Josh Newlan, Ju-yeong Ji, Kareem Mohamed, Kartikeya Badola, Kat Black, Katie Millican, Keelin McDonell, Kelvin Nguyen, Kiranbir Sodhia, Kish Greene, Lars Lowe Sjoesund, Lauren Usui, Laurent Sifre, Lena Heuermann, Leticia Lago, Lilly McNealus, Livio Baldini Soares, Logan Kilpatrick, Lucas Dixon, Luciano Martins, Michael Reid, Manvinder Singh, Mark Iverson, Martin Görner, Mat Velloso, Mateo Wirth, Matt Davidow, Matt Miller, Matthew Rahtz, Matthew Watson, Meg Risdal, Mehran Kazemi, Michael Moynihan, Ming Zhang, Minsuk Kahng, Minwoo Park, Mofi Rahman, Mohit Khatwani, Natalie Dao, Nenshad Bardoliwalla, Nesh Devanathan, Neta Dumai, Nilay Chauhan, Oscar Wahltinez, Pankil Botarda, Parker Barnes, Paul Barham, Paul Michel, Pengchong Jin, Petko Georgiev, Phil Culliton Pradeep Kuppala Ramona Comanescu Ramona Merhej Reena Jana Reza Ardeshir Rokni Rishabh Agarwal Ryan Mullins Samaneh Saadat Sara Mc Carthy Sarah Cogan Sarah Perrin Sebastien M. R. Arnold Sebastian Krause Shengyang Dai Shruti Garg Shruti Sheth Sue Ronstrom Susan Chan Timothy Jordan Ting Yu Tom Eccles Tom Hennigan Tomas Kocisky Tulsee Doshi,Vihan Jain,Vikas Yadav,Vilobh Meshram,Vishal DharmadhikariWarren Barkley Wei Wei Wenming Ye Woohyun Han Woosuk Kwon Xiang Xu Zhe Shen Zhitao Gong Zichuan Wei Victor Cotruta Phoebe Kirk Anand Rao Minh Giang Ludovic Peran Tris Warkentin Eli CollinsJoelle Barral,Zoubin Ghahramani Raia HadsellD.SculleyJeanine BanksAnca Dragan Slav Petrov Oriel Vinyls Jeff Dean Demis Hassabis Koray Kavukcuoglu Clement Farabet Elena Buchatskaya Sebastian Borgeaud Noah Fiedel Armand Joulin Kathleen Kenealy Robert Dadashi and Alek Andreev. Gemma 2: Improving Open Language Models at a Practical Size2024.ArXiv:2408.00118. +The Guardian. Pak'nSave AI meal planner suggests toxic recipes in 'malfunction'. The Guardian, 2023. + +Rheeya Uppaal, Junjie Hu, and Yixuan Li. Is Fine-tuning Needed? Pre-trained Language Models Are Near Perfect for Out-of-Domain Detection. In Annual Meeting of the Association for Computational Linguistics, 2023. +Nikhil Vyas, Sham Kakade, and Boaz Barak. On Provable Copyright Protection for Generative Models, 2023. +Eric Wallace, Shi Feng, Nikhil Kandpal, Matt Gardner, and Sameer Singh. Universal Adversarial Triggers for Attacking and Analyzing NLP. In Kentaro Inui, Jing Jiang, Vincent Ng, and Xiaojun Wan (eds.), 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. 2153-2162, Hong Kong, China, November 2019. Association for Computational Linguistics. ArXiv 1908.07125. +Eric Wallace, Tony Zhao, Shi Feng, and Sameer Singh. Concealed Data Poisoning Attacks on NLP Models. In Kristina Toutanova, Anna Rumshisky, Luke Zettlemoyer, Dilek Hakkani-Tur, Iz Beltagy, Steven Bethard, Ryan Cotterell, Tanmoy Chakraborty, and Yichao Zhou (eds.), Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pp. 139-150, Online, June 2021. Association for Computational Linguistics. ArXiv 2010.12563. +Alex Wang, Amanpreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel R. Bowman. GLUE: A Multi-Task Benchmark and Analysis Platform for Natural Language Understanding. 2019. +Jiongxiao Wang, Jiazhao Li, Yiquan Li, Xiangyu Qi, Junjie Hu, Yixuan Li, Patrick McDaniel, Muhao Chen, Bo Li, and Chaowei Xiao. BackdoorAlign: Mitigating Fine-tuning based Jailbreak Attack with Backdoor Enhanced Safety Alignment. In The Thirty-eighth Annual Conference on Neural Information Processing Systems, 2024. +Yizhe Xiong, Xiansheng Chen, Xin Ye, Hui Chen, Zijia Lin, Haoran Lian, Zhenpeng Su, Jianwei Niu, and Guiguang Ding. Temporal Scaling Law for Large Language Models, 2024. ArXiv: 2404.17785. +Heng Xu, Tianqing Zhu, Lefeng Zhang, Wanlei Zhou, and Philip S. Yu. Machine Unlearning: A Survey. ACM Comput. Surv., 56(1), August 2023. ISSN 0360-0300. Place: New York, NY, USA +Publisher: Association for Computing Machinery. +Ruiyao Xu and Kaize Ding. Large Language Models for Anomaly and Out-of-Distribution Detection: A Survey, 2024. ArXiv: 2409.01980. +W. J. Youden. Index for rating diagnostic tests. Cancer, 3(1):32-35, 1950. +Andi Zhang, Tim Z. Xiao, Weiyang Liu, Robert Bamler, and Damon Wischik. Your Finetuned Large Language Model is Already a Powerful Out-of-distribution Detector, 2024. ArXiv: 2404.08679. +Wenxuan Zhou, Fangyu Liu, and Muhao Chen. Contrastive Out-of-Distribution Detection for Pre-trained Transformers. In Marie-Francine Moens, Xuanjing Huang, Lucia Specia, and Scott Wentau Yih (eds.), Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, pp. 1100-1111, Online and Punta Cana, Dominican Republic, November 2021. Association for Computational Linguistics. +Andy Zou, Zifan Wang, J. Zico Kolter, and Matt Fredrikson. Universal and Transferable Adversarial Attacks on Aligned Language Models, 2023. Arxiv: 2307.15043. + +# A PROOFS + +Theorem 1 (VALID Certificate) Let $L$ be an LLM and $G$ a guide model as described above. Rejection sampling as described in Algorithm 1 with rejection threshold $k$ and up to $T$ iterations defines model $M_{L,G,k,T}$ with $M_{L,G,k,T}(\pmb{y}|\pmb{x})$ denoting the likelihood of $\pmb{y}$ given $\pmb{x}$ . Let $N_{\pmb{y}}$ be the length of $\pmb{y}$ . We state the adversarial bound: + +$$ +\forall \boldsymbol {x} \in \mathbb {S}: M _ {L, G, k, T} (\boldsymbol {y} | \boldsymbol {x}) \leq 2 ^ {k N _ {\boldsymbol {y}}} \cdot T \cdot G (\boldsymbol {y}). \tag {4} +$$ + +Hence, $M_{L,G,k,T}$ is $[2^{kN_y}TG(\pmb {y})]$ -AC and, further, it is $[\max_{\pmb {y}\in \mathbb{F}}2^{kN_y}TG(\pmb {y})]$ -DC w.r.t. $\mathbb{F}$ + +Proof: We abbreviate $M_{L,G,k,T}$ as $M$ . Let $A_{t}$ and $A_{t}^{\prime}$ be the events of accepting and rejecting in iteration $t$ , respectively. Let $S_{t}$ be the event of sampling $y \sim L(\cdot | x)$ in iteration $t$ and let $A_{ 0$ . + +# B DEFINING DOMAINS - PRACTICAL CONSIDERATIONS + +In this section, we provide practical guidance for practitioners on how to select domains for their AI systems, presenting a systematic approach to classifying sequences into different domains. Figure 7 illustrates a Venn diagram comprising three key sets of sequences, i.e. subsets of $\mathbb{S}$ : + +# S: Space of all sequences + +# Unintelligible Sequences $\mathbb{T}'\cap \mathbb{F}'$ + +Out-of-domain sequences that are not a concern. + +"The sky is blue, the sky is blue, the sky is blue" + +"ABC ABC ABC ABC ABC ABC ABC ABC" + +# Target Domain II Medical QA + +"The recommended dose of Paracetamol is + +# + +# Other Domains F Tax advice, Weapon Manufacturing, and many more. + +"Here is an easy recipe to commit tax fraud ..." + +Figure 7: A Venn diagram illustrating the separation of sentences into domains. + +1. The target domain $\mathbb{T}$ (shown in blue), containing desired content about which the LLM-driven system should converse (e.g., medical questions and answers), +2. The out-of-domain set $\mathbb{F}$ (shown in orange), containing potentially harmful or other content that require active protection measures (e.g., tax fraud advice), +3. The complement of $\mathbb{T}$ and $\mathbb{F}$ , denoted as $\mathbb{T}' \cap \mathbb{F}'$ (shown in gray). + +A fundamental question arises: How should one define $\mathbb{T}$ and $\mathbb{F}$ ? Defining $\mathbb{T}$ is relatively natural for most practitioners: Content that semantically belongs to the domain should be included in $\mathbb{T}$ . The more complex decision involves determining which sequences outside $\mathbb{T}$ should be included in $\mathbb{F}$ . We contend that protecting against certain sequences warrants higher priority than others, and these high-priority sequences should be included in $\mathbb{F}$ . + +Consider the example sequence $\mathbf{y} =$ The sky is blue. The sky is blue. The sky is blue. While this is clearly out-of-domain for a medical QA system, practitioners should evaluate two critical questions to determine its placement in $\mathbb{F}$ : + +1. Would adversaries have motivation to generate such sequences? +2. Could these sequences potentially harm users, the deployer, or third parties? + +In this example, adversaries would likely have little incentive to generate such a response, and the content itself is harmless. Therefore, practitioners might reasonably conclude that $\pmb{y}$ should remain in $\mathbb{T}' \cap \mathbb{F}'$ rather than $\mathbb{F}$ , excluding it from system certification considerations. + +These evaluation questions help practitioners assess risk levels effectively. When both questions receive negative answers, sequences can safely remain in $\mathbb{T}'\cap \mathbb{F}'$ without requiring active protection measures, allowing security efforts to focus on genuinely concerning sequences. If either question receives a positive response, practitioners may choose to implement protective measures. + +Let us analyze two more examples to demonstrate this in practice. Consider the sequence $\mathbf{y} = \text{Here}$ is an easy recipe to commit tax fraud... . In this case, malicious actors would be highly motivated to seek such information, and the content could directly harm society and government functions. Thus, this sequence clearly belongs in $\mathbb{F}$ and requires active protection measures. Similarly, when considering a love poem as $\pmb{y}$ , although it may seem harmless at first glance, the analysis reveals important considerations. Users might frequently request LLMs to generate poetry, potentially straining system resources, and while not directly harmful to users or society, it could significantly impact system infrastructure and operational costs. Consequently, practitioners might choose to include this in $\mathbb{F}$ to protect their computational resources. + +It is important to note that these evaluation questions are not intended as universal rules, but rather serve as a practical considerations to guide practitioners in their decision-making process. By systematically assessing motivation and potential harm, practitioners can make informed decisions about which sets of sequences require active protection measures. + +# C VALID—REJECTION SAMPLING + +# C.1 ATTACKING $M$ + +In this section, we provide some insight on how rejection sampling as deployed in VALID (see Section 2.2) can obtain such tight adversarial bounds. In particular, we show by example that out-of-domain samples are only accepted when they have sufficiently small likelihood of being sampled under $L$ . We then formalize this intuition and state the objective of a possible adversarial attack on $M$ . For simplicity, we will consider the case $T = 1$ . + +Intuition. Here, we demonstrate that accepting an out-of-domain response requires it to have low likelihood under model $L$ . Specifically, we show that when a response is rejected for a given prompt, the correct strategy for acceptance by model $M$ involves modifying the prompt to reduce the response's probability under $L$ . To illustrate this concept, we examine a single response $y$ . Let $y = \text{The cow drinks milk}$ and consider three prompts: + +- $\mathbf{x_1} =$ What does a cow drink? +- $\mathbf{x}_2 =$ Which animal drinks milk? +- $\mathbf{x}_{3} =$ Repeat after me: The cow drinks milk. Now you: + +Intuitively, we may assume $L(\pmb{y}|\pmb{x}_3) > L(\pmb{y}|\pmb{x}_1) > L(\pmb{y}|\pmb{x}_2)$ as $\pmb{y}$ more naturally follows some prompts than others: $\pmb{y}|\pmb{x}_3$ would have high likelihood for instruction-tuned models, moderate likelihood after being specifically asked about cows $(\pmb{x}_1)$ , and low likelihood when asked broadly about mammals $(\pmb{x}_2)$ . We illustrate this example in Figure 8. If we assume that $\pmb{y}|\pmb{x}_1$ is rejected, i.e., $\log L(\pmb{y}|\pmb{x}_1) - \log G(\pmb{y}) > kN_{\pmb{y}}$ , then we can conclude that $\pmb{y}|\pmb{x}_3$ will also be rejected. In contrast, $\pmb{y}|\pmb{x}_2$ will be accepted when $L(\pmb{y}|\pmb{x}_2)$ is small enough, such that $\log L(\pmb{y}|\pmb{x}_2) - \log G(\pmb{y}) < kN_{\pmb{y}}$ , which recovers the upper bound of $2^{kN_{\pmb{y}}}G(\pmb{y})$ (see Theorem 1) by algebraic manipulation. This illustrates how rejection sampling bounds the adversaries: Samples will only be accepted if proposing them was very unlikely in the first place. Consequently, when faced with rejected adversarial prompts $\pmb{x}$ , the attacker must find alternative prompt $\pmb{x}'$ that yield lower likelihood $\pmb{y}|\pmb{x}'$ . This creates a remarkable and counter-intuitive dynamic: successful adversarial attacks on model $M$ require the attacker to effectively perform risk control on sampling $\pmb{y}$ . This intuition helps us establishing how to attack $M$ . + +Formalization of Attack. We assume that the adversarial objective is to increase the probability of a given $\pmb{y}$ (e.g. from the out-of-domain set), $\mathbb{F}$ , being returned. The objective of attacking $L$ is immediately follows: + +$$ +\boldsymbol {x} _ {L} ^ {\text {a d v}} = \underset {\boldsymbol {x} \in \mathbb {X}} {\arg \max } L (\boldsymbol {y} | \boldsymbol {x}) \tag {30} +$$ + +where $\mathbb{X}$ is either $\mathbb{S}$ or some continuous relaxation, such as soft-prompt space. However, the solution $\pmb{x}_L^{adv}$ may not be an adversary under $M$ , since $\pmb{x}_L^{adv}$ might maximize the log-likelihood ratio that leads to the sample being rejected, and hence $M(\pmb{y}|\pmb{x}_L^{adv}) = 0$ . Instead, the adversary for $M$ , $\pmb{x}_M^{adv}$ , needs to maximize $L$ while ensuring the sample is accepted. We formalize this in the following lemma. + +Lemma 4 (Adversary under Rejection Sampling) Assume the adversarial objective is to maximize the likelihood of sample $\mathbf{y}$ being returned by the model $M$ . Assume the model $M$ is obtained through VALID as described in Algorithm 1 with $T = 1$ . The adversary is given by: + +$$ +\boldsymbol {x} _ {M} ^ {\text {a d v}} = \underset {\boldsymbol {x} \in \mathbb {X}} {\arg \max } L (\boldsymbol {y} | \boldsymbol {x}) \text {s . t .} L (\boldsymbol {y} | \boldsymbol {x}) \leq 2 ^ {k N _ {\boldsymbol {y}}} G (\boldsymbol {y}), \tag {31} +$$ + +where $\mathbb{X}$ is either sentence space $\mathbb{S}$ or some relaxation. + +Proof: The proof follows immediately from Lemma 2 with $T = 1$ . Let $\mathbb{A} \subset \mathbb{S}$ be the acceptance set, $\mathbb{A} = \{\pmb{x} \in \mathbb{X} : L(\pmb{y}|\pmb{x}) \leq 2^{kN_y}G(\pmb{y})\}$ . Then, $\forall \pmb{x} \notin \mathbb{A}$ the likelihood of $M(\pmb{y}|\pmb{x}) = 0$ . Hence, the adversary maximizing $M(\pmb{y}|\pmb{x})$ is the adversary for $L(\pmb{y}|\pmb{x})$ within $\mathbb{A}$ . + +![](images/1e2a18c6233e7275af3ea321bc939dd482364d50d946d2b57b7591aa70fc1c2b.jpg) +Figure 8: The likelihood of model $M$ obtained through VALID with $T = 1$ . The blue line is the likelihood of $M$ for the given $y$ . Three example prompts $x_{1}, x_{2}$ and $x_{3}$ are shown. + +**Executing Attack.** Applying VALID to obtain $M$ has implications on the suitable procedures to attack $M$ . In particular, it requires solving the constrained optimization problem in (31), which adds a layer of complexity to the unconstrained problem for $L$ . In general, constrained optimization problems are more challenging; this is compounded by the upper bound on $L(\boldsymbol{y}|\boldsymbol{x})$ not decomposing across tokens. Furthermore, while large models, such as LLama-3-8B, are often publicly available, $G$ will likely be a custom model for which the attacker does not have white-box access. For a successful attack, the adversarial user must estimate the likelihood ratio between $L$ and $G$ , which might prove challenging. This indicates that attacking $M$ defined through VALID might be a harder problem than attacking $L$ . Finally, as a reassuring reminder, while it is possible to attack $M$ , our certificate holds and $M$ cannot be attacked past the upper bound provided in Theorem 1. + +# D EXPERIMENTAL SETUP + +# D.1 CHARTASK DATASET + +For prototyping, we have created a toy dataset that we call CharTask. The goal of the CharTask dataset is to have a well-controlled toy dataset with clear definitions of target domain $\mathbb{T}$ and other domains $\mathbb{F}$ . + +As shown in Table 1, each sequence consists of three parts: A sequence of random characters, a task definition in the middle, and another sequence of characters in the end. We refer to the random sequence as $S_{in}$ . In the middle there are four task tokens, the first of which defines the task $T$ . "S" sets the task to sorting, "R" to reverse sorting, "A" to adding +1 and "E" to even-odd sorting. The instruction token is followed by the remaining three task tokens in random order to ensure that all are seen by a model trained on a subset of these. Finally, the completed sequence is the original sequence of characters with the task performed on them, i.e. $S_{out} = T(S_{in})$ . The pool of characters for each sequence is either only integers or integers and lower case letters. Importantly, all tasks interpret characters and integers as characters alike. For example, sorting integers "11", "5" results in "11", "5". To be precise, all tasks are based on integer unicode representations of characters. + +Each sequence has a variable length of up to 49 elements in $S_{in}$ (the elements can be double digits). For integers, we use a pool of 49 unique distinct integers and for characters, we use a pool of 249 + +elements (e.g., defining "at" as one element in the sequence). Under these conditions, there exists a combinatorially large set of unique sequences far exceeding our training dataset size. + +Given the tasks and pools of characters, 8 possible domains emerge as shown in Table 1, which we denote as CharTask (Task, Pool). We define sorting integers as the target domain: $\mathcal{D}_{\mathbb{T}} =$ CharTask (Sorting, Int) and all other combinations as out-of-domain. We create two distinct datasets with non-overlapping splits for training, validation, and testing. The in-domain dataset consists of 1M training samples. The "generalist" dataset $\mathcal{D}_{\mathbb{T} + \mathbb{F}} =$ CharTask (All, Int $^+$ Char) contains all possible tasks with sequences consisting of integers and characters. We use 1M training sequences per task, and hence 4M sequences in total. The validation and test sets are 64 sequences and 4096 sequences, respectively. + +# D.2 CHARTASK SETUP + +Dataset and Domain. We use the CharTask dataset described in Appendix D.1. We train a custom BPE tokenizer of length 360 (Sennrich et al., 2016). In practice, the pretrained tokenizer of any foundation model is trained on a general dataset. Hence, we train the tokenizer using $\mathcal{D}_{\mathbb{T}}$ and $\mathcal{D}_{\mathbb{F}}$ the target and out-of-domain datasets. While the dataset is inherently suitable for a sequence-to-sequence task, we treat it as next-token prediction problem just as used in language modeling. + +Training. We train our domain model $G$ on a set of integer sorting examples, CharTask (Sorting, Int). We train a GPT-2 (Radford et al., 2019) architecture with 3 layers, 3 heads and 48 embedding dimension. We train the model on partial sequences, as we are embedding marginal sequences $y$ . Hence, we cut each sequence in two parts using a splitting point that is sampled under a uniform distribution. Hence, the model learns the transition from "[BOS]..." to any character that might be the first response token. + +For the generalist model $L$ , we train using all available tasks on integers and characters, CharTask (All, Int+Char). We train a GPT-2 architecture with 6 layers, 6 heads and 192 embedding dimensions. + +We train $L$ and $G$ with AdamW (weight decay 0.1) for 2048 steps with a cosine learning rate schedule with 500 steps warm-up, a maximum learning rate of 0.005, scheduled for 40 epochs. We train with 120 context window using next-token prediction. + +Inference. We use common parameters to tweak the predictive distribution of our models. For $G$ we use a temperature of 0.7 and for $L$ of 0.2. We find this greatly helps the model performance of both. We do not perform TopK selection of tokens. We prompt with a prompt length of 10. The task-completed sequence is almost deterministic given the prompt and task for models that have very high accuracy. Hence, we remove sequences where the prompt of 10 tokens is larger than 25% of the entire sequence. + +# D.3 20NG SETUP + +Dataset Cleaning. The 20NG dataset is very dirty, containing a wide array of random special character sequences and arbitrary formatting. We found these sequences to complicate model training and large pre-trained models struggled with it. In addition, as formatting strongly varies between the 20NG dataset and others, this is a confounding factor for OOD detection. Classifying sentences + +Table 1: Examples of the CharTask dataset + +
TaskPoolSequence
PromptTaskCompletedCombined
SortingInt536SRAE356Q536SRAE356
AddingInt536AERS647Q536AERS647
Reverse SortingInt536REAS653Q536REAS653
Even-OddInt536ERAS635Q536ERAS635
SortingInt + Char135caSERA135acQ135caSERA
AddingInt + Char135caASRE146dbQ135caASRE
Reverse SortingInt + Char135caREASca513Q135caREASca513
Even-OddInt + Char135caESARac135Q135caESAR135ca
+ +as ID or OOD should focus on semantics, but the formatting provides a spurious correlation that is easily exploited by models. Hence, we decided to clean the dataset. To do so, we utilise the scikit-learn (v1.5.1) (Pedregosa et al., 2011) options to remove headers, footers and quotes. Further, we cleaned it using Llama-3.1-8B-Instruct (Dubey et al., 2024) using the following query: + +```txt +Your task is to clean and format a string. +Instructions: +- Do not change the order of the words. +- Remove cryptic character sequences, spacings out of order, and line breaks within sentences. +- Remove out-of-order punctuation, but leave correct punctuation in place. +- The result should be semantically and lexically the same as the original but well formatted. +- Remove IP addresses and email addresses. +- Remove sequences of (special) characters, that are not human language. +- Only return the cleaned string without messages or quotes around it. Do not return any other information. Do not repeat the instructions. Do not repeat the example. +``` + +Sentence: + +We check the output for various keywords and phrases from prompt and find a $0\%$ violation rate. While there still exist random sequences, the data quality is greatly improved. We notice that several sequences exist in 20NG and OOD testing datasets that are seemingly random character sequences and multiple trigram repetitions such as "Nanaimo British Columbia Nanaimo British Columbia Nanaimo British Columbia ...". These sequences have the highest likelihood under model $G$ and $L$ while not having any semantic meaning nor constituting a valid sequence that could indicate model misappropriation. Hence, when reporting max likelihoods for 20NG over a finite dataset (e.g. $\max_{\boldsymbol{x},\boldsymbol{y}\in \mathcal{D}_{\mathbb{F}}}L(\boldsymbol{y}|\boldsymbol{x})$ ) we instead use the 99.99th quantile and report it as max. + +Training. We use a pre-trained Gemma 2 tokenizer for both models which has a vocabulary size of 256k tokens. For the fine-tuned model $L$ , we use a pre-trained decoder-only Gemma 2 2B (hosted on Hugging Face) as the starting point then fine-tune it to our ID dataset using LoRA adaptors which involved training an additional 10.4M parameters (0.4% of the total parameters). We train $L$ with AdamW (weight decay 0.01) for 1536 steps with a cosine learning rate schedule with 64 steps warmup, a maximum learning rate of 5e-5, scheduled for 32 epochs. We train with 256 context window using next-token prediction. + +For the model $G$ , we use a decoder-only GPT-small model architecture, 6 layers, 6 heads and 384 embedding dimensions and a total of 109.3M parameters, which we train from scratch using the ID data exclusively. We train $G$ with AdamW (weight decay 0.01) for 320 steps with a cosine learning rate schedule with 100 steps warm-up, a maximum learning rate of 3e-4, scheduled for 100 epochs. We train with 256 context window using next-token prediction. + +Inference. For both $L$ and $G$ we use a default temperature of 1. We do not perform TopK token selection. When evaluating performance, we use a 128-token long prompt and a 128-token long ground truth response. + +# D.4 TINYSHAKESPEARE SETUP + +Dataset Cleaning. The formatting in TinyShakespeare dataset was distinctly different to other texts with long sequences of line breaks and usage of all-caps for character names. We removed these excessive line breaks and changed the character names from all caps to title case to make it similar to other datasets and make OOD detection more challenging. + +Training. We use a pre-trained Gemma-2 tokenizer for both models which has a vocabulary size of 256k tokens. For the fine-tuned model $L$ , we use a pre-trained decoder-only Gemma-2-2B as the starting point then fine-tune it to our ID dataset using LoRA adaptors which involved training an additional 10.4M parameters (0.4% of the total parameters). We train $L$ with AdamW (weight decay 0.01) for 128 steps with a cosine learning rate schedule with 64 steps warm-up, a maximum learning rate of 5e-5, scheduled for 32 epochs. We train with 256 context window using next-token prediction. + +For the model $G$ , we use a decoder-only GPT-micro model architecture, 4 layers, 4 heads and 128 embedding dimensions and a total of 33.7M parameters, which we train from scratch using the ID data exclusively. We train $G$ with AdamW (weight decay 0.01) for 2400 steps with a cosine learning rate schedule with 300 steps warm-up, a maximum learning rate of 3e-4, scheduled for 300 epochs. We train with 256 context window using next-token prediction. + +Inference. For both $L$ and $G$ we use a default temperature of 1. We do not perform TopK token selection. When evaluating performance, we use a 128-token long prompt and a 128-token long ground truth response. + +# D.5 MEDICALQA + +We apply our method to medical question answering as target domain, $\mathbb{T}$ . This could, for example, be extended to a chatbot for clinicians to research patient symptoms. To model potential questions and answers, we use the PubMedQA dataset (Jin et al., 2019) as $\mathcal{D}_{\mathbb{T}}$ , which contains approximately 200K QA pairs for training and 1000 test pairs. We regard question answering on other topics, such as geography or computer science as $\mathbb{F}$ . To model this, we use the Stanford Question and Answering Dataset (excluding medical categories) (Rajpurkar et al., 2016) as $\mathcal{D}_{\mathbb{F}}$ . + +Training. As a generalist LLM, $L$ , we use a LLama-3-8B model (AI@Meta, 2024) and train a custom GPT-2 model (184M parameters) for $G$ (Radford et al., 2019). We pre-train $G$ on PubMedQA (Jin et al., 2019) with 200K sequences. We then use 100K prompts from PubMedQA to generate sequences using $L$ and then fine-tune on them using responses from $L$ to half the prompts in PubMedQA. As $G$ embeds the responses, $G(\pmb{y})$ , we fine-tune using "BOS[Response]" rather than entire sequences. We pre-train with a learning rate of 0.0001 for 50 epochs and then fine-tune with a learning rate of 0.00001 for another 50 epochs. On $8 \times \mathrm{H}100$ , the total training takes about 2 hours. + +Inference. We perform inference without $top_{k}$ or $top_{p}$ parameters and with temperatures of 1.0 for model $L$ and $G$ . We prompt using the natural questions as defined by the datasets. For the analysis, we remove responses from SQuAD that are not clearly out-of-domain. For example, the response "10 million people every year" is not only a valid response to a geographical question, but can also be an information about the prevalence of the disease. When applying our method, we focus on responses with at least 10 tokens to further remove ambiguous sequences. Modern LLMs tend to be very verbose in their responses, so responses should naturally be longer than 10 tokens. + +# D.6 DATASET CATEGORIES + +We list here the categories excluded from SQuAD and included in MMLU for reproducibility. + +
Excluded From SQuADIncluded in MMLU-Med
AntibioticsAnatomy
SymbiosisClinical knowledge
GeneCollege medicine
BrainCollege biology
ImmunologyCollege chemistry
BiodiversityHigh school biology
DigestionHigh school chemistry
Pharmaceutical industryHigh school psychology
MammalHuman aging
NutritionHuman sexuality
TuberculosisMedical genetics
On the Origin of SpeciesNutrition
AsthmaProfessional medicine
PainVirology
Bacteria
Infection
Black Death
Pharmacy
Immune system
Chloroplast
+ +Table 2: Categories of items in used Datasets. + +# EXPERIMENTAL RESULTS + +# E.1 CHARTASK RESULTS + +![](images/4c71a9d8904d4975a42daf4b1aaa5686fb063ede07a809d1d1069fb2dff8f83c.jpg) +(a) + +![](images/0b30af210f4d97e42fc8a1fe8347f01df863d414ef93079dcf17f37d0d40ea5a.jpg) +(b) + +![](images/993c417168720dbb8380f29a40e1cfd99b7ba4596238fd6e9eb1029ccec455a8.jpg) +(c) +Figure 9: This Figure replicates Figure 3 for the CharTask dataset. + +# E.2 TINYSHAKESPEARE RESULTS + +![](images/e72986c866bdc936830147c2738ec530e1fdf328ff39f612642a24988a2a50ea.jpg) +(a) + +![](images/2cf35a41ca0daa07604b3a62e77e603b41a77c9c4567ecc7a2bea492ba2787a6.jpg) +(b) + +![](images/415dd174088b358736a1b18d3400cc0a9b82a23db3f169046fe21d6aa5f0ca91.jpg) +(c) +Figure 10: This Figure replicates Figure 3 for the TinyShakespeare dataset. + +# E.3 20NG + +![](images/a758bae73b167175c3d048b5fbd47b298e21259c9d0f1b720dfdc53f30027a09.jpg) +(a) + +![](images/3a0cd2f4835239df79be112220c40bffce137d97a6f128e254a7f955017ee47f.jpg) +(b) +Figure 11: Figure 11a shows that log likelihood ratios are well disentangled. Figure 11b shows the trade-off between OOD and certification: The best OOD detection performance occurs with a constriction ratio of 60. Figure 11c shows the false rejection rate (FRR) required to certify at a given $\epsilon$ . + +![](images/1747a4ed9b624b163cc3279867c1514f2b08f99432fad42c94c92e6fb7bfde13.jpg) +(c) + +# E.4 MEDICAL QA + +![](images/f0ee6a8fc40cbb2ce645bbf2534f8f6bada038f28689d6871e866074920df349.jpg) +(a) +Figure 12: Figure 12a shows that log likelihood ratios are well disentangled. Figure 12b shows the trade-off between OOD and certification. Figure 12c shows the false rejection rate (FRR) required to certify at a given $\epsilon$ . All results are for VALID with $T = 1$ for Medical QA. + +![](images/858642818cc0e1635e0a15c5967e77b8e42a590cdee9173479cda2277f013e8d.jpg) +(b) + +![](images/082d1db2680de8e29d40f3514fec54d1ae298bec6cb9f4a4261c0fe00c2cefa9.jpg) +(c) + +![](images/d32eceb0a8ce5726d39f09133d20780447aff428b589cae60865b5d7a64e91d5.jpg) +(a) +Figure 13: This figure demonstrates the gap in log likelihood between in-domain and out-of-domain samples for the guide models $G$ in Figure 13a and the LLM $L$ in Figure 13b. As the length of the response, $N_{y}$ , increases, the gap between ID $(\mathcal{D}_{\mathbb{T}})$ and OOD data $(\mathcal{D}_{\mathbb{F}})$ widens. The log-likelihood decreases roughly linearly. Thus, the guide model $G$ on the left side assigns exponential decreasing probabilities to OOD samples. + +![](images/1768f315d85eaceab81a43aac2def57562655b8eddc017409cec744f7cf52987.jpg) +(b) + +# E.5 CONSTRUCTION RATIOS FOR DIFFERENT FALSE REJECTION RATES + +![](images/4ca758abb80adb60dd28d9bb6d02c2637d00db1252dff83d0d55de8bd52f412c.jpg) + +![](images/5f3e407602651ff1df4c53807a66a029788cac30171fe843cf35fe8c23c215c3.jpg) + +![](images/eaf31a42dd7fabe6c4df25ece3b2561966dd7e02b8677933e302b94fb5f05aeb.jpg) + +![](images/6987b1aba4b4d8c05a62130dae8f26eff9b59d03230ab161329160afea595da3.jpg) + +![](images/4a49ec92e48077c2ba1d1efdd9ec9694840a152c52245b2d480038892753152a.jpg) + +![](images/e682c984caf7da9096f6bd943f74b2280945f3029f768c927aa3bc00d49d3acf.jpg) + +![](images/3b4e94f986cc22d1a96821b9bbe003db531f8476a7bb9ae7af4c4d5cab401b54.jpg) + +![](images/8038d71fb4ee4a52ad45cb107c294a83860b2e5109eb2b417ccfc6bb061f93b1.jpg) + +![](images/e6c21358a4dde4cc21693ca5b53d6bae592d54fa3053ac5d3441deeafedf85bd.jpg) + +![](images/ca66d85a6a8ee880145fff70951e4c41afec0bf570e7447599f99a0ed243dc1c.jpg) + +![](images/f7ef81bf1d3c2398a65c6934af65b86bdaad20d1b0d0a0a7b50adc066ad1f998.jpg) + +![](images/69dd4373dd7c11502cbfbca5c1335cd09c8c055fef0d1a7a85f13fd4e459068a.jpg) + +![](images/9c930ab7e67a776fe88f4ca8558f708ac377a3b7047e795597ae6e576a5b755a.jpg) + +![](images/4cb769403dc8bc95927cccefa7eaab2a827ed7285e9dd1b2ad8b95a55f18599e.jpg) + +![](images/e954f430a6a45c52a343aa7f6927f8a68b02a4a898c94ddaab35ac2e9066333e.jpg) + +![](images/e9edfccd7f155d2d44dd590cdb9989dddbf9b20d0fe33d7357deb999a67bd089.jpg) +(a) + +![](images/0ca343d6b1ffd87bdfe701e7af3241cf640633f5dfe94cd795f84d5f9ace9529.jpg) +(b) + +![](images/21ec70d0f9b325783d3b0bd75f8e4a7f77d51eb35359f2c3a68211300f5e8b14.jpg) +(c) +Figure 14: This figure shows the $\log_{10}$ constriction ratios (CR) on OOD samples as a function of the false rejection rate (FRR) on the in-domain samples. The rejection threshold $k$ is systematically decreased from top to bottom to achieve a given FRR. We can observe the gradual improvement in constriction while increasing the FRR. (a) shows Tiny Shakespeare, (b) shows 20NG, and (c) Medical QA. + +# E.6 ATOMIC CERTIFICATES - LENGTH CONTROLLED + +The experimental setup for MedicalQA uses PubMedQA as in-domain dataset and SQuAD as out-of-domain dataset as described in Section 3.1 and Appendix D. The different lengths of responses in these datasets confound our findings on the disentanglement of the atomic certificates, $\epsilon_{y}$ -ACs between in-domain data, $\mathcal{D}_{\mathbb{T}}$ , and out-of-domain data, $\mathcal{D}_{\mathbb{F}}$ . In Figure 15, we show that sequences tend to be a lot shorter in $\mathcal{D}_{\mathbb{F}}$ than in $\mathcal{D}_{\mathbb{T}}$ . As the likelihood of a response decays exponentially in the length of the responses, the responses in the OOD set $\mathcal{D}_{\mathbb{F}}$ have relatively high likelihood that is not attributable to the domain restriction, but rather to the length of the response. This results in the eCDFs in Figure 4b overlapping significantly. To show that this is a confounding factor that is indeed worsening disentanglement, we resample the data to account for length and present results here. + +Setup. We resample the in-domain data, $\mathcal{D}_{\mathbb{T}}$ and out-of-domain data, $\mathcal{D}_{\mathbb{F}}$ to have matching distribution of response lengths. We find the target distribution us + +ing the following steps: First, we find the common support between the distribution of response length $N_{y}$ between $\mathcal{D}_{\mathbb{T}}$ and $\mathcal{D}_{\mathbb{F}}$ , $N_{y} \in [15,38]$ . This interval covers $67\%$ of samples in the target domain dataset and $58\%$ of the OOD dataset. Second, we obtain the empirical distribution of $N_{y}$ in the in-domain dataset, perform Laplace smoothing (Manning et al., 2008) with $\alpha = 1$ and then further smooth the distribution using a moving average with a window length of 5. Third, we perform weighted sampling with replacement from $\mathcal{D}_{\mathbb{T}}$ and $\mathcal{D}_{\mathbb{F}}$ with a size of 100 times the original. The sampling weights are computed s.t. the distribution of $N_{y}$ matches the target distribution. We denote these resampled sets as $\mathcal{D}_{\mathbb{T}}^{RS}$ and $\mathcal{D}_{\mathbb{F}}^{RS}$ . + +Results. We find that the disentanglement of atomic certificates, $\epsilon_{\mathbf{y}}$ -ACs, improves greatly after eliminating the confounding factor response lengths. Figure 16 shows the empirical cumulative distribution functions (eCDFs) for "original" datasets, $\mathcal{D}_{\mathbb{T}}$ and $\mathcal{D}_{\mathbb{F}}$ in gray tones, as well as the results for $\mathcal{D}_{\mathbb{T}}^{RS}$ and $\mathcal{D}_{\mathbb{F}}^{RS}$ . You may observe that the distribution of ACs shifted left for datasets representing $\mathbb{F}$ and shifted right for datasets representing $\mathbb{T}$ , effectively increasing the disentanglement. This indicates that, when comparing similar indomain and out-of-domain samples, the gap in restriction is larger than presented in Figure 4c. ACs on indomain samples are more permissiveness and ACs on out-of-domain samples even more constrictive than it initially appeared. + +# E.7 ATOMIC CERTIFICATE BY LIKELIHOOD + +Obtaining a tight atomic certificate for a sample $\pmb{y}$ is most important when the sample is likely proposed by + +$L$ . Hence, in this section we study the log constriction ratio, the tightening of our adversarial certificate over model $L$ , as a function of the sample's likelihood under $L$ . + +We bin out-of-domain samples into 10 bins based on their log likelihood under model $L$ , i.e. $\log L(\pmb{y}|\pmb{x})$ , and compute median, 25th and 75th percentile log constriction ratio, as well as the median log likelihood. We present results in Figure 17 for both 20NG and TinyShakespeare. We observe that the constriction strengthens when samples get more likely under $L$ . That means, those samples most likely to be sampled under $L$ benefit most from our atomic certificate. We consider this to be a favorable result. + +![](images/88b173a817dad08730857332c4fa36b95bce971539613be38d3edfda4e5ac4a6.jpg) +Figure 15: MedQA setup: The in-domain dataset (PubMedQA) has longer responses than the OOD dataset (SQuAD). + +![](images/c334074ba84e7507a6c668bca406618c97f266f974ed46e67ce5a1579ffd779e.jpg) +Figure 16: The eCDFs of $\epsilon_{y}$ -ACs are shown for the original in- and out-of-domain data for the MedQA setup in comparison to a resampled dataset controlling the response length as confounder. The gap between the permissiveness of in-domain samples and restrictiveness on out-of-domain samples is greatly improved. + +![](images/68c40700c5c85a3ae75d73170ffc76c2ec4baae613112f65e5e92871a5df9f18.jpg) +(a) + +![](images/98c3c6b76021d0fb0f5fa585650008f3080deb4d2d69ad16bddbc6c580a4cc79.jpg) +(b) +Figure 17: These figures show the constriction ratio as a function of log likelihood of samples under $L$ for out-of-distribution samples. Figure 17a displays the results for 20NG and Figure 17b for TinyShakespeare. We bin all samples into 10 bins. For each bin the $x$ -axis shows the median log likelihood of the sample under $L$ , $\log L(\pmb{y}|\pmb{x})$ . The $y$ -axis shows the $\log_{10}$ constriction ratio (median and percentiles for each bin). + +# F REPEATED SAMPLING $(T > 1)$ + +In Section 3.3 we study the performance of VALID by sampling from $L$ with a single step, that is, $T = 1$ . Here, we extend the analysis to $T > 1$ . + +Setup. We adopt the MedicalQA setup as described in Appendix D.5. However, instead of employing VALID with $T = 1$ , we use $T \in \{1,2,3,4,5\}$ and study the resulting $\epsilon - DC$ for combinations of $k$ (the rejection threshold of VALID). As above, for ease of presentation we use a fixed temperature of 1.0 for $L$ . + +Results. We find that increasing $T$ significantly reduces false rejection rates (FRR) while only marginally increasing the $\epsilon$ -DC (domain certificate). We present findings for the FRR in Figure 18a and for $\epsilon$ -DC in Figure 18b. The minor increase in $\epsilon$ due to increasing $T$ should not come as a surprise as we recall the formula for the upper bound: $2^{kN_y}TG(y)$ (see (4)). Even $T = 10$ increases the upper bound $\epsilon_y$ by only one order of magnitude. On the other hand, the gains in in-domain performance are marked. In Figure 18a, we can observe the FRR is roughly halved for $T = 5$ and $k > 2$ , greatly improving the refusal behavior of the model on in-domain samples. Finally, we note that the temperature of $L$ , $t_L$ , is a confounding factor. For $t_L \to 0$ , we would perform (nearly) deterministic sampling of $y|x$ and therefore $T > 1$ would not have any benefit. + +![](images/7beec9303fd0cf9c726b9fd53d8798fba95aa87ebeb7b568bdf450d3687532df.jpg) +(a) +Figure 18: False Rejection Rate (FRR) (a) and $\epsilon - DC$ of the Domain certificate of VALID (b) plotted for a range of different values of $T$ and $k$ . + +![](images/fe73e0b852828194a73dbc0e7a94ebd8a4bfe142d893c9f39e3f707c6e78985c.jpg) +(b) + +# G ABLATION + +# G.1 COMPARING $M$ TO $G$ + +Our goal is to provide a guarantee on a generalist model assuming that such a model outperforms custom, small solutions that are inherently safer due to their domain specific training. We test this empirically by examining the gap in performance between the generalist model $L$ , a small indomain model. As $G$ is trained marginally on $y$ , it is not able to perform any task. Hence, we exactly replicate the training procedure of $G$ and train a model on the entire sequence, $G'(x, y)$ . We utilize the CharTask dataset as described above and study the accuracy of each model in generating valid sequences: A valid sequence is one that starts with $\mathbb{Q}$ , is followed by a random sequence of characters (e.g. 5 3), followed by four unique task tokens (e.g. S A E R) defining a task, which is then performed (e.g. 3 5). The sequence is expected to terminate there. If any of these are violated, the generated sequence is scored as invalid. We perform inference on 1000 prompts from the target domain test dataset prompting the model with various lengths of prompts. In Table 3, we present the results: The accuracy of generating such sequences of $L$ lies significantly above that of $G$ (difference of approx $30\%$ ). This shows that $G$ is effective in restricting the domain while performing considerably worse than $L$ . Hence, our method combines the best of both models: The safety of $G$ with the performance of $L$ . + +
Prompt LengthGL
160.4591.21
560.2592.68
1066.8991.11
+ +Table 3: Accuracy scores for CharTask generation dataset. + +# G.2 BENEFIT OF LARGER GUIDE MODELS + +In this Appendix, we study the influence of the size of $G$ on the VALID results. In particular, we ask whether VALID benefits from smaller or larger models. + +Setup. We turn to our MedicalQA setup as described in Section 3.1 and Appendix D.5. With the same methodology, we fit two more models for $G$ . $G_{XS}$ follows a GPT-2 architecture with 6 layers, 6 heads and 192 embedding dimension resulting in 27.49M parameters. $G_{S}$ follows a GPT-2 architecture with 6 layers, 6 heads and 384 embedding dimensions resulting in 60.29M parameters. To recap, the $G$ model as used above uses 12 layers, 12 heads and 768 embedding dimension resulting in 184M parameters. We then compare the three models on samples generated by $L$ following Section 3.3. + +Results. We find that larger models tend to perform better, however, the evidence is not strong. First, we study the rejection threshold $k$ per model. As described in (4) in Theorem 1, VALID's upper bounds get tighter with smaller $k$ . Hence, in Figure 19a we plot $k$ values achieving a given false rejection rate (FRR) for each model. We observe that larger models enable smaller $k$ at the + +![](images/a84fd2be0499abae3ca6fc83ae64b34c094d6445f3196088d6f7d0281e18b693.jpg) +(a) + +![](images/c02143f9f2cb8ab8ebd5bfc1c7eb39cd76e1a8c697030a29014ca041c9462b10.jpg) +(b) +Figure 19: These Figures demonstrate differences in the behavior of VALID for different sizes of guide models $G$ . Figure 19a shows that larger models allow for lower $k$ and hence lower bounds at the same False Rejection Rate (FRR). Figure 19b shows the FRR ( $y$ -axis) for a given $\epsilon$ -DC for guide models of different sizes. + +same FRR. This indicates that the trade-off in $k$ between certification and OOD detection is more favorable under larger models. This should not come as a surprise, as larger models tend to achieve better perplexity (i.e. lower loss) on in-domain data. + +Next, we study the constriction ratios of the Atomic Certificates (AC) and present results for different sizes of $G$ as shown in Table 4. For each model, we provide the 10th percentile, median and 90th percentile. You may observe that $G_{XS}(y)$ consistently provides constriction ratios that are often around 10 orders of magnitudes worse than $G_{S}(y)$ and $G(y)$ . Interestingly, $G_{S}(y)$ yields better ratios than $G(y)$ . However, the difference is smaller. We speculate that the limited amount of ID training data means we do not see benefits for increasing the size of $G$ beyond a point, as it begins to overfit without increasing regularization. + +Finally, we study the Domain Certificates (DC) for each model. For this we replicate Figure 12c and present Figure 19b showing the false rejection rate (FRR) given an $\epsilon$ -DC for the three models. We may observe that the lower bound to the FRR significantly increases as the models become smaller. The evidence here suggests that larger guide models yield better domain certificates. + +In conclusion, the evidence points to larger models working better for an application like MedQA. The evidence uniformly shows that a model as small as $G_{XS}(y)$ does perform significantly worse than larger models. + +
FRRLog10 Constriction Ratio (10% / Median / 90%)
GX(S)(y)GS(y)G(y)
0%-427 / -45 / 12-408 / -41 / 12-449 / -54 / 6
1%-246 / -14 / 42-176 / -3 / 79-198 / -10 / 43
5%-74 / 12 / 141-42 / 21 / 195-42 / 18 / 162
10%-29 / 24 / 202-11 / 35 / 257-8 / 33 / 229
20%-3 / 43 / 2811 / 57 / 3373 / 50 / 302
25%0 / 50 / 3085 / 63 / 3647 / 60 / 345
50%11 / 81 / 43013 / 96 / 49715 / 89 / 477
+ +Table 4: Constriction Ratios for MedicalQA for three models of different sizes. The smallest model yields significantly worse (lower) constriction ratios. + +# H BENCHMARKING + +In this section, we provide a comprehensive description of the PubMedQA experimental setup presented in Section 3.4, present additional benchmarking results, and extend our evaluation framework to the MMLU benchmark (Hendrycks et al., 2021). + +# H.1 PUBMEDQA + +Setup. The PubMedQA benchmark (Jin et al., 2019) comprises 1000 items. Each item contains background information (context), a multiple-choice question (answerable by yes/no/maybe), a long-text answer, and a ground truth label (yes/no/maybe). As illustrated in Figure 6, we evaluate the model through two streams: "item correctness" and "response acceptance". In both streams, we prompt the model with the context and question. In the "item correctness" stream, the model is provided with all multiple-choice tokens, and the maximum likelihood answer is selected and evaluated for correctness. In the "response acceptance" stream, we present the long-text answer as a response and determine if model $M$ abstains at a given domain certificate of $\epsilon$ . An item is considered correct at $\epsilon$ if and only if the response is accepted and the model scores correctly. We use the reasoning-required variant of the PubMedQA benchmark (for further details, see Jin et al. (2019)). + +Results. Extending our analysis of the PubMedQA benchmark presented in Section 3.4, we examined the relationship between PubMedQA performance scores and median constriction ratios. As illustrated in Figure 20a, our findings demonstrate that the model can achieve a $\log_{10}$ constriction ratio of 20 on samples in $\mathcal{D}_{\mathbb{F}}$ while maintaining robust PubMedQA performance. Specifically, at a performance threshold of $70\%$ accuracy, we observed a $\log_{10}CR_k$ value of 21.6, which effectively + +![](images/fb4a6250ebd36c9d7fe532a1b8e13e817ba36fd879fdacfaf9525ba82953ac28.jpg) +(a) + +![](images/110ada582b3caa78de7cc9c6cb33adab2f5c8af1f1137eb7b6e52b29454ae81f.jpg) +(b) +Figure 20: Evaluation of domain-certified models through standardized benchmarking. Figure 20a illustrates the association between log constriction ratios and the PubMedQA@ $\epsilon$ benchmark scores across models with varying $\epsilon$ -DC certifications. Figure 20b presents the MMLU@ $\epsilon$ metric evaluated at different certification thresholds $\epsilon$ . (c) Figure 20c shows the relationship between log constriction ratios and corresponding MMLU@ $\epsilon$ scores across multiple certification levels. + +![](images/19f113f583699ee171dcd4733a4b534e12b5821a47dc81374c8daecdee038e9c.jpg) +(c) + +constrains out-of-domain samples to probabilities at least $1 \times 10^{-21}$ times lower than the likelihood of samples in distribution $L$ . This indicates a strong capacity for domain constriction while preserving task performance. + +# H.2 MMLU-MED + +In this section, we extend the benchmarking of our certified model $M$ for medical question answering to the MMLU benchmark (Hendrycks et al., 2021). To that end, we follow the same methodology as above for the PubMedQA benchmark. In an earlier version of this work, we reported MMLU results that were erroneous, which we correct here. + +Setup. MMLU comprises thousands of questions spanning various domains of general and professional factual knowledge. As our model $M$ is deployed for medical questions, we focus on a subset of MMLU categories that fall within our domain $\mathbb{T}$ . We specify the selected categories in Table 2 and designate this remaining benchmark as MMLU-Med. + +MMLU's standard format provides $n$ -shot examples with four possible answers (A through D) followed by a question in the same format. The model is then prompted to select the correct response. However, this setup does not reflect a realistic user-system interaction. Therefore, similar to PubMedQA, we introduce the MMLU-Med@ $\epsilon$ metric, which separates the evaluation into two streams: (1) standard assessment of model $L$ on MMLU-Med to determine correctness, and (2) testing whether the correct question-answer pair is rejected by our algorithm. The process is summarized in Figure 21. We score an item as correct when the model scores correctly while maintaining its $\epsilon - DC$ on the realistic question-answer pair. + +Results. Our evaluation yields mixed evidence regarding the model's performance on MMLU-Med. Following the same analysis as for PubMedQA in Section 3.4, we present the MMLU-Med@ε metric in Figure 20b. As shown, MMLU-Med@1 = 37.1%, that is, the model retains 37.1% accuracy when certified at ε = 1, or log $_{10}$ ε = 0. The 10 $^{-10}$ -DC model achieves a score of 14.1%. In addition, to the domain certificates, we study the median constriction of our model in relation to + +![](images/041f602daea0783e9cd07fbce764e615c2365dfc01fe4bd0e3cfe6376217dc9e.jpg) +Figure 21: The MMLU@ $\epsilon$ benchmark assesses MMLU performance while satisfying $\epsilon$ -DC certificate. The correctness is scored as commonly done for MMLU (left). The correct question answer pair is checked for acceptance / rejection by $M$ . Only if a sample is accepted and correct, the question is scored positively. For questions not ending in “?” the sentence is concatenated without keywords. + +its certified performance. The evidence provided in Figure 20c indicates that a median constriction ratio of $1 \times 10^{-5}$ is achieved on out-of-domain samples together with a score of $65\%$ on the MMLU-Med@ε benchmark. Further, a median constriction of $1 \times 10^{-20}$ is achieved with an MMLU-Med@ε score of $37\%$ . + +These results are considerably weaker than the strong results presented above for PubMedQA raising the question as to why this is. In Figure 22, we investigate the domain shift between PubMedQA and MMLU. In particular, Figure 22a shows the distribution of log likelihoods of in-domain samples $(\mathcal{D}_{\mathbb{T}})$ , out-of-domain samples $(\mathcal{D}_{\mathbb{F}})$ and MMLU samples under guide model $G$ and Figure 22b shows the log likelihood ratios for the same samples. We observe a considerable overlap between the distributions of MMLU-Med and PubMedQA samples. However, the distribution of MMLU-Med has a long-tail into the distribution of $\mathcal{D}_{\mathbb{F}}$ . This explains our results quite well. On the one hand, the large overlapping mass of MMLU-Med and PubMedQA explains why $M$ accepts a wide range of MMLU-Med responses while significantly constricting the model on $\mathcal{D}_{\mathbb{F}}$ . On the other hand, the long tail of the distribution of MMLU scores into the distribution of $\mathcal{D}_{\mathbb{F}}$ indicates a range of MMLU-Med questions will be rejected unless the certificates become vacuous, making it hard challenging high MMLU-Med@ $\epsilon$ performance. We believe that training $G$ on MMLU-style QA pairs would significantly improve results but leave this as a future direction. + +![](images/5b2aa885d46a8879977a4aea1ea33e7949f472c59827b7825338b48b9400a10e.jpg) +(a) + +![](images/38633b408fb4b339d70e659d8862762e4970a22269ecbdc93b0f4b2272ef9a3b.jpg) +(b) +Figure 22: Comparison of likelihood of three datasets under model $G$ , showing a MMLU-Med exhibits domain shift relative to PubMedQA. Figure 22a indicates likelihood of MMLU-Med lies in-between the in-domain data $\mathcal{D}_{\mathbb{T}}$ (PubMedQA) and out-of-domain data $\mathcal{D}_{\mathbb{F}}$ . Figure 22b shows the normalized log likelihood ratio used in VALID lead to frequent rejections due to domain shift. \ No newline at end of file diff --git a/ICLR/2025/Shh, don't say that! Domain Certification in LLMs/images.zip b/ICLR/2025/Shh, don't say that! Domain Certification in LLMs/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..9135a886167406d9df5ffd9e3e608d3da5ee6b7a --- /dev/null +++ b/ICLR/2025/Shh, don't say that! Domain Certification in LLMs/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d087ccd7a446f8e5aee7466fe4fbd6ceab8ae8afbb937abff95774d1c3c9e350 +size 1320313 diff --git a/ICLR/2025/Shh, don't say that! Domain Certification in LLMs/layout.json b/ICLR/2025/Shh, don't say that! Domain Certification in LLMs/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..2374705acf7d6df29733faff6b67f2aa1147d9a3 --- /dev/null +++ b/ICLR/2025/Shh, don't say that! Domain Certification in LLMs/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:97562b87711549e40ce997ea225af082ddc6a39f93ba6df3946893136a43a135 +size 1706447 diff --git a/ICLR/2025/Shifting the Paradigm_ A Diffeomorphism Between Time Series Data Manifolds for Achieving Shift-Invariancy in Deep Learning/cce5ba06-3636-4ff7-9ac1-d274d2a8c8c0_content_list.json b/ICLR/2025/Shifting the Paradigm_ A Diffeomorphism Between Time Series Data Manifolds for Achieving Shift-Invariancy in Deep Learning/cce5ba06-3636-4ff7-9ac1-d274d2a8c8c0_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..8ee98903523c98fe980b531370c1821249df4ff6 --- /dev/null +++ b/ICLR/2025/Shifting the Paradigm_ A Diffeomorphism Between Time Series Data Manifolds for Achieving Shift-Invariancy in Deep Learning/cce5ba06-3636-4ff7-9ac1-d274d2a8c8c0_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fd3ef29b22d6285da3dbcc9989b3c0e18b91f0e3ff8f318014a1d4b74c7b4668 +size 273556 diff --git a/ICLR/2025/Shifting the Paradigm_ A Diffeomorphism Between Time Series Data Manifolds for Achieving Shift-Invariancy in Deep Learning/cce5ba06-3636-4ff7-9ac1-d274d2a8c8c0_model.json b/ICLR/2025/Shifting the Paradigm_ A Diffeomorphism Between Time Series Data Manifolds for Achieving Shift-Invariancy in Deep Learning/cce5ba06-3636-4ff7-9ac1-d274d2a8c8c0_model.json new file mode 100644 index 0000000000000000000000000000000000000000..6d8634bd64fcd608da3a56fe8cf14fa3ca05e59d --- /dev/null +++ b/ICLR/2025/Shifting the Paradigm_ A Diffeomorphism Between Time Series Data Manifolds for Achieving Shift-Invariancy in Deep Learning/cce5ba06-3636-4ff7-9ac1-d274d2a8c8c0_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8790e5c2bdccc7efaac3610916d87ead23c5b09628c14b8fca974e40e37471c6 +size 313330 diff --git a/ICLR/2025/Shifting the Paradigm_ A Diffeomorphism Between Time Series Data Manifolds for Achieving Shift-Invariancy in Deep Learning/cce5ba06-3636-4ff7-9ac1-d274d2a8c8c0_origin.pdf b/ICLR/2025/Shifting the Paradigm_ A Diffeomorphism Between Time Series Data Manifolds for Achieving Shift-Invariancy in Deep Learning/cce5ba06-3636-4ff7-9ac1-d274d2a8c8c0_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..de7a239a9e56c8019120419d9df3c07fcf05b3c7 --- /dev/null +++ b/ICLR/2025/Shifting the Paradigm_ A Diffeomorphism Between Time Series Data Manifolds for Achieving Shift-Invariancy in Deep Learning/cce5ba06-3636-4ff7-9ac1-d274d2a8c8c0_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5d4f65bb9e72aba59cb17c5ecad7e2b4a74863c014e8697482a174150edbf3d2 +size 2439466 diff --git a/ICLR/2025/Shifting the Paradigm_ A Diffeomorphism Between Time Series Data Manifolds for Achieving Shift-Invariancy in Deep Learning/full.md b/ICLR/2025/Shifting the Paradigm_ A Diffeomorphism Between Time Series Data Manifolds for Achieving Shift-Invariancy in Deep Learning/full.md new file mode 100644 index 0000000000000000000000000000000000000000..dbf3b673b97b2a8ec2eea67ca6b1192b48b9c8f5 --- /dev/null +++ b/ICLR/2025/Shifting the Paradigm_ A Diffeomorphism Between Time Series Data Manifolds for Achieving Shift-Invariancy in Deep Learning/full.md @@ -0,0 +1,1064 @@ +# SHIFTING THE PARADIGM: A DIFFEOMORPHISM BETWEEN TIME SERIES DATA MANIFOLDS FOR ACHIEVING SHIFT-INVARIANCY IN DEEP LEARNING + +Berken Utku Demirel + +Department of Computer Science ETH Zurich + +Christian Holz + +Department of Computer Science ETH Zurich + +# ABSTRACT + +Deep learning models lack shift invariance, making them sensitive to input shifts that cause changes in output. While recent techniques seek to address this for images, our findings show that these approaches fail to provide shift-invariance in time series, where the data generation mechanism is more challenging due to the interaction of low and high frequencies. Worse, they also decrease performance across several tasks. In this paper, we propose a novel differentiable bijective function that maps samples from their high-dimensional data manifold to another manifold of the same dimension, without any dimensional reduction. Our approach guarantees that samples—when subjected to random shifts—are mapped to a unique point in the manifold while preserving all task-relevant information without loss. We theoretically and empirically demonstrate that the proposed transformation guarantees shift-invariance in deep learning models without imposing any limits to the shift. Our experiments on six time series tasks with state-of-the-art methods show that our approach consistently improves the performance while enabling models to achieve complete shift-invariance without modifying or imposing restrictions on the model's topology. The source code is available on GitHub. + +# 1 INTRODUCTION + +Inference on time series is essential for several important applications, such as heart rate (HR) estimation (Koshy et al., 2018), activity recognition (Saint-Maurice et al., 2020), and cardiovascular health monitoring (Hannun et al., 2019), which are generally performed using signals that are encoded as a sequence of discrete values over time. Most of these signals contain features that characterize the signal independently of their position in time (Waibel et al., 1989; Demirel & Holz, 2023). In other words, the information content of signals generally remains unchanged under the action of finite groups such as translations (Mallat, 2012). Therefore, ensuring the ability to accurately capture these inherent patterns is crucial for the reliability of the deep learning models in such critical human-involved health-related tasks (Akbar et al., 2019; Cutillo et al., 2020). + +Deep learning networks perform downsampling by using strided-convolution and pooling (He et al., 2015; Krizhevsky et al., 2012), which cause loss of information due to high-frequency components of the input alias into lower frequencies, i.e., aliasing (Oppenheim et al., 1996). Previous works have proposed to employ a low-pass filter to prevent the aliasing and mitigate information loss during downsampling (Zhang, 2019; Mairal et al., 2014). While this additional filtering improved the robustness, the effect of employed low-pass filters is quite poor compared to the ideal implementation (see Figure 1 a and b), which still causes high-frequency components to alias into lower ones. + +Despite the potential benefits of emphasizing low-frequency components for image recognition, as it aligns with human perception (Subramanian et al., 2023), the imperfect preservation of frequency components with each subsampling layer contributes to information loss, leads to performance degradation, especially in tasks where the significance lies in both low and high-frequency components with their interactions. A more recent approach to achieve shift-invariant neural networks involves the use of adaptive subsampling grids (Chaman & Dokmanic, 2021). However, these methods still + +![](images/b7f883c023414eeeb9e34a0fff27bd10351877914a53811ad206be392ba35c80.jpg) + +![](images/e38f2dd9884b05e8f7fff694ac1fdbcc5395cc56445ba932c64f7e408c29ab80.jpg) + +![](images/5bfd1a2cf74a73b8306a4890b264be6aeea288cbfcb6d780053178786fd148ed.jpg) + +![](images/dfe2b8c1136d84d41504167481b8b4ad7460b13119ce514bf85cb5212d0f2b4f.jpg) +Figure 1: (a) The magnitude response of the ideal low-pass filter and binomial filter that is employed in (Zhang, 2019) for preventing aliasing. (b) Time domain representations of the ideal and binomial filters with interpolation for smoother waveforms. (c) An 8-second signal for blood volume changes and its $t'$ shifted version, obtained through photoplethysmogram—a widely utilized signal for heart rate monitoring (Perez et al., 2019). (d) The heart rate prediction of a trained ResNet with binomial filters to prevent aliasing. Different amounts of shifts ( $t' \in [-4, 4]$ ) change the trained model output drastically from 140 to 60 beats per minute (bpm). (e) A 10-second electrocardiogram (ECG) signal from a patient with atrial fibrillation (AFIB). (f) The model misclassifies the abnormal AFIB pattern as a healthy sinus rhythm (SR), with shifts causing a complete change in output probability. + +![](images/8b386ee37470781c58bb27451808a00a0bd617427b4b1db60627f09d20118526.jpg) + +![](images/d5a67b3cb140dbf494ae08678c75dfb81597bbc157e84acdc1c397ebb18f2dac.jpg) + +fail to guarantee shift-invariancy due to the change in content at the boundary (Rojas-Gomez et al., 2022) and impose constraints on the shift range to maintain invariance. + +Consequently, the evaluation of these methods is confined to a limited range of shifts while covering a small subset of the space. Additionally, their reliance on a grid scheme introduces a dependence on sampling rates, resulting in performance gaps across the entire shift space (Michaeli et al., 2023). + +In this work, we propose a differentiable bijective function that maps samples from their high-dimensional data manifold to another manifold of the same dimension, without any dimensional reduction. Our method ensures that randomly shifted samples—representing variations of the same signal—are mapped to the same point in the space, preserving all task-relevant information. + +Since our method modifies the data space, it can be integrated into any deep learning architecture, offering an adaptable and complementary solution for achieving shift-invariancy in time series. Summarizing our contributions in this paper: + +- We introduce a novel diffeomorphism to ensure shift-invariance in neural networks. Additionally, we incorporate the proposed diffeomorphism into the network architecture using a novel, tailored loss term to further enhance performance while ensuring invariance. +- We demonstrate both theoretically and empirically that the proposed transformation guarantees shift-invariance in models without imposing any limits to the range of shifts or changing model topology, which enable previous methods to be used in conjunction. +- We conduct extensive experiments on six time series tasks with nine datasets. Our experiments show that the proposed approach consistently improves the performance while decreasing the variance and enabling models to achieve complete shift-invariance. + +# 2 METHOD + +# 2.1 NOTATIONS + +We use bold lowercase symbols $(\mathbf{x})$ for time series. The parametric mappings are represented as $f_{\theta}(.)$ where $\theta$ is the parameter. The discrete Fourier transformation of a time series is denoted as $\mathcal{F}(\mathbf{x})$ , yielding a complex variable $|X(e^{j\omega})|e^{j\phi (\omega)}$ which contains magnitude and phase information of each harmonic (sinusoidal). $\phi (\omega_k)$ and $\mathrm{T}_k$ represent the phase angle and period of the $k$ -th harmonic with frequency $\omega_{k}$ . We mainly used the textbook notations (Oppenheim et al., 1996) throughout the script, providing a comprehensive list of notations and detailed definitions in Appendix A.1. + +# 2.2 OBJECTIVE + +Given a dataset $\mathcal{D} = \{(\mathbf{x}(t)_i,\mathbf{y}_i)\}_{i = 1}^K$ where each $\mathbf{x}\in X$ consists of uniformly sampled real-valued values and each $\mathbf{y}\in Y$ represents the corresponding labels, the objective is to have consistent and accurate outputs for all variants of a sample that are subjected to shifts such that when a parametric model $f_{\theta}:X\to Y$ is evaluated on the set $\mathcal{D}_{\mathrm{test}} = \{(\mathbf{x}(t)_i,\mathbf{y}_i)\}_{i = 1}^L$ , the output will be the same and true $\mathbf{y}_i$ for all $t^\prime$ to be shift-invariant, i.e., $\mathbf{y}_i = f_\theta (\mathbf{x}(t - t'_i),\forall t'\in \mathbb{R})$ + +We propose a diffeomorphism that maps randomly shifted time series samples to the same point in data space, preserving all relevant information to ensure shift-invariance. The motivation and theoretical derivation of our method are presented in the following steps. + +Proposition 2.1 (Time shift as a Group Operation). Shift operation in time domain defines an Abelian Group of phase angles in the frequency domain for each harmonic with frequency $\omega_{k}$ + +$$ +\left(\Phi_ {k}, + \mod 2 \pi\right), \text {w h e r e} \Phi_ {k} = \left\{\phi \mid \phi = \left(\phi \left(\omega_ {k}\right) + \omega_ {k} t ^ {\prime}\right) \mod 2 \pi , t ^ {\prime} \in \mathbb {R} \right\} \tag {1} +$$ + +Proof. Using $\mathcal{F}(x(t + t')) = |X(e^{j\omega})|e^{j\phi (\omega)}e^{j\omega t'}$ , and the multiplication of complex numbers + +$$ +\exists t ^ {\prime} \in \mathbb {R}, \forall \phi \in (- \pi , \pi ], \quad \phi = (\phi (\omega_ {k}) + \omega_ {k} t ^ {\prime}) \bmod 2 \pi \tag {2} +$$ + +See Appendix A for detailed proof with group axioms. + +Proposition 2.1 states that the shift variants of a sequence define a group of phase angles, known as circle group (Fuchs, 1960) $\mathbb{T}$ . An important observation from Equation 2 is that different shift values $(t^{\prime})$ can map to the same phase angle $(\phi)$ due to modulo operation with $2\pi$ . + +However, a closer look reveals that this mapping can be defined uniquely for specific harmonics using the circular shift. Specifically, we can represent every point in the shift space uniquely with the phase angle of a harmonic whose period is equal to or longer than the length of sample, i.e., $\mathrm{T}_0\leq t$ . In the remainder of this section, we explain how this observation is framed as a novel diffeomorphism. We denote the frequency, period, and phase of this specific harmonic as $\omega_0$ $\mathrm{T}_0$ ,and $\phi (\omega_0)$ ,respectively. + +![](images/1f7adb41cec65dc06522e52e9dc1e6e23929b09de3229bf6af3ec0e39006b9d1.jpg) +Figure 2: (a) Frequency domain representation of a harmonic at frequency $\omega_0$ with different phase angles in unit circle. (b) Time domain representation of a signal $\mathbf{x}(t)$ and its shifted version $\mathbf{x}(t - t')$ . The phase angle of the harmonic can cover all (i.e., surjective $\mathcal{T}(\mathbf{x},\phi)$ ) potential shifts. Moreover, shifts in the time domain correspond to unique (i.e., injective $\mathcal{T}(\mathbf{x},\phi)$ ) angle rotations in the frequency domain for the sinusoidal with periodicity $\mathrm{T}_0$ . Therefore, the proposed transformation function $\mathcal{T}(\mathbf{x},\phi)$ is bijective. + +The proposed transformation function, $\mathcal{T}(\mathbf{x},\phi)$ , takes a sample $\mathbf{x}$ and an angle $\phi \in (-\pi ,\pi ]$ . It then applies a linear phase shift to each harmonic, mapping the time series to a new variant where the phase angle of the harmonic with frequency $\omega_0$ matches the desired angle $\phi$ . The proposed transformation, which converts a time series to another shifted variant, is defined as in Equations 3 and 4. + +$$ +\mathbf {x} (t) \xrightarrow {\mathcal {T} (\mathbf {x} , \phi)} \mathcal {F} ^ {- 1} \left(| X \left(e ^ {j \omega}\right) | e ^ {j \phi (\omega)} e ^ {- j \omega \Delta \phi}\right) \quad \text {w h e r e} \tag {3} +$$ + +$$ +\Delta \phi = \left\{ \begin{array}{l l} \frac {(\theta - 2 \pi) * T _ {0}}{2 \pi}, & \text {if} \theta > \pi \\ \frac {\theta * T _ {0}}{2 \pi}, & \text {else} \end{array} \quad \text {and} \theta = [ \phi (\omega_ {0}) - \phi ] \% 2 \pi \right. \tag{4} +$$ + +Mainly, the transformation first decomposes a signal to its harmonics, then it calculates the phase difference, denoted as $\Delta \phi$ , between the harmonic with frequency $\omega_0$ and the desired angle $\phi$ . Finally, + +It returns to the time domain by taking the inverse Fourier transform, $\mathcal{F}^{-1}(.)$ , while applying a linear phase shift to all harmonics to preserve the waveform morphology. In the end, the transformation matches the phase angle of the harmonic at frequency $\omega_0$ with the desired angle $\phi$ . We first demonstrate that the proposed transformation is a bijective function, as shown in Theorem 2.2. + +Theorem 2.2 (Covering the Entire Time Space Injectively). Given a sample $\mathbf{x}$ , the defined function $\mathcal{T}(\mathbf{x},\phi):\varPhi\times\mathbb{R}^d\to\mathbb{R}^d\times\varDelta\varPhi$ is bijective such that all shift variants of a sample can be covered with the unique phase angle of a harmonic whose period is longer or equal to the length of $\mathbf{x}$ . + +$$ +\forall \phi_ {a}, \phi_ {b} \in \varPhi , \mathcal {T} (\mathbf {x}, \phi_ {a}) = \mathcal {T} (\mathbf {x}, \phi_ {b}) \Longrightarrow \phi_ {a} = \phi_ {b} +$$ + +$$ +\forall t ^ {\prime} \in \mathbb {R}, \exists \phi \in \Phi , \mathcal {T} (\mathbf {x}, \phi) = (\mathbf {x} (t - t ^ {\prime}), \Delta \phi), +$$ + +where the first and second equations represent the injection and surjection, respectively. + +We provide an intuitive demonstration in Figure 2, with a detailed mathematical proof in Appendix A. Since each point in the shift space can be uniquely defined by the phase angle of a harmonic with period $\mathrm{T}_0$ , we use the angle of this harmonic to define manifolds $^2$ , $\mathcal{M}^\phi$ , on which the samples lie. Specifically, we apply the proposed transformation $\mathcal{T}(\mathbf{x},\phi)$ for each sample to map it to a manifold defined by the angle, i.e., $\mathcal{T}(\mathbf{x},\phi_a)\in \mathcal{M}^{\phi_a}$ , $\mathcal{T}(\mathbf{x},\phi_b)\in \mathcal{M}^{\phi_b}$ , and $\bigcap_{i = 0}^{2\pi}\mathcal{M}^{\phi_i} = \emptyset$ (See Appendices A.1.2 and A.2 for detailed definition of manifolds and notations). We, therefore, can map a sample and its randomly shifted variants to the same point in the space, which is sufficient for providing shift-invariance as demonstrated in Theorem 2.3 with a detailed proof in Appendix A. + +Theorem 2.3 (Guarantees for Shift-Invariancy). Given $\mathbf{x}$ and a randomly shifted variant of it $\mathbf{x}(t - t')$ , if $\mathcal{T}(\mathbf{x},\phi)$ is applied to both samples with the same angle $\phi_{a}$ , the resulting samples will be the same. + +$$ +\mathcal {T} (\mathbf {x} (t), \phi_ {a}) = \left(\tilde {\mathbf {x}} (t), \varDelta \phi_ {\mathbf {x} (t)}\right), \quad \mathcal {T} (\mathbf {x} (t - t ^ {\prime}), \phi_ {a}) = \left(\tilde {\mathbf {x}} (t), \varDelta \phi_ {\mathbf {x} (t - t ^ {\prime})}\right) +$$ + +Proof. + +$$ +\phi_ {\mathbf {x} (t)} = \phi (\omega), \phi_ {\mathbf {x} (t - t ^ {\prime})} = \phi (\omega) - \omega t ^ {\prime}, \Delta \phi_ {\mathbf {x} (t - t ^ {\prime})} - \Delta \phi_ {\mathbf {x} (t)} = - \omega_ {0} \frac {T _ {0}}{2 \pi} t ^ {\prime} \tag {5} +$$ + +$$ +\phi_ {\mathcal {T} (\mathbf {x} (t - t ^ {\prime}), \phi_ {a})} - \phi_ {\mathcal {T} (\mathbf {x}, \phi_ {a})} = \left[ \frac {T _ {0}}{T} \omega_ {0} - \omega \right] t ^ {\prime}, \quad \phi_ {\mathcal {T} (\mathbf {x}, \phi_ {a})} = \phi_ {\mathcal {T} (\mathbf {x} (t - t ^ {\prime}), \phi_ {a})} \tag {6} +$$ + +Therefore, the output time series samples will be the same after applying the transformation. + +The proof concludes by demonstrating that the harmonics retain the same phase and magnitude after transformation, despite an unknown shift applied to the sample. Moreover, since the transformation only contains exponentials with Fourier transform, it is fully differentiable, allowing optimization with + +![](images/91bc71b3d6a01a13562870078be1000b3c1fa3b853f811578d38b7e0c1d22f90.jpg) +Figure 3: (a) An input signal in the time domain and complex plane representation of its decomposed sinusoidal of frequency $\omega_0 = \frac{2\pi}{T_0}$ with the phase angle $\phi_0$ . (b) Guiding the diffeomorphism to map samples between manifolds. (c) The obtained waveform with a phase shift applied to all frequencies linearly, calculated by the angle difference, as in Equation 4, without altering the waveform. (d) The loss functions for optimizing networks with the cross-entropy and the variance of possible manifolds. + +neural networks. Therefore, we use a guidance network $f_{G_\theta} : \mathbb{R}^d \to \varPhi$ with a shift-invariant input, absolute Fourier transform of samples, to generate an angle in radians for mapping. Simultaneously, the main classifier $f_{C_\theta} : X \to Y$ maps the transformed samples to the label space. Both networks are optimized with cross-entropy loss. The optimizer for the guidance network $(\mathcal{L}_G)$ has an additional loss term to reduce variations in a batch $(\mathcal{B})$ of angles, as given in Equation 7. + +$$ +\mathcal {L} _ {C} = - \sum_ {i = 1} ^ {N} \sum_ {j = 1} ^ {C} \mathrm {y} _ {i j} \log f _ {C _ {j}} \left(\mathcal {T} \left(\mathbf {x} _ {i}, \phi_ {i}\right)\right) \quad \mathcal {L} _ {G} = \mathcal {L} _ {C} + \sqrt {\operatorname {V a r} _ {\mathbf {x} \sim \mathcal {B}} \left(f _ {\theta_ {G}} \left(| \mathcal {F} (\mathbf {x}) |\right)\right)} \tag {7} +$$ + +The guidance network, optimized by the proposed loss, works as an adaptive linear constraint that limits the regions in the original data space where samples can be found. In other words, if we conceptualize the data space of samples as expanding with shift variants, as illustrated in Figure 3, the model learns to reduce the potential points where samples can be found in the data space. + +Additionally, for real-world samples where optimal phase shift values are unavailable, applying trivial phase shifting may lead to suboptimal data space representations. To address this, we transform the data space using the proposed diffeomorphism for the downstream tasks using the guidance network (see Appendix F for a detailed analysis of the guidance network). Moreover, unlike traditional manifold learning methods (Lin & Zha, 2008; Wang et al., 2004), which project data into lower-dimensional spaces, our approach operates directly within the original data space. In our ablation studies, we thoroughly examine the impact of loss terms on the performance and present the findings. + +# 3 EXPERIMENTS + +# 3.1 DATASETS + +We conducted experiments on nine datasets across six tasks, including heart rate (HR) estimation from photoplethysmography (PPG), step counting and activity recognition using inertial measurements (IMUs), cardiovascular disease classification from electrocardiogram (ECG), sleep stage classification from electroencephalography (EEG) and lung sound classification from audio. We provide short descriptions of each dataset below, and further details can be found in Appendix C. + +Heart rate We used the IEEE Signal Processing Cup in 2015 (IEEE SPC) (Zhang et al., 2015), and DaLia (Reiss et al., 2019) for PPG-based heart rate prediction. We used the leave-one-session-out (LOSO) cross-validation, which evaluates models on subjects/sections that were not used for training. + +Activity recognition We used UCIHAR (Anguita et al., 2012), and HHAR (Stisen et al., 2015) for activity recognition from inertial measurement units from smartphones. We evaluate the cross-person generalization performance of the models, i.e., the model is evaluated on previously unseen subjects. + +Cardiovascular disease (CVD) classification We used Chapman University, Shaoxing People's Hospital ECG (Zheng et al., 2020) and PhysioNet 2017 (Clifford et al., 2017; Goldberger et al., 2000) datasets. We selected the same four leads for the Chapman as in (Alday et al., 2020). We split the datasets into training, validation, and test sets according to the patient ID (each patient's recordings appear in only one set) using a 60, 20, 20 ratio as in Demirel & Holz (2023); Zheng et al. (2020). + +Step counting We used the Clemson dataset (Mattfeld et al., 2017), which released for pedometer evaluation. We conducted experiments using wrist IMUs where labels are available through videos. + +Sleep stage classification We used the Sleep-EDF dataset, from PhysioBank (Goldberger et al., 2000), which includes whole-night PSG sleep recordings, where we used a single EEG channel (i.e., Fpz-Cz) with a sampling rate of $100\mathrm{Hz}$ , following the same setup as in Eldele et al. (2021). + +Lung sound classification We used the Respiratory@TR, which contains lung sounds recorded with two digital stethoscopes (Altan et al., 2017). Two pulmonologists validated and labeled the recordings based on X-rays, pulmonary function tests (PFTs), and auscultation. The labels correspond to five COPD severity levels (COPD0-COPD4) as described in prior work (Zhang et al., 2024). + +# 3.2 BASELINES + +We compared our method and existing approaches including low-pass filtering (LPF) (Zhang, 2019), and adaptive subsampling grids (APS) (Chaman & Dokmanic, 2021). In addition to shift-invariance techniques, we evaluated our method against shift-equivariant Wavelet Networks (Romero et al., 2024) and canonical representation learning techniques for equivariance (Kaba et al., 2023; Mondal et al., 2023). Moreover, since our method can be integrated with any existing approaches, we investigate the performance of previous techniques for shift-invariancy when combined with our algorithm. + +# 3.3 IMPLEMENTATION + +We follow a similar implementation setup as previous work on shift-invariance (Zhang, 2019) in supervised learning, making architectural adjustments for time series. Specifically, we employed ResNet (He et al., 2015) with eight blocks designed for time series (Hong et al., 2020), excluding signals from inertial measurement units with a single dimension. For the latter, we observed a better performance with fully connected networks (FCN). Therefore, we used a three-layer FCN for the single dimensional IMU-based task, i.e., step counting. Similarly, for guiding the transformation function, we used an FCN with a single output, which is the angle for the chosen sinusoidal. For each dataset, we set the Fourier transform length equal to the signal length, as the Fourier transformation of the same size inherently includes sinusoids with periods equal to or longer than the signal length. We use categorical cross-entropy loss, which is optimized using Adam (Kingma & Ba, 2015). The learning rate is determined through grid search for each dataset and set to the same value for all baselines given in the Appendix. During training, it was halved when the validation loss stops improving for 15 consecutive epochs. The training is terminated when 90 successive epochs show no validation performance improvements. The best model is chosen as the lowest loss on the validation set. Detailed hyperparameters and architecture specifications can be found in the Appendix C.4. + +# 3.4 EVALUATION + +We evaluate the performance of the models using the common evaluation metrics, i.e., accuracy, F1, for each task. For shift-invariancy, we used the shift consistency (S-Cons.) metric which measures how often the network outputs the same classification, given the same time series with two different shifts, similar to (Zhang, 2019) as in Equation 8. We applied shifts across the entire space in contrast to previous approaches where the range of shift is heavily limited (Rojas-Gomez et al., 2022). + +$$ +\mathbb {E} _ {X, t _ {1}, t _ {2}} \mathbb {1} \left[ \hat {f} _ {C} (\mathrm {x} (t - t _ {1})) = \hat {f} _ {C} (\mathrm {x} (t - t _ {2})) \right], \tag {8} +$$ + +where $\hat{f}_C$ represents the classifier's output following the arg max operation. $t_{1,2}$ are uniformly sampled integers from the interval $[1,t]$ , with $t$ denoting the length of the sample. + +# 4 RESULTS AND DISCUSSION + +We present the main results of our approach compared to state-of-the-art methods across the six time series tasks on nine datasets. Overall, our method has demonstrated a substantial performance improvement, reaching up to $10 - 15\%$ in some tasks, while increasing the shift consistency up to $50 - 60\%$ compared to previous techniques. + +The experimental results from all the time series tasks are given in Tables 1, 2, 3 and 4. These tables demonstrate that the previous techniques fail to provide shift-invariant models when applied to time series without limiting shifts. Additionally, the models exhibit extremely low consistency (as low as $32\%$ ) in HR prediction. More importantly, applying state-of-the-art methods to enhance shift consistency in deep learning models for predicting the heart rate results in performance degradation. + +We believe the main reason for the small improvements in the consistency of previous techniques is that the research to date has tended to focus on limited shifts rather than considering the whole shift space as literature is mostly concerned about images. While restricting shifts can be a valid assumption in computer vision, where the main reasoning is that the object being classified should not be near the boundary. This assumption does not apply to time series, where the whole signal + +Table 1: Performance comparison of our method and other techniques for HR estimation + +
MethodIEEE SPC22DaLiA
S-Cons (%) ↑RMSE ↓MAE ↓ρ (%) ↑S-Cons (%) ↑RMSE ↓MAE ↓ρ (%) ↑
Baseline61.99±1.1918.39±2.9610.28±1.4162.64±5.7432.08±0.229.86±0.234.40±0.0386.01±0.51
Aug.76.48±1.7718.73±1.1510.42±0.4064.06±3.7052.77±0.399.85±0.214.47±0.0685.99±0.49
LPF76.88±0.7320.20±1.5413.44±0.8265.40±1.9238.67±0.3010.01±0.304.67±0.1285.68±0.51
APS73.99±1.0619.42±0.6012.98±0.2965.27±1.3244.33±0.1610.45±0.405.01±0.1784.69±0.85
WaveletNet51.71±1.9521.56±1.0114.61±0.3460.74±4.3736.71±3.0415.46±0.647.67±0.2376.13±1.86
Canonicalize63.52±1.2019.02±0.6210.40±0.6961.27±1.0732.01±0.339.77±0.124.39±0.0586.02±0.30
Ours100±0.0016.25±0.729.45±0.0370.12±2.10100±0.009.75±0.154.39±0.0386.06±0.19
Ours+LPF100±0.0020.34±1.6213.77±0.8465.60±2.31100±0.0010.72±0.115.30±0.0384.12±0.23
Ours+APS100±0.0018.81±1.5912.32±0.8467.01±3.79100±0.0010.47±0.095.10±0.0384.62±0.31
+ +Table 2: Performance comparison of ours and other techniques in ${ECG}$ datasets for CVD classification + +
MethodChapmanPhysioNet 2017
S-Cons (%) ↑Acc ↑F1 ↑AUC (%)↑S-Cons (%) ↑Acc ↑F1 ↑AUC ↑
Baseline98.53±0.1791.32±0.2391.22±0.2498.34±0.1698.37±0.1583.22±0.7273.50±1.9993.21±0.30
Aug.99.00±0.1691.96±0.1991.89±0.2298.45±0.1898.96±0.1782.28±1.1872.32±2.2093.20±0.42
LPF98.69±0.1492.01±0.2391.94±0.5898.50±0.2498.94±0.3984.40±0.1675.68±0.7693.80±0.32
APS98.60±0.1790.69±0.8989.44±1.0098.31±0.24————
WaveletNet91.02±1.1490.87±1.0290.02±1.0097.94±0.2165.03±0.7176.06±0.6463.35±3.4087.02±0.29
Canonicalize98.80±0.2491.93±0.1390.87±0.1898.42±0.1598.26±0.3183.34±0.4673.97±0.6793.68±0.31
Ours100±0.0092.10±0.2591.93±0.8598.47±0.15100±0.0083.15±0.6574.12±1.8093.28±0.31
Ours+LPF100±0.0092.05±0.5291.96±0.5498.51±0.10100±0.0085.20±0.4077.50±1.2194.20±0.19
Ours+APS100±0.0091.61±1.1191.10±0.5698.36±0.20————
+ +carries the information (Demirel & Holz, 2023) additional to local waveform features, and as such, there is no explicit boundary condition or input area to consider for limiting the range of shifts. + +The empirical results support our motivation for proposing a differentiable bijective function that maps samples with different shifts to the same point on the data manifold, avoiding the limited shift assumption. Additionally, applying low-pass filtering to prevent aliasing can degrade performance for certain tasks, where the interaction between frequencies plays a critical role (Canolty et al., 2006). + +Time delay as adversary? An interesting finding from our experiments is the notable decline in model consistency as the number of output classes increases. This behavior in the models is similar to previous findings on adversarial examples, indicating that the robustness decreases with a higher number of classes (Fawzi et al., 2018). During our experiments, we observed the same phenomenon where the small shifts of the input change the output to another class, particularly when the task complexity increased with a higher number of classes. For example, in the case of HR estimation (Table 1), even short shifts (as low as $10 - 100\mathrm{ms}$ ) can lead to a change in the prediction by over $80\mathrm{bpm}$ , despite no alteration in the periodicity of the signal, which is the main feature for this task. + +Normally, it is expected that models learn the periodicities in these signals and infer the heart rate. However, our results indicate that the models learn something else or in a different way, because as the signal undergoes a slight shift, the model prediction jumps more than $100\%$ , even though the periodicity of the waveform remains unchanged with the shift operation. + +We believe these drastic output changes arise from the model's sensitivity to (shortcut) features (Geirhos et al., 2020; Zhang et al., 2021), resulting in a performance decrease when evaluated on samples different from those encountered during training. Since our proposed transformation + +Table 3: Performance comparison of our method with other techniques on an EEG dataset for sleep stage classification and an audio dataset for lung sound classification in respiratory health assessment + +
MethodSleep-EDFRespiratory
S-Cons (%) ↑Acc ↑W-F1 ↑κ↑S-Cons (%) ↑Acc ↑F1 ↑W-F1 ↑
Baseline95.06±0.6175.41±2.0174.87±1.9267.12±2.9699.10±0.4325.21±5.6057.01±3.6221.21±5.98
Aug.99.00±0.1774.89±1.1174.03±1.4665.89±1.8199.68±0.4220.32±5.1845.81±3.5115.31±6.07
LPF92.43±1.2473.56±2.9376.01±1.9865.68±3.4699.50±0.4219.47±9.7846.53±3.0411.89±4.98
WaveletNet84.40±5.9073.54±4.7872.74±3.4564.66±4.1291.38±2.4028.57±10.8144.23±7.1217.10±7.81
Canonicalize93.95±0.5177.12±2.2170.14±2.2569.81±2.7698.28±0.6422.68±10.5245.33±5.7515.30±5.33
Ours100±0.0077.90±1.9276.77±2.5870.01±1.10100±0.0033.10±5.1260.13±4.6728.33±6.55
Ours+LPF100±0.0073.12±1.8975.34±1.6164.98±2.27100±0.0025.77±2.1251.82±2.1017.99±4.15
+ +Table 4: Performance comparison of our method with others in IMU datasets for Activity and Step + +
MethodUCIHARHHARClemson
S-Cons (%)↑Acc ↑F1 ↑S-Cons (%)↑Acc ↑F1 ↑S-Cons (%)↑MAPE ↓MAE ↓
Baseline94.07±1.3885.39±2.3083.20±2.9498.27±0.3391.87±1.3691.16±1.3854.31±4.404.76±0.112.74±0.08
Aug.96.55±0.8085.42±4.5083.69±6.7498.38±0.2891.97±0.4491.31±0.4961.01±4.884.08±0.142.29±0.07
LPF95.05±0.2183.96±3.4481.08±4.2198.10±0.1092.10±0.8091.43±0.9459.77±4.404.16±0.162.35±0.11
APS96.40±0.0381.75±4.1179.01±5.3398.30±0.2491.83±1.3591.01±1.4745.50±2.694.74±0.162.69±0.07
WaveletNet94.56±1.3182.78±4.6280.73±5.5996.76±0.1590.72±0.3890.71±0.3959.14±3.105.20±0.662.95±0.41
Canonicalize97.72±0.3784.10±2.1081.89±2.8998.27±0.0791.56±1.1890.73±1.1055.47±4.874.54±0.462.59±0.29
Ours100±0.0087.71±1.9885.67±2.47100±0.0091.93±1.1491.12±1.03100±0.004.28±0.342.43±0.21
Ours+LPF100±0.0084.78±2.4682.58±2.62100±0.0092.51±0.5591.80±0.62100±0.003.75±0.332.12±0.18
Ours+APS100±0.0082.96±1.7981.10±1.73100±0.0091.38±0.3290.64±0.32100±0.003.87±0.192.19±0.11
+ +function works as an adaptive linear constraint in the data space, it reduces the potential points where samples can exist, thereby enhancing overall performance. + +One distinct result from our experiments is that when previous shift-invariancy techniques are applied to the heart rate prediction task, the average error rate of the models increases by $7 - 10\%$ . This performance decrease can be easily observed in the DaLiA (Table 1) for the adaptive sampling technique. The performance discrepancy between tasks can be attributed to the dataset and signal characteristics. Since DaLiA contains impulse random noise with multiple periodicities, the norm-based subsampling can inadvertently emphasize the noisy waveforms instead of the desired pattern during the subsampling of feature maps, leading to a decrease in prediction performance. + +We conduct detailed ablation experiments to further investigate the impact of various components, with a particular focus on the effect of the proposed mapping function under different modifications, i.e., modified loss for optimization, on the overall model's performance across time series tasks. + +# 4.1 ABLATION STUDY + +We present a comprehensive investigation of our method and the effect of its components on the performance. Mainly, we investigate the effect of guiding the proposed transformation with different loss functions and without any guidance. First, we map all samples to a single manifold $\mathcal{M}^{\phi_0}$ , i.e., $\mathcal{T}(\mathbf{x},\phi)$ is applied with a constant $\phi = 0$ instead of learning the angle for each sample. We experimented with different values of $\phi \sim (-\pi ,\pi ]$ , but observed no significant change in the performance when the mapped manifold is constant for samples. Second, we modify the loss for training the guidance network to increase the variance of angles—increasing the possible manifolds where data can be found—without changing the cross-entropy loss from the classification network as in Equation 9, $(\hat{\mathcal{L}}_G)$ . Finally, we train both networks only with the cross-entropy loss $(\mathcal{L}_G' = \mathcal{L}_C)$ . We compared these three variants of the learning techniques with the original proposed implementation as each represents distinct approaches for manipulating the data space. For example, when all samples are mapped to a single manifold, the variations in samples decrease significantly since there is only one possible phase angle for the chosen harmonic with period $\mathrm{T_0}$ . Additionally, the relationships among all sinusoidal components remain invariant, given that the proposed transformation is a linear function of the frequency. Conversely, optimizing the guidance network to increase the variance of angles, thereby favoring a greater sample diversity, expands the possible variations for samples. + +$$ +\hat {\mathcal {L}} _ {G} = \mathcal {L} _ {C} - \sqrt {\operatorname {V a r} _ {\mathbf {x} \sim \mathcal {B}} \left(f _ {\theta_ {G}} \left(\left| \mathcal {F} (\mathbf {x}) \right|\right)\right)} \tag {9} +$$ + +Tables 5 and 6 summarize the results where we exclude the consistency metric from the tables as the models that include the proposed transformation are always completely shift-invariant. The first row $(\mathcal{T}(\mathbf{x},\phi))$ in the tables shows the performance when all the samples are mapped to a single manifold + +Table 5: Ablation experiments for ${HR}$ (left) and ${IMU}$ (right) tasks + +
MethodIEEE SPC22DaLiAPPG
MAE ↓RMSE ↓ρ↑MAE ↓RMSE ↓ρ↑
T(x,φ)11.1519.1862.074.7710.1385.35
L′G9.8017.1666.804.6010.1085.52
L′G9.4517.0069.104.419.6386.35
Ours9.4516.2570.124.399.7586.06
Change+1.70+2.97+8.05+0.38+0.38+0.71
+ +
MethodUCIHARHHARClemson
Acc ↑F1 ↑Acc ↑F1 ↑MAPE ↓MAE ↓
T(x,φ)84.6782.6592.3391.564.642.67
L′G84.3082.4991.9891.184.422.52
L′G84.8281.9991.5190.834.312.45
Ours85.8183.8191.8391.124.282.43
Change (%)+1.14+1.16-0.50-0.44+0.36+0.24
+ +Table 6: Ablation experiments for ${EEG}$ (left) and ${ECG}$ (right) tasks + +
MethodSleep-EDF
Acc ↑F1 ↑W-F1 ↑κ ↑
T(x,φ)75.54±2.3966.96±1.7875.53±2.2967.08±0.03
L′G77.21±1.5167.67±1.6776.89±1.7169.39±0.02
L′G77.75±1.2368.04±1.1677.01±1.0769.94±0.01
Ours77.80±1.9567.01±2.6576.77±2.5870.01±1.10
Change+2.26+0.05+1.24+2.93
+ +
MethodChapmanPhysioNet
Acc ↑F1 ↑AUC ↑Acc ↑F1 ↑AUC ↑
T(x,φ)91.8290.7698.3683.1273.6793.24
L′G91.2790.1098.3882.8173.7593.45
LG91.8890.8498.4483.3073.9093.51
Ours92.1091.9398.4083.1574.1293.30
Change (%)+0.28+1.17+0.04+0.03+0.45+0.06
+ +i.e., without a guidance network for learning the mapping. The second row $(\mathcal{L}_G^{\prime})$ represents the performance when the guidance network is only optimized using the categorical cross-entropy loss. The third row $(\hat{\mathcal{L}}_G)$ presents the performance when the variance of angles is optimized to increase during training. And, the last row (Ours) is the original implementation of the proposed method. We also report the change when the mapping function is guided using the network $f_{G_{\theta}}$ and optimized using the loss defined in Equation 7, as opposed to being a fixed, non-learnable function. + +As can be seen from the tables, when the models are trained by guiding the transformation function (with $f_{G_{\theta}}$ ), the performance of the models increases significantly up to $8\%$ , except for the HHAR dataset with a marginal performance decrease of $0.5\%$ . Importantly, adding the guidance network does not bring any additional parameters that help the learning, meaning that the model achieves improved generalization with the same capacity. Furthermore, the additional model parameters introduced to the overall framework approximately amount to one percent of those in the classifier. + +While the performance increase can be associated with the decreased possible variations in the signals, our ablation experiments show that decreasing the variations blindly using the transformation with the same angle, decreases performance. Therefore, it is important to guide the transformation function for reducing the dimensionality, i.e., the space and time variations of a signal, of the whole data space. Overall, the results obtained from the ablation study and main experiments support the previous propositions and our motivation for introducing a novel diffeomorphism for preventing the inconsistency of deep + +Table 7: Ablation experiments for Audio + +
MethodRespiratory
Acc ↑F1 ↑W-F1 ↑
T(x,φ)21.28±7.4355.03±2.8918.14±6.39
L′G27.17±6.7155.58±9.1821.46±4.07
L′G28.57±8.3154.28±6.5623.73±4.65
Ours33.10±5.1260.13±4.6728.33±6.55
Change+11.82+5.10+10.19
+ +learning models to the time shifts while increasing the generalization capability. + +Additional results (i.e., the extended experiments and ablations) regarding the performance of the proposed method can be found in Appendix D. Investigations regarding the performance improvements of the proposed diffeomorphism with different model networks are given in Appendix E. Detailed analysis of the guidance network with its effect is given in Appendix F. We provide an extended discussion of related work in Appendix G and outline limitations and future directions in Appendix H. + +# 5 RELATED WORK + +Shift-invariant networks Modern deep learning architectures use strided convolution or pooling to decrease the variance to a certain extent (Fukushima, 1980). However, Azulay and Weiss have demonstrated that a shift of one pixel in an image can lead to a significant alteration in the output probability of a trained classifier (Azulay & Weiss, 2018). Previous works showed that the downsampling caused aliasing and used low-pass filtering before the downsampling to prevent information loss (Zhang, 2019; Mairal et al., 2014). However, the used filters have suboptimal frequency responses, and realizing the ideal filter in practice is unfeasible. This leads to persistent aliasing, becoming a more significant concern for time series where high-frequency components are crucial for classification. + +Adaptive subsampling methods have been recently explored for shift-invariancy (Chaman & Dokmanic, 2021; Xu et al., 2021). Mainly, these methods perform subsampling on a constant (Chaman & Dokmanic, 2021) or input dependent (Rojas-Gomez et al., 2022) grid. This approach has a notable limitation in time series, particularly when nonlinear activation functions are involved. The methods tend to overlook variations in boundaries arising from the translation of samples, thereby imposing additional constraints on invariance (Rojas-Gomez et al., 2022). Consequently, the evaluation of + +these methods is restricted to a narrow range of shifts, covering only a limited subset of the shift space. Moreover, their reliance on a grid scheme for sampling introduces a sensitivity to sampling rates, leading to performance gaps across the entire shift space (Michaeli et al., 2023). Therefore, we shift the paradigm and present a bijective transformation to modify the data space. Moreover, unlike existing methods that change network topology by modifying the pooling or adding extra filters without achieving complete shift-invariance, our method guarantees invariance in neural network models without imposing any restrictions on the model topology or shift range. + +Time-delay neural networks Efforts to design shift-invariant models for time series predate modern deep learning methods (Hasegawa et al., 1996; Waibel et al., 1989). For example, a time-delay neural network (TDNN) network is designed to have the ability to represent relationships between events in time frames where the learned features by the network are aimed to be invariant under translation in time (Waibel et al., 1989). TDNN is trained with all time-shifted copies of samples and weights are updated by the average of all corresponding time-delayed error values. This is similar to the supervised training of a network with randomly shifted versions of samples. Although this strategy achieved shift-invariance for the first type of networks, as they do not include a pooling layer, it was shown that this approach is ineffective for modern architectures where pooling and derivatives are used (Scherer et al., 2010), and the network's invariance is limited to patterns seen during training and fails generalization (Azulay & Weiss, 2018). In this work, as we learn the mapping for each sample, the proposed transformation ensures that all shifted variants of a sample are mapped to a single point. Hence, a single data point effectively represents all the augmented variants. + +# 6 CONCLUSION + +The inadequacy of shift-invariance in deep learning models, particularly in the context of temporal data, remains a significant challenge. Existing solutions designed for images not only prove ineffective for time series but also result in performance deterioration for some tasks. To address this, we have introduced a novel differentiable bijective function. Our approach builds on the insight from Proposition 2.1, which states that the shift operation forms an Abelian group for each harmonic of a sample. Leveraging this property, we uniquely represent each point in the shift space using the phase angle of a harmonic whose period is at least as long as the sample length. Our approach ensures that samples, under various shifts, are mapped to a unique point in the data manifold without reducing dimensions, preserving task-related information without any loss. We validated our method theoretically and empirically, showing that it establishes shift-invariance in deep learning models without constraints on the shift range. In extensive experiments across six tasks, our approach consistently outperforms state-of-the-art methods, demonstrating its effectiveness in achieving complete shift-invariance without limitations on the model topology. + +# REFERENCES + +Saba Akbar, Enrico Coiera, and Farah Magrabi. Safety concerns with consumer-facing mobile health applications and their consequences: a scoping review. Journal of the American Medical Informatics Association, 27(2):330-340, 10 2019. ISSN 1527-974X. doi: 10.1093/jamia/ocz175. URL https://doi.org/10.1093/jamia/ocz175. +Erick A Perez Alday, Annie Gu, Amit J Shah, Chad Robichaux, An-Kwok Ian Wong, Chengyu Liu, Feifei Liu, Ali Bahrami Rad, Andoni Elola, Salman Seyedi, Qiao Li, Ashish Sharma, Gari D Clifford, and Matthew A Reyna. Classification of 12-lead eecs: the physionet/computing in cardiology challenge 2020. Physiological Measurement, 41(12):124003, dec 2020. doi: 10.1088/ 1361-6579/abc960. URL https://dx.doi.org/10.1088/1361-6579/abc960. +Gokhan Altan, Yakup Kutlu, Yusuf Garbi, Adnan Özhan Pekmezci, and Serkan Nural. Multimedia respiratory database (respiratorydatabase@tr): Auscultation sounds and chest x-rays. ArXiv, 2017. +D. Anguita, Alessandro Ghio, L. Oneto, Xavier Parra, and Jorge Luis Reyes-Ortiz. Human activity recognition on smartphones using a multiclass hardware-friendly support vector machine. In International Workshop on Ambient Assisted Living and Home Care, 2012. URL https://api.sementicscholar.org/CorpusID:13178535. + +Aharon Azulay and Yair Weiss. Why do deep convolutional networks generalize so poorly to small image transformations? J. Mach. Learn. Res., 20:184:1-184:25, 2018. +Siddharth Biswal, Haoqi Sun, Balaji Goparaju, M Brandon Westover, Jimeng Sun, and Matt T Bianchi. Expert-level sleep scoring with deep neural networks. Journal of the American Medical Informatics Association, 25(12):1643-1650, 11 2018. ISSN 1527-974X. doi: 10.1093/jamia/ocy131. URL https://doi.org/10.1093/jamia/ocy131. +Dwaipayan Biswas, Luke Everson, Muqing Liu, Madhuri Panwar, Bram-Ernst Verhoef, Shrishail Patki, Chris H. Kim, Amit Acharyya, Chris Van Hoof, Mario Konijnenburg, and Nick Van Helleputte. Cornet: Deep learning framework for ppg-based heart rate estimation and biometric identification in ambulant environment. IEEE Transactions on Biomedical Circuits and Systems, 2019. +R. T. Canolty, E. Edwards, S. S. Dalal, M. Soltani, S. S. Nagarajan, H. E. Kirsch, M. S. Berger, N. M. Barbaro, and R. T. Knight. High gamma power is phase-locked to theta oscillations in human neocortex. Science, 313(5793):1626–1628, 2006. doi: 10.1126/science.1128115. URL https://www.science.org/doi/abs/10.1126/science.1128115. +Ryan T. Canolty and Robert T. Knight. The functional role of cross-frequency coupling. Trends in Cognitive Sciences, 14(11):506-515, November 2010. ISSN 13646613. doi: 10.1016/j.tics.2010.09.001. URL https://linkinghub.elsevier.com/retrieve/pii/S1364661310002068. +Yuan Cao, Zixiang Chen, Misha Belkin, and Quanquan Gu. Benign overfitting in two-layer convolutional neural networks. In Alice H. Oh, Alekh Agarwal, Danielle Belgrave, and Kyunghyun Cho (eds.), Advances in Neural Information Processing Systems, 2022. URL https://openreview.net/forum?id=pF8btdPVTL_. +A. Chaman and I. Dokmanic. Truly shift-invariant convolutional neural networks. In 2021 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 3772-3782, Los Alamitos, CA, USA, jun 2021. IEEE Computer Society. doi: 10.1109/CVPR46437.2021.00377. URL https://doi.ieeecomputersociety.org/10.1109/CVPR46437.2021.00377. +Peter Christen, David J. Hand, and Nishadi Kirielle. A review of the f-measure: Its history, properties, criticism, and alternatives. ACM Comput. Surv., 56(3), oct 2023. ISSN 0360-0300. doi: 10.1145/3606367. URL https://doi.org/10.1145/3606367. +Gari D Clifford, Chengyu Liu, Benjamin Moody, Li-wei H. Lehman, Ikaro Silva, Qiao Li, A E Johnson, and Roger G. Mark. Af classification from a short single lead ecg recording: The physionet/computing in cardiology challenge 2017. In 2017 Computing in Cardiology (CinC), pp. 1-4, 2017. doi: 10.22489/CinC.2017.065-469. +Jacob Cohen. A coefficient of agreement for nominal scales. Educational and Psychological Measurement, 20:37 - 46, 1960. URL https://api(semanticscholar.org/CorpusID:15926286. +Christine M. Cutillo, Karlie R. Sharma, Luca Foschini, Shinjini Kundu, Maxine Mackintosh, and Kenneth D. Mandl. Machine intelligence in healthcare—perspectives on trustworthiness, explainability, usability, and transparency. npj Digital Medicine, 3(1):1-5, March 2020. ISSN 2398-6352. doi: 10.1038/s41746-020-0254-2. URL https://www.nature.com/articles/s41746-020-0254-2. +Berken Utku Demirel and Christian Holz. Finding order in chaos: A novel data augmentation method for time series in contrastive learning. In Thirty-seventh Conference on Neural Information Processing Systems, 2023. URL https://openreview.net/forum?id=dbVRDk2wt7. +Nicki Skafte Detlefsen, Oren Freifeld, and Søren Hauberg. Deep diffeomorphic transformer networks. In 2018 IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 4403-4412, 2018. doi: 10.1109/CVPR.2018.00463. +Luo donghao and wang xue. ModernTCN: A modern pure convolution structure for general time series analysis. In The Twelfth International Conference on Learning Representations, 2024. URL https://openreview.net/forum?id=vpJMJerXHU. + +Emadeldeen Eldele, Mohamed Ragab, Zhenghua Chen, Min Wu, Chee Keong Kwoh, Xiaoli Li, and Cuntai Guan. Time-series representation learning via temporal and contextual contrasting. In Zhi-Hua Zhou (ed.), Proceedings of the Thirtieth International Joint Conference on Artificial Intelligence, IJCAI-21, pp. 2352-2359. International Joint Conferences on Artificial Intelligence Organization, 8 2021. doi: 10.24963/ijcai.2021/324. URL https://doi.org/10.24963/ ijcai.2021/324. Main Track. +Alhussein Fawzi, Hamza Fawzi, and Omar Fawzi. Adversarial vulnerability for any classifier. In Proceedings of the 32nd International Conference on Neural Information Processing Systems, NIPS'18, pp. 1186-1195, Red Hook, NY, USA, 2018. Curran Associates Inc. +Riccardo Femiano, Charlotte Werner, Matthias Wilhelm, and Prisca Eser. Validation of open-source step-counting algorithms for wrist-worn tri-axial accelerometers in cardiovascular patients. Gait & Posture, 92:206-211, 2022. ISSN 0966-6362. doi: https://doi.org/10.1016/j.gaitpost.2021.11.035. URL https://www.sciencedirect.com/science/article/pii/S0966636221006196. +L. Fuchs, Abelian Groups. Number Bd. 1 in International series of monographs in pure and applied mathematics. Pergamon Press, 1960. URL https://books.google.ch/books?id=F7VUzgEACAAJ. +Kunihiko Fukushima. Neocognitron: A self-organizing neural network model for a mechanism of pattern recognition unaffected by shift in position. Biological Cybernetics, 36(4):193-202, April 1980. ISSN 1432-0770. doi: 10.1007/BF00344251. URL https://doi.org/10.1007/BF00344251. +Robert Geirhos, Jorn-Henrik Jacobsen, Claudio Michaelis, Richard Zemel, Wieland Brendel, Matthias Bethge, and Felix A. Wichmann. Shortcut learning in deep neural networks. Nature Machine Intelligence, 2(11):665-673, November 2020. ISSN 2522-5839. doi: 10.1038/s42256-020-00257-z. URL https://www.nature.com/articles/s42256-020-00257-z. +Ary L. Goldberger, Luis A. N. Amaral, Leon Glass, Jeffrey M. Hausdorff, Plamen Ch. Ivanov, Roger G. Mark, Joseph E. Mietus, George B. Moody, Chung-Kang Peng, and H. Eugene Stanley. Physiobank, physi toolkit, and physionet. Circulation, 101(23):e215-e220, 2000. doi: 10.1161/01.CIR.101.23.e215. URL https://www.ahajournals.org/doi/abs/10.1161/01.CIR.101.23.e215. +Roger Grosse, Rajat Raina, Helen Kwong, and Andrew Y. Ng. Shift-invariant sparse coding for audio classification. In Proceedings of the Twenty-Third Conference on Uncertainty in Artificial Intelligence, UAI'07, pp. 149–158, Arlington, Virginia, USA, 2007. AUAI Press. ISBN 0974903930. +Awni Y. Hannun, Pranav Rajpurkar, Masoumeh Haghpanahi, Geoffrey H. Tison, Codie Bourn, Mintu P. Turakhia, and Andrew Y. Ng. Cardiologist-level arrhythmia detection and classification in ambulatory electrocardiograms using a deep neural network. Nature Medicine, 25(1):65-69, January 2019. ISSN 1546-170X. doi: 10.1038/s41591-018-0268-3. URL https://www.nature.com/articles/s41591-018-0268-3. +Akira Hasegawa, Kazuyoshi Itoh, and Yoshiki Ichioka. Generalization of shift invariant neural networks: Image processing of corneal endothelium. *Neural Networks*, 9(2):345–356, 1996. ISSN 0893-6080. doi: https://doi.org/10.1016/0893-6080(95)00054-2. URL https://www.sciencedirect.com/science/article/pii/0893608095000542. +Simon Haykin and Barry Van Veen. Signals and Systems. John Wiley & Sons, Inc., USA, 2nd edition, 2002. ISBN 0471164747. +Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition, 2015. +Shenda Hong, Yanbo Xu, Alind Khare, Satria Priambada, Kevin Maher, Alaa Aljiffry, Jimeng Sun, and Alexey Tumanov. Holmes: Health online model ensemble serving for deep learning models in intensive care units. In Proceedings of the 26th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, pp. 1614-1624, 2020. + +Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In Francis Bach and David Blei (eds.), Proceedings of the 32nd International Conference on Machine Learning, volume 37 of Proceedings of Machine Learning Research, pp. 448-456, Lille, France, 07-09 Jul 2015. PMLR. URL https://proceedings.mlr.press/v37/ioffel15.html. +Max Jaderberg, Karen Simonyan, Andrew Zisserman, and koray kavukcuoglu. Spatial transformer networks. In C. Cortes, N. Lawrence, D. Lee, M. Sugiyama, and R. Garnett (eds.), Advances in Neural Information Processing Systems, volume 28. Curran Associates, Inc., 2015. URL https://proceedings.neurips.cc/paper_files/paper/2015/file/33ceb07bf4eeb3da587e268d663aba1a-Paper.pdf. +Sékou-Oumar Kaba, Arnab Kumar Mondal, Yan Zhang, Yoshua Bengio, and Siamak Ravanbakhsh. Equivalence with learned canonicalization functions. In Proceedings of the 40th International Conference on Machine Learning, ICML'23. JMLR.org, 2023. +Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In Yoshua Bengio and Yann LeCun (eds.), 3rd International Conference on Learning Representations, ICLR 2015, San Diego, CA, USA, May 7-9, 2015, Conference Track Proceedings, 2015. URL http://arxiv.org/abs/1412.6980. +Dani Kiyasseh, Tingting Zhu, and David A. Clifton. Clocs: Contrastive learning of cardiac signals across space, time, and patients. In International Conference on Machine Learning, 2020. +Risi Kondor and Shubhendu Trivedi. On the generalization of equivariance and convolution in neural networks to the action of compact groups. In Jennifer Dy and Andreas Krause (eds.), Proceedings of the 35th International Conference on Machine Learning, volume 80 of Proceedings of Machine Learning Research, pp. 2747-2755. PMLR, 10-15 Jul 2018. URL https://proceedings.mlr.press/v80/kondor18a.html. +Anoop N. Koshy, Jithin K. Sajeev, Nitesh Nerlekar, Adam J. Brown, Kevin Rajakariar, Mark Zureik, Michael C. Wong, Louise Roberts, Maryann Street, Jennifer Cooke, and Andrew W. Teh. Smart watches for heart rate assessment in atrial arrhythmias. International Journal of Cardiology, 266: 124-127, 2018. ISSN 0167-5273. doi: https://doi.org/10.1016/j.ijcard.2018.02.073. URL https://www.sciencedirect.com/science/article/pii/S0167527318304017. +Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. In F. Pereira, C.J. Burges, L. Bottou, and K.Q. Weinberger (eds.), Advances in Neural Information Processing Systems, volume 25. Curran Associates, Inc., 2012. URL https://proceedings.neurips.cc/paper_files/paper/2012/file/c399862d3b9d6b76c8436e924a68c45b-Paper.pdf. +Tong Lin and Hongbin Zha. Riemannian manifold learning. IEEE Transactions on Pattern Analysis and Machine Intelligence, 30(5):796-809, 2008. doi: 10.1109/TPAMI.2007.70735. +Minhao LIU, Ailing Zeng, Qiuxia LAI, Ruiyuan Gao, Min Li, Jing Qin, and Qiang Xu. T-wavenet: A tree-structured wavelet neural network for time series signal analysis. In International Conference on Learning Representations, 2022. URL https://openreview.net/forum?id=U4uFaLyg7PV. +Suhas Lohit, Qiao Wang, and Pavan K. Turaga. Temporal transformer networks: Joint learning of invariant and discriminative time warping. 2019 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 12418-12427, 2019. URL https://api-semanticscholar.org/CorpusID:189897590. +Julien Mairal, Piotr Koniusz, Zaid Harchaoui, and Cordelia Schmid. Convolutional kernel networks. In Z. Ghahramani, M. Welling, C. Cortes, N. Lawrence, and K.Q. Weinberger (eds.), Advances in Neural Information Processing Systems, volume 27. Curran Associates, Inc., 2014. URL https://proceedings.neurips.cc/paper_files/paper/2014/file/81ca0262c82e712e50c580c032d99b60-Paper.pdf. + +Alexander Malafeev, Dmitry Laptev, Stefan Bauer, Ximena Omlin, Aleksandra Wierzbicka, Adam Wichniak, Wojciech Jernajczyk, Robert Riener, Joachim Buhmann, and Peter Achermann. Automatic human sleep stage scoring using deep neural networks. Frontiers in Neuroscience, 12, 2018. ISSN 1662-453X. doi: 10.3389/fnins.2018.00781. URL https://www.frontiersin.org/articles/10.3389/fnins.2018.00781. +Stéphane Mallat. Group invariant scattering. Communications on Pure and Applied Mathematics, 65(10):1331-1398, 2012. doi: https://doi.org/10.1002/cpa.21413. URL https://onlinelibrary.wiley.com/doi/abs/10.1002/cpa.21413. +Inigo Martinez, Elisabeth Viles, and Igor G. Olaizola. Closed-form diffeomorphic transformations for time series alignment. In Kamalika Chaudhuri, Stefanie Jegelka, Le Song, Csaba Szepesvari, Gang Niu, and Sivan Sabato (eds.), Proceedings of the 39th International Conference on Machine Learning, volume 162 of Proceedings of Machine Learning Research, pp. 15122-15158. PMLR, 17-23 Jul 2022. URL https://proceedings.mlr.press/v162/martinez22a.html. +Ryan Mattfeld, Elliot Jesch, and Adam Hoover. A new dataset for evaluating pedometer performance. In 2017 IEEE International Conference on Bioinformatics and Biomedicine (BIBM), pp. 865-869, 2017. doi: 10.1109/BIBM.2017.8217769. +Hagay Michaeli, Tomer Michaeli, and Daniel Soudry. Alias-free convnets: Fractional shift invariance via polynomial activations. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 16333-16342, June 2023. +Arnab Kumar Mondal, Siba Smarak Panigrahi, Oumar Kaba, Sai Rajeswar Mudumba, and Siamak Ravanbakhsh. Equivariant adaptation of large pretrained models. In A. Oh, T. Neumann, A. Globerson, K. Saenko, M. Hardt, and S. Levine (eds.), Advances in Neural Information Processing Systems, volume 36, pp. 50293-50309. Curran Associates, Inc., 2023. URL https://proceedings.neurips.cc/paper_files/paper/2023/file/9d5856318032ef3630cb580f4e24f823-Paper-Conference.pdf. +Jeeheh Oh, Jiaxuan Wang, and Jenna Wiens. Learning to exploit invariances in clinical time-series data using sequence transformer networks. In Finale Doshi-Velez, Jim Fackler, Ken Jung, David Kale, Rajesh Ranganath, Byron Wallace, and Jenna Wiens (eds.), Proceedings of the 3rd Machine Learning for Healthcare Conference, volume 85 of Proceedings of Machine Learning Research, pp. 332-347. PMLR, 17-18 Aug 2018. URL https://proceedings.mlr.press/v85/oh18a.html. +Alan V. Oppenheim, Alan S. Willsky, and S. Hamid Nawab. Signals & Systems (2nd Ed.). Prentice-Hall, Inc., USA, 1996. ISBN 0138147574. +A Paszke et al. Pytorch: An imperative style, high-performance deep learning library. In Advances in Neural Information Processing Systems 32, pp. 8024-8035. Curran Associates, Inc., 2019. +Marco V. Perez, Kenneth W. Mahaffey, Haley Hedlin, John S. Rumsfeld, Ariadna Garcia, Todd Ferris, Vidhya Balasubramanian, Andrea M. Russo, Amol Rajmane, Lauren Cheung, Grace Hung, Justin Lee, Peter Kowey, Nisha Talati, Divya Nag, Santosh E. Gummidipundi, Alexis Beatty, Mellanie True Hills, Sumbul Desai, Christopher B. Granger, Manisha Desai, and Mintu P. Turakhia. Large-scale assessment of a smartwatch to identify atrial fibrillation. New England Journal of Medicine, 381(20):1909-1917, 2019. doi: 10.1056/NEJMoa1901183. URL https://doi.org/10.1056/NEJMoa1901183. PMID: 31722151. +David M. W. Powers. What the f-measure doesn't measure: Features, flaws, fallacies and fixes. ArXiv, abs/1503.06410, 2015. URL https://api(semanticscholar.org/CorpusID:10874558. +Hangwei Qian, Sinno Jialin Pan, and Chunyan Miao. Latent independent excitation for generalizable sensor-based cross-person activity recognition. Proceedings of the AAAI Conference on Artificial Intelligence, 35(13):11921-11929, May 2021. doi: 10.1609/aaai.v35i13.17416. URL https://ojs.aaai.org/index.php/AAAI/article/view/17416. + +Hangwei Qian, Tian Tian, and Chunyan Miao. What makes good contrastive learning on small-scale wearable-based tasks? In Proceedings of the 28th ACM SIGKDD Conference on Knowledge Discovery and Data Mining, KDD '22, pp. 3761-3771, New York, NY, USA, 2022. Association for Computing Machinery. ISBN 9781450393850. doi: 10.1145/3534678.3539134. URL https://doi.org/10.1145/3534678.3539134. +Nasim Rahaman, Aristide Baratin, Devansh Arpit, Felix Draxler, Min Lin, Fred Hamprecht, Yoshua Bengio, and Aaron Courville. On the spectral bias of neural networks. In Kamalika Chaudhuri and Ruslan Salakhutdinov (eds.), Proceedings of the 36th International Conference on Machine Learning, volume 97 of Proceedings of Machine Learning Research, pp. 5301-5310. PMLR, 09-15 Jun 2019. URL https://proceedings.mlr.press/v97/rahaman19a.html. +Ali Rahimi and Benjamin Recht. Random features for large-scale kernel machines. In Proceedings of the 20th International Conference on Neural Information Processing Systems, NIPS'07, pp. 1177-1184, Red Hook, NY, USA, 2007. Curran Associates Inc. ISBN 9781605603520. +Attila Reiss, Ina Indlekofer, Philip Schmidt, and Kristof Van Laerhoven. Deep ppg: Large-scale heart rate estimation with convolutional neural networks. Sensors, 19, 2019. +Leandro Giacomini Rocha, Dwaipayan Biswas, Bram-Ernst Verhoef, Sergio Bampi, Chris Van Hoof, Mario Konijnenburg, Marian Verhelst, and Nick Van Helleputte. Binary cornet: Accelerator for hr estimation from wrist-ppg. IEEE Transactions on Biomedical Circuits and Systems, 2020. +Renan A. Rojas-Gomez, Teck-Yian Lim, Alex Schwing, Minh Do, and Raymond A. Yeh. Learnable polyphase sampling for shift invariant and equivariant convolutional networks. In S. Koyejo, S. Mohamed, A. Agarwal, D. Belgrave, K. Cho, and A. Oh (eds.), Advances in Neural Information Processing Systems, volume 35, pp. 35755-35768. Curran Associates, Inc., 2022. +David W. Romero, Erik J Bekkers, Jakub M. Tomczak, and Mark Hoogendoorn. Wavelet networks: Scale-translation equivariant learning from raw time-series. Transactions on Machine Learning Research, 2024. ISSN 2835-8856. URL https://openreview.net/forum?id=ga5SNulYet. Expert Certification. +Pedro F. Saint-Maurice, Richard P. Troiano, Jr Bassett, David R., Barry I. Graubard, Susan A. Carlson, Eric J. Shiroma, Janet E. Fulton, and Charles E. Matthews. Association of Daily Step Count and Step Intensity With Mortality Among US Adults. JAMA, 2020. +Dominik Scherer, Andreas Müller, and Sven Behnke. Evaluation of pooling operations in convolutional architectures for object recognition. In Konstantinos Diamantaras, Wlodek Duch, and Lazaros S. Iliadis (eds.), Artificial Neural Networks – ICANN 2010, pp. 92–101, Berlin, Heidelberg, 2010. Springer Berlin Heidelberg. ISBN 978-3-642-15825-4. +Ron Shapira Weber and Oren Freifeld. Regularization-free diffeomorphic temporal alignment nets. In Andreas Krause, Emma Brunskill, Kyunghyun Cho, Barbara Engelhardt, Sivan Sabato, and Jonathan Scarlett (eds.), Proceedings of the 40th International Conference on Machine Learning, volume 202 of Proceedings of Machine Learning Research, pp. 30794-30826. PMLR, 23-29 Jul 2023. URL https://proceedings.mlr.press/v202/shapira-weber23a.html. +Ron A Shapira Weber, Matan Eyal, Nicki Skafte, Oren Shriki, and Oren Freifeld. Diffeomorphic temporal alignment nets. In H. Wallach, H. Larochelle, A. Beygelzimer, F. d'Alché-Buc, E. Fox, and R. Garnett (eds.), Advances in Neural Information Processing Systems. Curran Associates, Inc., 2019. +Nitish Srivastava, Geoffrey Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: A simple way to prevent neural networks from overfitting. Journal of Machine Learning Research, 15(56):1929-1958, 2014. URL http://jmlr.org/papers/v15/srivastava14a.html. +Allan Stisen, Henrik Blunck, Sourav Bhattacharya, Thor Siiger Prentow, Mikkel Baun Kjørgaard, Anind Dey, Tobias Sonne, and Mads Møller Jensen. Smart devices are different: Assessing and mitigating mobile sensing heterogeneities for activity recognition. SenSys '15. Association for Computing Machinery, 2015. ISBN 9781450336314. + +Ajay Subramanian, Elena Sizikova, Najib J.Majaj, and Denis G.Pelli. Spatial-frequency channels, shape bias, and adversarial robustness. In Thirty-seventh Conference on Neural Information Processing Systems, 2023. +Laurens van der Maaten and Geoffrey Hinton. Visualizing data using t-sne. Journal of Machine Learning Research, 9(86):2579-2605, 2008. URL http://jmlr.org/papers/v9/vandermaaten08a.html. +A. Waibel, T. Hanazawa, G. Hinton, K. Shikano, and K.J. Lang. Phoneme recognition using time-delay neural networks. IEEE Transactions on Acoustics, Speech, and Signal Processing, 1989. +Jing Wang, Zhenyue Zhang, and Hongyuan Zha. Adaptive manifold learning. In L. Saul, Y. Weiss, and L. Bottou (eds.), Advances in Neural Information Processing Systems, volume 17. MIT Press, 2004. URL https://proceedings.neurips.cc/paper_files/paper/2004/file/eb0ecdb070a1a0ac46de0cd733d39cf3-Paper.pdf. +Yifei Wang, Qi Zhang, Yisen Wang, Jiansheng Yang, and Zhouchen Lin. Chaos is a ladder: A new theoretical understanding of contrastive learning via augmentation overlap. In The Tenth International Conference on Learning Representations, ICLR 2022, Virtual Event, April 25-29, 2022, 2022. URL https://openreview.net/forum?id=ECvgmYVyeUz. +Kaiyue Wen, Jiaye Teng, and Jingzhao Zhang. Benign overfitting in classification: Provably counter label noise with larger models. In The Eleventh International Conference on Learning Representations, 2023. URL https://openreview.net/forum?id=UrEwJebCxk. +Jin Xu, Hyunjik Kim, Tom Rainforth, and Yee Whye Teh. Group equivariant subsampling. In A. Beygelzimer, Y. Dauphin, P. Liang, and J. Wortman Vaughan (eds.), Advances in Neural Information Processing Systems, 2021. URL https://openreview.net/forum?id= CtaD19L0bIQ. +Runze Yang, Jian Song, Baoqi Huang, Wuyungerile Li, and Guodong Qi. An Energy-Efficient Step-Counting Algorithm for Smartphones. The Computer Journal, 65(3):689-700, 08 2020. ISSN 0010-4620. doi: 10.1093/comjnl/bxaa096. URL https://doi.org/10.1093/comjnl/bxaa096. +Cem Üçüeer and Kemal Oflazer. A rotation, scaling, and translation invariant pattern classification system. Pattern Recognition, 1993. +Dinghuai Zhang, Kartik Ahuja, Yilun Xu, Yisen Wang, and Aaron Courville. Can subnetwork structure be the key to out-of-distribution generalization? In Marina Meila and Tong Zhang (eds.), Proceedings of the 38th International Conference on Machine Learning, Proceedings of Machine Learning Research, pp. 12356-12367. PMLR, 2021. +Richard Zhang. Making convolutional networks shift-invariant again. In ICML, 2019. +Yuwei Zhang, Tong Xia, Jing Han, Yu Wu, Georgios Rizos, Yang Liu, Mohammed Mosuily, Jagmohan Chauhan, and Cecilia Mascolo. Towards open respiratory acoustic foundation models: Pretraining and benchmarking. In The Thirty-eight Conference on Neural Information Processing Systems Datasets and Benchmarks Track, 2024. URL https://openreview.net/forum?id=vXnGXRbOfb. +Zhilin Zhang, Zhouyue Pi, and Benyuan Liu. Troika: A general framework for heart rate monitoring using wrist-type photoplethysmographic signals during intensive physical exercise. IEEE Transactions on Biomedical Engineering, 62(2):522-531, 2015. doi: 10.1109/TBME.2014.2359372. +Jianwei Zheng, Jianming Zhang, Sidy Danioko, Hai Yao, Hangyuan Guo, and Cyril Rakovski. A 12-lead electrocardiogram database for arrhythmia research covering more than 10,000 patients. Scientific Data, 7(1):48, February 2020. ISSN 2052-4463. doi: 10.1038/s41597-020-0386-x. URL https://www.nature.com/articles/s41597-020-0386-x. + +# APPENDIX + +# A THEORETICAL ANALYSIS + +Here, we present complete proofs of our theoretical study, starting with notations. We assume all the samples (time series) are absolutely summable, and finite. + +# A.1 REPRESENTATIONS AND NOTATIONS + +# A.1.1 FREQUENCY DOMAIN + +Fourier transform of a real-valued sample with a finite duration is obtained as in Equation 10. + +$$ +\mathcal {F} (\mathbf {x}) = | X (e ^ {j \omega}) | e ^ {j \phi (\omega)} = \int_ {- \infty} ^ {\infty} \mathbf {x} (t) e ^ {- j \omega t}, \tag {10} +$$ + +where $\omega = \frac{2\pi}{T}$ , and $\omega$ and $T$ are the frequency in radian and period for all sinusoids in the range of Nyquist rate. $|X(e^{j\omega})|$ and $\phi (\omega)$ denote the amplitude and phase for all frequencies, respectively. Thus, the amplitude and phase angle of a particular sinusoidal are represented as $|X(e^{j\omega_0})|$ and $\phi (\omega_0)$ . Similarly, the period for this sinusoidal is $T_0 = 2\pi /\omega_0$ . The phase difference between a sinusoidal and an angle $\phi$ is shown in Equation 11. + +$$ +\Delta \phi_ {\mathbf {x} (t)} = \left\{ \begin{array}{l l} \frac {(\theta - 2 \pi) * T _ {0}}{2 \pi}, & \text {if} \theta > \pi \\ \frac {\theta * T _ {0}}{2 \pi}, & \text {else} \end{array} , \text {and} \theta = [ \phi (\omega_ {0}) - \phi ] \% 2 \pi , \right. \tag{11} +$$ + +where $\mathrm{T}_0 / 2\pi = 1 / \omega_0$ . The calculated phase difference between the sample and given angle normalizes the phase change for the sinusoidal to exactly match the angle $\phi$ when shifted $\Delta \phi_{\mathbf{x}(t)}$ in the complex domain as in equations below. + +$$ +\mathcal {F} (\mathbf {x}) = | X (e ^ {j \omega}) | e ^ {j \phi (\omega)} e ^ {- j \omega \Delta \phi} \quad \text {a f t e r s h i f t i n g} \quad | X (e ^ {j \omega}) | e ^ {j \phi (\omega_ {0})} e ^ {- j \omega_ {0} (\theta / \omega_ {0})} \tag {12} +$$ + +$$ +\left| X \left(e ^ {j \omega_ {0}}\right) \right| e ^ {j \phi \left(\omega_ {0}\right)} e ^ {- j \omega_ {0} \left(\phi \left(\omega_ {0}\right) - \phi\right) / \omega_ {0}} \tag {13} +$$ + +$$ +\left| X \left(e ^ {j \omega_ {0}}\right) \right| e ^ {j \phi} \quad \text {f o r t h e s i n u s o i d a l w i t h f r e q u e n c y} \omega_ {0} \tag {14} +$$ + +# A.1.2 TRANSFORMATION AND DIFFEOMORPHISMS + +The observed samples $\mathbf{x}(t)$ from the sets with the (shift) variants are considered elements of manifolds $M^{\phi}$ according to the phase angle $\phi (\omega_0)$ of the harmonic with a period equal to or longer than the length of the segment $t$ , i.e., the specific harmonic with period $\mathrm{T}_0$ and frequency $\omega_0$ . In other words, if the phase angle of the harmonic $\omega_0$ is $\phi_{a}$ for a sample $\mathbf{x}(t)$ , the sample lies in manifold $\mathcal{M}^{\phi_a}$ . The mapping function $f:\mathcal{M}^{\phi_a}\to \mathcal{M}^{\phi_b}$ between manifolds is defined as $\mathcal{T}(\mathbf{x}(t),\phi_b) = (\tilde{\mathbf{x}} (t),\varDelta \phi_b)$ where $\mathbf{x}(t)$ lies in $\mathcal{M}^{\phi_a}$ , and $\tilde{\mathbf{x}} (t)$ lies in $\mathcal{M}^{\phi_b}$ . Similarly, the inverse mapping $f^{-1}:\mathcal{M}^{\phi_b}\rightarrow \mathcal{M}^{\phi_a}$ is represented as $\mathcal{T}(\tilde{\mathbf{x}} (t),\phi_a) = (\mathbf{x}(t),\varDelta \phi_a)$ . + +$\tilde{\mathbf{x}}(t)$ and $\mathbf{x}(t)$ only differ by a random time shift $t'$ where this random time shift can be calculated using the phase angles of harmonics with frequency $\omega_0$ , which makes the presented transformation a bijective function between time series manifolds. The differentiation of the mapping function at sample $\mathbf{x}(t)$ is shown as $Df_x: T_x\mathcal{M}^{\phi_a} \to T_{f_x}\mathcal{M}^{\phi_b}$ . + +# A.2 NOTATION LIST + +
NotationDescription
xTime series represented as a bold lowercase symbol
F(x)Discrete Fourier transformation of time series x
∠The complex argument for obtaining phase values
ωVariable that represents the frequencies in radian
|X(ejω)|Magnitude components of the Fourier transformation of a time series
φ(ω)Phase components of the Fourier transformation of a time series
ω0Frequency of the specific harmonic whose period is equal or longer than the sample x
T0 = 2π/ω0Period of the specific harmonic with frequency ω0
ΦRandom variable for phase angles, i.e., φ ~ Φ
φ(ω0)Phase angle of a specific harmonic with the frequency ω0
φx(t)Variable that represents phase angles of all harmonics for sample x(t)
φx(t-t')Variable that represents phase angles for sample x(t-t')
φx(t)(ω0)Phase angle of the specific harmonic with the frequency ω0 for sample x(t)
T(x,φ)The proposed transformation function
ΔφPhase difference between two angles
Δφx(t)Phase difference between the given angle φ in the transformation and the harmonic with frequency ω0 when sample x(t) is decomposed using Fourier transformation
Δφx(t-t')Phase difference between the given angle φ in the transformation and the harmonic with frequency ω0 when sample x(t-t') is decomposed using Fourier transformation
MφManifold notation with an angle φ
MφaA specific manifold with the angle φa
T(x,φa)The output of the transformation, i.e., a time series that lies on the manifold Mφa
F(T(x,φ))Fourier transformation of the output from the proposed transformation: Since the transformation function produces a tuple, we specifically apply the Fourier transformation to the first output, which corresponds to the time series.
fθ(.)Parametric mapping with parameter θ
fGθ: Rd→ΦThe guidance network that outputs an angle to map the sample to a specific manifold
fCθ: X→YThe classifier neural network
Var(.)Variance function
%Modulo operation
+ +Table 8: Detailed list of notations used in this work + +# A.3 PROOFS + +Lemma A.1 (Circular Shift). Given a sample $\mathbf{x}$ in the interval $[0, t_{int}]$ and its shifted version $\mathbf{x}(t - t')$ , where the shift is a random value from the finite real numbers, i.e., $t' \in (-\infty, \infty)$ . The shift is periodic with the signal length $t_{int}$ , leading to the same vector representation when the shift is an integer multiple of the signal length. + +$$ +\infty > t > | t ^ {\prime} | > - \infty , 0 = t ^ {\prime} (\mathrm {m o d} t _ {i n t}) \Longrightarrow \mathbf {x} (t) = \mathbf {x} (t - t ^ {\prime}) +$$ + +Proof. From circular shift, we know + +$$ +\mathbf {x} (t) = \mathbf {x} (t (\mathrm {m o d} t _ {\text {i n t}})) \tag {15} +$$ + +$$ +\mathbf {x} \left(t - t ^ {\prime}\right) = \mathbf {x} \left(\left(t - t ^ {\prime}\right) (\mathrm {m o d} t _ {i n t})\right) \tag {16} +$$ + +Therefore, $0 = t'$ (mod $t_{int}$ ) $\Longrightarrow \mathbf{x}(t) = \mathbf{x}(t - t')$ + +Throughout the proofs, the length of the samples and their intervals are denoted by the same variable $t$ . In other words, the samples are assumed to start at $t = 0$ and finish at $t_{int} = t$ . + +# A.4 PROOF FOR PROPOSITION 2.1 + +Proposition A.2 (Time shift as a Group Operation). Shift operation in time domain defines an Abelian Group of phase angles in the frequency domain for each harmonic with frequency $\omega_{k}$ + +$$ +\left(\Phi_ {k}, + \mod 2 \pi\right), \text {w h e r e} \Phi_ {k} = \phi \mid \phi = \left(\phi \left(\omega_ {k}\right) + \omega_ {k} t ^ {\prime}\right) \mod 2 \pi , t ^ {\prime} \in \mathbb {R} \tag {17} +$$ + +Proof. Let $\mathbf{x}(t + t^{\prime})$ be randomly shifted variant of sample $\mathbf{x}(t)$ where $t^\prime \in \mathbb{R}$ . We can decompose these two sequences as in below using Fourier transformation. + +$$ +\mathbf {x} (t) \xrightarrow {\mathcal {F} (\cdot)} | X (e ^ {j \omega}) | e ^ {j \phi (\omega)} \text {a n d} \mathbf {x} (t + t ^ {\prime}) \xrightarrow {\mathcal {F} (\cdot)} | X (e ^ {j \omega}) | e ^ {j (\phi (\omega) + \omega t ^ {\prime})} \tag {18} +$$ + +The phase values of these two time series for a harmonic at the given frequency can be expressed as follows. + +$$ +\phi_ {\mathbf {x} (t)} \left(\omega_ {k}\right) = \phi \left(\omega_ {k}\right) \text {a n d} \phi_ {\mathbf {x} \left(t - t ^ {\prime}\right)} \left(\omega_ {k}\right) = \phi \left(\omega_ {k}\right) + \omega_ {k} t ^ {\prime} \tag {19} +$$ + +Then, we can define a set of phase angles $\varPhi_{k}$ with shift values $t^\prime$ + +$$ +\Phi_ {k} = \left\{\phi \mid \phi = \left(\phi \left(\omega_ {k}\right) + \omega_ {k} t ^ {\prime}\right) \bmod 2 \pi , t ^ {\prime} \in \mathbb {R} \right\} \tag {20} +$$ + +This set of phase angles with time shift operation defines the circle group $\mathbb{T}$ . The circle group is Abelian (Fuchs, 1960), with time shifts corresponding to multiplication in the complex plane. For completeness, we have shown all the group axioms. + +# GROUP AXIOMS + +The set of phase angles with time shift, $\varPhi_{k}=\{\phi\mid\phi=(\phi(\omega_{k})+\omega_{k}t^{\prime})\mod 2\pi,t^{\prime}\in\mathbb{R}\}$ , satisfies the five axioms of an Abelian group under modular addition. + +# Axiom 1: Closure + +For any two phase angles $\phi_1, \phi_2 \in \varPhi_k$ , their sum is also in $\varPhi_k$ . + +Let $\phi_1 = (\phi(\omega_k) + \omega_k t_1') \mod 2\pi$ and $\phi_2 = (\phi(\omega_k) + \omega_k t_2') \mod 2\pi$ . Then their sum is: + +$$ +\phi_ {1} + \phi_ {2} = \left(\phi \left(\omega_ {k}\right) + \omega_ {k} t _ {1} ^ {\prime} + \phi \left(\omega_ {k}\right) + \omega_ {k} t _ {2} ^ {\prime}\right) \mod 2 \pi +$$ + +$$ +\phi_ {1} + \phi_ {2} = \left(\phi \left(\omega_ {k}\right) + \omega_ {k} \left(t _ {1} ^ {\prime} + t _ {2} ^ {\prime}\right)\right) \mod 2 \pi +$$ + +Since $t_1' + t_2' \in \mathbb{R}$ , the sum is also in $\varPhi_k$ , so closure holds. + +# Axiom 2: Associativity + +For any three phase angles $\phi_1, \phi_2, \phi_3 \in \varPhi_k$ , their sum is associative under addition modulo $2\pi$ . + +$$ +\left(\left(\phi_ {1} + \phi_ {2}\right) \mod 2 \pi\right) + \phi_ {3}) \mod 2 \pi = \left(\phi_ {1} + \left(\phi_ {2} + \phi_ {3}\right) \mod 2 \pi\right) \mod 2 \pi +$$ + +Let $\phi_1 = (\phi(\omega_k) + \omega_k t_1') \mod 2\pi$ , $\phi_2 = (\phi(\omega_k) + \omega_k t_2') \mod 2\pi$ , and $\phi_3 = (\phi(\omega_k) + \omega_k t_3') \mod 2\pi$ . Then: + +$$ +\begin{array}{l} \left(\left(\phi_ {1} + \phi_ {2}\right) \mod 2 \pi\right) + \phi_ {3} = \left(\phi (\omega_ {k}) + \omega_ {k} t _ {1} ^ {\prime} + \omega_ {k} t _ {2} ^ {\prime}\right) \mod 2 \pi + \phi_ {3} \\ = \left(\phi (\omega_ {k}) + \omega_ {k} (t _ {1} ^ {\prime} + t _ {2} ^ {\prime}) \mod 2 \pi + \omega_ {k} t _ {3} ^ {\prime}\right) \mod 2 \pi \\ \end{array} +$$ + +Similarly, for the right-hand side: + +$$ +\begin{array}{l} \phi_ {1} + \left(\left(\phi_ {2} + \phi_ {3}\right) \mod 2 \pi\right) = \phi_ {1} + \left(\phi (\omega_ {k}) + \omega_ {k} \left(t _ {2} ^ {\prime} + t _ {3} ^ {\prime}\right) \mod 2 \pi\right) \\ = \left(\phi \left(\omega_ {k}\right) + \omega_ {k} t _ {1} ^ {\prime} + \omega_ {k} \left(t _ {2} ^ {\prime} + t _ {3} ^ {\prime}\right)\right) \mod 2 \pi \\ \end{array} +$$ + +Using $(a + b) \mod 2\pi = ((a \mod 2\pi) + (b \mod 2\pi)) \mod 2\pi$ , both sides simplify to $(\phi(\omega_k) + \omega_k(t_1' + t_2' + t_3')) \mod 2\pi$ . Thus, associativity holds under addition modulo $2\pi$ . + +Axiom 3: Identity Element + +The identity element in this group is the phase angle when no time shift has occurred, i.e., $t' = 0$ . + +$$ +\phi_ {0} = \left(\phi \left(\omega_ {k}\right) + \omega_ {k} \cdot 0\right) \mod 2 \pi = \phi \left(\omega_ {k}\right) +$$ + +For any $\phi_1\in \varPhi_k$ , we have: + +$$ +\phi_ {1} + \phi_ {0} = \phi_ {1} +$$ + +Thus, $\phi_0$ is the identity element. + +Axiom 4: Inverse Element + +For any phase angle $\phi_{1} = (\phi (\omega_{k}) + \omega_{k}t^{\prime})$ mod $2\pi$ , its inverse is: + +$$ +\phi_ {1} ^ {- 1} = \left(- \omega_ {k} t ^ {\prime}\right) \mod 2 \pi +$$ + +Then: + +$$ +\phi_ {1} + \phi_ {1} ^ {- 1} = \left(\phi \left(\omega_ {k}\right) + \omega_ {k} t ^ {\prime} - \omega_ {k} t ^ {\prime}\right) \mod 2 \pi = \phi \left(\omega_ {k}\right) +$$ + +Thus, each element has an inverse. + +Axiom 5: Commutativity + +For any two phase angles $\phi_1, \phi_2 \in \varPhi_k$ , the sum is commutative: + +$$ +\phi_ {1} + \phi_ {2} = \phi_ {2} + \phi_ {1} +$$ + +This follows from the commutativity of modular addition, so the group is Abelian. + +Proposition 2.1 states that shift operation in time domain defines an Abelian group of phase angles for each harmonic. Proposition 2.1 holds a key role in our algorithm, as it establishes an abstract connection between the time-domain shift operation and its effects on samples in the frequency domain. + +# A.4.1 PROOF FOR THEOREM 2.2 + +Theorem A.3 (Covering the Entire Time Space Injectively). Given a sample $\mathbf{x}$ , the defined function $\mathcal{T}(\mathbf{x},\phi):\varPhi\times\mathbb{R}^d\to\mathbb{R}^d\times\varDelta\varPhi$ is bijective such that all shift variants of a sample can be covered with the unique phase angle of a harmonic whose period is longer or equal to the length of $\mathbf{x}$ . + +$$ +\forall \phi_ {a}, \phi_ {b} \in \varPhi , \mathcal {T} (\mathbf {x}, \phi_ {a}) = \mathcal {T} (\mathbf {x}, \phi_ {b}) \Longrightarrow \phi_ {a} = \phi_ {b} +$$ + +$$ +\forall t ^ {\prime} \in \mathbb {R}, \exists \phi \in \Phi , \mathcal {T} (\mathbf {x}, \phi) = (\mathbf {x} (t - t ^ {\prime}), \Delta \phi), +$$ + +Proof. + +$$ +\mathbf {x} (t) \xrightarrow {\mathcal {F} (\cdot)} | X (e ^ {j \omega}) | e ^ {j \phi (\omega)} \tag {21} +$$ + +$$ +\mathbf {x} \left(t - t ^ {\prime}\right) \xrightarrow {\mathcal {F} (.)} | X \left(e ^ {j \omega}\right) | e ^ {j (\phi (\omega) - \omega t ^ {\prime})} \tag {22} +$$ + +$$ +\phi_ {\mathbf {x} (t)} = \phi (\omega), \quad \phi_ {\mathbf {x} (t - t ^ {\prime})} = \phi (\omega) - \omega t ^ {\prime} \tag {23} +$$ + +$$ +\phi_ {\mathbf {x} (t)} - \phi_ {\mathbf {x} (t - t ^ {\prime})} = \omega t ^ {\prime}, \tag {24} +$$ + +Using Euler's formula, + +$$ +\phi_ {\mathbf {x} (t)} - \phi_ {\mathbf {x} (t - t ^ {\prime})} = (\omega t ^ {\prime}) (\mathrm {m o d} 2 \pi) \tag {25} +$$ + +$$ +\phi_ {\mathbf {x} (t)} - \phi_ {\mathbf {x} (t - t ^ {\prime})} = \left(\frac {2 \pi}{T} t ^ {\prime}\right) (\mathrm {m o d} 2 \pi) \tag {26} +$$ + +$$ +\forall T _ {0} \in T, \infty > T _ {0} \geq t \Rightarrow \phi_ {\mathbf {x} (t)} (\omega_ {0}) - \phi_ {\mathbf {x} (t - t ^ {\prime})} (\omega_ {0}) = \frac {2 \pi}{T _ {0}} t ^ {\prime} \tag {27} +$$ + +Thus, + +$$ +\phi_ {\mathbf {x} (t)} \left(\omega_ {0}\right) - \phi_ {\mathbf {x} \left(t - t ^ {\prime}\right)} \left(\omega_ {0}\right) = \phi_ {\mathbf {x} (t)} \left(\omega_ {0}\right) - \phi_ {\mathbf {x} \left(t - t ^ {\prime}\right)} \left(\omega_ {0}\right) \Longrightarrow t ^ {\prime} = t ^ {\prime} \tag {28} +$$ + +Also, + +$$ +\forall T _ {0} \in T, \infty > t > T _ {0} \Rightarrow \phi_ {\mathbf {x} (t)} (\omega_ {0}) - \phi_ {\mathbf {x} (t - t ^ {\prime})} (\omega_ {0}) = \left(\frac {2 \pi}{T _ {0}} t ^ {\prime}\right) \mod 2 \pi , \tag {29} +$$ + +$$ +\because \exists t ^ {\prime} \in \mathbb {R}, \left(\frac {2 \pi}{T _ {0}} t ^ {\prime}\right) > 2 \pi \tag {30} +$$ + +$$ +\therefore \exists t ^ {\prime}, t ^ {\prime} \in \mathbb {R}, \neg \left(\phi_ {\mathbf {x} (t)} \left(\omega_ {0}\right) - \phi_ {\mathbf {x} \left(t - t ^ {\prime}\right)} \left(\omega_ {0}\right) = \phi_ {\mathbf {x} (t)} \left(\omega_ {0}\right) - \phi_ {\mathbf {x} \left(t - t ^ {\prime}\right)} \left(\omega_ {0}\right) \Longrightarrow t ^ {\prime} = t ^ {\prime}\right), \tag {31} +$$ + +which proves injection. Similarly, for surjection using Lemma A.1, + +$$ +\forall t ^ {\prime} \in \mathbb {R}, \infty > T _ {0} \geq t > | t ^ {\prime} | \Rightarrow \phi_ {\mathbf {x} (t)} (\omega_ {0}) - \phi_ {\mathbf {x} (t - t ^ {\prime})} (\omega_ {0}) = \frac {2 \pi}{T _ {0}} t ^ {\prime} \tag {32} +$$ + +![](images/84bcfefb558bcd9be40dcea6ed277bc64db73473f31ed7d6d11370db53dbce43.jpg) + +The final equation completes the proof by showing that the phase difference between the sample and its shifted version can get unique values for any shift, i.e., covering the whole time space. + +# A.4.2 PROOF FOR THEOREM 2.3 + +Theorem A.4 (Guarantees for Shift-Invariancy). Given a sample $\mathbf{x}$ and a randomly shifted variant of it $\mathbf{x}(t - t')$ , if the transformation function $\mathcal{T}(\mathbf{x},\phi)$ is applied to both samples with the same angle $\phi_{a}$ , the resulting time series will be the same while carrying the same information. + +$$ +\mathcal {T} (\mathbf {x} (t), \phi_ {a}) = \left(\tilde {\mathbf {x}} (t), \varDelta \phi_ {\mathbf {x} (t)}\right), \quad \mathcal {T} (\mathbf {x} (t - t ^ {\prime}), \phi_ {a}) = \left(\tilde {\mathbf {x}} (t), \varDelta \phi_ {\mathbf {x} (t - t ^ {\prime})}\right) +$$ + +Proof. + +$$ +\mathbf {x} (t) \xrightarrow {\mathcal {F} (\cdot)} | X (e ^ {j \omega}) | e ^ {j \phi (\omega)}, \quad \mathbf {x} (t - t ^ {\prime}) \xrightarrow {\mathcal {F} (\cdot)} | X (e ^ {j \omega}) | e ^ {j \phi (\omega)} e ^ {\omega t ^ {\prime}} \tag {33} +$$ + +$$ +\phi_ {\mathbf {x} (t)} = \phi (\omega), \quad \phi_ {\mathbf {x} (t - t ^ {\prime})} = \phi (\omega) - \omega t ^ {\prime} \tag {34} +$$ + +$$ +\phi_ {\mathbf {x} (t - t ^ {\prime})} - \phi_ {\mathbf {x} (t)} = - \omega t ^ {\prime} \tag {35} +$$ + +Using Equation 11, the phase difference between samples $(\mathbf{x}(t),\mathbf{x}(t - t'))$ and $\phi_{a}$ can be obtained as, + +$$ +\Delta \phi_ {\mathbf {x} (t)} = \frac {[ \phi (\omega_ {0}) - \phi_ {a} ]}{2 \pi} \cdot T _ {0}, \quad \Delta \phi_ {\mathbf {x} (t - t ^ {\prime})} = \frac {[ \phi (\omega_ {0}) - \omega_ {0} t ^ {\prime} - \phi_ {a} ]}{2 \pi} \cdot T _ {0} \tag {36} +$$ + +$$ +\Delta \phi_ {\mathbf {x} (t - t ^ {\prime})} - \Delta \phi_ {\mathbf {x} (t)} = - \omega_ {0} t ^ {\prime} \frac {T _ {0}}{2 \pi} \tag {37} +$$ + +Using Fourier transform as in Equation 4, + +$$ +\mathcal {F} \left\{\mathcal {T} (\mathbf {x} (t), \phi_ {a}) \right\} = | X (e ^ {j \omega}) | e ^ {j \phi (\omega)} e ^ {- j \omega \Delta \phi_ {\mathbf {x}} (t)} \tag {38} +$$ + +$$ +\mathcal {F} \left\{\mathcal {T} \left(\mathbf {x} \left(t - t ^ {\prime}\right), \phi_ {a}\right) \right\} = | X \left(e ^ {j \omega}\right) | e ^ {j \phi (\omega)} e ^ {- j \omega t ^ {\prime}} e ^ {- j \omega \Delta \phi_ {\mathbf {x} _ {(t - t ^ {\prime})}}} \tag {39} +$$ + +Given that the amplitudes are identical, demonstrating equality in phase is sufficient, as shown below, + +$$ +\phi_ {\mathcal {T} (\mathbf {x} (t), \phi_ {a})} = \phi (\omega) - \omega \Delta \phi_ {\mathbf {x} (t)}, \quad \phi_ {\mathcal {T} (\mathbf {x} (t - t ^ {\prime}), \phi_ {a})} = \phi (\omega) - \omega t ^ {\prime} - \omega \Delta \phi_ {\mathbf {x} _ {(t - t ^ {\prime})}} \tag {40} +$$ + +$$ +\phi_ {\mathcal {T} (\mathbf {x} (t - t ^ {\prime}), \phi_ {a})} - \phi_ {\mathcal {T} (\mathbf {x} (t), \phi_ {a})} = - \omega t ^ {\prime} - \omega \Delta \phi_ {\mathbf {x} _ {(t - t ^ {\prime})}} + \omega \Delta \phi_ {\mathbf {x} (t)} \tag {41} +$$ + +$$ +\phi_ {\mathcal {T} (\mathbf {x} (t - t ^ {\prime}), \phi_ {a})} - \phi_ {\mathcal {T} (\mathbf {x} (t), \phi_ {a})} = - \omega t ^ {\prime} - \omega [ \Delta \phi_ {\mathbf {x} _ {(t - t ^ {\prime})}} - \Delta \phi_ {\mathbf {x} (t)} ] \tag {42} +$$ + +$$ +\phi_ {\mathcal {T} (\mathbf {x} (t - t ^ {\prime}), \phi_ {a})} - \phi_ {\mathcal {T} (\mathbf {x} (t), \phi_ {a})} = - \omega t ^ {\prime} - \omega \left[ - \omega_ {0} t ^ {\prime} \frac {T _ {0}}{2 \pi} \right] \tag {43} +$$ + +$$ +\phi_ {\mathcal {T} (\mathbf {x} (t - t ^ {\prime}), \phi_ {a})} - \phi_ {\mathcal {T} (\mathbf {x} (t), \phi_ {a})} = - \omega t ^ {\prime} + \omega \left[ \frac {2 \pi}{T _ {0}} t ^ {\prime} \frac {T _ {0}}{2 \pi} \right] \tag {44} +$$ + +$$ +\phi_ {\mathcal {T} (\mathbf {x} (t - t ^ {\prime}), \phi_ {a})} - \phi_ {\mathcal {T} (\mathbf {x} (t), \phi_ {a})} = - \omega t ^ {\prime} + \omega t ^ {\prime} \tag {45} +$$ + +$$ +\phi_ {\mathcal {T} (\mathbf {x} (t - t ^ {\prime}), \phi_ {a})} = \phi_ {\mathcal {T} (\mathbf {x} (t), \phi_ {a})} \tag {46} +$$ + +$$ +\mathcal {F} \left\{\mathcal {T} (\mathbf {x} (t), \phi_ {a}) \right\} = | X \left(e ^ {j \omega}\right) \left| e ^ {j \phi_ {\mathcal {T}} (\mathbf {x} (t), \phi_ {a})} \right. \tag {47} +$$ + +$$ +\mathcal {F} \left\{\mathcal {T} \left(\mathbf {x} \left(t - t ^ {\prime}\right), \phi_ {a}\right) \right\} = | X \left(e ^ {j \omega}\right) | e ^ {j \phi_ {\mathcal {T}} \left(\mathbf {x} \left(t - t ^ {\prime}\right), \phi_ {a}\right)} \tag {48} +$$ + +Therefore, the output time series samples will be the same after applying the transformation. + +We complete the proof by showing the phase and magnitude of Fourier transformation of both samples are the same after transformation even though a random unknown shift is applied to the sample. Thus, the proposed transformation guarantees shift-invariancy without limiting the range of shifts. + +# B ALGORITHM + +In this section, we present the pseudocode and the PyTorch (Paszke et al, 2019) implementation for the proposed transformation function. Algorithm 1 details each step of the transformation, which takes a sample, $\mathbf{x}$ , and an angle, $\phi$ as inputs and outputs the transformed sample. + +1: Input: $\mathbf{x}$ , $\phi_{a}$ +2: Output: $\mathcal{T}(\mathbf{x},\phi_a)$ + +3: $|X(e^{j\omega})|e^{j\phi(\omega)} = \int_{-\infty}^{\infty} \mathbf{x}(t)e^{-j\omega t}$ + +$\triangleright$ Calculate the Fourier transformation to obtain harmonics + +4: $\phi (\omega_0) = \angle \left(|X(e^{j\omega_0})|e^{j\phi (\omega_0)}\right)$ + +Obtain the angle for the harmonic with period $\mathrm{T_0}$ + +5: $\theta = [\phi (\omega_0) - \phi_a]\% 2\pi$ + +6: $\Delta \phi = \left\{ \begin{array}{ll} \frac{(\theta - 2\pi)*T_0}{2\pi}, & \text{if } \theta > \pi \\ \frac{\theta*T_0}{2\pi}, & \text{else} \end{array} \right.$ + +$\triangleright$ Calculate the phase difference between the harmonic and the angle $\phi$ + +7: $|X(e^{j\omega})|e^{j(\phi (\omega) - \omega \Delta \phi)} = |X(e^{j\omega})|e^{j\phi (\omega)}*e^{-j\omega \Delta \phi}$ + +Apply a linear phase shift to each harmonic + +8: Return: $\mathcal{F}^{-1}(|X(e^{j\omega})|e^{j(\phi (\omega) - \omega \Delta \phi)})$ + +Below, we provide the PyTorch implementation of our proposed transformation function, which includes two functions. The first function, distanceCalculate, computes the phase difference between the harmonic with frequency $\omega_0$ and the desired input angles. The second function, diffeomorphism, performs the main transformation: it takes as inputs the batch of samples $\mathbf{x}$ and the angles $\phi$ , and outputs the transformed samples in the time domain. + +Algorithm 1 Algorithm for the proposed diffeomorphism. +```python +def distanceCalculate(angleDiff): + theta = angleDiff % (2 * torch.pi) + # Calculate the angular distance on the unit circle + theta[theta > torch.pi] == 2 * torch.pi + return theta +def diffeomorphism(sample, desiredAngles): + B, L, D = sample.shape + samplesFFT = torch fft.rfft(sample, dim=1) + freq = torch fft.rfftfreq(n=L) + phAngle = torch.angle(sampleFFT) + # Get the phase angle of the harmonic with frequency T_0 + angles = phAngle[torch/arange(phAngle.size(0)), 1, 0].squeeze() + # Calculate the angle difference + theta = distanceCalculateAngles-desiredAngles) + #Normalize it to the sepecific harmonic with frequency w_0 + dtheta = theta / (2*torch.pi*freq[1]) + #Create complex exponentials with specific phase values + linShift = torch.exp(-1j*2*torch.pi*freq[None,:]*dtheta[:, None]) + linShift = linShift.unsqueeze(dim=2).expand(-1, -1, D) + #Apply a linear phase shift to all harmonics + shiftedFFT = linShift*(samplesFFT) + #Return to the time domain + transformedSamples = torch.fft.irfftshiftedFFT, n=L, dim=1) + return transformedSamples +``` + +Implementation 1: PyTorch implementation of the proposed transformation + +# C EXPERIMENTS + +Here, we give a detailed description of datasets, architectures, metrics, and training details for our experiments. We performed our experiments on NVIDIA GeForce RTX 4090 GPUs, involving training with three random seeds for all datasets, totaling approximately 480 GPU hours including ablation. We reported the mean of three runs with the standard deviation. + +# C.1 DATASETS + +In this section, we give details about the datasets that are used during our experiments. Overall, we have used eight datasets with six different time series tasks including heart rate prediction, cardiovascular disease classification, activity recognition, step counting, sleep stage classification, and lung sound classification from six sensor modalities photoplethysmography, electrocardiogram, inertial measurement units, electroencephalography, and audio. When selecting datasets for our experiments, we prioritized signals that provide meaningful insights into individuals' mental and physical health, where robust inference is particularly critical. Therefore, we specifically choose signals generated by humans. Additional to main experiments, in appendix, we also included lung audio classification from audio signals. + +# C.1.1 HEART RATE PREDICTION + +IEEE SPC The IEEE SPC dataset overall has 22 recordings of 22 subjects, ages ranging from 18 to 58 performing three different activities (Rocha et al., 2020). Each recording has sampled data from three accelerometer signals and two PPG signals along with the ECG data with a sampling frequency of $125\mathrm{Hz}$ . All these recordings were recorded from the wearable device placed on the wrist of each individual. All recordings were captured with two 2-channel PPGs with green LEDs, a tri-axial accelerometer, and a chest ECG for the ground-truth HR estimation. We averaged the two channels of PPG for prediction. We choose the last five subjects of SPC22 to be used for source domains. Throughout our experiments, we used PPG channels without integrating any inertial measurements. + +Dalia The PPG dataset for motion compensation and heart rate estimation in Daily Life Activities (DaLiA) was recorded from 15 subjects (8 females, 7 males, mean age of 30.6), where each recording was approximately two hours long. PPG signals were recorded while subjects went through different daily life activities, for instance sitting, walking, driving, cycling, working, and so on. PPG signals were recorded at a sampling rate of $64\mathrm{Hz}$ . The first five subjects are used as source domains, similar to Demirel & Holz (2023). + +We standardize all PPG datasets as follows, same as the previous works (Biswas et al., 2019). Initially, a fourth-order Butterworth bandpass filter with a frequency range of $0.5 - 4\mathrm{Hz}$ is applied to PPG signals. Subsequently, a sliding window of 8 seconds with 2-second shifts is employed for segmentation, followed by z-score normalization of each segment. Lastly, the signal is resampled to a frequency of $25\mathrm{Hz}$ for each segment. We used an 8-block ResNet model with a stride of 2, a learning rate of $5e - 4$ and a batch size of 32. Additional results with further experiments can be found in Appendix D. + +# C.1.2 HUMAN ACTIVITY RECOGNITION + +UCIHAR Human activity recognition using a smartphone's dataset (UCIHAR) (Anguita et al., 2012) is collected by 30 subjects within the age range of 16 to 48 performing six daily living activities with a waist-mounted smartphone. Six activities include walking, sitting, lying, standing, walking upstairs, and walking downstairs. Data is captured by 3-axial linear acceleration and 3-axial angular velocity at a constant rate of $50\mathrm{Hz}$ . We used the pre-processing technique the same as in (Qian et al., 2021) such that the input contains nine channels with 128 features (it is sampled in a sliding window of 2.56 seconds and $50\%$ overlap, resulting in 128 features for each window). Windows are normalized to a mean of zero and unit standard deviation before feeding it to the models. The experiments are conducted with a leave-one-domain-out strategy with the first five subjects, where one of the domains is chosen to be the unseen target (Qian et al., 2022). We used an 8-block ResNet model with a stride of 2, a learning rate of $3e - 3$ , and a batch size of 32. + +HHAR Heterogeneity Dataset for Human Activity Recognition (HHAR) is collected by nine subjects within an age range of 25 to 30 performing six daily living activities with eight different smartphones—Although HHAR includes data from smartwatches as well, we use data from smartphones—that were kept in a tight pouch and carried by the users around their waists (Stisen et al., 2015). Subjects then perform six activities including cycling, sitting, descending stairs, ascending stairs, standing, and walking. Considering the variable sampling frequencies of smart devices in the HHAR dataset, we downsampled the readings to $50\mathrm{Hz}$ . We employed sliding windows with lengths of 100 (two seconds) and 50, using a specified step size. These windows were then normalized to a mean of zero with unit standard deviation. In our experiments, we utilized the data from the first four subjects (i.e., a, b, c, d) as source domains, following a similar approach to previous papers (Qian et al., 2022; Demirel & Holz, 2023). We used an 8-block ResNet model with a stride of 2, a learning rate of $1e-3$ , and a batch size of 64. The learning rate $1e-3$ for the guidance network, was the same for the activity recognition task. + +# C.1.3 CARDIOVASCULAR DISEASE (CVD) CLASSIFICATION + +Chapman Chapman University, Shaoxing People's Hospital (Chapman) ECG dataset which provides 12-lead ECG with a 10-second sampling rate of $500\mathrm{Hz}$ . The recordings are downsampled to $100\mathrm{Hz}$ , resulting in each ECG frame consisting of 1000 samples. The labeling setup follows the same approach as in Zheng et al. (2020) with four classes: atrial fibrillation, GSVT, sudden bradycardia, and sinus rhythm. The ECG frames are normalized to have a mean of 0 and scaled to have a standard deviation of 1. We split the dataset to $80 - 20\%$ for training and testing as suggested in Zheng et al. (2020). We chose leads I, II, III, and V2 during our experiments for both ECG datasets. + +PhyioNet 2017 The 2017 PhysioNet/CinC Challenge aims to classify, from 8,528 single-lead ECG recordings (between 30 s and 60 s in length), whether the recording shows normal sinus rhythm, atrial fibrillation (AF), an alternative rhythm, or is too noisy to be classified, i.e., four classes. We normalize the signals to have zero mean and unit standard deviation. Additionally, we zero-pad the shorter recordings to ensure they have the same length. We split the dataset into training, validation, and test sets according to the patients using a 60, 20, 20 configuration. + +For both datasets in CVD task, we used an 8-block ResNet model with a stride of 2, a learning rate of $5e - 4$ , and a batch size of 32. The learning rate for the guidance network was set same as the main classifier architecture. + +# C.1.4 STEP COUNTING + +The Clemson dataset has 30 participants (15 males, 15 females), Each participant wore three Shimmer3 sensors. We used the IMU sensor readings from non-dominant wrists to predict step count where each sensor recorded accelerometer and gyroscope data at $15\mathrm{Hz}$ . We calculated the total magnitude of the accelerometer and fed it to the model as a pre-processing without any filtering. We used window lengths of 32 seconds without an overlap in the regular walking setting. We conducted 10-fold cross-validation, with each fold consisting of 3 subjects for testing and validation. And, six randomly selected subjects were used for training in each fold. We used a 3 layer of FCN architecture, a learning rate of $5e - 4$ , and a batch size of 64 . The learning rate for the guidance network was set same as the main classifier architecture. + +# C.1.5 SLEEP STAGE CLASSIFICATION + +We used the Sleep-EDF dataset which has five classes: wake (W), three different non-rapid eye movements (N1, N2, N3), and rapid eye movement (REM). The dataset includes whole-night PSG sleep recordings, where we used a single EEG channel (i.e., Fpz-Cz) with a sampling rate of $100\mathrm{Hz}$ . We employed the identical data split as presented in the paper (Eldele et al., 2021), accessible online, without applying any additional pre-processing steps. We used a 16-block ResNet model with a stride of 2, a learning rate of $1e - 3$ and a batch size of 64. We ran three distinct seeds using the same split and reported the mean and standard deviation on the test set. + +# C.1.6 LUNG SOUND CLASSIFICATION + +We used Respiratory@TR which contains lung sounds recorded from left and right sides of posterior and anterior chest wall and back using two digital stethoscopes from 42 subjects collected in Antakya State Hospital (Altan et al., 2017). The 12 channels of lung sounds are focused on upper lung, middle lung, lower lung and costophrenic angle areas of posterior and anterior sides of the chest. The recordings are validated and labeled by two pulmonologists evaluating the collected chest X-ray, PFT and auscultation sounds of the subjects. Labels fall into 5 COPD severities (COPD0, COPD1, COPD2, COPD3, COPD4). The patients aged 38 to 68 are selected from different occupational groups, socio-economic status and genders. We performed 10-fold cross-validation on data from 42 subjects, with one fold reserved for validation in each iteration. All 12 channels, combining left and right chest wall recordings from six channels each, were used. + +The audio was segmented into 8-second windows with a 2-second overlap to capture temporal patterns. We used an 8-block ResNet model with a stride of 3, a learning rate of $1e - 5$ , and a batch size of 15. Although audio models typically use Mel-frequency spectrograms with different networks, we did not observe a significant performance difference between these models and our initial model. Therefore, we used the original model with temporal data, consistent with our main experiments. + +# C.2 METRICS + +We used the common evaluation metrics in the literature for each task. Specifically, we used mean absolute error (MAE), root mean square error (RMSE), and Pearson correlation coefficient $(\rho)$ for heart rate prediction. We used accuracy (Acc), macro-F1 score (F1) for activity recognition, and an additional area under the receiver operating characteristic curve (AUC) for cardiovascular disease classification (Kiyasseh et al., 2020). We used the mean absolute percentage error (MAPE) for step counting (Yang et al., 2020; Femiano et al., 2022). For lung audio classification, we evaluated performance using accuracy, macro F1, and weighted F1 scores (F1, W-F1). For sleep stage classification, we used the same metrics—accuracy, macro F1, and weighted F1 scores (F1, W-F1)—along with Cohen's Kappa coefficient $(\kappa)$ (Cohen, 1960). + +# C.3 BASELINES + +# C.3.1 LPF (BLURRING) + +In convolutional neural networks, pooling layers or convolutions with strides greater than 2 would conduct downsampling on the feature maps to reduce their size. However, since features are averaged or discarded in the downsampling, information may be lost, i.e., aliasing. Traditional pooling aggregates all values within the window to a single value. In contrast, Zhang (2019) aims to minimize information loss caused by pooling via replacing the traditional kernel with a Gaussian kernel as an low-pass filtering (LPF). Specifically, LPF applies a Gaussian-weighted function to the neighborhood values around each feature for convolution, and obtains a weighted average result. + +Compared to the pooling operations of simply selecting the maximum/average value within the window, LPF uses Gaussian-weighted averages to preserve the relative positions and spatial relationships between features. In our implementations, we used 1D version of LPF with a length of 5. We evaluated filter lengths of 3, 5, 7 to determine the optimum size for each task. During our experiments, we observed the best performance with a filter length of 5, except for HR prediction, where a length of 3 was optimal. + +# C.3.2 APS + +To make the sampling layer invariant to shifts, Chaman & Dokmanic (2021) proposed to subsample by partitioning feature maps into polyphase components and select the component with the highest norm. This approach has a significant limitation when applied to time series, especially with the nonlinear activation functions. It tends to overlook variations in boundaries arising from the translation of samples, thereby imposing additional shift constraints (Rojas-Gomez et al., 2022). Consequently, the evaluation of these methods is restricted to a narrow range of shifts, covering only a limited subset of the shift space. Moreover, as this approach selects the component with the highest norm, it requires feature maps to have unique values. + +# C.3.3 WAVELET NETWORKS + +Wavelet networks (Romero et al., 2024) consist of several stacked layers that respect scale and translation. At the beginning, the network consists of a lifting group convolution layer that lifts input time-series to the scale-translation group, followed by arbitrarily many group convolutional layers. At the end of the network, a global pooling layer is used to produce scale-translation invariant representations. Wavelet Networks are proposed for equivariant mappings between input and output. However, to turn an equivariant network into an invariant network, an extra layer that is equivariant in this degenerate sense (in practice, this often means either averaging or creating a histogram of the activations of the last layer) should be applied (Kondor & Trivedi, 2018). For example, the well-known wavelet scattering network achieves invariance by stacking equivariant layers followed by a final invariant one in that of scattering networks (Mallat, 2012). However, our proposed method does not require an additional layer as it operates on data manifolds directly. + +We used the original GitHub (https://github.com/dwromero/wavelet_networks) implementation, leaving the dropout and base parameters unchanged. We searched over the learning rate (e.g., $\{10^{-3}, 10^{-4}, 10^{-5}\}$ ) using the validation set for each time series task. + +# C.3.4 CANONICALIZATION + +We also compared our method with a canonicalization approach which is based on learning mappings to canonical samples. Specifically, we used the equiadapt library (https://github.com/arnab39/equiadapt) (Mondal et al., 2023; Kaba et al., 2023) while adding translation equivariant architectures for shift operations. For translation equivariant canonicalization architecture, we implemented a convolutional neural network with a kernel size of five and three layers. The network avoids pooling layers to prevent aliasing and instead employs global average pooling at the final stage to aggregate information across the signal length. The output is reshaped to separate the channels corresponding to each discrete translation, followed by aggregation over the fiber channels to produce translation-equivariant activations. + +We used a discrete Group representation with number of translations set to 16. The canonicalization network and classifier were trained jointly, incorporating a prior regularization loss to guide the learning process. For optimization, we employed the Adam optimizer with a learning rate of $1 \times 10^{-3}$ and no weight decay. We also performed a grid search to identify the optimal learning rate for the canonicalization network; however, no significant performance improvements were observed across different learning rates. + +# C.4 IMPLEMENTATION DETAILS + +Here, we have provided the details of the architectures, and hyperparameters. Primarily, we used the 1D ResNet (Hong et al., 2020) implementation in the supervised settings. While some alternative deep learning models can perform better in time series such as the combination of convolutional and LSTM layers, similar to previous works in shift consistency (Zhang, 2019), we focused on deep learning models which are mainly composed of convolutional layers. + +# C.4.1 ARCHITECTURES + +Here, we present the details of architectures that are investigated for the performance of shift-invariant techniques. Some details that are not given in the tables are as follows. Batch normalization (Ioffe & Szegedy, 2015) is applied after each convolutional block. ReLU activation is employed following batch normalization, in line with (He et al., 2015). We also applied a Dropout (Srivastava et al., 2014) with 0.5 after each activation and before the convolutions. Finally, a global average pooling is implemented before the linear layers. + +Tables 9, 10a, and 10b give an overall for the architectures with the number of parameters for each dataset. From these tables, it can be observed that the number of parameters for the guidance network is much less than the main classifier, where the ratio is close to $\approx 2 - 4\%$ . + +The parameter count of the guidance network could be further reduced by selectively inputting only the important frequencies or the frequency band for each time series task, which can be determined using prior knowledge, rather than the entire spectrum. Nevertheless, for the sake of consistency, we + +Table 9: ResNet architecture + +
RepetitionLayerKernel SizeOutput SizeStride
1Input (C,T)-(C, T)-
1Conv(5, 1)(64, T/2)1
RResidual Block
Conv(5, 1)(128, T/4)S
Conv(5, 1)(128, T/4)1
1Linear-(n_classes,,)-
# Parameters for dataset (C,T, R, S)
IEEE SPC (C=1, T=200, R=8, S=2)≈210k
DaLiA (C=1, T=200, R=8, S=2)≈210k
Chapman (C=4, T=1000, R=8, S=2)≈197k
PhysioNet (C=1, T=6000, R=8, S=2)≈197k
UCIHAR (C=9, T=65, R=8, S=2)≈200k
HHAR (C=6, T=51, R=8, S=2)≈200k
Respiratory (C=12, T=6000, R=8, S=3)≈200k
Sleep (C=1, T=3000, R=16, S=2)≈3.2M
+ +Table 10: The model topologies of the classifier $f_{C}$ and guidance network $f_{G}$ +(a) FCN architecture + +
LayerKernel SizeOutput Size
Input (C,T)-(C, T)
Conv (32 kernels)(8, 1)(32, T-4)
Max Pooling(2,1)(32, (T-4)/2)
Conv (64 kernels)(8, 1)(64, (T-4)/2-4)
Max Pooling(2,1)(64, (T-4)/4-2)
Conv (128 kernels)(8, 1)(128, (T-4)/4-6)
Max Pooling(2,1)(128, (T-4)/8-3)
Linear-(n_classes,,)
# Parameters for dataset (C,T)
Clemson (C=1, T=240)≈432k
+ +(b) Guidance architecture + +
LayerKernel SizeOutput Size
Input (C,T)—(C, T)
Conv (4 kernels)(8, 1)(4, T-5)
Max Pooling(2,1)(4, (T-5)/2+1)
Conv (16 kernels)(5, 1)(16, (T-5)/2-1)
Max Pooling(2,1)(16, (T-5)/4+1)
Conv (32 kernels)(3, 1)(32, (T-5)/4+1)
Max Pooling(2,1)(32, (T-5)/8+1)
Linear-(n_classes,,)
# Parameters for dataset (C,T)
UCIHAR (C=9, T=65)≈2.5k
HHAR (C=6, T=51)≈2k
Clemson (C=1, T=240)≈3k
IEEE SPC (C=1, T=200)≈2.4k
DaLiA (C=1, T=200)≈2.4k
Chapman (C=4, T=500)≈6k
PhysioNet (C=1, T=3000)≈13k
Respiratory (C=1, T=1500)≈66k
Sleep (C=12, T=6000)≈8k
+ +perform the Fourier transform with the number of harmonics same as the length of time series and provide the entire spectrum to the guidance network as the input. + +One advantage of this input modeling is that the ratio between the number of parameters for the guidance network and the main classifier decreases more when the main classifier has more blocks as they are independent. For example, the guidance network has $1000 \times$ fewer parameters than the main classifier for the sleep stage classification task where we have used 16 ResNet blocks for the classifier model for all techniques. At the same time, this addition increases the performance metrics up to $3\%$ . Furthermore, increasing the number of parameters can decrease the performance of the models as it can cause overfitting of the training data (Cao et al., 2022; Wen et al., 2023), which is observed in our case as well (see Table 11 in Appendix D for additional results). + +# D ADDITONAL RESULTS + +# D.1 SLEEP STAGE CLASSIFICATION + +Here, we present extended results for the sleep stage classification in Table 11. Specifically, we include the F1 score as an additional metric and employ a larger network to observe its impact. Although our method ranked second in F1 metric, it is important to highlight that F1 scores are a + +Table 11: Performance comparison of ours with other methods in ${EEG}$ for sleep stage classification + +
MethodSleep-EDF
S-Cons ↑Acc ↑F1 ↑W-F1 ↑κ ↑
Baseline95.06±0.6175.41±2.0165.40±1.3374.87±1.9267.12±2.96
Baseline (2×)91.09±1.2673.88±2.1065.84±3.2974.32±2.8665.14±2.94
Aug.99.00±0.1774.89±1.1164.71±1.5574.03±1.4665.89±1.81
LPF92.43±1.2473.56±2.9368.08±1.9776.01±1.9865.68±3.46
APS—————
Ours100±0.0077.90±1.9267.01±2.6576.77±2.5870.01±1.10
Ours+LPF100±0.0073.12±1.8967.42±1.9975.34±1.6164.98±2.27
+ +biased measure of classification quality (Christen et al., 2023; Powers, 2015), which is a problem when comparing recordings with a different prevalence of the classes as in sleep staging (Malafeev et al., 2018). Therefore, we reported additional metrics for measuring the performance. In particular, we included the kappa score, a metric widely used for evaluating algorithms in this task (Malafeev et al., 2018; Biswal et al., 2018). Additionally, sleep stage classification and certain other tasks have empty APS values as the authors' original implementation encountered overflow issues with matrix repetition, particularly for longer arrays. + +Overall, our proposed method demonstrates a significant performance improvement in three of the metrics, with high kappa and accuracy—both of which are commonly used in the medical domain (Biswal et al., 2018) while ranking second in the F1 metric, following the LPF approach. We also performed the same ablation experiments for investigating the behavior of the loss function on the performance of the model for the sleep stage classification and reported the results in Table 12 while excluding the consistency metric as the model that include the proposed transformation are always completely shift-invariant. + +Table 12: Ablation experiments for sleep stage classification + +
MethodSleep-EDF
Acc ↑F1 ↑W-F1 ↑κ ↑
T(x,φ)75.54±2.3966.96±1.7875.53±2.2967.08±0.03
L′G77.21±1.5167.67±1.6776.89±1.7169.39±0.02
L′G77.75±1.2368.04±1.1677.01±1.0769.94±0.01
Ours77.80±1.9567.01±2.6576.77±2.5870.01±2.50
Change+2.26+0.05+1.24+2.93
+ +Table 12 also supports the previous experiments and claims regarding the advantages of guiding the proposed diffeomorphism with a neural network. When the models are trained by guiding the mapping function, the performance of the models increases up to $3\%$ in Kappa $(\kappa)$ score. + +# D.2 HEART RATE PREDICTION + +Here, we conducted additional experiments to evaluate the models' performance using varied amounts of training and testing data. Initially, we reduced the training data while increasing the testing data by dividing the datasets in half based on subjects to investigate the performance with less training data. Table 13 presents the results, where our proposed method also increases performance by $3 - 4\%$ compared to the baseline architecture while reducing the variance between different runs and improving shift consistency by $40 - 60\%$ , even in the low data regime. + +Table 13: Performance comparison of ours and other methods in PPG datasets for HR estimation + +
MethodIEEE SPC22DaLiA
S-Cons (%)↑RMSE ↓MAE ↓ρ(%) ↑S-Cons (%)↑RMSE ↓MAE ↓ρ(%) ↑
Baseline55.70±2.6125.93±0.0711.55±0.0848.85±0.8531.48±0.4112.51±0.055.59±0.0585.37±0.20
Aug.70.35±0.4726.21±0.4812.06±0.3348.50±1.2253.38±0.2912.31±0.095.60±0.0585.90±0.13
LPF67.43±0.5625.87±1.0214.03±0.6947.76±2.4939.82±1.3312.65±0.095.81±0.0184.87±0.23
APS60.43±1.0824.83±1.2611.14±0.8352.10±2.9038.99±0.8512.49±0.115.61±0.0485.68±0.17
Ours100±0.0024.67±0.0611.10±0.1652.26±0.27100±0.0012.30±0.115.57±0.0385.95±0.25
Ours+LPF100±0.0026.01±0.2714.04±0.2447.20±0.86100±0.0012.78±0.096.18±0.0184.48±0.26
Ours+APS100±0.0024.67±0.3211.38±0.1351.64±0.73100±0.0012.40±0.085.67±0.0285.63±0.30
+ +We also performed the same ablation studies for heart rate prediction task in the low data regime and presented the results in Table 14. + +Table 14: Ablation experiments for $HR$ task with less training data + +
MethodIEEE SPC22DaLiAPPG
MAE ↓RMSE ↓ρ↑MAE ↓RMSE ↓ρ↑
T(x,φ)12.0425.4950.726.1012.9485.03
L′G11.2925.1051.105.6312.8085.10
L′G11.3225.0851.185.6012.7185.12
Ours11.1024.6752.265.5712.3085.95
Change+0.94+0.82+1.54+0.53+0.64+0.92
+ +The ablation study results with a smaller training set align with our main findings, where reducing variations uniformly using the same angle negatively impacts performance. Likewise, expanding the potential solution space with $\hat{\mathcal{L}}_G$ leads to a performance decline compared to our method. + +# D.3 DIFFEOMORPHISMS IN DEEP LEARNING + +In this section, we review previous transformation functions and diffeomorphisms used in deep learning models. Invariant classification of input samples with neural networks has a long-standing history, with the Spatial Transformer Network (STN) being introduced to learn transformation functions for invariant image classification (Jaderberg et al., 2015). Similarly, Temporal Transformer Networks (TTN), an adaptation of STNs for time series applications, were introduced to predict the parameter of warp functions and align time series (Lohit et al., 2019; Shapira Weber & Freifeld, 2023). Recent methods have focused on optimizing a known family of diffeomorphism, known as diffeomorphic warping functions (Martinez et al., 2022) for time series alignment, through deep learning (Detlefsen et al., 2018; Shapira Weber et al., 2019). Thus, a significant distinction between our approach and previous techniques lies in the fact that we introduce a novel tailored diffeomorphism that is capable of mapping samples subjected to shifts to the same point in the high-dimensional data manifold, to ensure shift-invariance. + +Although previous techniques were designed for different purposes, such as time-warping (Lohit et al., 2019), we also evaluated and compared the performance and shift consistency of their transformation functions. Specifically, we implemented sequence temporal transformations (STN) for clinical time series from Oh et al. (2018) and TTN (Lohit et al., 2019) where the transformation and the classifier are trained together to maximize classification performance by minimizing the cross-entropy loss for both methods. In our implementation of STN, we followed the original design, using a neural network with two convolutional layers and two pooling layers, where pooling is applied between and after the convolutions. After the pooling operations, two fully connected layers are applied to the resulting feature maps to obtain the transformation parameter. The overall results in time series tasks are presented in the tables below. + +Table 15: Performance comparison of our method with different transformations in HR estimation + +
MethodIEEE SPC22DaLiA
S-Cons (%)↑RMSE ↓MAE ↓ρ(%) ↑S-Cons (%)↑RMSE ↓MAE ↓ρ(%) ↑
Baseline61.99±1.1918.39±2.9610.28±1.4162.64±5.7432.08±0.229.86±0.234.40±0.0386.01±0.51
Aug.76.48±1.7718.73±1.1510.42±0.4064.06±3.7052.77±0.399.85±0.214.47±0.0685.99±0.49
Baseline+STN67.13±1.5318.45±2.7310.35±0.7363.49±4.1044.81±0.259.90±0.174.43±0.0485.96±0.47
Baseline+TTN60.12±1.1020.57±1.2311.55±1.8760.17±3.6439.13±0.3010.23±0.304.45±0.0584.31±0.67
Ours100±0.0016.25±0.729.45±0.0370.12±2.10100±0.009.75±0.154.39±0.0386.06±0.19
+ +Table 16: Performance comparison of our method with different transformations in ECG datasets + +
MethodChapmanPhysioNet 2017
S-Cons (%) ↑Acc ↑F1 ↑AUC (%)↑S-Cons (%) ↑Acc ↑F1 ↑AUC ↑
Baseline98.53±0.1791.32±0.2391.22±0.2498.34±0.1698.37±0.1583.22±0.7273.50±1.9993.21±0.30
Aug.99.00±0.1691.96±0.1991.89±0.2298.45±0.1898.96±0.1782.28±1.1872.32±2.2093.20±0.42
Baseline+STN98.31±0.1391.45±0.2091.33±0.1998.31±0.1498.55±0.1483.12±0.5073.27±1.5493.23±0.28
Baseline+TTN97.69±0.1591.27±0.1790.54±0.3898.23±0.2197.12±0.2382.51±0.6371.43±1.4393.07±0.35
Ours100±0.0092.10±0.2591.93±0.8598.47±0.15100±0.0083.15±0.6574.12±1.8093.28±0.31
+ +Table 17: Performance comparison of our method with different transformations in IMU datasets + +
MethodUCIHARHHARClemson
S-Cons (%)↑Acc ↑F1 ↑S-Cons (%)↑Acc ↑F1 ↑S-Cons (%)↑MAPE ↓MAE ↓
Baseline94.07±1.3885.39±2.3083.20±2.9498.27±0.3391.87±1.3691.16±1.3854.31±4.404.76±0.112.74±0.08
Aug.96.55±0.8085.42±4.5083.69±6.7498.38±0.2891.97±0.4491.31±0.4961.01±4.884.08±0.142.29±0.07
Baseline+STN93.96±1.2283.22±1.2383.57±2.1498.30±0.2488.92±1.1089.10±1.2058.56±4.784.94±0.132.53±0.10
Baseline+TTN93.32±1.9583.27±1.5782.78±3.1297.10±0.7890.03±1.7490.18±1.1045.89±3.025.43±0.202.89±0.18
Ours100±0.0087.71±1.9885.67±2.47100±0.0091.93±1.1491.12±1.03100±0.004.28±0.342.43±0.21
+ +As shown in the tables, other transformation functions fail to achieve true shift-invariance. While the STN method shows some improvements on certain datasets, it still lacks full shift-invariance. This limitation arises because STN relies on a neural network to estimate transformation parameters from time series data. However, this temporal transformation has no information about the position of the time series. Thus, when the input is shifted, the output changes. + +# D.4 EXPANDED COMPARISON + +Here, we compared the performance of techniques when random data augmentation (Aug.) is applied during training. In other words, the samples are randomly shifted and fed to the models during training. During inference, the performance of methods with original samples is evaluated without applying any shifts. We present the results in the tables below. + +Table 18: Performance comparison of our method and other techniques with data augmentation for HR estimation + +
MethodIEEE SPC22DaLiA
S-Cons (%)↑RMSE ↓MAE ↓ρ(%) ↑S-Cons (%)↑RMSE ↓MAE ↓ρ(%) ↑
Baseline61.99±1.1918.39±2.9610.28±1.4162.64±5.7432.08±0.229.86±0.234.40±0.0386.01±0.51
Aug.76.48±1.7718.73±1.1510.42±0.4064.06±3.7052.77±0.399.85±0.214.47±0.0685.99±0.49
LPF76.88±0.7320.20±1.5413.44±0.8265.40±1.9238.67±0.3010.01±0.304.67±0.1285.68±0.51
APS73.99±1.0619.42±0.6012.98±0.2965.27±1.3244.33±0.1610.45±0.405.01±0.1784.69±0.85
WaveletNet51.71±1.9521.56±1.0114.61±0.3460.74±4.3736.71±3.0415.46±0.647.67±0.2376.13±1.86
LPF + Aug.76.17±1.1520.39±1.1513.22±0.3661.72±2.8755.62±0.2112.57±0.196.02±0.1184.94±0.40
APS + Aug.74.88±0.6118.01±0.1510.57±0.1566.40±2.2153.70±0.0812.84±0.106.08±0.0285.62±0.65
WaveletNet + Aug.50.14±0.1420.10±1.1513.41±0.5761.90±3.5036.71±3.0415.46±0.647.67±0.2376.13±1.86
Ours100±0.0016.25±0.729.45±0.0370.12±2.10100±0.009.75±0.154.39±0.0386.06±0.19
Ours+LPF100±0.0020.34±1.6213.77±0.8465.60±2.31100±0.0010.72±0.115.30±0.0384.12±0.23
Ours+APS100±0.0018.81±1.5912.32±0.8467.01±3.79100±0.0010.47±0.095.10±0.0384.62±0.31
+ +Table 19: Performance comparison of ours and other techniques with data augmentation in ECG datasets for CVD classification + +
MethodChapmanPhysioNet 2017
S-Cons (%)↑Acc ↑F1 ↑AUC (%)↑S-Cons (%)↑Acc ↑F1 ↑AUC ↑
Baseline98.53±0.1791.32±0.2391.22±0.2498.34±0.1698.37±0.1583.22±0.7273.50±1.9993.21±0.30
Aug.99.00±0.1691.96±0.1991.89±0.2298.45±0.1898.96±0.1782.28±1.1872.32±2.2093.20±0.42
LPF98.69±0.1492.01±0.2391.94±0.5898.50±0.2498.94±0.3984.40±0.1675.68±0.7693.80±0.32
APS98.60±0.1790.69±0.8989.44±1.0098.31±0.24————
WaveletNet91.02±1.1490.87±1.0290.02±1.0097.94±0.2165.03±0.7176.06±0.6463.35±3.4087.02±0.29
LPF + Aug.98.85±0.2092.05±0.1391.94±0.4098.53±0.2099.00±0.5083.27±0.6174.03±1.5693.20±0.31
APS + Aug.98.60±0.1790.69±0.8989.44±1.0098.31±0.24————
WaveletNet + Aug.91.02±1.1490.87±1.0290.02±1.0097.94±0.2165.03±0.7178.90±0.5765.88±1.4488.67±0.22/
Ours100±0.0092.10±0.2591.93±0.8598.47±0.15100±0.0083.15±0.6574.12±1.8093.28±0.31
Ours+LPF100±0.0092.05±0.5291.96±0.5498.51±0.10100±0.0085.20±0.4077.50±1.2194.20±0.19
Ours+APS100±0.0091.61±1.1191.10±0.5698.36±0.20————
+ +Table 20: Performance comparison of our method and others with data augmentation in IMU datasets for Activity and Step + +
MethodUCIHARHHARClemson
S-Cons (%) ↑Acc ↑F1 ↑S-Cons (%) ↑Acc ↑F1 ↑S-Cons (%) ↑MAPE ↓MAE ↓
Baseline94.07±1.3885.39±2.3083.20±2.9498.27±0.3391.87±1.3691.16±1.3854.31±4.404.76±0.112.74±0.08
Aug.96.55±0.8085.42±4.5083.69±6.7498.38±0.2891.97±0.4491.31±0.4961.01±4.884.08±0.142.29±0.07
LPF95.05±0.2183.96±3.4481.08±4.2198.10±0.1092.10±0.8091.43±0.9459.77±4.404.16±0.162.35±0.11
APS96.40±0.0381.75±4.1179.01±5.3398.30±0.2491.83±1.3591.01±1.4745.50±2.694.74±0.162.69±0.07
WaveletNet94.56±1.3182.78±4.6280.73±5.5996.76±0.1590.72±0.3890.71±0.3959.14±3.105.20±0.662.95±0.41
LPF + Aug.97.65±1.3084.67±3.4583.32±3.5098.65±0.1292.45±0.7891.70±0.6259.77±4.403.81±0.132.23±0.10
APS + Aug.96.40±0.0378.40±3.7575.43±4.3398.87±0.3492.40±0.4091.49±0.7345.50±2.693.94±0.102.50±0.07
WaveletNet + Aug.94.56±1.3182.78±4.6280.73±5.5996.76±0.1590.72±0.3891.71±0.3960.23±2.545.18±1.023.02±0.48
Ours100±0.0087.71±1.9885.67±2.47100±0.0091.93±1.1491.12±1.03100±0.004.28±0.342.43±0.21
Ours+LPF100±0.0084.78±2.4682.58±2.62100±0.0092.51±0.5591.80±0.62100±0.003.75±0.332.12±0.18
Ours+APS100±0.0082.96±1.7981.10±1.73100±0.0091.38±0.3290.64±0.32100±0.003.87±0.192.19±0.11
+ +From the results, we can see that applying shift data augmentation during training did not consistently improve performance, and in some cases, it led to a decrease. For instance, in the HR prediction task, training the low-pass filtering method with randomly shifted samples resulted in lower performance. We believe that random shifts may reduce the inter-class separation between samples, causing them to overlap in the feature space (Wang et al., 2022). As a result, even though the number of training samples increases with augmentation, this reduced separation can lead to a decline in model performance. + +# D.5 PERFORMANCE IN DIFFERENT HYPERPARAMETERS + +In this section, we vary the training batch size to evaluate the performance of the proposed method. Given that the guidance network includes an additional loss function to reduce angle variance within a batch, we examined its performance under different batch sizes. The results are presented in Tables 21, 22, and 23. + +Table 21: Performance comparison of our method and other techniques with a different batch size for HR estimation + +
MethodIEEE SPC22DaLiA
S-Cons (%) ↑RMSE ↓MAE ↓ρ(%) ↑S-Cons (%) ↑RMSE ↓MAE ↓ρ(%) ↑
Baseline64.85±1.8719.28±0.4111.51±0.2165.15±1.4336.34±0.3912.47±0.175.53±0.0685.65±0.20
Aug.78.90±1.1219.51±0.9311.82±0.4963.62±1.5552.77±0.3912.36±0.095.61±0.0685.84±0.16
LPF72.16±1.1320.66±1.2613.86±1.0665.22±3.0642.08±0.1812.82±0.265.88±0.0784.50±0.47
APS71.25±1.1919.79±0.9212.59±0.6867.05±0.8542.01±0.2612.37±0.185.50±0.0485.75±0.39
Ours100±0.0018.29±0.7111.30±0.5769.10±1.20100±0.0012.49±0.165.55±0.0785.60±0.23
Ours+LPF100±0.0020.49±0.7714.18±0.4267.28±3.20100±0.0013.17±0.236.43±0.1183.63±0.57
Ours+APS100±0.0020.03±0.9513.23±0.6966.40±4.03100±0.0012.59±0.175.76±0.0585.22±0.27
+ +Table 22: Performance comparison of ours and other techniques with a different batch size in ECG datasets for CVD classification + +
MethodChapmanPhysioNet 2017
S-Cons (%)↑Acc ↑F1 ↑AUC (%)↑S-Cons (%)↑Acc ↑F1 ↑AUC ↑
Baseline99.00±0.1392.56±0.2591.58±0.2698.59±0.1298.41±0.2682.71±1.5573.16±3.3993.00±0.30
Aug.99.08±0.1692.46±0.1891.45±0.1698.57±0.2098.73±0.0782.03±1.6072.61±4.1092.63±0.51
LPF98.88±0.1792.32±0.1591.31±0.1798.58±0.1498.92±0.4083.07±1.3073.98±3.8593.60±0.70
Ours100±0.0092.58±0.2691.50±0.3098.59±0.10100±0.0083.14±0.8274.40±2.2893.60±0.20
Ours+LPF100±0.0092.28±0.2591.34±0.2798.54±0.20100±0.0083.01±1.0172.94±2.7493.05±0.50
+ +Table 23: Performance comparison of our method and others with a different batch size in IMU datasets for Activity and Step + +
MethodUCIHARHHARClemson
S-Cons (%)↑Acc ↑F1 ↑S-Cons (%)↑Acc ↑F1 ↑S-Cons (%)↑MAPE ↓MAE ↓
Baseline95.13±1.2189.89±1.7689.37±1.8298.25±0.1491.99±0.8691.20±0.9143.61±1.534.27±0.262.41±0.14
Aug.96.55±0.8091.46±1.1090.69±1.5898.13±0.2791.70±1.5590.94±1.6163.74±4.833.81±0.212.13±0.11
LPF96.88±0.7692.13±0.5692.23±0.7698.14±0.0990.29±0.8689.45±0.9452.60±3.714.24±0.242.38±0.15
APS97.12±0.7592.43±1.4092.07±1.2198.30±0.2491.83±1.3591.01±1.4742.16±0.985.00±0.032.84±0.02
Ours100±0.0092.78±0.5192.94±0.33100±0.0091.77±0.5691.10±0.60100±0.004.06±0.162.24±0.10
Ours+LPF100±0.0089.78±1.2590.04±1.11100±0.0091.40±1.2090.60±1.32100±0.004.14±0.092.32±0.06
Ours+APS100±0.0090.64±1.4690.40±1.62100±0.0091.19±0.6090.36±0.55100±0.004.41±0.162.48±0.10
+ +When we doubled the batch size during training, we observed a performance decrease in some datasets for our method, such as Clemson and DaLiA. We believe this could be due to the need to adjust the guidance network's learning rate when changing the batch size. Additionally, since the introduced loss function aims to reduce overall angle variance for a batch of samples, larger batches may pose optimization challenges for the guidance network. It is important to note that despite performance decreases in some cases, our method consistently outperformed baseline models with the original batch size used in the main experiments. + +# E IMPROVEMENTS IN PERFORMANCE ACROSS DIFFERENT NETWORKS + +In this section, we conduct experiments to observe the performance of our proposed method when it is integrated into different network architectures. First, we employed the same 1D ResNet architecture for IMU related tasks as we used the fully convolutional network without residual connections in the main results because of better performance. Second, we applied a transformer with positional encoding, which is designed for time series tasks (Qian et al., 2022), to all tasks. Specifically, we used linear layers with a stack of four identical blocks. The linear layer converts the input data to embedding vectors of 128. Each block is made up of a multi-head self-attention layer and a fully connected feed-forward layer. We use residual connections around each layer. + +We have not included blurring (LPF) and adaptive sampling in the transformer network analysis, as these methods are primarily tailored for convolutional architectures. Additionally, due to lack of convergence in the heart rate prediction task, we have omitted reporting results from the transformers. We reported the results in the tables below. + +Table 24: Performance comparison of our method with others in IMU with ResNet + +
MethodUCIHARHHARClemson
S-Cons (%)↑Acc ↑F1 ↑S-Cons (%)↑Acc ↑F1 ↑S-Cons (%)↑MAPE ↓MAE ↓
Baseline97.40±0.8685.02±3.9283.35±3.9099.29±0.0291.78±1.0791.70±1.0884.80±4.156.83±1.603.97±0.96
Aug.98.40±0.3786.66±1.2685.12±1.5399.31±0.0492.82±0.3592.84±0.3595.88±1.106.62±1.103.83±0.66
LPF97.91±0.6084.03±2.6782.49±2.9393.01±1.9291.33±1.4391.38±1.4094.59±0.714.46±0.042.50±0.26
APS98.02±0.4681.98±3.3679.23±4.2093.01±1.9292.13±0.2292.14±0.2293.01±1.926.61±1.443.84±0.84
Ours100±0.0087.12±2.2185.21±3.10100±0.0091.90±0.1092.02±0.07100±0.006.55±0.753.93±0.61
Ours+LPF100±0.0083.05±3.8680.14±3.62100±0.0092.45±0.4592.50±0.44100±0.004.45±0.222.45±0.13
Ours+APS100±0.0084.33±2.9383.01±3.13100±0.0092.25±0.1792.30±0.16100±0.006.07±0.473.50±0.28
+ +Table 25: Performance comparison of our method with others in IMU with Transformer + +
MethodUCIHARHHARClemson
S-Cons (%)↑Acc ↑F1 ↑S-Cons (%)↑Acc ↑F1 ↑S-Cons (%)↑MAPE ↓MAE ↓
Baseline90.44±0.4869.15±4.7965.64±4.5996.98±0.2091.10±1.8391.04±1.9293.87±2.126.55±0.833.77±0.48
Aug.93.68±0.6473.23±2.7569.79±3.6398.35±0.0689.21±0.0789.16±0.1195.46±2.656.54±0.343.76±0.17
Ours100±0.0074.02±3.0170.42±3.47100±0.0091.55±1.2091.19±1.19100±0.006.50±0.553.77±0.31
+ +Table 26: Performance comparison of ours and others in $ECG$ with Transformer + +
MethodChapmanPhysioNet 2017
S-Cons (%)↑Acc ↑F1 ↑AUC (%)↑S-Cons (%)↑Acc ↑F1 ↑AUC ↑
Baseline98.53±0.1791.32±0.2391.22±0.2498.34±0.1698.37±0.1583.22±0.7273.50±1.9993.21±0.30
Aug.99.00±0.1691.96±0.1991.89±0.2298.45±0.1898.96±0.1782.28±1.1872.32±2.2093.20±0.42
Ours100±0.0092.10±0.2591.93±0.8598.40±0.15100±0.0083.35±0.6574.12±1.8093.28±0.31
+ +We also integrated our proposed transformation into some recent neural networks and investigated the performance. Mainly, we employed ModernTCN (donghao & wang xue, 2024) and T-WaveNet (LIU et al., 2022) architectures. When we implemented ModernTCN, we follow the original implementation from We set the patch size and stride to 5 and 2, respectively, while keeping the backbone and dropout rate the same as in the original implementation. The stem, downsampling, and FFN ratios were set to 1. + +Table 27: Performance comparison of our method for HR estimation using ModernTCN + +
MethodIEEE SPC22DaLiA
S-Cons (%)↑RMSE ↓MAE ↓ρ(%) ↑S-Cons (%)↑RMSE ↓MAE ↓ρ(%) ↑
Baseline38.62±0.2334.67±0.4529.26±0.413.45±0.5410.24±0.4620.52±0.4611.90±0.2460.16±1.27
Aug.50.15±0.0734.36±2.1428.29±3.0401.95±2.2339.10±1.2715.36±1.167.25±0.6479.97±2.53
Ours100±0.0033.45±1.0729.33±1.0908.96±3.73100±0.0015.20±1.227.13±0.1080.05±1.08
+ +Table 28: Performance comparison of our method for ECG datasets using ModernTCN + +
MethodChapmanPhysioNet 2017
S-Cons (%) ↑Acc ↑F1 ↑AUC (%)↑S-Cons (%) ↑Acc ↑F1 ↑AUC ↑
Baseline98.53±0.1755.48±1.3446.07±1.0373.35±0.3487.77±1.2051.84±4.8022.41±2.3060.34±1.64
Aug.95.51±3.3881.93±3.6079.15±4.6394.88±1.1198.96±0.1760.13±2.5728.86±5.2370.57±6.10
Ours100±0.0083.80±2.0680.73±2.7095.41±0.33100±0.0060.58±1.5030.73±1.0872.58±3.76
+ +Table 29: Performance comparison of our method for IMU datasets using ModernTCN + +
MethodUCIHARHHARClemson
S-Cons (%)↑Acc ↑F1 ↑S-Cons (%)↑Acc ↑F1 ↑S-Cons (%)↑MAPE ↓MAE ↓
Baseline95.89±2.1086.68±1.5385.45±2.3597.23±0.1892.21±0.7692.09±1.1073.96±2.184.03±0.112.32±0.09
Aug.96.55±0.8085.42±4.5083.69±6.7498.38±0.2891.97±0.4491.31±0.4961.01±4.884.08±0.142.29±0.07
Ours100±0.0088.73±1.4787.19±1.94100±0.0094.12±0.8793.43±1.10100±0.003.88±0.262.15±0.16
+ +Table 30: Performance comparison of our method using ModernTCN for sleep stage classification + +
MethodSleep-EDF
S-Cons ↑Acc ↑F1 ↑W-F1 ↑κ ↑
Baseline71.84±1.7869.50±1.8162.84±1.3971.21±1.6660.39±2.20
Aug.95.47±5.7572.96±4.7264.50±4.1473.61±5.1264.90±6.13
Ours100±0.0073.36±3.1065.37±2.8874.10±1.9765.42±3.51
+ +From these results, we can see that ModernTCN architecture performs relatively poor compared to 1D ResNet architecture in most tasks. However, for the IMU related tasks, ModernTCN outperforms other architectures. Similarly, when we integrate our method into the ModernTCN, the performance increases by $5 - 10\%$ while decreasing the variation between runs. + +We also performed experiments with T-WaveNet, a tree-structured wavelet deep neural network. The model decomposes input signals into multiple subbands and builds a tree structure with data-driven wavelet transforms the bases of which are learned using invertible neural networks. We use the original implementation from https://openreview.net/forum?id=U4uFaLyg7PV. Following the original implementation, the wavelet functions are learned together with the neural network instead of using stationary wavelet transforms like Haar. + +Table 31: Performance comparison of our method for HR estimation using T-WaveNet + +
MethodIEEE SPC22DaLiA
S-Cons (%) ↑RMSE ↓MAE ↓ρ(%) ↑S-Cons (%) ↑RMSE ↓MAE ↓ρ(%) ↑
Baseline49.73±1.6121.78±1.8715.77±1.5960.30±4.1639.69±0.1713.38±0.196.15±0.0883.10±0.47
Aug.71.11±1.2419.29±2.3112.16±1.5166.50±6.3053.95±0.2812.82±0.305.89±0.1183.63±0.76
Ours100±0.0019.03±2.4112.10±2.1067.76±6.55100±0.0012.65±0.255.59±0.1084.05±0.57
+ +Table 32: Performance comparison of our method for ECG datasets using T-WaveNet + +
MethodChapmanPhysioNet 2017
S-Cons (%)↑Acc ↑F1 ↑AUC (%)↑S-Cons (%)↑Acc ↑F1 ↑AUC ↑
Baseline97.23±0.1993.17±0.8092.40±0.7898.87±0.1894.72±1.9178.94±1.6071.43±2.2492.44±1.03
Aug.98.19±0.6893.63±0.3692.89±0.3298.96±0.1095.43±0.8979.77±0.9970.72±1.4292.33±0.63
Ours100±0.0093.45±0.4092.92±0.5099.00±0.15100±0.0079.89±1.1071.61±2.1092.50±0.89
+ +Table 33: Performance comparison of our method for IMU datasets using T-WaveNet + +
MethodUCIHARHHARClemson
S-Cons (%)↑Acc ↑F1 ↑S-Cons (%)↑Acc ↑F1 ↑S-Cons (%)↑MAPE ↓MAE ↓
Baseline97.63±1.4572.77±2.3670.48±4.1698.37±0.9692.37±0.8991.53±1.0389.50±0.506.69±0.543.90±0.31
Aug.98.30±2.4372.82±3.3468.78±3.5398.68±0.6592.88±1.1592.05±1.2889.29±0.726.62±0.593.83±0.31
Ours100±0.0074.04±2.1071.04±3.25100±0.0092.95±1.1491.60±0.93100±0.006.03±0.503.54±0.35
+ +Table 34: Performance comparison of our method using T-WaveNet for sleep stage classification + +
MethodSleep-EDF
S-Cons ↑Acc ↑F1 ↑W-F1 ↑κ ↑
Baseline71.84±1.7869.50±1.8162.84±1.3971.21±1.6660.39±2.20
Aug.95.47±5.7572.96±4.7264.10±1.2373.61±5.1264.90±6.13
Ours100±0.0073.36±5.1065.90±1.0774.10±3.9765.42±3.51
+ +As shown in tables, the proposed transformation also increases the performance of the different neural networks. One important result from the comparison of these tables is that there is a correlation between the model's ability to remain invariant to shifts and its performance, up to a certain threshold where the model performs adequately. However, beyond that point, as the model's performance declines, the consistency in shift increases, resulting in the model consistently outputting the wrong class. For instance, in the case of step counting, the transformer architecture performs quite worse and fails to distinguish between samples. As a result, the consistency of the transformer is higher compared to ResNet and fully convolutional networks while the performance is lower. We believe that investigating the invariance of different neural architectures alongside their performance on time series tasks can shed light on model networks and the fundamental reasons behind abrupt output changes with small changes in the input signal, i.e., $\approx 10 - 15$ ms shift. + +# F VISUAL EXAMPLES FOR THE GUIDANCE NETWORK + +In this section, we provide some visual examples to show how the proposed transformation function works. First, we show the t-SNE (van der Maaten & Hinton, 2008) representations of the embeddings obtained from a trained model with and without applying our transformation in Figure 4. + +![](images/8d8b67cbc53c2eb36a73e14c4d36f6a29315f1d6f310d4a2d6433fddd18a3f5b.jpg) +Figure 4: (a) Comparison of pairwise Euclidean distances of randomly shifted embeddings with and without applying our method. (b) t-SNE visualizations of embeddings without our method show some shifted samples clustering with opposite class embeddings. (c) With our transformation, all shifted variants of the same signal cluster correctly within their true class label. + +![](images/4bfb928f186a89efe5cb3b35f1f04bdec6fda2672627aa43795e0ecfb786b80e.jpg) + +For visualization, we selected 50 different ECG (healthy) signals from the test set. We then took a single arrhythmia ECG sample from the test set, applied 49 shifts to it (50 samples with the original), and created variants shown in blue. Finally, we compared the embeddings with and without applying our proposed transformation function. As seen in Figure 4, applying our transformation function maps the shifted samples to a single point in the embedding space, with the maximum Euclidean distance between embeddings being close to $10^{-6}$ . + +Second, we conducted a simple experiment to investigate how the guidance network works with the proposed transformation. Specifically, we created a two-label classification task where the model classifies sinusoids by frequency. The dataset includes two waveforms: $x_{1}(t) = \cos (\omega_{1}t + \phi_{1}) + \cos (\omega_{2}t + \phi_{2})$ and $x_{2}(t) = \cos (\omega_{1}t + \phi_{1}) + \cos (\omega_{3}t + \phi_{3})$ , with the model identifying whether the input contains frequency $\omega_{2}$ or $\omega_{3}$ . Frequencies were set at 5, 24, and $25\mathrm{Hz}$ for $\omega_{1}, \omega_{2}$ , and $\omega_{3}$ , respectively, with $\omega_{1}$ included in both waveforms to increase task difficulty. We set the sampling rate of the signals to $300\mathrm{Hz}$ . + +![](images/1835832c891e50da1f59ead1989cb320609fee1672037d40cc00abdf2ef3e173.jpg) + +![](images/2a0ea7ef559636cf69ad2b61931680021be22496125bc25f823bcce8a354f5a5.jpg) + +![](images/a3618c94a74c460dfb3a82ac16e513a295c1e6b9afb408c0bb78b3b473aeea13.jpg) +Figure 5: Input waveforms to the classifier in the third epoch (a) without applying our transformation function. (b) with our guidance network $(f_{\theta_G})$ . Another experiment with a different seed. Input waveforms (c) without applying our transformation function. (d) with our guidance network $(f_{\theta_G})$ . + +![](images/ac858c7bcbaf48aef6a5e9f1dc2c140467423c207e6376a45b759c468093b50e.jpg) + +To add diversity, we randomly shifted $x_{1}(t)$ and $x_{2}(t)$ by angles sampled from $[0,\pi)$ and added Gaussian noise $(\epsilon)$ with variance of 0.1. We used the FCN similar to that specified in Appendix C.4 as the architecture. This experimental setup is inspired by similar experiments exploring neural network behaviors (Rahaman et al., 2019). + +Figure 5 illustrates an interesting result: after a few weight updates, the guidance network assigns angles $\phi$ that maximize the Euclidean distance between inter-class samples. For instance, before applying the guidance network, the distance between a pair of samples is 9.12 (Figure 5 (a)). After applying the guidance network, this distance increases by four to 43.6 (Figure 5 (b)). Interestingly, running the same experiment with a different seed (i.e., a new random initialization of the guidance network) shows that the assigned angles differ, but the Euclidean distances between the samples remain almost unchanged, shifting only slightly from 43.6 to 42.8 (See Figure 5 (d)). + +This experiment can also explain the occasional performance increase when the angle variance increases with a loss term as there is no single solution for minimizing the distance, but there can be infinitely many depending on the frequency distribution of the dataset and classes. + +![](images/3f38ad90f35faa06f9589face16e391a3d86899f711575068b892cd0780bac00.jpg) +Figure 6: (a) Angle assignments across different seeds. (b) Euclidean distances between intra-class samples, compared with and without the proposed transformation $(\mathrm{W / o}\mathcal{T}(\mathbf{x},\phi))$ . The results show that the Euclidean distances are highly consistent across different seeds, with the curves nearly overlapping. Additionally, when the transformation is not applied, the distances between intra-class samples are noticeably higher. + +![](images/bf4ab463a9d3de532a434649846babec55a0136527b349db707c3cd6347fa0e6.jpg) + +We conducted an additional experiment to analyze the angle assignments across runs using the IEEE SPC22 dataset. The experiment was performed with three random seeds, and the results are presented in Figure 6. In Figure 6 (a), we reported the assigned angles in $\cos (\phi)$ as the angle $-\pi$ and $\pi$ are the same due to the circular property of the angles. While the assigned angles vary slightly between runs, the Euclidean distances between samples consistently converge to similar values. Specifically, the intra-class samples are closer in the transformed space compared to the case when the proposed transformation is not applied. + +# G EXPANDED REVIEW OF RELATED WORK + +Transformation Applying phase shifts to time series is commonly used in signal processing (Haykin & Veen, 2002; Oppenheim et al., 1996). Recently, shifting phase values of harmonics have also been applied in the machine learning community for data augmentation of time series (Demirel & Holz, 2023; Qian et al., 2022). However, our proposed transformation differs from these in two key aspects. First, our work is the first to represent every point in the shift space uniquely with the phase angle of a harmonic whose period is equal to or longer than the length of the sample, i.e., $\mathrm{T}_0 \leq t$ . This observation enables us to design a bijective transformation that ensures shift invariance. Additionally, we integrated this observation into deep learning frameworks using a novel loss function, demonstrating that our proposed method enhances model performance while ensuring shift invariance. + +Second, we apply linear phase shifts to keep waveform features intact. Since if an input signal is subjected to a phase shift that is a nonlinear function of $\omega$ similar to Qian et al. (2022); Demirel & Holz (2023), then the complex exponential components of the input at different frequencies will be shifted in a manner that results in a change in their relative phases. Superimposing these exponentials can result in a signal that significantly differs from the input if special precautions are not taken. Thus, this alteration in the waveform (Oppenheim et al., 1996) can potentially affect downstream labels or generate unrealistic signals. + +However, our transformation applies the tailored shift linearly to all harmonics while keeping the information content unchanged (Mallat, 2012) as the transformation operates as a group action. + +Shift-invariant Kernels Learning shift invariant representations from data has a long history in machine learning (Grosse et al., 2007; Rahimi & Recht, 2007). The initial effort focused on designing shift-invariant kernels for feature extraction (Rahimi & Recht, 2007), which were applied to support vector machines. A different approach introduced shift-invariant sparse coding technique, which reconstructs an input using all basis functions across all possible shifts (Grosse et al., 2007). However, the classification performance of these techniques were significantly outperformed by the modern networks. Thus, recent approaches have focused on integrating shift-invariant kernels into modern convolutional neural networks in a stacked manner while using Gaussian low-pass filters to prevent aliasing (Mairal et al., 2014). + +However, applying low-pass filters to prevent anti-aliasing completely is not possible (Oppenheim et al., 1996). Thus, high-frequency components will always (partially) alias. This is more problematic for time series as the interaction of high and low frequencies are more common (Demirel & Holz, 2023; Canolty & Knight, 2010). Therefore, applying a low-pass filter can reduce the performance of neural networks in certain time series tasks, as shown by our experiments. The filtering may inadvertently attenuate important high-frequency components, which are essential for distinguishing patterns, leading to suboptimal model outcomes. + +Learning based Transformations Methods to standardize inputs have been around for a long time (Yüceer & Oflazer, 1993). An important recent work along this direction is the Spatial Transformer Network (STN) being introduced to learn transformation functions for invariant image classification (Jaderberg et al., 2015). Similarly, Temporal Transformer Networks (TTN), an adaptation of STNs for time series applications, were introduced to predict the parameter of warp functions and align time series (Lohit et al., 2019; Shapira Weber & Freifeld, 2023). Recent studies have utilized canonical equivariant networks to obtain mapping points for inputs (Kaba et al., 2023). However, these methods face significant limitations as the operation order increases. Specifically, higher-order transformations in group equivariant networks require additional filter copies in the lifting layer and an increased number of parameters in the subsequent group convolution layers. While this can improve performance, it comes at the cost of significantly higher computational and model complexity. Furthermore, prior works restrict mappings to a finite number of group elements defined by the canonicalization network. In contrast, our proposed transformation eliminates this limitation entirely, enabling each sample to map to any point in the input space—in infinitely many—without relying on a neural network. This is achieved by uniquely representing each point in the shift space using a specific harmonic. + +# H DISCUSSION, LIMITATIONS AND FUTURE WORK + +In this work, we propose a new diffeomorphism to achieve shift invariant deep learning models for time series in real-world tasks. While existing techniques show promise for images, they fall short in time series, where the interaction of low and high frequencies are an important part of the data generation. The proposed transformation offers a novel solution, ensuring that samples will map the same point in the high dimensional data manifold despite a random shift. Theoretical and empirical analysis demonstrates its effectiveness across several time series tasks, enhancing model robustness while improving the performance. + +While our approach consistently improves the performance of deep learning models for time series data, it is worth noting the potential areas for future investigation and improvement. First, we conducted our experiments on health-related time series tasks from humans since the robustness of models is crucial in those domains. Therefore, extending the proposed transformation to images for shift or rotation invariance presents an intriguing direction for future investigations. Thus, we believe that future research could benefit on adapting our approach to diverse domains, including images, to explore shift or rotation invariance further. Second, our approach requires samples to be expanded into the sum of periodic sinusoids with Fourier expansion followed by using the phase angle of the one whose period equals or exceeds the length of the signal. Input samples should be decomposed the sinusoids while considering this requirement. Therefore, we believe future work can benefit by detecting the phase of a specific sinusoidal which satisfies the condition and apply a linear phase all-pass filter without performing the operation in the frequency domain. Lastly, we observed notable performance improvements from the additional guidance network when it is used with the proposed diffeomorphism while applying a proper loss function. Thus, we believe that further performance improvements can be achieved through a refined design incorporating alternative inputs. \ No newline at end of file diff --git a/ICLR/2025/Shifting the Paradigm_ A Diffeomorphism Between Time Series Data Manifolds for Achieving Shift-Invariancy in Deep Learning/images.zip b/ICLR/2025/Shifting the Paradigm_ A Diffeomorphism Between Time Series Data Manifolds for Achieving Shift-Invariancy in Deep Learning/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..21b365ed8be9f0876f9dd952f04c39e36e31d4ab --- /dev/null +++ b/ICLR/2025/Shifting the Paradigm_ A Diffeomorphism Between Time Series Data Manifolds for Achieving Shift-Invariancy in Deep Learning/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2f81f7ce0e35cb31e6ad07b6ce8448e07e74205eaaa29237cce00f7b81446048 +size 2573056 diff --git a/ICLR/2025/Shifting the Paradigm_ A Diffeomorphism Between Time Series Data Manifolds for Achieving Shift-Invariancy in Deep Learning/layout.json b/ICLR/2025/Shifting the Paradigm_ A Diffeomorphism Between Time Series Data Manifolds for Achieving Shift-Invariancy in Deep Learning/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..6c206a9642db4f1a2ed241f74a4b3c0c18ee9ace --- /dev/null +++ b/ICLR/2025/Shifting the Paradigm_ A Diffeomorphism Between Time Series Data Manifolds for Achieving Shift-Invariancy in Deep Learning/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5f072119cbfe0722b0e581daa5d6cb1b396ff2421e4f8e36712b4f3084575432 +size 1158869 diff --git a/ICLR/2025/ShortcutsBench_ A Large-Scale Real-world Benchmark for API-based Agents/e913d07b-4719-46a2-ad05-c2910eccdd4d_content_list.json b/ICLR/2025/ShortcutsBench_ A Large-Scale Real-world Benchmark for API-based Agents/e913d07b-4719-46a2-ad05-c2910eccdd4d_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..c1d0070f161705c367eba6c5b961dfce22c7b47b --- /dev/null +++ b/ICLR/2025/ShortcutsBench_ A Large-Scale Real-world Benchmark for API-based Agents/e913d07b-4719-46a2-ad05-c2910eccdd4d_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7a8ad5d18847da00b2381feeaad5803b040ede848bf72827fcbba57b75e96550 +size 160912 diff --git a/ICLR/2025/ShortcutsBench_ A Large-Scale Real-world Benchmark for API-based Agents/e913d07b-4719-46a2-ad05-c2910eccdd4d_model.json b/ICLR/2025/ShortcutsBench_ A Large-Scale Real-world Benchmark for API-based Agents/e913d07b-4719-46a2-ad05-c2910eccdd4d_model.json new file mode 100644 index 0000000000000000000000000000000000000000..095ffb062b987eb53712254a99519b1320849cb6 --- /dev/null +++ b/ICLR/2025/ShortcutsBench_ A Large-Scale Real-world Benchmark for API-based Agents/e913d07b-4719-46a2-ad05-c2910eccdd4d_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f3862f0eff7a31ccaaae7219f4ff2df68574c6a6c7cd7d5370de1ee0ddea91ea +size 213404 diff --git a/ICLR/2025/ShortcutsBench_ A Large-Scale Real-world Benchmark for API-based Agents/e913d07b-4719-46a2-ad05-c2910eccdd4d_origin.pdf b/ICLR/2025/ShortcutsBench_ A Large-Scale Real-world Benchmark for API-based Agents/e913d07b-4719-46a2-ad05-c2910eccdd4d_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..32f3b03ed470d4cbafc5fdd17cc6a3cba00c3bc3 --- /dev/null +++ b/ICLR/2025/ShortcutsBench_ A Large-Scale Real-world Benchmark for API-based Agents/e913d07b-4719-46a2-ad05-c2910eccdd4d_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:56623937747bf948202fbf4d5e2cfd004499ec9440796ce5a276c0cad6bd032b +size 2953935 diff --git a/ICLR/2025/ShortcutsBench_ A Large-Scale Real-world Benchmark for API-based Agents/full.md b/ICLR/2025/ShortcutsBench_ A Large-Scale Real-world Benchmark for API-based Agents/full.md new file mode 100644 index 0000000000000000000000000000000000000000..55249fc4d56ddb1be6d7ebcf1638c5563763d797 --- /dev/null +++ b/ICLR/2025/ShortcutsBench_ A Large-Scale Real-world Benchmark for API-based Agents/full.md @@ -0,0 +1,748 @@ +# SHORTCUTSBENCH: A LARGE-SCALE REAL-WORLD BENCHMARK FOR API-BASED AGENTS + +Haiyang Shen $^{1}$ , Yue Li $^{3}$ , Desong Meng $^{4}$ , Dongqi Cai $^{5}$ , Sheng Qi $^{2}$ , Li Zhang $^{5}$ , Mengwei Xu $^{5}$ , Yun Ma $^{1*}$ + +$^{1}$ Institute for Artificial Intelligence, Peking University +$^{2}$ School of Computer Science, Peking University +$^{3}$ School of Software & Microelectronics, Peking University +$^{4}$ School of Electronics Engineering and Computer Science, Peking University +$^{5}$ Beijing University of Posts and Telecommunications {hyshen}@stu.pku.edu.cn, {mayun}@pku.edu.cn + +# ABSTRACT + +Recent advancements in integrating large language models (LLMs) with application programming interfaces (APIs) have gained significant interest in both academia and industry. Recent work demonstrates that these API-based agents exhibit relatively strong autonomy and planning capabilities. However, their ability to handle multi-dimensional difficulty levels, diverse task types, and real-world demands remains unknown. In this paper, we introduce SHORTCUTSBENCH, a large-scale benchmark for the comprehensive evaluation of API-based agents in solving real-world complex tasks. SHORTCUTSBENCH includes a wealth of real APIs from Apple Inc., refined user queries, human-annotated high-quality action sequences, detailed parameter filling values, and parameters requesting necessary input from the system or user. We revealed how existing benchmarks / datasets struggle to accommodate the advanced reasoning capabilities of existing more intelligent LLMs. Moreover, our extensive evaluation of agents built with 5 leading open-source (size $\geq$ 57B) and 5 closed-source LLMs (e.g. Gemini-1.5-Pro and GPT-4o-mini) with varying intelligence level reveals significant limitations of existing API-based agents in the whole process of handling complex queries related to API selection, parameter filling, and requesting necessary input from the system and the user. These findings highlight the great challenges that API-based agents face in effectively fulfilling real and complex user queries. All datasets, code, experimental logs, and results are available at https://github.com/EachSheep/ShortcutsBench. + +# 1 INTRODUCTION + +Large language model based agents (LLM-based agents) (Zhao et al., 2025; Chen et al., 2025; Wang et al., 2024b; Xi et al., 2023) built on application programming interfaces (APIs) have gained significant interest in academia and industry. By integrating LLM with APIs, LLMs can access real-time information (Qin et al., 2024), reduce hallucination with external knowledge (Gao et al., 2024), as well as plan and complete complex tasks that need multi-step actions (Gravitas, 2024). Many of these agents (OpenAI, 2024a) have already demonstrated commendable performance on simple + +Table 1: Less intelligent LLMs (even ${3B}$ ) on existing benchmarks / dataset demonstrated excellent results with the same prompt in Section 4.1. + +
Acc. (%)MetaTool
2024b20242024
LLaMA-3.2-3B89.6472.9279.47
QWen-2.5-3B88.2977.8691.35
LLaMA-3-8B89.0078.3193.57
QWen-2.5-7B92.5082.6994.26
GPT-4o-mini88.3184.5089.90
+ +tasks involving only a few actions such as "Check the weather $①$ and tell me $②$ ". This impressive performance raises an important question: Are these API-based agents truly capable of generating action sequences for real and complex demands? + +Some existing benchmarks / datasets1 have attempted to evaluate API-based agents. However, they have three limitations (please refer to Table 2 for all details): First, the APIs (a.k.a tools available to the agent) lack richness, and the queries (a.k.a the task to the agent) lack complexity. They either involve a limited number of APIs, cover small numbers of apps (an app may have $\geq 1$ APIs), or the difficulties of the queries are limited in a narrow range, with the average action length ranges from 1 to 5.9. This lack of richness and complexity makes it difficult to effectively distinguish the capabilities of different agents, even on less intelligent LLMs like QWen-2.5-3B (Alibaba, 2024), let alone more intelligent LLMs like Gemini-1.5-Pro (Google, 2024). Our evaluation on API selection of these less intelligent LLMs on 3 representative2 benchmarks / datasets (Table 1) shows that even 3B LLMs can achieve impressive results. There is almost no difference in accuracy across LLMs of varying intelligence levels. Therefore, existing benchmarks / datasets struggle to accommodate more intelligent LLMs and to differentiate the intelligence levels among various LLMs. Second, the APIs lack realism as they may be manually crafted, and the queries fail to reflect actual user demands since they may be either created by hand or generated directly by LLMs without verifying real user demands. Moreover, they only cover the evaluation of API selection, lacking a study on API parameter filling. Efficient and accurate parameter filling is essential for an agent to finish the whole process of completing queriesess Third, they don't adequately evaluate the agent's ability to request systems or the users for the necessary input to resolve the missing information for solving the queries. This is crucial as a user's query may be implicit or may not provide all the input an agent needs to solve the task effectively. + +In this paper, we innovatively propose to use data extracted from existing Digital Automation Platforms (DAPs), Apple Shortcuts, to construct a high-quality benchmark for API-based agents, i.e., SHORTCUTSBENCH. To the best of our knowledge, SHORTCUTSBENCH is the first large-scale real API-based agent benchmark considering APIs, queries, and action sequences. SHORTCUTSBENCH provides rich and real APIs, queries with various difficulties and task types, high-quality human-annotated action sequences, and queries from real user demands. Moreover, it also provides precise values for parameter filling, including primitive data types, enum types, and the use of output from previous actions for parameter values, as well as evaluations of the agent's awareness in requesting necessary input from the system or user. Furthermore, the scale of APIs, queries, and the corresponding action sequences is comparable or even better to benchmarks / datasets created by LLM or modified by existing datasets. The overall comparison between SHORTCUTSBENCH and existing benchmarks / datasets is listed in Table 2. + +To demonstrate SHORTCUTSBENCH's advantages, we do extensive evaluations of API-based agents from 10 leading open-source and close-source LLMs, covering varying intelligence levels. To our best known, this is the most comprehensive evaluation considering the API selection, parameter value filling, and recognition of the need for input from the system or the user, covering all key processes of API-based agent. The evaluation results highlight great limitations of existing API-based agents. + +In summary, this paper makes the following key contributions: + +- We identified problems of the existing benchmarks / datasets, specifically that they struggle to accommodate the advanced reasoning capabilities of existing more intelligent LLMs, and have conducted experiments to validate the problem. +- We innovatively extracted data from Shortcuts, to build a high-quality benchmark for API-based agents. To our best knowledge, SHORTCUTSBENCH is the most realistic, rich, comprehensive, and large-scale benchmark for API-based agents. We hope this approach to dataset construction will inspire more researchers. +- We made efforts to evaluate 10 advanced LLM-based agents with varying intelligence levels on the whole process required to complete user queries, including API selection, parameter filling, and their awareness of requesting necessary input from the system or user. +- We obtained massive interesting conclusions such as (1) Open-source LLM agents now match closed-source ones on simpler tasks but still lag behind on complex ones; (2) Extracting necessary parameters from queries is the most challenging task in parameter filling; (3) There is a substantial lack of awareness in agents when it comes to requesting the necessary input; + +Table 2: SHORTCUTSBENCH has a great advantage in the $①$ realness and richness, $②$ the complexity of APIs, queries, and corresponding action sequences, $③$ the validity of action sequences, $④$ detailed parameter value filling, $⑤$ the awareness for asking necessary input, and $⑥$ the overall scale. + +
ResourceShortcuts +Bench +(Ours)Meta +Tool +2024bTool +LLM +2024API +Bench +2024Tool +Alpaca +2023API +Bank +2023Tool +Bench +2024Tool +QA +2024Tool +Lens +2024
Real API?✓✓✓✓✓✗✗✗✓
Demand-driven Query?✓✗✗✗✗✗✗✗✗
Human-Annotated Act.?✓✗✗✗✗✗✗✗✗
Multi-APIs Query?✓✓✓✗✗✗✗✓✓
Multi-Step Act.?✓✓✓✗✓✓✓✓✓
Prec. Val. for Para. Fill?✓✗✗✗✗✗✗✗✗
Awareness for Ask Info?✓✗✗✗✗✗✗✗✗
# Apps88N/A34513N/AN/A8N/AN/A
# APIs14143901646416455340023213464
# Queries762721112126571700239382742726153018770
# Avg APIs9.621.022.31.01.02.15.43.5*2.65
# Avg Actions21.621.024.01.01.02.25.93.9*2.67
+ +* denotes estimation. + +- We have fully open-sourced all the datasets, code, experimental logs, and results, and provided detailed documents. We hope our research opens new directions for the real-world deployment of existing LLM-based agents. + +# 2 RELATED WORK + +API-based agents. API-based agents treat APIs as tools. They accept queries, generate action sequences based on queries and provided APIs, and generate next action depends on the history actions (Wang et al., 2024b; Yao et al., 2023). Related work about API-based agents can generally be categorized into 3 types: (1) Task-specific enhancement focuses on improving the agent's ability like using the model (Shen et al., 2024; Zhong et al., 2024). (2) Data-driven workflows emphasize the importance of data by researching how to construct action sequences, enabling generated data to fine-tune the model (Qin et al., 2024; Patil et al., 2024). (3) Agent evaluation studies the assessment of agents (Huang et al., 2024b; Li et al., 2023). + +Code-based agents. Code-based agents use code generated for interaction with the external environment. They accept queries, generate scripts in programming languages such as Python (OpenAI, 2024b; Wang et al., 2024c), JavaScript (Wang et al., 2024a; Zheng et al., 2023), or Shell (OpenInterpreter, 2024; Sladic et al., 2024), and then input the code into interpreters. The execution results are then returned to the agent, which is used to help determine the next code generation. Currently, these approaches primarily focus on enhancing agent performance in specific tasks by incorporating additional knowledge (Wang et al., 2024a; Wu et al., 2023), increasing feedback (OpenInterpreter, 2024; Huang et al., 2024a), and decomposing tasks (Huang et al., 2023; Prasad et al., 2024). In addition to work on optimization methods, numerous efforts have emerged to evaluate code-based agents (Trivedi et al., 2024; Liu et al., 2024) + +Digital Automation Platforms (DAPs). DAPs (Abdou et al., 2021) refer to software tools or services designed to optimize workflows through automation. DAPs leverage technologies such as robotic process automation (RPA) (Chakraborti et al., 2020) and low-code / no-code development tools to achieve the goals. DAPs like Zapier (Zapier, 2024), Make (Make, 2024), and IFTTT (Rahmati et al., 2017) offer extensive APIs that enable users to create automated workflows. Similarly, DAPs such as Microsoft Power Automate (Microsoft, 2024) and Tasker (Dias, 2024) are primarily used to build workflows on Azure and Android, respectively. Recently, with the rise of LLM-based agents, platforms like Coze (Coze, 2024) and Dify (Dify, 2024) have emerged as "agent construction + +platforms". Functionality like "workflow" in these platforms can also help manually build workflows, but they have been specifically optimized for integration with LLMs. + +Shortcuts app (formerly Workflow) (Apple, 2024) is an app developed by Apple for building workflows through a graphical interface, available on Apple's operating systems (iOS / iPadOS and macOS). Shortcuts app can be seen as the DAP of Apple. It allows users to create workflows (known as shortcuts (Apple, 2024c)) that execute specific tasks on their devices and share them online via iCloud link (Apple, 2024b). Users can also download curated shortcuts from the Gallery of the Shortcuts app. However, the shortcuts available in the Gallery are very limited, with only a few dozen options. To access more shortcuts, users must either collect them from third-party sharing sites like Shortcuts Gallery (Gallery, 2024) or create their own. Shortcuts can be triggered through the Shortcuts app, widgets, the share sheet, old Siri (Apple, 2024a), new Siri of Apple Intelligence (Apple, 2024b), and they can also be automated to run upon specific events. + +Shortcuts are composed of multiple API calls (actions). An agent can use the shortcut as a whole API or utilize the individual APIs involved in the shortcut. This paper treats APIs within the shortcuts as APIs available to the agent, aiming for the agent to automatically construct workflows of API calls. + +# 3 DATASET + +In this Section, we first introduce the acquisition of the dataset (Section 3.1). Then, we outline the SHORTCUTSBENCH's construction process (Section 3.2). Finally, we outline the setup for evaluation tasks to evaluate the agent's ability to handle tasks of varying difficulty, including the ability to select suitable APIs (Section 3.3.1), the ability to do parameter filling (Section 3.3.2), and the awareness in requesting additional input from the system or user (Section 3.3.3). + +# 3.1 DATASET ACQUISITION + +Figure 1 shows the data acquisition process. We first use search engines to identify popular public shortcut-sharing sites $①$ . We totally find 14 sites (Table 5). Then we crawled these sites to obtain fields such as "shortcut name", "function description", "shortcut type", and "iCloud link" $②$ . Then we downloaded the shortcut source file by "iCloud link" and then perform deduplicating based on iCloud link itself and the actual shortcut content (i.e., the action sequences) $③$ . Subsequently, we extracted "app name" using the field WFWorkflowActionIdentifier in the shortcut source file, and then downloaded associated apps $④$ . These apps may come from various sources. (1) apps from the macOS or iOS App Store, (2) apps like Keynote from path /Applications/ and /System /Application/ on macOS, (3) third-party apps from the official website of the app. During the downloading, we also excluded some legacy apps and paid apps. + +![](images/c98ddedc9645280222a0972098aa9bc6ecdf5b0d2070326df0d7e18f14074589.jpg) +Figure 1: (a) illustrates the data acquisition process. (b) shows the dataset acquisition of existing work. APIs in existing work are collected from API hubs, created by hand, or modified from existing datasets. The queries and action sequences are constructed using templates or semi / fully automated methods. + +Then we managed to extract APIs from the downloaded apps $⑤$ . The APIs are mainly from intent definition file $\{$ filename\}.actionsdata from AppIntent (Apple-Inc., 2024b) framework and $\{$ filename\}.intentdefinition from SiriKit (Apple-Inc., 2024c) framework. We extracted all APIs involved in the apps. During the extraction, we perform dedduplication of APIs based on manually crafted rules as an app may have multiple duplicate API definition files with the same API definition. This process also involves significant manual filtering. Additionally, for app Shortcuts, which are deeply integrated with Apple's operating system, we need to obtain their API definition files WFActions.json from system path /System/Library/PrivateFrameworks/ WorkflowKit.proto/ on macOS, instead of extracting it from the app itself. Subsequently, + +# a. API Information + +(1) com.openai chat. AskIntent (prompt: String, newChat: Boolean, model: ModelEntity, continuous: Boolean) -> Ask ChatGPT: String +(2) Parameters [parameter name (default value): title, parameterDescription]: (2.1) prompt: Message. Message to send to ChatGPT +(2.2) newChat (0): Start new chat. Indicates whether a new chat should be started +(2.3) model (default): Model. Model to use with the new chat +(2.4) continuous (0): Continuous chat. Whether to enable back-and-forth chat or complete the Shortcut immediately after response +(3) Return Value [return value name:研究成果Name.displayTypeName]: +(3.1) Ask ChatGPT: None +(4) Description [title + description + actionSummary]: +(4.1) title: Ask ChatGPT +(4.2) description: This action will send a single message to a chat with ChatGPT and return the response. +(4.3) actionSummary: Ask ChatGPT $\S$ {prompt} in a new chat + +# b. Generating User Queries using Info from (c), (d), (e) + +(5) As a user-friendly and patient inquirer, you need to craft a query based on the provided shortcut .... + +(6) APIs: Related API and corresponding Parameters and Return Value: ... + +7) NLP descriptions to developers: + +Ask ChatGPT $Message$ in a new chat. Start new chat: true, Model: default, Continuous chat: true, Show When Run: true +If $Ask ChatGPT $does not have any value:$ + +Open $ChatGPT$ + +NameInStore: Ask ChatGPT; DescriptionInStore: Chat with ChatGPT. + +# c. NLP desc to devs + +$\left\lbrack {\frac{1 + \sqrt{2}\left( {1 + u}\right) u}{1 - {\left( 1 + u\right) }^{2}} + \frac{1 + \sqrt{2}}{1}}\right\rbrack T =$ + +02:58 + +AskChatGPT Done + +Ask ChatGPT + +in a new chat + +Start new chat + +Model + +Continued + +Show When Run + +# + +If As + +does not have any value. + +# + +Open + +$\therefore m - 1 \neq 0$ ; + +Q. Search for apps + +⑤ + +$\therefore m = \frac{3}{11}$ + +![](images/978bcd971c218efdb95ae5cce09c839d5ac7478c2b778ec988756772488e1359.jpg) +Figure 2: The construction of SHORTCUTSBENCH. (a) shows the information of API com.openuai chatAskIntent extracted from the app ChatGPT's $\S$ {filename}.actionsdata.We provide this API description to the LLM, expecting it to call the API at the appropriate time. The API information shown in (a) includes the API functionality description (a.k. (a.1)\~(a.4)) as shown in (d), and the user-friendly natural language description of the API (a.k. (a.4.3)) seen by shortcut developers during programming, as shown in (c). (e) presents the shortcut name and functionality description from the shortcut sharing-sites. (b) shows the simplified prompt fed to GPT-4o, instructing it to generating queries based on demands indicated by shortcuts by integrating the info from (c), (d), and (e). Different colors indicate different information sources. + +![](images/1d9f9173704b3a0064ca66d67632d117ae37cf9063fcc47afbbe5dc1c1b67b27.jpg) + +![](images/e6aa024730dd2007231de644371b82afa68eddb049a1c505f4ac677dfee1b99c.jpg) + +NameInStore: Ask ChatGPT. +optionInStore: Chat with Chat + +e. Descs from Sharing-site + +# d. Funcs of API + +![](images/1016e8769a68abfa4c81ba71bfa45d7b0fb80da1cec2a7dde594257560ccf870.jpg) + +Indicates whether a new chat should be used. + +10.6.10.10 + +Model + +Model to use with the new chat + +Continuous chat + +Whether to enable back-and-forth chat + +or complete the Shortcut Immediately after response. + +Result + +TODAY + +# + +we further filtered the shortcuts $⑥$ based on criteria such as whether the associated apps is paid app, whether the apps were outdated, and whether the APIs were deprecated. Additionally, we imported all shortcuts into the macOS Shortcuts app to ensure they were functional. Finally, as shown in Table 2, we get 88 apps from various categories such as “Health & Fitness” and “Developer Tools”. We finally get 1414 APIs involved in 7627 shortcuts. + +As the acquisition process involves specific knowledge about shortcut-sharing sites and Apple's operating system, detailed explanations are omitted here due to space constraints. For more details about the whole acquisition process, please refer to Appendix A.1. + +# 3.2 DATASET CONSTRUCTION + +As shown in Figure 2, existing benchmarks / datasets consist of two parts: (1) APIs; (2) queries and corresponding action sequences. + +APIs (Figure 2.a) include the "API description" (a.4), "API name" (a.1), "parameter names" (a.2), "parameter types" (a.1), "default value" (a.2), "return value type" (a.3), and "return value name" (a.3). The field names in square brackets [ ] represent the original field name in the shortcut source file. For more details about ${filename}.actionsdata, ${filename}.intentdefinition, and WFActions.json, please refer to the Appendix A.2. In existing benchmarks / datasets, the "parameter types" and "return value types" are composed of primitive data types such as int and string. In addition to primitive data types, APIs in SHORTCUTSBENCH also include "enum" or "advanced data types". Enum is composed of "the class name" and "the possible value", with each value equipping a "value name". We also provide the agent with a description of the "enum" in the API information. Advanced data types, such as the model (a.1), include three String types named identifier, title, and subtitle. We can comprehend them through their "type name" and "type description". + +Query and action sequence. A query is a user command, such as "Tell me what the weather will be like tomorrow." The action sequence (aka. shortcut) is the series of API calls to complete the + +query, with each API call referred to as an action. The action sequence identifies the steps needed to complete a query. As shown in Figure 1.b, existing benchmarks / datasets collect APIs first and then use them, either fully automatically or semi-automatically, to construct query and action sequences through LLMs. In contrast, action sequences in SHORTCUTSBENCH are all human-annotated. The shortcut developers are our annotators. APIs in SHORTCUTSBENCH are also all real-world. Moreover, we ensured the quality of action sequences by filtering shortcuts based on criteria such as whether the associated apps were paid, outdated, or relied on deprecated APIs. We also imported all shortcuts into the macOS Shortcuts app to verify their functionality. + +Generating queries. As shown in Figure 1, existing works construct query and action sequences based on available APIs. In contrast, we construct queries based on existing action sequences and APIs. When constructing a query for a specific action sequence, we need to understand the functional description of the action sequence (Figure 2.e) and detailed information about the involved APIs (Figure 2.a). With this information, we can generate higher-quality queries. To ensure the quality of the generated queries, we also leverage the unique advantage of shortcuts: the natural language workflow descriptions (Figure 2.b.7 / Figure 2.c). By inputting these intuitive natural language descriptions into an LLM, we can generate more accurate queries. When generating queries, we also require the model to naturally include primitive data type parameters and enum data type needed for API calls in generated queries. This helps us evaluate the agent's ability to fill in primitive parameters in Section 3.3.2. To ensure the quality of generated queries, we use the state-of-the-art LLM, GPT-4 (OpenAI, 2024), to generate the queries. The prompt templates we used to generate queries can be found in the Appendix A.2. + +To ensure the quality of queries generated, follow existing work (Qin et al., 2024), we conducted a preliminary experiment using 3 LLMs: GPT-4o, GPT-3.5, and Gemini-1.5-Pro, on a dataset of 100 samples. The results showed that human evaluators rated GPT-4o generated queries the highest, outperforming the other 2 LLMs. GPT-4o demonstrated superior performance by accurately capturing required parameters and providing clear query descriptions, meeting our criteria in 94/100. This superior performance can largely be attributed to the natural language workflow descriptions. + +# 3.3 TASK DEFINITION AND METRICS + +We aim to address 3 research questions regarding the performance of existing agents built using leading LLMs on SHORTCUTSBENCH with varying difficulties: (1) How do they perform in API selection? (2) How do they handle API parameter value filling, including parameters for primitive data types, enums, and outputs from previous actions? (3) Can they recognize when input is required for tasks that need system or user input? + +Preliminaries. SHORTCUTSBENCH consists of a set of queries $Q = \{q_{1}, q_{2}, \dots, q_{n}\}$ , corresponding "golden" action sequences $ASeq = \{aseq_{1}, aseq_{2}, \dots, aseq_{n}\}$ , and all available APIs $APIs = \{api_{1}, api_{2}, \dots, api_{m}\}$ . For each query $q_{i}, 1 \leq i \leq n$ , the corresponding "golden" action sequence is $aseq_{i} = \{a_{1}, a_{2}, \dots, a_{|aseq_{i}|}\}$ , where the length of the + +Table 3: Final evaluation set with varying difficulties. + +
|a seqi|(0,1](1,5](5,15](15,30]Overall
# Queries706216915717745220
# Avg APIs1.173.438.3013.766.60
# Avg Acts1.003.199.6021.588.34
+ +action sequence is $|aseq_i|$ . Each app $app_j$ has a set of APIs $apis_j = \{api_1, api_2, \dots, api_{|apis_j|}\}$ . The action sequences generated by the agent for each query $q_i$ are referred to as $bseq_i$ . + +Prepare available APIs for each query. For each query $q_{i}$ , we provide the LLM with a certain number of usable APIs to simulate real-world scenarios where APIs can be input into the LLM's context. Following existing work (Qin et al., 2024; Tang et al., 2023; Xu et al., 2024), we equip each $q_{i}$ with a specific number of APIs. For each $aseq_{i}$ , let $|APIs_{i}|$ represent the number of APIs involved. In addition to these $|APIs_{i}|$ APIs, we equip each query with extra APIs calculated as $\max(\min(x \times |APIs_{i}|, 20 - |APIs_{i}|), 0)$ , where $x \in \{3,4,5\}$ . We do this because it is impractical to input all APIs into the context simultaneously. When dealing with a large number of APIs, additional retrieval is often required (Qin et al., 2024; Qu et al., 2024), which we do not consider in this work. + +Further Processing. Considering the context limitations of LLMs, we excluded shortcuts longer than 30 and parts using the API is.workflow actions.runworkflow to call other shortcuts. + +While these shortcuts remain in our open-source dataset, they will not be included in the subsequent evaluation. We aim to study the performance of agents on queries of varying difficulties. As shown in Table 3, we categorize SHORTCUTSBENCH into 4 difficulty levels and 8 task types based on $|aseq_i|$ and "shortcut type", respectively. For more details, please refer to the Appendix A.3. When calculating the length, for branching actions like is.workflowActions情况来看, we consider the longest branch as the length. Additionally, we ignore the lengths of looping actions like is.workflowActionsrepeat.count and special actions such as is.workflowActions.comment. Due to the presence of branching actions, the average number of APIs involved when $p = 1$ is greater than one, specifically 1.17. For a detailed process, please refer to the Appendix A.3. The number of shortcuts in each level is denoted as $n_p$ . Each query and action sequence is referred to as $q_{p,i}$ and $aseq_{p,i}$ , with $1\leq p\leq 4$ and $1\leq i\leq n_p$ . + +# 3.3.1 PERFORMANCE ABOUT API SELECTION + +Following existing work (Huang et al., 2024b; Patil et al., 2024; Xu et al., 2024), we use the accuracy of API selection as the metric. The accuracy is calculated as the number of correct API selections $m_p$ divided by $n_p$ . Specifically, each time we predict an action $b_j$ , $1 \leq j \leq |aseq_i|$ , we provide the agent with all the correct historical actions $\{a_1, a_2, \dots, a_{j-1}\}$ . We then require the agent to predict the next action. All actions predicted by the agent form the prediction sequence $bseq_{p,i}$ . This method is similar to the next token prediction (NTP) in LLMs, effectively preventing a cascade of errors in subsequent action predictions due to a single incorrect prediction. During the prediction, when encountering special actions such as branching and looping, we skip predicting these actions and directly add them to the historical actions. For more details, please refer to Appendix A.4. We chose API selection accuracy over the final result for the following two additional reasons: + +- SHORTCUTSBENCH contains numerous APIs such as opening the "All Shortcuts Folder" in the Shortcuts app that do not have a return value. This makes it challenging to evaluate using existing metrics that measure the success rate of solving queries (Qin et al., 2024; Xu et al., 2024?). +- SHORTCUTSBENCH includes numerous APIs with complex input and output types, such as PDFs and Rich Text. Converting these formats into text that an LLM can process presents a significant challenge (Naveed et al., 2023), as LLMs struggle to serialize them into text. Consequently, it becomes difficult to ascertain the correctness of the final results. However, measuring API selection accuracy is straightforward. + +# 3.3.2 EFFECTIVENESS OF API PARAMETER VALUE FILLING + +In this part, we aim to investigate the performance of agents in API parameter value filling, including parameters for "primitive data types" and "enums" and filling output from previous actions. For each input parameter of every action in SHORTCUTSBENCH, we expect the agent to fill in the following parameters correctly: + +- Static Parameters Preset: These are static parameters that users provide as default inputs of the action. These static parameters typically include primitive data types such as String and Integer, as well as custom Enum defined by app developers. When the query explicitly specifies a parameter that can be used as a static parameter, we expect the agent to accurately fill in the parameter values according to the user's query and the API's definition. When generating queries, we have already required the LLM to naturally include primitive and enumerated data types (Section 3.2). To further ensure that the corresponding parameters are indeed included in the queries during evaluation, we used the LLM to filter these parameters further, ensuring their presence in the queries. Detailed prompts can be found in the Appendix A.5. +- Outputs from Previous Actions: An action may either have no output or, if it does have an output, the output may be used by the following actions. In SHORTCUTSBENCH, outputs that are difficult to input directly into the LLM are represented by a unique identifier (UID) and an output name (OutputName), which can be input into the LLM for processing. The agent should have the ability to correctly use the output values of previous actions. + +For the static parameters preset, we evaluate using the overall parameter fill rate. Let $sppa_{i}$ be the total number of parameters that need to be filled in $aseq_{i}$ , $1 \leq i \leq n_{q}$ , where $n_{q}$ is the number of queries. If the agent correctly fills $sppt_{i}$ parameters in the generated action sequence $bseq_{i}$ , then + +the Static parameter preset accuracy can be calculated as $Acc_{spp} = \sum_{i=1}^{n_q} sppt_i / \sum_{i=1}^{n_q} sppa_i$ . Similarly, for outputs from previous actions, the accuracy can be calculated as $Acc_{ofpa} = \sum_{i=1}^{n_q} ofpat_i / \sum_{i=1}^{n_q} ofpaa_i$ . + +# 3.3.3 RECOGNITION OF NEED FOR INPUT + +In this section, we aim to investigate the ability of existing API-based agents to ask systems or users for necessary input to resolve the missing information. This missing information can come from the system like clipboard (Clipboard), input files (ExtensionInput), and the current date (CurrentDate) or from the user (Ask) (Apple-Inc., 2024a). For example, a parameter named tags is usually represented in a shortcut as "tags": {"Value": {"Type": "Ask"}}, where "Type": "Ask" indicates that the parameter will prompt the user for input. For more details, please refer to Appendix A.6. We use the proportion of correctly identified parameters to evaluate the agent's ability to recognize the need for input from the system or the user. Let $n_s$ be the number of queries, $ask_i$ , $askti$ be the number of times the need from the system or the user appears in $aseq_i$ , $bseq_i$ , respectively, The accuracy of ask for necessary information can be calculated as $Acc_{afni} = askti / askai$ . + +# 4 EVALUATION + +# 4.1 SETUP + +Model. Referencing existing work (Huang et al., 2024b; Qin et al., 2024; Li et al., 2023), considering the performance of existing LLMs, we selected 10 most advanced LLMs to construct API-based agent. The chosen model includes 5 closed-sourced and 5 open-source LLMs, covering varying intelligence levels. Among them, Gemini-1.5-Pro, LLaMA-3-70B, QWen-2-70B, and Deepseek-2-chat/coder are LLMs benchmarked against GPT-4o-2024-05, while Gemini-1.5-Flash, ChatGLM-4-Air, and QWen-2-57B are benchmarked against GPT-4o-mini-2024-07 and GPT-3.5-turbo. We did not evaluate GPT-o1-preview/mini, GPT-4o, LLaMA-3.1-70b/405B, and QWen-2.5-72b, mainly due to limited access, high costs, and the fact that LLaMA and QWen are minor version improvements with recent releases. + +We also compare our work with specialized API-calling fine-tuned LLMs, such as AgentLM (Zeng et al., 2024) and xLAM (Zhang et al., 2024), uncovering intriguing findings. Due to space limitations, the results are presented in Appendix A.9 for interested readers. + +Prompt Template. Following existing work (Huang et al., 2024b; Qin et al., 2024; Tang et al., 2023; Zhuang et al., 2024), we slightly modified the ReACT (Yao et al., 2023) templates to construct the API-based agents. For all 3 research questions (RQs), we use the same prompt templates. An agent should correctly select APIs, fill in parameters, and be aware of the need to request necessary input from the system or user at appropriate times. Please refer to Appendix A.7 for more details. + +# 4.2 RESULT ANALYSIS + +![](images/33ec8504cd279c9017f86d5b56386b79905326843353d9e5dc554b7a49234d56.jpg) +Figure 3: The API selection accuracy on queries with Figure 4: The API selection accuracy difference of each LLM across 8 task types. + +![](images/c096d58139750b74c5853a9f0daf5340cde70fb21f98d8cb58332a35232b1428.jpg) + +From Figure 3, we can see that for tasks with a lower difficulty level, both less intelligent LLMs and more intelligent LLMs perform well. This is similar to the conclusion drawn from Table 1. However, + +![](images/2f554aa09338038191fb105244712f6b16cb4e6994a9e12f403fbaca53b64b0b.jpg) +Figure 5: The API selection accuracy of each task type on 10 API-based agents. + +for tasks with a higher difficulty level, only the more intelligent LLMs like Gemini-1.5-Pro, Deepseek, and QWen2 perform adequately. + +The superiority of SHORTCUTSBENCH. Combined with Table 1, SHORTCUTSBENCH can effectively distinguish between different levels of intelligence, making it a superior benchmark. + +Through the results of API selection accuracy (Section 3.3.1), we get the following conclusions: + +- Agents built using open-source LLMs now perform comparably to closed-source LLMs on lower-difficulty tasks but still lag on higher-difficulty tasks. From Figure 3 we know that open-source LLMs $> = 70\mathrm{B}$ match the performance of closed-source LLMs from the first 3 difficulty tasks, significantly outperforming GPT-4o-mini and GPT-3.5-turbo. However, they still lag behind closed-source LLMs in handling complex tasks at the 4-th level. For more details, please refer to Appendix A.8. +- Existing LLM-based agents still perform poorly on tasks requiring multi-step reasoning, even more intelligent LLMs like Gemini-1.5-Pro struggle with high-difficulty tasks. From Figure 3 we know that almost all LLMs handle well in API selection tasks at the level of $(0,1]$ , but only more advanced models like Gemini-1.5-Pro and QWen-2-72B can do well in higher-difficulty tasks of $(1,5]$ . As tasks become more complex, the accuracy drops sharply. The average accuracy dropped by $19\%$ as task difficulty rose from $(0,1]$ to $(1,5]$ , ranging from a $9\%$ decrease (Deepseek-2-chat) to a $44\%$ (ChatGLM-4-Air). From $(0,1]$ to $(5,15]$ , accuracy fell by $46\%$ , with drops from $38\%$ (Gemini-1.5-Pro) to $58\%$ (ChatGLM-4-Air). +- Agents built with the same LLM show significant performance variations across different types of tasks. From Figure 5 we know that the performance difference of agents built with different LLM ranges from $15.94\%$ (GPT-40-mini) to $36.70\%$ (Gemini-1.5-Pro). +- Existing API-based agents perform well on tasks in daily life such as Lifestyle & Social but show poorer performance on professional tasks like Development & API. From Figure 5 we know that Lifestyle & Social exhibit the highest average accuracy, surpassing the lowest category, Development & API by approximately $18\%$ . + +Based on the results of API Parameter Value Filling (Section 3.3.2), we draw following conclusions: + +- API selection and parameter filling both impact the agent's performance. However, API selection has a greater effect. As shown in Figure 6a, for existing more intelligent LLM like Gemini-1.5-Pro, increased task difficulty has a much smaller impact on the accuracy of parameter filling, especially on using outputs from previous actions. This indicates that the greatest limitation of existing API-based agents in addressing user queries lies in the reasoning and planning capabilities implied by API selection. +- The performance of API parameter filling remains a bottleneck for existing less intelligent LLMs. As shown in Figure 6a, the performance of less intelligent LLMs like GPT-4o-mini in API parameter filling significantly decreases as task difficulty increases. +- Compared to using the outputs of previous actions, extracting relevant parameters from the user's query and filling them is more challenging. As shown in Figure 6a, the colors in the top plot (filling primitive data types and enum data types) are generally lighter than those in the + +![](images/1190f96cff6483407eaecdcd40412ba8a4e5dad7b00d04f5d615984ab214c02e.jpg) +(a) Accuracy of primitive data types & enum data types (upper) and outputs from previous actions (lower). + +![](images/3b0c9133b6098df9b734bf599c44c8271f465bb8f95163a5ae2d65e24a01320a.jpg) +(b) The error rates for action parameter value filling. + +Table 4: The accuracy of recognition of the need for input from the system or the user. + +
LevelsGemini 1.5 ProQWen 2 72BDeep seek2 chatDeep seek2 coderLLaMA 3 70BGemini 1.5 FlashQWen 2 57BGPT 4o miniGPT 3.5 turboChat GLM4 Air
(0,1]33.3337.7864.2962.7147.6262.7922.2237.1428.8947.62
(1,5]45.9550.4055.5060.0844.0853.9937.2440.5537.7048.06
(5,15]51.8536.4240.7649.4435.7140.6528.3729.7120.3348.42
(15,30]46.6725.0027.5943.1422.2244.648.1138.8917.1448.89
Overall46.5941.9747.9055.1849.8940.7130.7436.7130.5548.28
+ +bottom plot (filling the outputs of previous actions as parameters). The accuracy drop ranges from $2.55\%$ (GPT-3.5-turbo) to $15.39\%$ (Deepseek-2-Chat). + +- For existing less intelligent LLMs errors mainly stem from incorrect output formats and wrong API selections. Figure 6b shows error types for tasks requiring outputs from previous actions. It can be seen that powerful LLMs like Gemini-1.5-Pro rarely make format errors, whereas the less intelligent models frequently make mistakes in output format and API selection. + +The results from Recognition of Need for Input (Section 3.3.3) lead us to the following conclusions: + +- All agents perform poorly at recognizing necessary system and user inputs when required. Overall, all agents have weak recognition capabilities, with accuracy ranging between $30.55\%$ (GPT-3.5-turbo) and $55.18\%$ (Deepspeed-2-coder). Larger LLMs such as Deepspeed-2-chat (236B) still demonstrate better recognition accuracy. + +# 5 CONCLUSION + +In this paper, we introduce SHORTCUTSBENCH, a benchmark for evaluating API-based agents. To the best of our knowledge, SHORTCUTSBENCH is the most realistic, rich, and comprehensive benchmark of its kind. Our findings indicate that for agents built on the most advanced LLMs, the primary bottleneck is API selection. For the most cost-effective LLMs, there is considerable room for improvement in both API selection and parameter filling. Additionally, we identified a significant deficiency in the agents' awareness of requesting necessary input. + +# REFERENCES + +App store categories. URL https://developer.apple.com/app-store/ categories/. Accessed: date-of-access. +Mohammed Abdou, Abdelrahman M Ezz, and Ibrahim Farag. Digital automation platforms comparative study. In 2021 4th International Conference on Information and Computer Technologies (ICICT), pp. 279-286. IEEE, 2021. +Alibaba. Qwen2.5-3b-instruct. https://huggingface.co/Qwen/Qwen2. 5-3B-Instruct, 2024. Accessed: 2024-06-10. +Apple. Shortcuts app, 2024. URL https://apps.apple.com/us/app/shortcuts/id915249334. Accessed: 2024-05-09. +Apple. Use a shortcut on iphone. https://support.apple.com/en-hk/guide/iphone/iph7d118960c/ios, 2024a. Accessed: [Date of Access]. +Apple. Apple worldwide developers conference 2024. https://developer.apple.com/wwdc24/, 2024b. Accessed: [Date of Access]. +Apple. icloud api shortcut, 2024a. URL https://www.icloud.com/shortcuts/api/records/cc2283b9eea947e6a049b2020755fad1. Accessed: 2024-05-09. +Apple. ①icloud shortcut, 2024b. ②URL https://www.icloud.com/shortcuts/dff19df10aaf47de9740209b6f9bde7a. Accessed: 2024-05-09. +Apple. Which is a shortcut, 2024c. URL https://support.apple.com/en-sg/guide/ shortcuts/welcome/ios. Accessed: 2024-05-09. +Apple-Inc. Use the ask each time variable in a shortcut on iphone or ipad. https://support.apple.com/en-hk/guide/shortcuts/apd8b28e2166/ios, 2024a. Accessed: 2024-05-15. +Apple-Inc. Appintent documentation, 2024b. URL https://developer.apple.com/ documentation/appintents/appintent. Accessed: 2024-05-09. +Apple-Inc. Sirikit documentation, 2024c. URL https://developer.apple.com/documentation/sirikit/. Accessed: 2024-05-09. +Tathagata Chakraborti, Vatche Isahagian, Rania Khalaf, Yasaman Khazaeni, Vinod Muthusamy, Yara Rizk, and Merve Unuvar. From robotic process automation to intelligent process automation: -emerging trends-. In Business Process Management: Blockchain and Robotic Process Automation Forum: BPM 2020 Blockchain and RPA Forum, Seville, Spain, September 13-18, 2020, Proceedings 18, pp. 215-228. Springer, 2020. +Zhiyang Chen, Yun Ma, Haiyang SHEN, and Mugeng Liu. Weinfer: Unleashing the power of webGPU on LLM inference in web browsers. In THE WEB CONference 2025, 2025. URL https://openreview.net/forum?id=Qu2itILaoZ. +Coze. Coze. https://www.coze.com/home, 2024. Accessed: 2024-05-10. +João Dias. Tasker for android. https://tasker.joaoapps.com/, 2024. Accessed: 2024-11-24. +Dify. Dify. https://dify.ai/, 2024. Accessed: 2024-05-10. +Shortcuts Gallery. Shortcuts gallery, 2024. URL https://shortcutsgallery.com/. Accessed: 2024-05-09. +Yunfan Gao, Yun Xiong, Xinyu Gao, Kangxiang Jia, Jinliu Pan, Yuxi Bi, Yi Dai, Jiawei Sun, Meng Wang, and Haofen Wang. Retrieval-augmented generation for large language models: A survey, 2024. URL https://arxiv.org/abs/2312.10997. + +Google. Gemini-1.5-pro, 2024. URL https://deepmind.google/technologies/gemini/. Accessed: 2024-05-17. +Significant Gravitas. Autogpt, 2024. URL https://github.com/Significant-Gravitas/AutoGPT. Accessed: 2024-05-09. +Di Huang, Ziyuan Nan, Xing Hu, Pengwei Jin, Shaohui Peng, Yuanbo Wen, Rui Zhang, Zidong Du, Qi Guo, Yewen Pu, and Yunji Chen. ANPL: Towards natural programming with interactive decomposition. In Thirty-seventh Conference on Neural Information Processing Systems, 2023. URL https://openreview.net/forum?id=RTRS3ZTsSj. +Dong Huang, Jie M. Zhang, Michael Luck, Qingwen Bu, Yuhao Qing, and Heming Cui. Agentcoder: Multi-agent-based code generation with iterative testing and optimisation, 2024a. URL https://arxiv.org/abs/2312.13010. +Yue Huang, Jiawen Shi, Yuan Li, Chenrui Fan, Siyuan Wu, Qihui Zhang, Yixin Liu, Pan Zhou, Yao Wan, Neil Zhenqiang Gong, and Lichao Sun. Metatool benchmark for large language models: Deciding whether to use tools and which to use. In The Twelfth International Conference on Learning Representations, 2024b. URL https://openreview.net/forum?id=R0c2qtalgG. +Minghao Li, Yingxiu Zhao, Bowen Yu, Feifan Song, Hangyu Li, Haiyang Yu, Zhoujun Li, Fei Huang, and Yongbin Li. API-bank: A comprehensive benchmark for tool-augmented LLMs. In Houda Bouamor, Juan Pino, and Kalika Bali (eds.), Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing, pp. 3102-3116, Singapore, December 2023. Association for Computational Linguistics. doi: 10.18653/v1/2023.emnlp-main.187. URL https://aclanthology.org/2023.emnlp-main.187. +Xiao Liu, Hao Yu, Hanchen Zhang, Yifan Xu, Xuanyu Lei, Hanyu Lai, Yu Gu, Hangliang Ding, Kaiwen Men, Kejuan Yang, Shudan Zhang, Xiang Deng, Aohan Zeng, Zhengxiao Du, Chenhui Zhang, Sheng Shen, Tianjun Zhang, Yu Su, Huan Sun, Minlie Huang, Yuxiao Dong, and Jie Tang. Agentbench: Evaluating LLMs as agents. In The Twelfth International Conference on Learning Representations, 2024. URL https://openreview.net/forum?id=zAdUBOaCTQ. +Make. Make. https://www.make.com/, 2024. Accessed: 2024-05-10. +Meta. Llama 3, 2024. URL https://llama.meta.com/llama3/. Accessed: 2024-05-09. +Microsoft. Microsoft power automate - process automation platform. https://www.microsoft.com/en-us/power-platform/products/power-automate, 2024. Accessed: 2024-11-24. +Humza Naveed, Asad Ullah Khan, Shi Qiu, Muhammad Saqib, Saeed Anwar, Muhammad Usman, Nick Barnes, and Ajmal Mian. A comprehensive overview of large language models. arXiv preprint arXiv:2307.06435, 2023. +OpenAI. Hello gpt-4o, 2024. URL https://openai.com/index/hello-gpt-4o/. Accessed: 2024-05-17. +OpenAI. Introducing gpts, 2024a. URL https://openai.com/index/introducing-gpts.Accessed:2024-05-09. +OpenAI. Openai code interpreter documentation. https://platform.openai.com/docs/assistant/tools/code-Interpreter, 2024b. Accessed: 2024-05-10. +OpenAI Community. Conversation context and quadratic billing, 2023. URL https://community.openuai.com/t/conversation-context-and-quadratic-billing/126421. Accessed: 2023-07-22. +OpenInterpreter. Open interpreter. https://github.com/OpenInterpreter/open-Interpreter, 2024. Accessed: 2024-05-10. + +Shishir G Patil, Tianjun Zhang, Xin Wang, and Joseph E. Gonzalez. Gorilla: Large language model connected with massive APIs. In The Thirty-eighth Annual Conference on Neural Information Processing Systems, 2024. URL https://openreview.net/forum?id=tBRNC6YemY. +Archiki Prasad, Alexander Koller, Mareike Hartmann, Peter Clark, Ashish Sabharwal, Mohit Bansal, and Tushar Khot. ADaPT: As-needed decomposition and planning with language models. In Kevin Duh, Helena Gomez, and Steven Bethard (eds.), Findings of the Association for Computational Linguistics: NAACL 2024, pp. 4226-4252, Mexico City, Mexico, June 2024. Association for Computational Linguistics. doi: 10.18653/v1/2024-findings-naacl.264. URL https://aclanthology.org/2024-findings-naacl.264. +Yujia Qin, Shihao Liang, Yining Ye, Kunlun Zhu, Lan Yan, Yaxi Lu, Yankai Lin, Xin Cong, Xiangru Tang, Bill Qian, Sihan Zhao, Lauren Hong, Runchu Tian, Ruobing Xie, Jie Zhou, Mark Gerstein, dahai li, Zhiyuan Liu, and Maosong Sun. ToolLLM: Facilitating large language models to master 16000+ real-world apis. In The Twelfth International Conference on Learning Representations, 2024. +Changle Qu, Sunhao Dai, Xiaochi Wei, Hengyi Cai, Shuaiqiang Wang, Dawei Yin, Jun Xu, and Ji-Rong Wen. Towards completeness-oriented tool retrieval for large language models. In Proceedings of the 33rd ACM International Conference on Information and Knowledge Management, CIKM '24, pp. 1930-1940, New York, NY, USA, 2024. Association for Computing Machinery. ISBN 9798400704369. doi: 10.1145/3627673.3679847. URL https://doi.org/10.1145/3627673.3679847. +Qwen. Qwen2-72b-instruct. https://huggingface.co/Qwen/Qwen2-72B-Instruct, 2024. Accessed: 2024-06-10. +Amir Rahmati, Earlence Fernandes, Jaeyeon Jung, and Atul Prakash. Ifttt vs. zapier: A comparative study of trigger-action programming frameworks. arXiv preprint arXiv:1709.02788, 2017. +Yongliang Shen, Kaitao Song, Xu Tan, Dongsheng Li, Weiming Lu, and Yueting Zhuang. Huggingppt: Solving ai tasks with chatgpt and its friends in hugging face. Advances in Neural Information Processing Systems, 36, 2024. +Muris Sladic, Veronica Valeros, Carlos Catania, and Sebastian Garcia. Llm in the shell: Generative honeypots. In 2024 IEEE European Symposium on Security and Privacy Workshops (EuroS&amp;PW), pp. 430-435. IEEE, July 2024. doi: 10.1109/eurospw61312.2024.00054. URL http://dx.doi.org/10.1109/EuroSPW61312.2024.00054. +Qiaoyu Tang, Ziliang Deng, Hongyu Lin, Xianpei Han, Qiao Liang, and Le Sun. Toolalpaca: Generalized tool learning for language models with 3000 simulated cases. arXiv preprint arXiv:2306.05301, 2023. +Harsh Trivedi, Tushar Khot, Mareike Hartmann, Ruskin Manku, Vinty Dong, Edward Li, Shashank Gupta, Ashish Sabharwal, and Niranjan Balasubramanian. AppWorld: A controllable world of apps and people for benchmarking interactive coding agents. In Lun-Wei Ku, Andre Martins, and Vivek Srikumar (eds.), Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 16022-16076, Bangkok, Thailand, August 2024. Association for Computational Linguistics. doi: 10.18653/v1/2024.acl-long.850. URL https://aclanthology.org/2024.acl-long.850. +Guanzhi Wang, Yuqi Xie, Yunfan Jiang, Ajay Mandlekar, Chaowei Xiao, Yuke Zhu, Linxi Fan, and Anima Anandkumar. Voyager: An open-ended embodied agent with large language models. Transactions on Machine Learning Research, 2024a. ISSN 2835-8856. URL https://openreview.net/forum?id=ehfRiF0R3a. +Lei Wang, Chen Ma, Xueyang Feng, Zeyu Zhang, Hao Yang, Jingsen Zhang, Zhiyuan Chen, Jiakai Tang, Xu Chen, Yankai Lin, Wayne Xin Zhao, Zhewei Wei, and Jirong Wen. A survey on large language model based autonomous agents. Frontiers of Computer Science, 18(6), March 2024b. ISSN 2095-2236. doi: 10.1007/s11704-024-40231-1. URL http://dx.doi.org/10.1007/s11704-024-40231-1. + +Xingyao Wang, Yangyi Chen, Lifan Yuan, Yizhe Zhang, Yunzhu Li, Hao Peng, and Heng Ji. Executable code actions elicit better LLM agents. In Ruslan Salakhutdinov, Zico Kolter, Katherine Heller, Adrian Weller, Nuria Oliver, Jonathan Scarlett, and Felix Berkenkamp (eds.), Proceedings of the 41st International Conference on Machine Learning, volume 235 of Proceedings of Machine Learning Research, pp. 50208-50232. PMLR, 21-27 Jul 2024c. URL https://proceedings.mlr.press/v235/wang24h.html. +Yue Wu, So Yeon Min, Shrimai Prabhumoye, Yonatan Bisk, Ruslan Salakhutdinov, Amos Azaria, Tom Mitchell, and Yuanzhi Li. SPRING: Studying papers and reasoning to play games. In Thirty-seventh Conference on Neural Information Processing Systems, 2023. URL https://openreview.net/forum?id=jU9qiRMDtR. +Zhiheng Xi, Wenxiang Chen, Xin Guo, Wei He, Yiwen Ding, Boyang Hong, Ming Zhang, Junzhe Wang, Senjie Jin, Enyu Zhou, Rui Zheng, Xiaoran Fan, Xiao Wang, Limao Xiong, Yuhao Zhou, Weiran Wang, Changhao Jiang, Yicheng Zou, Xiangyang Liu, Zhangyue Yin, Shihan Dou, Rongxiang Weng, Wensen Cheng, Qi Zhang, Wenjuan Qin, Yongyan Zheng, Xipeng Qiu, Xuanjing Huang, and Tao Gui. The rise and potential of large language model based agents: A survey, 2023. URL https://arxiv.org/abs/2309.07864. +Qiantong Xu, Fenglu Hong, Bo Li, Changran Hu, Zhengyu Chen, and Jian Zhang. On the tool manipulation capability of open-sourced large language models, 2024. URL https://openreview.net/forum?id=iShM3YolRY. +Shunyu Yao, Jeffrey Zhao, Dian Yu, Nan Du, Izhak Shafran, Karthik R Narasimhan, and Yuan Cao. React: Synergizing reasoning and acting in language models. In The Eleventh International Conference on Learning Representations, 2023. URL https://openreview.net/forum?id=WE_vluYUL-X. +Zapier. Zapier - automate your work with no code, 2024. URL https://zapier.com/. Accessed: 2024-11-24. +Aohan Zeng, Mingdao Liu, Rui Lu, Bowen Wang, Xiao Liu, Yuxiao Dong, and Jie Tang. AgentTuning: Enabling generalized agent abilities for LLMs. In Lun-Wei Ku, Andre Martins, and Vivek Srikumar (eds.), Findings of the Association for Computational Linguistics: ACL 2024, pp. 3053-3077, Bangkok, Thailand, August 2024. Association for Computational Linguistics. doi: 10.18653/v1/2024.findings-acl.181. URL https://aclanthology.org/2024-findings-acl.181. +Jianguo Zhang, Tian Lan, Ming Zhu, Zuxin Liu, Thai Hoang, Shirley Kokane, Weiran Yao, Juntao Tan, Akshara Prabhakar, Haolin Chen, Zhiwei Liu, Yihao Feng, Tulika Awalgaonkar, Rithesh Murthy, Eric Hu, Zeyuan Chen, Ran Xu, Juan Carlos Niebles, Shelby Heinecke, Huan Wang, Silvio Savarese, and Caiming Xiong. xlam: A family of large action models to empower ai agent systems, 2024. URL https://arxiv.org/abs/2409.03215. +Wayne Xin Zhao, Kun Zhou, Junyi Li, Tianyi Tang, Xiaolei Wang, Yupeng Hou, Yingqian Min, Beichen Zhang, Junjie Zhang, Zican Dong, Yifan Du, Chen Yang, Yushuo Chen, Zhipeng Chen, Jinhao Jiang, Ruiyang Ren, Yifan Li, Xinyu Tang, Zikang Liu, Peiyu Liu, Jian-Yun Nie, and Ji-Rong Wen. A survey of large language models, 2025. URL https://arxiv.org/abs/2303.18223. +Qinkai Zheng, Xiao Xia, Xu Zou, Yuxiao Dong, Shan Wang, Yufei Xue, Lei Shen, Zihan Wang, Andi Wang, Yang Li, Teng Su, Zhilin Yang, and Jie Tang. Codegeex: A pre-trained model for code generation with multilingual benchmarking on humaneval-x. In Proceedings of the 29th ACM SIGKDD Conference on Knowledge Discovery and Data Mining, KDD '23, pp. 5673-5684, New York, NY, USA, 2023. Association for Computing Machinery. ISBN 9798400701030. doi: 10.1145/3580305.3599790. URL https://doi.org/10.1145/3580305.3599790. +Wanjun Zhong, Lianghong Guo, Qiqi Gao, He Ye, and Yanlin Wang. Memorybank: Enhancing large language models with long-term memory. In AAAI, pp. 19724-19731, 2024. URL https://doi.org/10.1609/aaai.v38i17.29946. + +Yuchen Zhuang, Yue Yu, Kuan Wang, Haotian Sun, and Chao Zhang. Toolqa: A dataset for llm question answering with external tools. Advances in Neural Information Processing Systems, 36, 2024. + +# A APPENDIX / SUPPLEMENTAL MATERIAL + +# A.1 DATASET ACQUISITION + +In this section, we introduce more details about the dataset acquisition introduced in Section 3.1. + +Regarding data acquisition, we first use search engines to identify popular public shortcut-sharing sites (1 in Figure 1). We found a total of 14 sites. These sites include: + +Table 5: 14 shortcut-sharing sites, including names, URLs, and shortcut counts. + +
#Site NameURLCount
1Matthewcassinellihttps://matthewcassinelli.com1535
2Routinehubhttps://routinehub.co6860
3MacStorieshttps://www.macstories.net/shortcuts4993
4ShareShortcutshttps://shareshortcuts.com2395
5ShortcutsGalleryhttps://shortcutsgallery.com4269
6iSpaziohttps://shortcuts.ispazio.net115
7Jiejingkuhttps://jiejingku.net3347
8SSPaihttps://shortcuts.sspai.com145
9Jiejing.funhttps://jiejing.fun84
10Kejicuthttps://www kejicut.com37
11RCutshttps://www.rcuts.com133
12Sharecutshttps://sharecuts.app2395
13Siri-shortcutshttps://www.siri-shortcuts.de15
14Reddithttps://www.reddit.com/r/shortcuts100
+ +Total (After Dedduplication):8675 + +We can obtain shortcuts from these sites. Specifically, each dataset includes the "shortcut name" (NameInStore), "function description" (DescriptionInStore), "shortcut type" (CategoryInStore), and most importantly, the "iCloud link" (Apple, 2024a). Additionally, it includes less important data such as the number of downloads (Downloads), favorites (Favorite), reads (Reads), and ratings (Rates). All shortcuts include NameInStore and DescriptionInStore, while the availability of other fields varies slightly depending on the specific shortcut-sharing site. + +We then downloaded the shortcut source file by "iCloud link" and performed dedduplication based on both iCloud links and the actual shortcut content (i.e., action sequences) to ensure the uniqueness of each shortcut in the final dataset (② in Figure 1). For details on downloading source files via iCloud links, please refer to our open-source code repository. We do dedduplication because shortcuts sharing sites store shortcuts as iCloud links, which often results in the same shortcut appearing in multiple sharing-site. Additionally, shortcuts linked by these iCloud links could have identical content, making dedduplication essential to ensure that each shortcut in the final dataset was unique. + +We then extracted the app name using the field WFWorkflowActionIdentifier from the shortcut source file and downloaded the associated apps (③ in Figure 1). Shortcuts are composed of a series of shortcut API calls, referred to as Actions. An example of a typical shortcut is shown in Figure 7. Each shortcut API call is identified by a name, which usually includes the app's identifier, such as com.openai chat, and the Intent name, such as AskIntent. For most API names, the segment before the last dot represents the app name, while the segment after denotes the Intent name. We semi-automatically extracted all app names to streamline the app download process. + +We download these apps from various sources: + +![](images/9ae0e613de509b0b6355049eabae0c8ee412503f41a6c3eebb2732c6a13d1abf.jpg) +Figure 7: An example of a shortcut: Ask ChatGPT. + +- Apps from the macOS or iOS App Store: We downloaded a variety of applications directly from Apple's official platforms. This provided us with a vast selection of apps that are widely used and trusted by users. +- System apps like Keynote from paths /Applications/ and /System/Application/ on macOS: These are pre-installed applications integral to the operating system. Including them ensured that our dataset covered essential tools commonly used by macOS users. +- Third-party apps from the official websites of the apps: To include software not available through the App Store, we downloaded apps from their official websites. This allowed us to capture a broader range of functionalities offered by third-party developers. + +During the downloading process, we also excluded some legacy apps that are no longer maintained and 12 paid apps to avoid potential licensing issues and focus on applications readily accessible to the general public. + +Then we managed to extract APIs from the downloaded apps (④ in Figure 1). The APIs are mainly from intent definition file ${filename}.actionsdata from AppIntent (Apple-Inc., 2024b) framework and ${filename}.intentdefinition from SiriKit (Apple-Inc., 2024c) framework. We extracted all APIs involved in the apps. During the extraction, we perform dedduplication of APIs based on manually crafted rules as an app may have multiple duplicate API definition files with the same API definition. + +We perform dedduplication to streamline API definitions, minimize redundancy, and ensure compatibility across frameworks, addressing inconsistencies introduced by the coexistence of SiriKit and AppIntents. SiriKit, introduced in 2016 with iOS 10, enabled applications to integrate with Siri for voice command interactions. In 2022, Apple launched AppIntents with iOS 16, providing a more modern and flexible approach to defining and handling app intents. AppIntents facilitate integration with Siri, Shortcuts, widgets, and more. To encourage adoption, Apple has provided migration tools for developers transitioning from SiriKit. However, some apps still rely on the SiriKit. Under SiriKit, developers use $filename.intentdefinition files, while the AppIntents relies on $filename(actionsdata files. These files define APIs corresponding to actions in Shortcuts. Apps may include only $filename.intentdefinition files, only $filename(actionsdata files, or both, potentially leading to redundancy in API definitions. To address this, we have implemented a set of rules to reduce API definition files and ensure API uniqueness. + +Additionally, for app Shortcuts, which are deeply integrated with Apple's operating system, we need to obtain their API definition files WFActions.json from system path /System/Library/PrivateFrameworks/WorkflowKit-framework/ on macOS, instead of extracting it from the app itself. + +Subsequently, we further filtered the shortcuts based on criteria such as whether the associated apps is paid app, whether the apps were outdated, and whether the APIs were deprecated. Additionally, we imported all shortcuts into the macOS Shortcuts app to ensure they were functional. These steps were repeated multiple times. + +Finally, as shown in Table 2, we get 88 apps from various categories such as "Health & Fitness", "Developer Tools", and "Lifestyle". These apps in total include 1414 APIs, including all of 556 APIs (Not all APIs have been used in Shortcuts) involved in 7627 shortcuts. + +The approximate time spent on each step of the process is outlined below: + +- Shortcut site collection: Approximately 3 days, completed entirely manually. +- Link scraping using Selenium: Around 2 weeks, requiring custom scripts for each site. +- Shortcut dedduplication, API validity checks, and shortcut functionality validation: Approximately 4 weeks. Deduplication: Automated using iCloud links and content cleaning. +- API validity checks: Performed manually. Shortcut validity checks: A mix of automated and semi-automated methods. Automated filtering was conducted using Apple Scripts to execute shortcuts for preliminary filtering, followed by manual validation through importing shortcuts into the Shortcuts app. + +Additional manual and automated checks were conducted throughout the process but are not detailed here. + +# A.2 DATASET CONSTRUCTION + +The API definition files extracted from the app exist in two forms: the ${filename}. intentdefinition files as indicated by the Sirikit framework and the ${filename}. actionsdata files as indicated by the App Intent framework. Additionally, Apple's first-party apps provide a third type of definition file, WFActions.json. All three file formats provide "API description", "API name", "parameter names", "parameter types", "default value", "return value type", and "return value name", but differ in their file format. We give a sample from each of the three different file formats, as shown in Figure 8. + +We construct queries based on existing action sequences and APIs. To ensure the quality of these queries, we utilize the natural language workflow descriptions unique to shortcuts. When generating queries, we require the model to naturally include primitive data type parameters and enum data types needed for API calls. This helps us evaluate the agent's ability to handle primitive parameters. We do not require the inclusion of complex data types in the queries, as they are difficult to convert to text and challenging to evaluate. To ensure high-quality query generation, we use the state-of-the-art LLM, GPT-4 (OpenAI, 2024). The prompt templates used for generating queries are provided in Figure 9. + +To ensure the quality of shortcuts, we filtered them based on criteria such as whether the associated apps were paid, outdated, or relied on deprecated APIs. Additionally, all shortcuts were imported into the macOS Shortcuts app to verify functionality. Dedduplication and error-checking processes were carried out throughout the entire data collection phase. + +For ensuring the quality of generated queries, following prior work (Qin et al., 2024), we conducted a preliminary experiment with three LLMs: GPT-4o, GPT-3.5, and Gemini-1.5-Pro, on a dataset of 100 samples. Human evaluators rated GPT-4o as generating the highest-quality queries, outperforming the other two models. GPT-4o excelled in accurately identifying required parameters and providing clear query descriptions, meeting our criteria in 94 out of 100 cases. This superior performance can largely be attributed to the natural language workflow descriptions. While we acknowledge that not all queries may fully meet our requirements, we believe our approach is reasonable. Similar works, such as ToolLLM, rely on GPT for large-scale query and action sequence generation without guaranteeing complete accuracy. + +(1) com.openai chat. Ask Intent (prompt: String, newChat: Boolean, model: ModelEntity, continuous: Boolean) -> Ask ChatGPT: String +(2) Parameters [parameter name (default value): title. parameterDescription]: + +(2.1) prompt: Message. Message to send to ChatGPT +(2.2) newChat (0): Start new chat. Indicates whether a new chat should be started +(2.3) model (default): Model. Model to use with the new chat +(2.4) continuous (0): Continuous chat. Whether to enable back-and-forth chat or complete the Shortcut immediately after response + +(3) Return Value [return value name:研究成果Name. displayTypeName]: +(3.1) Ask ChatGPT: None + +(4) Description [title + description + actionSummary]: + +(4.1) title: Ask ChatGPT +(4.2) description: This action will send a single message to a chat with ChatGPT and return the response. +(4.3) actionSummary: Search for $ {query} + +(1) isworkflow(actions.getrichtextfromhtml (WFHTML: WFStringContentItem) -> Rich Text from HTML: public.html +(2) Parameters [parameter name (default value): DescriptionInput]: + +(2.1) WFHTML: HTML + +(3) Return Value [return value name: DescriptionResult]: +(3.1) Rich Text from HTML: None + +(4) Description [Name + DescriptionSummary + ParameterSummary]: + +(4.1) Name: Make Rich Text from HTML. +(4.2) DescriptionSummary: Takes the inputted HTML and turns it into rich text, which can then be converted to other formats. +(4.3) ParameterSummary: Make rich text from $\S$ {WFHTML} + +(1) com.ulysssesapp.mac.ULInsertTextIntent (sheet: SheetReference (Object), text: String, format: TextFormat (Enum), position: TextPosition (Enum)) -> Result: None +(2) Parameters [parameter name (default value): INIntentParameterDisplayName. INTypeDisplayName]: + +(2.1) sheet: Sheet. Sheet Reference +(2.2) text: Content. +(2.3) format: None +(2.4)TextPosition: None + +(3) Return Value [return value name: INIntentResponseParameterDisplayName]: +Result: None +(4) Description. [INIntentTitle + INIntentDescription + INIntentParameterCombinationTitle]: +(4.1) INIntentTitle: Add Text to Sheet. +(4.2) INIntentDescription: Adds text to an existing sheet in Ulysses. +(4.3) INIntentParameterCombinationTitle: Add ${text} to ${sheet} + +Figure 8: We randomly selected three samples from three different definition files, as shown in the upper (\$\{filename\}.actionsdata), middle (WFActions.json), and lower (\$\{filename\}.intentdefinition) figures. The content in brackets represents different field names. In practice, there are various details to handle, such as name prefixes and missing fields. For complete details, please refer to our open-source code. + +# SYSTEM_prompt_template: + +Shortcut consist of a sequence of actions, each is an API call, to execute user-provided queries. + +As a user-friendly and patient inquirer, you need to craft a query based on the provided shortcut. This query, formatted as a question, should describe the task a user wants to complete and adhere to the following criteria: + +1. The problem described in the query must be solvable using the shortcut. +2. The query should include all required parameters from the shortcut. +3. The query should be naturally phrased, integrating parameters seamlessly into the question rather than listing them separately. + +For each shortcut command, I will provide you with five fields: + +1. 'RecordName': The name of the shortcut, briefly describing its function. +2. 'Description of the Shortcut Workflow': A description of the entire action workflow of the shortcut. +3. 'Comments': Optional. Notes from the shortcut's developer, which may describe its functions or other features. +4. 'Description in Store': A description of the shortcut's functionality provided in the shortcut store. +5. 'API Description List': Detailed descriptions of the APIs involved in the shortcut. + +You should rely primarily on the 'Description of the Shortcut Workflow' and 'API Description List', and refer to 'RecordName', 'Comments', and 'Description in Store' to formulate the final query. + +# USER_prompt_template: + +Below are the five fields I provide to you: + +1. 'RecordName': {RecordName} +2. 'Description of the Shortcut Workflow': {DescriptionoftheShortcutWorkflow} +3. 'Comments': {Comments} +4. 'Description in Store': {DescriptionInStore} +5. 'API Description List': {APIDescriptionList} + +Please generate a query based on these details. Alongside the query, provide the shortcut's name and a description of its functionality using the following JSON format: + +```json +{ + "shortcut_name": "ThisIsShortcutName", + "shortcut_description": "ThisIsShortcutDescription", + "query": "ThisIsQuery" +} +``` + +Do not output any other content; your response should only be in this JSON format. Do not simply repeat the shortcut workflow. Parameters not surrounded by $\{\{\}\}$ should not appear in the generated query. Output the JSON directly without using "json XX" to enclose it. + +Note again, you should include all required parameters in the generated query. Please give your answer in English. + +Figure 9: System and user prompt templates for query generation based on a shortcut + +# A.3 TASK DEFINITION AND METRICS + +Considering the context limitations of LLMs, we excluded shortcuts longer than 30 and parts using the API is.workflow-actions.runworkflow to call other shortcuts. While these shortcuts remain in our open-source dataset, they will not be included in the evaluation. We aim to study + +the performance of agents on queries of varying difficulties. As shown in Table 3, we categorize SHORTCUTSBENCH into 4 difficulty levels and 8 task types based on $|aseq_i|$ and "shortcut type" (Section 3.1), respectively. + +In calculating the length of shortcut commands, we do not simply count the number of actions within the shortcut. Instead, we apply a specialized approach. Initially, certain actions that do not contribute meaningful operations, such as isworkflowActions.comment and isworkflowactions(alert), which are akin to comments in programming, are excluded. Furthermore, we disregard the length of certain control flow statements, including isworkflowactions conditional, isworkflowActionschoosefrommenu, isworkflowactionsrepeat.count, isworkflowactionsrepeat.each. For branching statements, we consider the length of the longest branch, rather than the cumulative length of all branches. + +When categorizing shortcuts, we first analyzed all available categories from the CategoryInStore field in the collected data. We then classified the shortcuts into 8 categories, referencing with the classification of apps on the Apple App Store (app). The categories are as follows: + +1. Productivity & Utilities +2. Health & Fitness +3. Entertainment & Media +4. Lifestyle & Social +5. Education & Reference +6. Business & Finance +7. Development & API +8. Home & Smart Devices + +Subsequently, I employed a language model to categorize all shortcuts using the prompt shown in Figure 10. + +# A.4 PERFORMANCE ABOUT API SELECTION + +Following existing work (Huang et al., 2024b; Patil et al., 2024; Xu et al., 2024), we use the accuracy of API selection as the metric. The accuracy is calculated as the number of correct API selections $m_{p}$ divided by $n_{p}$ . Specifically, each time we predict an action $b_{j}, 1 \leq j \leq |aseq_{i}|$ , we provide the agent with all the correct historical actions $\{a_{1}, a_{2}, \dots, a_{j-1}\}$ . We then require the agent to predict the next action. All actions predicted by the agent form the prediction sequence $bseq_{p,i}$ . This method is similar to the next token prediction (NTP) in LLMs, effectively preventing a cascade of errors in subsequent action predictions due to a single incorrect prediction. During the prediction, when encountering special actions such as branching and looping, we skip predicting these actions and directly add them to the historical actions. + +Specifically, when calculating the precision of API selection, we do not consider the contributions of control statements such as branches and loops. This avoids the unreasonable requirement for the agent to invoke "branch APIs" or "loop APIs" in the next action. The agent should inherently possess the ability to correctly understand and act according to the conditions dictated by branches and loops. In addition to excluding the contributions of these control statements, we also disregard contributions from isworkflowActions/comment and isworkflow ACTIONS(alert, effectively removing these non-operative commands from the history of actions provided to the agent. + +# A.5 EFFECTIVENESS OF API PARAMETER VALUE FILLING + +To further ensure that the corresponding parameters are indeed included in the queries during evaluation, we used the LLM to filter these parameters further, ensuring their presence in the queries. Detailed prompts can be found in Figure 11. + +# SYSTEM_prompt_template: + +Shortcut consist of a sequence of actions, each is an API call, to execute user-provided queries. + +As a friendly and patient assistant, you need to categorize the provided shortcut into one of the following eight categories: + +1. Productivity & Utilities +2. Health & Fitness +3. Entertainment & Media +4. Lifestyle & Social +5. Education & Reference +6. Business & Finance +7. Development & API +8. Home & Smart Devices + +For each shortcut command, I will provide you with five fields: + +1. 'RecordName': The name of the shortcut, briefly describing its function. +2. 'Description of the Shortcut Workflow': A description of the entire action workflow of the shortcut. +3. 'Comments': Optional. Notes from the shortcut's developer, which may describe its functions or other features. +4. 'Description in Store': A description of the shortcut's functionality provided in the shortcut store. +5. 'API Description List': Detailed descriptions of the APIs involved in the shortcut. + +You should rely primarily on the 'Description of the Shortcut Workflow' and 'API Description List', and refer to 'RecordName', 'Comments', and 'Description in Store' to give the final category. + +# USER_prompt_template: + +Below are the five fields I provide to you: + +1. 'RecordName': {RecordName} +2. 'Description of the Shortcut Workflow': {DescriptionoftheShortcutWorkflow} +3. 'Comments': {Comments} +4. 'Description in Store': {DescriptionInStore} +5. 'API Description List': {APIDescriptionList} + +Please give the category on these details. Alongside the category, provide the shortcut's name and a description of its functionality in English using the following JSON format: + +```json +{ + "category": "category", + "english_name": "ThisIsShortcutName", + "english_functionality": "ThisIsFunctionality" +} +``` + +Do not output any other content; your response should only be in this JSON format. + +Output the JSON directly without using "json XX"" to enclose it. Please give your answer in English. + +Figure 10: System and user prompt templates for categorizing shortcuts based on their functionalities + +# SYSTEM_prompt_template: + +Your task is to classify the parameters I provide based on user queries, API information, and API calls (also known as actions). + +User query describes the task the user wants to accomplish. + +Information about the API definition includes the API name, parameter names, parameter types, default values, return value names, and return value types. Parameters are identified by 'Parameters' and explained. The return value names and return value types are identified by 'Return Values'. The API's brief and detailed descriptions are marked by 'Description'. The natural language description of the API is marked by 'ParameterSummary'. + +Completing the user query requires a series of API calls, each API call needs the correct and appropriate parameters. We have pre-selected possible parameters that may appear in the query. + +Please note, you must classify these pre-selected parameters based on the user query. Each parameter can generally be classified into the following categories: + +1. Precise parameter: Parameters stated by users in the query, or those implicitly indicated in the query but can be accurately inferred by combining the query and the API definition. +2. Not precise parameter: Parameters not stated by users in the query and cannot be accurately inferred even with the combination of the query and the API definition. + +Note! Note! Note! all precise parameters must be clearly or implicitly specified in the query. + +# USER_prompt TEMPLATE: + +The user query is: {query} + +Information about the API definition is provided below: {api_desc} + +The API call is: {API_call} The pre-selected possible parameters that may appear in the query are listed below: {possible_paras} + +Output the classification in the following format: + +```txt +{ para_name1: { para_name1:para_type1, "reason1":The reason }, para_name2:{ para_name2:para_type2, "reason2":The reason }, 1 +``` + +Do not output any additional content; only output a JSON. Do not enclose your output with “`json XXX'”. + +Note! Note! Note! all precise parameters must be clearly or implicitly specified in the query. + +Figure 11: System and user prompt templates for classifying parameters based on user queries and API definitions + +# A.6 RECOGNITION OF NEED FOR INPUT + +In the shortcut, a parameter can be set to ExtensionInput, indicating that the parameter requires a file provided by the user, or CurrentDate, indicating that the parameter needs to retrieve the date from the system. Similarly, Clipboard indicates that the parameter should obtain content from the clipboard, and DeviceDetails implies that the parameter needs to access certain information about the user's device. Lastly, Ask denotes that the parameter requires user authorization or + +essential input from the user. A typical example is shown in Figure 12, where the action uses the is.workflow actions.getmyworkflows API. The Folder parameter is set to Ask, indicating that this parameter requires input provided by the user. + +```json +{ "WFWorkflowActionIdentifier": "is.workflow actions.getmyworkflows", "WFWorkflowActionParameters": { "Folder": { "Value": { "Type": "Ask" }, "WFLocalizationType": "WFTextTokenAttachment" }, "UUID": "E5F695A5-9DD3-4720-84D2-9AB0AD457908" } } +``` + +Figure 12: An example of Ask parameter. + +# A.7 SETUP + +Following existing work (Huang et al., 2024b; Qin et al., 2024; Li et al., 2023), we slightly modified the ReACT (Yao et al., 2023) templates to construct the API-based agents. The templates used in our experiments are as shown in Figure 13. + +# A.8 RESULT ANALYSIS + +Table 6: Pricing, Testing Instances, and Actual Costs of Popular AI Models. (07-22-24). Except for gemini-1.5-pro, which was randomly tested on 800 instances due to cost considerations, all other LLMs were tested across all datasets. However, the number of successful tests varied slightly due to factors such as context length, safety reviews, and etc. The cost of testing primarily stems from inputs, as we continuously feed historical actions into the LLM for evaluation, and all historical conversations are billed repeatedly (OpenAI Community, 2023). + +
Model NamePrice / 1M tokensInstancesEstimate Cost ($)
gemini-1.5-pro$3.50 / $10.50801592
gemini-1.5-flash$0.35 / $1.055295391
qwen2-72b-instruct$0.70 / $1.405216800
qwen2-57b-a14b-instruct$0.49 / $0.985368580
GPT-4o-mini$0.15 / $0.605320100
gpt-3.5-turbo$0.50 / $1.505463500
deepseek-chat$0.14 / $0.28531990
deepseek-coder$0.14 / $0.28531790
GLM-4-Air$0.14 / $0.145330110
Total Cost3253
+ +Among them, gemini-1.5-pro (tested with 801 instances) and gemini-1.5-flash (tested with 5,295 instances) incurred a total cost of $801, with gemini-1.5-flash accounting for approximately $391 and gemini-1.5-pro approximately $592. The costs for qwen2-72b-instruct (tested with 5,216 instances) were about $800, qwen2-57b-a14b-instruct (tested with 5,368 instances) around $580, and GPT-4o-mini (tested with 5,320 instances) approximately $50. gpt-3.5-turbo (tested with 5,463 instances) cost approximately $500. The combined expenses for deepseek-chat (tested with 5,319 instances) and deepseek-coder (tested with 5,317 instances) were roughly $180, while GLM-4-Air cost about $110. + +# SYSTEM_prompt_template: + +You are AutoGPT. Your task is to complete the user's query using all available APIs. + +First, the user provides the query, and your task begins. + +At each step, you need to provide your thought process to analyze the current status and determine the next action, with an API call to execute the step. After the call, you will receive the result, and you will be in a new state. Then, you will analyze your current status, decide the next step, and continue... After multiple (Thought-Call) pairs, you will eventually complete the task. + +Below are all the available APIs, including the API name, parameter names, parameter types, default values, return value names, and return value types. {all_api_descs} + +For each step, use only one API. Strictly follow the JSON format below for your output and do not include any irrelevant characters. + +```json +{ "Thought": "Your analysis of what to do next", "WFWorkflowActionIdentifier": "The API name you call", "WFWorkflowActionParameters": { "parameter name": "parameter value" } +} +``` + +WFWorkflowActionParameters are the parameters required for the API call. The parameter value might be: + +1. basic data types like string, integer, float, or boolean. +2. output from previous API call. +3. input from the system or the user, including file provided by the user. +4. Previously defined variable names. +5. If the parameter is of type string, you can also combine the output of a previous action, input from the system or the user, with a string. +6. If the output of a previous action is an Object type, or if you need to use input from the system or the user, you can utilize specific properties from the previous action's output. + +# USER_prompt_template: + +The user query is: {query} + +The history actions and observations are as follows: {history_actions} + +Please continue with the next actions based on the previous history. Do not output any other content; your response should only be in this JSON format. + +You should only output one action at a time. + +Figure 13: System and user prompt templates for executing API calls based on user queries + +The cost analysis indicates a notable range in efficiency and value for money. Models like deepseek-chat and deepseek-coder show excellent cost-effectiveness, particularly suitable for high-volume, low-cost deployments. In contrast, models like gemini-1.5-pro and gemini-1.5-flash reflect higher costs, but they offer superior performance. + +# A.9 ADDITIONAL RESULTS ON EVALUATION ON SPECIALIZED API-CALLING FINE-TUNED LLMS + +To comprehensively evaluate the effectiveness of fine-tuning LLMs for agent-based scenarios, we extended our comparison to include specialized AI agent models such as AgentLM (Zeng et al., 2024) and xLAM (Zhang et al., 2024), alongside general-purpose LLMs like Qwen-2-72B Qwen + +Table 7: Performance Comparison of Fine-Tuned and Base LLMs + +
ModelLLaMA-2-7B AgentLM-7BLLaMA-2-13B AgentLM-13BLLaMA-2-70B AgentLM-70B
BaseFine-TunedBaseFine-TunedBaseFine-Tuned
Context Length4k4k4k4k4k4k
API Selection32.7524.9538.5930.5752.1343.41
12.5717.4325.9935.4843.0837.34
23.7032.7835.4540.7857.7639.22
API Parameter Value Filling51.1134.8830.7731.8272.8652.83
32.1435.7112.5040.9845.0537.31
0.000.0011.1140.006.6711.11
Recognition of Need for Input7.4110.535.005.2621.740.00
12.504.170.003.577.699.09
0.000.000.000.000.000.00
ModelMistral-7B xLAM-7b-rMixtral-8x7b xLAM-8x7b-rLLaMA-2-70B Lemur-70B-Chat-V1
BaseFine-TunedBaseFine-TunedBaseFine-Tuned
Context Length32k32k32k32k4k4k
API Selection17.0370.5670.2185.2952.1352.45
3.2750.8249.1551.7243.0847.08
0.5066.3329.9229.6757.7660.39
API Parameter Value Filling40.0066.6753.4568.9372.8645.45
40.5459.3233.7246.7645.0536.49
11.1131.8227.2042.716.6726.92
Recognition of Need for Input0.005.566.2511.9021.7416.00
0.002.5619.2719.917.693.57
0.000.000.000.000.000.00
+ +(2024) and LLaMA-3-70B Meta (2024). This was aimed at understanding the applicability of fine-tuning strategies for API-based agents. + +We conducted experiments with additional 11 LLMs, comprising 6 models fine-tuned specifically for agent scenarios and 5 base models. The fine-tuned models include the AgentLM series (AgentLM-7B, AgentLM-13B, AgentLM-70B), the xLAM series (xLAM-7b-r, xLAM-8x7b-r), and Lemur (Lemur-70B-Chat-V1). The base models include various configurations of LLaMA-2 and Mistral from Hugging Face repositories. + +The fine-tuning processes of these LLMs varied: the AgentLM series was fine-tuned on 1866 traces of simple code data, Lemur utilized scripting and interpreted languages from The Stack dataset, and the xLAM series was specialized for API-based agents with a predefined format for API calls. To ensure standardized evaluation, outputs were processed using gpt-4o-mini, with manual verification confirming the accuracy of conversions. Due to context length limitations (4k tokens for most models and 32k tokens for xLAM series), results are reported for the first 3 difficulty levels. + +Experimental results are summarized in Table 7. + +# A.9.1 RECOGNITION OF NEED FOR INPUT + +All evaluated LLMs performed exceptionally poorly in the recognition of need for input, significantly lagging behind the general LLMs mentioned in the ShortcutsBench. Compared to the performance of the base LLMs before fine-tuning, neither the AgentLM and Lemur series models fine-tuned on code nor the xLAM series models fine-tuned specifically for API-based agents showed any improvement + +in this aspect. This suggests the need for targeted fine-tuning specifically aimed at enhancing this capability. + +# A.9.2 API PARAMETER VALUE FILLING + +The evaluated LLMs perform significantly worse in API Parameter Value Filling compared to the general LLMs mentioned in ShortcutsBench. The general LLMs achieve accuracies of $94.29\%$ , $83.92\%$ , and $75.53\%$ across three difficulty levels, whereas the best results from the evaluated models only reach accuracies of $72.86\%$ , $59.32\%$ , and $42.71\%$ . + +Compared to the base LLMs before fine-tuning, the code-based agents, including the AgentLM and Lemur models fine-tuned on code, did not achieve a general improvement in parameter-filling accuracy for API-based tasks and even exhibited performance degradation. In contrast, the API-based agents, such as the xLAM series fine-tuned specifically for API-based agents, showed a consistent improvement in parameter-filling accuracy. The existing fine-tuning methods for API-based agents (xLAM-7b-r / xLAM-8x7b-r) are effective for parameter filling in short sequences, but accuracy drops sharply as the context length increases. + +# A.9.3 API SELECTION + +Methods fine-tuned specifically for API-based agents, such as the xLAM series models, can significantly enhance agents' API selection accuracy. The xLAM series achieves reasonable accuracy in API selection, even compared to general LLMs. However, compared to xLAM-7b-r, the API selection accuracy of xLAM-8x7b-r is significantly lower, suggesting that existing fine-tuning methods specialized for agents may only achieve notable improvements on models with relatively weaker foundational capabilities. + +Additionally, methods fine-tuned on code can still enhance agents' API selection accuracy, as demonstrated by the AgentLM-7b/13b and Lemur-70b-chat-v1 models. The performance drop of AgentLM-70b may be attributed to the fine-tuning dataset used for the AgentLM series lacking realism and complexity. \ No newline at end of file diff --git a/ICLR/2025/ShortcutsBench_ A Large-Scale Real-world Benchmark for API-based Agents/images.zip b/ICLR/2025/ShortcutsBench_ A Large-Scale Real-world Benchmark for API-based Agents/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..bd2c81e4d72400c2c5d618cf48ddd11ba0a5ad33 --- /dev/null +++ b/ICLR/2025/ShortcutsBench_ A Large-Scale Real-world Benchmark for API-based Agents/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:98398a923dfc83ce423a90acda7c94d98df079d1941e6e81ef535b9bbb468162 +size 827781 diff --git a/ICLR/2025/ShortcutsBench_ A Large-Scale Real-world Benchmark for API-based Agents/layout.json b/ICLR/2025/ShortcutsBench_ A Large-Scale Real-world Benchmark for API-based Agents/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..6005037d61cec686870a407b82bdcd43c3fc3ef5 --- /dev/null +++ b/ICLR/2025/ShortcutsBench_ A Large-Scale Real-world Benchmark for API-based Agents/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:48df15967fec04fb51deed40950c5d2c327ddf483c28f77b442823d46e52d642 +size 832882 diff --git a/ICLR/2025/Shot2Story_ A New Benchmark for Comprehensive Understanding of Multi-shot Videos/1ce25ece-20d3-4625-a961-7411e9744648_content_list.json b/ICLR/2025/Shot2Story_ A New Benchmark for Comprehensive Understanding of Multi-shot Videos/1ce25ece-20d3-4625-a961-7411e9744648_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..c04dcf4289d98e2f90f90e7525adde9e138aaf9e --- /dev/null +++ b/ICLR/2025/Shot2Story_ A New Benchmark for Comprehensive Understanding of Multi-shot Videos/1ce25ece-20d3-4625-a961-7411e9744648_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:684aa95ebde9a84a28e3e70962b726947a649bef73d85be642415036325fa1f0 +size 84957 diff --git a/ICLR/2025/Shot2Story_ A New Benchmark for Comprehensive Understanding of Multi-shot Videos/1ce25ece-20d3-4625-a961-7411e9744648_model.json b/ICLR/2025/Shot2Story_ A New Benchmark for Comprehensive Understanding of Multi-shot Videos/1ce25ece-20d3-4625-a961-7411e9744648_model.json new file mode 100644 index 0000000000000000000000000000000000000000..0dc1fafba6f2430e8aae8b41b7c205a88352ef3f --- /dev/null +++ b/ICLR/2025/Shot2Story_ A New Benchmark for Comprehensive Understanding of Multi-shot Videos/1ce25ece-20d3-4625-a961-7411e9744648_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ac0a220a621a730fa2d6578328093380d252e1aa6321aaaae84a850e73866b41 +size 102056 diff --git a/ICLR/2025/Shot2Story_ A New Benchmark for Comprehensive Understanding of Multi-shot Videos/1ce25ece-20d3-4625-a961-7411e9744648_origin.pdf b/ICLR/2025/Shot2Story_ A New Benchmark for Comprehensive Understanding of Multi-shot Videos/1ce25ece-20d3-4625-a961-7411e9744648_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..4ebcaa5b0021bba59f5c8c8854aaeaec05ec12cf --- /dev/null +++ b/ICLR/2025/Shot2Story_ A New Benchmark for Comprehensive Understanding of Multi-shot Videos/1ce25ece-20d3-4625-a961-7411e9744648_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cb803720df97ccfde4cb8deb088a0c63e3e0c3e13f02f92e9a1abab4dbbe62f0 +size 2328238 diff --git a/ICLR/2025/Shot2Story_ A New Benchmark for Comprehensive Understanding of Multi-shot Videos/full.md b/ICLR/2025/Shot2Story_ A New Benchmark for Comprehensive Understanding of Multi-shot Videos/full.md new file mode 100644 index 0000000000000000000000000000000000000000..cc2ba222040a3fb7bc0cc0963676127656661efa --- /dev/null +++ b/ICLR/2025/Shot2Story_ A New Benchmark for Comprehensive Understanding of Multi-shot Videos/full.md @@ -0,0 +1,318 @@ +# SHOT2 STORY: A NEW BENCHMARK FOR COMPREHENSIVE UNDERSTANDING OF MULTI-SHOT VIDEOS + +Mingfei Han $^{1,2,3,5\dagger}$ , Linjie Yang $^{1\dagger}$ , Xiaojun Chang $^{3,4}$ , Lina Yao $^{5}$ , Heng Wang $^{1}$ + +1Bytedance Inc. 2ReLER Lab, AAII, UTS 3Department of Computer Vision, MBZUAI + +$^{4}$ University of Science and Technology of China ${ }^{5}$ Data61, CSIRO + +https://github.com/bytedance/Shot2Story + +# ABSTRACT + +A short clip of video may contain progression of multiple events and an interesting story line. A human need to capture both the event in every shot and associate them together to understand the story behind it. In this work, we present a new multi-shot video understanding benchmark Shot2Story with detailed shot-level captions, comprehensive video summaries and question-answering pairs. To facilitate better semantic understanding of videos, we provide captions for both visual signals and human narrations. We design several distinct tasks including single-shot video captioning, multi-shot video summarization, and multi-shot video question answering. Preliminary experiments show some challenges to generate a long and comprehensive video summary for multi-shot videos. Nevertheless, the generated imperfect summaries can already achieve competitive performance on existing video understanding tasks such as video question-answering, promoting an under-explored setting of video understanding with detailed summaries. + +# 1 INTRODUCTION + +Video captioning is a long-standing video understanding task to facilitate open-world video analysis with the help of human-annotated captions. Since a video may contain multiple events, dense captioning benchmarks (Ego4D (Grauman et al., 2022), YouCook2 (Zhou et al., 2018), ActivityNet-Caps (Krishna et al., 2017)) capture information of multiple events in videos ranging from 3-20 minutes. However, even within seconds, more than one event often occurs in daily videos such as news broadcasts, tutorial videos, and movies. Specifically, shot transition, which is a common technique to transfer from one event to another, or to switch the viewpoint of a single event, happens less than every 4s for average English movies after 2010 (Cutting et al., 2011). Although some existing captioning benchmarks (Xu et al., 2016; Krishna et al., 2017; Zhou et al., 2018) already use multi-shot videos, they often annotate the captions in a coarse-grained manner, either providing a holistic caption or asking annotators to subjectively choose the boundary of each event. To better accommodate the multi-shot formation of videos, we believe a new video benchmark with rich textual descriptions based on video shots is favored in the research community. + +On the other hand, multi-shot videos are often accompanied by rich narrations that relate to the different events happening in the video. A model needs to capture both the visual and audio signals to understand the underlying story. Specifically, narrations may contain key information that cannot be inferred from pure visual information only. See Figure 1 without the narration, a viewer is unable to capture the relationship between the man's action and the avocado product in the first shot. + +In this work, we propose a new benchmark Shot2Story for audio-visual understanding of multi-shot videos. We collect a dataset of 42,958 short videos where the average number of shots in each video is 4.4. For each video shot, we annotate a detailed textual description for the video frames and another textual description for the human speech. We also leverage a state-of-the-art large language model (LLM) GPT-4 (OpenAI) to generate a long textual video summary from the annotated clip descriptions, which are further verified by human annotators. The summary includes additional details such as transitions of different shots, progression of multiple events, and mapping of the subject identities in different scenes. An example of one annotated video is shown in Figure I. + +
Shot 0: 0-6.5s +Caption: It's a man in a kitchen chopping something with +a knife. The man is wearing a T-shirt with the number +19 on it. He seems to hurt himself and appears in pain. +The video is in black and white. The yellow words +"DON'T RISK IT" appear on the screen. Then the scene +changes to a bowl of guacamole with chips on the side. +Narration Caption: The background voice says don't risk +getting injured from cutting up avocados.Shot 1: 6.5-10.5s +Caption: It's a close-up of a person +scoping avocado out with a spoon +on a wooden cutting board. There is +also a white bowl next to it. +Narration Caption: The background +voice says the product is +refrigerated and pre-scooped for +the customers.Shot 2: 10.5-13.5s +Caption: It's a woman in a pink +shirt with a cast on her arm. She +holds her thumb up with the injured +arm. The word "SWEET" in purple is +typed on the screen.Shot 3: 13.5-15.7s +Caption: It's a bowl of guacamole +with chips on the side. There is a +plastic container of guacamole +with a purple package next to it.
+ +Figure 1: An annotated example of our Shot2Story with sing-shot visual captions and narration captions. Moreover, we provide coherent and reasonable video summaries, and question-answering pairs to facilitate comprehensive understanding of multi-shot videos. + +To benchmark the advances of multi-modal video understanding, we designed several distinctive tasks using our dataset, including single-shot video captioning, multi-shot video summarization, and multi-shot video question answering. We design and implement several baseline models using a frozen vision encoder and an LLM, by prompting the LLM with frame tokens and ASR (Automatic Speech Recognition) text. Through extensive experiments, we show that: (1) the ASR text is critical to joint understanding of visual and audio content, (2) processing the video as a whole without the shot structure degenerates the model's capacity of understanding the multi-shot video, (3) the summarization model trained on our multi-shot summaries can be used on the proposed multi-shot QA benchmark and generalized to other datasets with longer durations (ActivityNet(Krishna et al., 2017)) and out-of-domain topics (MSRVTT(Xu et al., 2016)), validating the quality of our annotated summaries. Without any bells and whistles, we attain competitive results on zero-shot video question-answering by converting the problem into pure text-based QA with the generated video summaries. + +# 2 THE SHOT2STORY BENCHMARK + +Our new benchmark Shot2Story contains 42,958 videos. The length of each video is ranging from 10s to 40s. We first use an off-the-shelf shot detection method TransNetV2 (Souček & Lokoc 2020) to split each video into shots. For each video shot, we annotate captions for both visual and audio information. Then we further annotate video summaries based on the annotated shot captions. Figure 2 shows an overview of our dataset with some key statistics. + +# 2.1 DATA PREPARATION + +We source videos for our dataset from the public video benchmark HD-VILA-100M (Xue et al., 2022). It offers a large collection of narrative videos, comprising 3M YouTube videos segmented into 100M clips, each about 13 seconds long. We choose this data source for its concise yet complex multi-shot formats, diverse topics, and abundant ASR content. Since we prefer videos with both rich visual and ASR information, we design several filtering techniques to exclude those videos with either low visual-ASR correlation or static visual content. + +We start with keeping video clips with durations between 10 to 40 seconds, since we observe that the majority of the video clips from HD-VILA-100M fall in this range. Then we remove videos with more than 8 shots due to the heavy annotation cost. We also notice that the video segments with too many shots in HD-VILA-100M tend to be slideshows or image collages that deviates from our focuses. Further, to harvest videos with rich visual-ASR correlations, we set up a metric between + +![](images/35e627fb89ce22996970c5d4432aa0af13fc0090b679aa3be7659d32db2c3de4.jpg) + +![](images/80ad9a4ec3f90386e13206a430a2dd229bf016c268f86a17ef2743de62da1c69.jpg) + +![](images/59df4d8cf484dabac37a76933033ee083cb219a0eaa9db45cc1c3bd76645409c.jpg) + +![](images/19fb98efceda4e7683bb02d8459457da77301629c50613f009d577b0479fbaa2.jpg) + +![](images/c0a197707b0c69ece832cad196dfa7ac34073c22c4abe30f628b6f58ce4307ef.jpg) +Figure 2: Statistics of Shot2Story. Our dataset features detailed visual captions and narration captions, and video summaries, highlighting video progressions, transitions, camera cuts and narration descriptions, with statistics of frequent expressions depicted in the figure. + +![](images/5a960c59b1eb3c429b0280330811230df8013049ab6ec8bed3ef036e09856c51.jpg) + +![](images/5fea81206990ab3c6f20ca0506993c8961e048eb3968f3f00edcf73f59e2508b.jpg) + +video shots and ASR texts. Specifically, we uniformly sample 4 video frames for each shot and obtain the cosine similarity score between the video shot embedding and the text embedding using CLIP (Radford et al., 2021) encoders. We only keep the videos containing at least one shot that is visually correlated to ASR with a threshold of 0.25. Next, in order to obtain videos with diverse shot contents, we set up an inter-shot metric to filter out the videos with similar adjacent shots. We compute the cosine similarities between embeddings of adjacent shots and keep the videos with all inter-shot similarity scores smaller than 0.9. Finally, to further remove the videos with static contents, we adopt an intensity-based scene change detector in PySceneDetect with a low threshold of 11 on our segmented shots. If the filter is unable to detect scene changes at this low threshold, it is conceivable that the shot contains static contents. We only keep the video clips in which all shots contain no static content based on our filtering method. + +As a result, from a total of 2.1M sampled video clips from HD-VILA-100M, we obtain 42,958 video clips that meet our quality standard. The number of shots in each video is from 2 to 8. These videos are then shared with our annotators for further annotations. + +# 2.2 ANNOTATION OF SINGLE-SHOT CAPTIONS + +After using TransNetV2 to divide the target videos into video shots, we ask annotators to annotate both visual-only captions and audio-related captions for each shot. We split these two caption annotation to facilitate separate modeling of these two types of information source. For visual-only captions, we require annotators to describe the major subjects and events in the video. Since it is an open-world setting, the videos can be quite diverse and hard to describe. In order to reduce the difficulties of annotating a caption from scratch, we generate an initial video caption using MiniGPT-4 (Zhu et al., 2023) by sampling 4 image frames from the video clip and prompting the model using below prompt. + +```python +##Human: Frame1Frame2Frame3Frame4 +Please describe this video. Do not include details that you are not sure of. For example, if there is text in the image, do not include the content of the text if they are not clearly shown. ##Assistant: + +Although MiniGPT-4 is originally designed for image understanding, empirically it is able to generate captions for short video clips, both comprehensively and reasonably. It is able to describe different subjects including persons, animals, food, tools, and virtual objects like animated characters. Annotators are first instructed to correct any errors in the original captions. The mistakes include incorrect descriptions of the object categories, attributes, actions, facial expressions, etc. Also, there might be some subjective descriptions generated by MiniGPT-4 such as emotion and atmosphere. We ask annotators to remove all these subjective descriptions. We then ask annotators to supplement the + +Table 1: High-level comparison of our dataset to previous ones. The summary length of ActivityNet and YouCook2 are combined length of captions in one video. M and G denote manual and generated. + +
DatasetAnnotationMulti-shot VideoMulti-event DescriptionsDetailed SummarySummary Length#VideosAvg. Duration
MSRVTT (Xu et al., 2016)M✓✘✘-10K15s
ActivityNet Caps (Krishna et al., 2017)M✓✓✘52.420K3min
VideoStorytelling (Li et al., 2019)M✓✓✓162.610512.5min
Ego4D (Grauman et al., 2022)M✘✓✘-10K23min
YouCook2 (Zhou et al., 2018)M✓✓✘67.82K6min
VAST (Chen et al., 2024)G✓✘✓32.427M5~30s
Shot2StoryM+G✓✓✓218.343K17.1s
+ +information about the major subjects, actions, and backgrounds present in the video. The goal is for the resulting captions to accurately capture the key elements of each video shot. Statistics show over $80\%$ of single-shot visual captions are manually corrected. For narration captions, annotators should watch the video and interpret the audio content that visually correlates into descriptive narration, including information sources. For example: "According to the woman in white, the room is not very clean." All narration captions are manually drafted from scratch. An example of this annotation process is shown in Appendix A.1 where the annotator corrects the caption from "standing in front of the car" to "getting close to the car", and adding a missing detail of "a close-up shot of the front". In this way, we find the annotation speed significantly faster $(\sim 3\times)$ compared to writing a caption from scratch. On the other hand, we find the captions generated this way has more coherent style and tend to cover more details of the video. + +In contrast to the traditional video captioning benchmarks (Xu et al., 2016; Krishna et al., 2017; Zhou et al., 2018), we also annotate narration captions in addition to the visual-only captions. Different from existing audio captioning benchmarks (Gemmeke et al., 2017), we focus more on human speeches rather than acoustic events. Annotators are required to associate the human speech with the video content and summarize the main idea of the speech. We require annotators to describe the source of the speech using visual information. For example, if someone is talking, the annotators need to describe which person in the video is talking. If the human speech refers to some object in the video, the annotator is required to describe which object in the video the speaker is referring to. Note that the speaker identity and reference of visual objects are critical information for understanding a video that cannot be trivially obtained using existing algorithms. There are existing research on speaker identification (Kim et al., 2021) and visual grounding (Anne Hendricks et al., 2017; Zhou et al., 2019), but they only work well on constraint scenarios. + +# 2.3 ANNOTATION OF VIDEO SUMMARY + +To create video summaries with annotated video-shot captions, we leverage an LLM-based approach. Specifically, we form a text prompt with incorporating all shot captions and ASR text included, and uses GPT-4 (OpenAI) to generate a cohesive summary. The text prompt we use is shown in Appendix A.2. The quality is assured through further review and correction by our annotators. + +We prompt GPT-4 to produce coherent, fluent text summaries with transition expressions such as "the video begins", "following this", and "in the final scene" to connect video-shot descriptions. The generated annotations also encompass a higher-level understanding of shots, using key phrases such as "scene shifts back" and "returns to the scene" to denote recurring scenes across shots. Notably, GPT-4 often identifies and links the same subjects across scenes without relying on explicit re-identification models. It draws on descriptive and attributive text from shot captions like "a newsroom" or "a man wearing a black suit" to infer scene or subject identity. To ensure quality, annotators carefully review and correct any inconsistencies in scene or subject references within summaries. Since our shot-level captions for generating video summaries are manually checked and annotated, the initial video summaries merely have factual errors, with exceptions for some subject identity and scene mismatches. We require annotators to pay more attention to these errors and ensure holistic summary is accurate and comprehensive. Statistics show that over $40\%$ summaries are manually corrected. + +Despite the rigorous verification process, the reliance on automated generation introduces certain inaccuracies and biases. Common pitfalls in the generated summaries include the omission of minor yet contextually important details and a bias towards emphasizing more prominent actions or objects, + +potentially overlooking less conspicuous elements. This is partly due to our dataset predominantly featuring human-centric activities, as a result of our video filtering process that selects videos rich in visually related audio information and sourcing from HDVILA [Xue et al. (2022)], which primarily curates content related to human activities. Consequently, our annotations tend to highlight salient events and large-scale objects essential to the video's storyline, mentioning smaller objects only when they directly contribute to the narrative. + +# 2.4 ANNOTATION OF QUESTION-ANSWERING PAIRS + +We annotate the question-answering pairs on videos in validation and testing splits. To construct this benchmark, we begin with the human-annotated video summaries from Section 2.3 which is detailed in video content. We then prompt GPT-4 (Achiam et al., 2023) to generate candidate question-answer pairs in three predefined categories: temporal-related (e.g., Does the woman appearing at the end of the video wear any accessories?), multi-shot holistic understanding (e.g., What is the overarching theme of the video?), and audio content related (e.g., Which specific car model does the background voice mention, and what visual features confirm its identity?). The text prompt we use is shown in Appendix B.3 + +The quality is then assessed through further automatic filtering and manual checks. Annotators are instructed to verify each question-answer pair against the video content and discard any with mistakes. Simultaneously, they are asked to categorize the questions, where a single question might fall into multiple categories, facilitating evaluating different aspects of multishot understanding i.e., understanding sequences of events and actions (temporal related), integrating information across multiple shots (holistic understanding), correlating audio content with visual elements (audio related), and others (directly discarded). After this verification, annotators carefully review the quality of the questions to ensure they solely correlate with the video content and that the answers are not revealed in the question texts. This step includes a thorough manual check to address potential mistakes and biases from the initial verification. Through these sequential annotation stages, we ensure high-quality annotations. The process starts with detailed manual single-shot captioning, followed by careful verification and correction at each stage. Even with LLMs introduced to reduce workload, the human-involved process and thorough procedures keep the resulting annotations well-aligned with human labeling. + +Subsequently, to optimize clarity and reduce unnecessary information in the QA pairs, we remove QA pairs with questions exceeding 28 words or answers exceeding 20 words. Then, we employ Vicuna-13B (Chiang et al., 2023) to attempt answering the questions without video context and discard those answerable without accessing the videos. Finally, the pairs are tested against popular methods such as Video-LLaVA (Lin et al., 2023), LLaMAVID (Li et al., 2023c), Video-ChatGPT (Maaz et al., 2023), and VideoChat2 (Li et al., 2023c). Questions correctly answered by more than two models are excluded to guarantee that our dataset poses a substantial challenge. Finally, we obtain 4905 QA pairs for validation and 6465 QA pairs for testing set. + +![](images/4e81388cb52ac522ed24a51628b8890650ffff13efa213c1664e19f8f73cd521.jpg) +Figure 3: Distribution of multi-shot video QA benchmark. Questions from different categories overlap. All-shared means questions fall under all three categories. + +# 2.5 COMPARISON TO EXISTING BENCHMARKS + +Compared to existing video description datasets, our dataset is more challenging due to the explicit modeling of the multi-shot nature of web videos. Our textual description includes both shot-level captions and video-level summaries, combining visual and audio understanding, which provides a unique test bed for multi-modal video understanding. Table I shows a high-level comparison of our new dataset with existing video captioning benchmarks. Most existing video captioning benchmarks, such as MSRvTT (Xu et al., 2016), YouCook2 (Zhou et al., 2018) and ActivityNet Caps (Krishna et al., 2017), also use multi-shot videos as annotation source, but they either annotate a holistic caption for the video (MSRVTT) or ask annotators to decide the boundary of different events. In our study, we observe that video shots naturally create a sequence of related events, motivating us to annotate distinct captions for each shot. Ego4D (Grauman et al., 2022) only annotates dense visual captions but not audio captions for relatively long egocentric videos. Video Storytelling (Li et al. + +Table 2: Performance of models on video shot captioning using different modalities, following the settings of VAST(Chen et al., 2024). The models are fine-tuned on Shot2Story video shot captions. V, A and S are abbreviated for vision, audio and subtitle (ASR text) respectively. + +
ModelFT ModalityB4MRC
VASTV+S10.716.130.333.8
VASTV+A+S10.716.130.434.0
MiniGPT4-CV9.214.727.925.1
MiniGPT4-CV+S11.816.730.135.9
VideoChat2-CV8.816.127.923.7
VideoChat2-CV+S13.818.732.143.9
+ +Table 3: Performance of models on video summarization. The models are fine-tuned on Shot2Story video summaries. V and S are abbreviated for vision and subtitle (ASR text) respectively. + +
ModelFT ModalityB4MRC
Video-ChatGPT w/o ASR (Maaz et al., 2023)V4.817.321.31.5
Video-ChatGPT (Maaz et al., 2023)V+S3.617.819.71.0
MiniGPT4-SUM-holisticV+S7.816.923.42.8
MiniGPT4-SUM-shot w/o ASRV10.418.525.84.8
MiniGPT4-SUM-shotV+S12.419.727.67.6
VideoChat2-SUM-shotV+S12.719.828.39.0
+ +2019) is a small-scale dataset with annotations of multiple events in a videos and provides a summary of the video by concatenating all captions. + +A recent work VAST (Chen et al., 2024) feeds generated video and audio captions into an LLM to generate video summary. However, it processes multi-shot video as a whole and lacks the granularity of the events in different shots. Moreover, VAST directly uses predicted captions without any human verification, leading to potentially noisy and biased summaries towards the captioning models. Our dataset stands out from VAST with its accurately annotated visual and narration shot captions. Although our video summary is also generated using an LLM, it is further verified by annotators to make sure there is no hallucinated details from the LLM. Our dataset has an average length of 218.3 words for the video summary, which is much longer than existing benchmarks, and is longer than the combined length of captions in one video in ActivityNet and YouCook2. + +Furthermore, our Shot2Story-QA introduces unique and complex challenges through its emphasis on shot transitions and multi-event progression, setting it apart from benchmarks like MSRVTT-QA Xu et al. (2017) and ActivityNet-QA Yu et al. (2019). For instance, unlike existing benchmarks Xu et al. (2017); Yu et al. (2019) that assess understanding at a single time point, e.g., "Who do three judges talk to?" (MSRVTT-QA, in Figure 19), or general inquiries like "What is the person in the video doing?" (ActivityNet-QA, in Figure 20), Shot2Story-QA includes "Temporal-related" and "Multishot Holistic Understanding" questions. A temporal-related question, such as "What is the man's immediate action after handling the skewer?" shown in Figure 21, requires models to comprehend the sequence and progression of events, linking consecutive actions meaningfully. Similarly, multi-event progression questions like "How does the setting change from the start to the end of the video?" necessitate understanding multiple concurrent events within their temporal context. This provides a more rigorous and nuanced evaluation framework for temporal understanding. + +# 3 TASKS AND EXPERIMENTS + +# 3.1 BASIC SETTINGS + +For all the tasks described in this section, we follow the same training/validation/test split. Specifically, the number of videos for training, validation, and test set are 36951, 1982 and 4025, respectively. We resize the frames to $224 \times 224$ . We adapt two popular VLMs to accommodate our tasks: MiniGPT-4 (Zhu et al., 2023) and VideoChat2 (Li et al., 2023c). For MiniGPT-4, we employ ViT-G/14 (Fang et al., 2022) and Q-Former (Li et al., 2023a) as visual encoder, and Vicuna v0-7B (Chiang et al., 2023) as the language model. We load pretrained Q-Former and MLP from MiniGPT-4 (Zhu et al., 2023). In training, we update only Q-Former and MLP parameters, keeping the ViT and LLM frozen. + +![](images/b6867da0f086a30e0019ce05e7b14db5981637125f7a4f07067006ecae351c5d.jpg) +Figure 4: Model structure for multi-shot video summarization model SUM-shot. We arrange visual tokens sequentially for each single shot and in a multi-shot format to encapsulate multi-shot information. Additionally, ASR text is incorporated for audio-visual video summarization. + +For VideoChat2, we employ UMT-L(Li et al., 2023d) as backbone and load pretrained Q-Former and MLP from VideoChat2 (Li et al., 2023c). During training, we adopt LoRA(Hu et al., 2021) and AdamW (Loshchilov & Hutter, 2017) with a learning rate of 8e-5. We train both models for 10 epochs with a batch size of 128 for single-shot video captioning. We finetune our video summarization models on the single-shot captioning models with a batch size of 32. For captioning and summarization, we evaluate the models using BLEU@4 (Papineni et al., 2002) (B), METEOR (Denkowski & Lavie, 2014) (M), ROUGE (Lin, 2004) (R), and CIDEr (Vedantam et al., 2015) (C). + +# 3.2 SINGLE-SHOTVIDEOCAPTIONING + +This task involves generating descriptions for individual video shots, where the target description is a concatenation of the visual-only and narration caption for a video shot. This task requires a joint understanding of visual and speech information. Specifically, we adopt a similar structure as we generate pseudo captions for data annotation in Section 2.2. First, we sample $N_{s}$ frames from a video shot, encode them using a fixed vision encoder, then feed the encoded features to a Q-Former to produce visual tokens. Further, we combine the visual tokens and an optional ASR text into a unified LLM prompt to facilitate both visual and narration understanding. We adapt the framework of MiniGPT-4 (Zhu et al., 2023) and VideoChat2 (Li et al., 2023c), with the two models denoted as MiniGPT4-C and VideoChat2-C for brevity. We compare with baseline model VAST (Chen et al., 2024), which is able to processes audio, vision, and subtitle inputs simultaneously. + +The results are shown in Table 2. Benefiting from extensive pretraining, VAST achieves 34 on C and 30 on R, comparable to MiniGPT4-C. Incorporating an additional audio modality results in a negligible performance difference, indicating that audio content only contributes marginally given the ASR text as input on our benchmark. We then assess variants of our models, MiniGPT4-C and VideoChat2-C, with and without the additional ASR text. It shows that including ASR texts significantly enhances performance across all metrics, with a notable boost in R and C, highlighting the relevance of audio content to our video captions. Furthermore, VideoChat2-C, featuring a superior visual backbone and extensive video pretraining, consistently outperforms MiniGPT4-C. This superiority highlights the importance of advanced visual backbone and video pretraining, confirming our benchmark's robustness. However, despite these advances, the results also indicate room for improvement. Figure 5(a) showcases output examples of our model's single-shot video captioning, detailing visual elements and audio content effectively, capturing actions like "gesturing to explain her fear" and secondary elements such as "a red stuffed doll next to her". + +# 3.3 MULTI-SHOTVIDEOSUMMARIZATION + +Multi-shot video summarization is a new task that is distinct from existing video description tasks. It requires the model to understand the shot structure of the given video and to provide a coherently paragraph to describe the progression of events in the different shots. Due to the complexity of this task, we adopt GPT-V (Achiam et al., 2023) to generate a supplementary training set, with video summaries for another 90K videos, sampled in the same approach as described in Section 2.1. Please + +![](images/dfff17e6f7651129cb9ed8e16a2edbd1c12688126c9a08c52d6e69192c37f579.jpg) + +![](images/77183abffa62e4d10d04ace87d37a0e3497705939ea948778b6c937ca9898bd9.jpg) +Human speech: explains to us the fear she has. + +![](images/3cb9a13f0e1dbb8ebc5ca0c0d4a5f2d7621d6d7d4fd672f07cad8034f5ade80a.jpg) + +Single-shot video captioning: + +in the video, a pregnant woman is sitting on a black couch. she is wearing a black halter top. there is a red stuffed doll next to her. she is gesturing to explain her fear. + +![](images/9c0f135d54610db45137a0c5a159686923ca61198d578c9cb124d2ab2ec1eec5.jpg) +Human speech: But when you look at something like this, how many man hours have gone into peeling back the matrix? + +Single-shot video captioning: + +in the video, a man in a blue shirt and a man in a hat are looking at a large rock in a room. The man in the blue shirt is querying how many man hours have spent. + +(a) Example predictions of single-shot video captioning. Videos: dR9jfG9Zr5A.2_516_578 and JPMGjObNQwk.58_161_287 + +![](images/031e96a33d2b746da5c3b3a7e5f7dbccc057a49f36fe9b2c5f0d72d21aab2f17.jpg) + +![](images/1235fc98aa778bf3885fd9754fce05ec26583bb3a41fa2243c9168899971350e.jpg) + +![](images/b925068a12349e72c22d24d24aa747b9913ee40338dbecd2960a567417f13c2b.jpg) +Figure 5: Example predictions of our models. (a) shows single-shot video captioning results of VideoChat2-C, which incorporates audio and visual content correctly (b) shows multi-shot video summarization of VideoChat2-SUM-shot, with accurate descriptions in green and errors in red, illustrating the model's ability to narrate event sequences (c) shows two sample questions of the video in (b). The answers are based on the generated summary of VideoChat2-SUM-shot. + +Human speech: Putter pocket holds two putters for quick and easy access in the front. We have a flap that you can close to protect your discs, but theres also velcro in there, so that when youre ready to play, you have easy access to your discs. + +VideoChat2-SUM-shot video summarization: + +the video begins with a close-up shot of a blue and black backpack resting on a wooden table. the backpack is adorned with a logo and features a putter pocket, as mentioned by a male voice in the audio. the scene then transitions to a man sitting at the same wooden table. he is dressed in a red shirt and black shorts, and he is surrounded by various backpacks. the man proceeds to open one of the backpacks, revealing its contents. as he does this, the male voice in the audio explains that the backpack has a flap that can be closed to protect the discs inside. in the final part of the video, the focus shifts to a close-up shot of the man's hand as he opens the backpack. the backpack is blue and black, with a logo on the front. the male voice in the audio explains that there is velcro in the backpack, which makes it easy for people to access their discs when they are ready to play. + +(b) Example predictions of multi-shot video summarization. Video: ETyfOQt9vtM.2 + +![](images/ec4a8660f90b555d5acbe21cf244368a2d726b0c31846d965a366c29cabc50b3.jpg) + +Temporal-related Question: What colors are visible on the backpack that is initially shown behind the frisbee? + +Ground-truth answer: Blue, gray, and white. + +Answer based on VideoChat2-SUM-shot summary: The backpack in the video has a pattern of blue, black, and white. + +Multi-shot Holistic Understanding Question: What is the overarching theme of the video? + +Ground-truth answer: Showcasing disc storage backpacks. + +Answer based on VideoChat2-SUM-shot summary: The overarching theme of the video is the demonstration of a backpack with features that make it suitable for playing disc golf. + +(c) Example questions and predicted answers of multi-shot video. Video: ETyfOQt9vtM.2 + +check the annotation prompt and data samples in Appendix B.5! First, we finetune an existing video caption model Video-ChatGPT (Maaz et al., 2023) by instruction-tuning it on our video summary data, with and without the additional ASR text input. Then, we experiment with three different architecture designs based on MiniGPT4. The first model MiniGPT4-SUM-holistic uses a similar pipeline as MiniGPT4-C. We uniformly sample 16 frames from the full video clip and prompt the LLM with frame tokens and ASR text. The second model MiniGPT4-SUM-shot w/o ASR, neglecting ASR input, uses a more refined framework by sampling 4 frames in each video shot and prompting the LLM with frame tokens from different shots, as is shown in Figure 4! The third model, MiniGPT4-SUM-shot further incorporates ASR text input as an additional input. Further, we replace the backbone of MiniGPT4-SUM-shot with the more advanced VideoChat2 model, resulting in the VideoChat2-SUM-shot model variant. Compared to SUM-shot, SUM-holistic does not have explicit shot information and relies on the LLM to parse the video shots using the provided frame features. + +Table 3 shows the results of the models. It is shown that MiniGPT4-SUM-holistic is worse than MiniGPT4-SUM-shot, showing the importance of the shot structure in predicting a video summary matching the transition of shots. MiniGPT4-SUM-shot w/o ASR underperforms compared to MiniGPT4-SUM-shot and outperforms MiniGPT4-SUM-holistic, highlighting the significance of both audio information and shot structure in multi-shot video understanding. Compared VideoChat2-SUM-shot and MiniGPT4-SUM-shot, the former model achieves the best performance, indicating the benefit of advanced vision backbone and video pretraining. Video-ChatGPT obtains much worse performance comparing to our models, potentially due to their weakness in processing multiple scenes and building the correlation between visual frames and ASR texts. It directly encodes the whole video into a sequence of tokens, potentially losing significant frame details and essential correlation between ASR and visual frames, while ours directly feed frames tokens into the LLM without compressing them. + +![](images/b008858a173e239cff197060510a29f563ca8f8e564885a286bce1d6469a2d11.jpg) + +VideoChat2-SUM-shot video summarization: + +in the opening scene of the video, a man stands on a ping pong table in an indoor sports facility. he is dressed in a black polo shirt with a logo on the left chest, and he holds a ping pong racket in his right hand. the background is a vibrant blue, and there's a sign that reads welcome to the world of ping pong. as he speaks, he introduces the topic of the video, which is about the basics of ping pong. transitioning to the second scene, the same man continues to address the audience, now holding a red ping pang ball in his hand. he emphasizes the importance of understanding the basics of ping pong, suggesting that this is a fundamental aspect of the sport. In the third scene, the man is seen again on the ping pong table, this time preparing for a serve. he demonstrates the proper grip and stance for a serve, which is a crucial part of the game. the video then cuts to the fourth scene, where a different man appears on the ping pong court. he is wearing a white t-shirt emblazoned with the website www.pinggonginfo.com and the text ping pong information . . . this man speaks about the importance of proper footwork in ping pong, highlighting the role it plays in the game. finally, in the fifth and last scene, the same man from the first scene reappears. he is still on the ping pong table, and he poses a question to the viewers, asking if they have a question about ping pong. this serves as an invitation for the audience to engage with the content and potentially learn more about the sport. throughout the video, the speakers, including the man on the ping pong table and the man in the white t-shirt, provide informative commentary on the basics of ping pong, emphasizing the importance of understanding the fundamentals of the game. + +# Questions: + +Q1: what is the person in the video doing? +Q2: is the person in the video wearing a watch? +Q3: is the person in the video wearing a hat? +Q4: what is in front of the person in the video? +Q5: what happened before playing table tennis? + +# Answers: + +GT1: play table tennis +GT2:yes +GT3: no +GT4: table tennis table +GTS: introduction of pang ball + +Vicuna answers using summaries & GPT evaluation: + +A1: The person in the video is demonstrating the basics of ping pong, including proper grip, stance, serve, and footwork. +A2: No, the person in the video is not wearing a watch. +A3: No, the person in the video is not wearing a hat. +A4: In the video, the person is standing on a ping pong table in an indoor sports facility. +A5: Based on the video, it is not clear what happened before the man started playing table tennis + +![](images/56ddba384675ea448e65edcc69cf68cf96bde35e5f2c56e11dd2743e454b3082.jpg) +Figure 6: Example predictions of our model on zero-shot question answering an ActivityNet-QA video. More questions and explanations can be found in Appendix C.2 + +ActivityNet-QA case: v_mZYWfsYQPA.mp4 duration: 104 seconds + +Figure 5 (b) showcases predictive capabilities of our VideoChat2-SUM-shot model. The model adeptly narrates event sequences with appropriate emphasis. For instance, it details the backpack's colour and location, and rationalizes the item in the beginning shot, i.e., "putter pocket", aligning with the ASR with "by a male voice in the audio". However, some predictions that marked in red are erroneous, such as the incorrect "black" colour and the non-existent "with a logo on the front" in the ending shot. These inaccuracies likely stem from the LLM's tendency to "hallucinate" plausible yet non-factual details. Despite these errors, the model demonstrates proficiency in generating consistent and nuanced summaries, highlighting our model's potential and the challenges our dataset presents. + +# 3.4VIDEO QUESTION-ANSWERING WITH VIDEO SUMMARY + +Generated video summaries are supposed to be grounded and detailed, covering rich elements like event progression, holistic topics and audio elements, making them suitable for other vision tasks such as video question-answering. Existing work (Guo et al., 2023; Zhang et al., 2023) uses image or video frame captions as input to an LLM to generate question responses. However, little work has been done for the capacity of video summaries. We directly apply our video summarization model on video QA benchmarks, i.e. MSRVTT-QA (Xu et al., 2017), ActivityNet-QA (Yu et al., 2019) and our Shot2Story-QA. + +Specifically, we first split the testing videos into video shots, and then feed the videos into our SUM-shot models. The generated summaries and the associated questions are then fed into a Vicuna model to derive the answers with the prompt shown in Appendix B.4.1 Note there is no adaptation or finetuning conducted for the Vicuna model. Since the original answers in the QA benchmarks are very short and the responses generated by LLM tend to be long sentences, we leverage the gpt-3.5-turbo model to generate a binary decision on whether the answer is correct, following Video-ChatGPT (Maaz et al., 2023). + +Zero-shot video question-answering. As shown in Table 4, our results with VideoChat2-SUM-shot surpass 5 out of 6 existing video-VLMs on MSRVTT-QA and 4 out of 6 existing models on ActivityNet-QA. Furthermore, our results are comparable to the SOTA performance on MSRVTT-QA with Video-LLaVA (Lin et al., 2023). Note that these models require extensive instruction-tuning data to learn to directly generate answers from visual features and the text prompt, whereas our model bypasses instruction tuning by distilling the video information into a summary. Our model also follows the zero-shot QA setting since the model only uses Shot2Story as training data. Note that MSRVTT contains a large portion of videos with out-of-domain topics such as TV shows + +Table 4: Performance on video question answering on MSRVTT-QA and ActivityNet-QA. IT means whether the model uses video-text instruction tuning data. All methods follow the zero-shot manner. + +
ModelTraining DataITQA InputMSRVTT QAActivityNet QA
VideoChat (Li et al., 2023b)Cap.+QA✓V+T45.026.5
Video-ChatGPT (Maaz et al., 2023)Cap.+QA✓V+T49.335.2
MovieChat (Song et al., 2023)Cap.+QA✓V+T52.745.7
LLaMA-VID (Li et al., 2023c)Cap.+QA✓V+T57.747.4
VideoChat2 (Li et al., 2023c)Cap.+QA✓V+T54.149.1
Video-LLaVA (Lin et al., 2023)Cap.+QA✓V+T59.245.3
MiniGPT4-SUM-shotSummaryXT57.745.6
VideoChat2-SUM-shotSummaryXT58.547.1
+ +Table 5: Benchmark on Shot2Story-QA. IT means usage of video-text instruction tuning data. Summary, Cap. and QA denote video summary, captions and question-answering pairs. + +
ModelTraining dataITQA InputTemporal relatedHolistic understandingAudio relatedOverall
LLaMA-VID (Li et al., 2023e)Cap.+QA✓V+T7.99.711.49.7
Video-ChatGPT (Maaz et al., 2023)Cap.+QA✓V+T13.115.514.314.2
VideoChat2 (Li et al., 2023c)Cap.+QA✓V+T15.115.41314.5
Video-LLaVA (Lin et al., 2023)Cap.+QA✓V+T16.414.811.714.3
MiniGPT4-SUM-shotSummaryXT28.931.936.732.5
VideoChat2-SUM-shotSummaryXT36.141.543.840.5
+ +(e.g., Figure 19) and food, while ActivityNet has much longer videos than our training videos (e.g., Figure 6). This validates the robustness and transferability of our model across different topics and longer videos. This surprisingly good result indicates that a comprehensive and detailed video summary is a high-quality abstraction of the video, facilitating a wide range of tasks including video QA and video-based conversation. Moreover, our model achieves strong results on ActivityNet-QA, which predominantly consists of single-shot long videos, validating that models trained with multi-shot videos can effectively generalize to single-shot videos. + +Multi-shot video question-answering. As shown in Table 5, we benchmark existing and our proposed video summary models on Shot2Story-QA. Specifically, four popular video-VLMs are compared, i.e., Video-ChatGPT (Maaz et al., 2023), LLaMA-VID (Li et al., 2023e), VideoChat2 (Li et al., 2023c) and Video-LLaVA (Lin et al., 2023). The predicted summaries of MiniGPT4-SUM-shot and VideoChat2-SUM-shot are used to tackle the QA task with the same configuration as zero-shot VQA. Accuracies on temporal-related, multi-shot holistic understanding and audio-related are reported, with the "overall" metric showing the average score from these three sub-tasks. The current video-VLMs present unsatisfying results, potentially due to two factors: (1) The current models does not have audio or ASR as input, lacking capacity with audio-related understanding. (2) Current models do not have training data with detailed descriptions based on multi-shot videos, weakening their performance on holistic understanding and temporal modeling. For our models, VideoChat2-SUM-shot achieves an overall score of 40.5, surpassing the compared models and MiniGPT4-SUM-shot on all three subtasks. This performance underscores the benefits of video pretraining and the advanced visual backbone of VideoChat2. These baseline results highlight the complexities and demanding nature of our Shot2Story-QA task. We show some example predictions in Figure 5(c). Please refer to Appendix C.2 for more qualitative results. + +# 4 CONCLUSION + +In this work, we present Shot2Story, a large-scale benchmark for comprehensive multi-shot video understanding. We provide detailed shot-level captions for both visual signals and human narrations. Furthermore, we provide comprehensive video summaries based on shot-level captions and design a challenging video question-answering benchmark for multi-shot video understanding. With the rich and diverse descriptions, our benchmark serves as a playground for future multi-modal video understanding models, ready to be extended for a range of other video understanding tasks, such as visual grounding and video-based conversation. + +# REFERENCES + +Josh Achiam, Steven Adler, Sandhini Agarwal, Lama Ahmad, Ilge Akkaya, Florencia Leoni Aleman, Diogo Almeida, Janko Altenschmidt, Sam Altman, Shyamal Anadkat, et al. Gpt-4 technical report. arXiv preprint arXiv:2303.08774, 2023. +Lisa Anne Hendricks, Oliver Wang, Eli Shechtman, Josef Sivic, Trevor Darrell, and Bryan Russell. Localizing moments in video with natural language. In ICCV, pp. 5803-5812, 2017. +Sihan Chen, Handong Li, Qunbo Wang, Zijia Zhao, Mingzhen Sun, Xinxin Zhu, and Jing Liu. Vast: A vision-audio-subtitle-text omni-modality foundation model and dataset. Advances in Neural Information Processing Systems, 36, 2024. +Wei-Lin Chiang, Zhuohan Li, Zi Lin, Ying Sheng, Zhanghao Wu, Hao Zhang, Lianmin Zheng, Siyuan Zhuang, Yonghao Zhuang, Joseph E. Gonzalez, Ion Stoica, and Eric P. Xing. Vicuna: An open-source chatbot impressing gpt-4 with $90\%$ * chatgpt quality, March 2023. URL https://lmsys.org/blog/2023-03-30-vicuna/. +James E Cutting, Kaitlin L Brunick, Jordan E DeLong, Catalina Iricinschi, and Ayse Candan. Quicker, faster, darker: Changes in Hollywood film over 75 years. i-Perception, 2(6):569-576, 2011. +Michael Denkowski and Alon Lavie. Meteor universal: Language specific translation evaluation for any target language. In Proceedings of the ninth workshop on statistical machine translation, pp. 376-380, 2014. +Yuxin Fang, Wen Wang, Binhui Xie, Quan Sun, Ledell Wu, Xinggang Wang, Tiejun Huang, Xinlong Wang, and Yue Cao. Eva: Exploring the limits of masked visual representation learning at scale. arXiv preprint arXiv:2211.07636, 2022. +Jort F Gemmeke, Daniel PW Ellis, Dylan Freedman, Aren Jansen, Wade Lawrence, R Channing Moore, Manoj Plakal, and Marvin Ritter. Audio set: An ontology and human-labeled dataset for audio events. In 2017 IEEE international conference on acoustics, speech and signal processing (ICASSP), pp. 776-780. IEEE, 2017. +Kristen Grauman, Andrew Westbury, Eugene Byrne, Zachary Chavis, Antonino Furnari, Rohit Girdhar, Jackson Hamburger, Hao Jiang, Miao Liu, Xingyu Liu, et al. Ego4d: Around the world in 3,000 hours of egocentric video. In CVPR, 2022. +Jiaxian Guo, Junnan Li, Dongxu Li, Anthony Meng Huat Tiong, Boyang Li, Dacheng Tao, and Steven Hoi. From images to textual prompts: Zero-shot visual question answering with frozen large language models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 10867-10877, 2023. +Edward J Hu, Yelong Shen, Phillip Wallis, Zeyuan Allen-Zhu, Yuzhhi Li, Shean Wang, Lu Wang, and Weizhu Chen. Lora: Low-rank adaptation of large language models. arXiv preprint arXiv:2106.09685, 2021. +You Jin Kim, Hee-Soo Heo, Soyeon Choe, Soo-Whan Chung, Yoohwan Kwon, Bong-Jin Lee, Youngki Kwon, and Joon Son Chung. Look who's talking: Active speaker detection in the wild. Interspeech, 2021. +Ranjay Krishna, Kenji Hata, Frederic Ren, Li Fei-Fei, and Juan Carlos Niebles. Dense-captioning events in videos. In Proceedings of the IEEE international conference on computer vision, pp. 706-715, 2017. +Junnan Li, Yongkang Wong, Qi Zhao, and Mohan S Kankanhalli. Video storytelling: Textual summaries for events. IEEE Transactions on Multimedia, 22(2):554-565, 2019. +Junnan Li, Dongxu Li, Silvio Savarese, and Steven Hoi. Blip-2: Bootstrapping language-image pretraining with frozen image encoders and large language models. arXiv preprint arXiv:2301.12597, 2023a. +KunChang Li, Yinan He, Yi Wang, Yizhuo Li, Wenhai Wang, Ping Luo, Yali Wang, Limin Wang, and Yu Qiao. Videochat: Chat-centric video understanding, 2023b. + +Kunchang Li, Yali Wang, Yinan He, Yizhuo Li, Yi Wang, Yi Liu, Zun Wang, Jilan Xu, Guo Chen, Ping Luo, et al. Mybench: A comprehensive multi-modal video understanding benchmark. arXiv preprint arXiv:2311.17005, 2023c. +Kunchang Li, Yali Wang, Yizhuo Li, Yi Wang, Yinan He, Limin Wang, and Yu Qiao. Unmasked teacher: Towards training-efficient video foundation models. arXiv preprint arXiv:2303.16058, 2023d. +Yanwei Li, Chengyao Wang, and Jiaya Jia. Llama-vid: An image is worth 2 tokens in large language models. arXiv preprint arXiv:2311.17043, 2023e. +Bin Lin, Bin Zhu, Yang Ye, Munan Ning, Peng Jin, and Li Yuan. Video-llava: Learning united visual representation by alignment before projection. arXiv preprint arXiv:2311.10122, 2023. +Chin-Yew Lin. Rouge: A package for automatic evaluation of summaries. In Text summarization branches out, pp. 74-81, 2004. +Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization. arXiv preprint arXiv:1711.05101, 2017. +Muhammad Maaz, Hanoona Rasheed, Salman Khan, and Fahad Shahbaz Khan. Video-chatgpt: Towards detailed video understanding via large vision and language models. arXiv preprint arXiv:2306.05424, 2023. +OpenAI. Gpt-4. URL https://chat.openai.com/?model=gpt-4 +Kishore Papineni, Salim Roukos, Todd Ward, and Wei-Jing Zhu. Bleu: a method for automatic evaluation of machine translation. In Proceedings of the 40th annual meeting of the Association for Computational Linguistics, pp. 311-318, 2002. +Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, et al. Learning transferable visual models from natural language supervision. In International conference on machine learning, pp. 8748-8763. PMLR, 2021. +Enxin Song, Wenhao Chai, Guanhong Wang, Yucheng Zhang, Haoyang Zhou, Feiyang Wu, Xun Guo, Tian Ye, Yan Lu, Jenq-Neng Hwang, et al. Moviechat: From dense token to sparse memory for long video understanding. arXiv preprint arXiv:2307.16449, 2023. +Tomáš Souček and Jakub Lokoč. Transnet v2: An effective deep network architecture for fast shot transition detection. arXiv preprint arXiv:2008.04838, 2020. +Hugo Touvron, Thibaut Lavril, Gautier Izacard, Xavier Martinet, Marie-Anne Lachaux, Timothée Lacroix, Baptiste Rozière, Naman Goyal, Eric Hambro, Faisal Azhar, et al. Llama: Open and efficient foundation language models. arXiv preprint arXiv:2302.13971, 2023. +Ramakrishna Vedantam, C Lawrence Zitnick, and Devi Parikh. Cider: Consensus-based image description evaluation. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 4566-4575, 2015. +Dejing Xu, Zhou Zhao, Jun Xiao, Fei Wu, Hanwang Zhang, Xiangnan He, and Yueting Zhuang. Video question answering via gradually refined attention over appearance and motion. In ACM Multimedia, 2017. +Jun Xu, Tao Mei, Ting Yao, and Yong Rui. Msr-vtt: A large video description dataset for bridging video and language. CVPR, June 2016. +Hongwei Xue, Tiankai Hang, Yanhong Zeng, Yuchong Sun, Bei Liu, Huan Yang, Jianlong Fu, and Baining Guo. Advancing high-resolution video-language representation with large-scale video transcriptions. In CVPR, pp. 5036-5045, 2022. +Zhou Yu, Dejing Xu, Jun Yu, Ting Yu, Zhou Zhao, Yueting Zhuang, and Dacheng Tao. Activitynet-qa: A dataset for understanding complex web videos via question answering. In Proceedings of the AAAI Conference on Artificial Intelligence, 2019. + +Ce Zhang, Taixi Lu, Md Mohaiminul Islam, Ziyang Wang, Shoubin Yu, Mohit Bansal, and Gedas Bertasius. A simple llm framework for long-range video question-answering. arXiv preprint arXiv:2312.17235, 2023. +Luowei Zhou, Chenliang Xu, and Jason Corso. Towards automatic learning of procedures from web instructional videos. In AAAI, volume 32, 2018. +Luowei Zhou, Yannis Kalantidis, Xinlei Chen, Jason J Corso, and Marcus Rohrbach. Grounded video description. In CVPR, pp. 6578-6587, 2019. +Deyao Zhu, Jun Chen, Xiaogian Shen, Xiang Li, and Mohamed Elhoseiny. Minigpt-4: Enhancing vision-language understanding with advanced large language models. arXiv preprint arXiv:2304.10592, 2023. \ No newline at end of file diff --git a/ICLR/2025/Shot2Story_ A New Benchmark for Comprehensive Understanding of Multi-shot Videos/images.zip b/ICLR/2025/Shot2Story_ A New Benchmark for Comprehensive Understanding of Multi-shot Videos/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..731a8f968bb539d1a1a365a63088b436ad65600f --- /dev/null +++ b/ICLR/2025/Shot2Story_ A New Benchmark for Comprehensive Understanding of Multi-shot Videos/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:61e062123d44774a7fbbe714026bdad0b56720f7688091fcdd8396a259d0472f +size 652538 diff --git a/ICLR/2025/Shot2Story_ A New Benchmark for Comprehensive Understanding of Multi-shot Videos/layout.json b/ICLR/2025/Shot2Story_ A New Benchmark for Comprehensive Understanding of Multi-shot Videos/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..3fd5d7c44c6d445227a524035c4cb82dde2fec7b --- /dev/null +++ b/ICLR/2025/Shot2Story_ A New Benchmark for Comprehensive Understanding of Multi-shot Videos/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4adc71928c07b9e6b0f4316983f320e0da94c17732223d575a069ae95181fc84 +size 333546 diff --git a/ICLR/2025/Should VLMs be Pre-trained with Image Data_/a3ed73ab-7e2e-453c-bdca-7750efeafce8_content_list.json b/ICLR/2025/Should VLMs be Pre-trained with Image Data_/a3ed73ab-7e2e-453c-bdca-7750efeafce8_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..54232bbcc25370b6f8a080958befb13d57f86d23 --- /dev/null +++ b/ICLR/2025/Should VLMs be Pre-trained with Image Data_/a3ed73ab-7e2e-453c-bdca-7750efeafce8_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:134b9dbe72ac83da05f43bc362ec949db2fa12a62995c054454c10901dea1f16 +size 131906 diff --git a/ICLR/2025/Should VLMs be Pre-trained with Image Data_/a3ed73ab-7e2e-453c-bdca-7750efeafce8_model.json b/ICLR/2025/Should VLMs be Pre-trained with Image Data_/a3ed73ab-7e2e-453c-bdca-7750efeafce8_model.json new file mode 100644 index 0000000000000000000000000000000000000000..7a32f43a4049c58da845f75a6ad0d230a2a853be --- /dev/null +++ b/ICLR/2025/Should VLMs be Pre-trained with Image Data_/a3ed73ab-7e2e-453c-bdca-7750efeafce8_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e39db1bae74bc11a8e3b1420785b742d237c26f1490dab9eb07a776a8e85494e +size 163275 diff --git a/ICLR/2025/Should VLMs be Pre-trained with Image Data_/a3ed73ab-7e2e-453c-bdca-7750efeafce8_origin.pdf b/ICLR/2025/Should VLMs be Pre-trained with Image Data_/a3ed73ab-7e2e-453c-bdca-7750efeafce8_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..e689278187fa194c5de81a072c47b774e571e73c --- /dev/null +++ b/ICLR/2025/Should VLMs be Pre-trained with Image Data_/a3ed73ab-7e2e-453c-bdca-7750efeafce8_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:85c7cc6fa9fc248ffaaef838dbe765dba1310411d43b3e836b36874efb4157a5 +size 8450839 diff --git a/ICLR/2025/Should VLMs be Pre-trained with Image Data_/full.md b/ICLR/2025/Should VLMs be Pre-trained with Image Data_/full.md new file mode 100644 index 0000000000000000000000000000000000000000..c485896f2d443f98c4ab51907796c85dfe673650 --- /dev/null +++ b/ICLR/2025/Should VLMs be Pre-trained with Image Data_/full.md @@ -0,0 +1,563 @@ +# SHOULD VLMS BE PRE-TRAINED WITH IMAGE DATA? + +Sedrick Keh\* Jean Mercat\* Samir Yitzhak Gadre' Kushal Arora' Igor Vasiljevic' Benjamin Burchfiel Shuran Song Russ Tedrake, Thomas Kollar' Ludwig Schmidt' Achal Dave + +1Toyota Research Institute, 2Stanford, 3MIT, {sedrick.keh, jean.mercat} @tri.global + +# ABSTRACT + +Pre-trained LLMs that are further trained with image data perform well on vision-language tasks. While adding images during a second training phase effectively unlocks this capability, it is unclear how much of a gain or loss this two-step pipeline gives over VLMs which integrate images earlier into the training process. To investigate this, we train models spanning various datasets, scales, image-text ratios, and amount of pre-training done before introducing vision tokens. We then fine-tune these models and evaluate their downstream performance on a suite of vision-language and text-only tasks. We find that pre-training with a mixture of image and text data allows models to perform better on vision-language tasks while maintaining strong performance on text-only evaluations. On an average of 6 diverse tasks, we find that for a 1B model, introducing visual tokens $80\%$ of the way through pre-training results in a $2\%$ average improvement over introducing visual tokens to a fully pre-trained model. + +![](images/29617e4abb409493c517e404feca0ab3fb237b44eccf3c82d73930f69bb8399f.jpg) +Figure 1: An overview of our VLM pre-training data recipe. We investigate data mixes and design choices for text-only pre-training, image-text pre-training, and fine-tuning. Note that while we depict "LLM Pre-training" and "Image-text Pre-training" as two separate steps in this diagram, in practice, we continuously transition from the first stage to the second. + +# 1 INTRODUCTION + +Numerous work have extensively studied how to train a VLM from a pre-trained LLM (Liu et al., 2024; Alayrac et al., 2022; Bavishi et al., 2023; Li et al., 2024a; Karamcheti et al., 2024; Tong et al., 2024; Beyer et al., 2024; Laurençon et al., 2024; Lu et al., 2024; Wu et al., 2024a;b; Chen et al., 2025). Most existing VLMs follow roughly the same high-level recipe: 1) Start with a pre-trained LLM, 2) continue training intermediate layers on image-text tokens (e.g., Flamingo, Pali-Gemma, Idefics, DeepSeek-VL) or align an image projection layer (e.g., LLaVA, Cambrian, Prismatic), and 3) fine-tune the model on multi-task instructions or chat templates. Notably, training with images included in the initial pre-training stage (i.e., step 1) is largely undocumented in these papers, even though a number of large models (with undocumented training procedures) are known to be natively multimodal (e.g., Pixtral, Gemini, Fuyu). + +In this paper, we investigate the significance of each step in the pipeline for downstream performance on vision-language and text benchmarks. Additionally, we examine whether increasing the amount of image data in one step can reduce the data requirements in other steps. To understand when image data should be introduced to VLM training, we train a suite of 300 models over various numbers of parameters, varying the amount of text-only pre-training data, as well as the amount, type, and ratio of image pre-training data (Figure 1). + +Our experiments suggest several key findings: + +First, incorporating image data during pre-training generally helps, especially after a model has seen many text tokens. However, the timing and method of introducing visual information are also important. Specifically, we find that it is beneficial to add image data before the LLM is fully pretrained, during the cooldown phase. Our strategy to interrupt the text pre-training at $80\%$ completion and add image-text data outperforms the popular alternative of fully training the LLM, then re-warming and cooling the model with image data (Section 3.1). + +Second, the fraction of visual data introduced during cooldown is another key parameter for strong performance across domains. At the 1B parameter regime, our experiments reveal that $10\%$ to $20\%$ of tokens should be visual. Going above or below this ratio results in worse downstream performance. However, this fraction appears to be a function of scale. At the smaller 79M parameter regime, larger fractions of visual data are preferred (Sections 3.2 and 3.3). + +Third, the timing of when to introduce instruction fine-tuning image tokens is crucial for downstream performance, both for pure text and vision-language tasks. We observe that mixing together instruction fine-tuning during the image-text pre-training process actively hurts the model (Section 3.4). Meanwhile, adding instruction tokens during fine-tuning improves vision-language task performance up to 4 epochs at the 1B parameter scale, at the cost of slightly hurting performance on text-only tasks (Section 3.5). + +# 2 EXPERIMENTAL SETUP + +![](images/b403e772e9592035a063970e1a3af694a878e5ac792560689f50d67efef2cd80.jpg) +Figure 2: The commonly used framework we apply to add vision capabilities to a transformer model. + +Our experimental setup is designed to study the impact of image-text data on the model's downstream results on both text and vision tasks. To this end, we implement a commonly used model architecture (Liu et al., 2023; Tong et al., 2024; McKinzie et al., 2024; Beyer et al., 2024; Bai et al., 2023; Li et al., 2023a; Laurençon et al., 2024) consisting of a pre-trained image encoder, a projection block, and a decoder-only transformer. Unless stated otherwise, the image encoder is SigLIP 400M (Zhai et al., 2023), the projection block is a two-layer MLP, and the transformer is the 1.4B parameter model described in Gadre et al. (2024b). Our training procedures (Section 2.1) are applied to the model prior to its downstream evaluation (Section 2.2). + +# 2.1 TRAINING PROCEDURE + +We train all our models with a three-step process illustrated in Figure 1: + +1. Partial text-only pre-training +2. Image-text pairs mixed with text-only continued pre-training +3. Image-text pairs multi-task fine-tuning + +We can view the first and second steps as a single pre-training stage, where we introduce images before the model has finished pre-training, as opposed to previous methods where images are introduced + +Table 1: The conventional approach to VLM training first fully trains a language model on text-only data, and adds images in a second or third stage of training. In this work, we instead introduce image data earlier in pre-training. To do this efficiently, we resume a language model during the course of its pre-training at various stages (e.g., $20\%$ of the way through training) and introduce images midway through training. + +
ModelText-Only Pre-trainingImage-Text Pre-trainingMultitask Fine-Tuning
BLIP3(Xue et al., 2024)Fully pre-trained(Phi3-mini)Re-warmupCaption and interleaved text-image data; no pure textRe-warmup
Flamingo(Alayrac et al., 2022)Fully pre-trained(closed model)Re-warmupCaption and interleaved text-image data; no pure text(Scipped)
IDEFICS(Laurençon et al., 2024)Fully pre-trained(Mistral-7B-v0.1)Re-warmupInterleaved text-image data; no pure textRe-warmup
MM1(McKinzie et al., 2024)Fully pre-trained(closed model)Re-warmupVarious image-text ratios (100:0, 91::9, 86::14, 66::33)Re-warmup
DeepSeek-VL / DeepSeek-VL2(Lu et al., 2024; Wu et al., 2024b)Fully pre-trained(DeepSeek)Two-stage (re-warmup then re-warmup)Multitask; 30::70 image-text ratioRe-warmup
Qwen-VL(Bai et al., 2023)Fully pre-trained(Qwen)Two-stage (re-warmup then re-warmup)Caption then multitask; no pure textRe-warmup
PaliGemma(Beyer et al., 2024)Fully pre-trained(Gemma)Two-stage (re-warmup then continue LR schedule)Multitask; no pure textContinued LR schedule
Janus / Janus Pro(Wu et al., 2024a; Chen et al., 2025)Fully pre-trained(DeepSeek-LLM)Two-stage (re-warmup then re-warmup)Multitask; no pure text, followed by 30::70 image-text ratioNo warmup
Prismatic(Karamcheti et al., 2024)Fully pre-trained(LLaMA)No image-text pre-training.Re-warmup
OursPartially pre-trained(OpenLM)Continued LR scheduleVarious image-text ratiosRe-warmup
+ +to a model which had already been pre-trained. In practice, this is implemented by resuming from the same learning rate schedule (Section 2.1.2). A more detailed comparison overview of different models can be found in Table 1. + +# 2.1.1 TEXT-ONLY PRE-TRAINING + +During the initial pre-training process, only the LLM backbone is trained with the training recipe from Gadre et al. (2024b). Rather than re-training from scratch, we instead leverage existing open checkpoints from DCLM-1B (Li et al., 2024b) $^{1}$ . This is a 1.4B parameter model trained on text tokens from DCLM-Baseline mixed with StarCoder (Li et al., 2023b) and ProofPile (Azerbayev et al., 2024), for a total of 4.3T tokens, and it outperforms the recent LLaMA-3.2 1B model $^{2}$ on several commonly used text benchmarks. + +The pre-training learning rate schedule is warmup-cosine with a peak learning rate of $10^{-2}$ and a final learning rate of $10^{-5}$ . In addition to using the final model, we also use checkpoints from $20\%$ , $40\%$ , $60\%$ , and $80\%$ through training, which correspond to 860B, 1.72T, 2.58T, and 3.44T training tokens respectively. Since these checkpoints are taken from the middle of training, their learning rates are higher than the typical last learning rates of most released model weights, allowing us to effectively resume pre-training (Figure 3). + +Additional hyperparameters for the text-only pre-training stage can be found in Appendix A. + +# 2.1.2 IMAGE-TEXT PRE-TRAINING + +We take checkpoints from the text-only pre-trained model and resume the cosine learning rate schedule with a cooldown phase, as illustrated in Figure 3. + +For our experiments, we perform multi-modal training using both caption data and task-related instruction data. As opposed to other VLMs like MM1 (McKinzie et al., 2024), BLIP3 (Xue et al., 2024), and IDEFICS (Laurençon et al., 2024) which use interleaved data in addition to caption data, we limit our setting to either text only or text + a single image. Our minimal setting allows us to control as many factors as possible to isolate the most fundamental factors to train a performant multi-modal model. + +![](images/d1b5469861e8c29197e54661b50ec207e3dee999d66cc9b2cf86c9d1d212f7bb.jpg) +Figure 3: Representation of the different learning rate schedules used for our experiments. 'Main schedule' corresponds to the learning rate for the initial, text-only pretraining. Other colored schedules are the ones used for image-text training and extend over 28B tokens each. They have been upscaled and appear as extending over 280B tokens for readability. + +There are a number of design choices involved in this stage. We give an overview of these design choices below: + +Text dataset selection: During the image-text pre-training stage, we train with the DCLM-baseline dataset, mixed with StarCoder and MathPile. This is selected to match the dataset used during the text-only pre-training step to ensure continuity from the LLM checkpoints that we resume. + +Caption dataset selection: We train with the DataCompDR-1B caption dataset (Vasu et al., 2024), which is an enhancement over DataComp-1B (Gadre et al., 2024a) by regenerating higher quality captions. To arrive at this selection, we ablated over several caption datasets (Appendix J.1). + +Image-text ratio: The effect of mixing text and images has not been thoroughly documented and is one of the key questions we explore in this paper. McKinzie et al. (2024) show that adding some text tokens helps with few-shot and text-only performance, though they show only up to $33\%$ text and operate at slightly different settings (fully pre-trained vs partially pre-trained model). DeepSeek-VL (Lu et al., 2024) uses a fixed $70\%$ text ratio but does not discuss other ratios. We conduct a thorough investigation on the image-text ratio in Sections 3.3 and 3.2. + +Amount of training: We train all our models with a token multiplier of 20, following approximate Chinchilla optimal scaling (Hoffmann et al., 2022). For a 1.4B model, this equates to around 28B tokens. From our experiments at smaller scale, we observe that trends generally hold across higher token multipliers (Appendix G). + +Image encoder selection: We found the SigLIP encoder to work well for our setting, which confirms findings from Beyer et al. (2024). The DINO+SigLIP combination from Karamcheti et al. (2024) gave slightly better results on some benchmarks; for simplicity, however, we use SigLIP for most of our experiments. See Appendix J.2 for full ablations. + +Frozen encoder weights: The vision encoder can be kept frozen (Karamcheti et al., 2024) (i.e., its parameters are not trained) or trained end-to-end with the language model (Tong et al., 2024; Beyer et al., 2024). In our small-scale ablations, we found it more effective to freeze the image encoder weights in both the pre-training and fine-tuning stages (Appendix I), so we freeze the weights for the rest of this section. + +Each image is encoded to 729 tokens, and we train all models for a sequence length of 1024. We provide additional implementation details in Appendix C. + +# 2.1.3 INSTRUCTION FINE-TUNING + +We fine-tune our pre-trained models with the LLaVA dataset (Liu et al., 2024) using the Prismatic framework (Karamcheti et al., 2024). For each model trained in the previous step, we fine-tune for $\{1,2,3,4\}$ epochs. We use a cosine learning rate schedule with warmup. To account for different epoch numbers having different learning rate schedules, we treated each epoch number as its own separate run. A full list of hyperparameters can be found in Appendix D. + +# 2.2 EVALUATION + +We want our VLMs to perform well in vision-language tasks while still retaining their performance in text-only tasks. As such, we conduct evaluations over a suite of diverse tasks, both image-based and text-based. In our early experiments, we trained a 79M parameter model with text and used it to search the training space before scaling to the 1B experiment presented in this work. We only keep the downstream text tasks where a 79M parameter model performs better than random chance. We test our model without any in-context learning, thus all results reported are 0-shot. + +Vision-language tasks: We evaluate on a subset of vision-language tasks used by Karamcheti et al. (2024) $^3$ . These tasks test general visual reasoning, spatial reasoning, ability to read text, object localisation and hallucination. For a full set of vision-language evaluation tasks, see Appendix E. + +In addition to reporting the scores on individual tasks, we also report an aggregate metric. All our results are accuracy scores (between [0, 1]). To aggregate them, we subtract the random baseline accuracy, then average the result over all tasks. We call this aggregate metric the stable score. Its absolute value can be interpreted as the percentage points of advantage over random guessing. Its trend can be understood as average percentage points on the suite of benchmarks. + +Text tasks: We evaluate on a suite of tasks taken from Gadre et al. (2024b) and conduct our evaluations with Eleuther's LM Harness (Gao et al., 2024). These tasks test for general and specific knowledge, reasoning, and commonsense. We also compute the stable score as previously described. For a full list of our text evaluation tasks, see Appendix E. + +# 3 RESULTS + +This section presents a series of experiments exploring different aspects of multi-modal training. We aim to find important choices that affect the downstream performance of the model on a set of diverse visual tasks and text-only question answering. + +All experiments below are conducted on the 1.4 billion parameter regime. We make use of various checkpoints of the DCLM-1B model along its text-only pre-training. This is explored in more detail in Section 3.1 below. + +All experiments use in different proportions three dataset sources. (1) A text-only dataset, DCLM-baseline (Li et al., 2024b), which was used to pre-train the 1B language model. (2) An image caption dataset, DataCompDR-1B (Vasu et al., 2024), and (3) An image instruction tuning dataset, mix of openly available data described in A.1/Multimodal Instruct Tuning (Karamcheti et al., 2024). + +Each section below discusses a different set of experiments with a given setup summarized in a green box labeled Setup. The setup describes which checkpoint of the text-only pre-trained model is used, the mix of text and image captioning data used for image-text pre-training, and the number of fine-tuning epochs performed on the image instruction tuning dataset. Within each description, we use $x$ to denote the variable that we are changing for that particular experiment, while keeping the rest of the variables constant. + +For each of the sections below, there will be two plots, each with two vertical axes, representing our experiment results on vision-language and text tasks. Each point on a plot represents a 1B model initialized from one of the text-only pre-trained checkpoints, pre-trained with text and image captions, and fine-tuned with image instruction tuning data. The plot on the left represents the stable score, an aggregate of performance results, across the vision benchmark on one hand and text benchmarks in the other. The plot on the right represents one of each set of benchmark, the VQA-v2 (Goyal et al., 2017) results and the ARC-easy (Clark et al., 2018) results. These might be easier to interpret but do not convey the full extent of the evaluation. The full list of benchmarks as well as detailed graphs for the vision performance can be found in Appendix F. + +# 3.1 THE IMPACT OF AMOUNT OF TEXT-ONLY PRE-TRAINING + +# Setup + +- $x\%$ checkpoints of 1B model +- Image-text pre-trained for 28B tokens: +90% Text-only +$\circ 10\%$ Image captions +- Fine-tuning 4 epochs + +For this experiment, we use different checkpoints along the text-only pre-training. The initial text model was trained with a warmup-cosine learning rate schedule. All continued image-text pre-training runs follow the learning rate schedules represented in Figure 3. We continue training starting from the last text-only learning rate value, if not too low, and continue training for 28B. For $0\%$ and $100\%$ the learning + +rate would be too low, thus we adopt a linear warmup-cosine decay with a maximum learning rate of $3 \times 10^{-3}$ . See Figure 3. + +Figure 4 below shows the progression of the model performance as a function of the text pre-training completion of the initial checkpoint. We see that up to $80\%$ , a larger amount of text-only pre-training improves performance for both text and vision tasks, suggesting that it's helpful to start with a stronger model which has been trained for a greater number of text tokens. However, at $100\%$ the learning rate schedule is different and could affect the results. Many similar works all initialize their model to a $100\%$ text-only pre-trained model and all re-warmup the learning rate during the image-text pre-training phase. From our experiments, we observe a decrease in performance at $100\%$ , suggesting that continued training is preferable to re-training a $100\%$ fully pre-trained text model. + +![](images/815e9b5a1acb8abeb9e3fd4f25d8b7654161d664ffe03376e5a13214e0ec580a.jpg) +Figure 4: Varying the length of text-only pre-training. We analyze the impact of adding image data after varying amounts of text-only pre-training, showing results on vision benchmarks (green) and text benchmarks (blue). On the left, we show results across a suite of vision and text benchmarks; on the right, we plot two common benchmarks, VQA-v2 and ARC-easy. Introducing images at around $80\%$ of the way through training performs best, maintaining high vision and text task performance. Note: The points at $100\%$ are marked with hollow circles to highlight that they are trained with a different learning rate schedule, as shown in Figure 3 + +![](images/65bc2c08629ecd471215c472e763890672c01930e4a18ee5538f1204025b25b5.jpg) + +Longer text pre-training improves performance but, when adding image input, continued training gives better performance than re-warming up. + +# 3.2 THE IMPACT OF ADDING IMAGES BEFORE THE END OF PRE-TRAINING + +# Setup + +- $80\%$ pre-trained 1B model +- Image-text pre-trained for 28B tokens: +$1 - x\%$ text +$0x\%$ image captions +- Fine-tuning 4 epochs + +Building on the results from Figure 4, we take the $80\%$ checkpoint and vary the image-text ratio we add during pre-training. Figure 5 shows the evolution of the model performance as we pre-train (from a text-only pre-trained model) with more image data. We keep the total number of pre-training tokens constant at 28B, adjusting only the image-text ratio. + +From Figure 5, we see that as more image data is + +added to the mix, better downstream performance is obtained on vision tasks. However, text-only downstream performance decreases. When only image data is used for image pre-training, both text and vision task performance drop significantly. We observe that from $0\%$ images (i.e. train on $100\%$ text) to $1\%$ images, there is a slight drop in vision stable score performance. We believe this can possibly be attributed to the model being confused at the addition of this new task, and that it requires + +some minimum number of tokens in order to truly learn the image representations. Interestingly, performance on text-only tasks gets slightly better when some image data is added to the pre-training mix. + +Introducing image data at a late stage during pre-training improves vision performance while maintaining text performance. + +![](images/d22370b035137fd050ca4cef65dd03c3eddddf0a2ce9129d53af3265d24125b0.jpg) +Figure 5: Varying the ratio of image to text data, after some text-only pretraining. We analyze the impact of the ratio of image to text data in pre-training, after the model has seen text-only data for most of pre-training (80%). Unlike when training from scratch (Figure 6), we find that adding vision data significantly helps vision performance, while maintaining high text accuracy. + +![](images/2cb341e79d7b6c185c75a779fa64474257e50caac965a4a57205b321532a82d8.jpg) + +# 3.3 THE IMPACT OF ADDING IMAGES WHEN TRAINING FROM SCRATCH + +# Setup + +- $0\%$ randomly initialized 1B model +- Image-text pre-trained for 28B tokens: + +$1 - x\%$ text +$0x\%$ image captions +- Fine-tuning 4 epochs + +is section mirrors Section 3.2, with the only range being starting the image-text pre-training from scratch as opposed to from an $80\%$ checkpoint. Figure 6 shows the evolution of the model performance as we pre-train the model from scratch with pre-image data. + +We observe slightly different trends for models + +trained from scratch (Figure 6) as compared to the models trained from the $80\%$ checkpoint (Figure 5). Here, as more image data are added to the mix, we obtain worse downstream performance on both text and vision tasks. These models were trained for 28B tokens each and would likely benefit from more training; it is possible that at larger scales, these trends will more closely resemble those in Figure 5. Interestingly, just like in Figure 5, adding $1\%$ image data strongly degrades the ability of the model to be fine-tuned for vision tasks. + +![](images/d8940b76b630a3c1a0d959311aeba6539ca758a3011c08a8a910dcd12e5099d9.jpg) +Figure 6: Varying the ratio of image to text data, when training from scratch. We analyze the impact of the image-text ratio in pre-training from scratch without any language-only pre-training. Perhaps surprisingly, when training from scratch, adding vision data consistently hurts both vision and text performance, suggesting a period of language-only training early on is important for VLMs. + +![](images/7b8b6617e35a5d77c55faf1304fc47aafb25b5edc4932676d7540e01664fa555.jpg) + +Introducing image data when training from scratch at small scales does not improve downstream vision performance. + +# 3.4 THE IMPACT OF INSTRUCTION TUNING DATA IN PRE-TRAINING + +# Setup + +- $80\%$ pre-trained 1B model +- Image-text pre-trained for 28B tokens: + +90% text +$0 - x\%$ image captions +$0x\%$ image instruction tuning data +- Fine-tuning for 4 epochs + +We train a 1B model with a mix of $10\%$ image-text and $90\%$ text-only data and vary the source of the image-text data from purely image captions to purely instruction tuning data. Figure 7 shows the evolution of the model performance as we increase the proportion of image instruction tuning in the mix of image-text data. We observe that the best performance on vision-language tasks occurs when there are no instruction tuning data included in the pre + +training mix, although adding instruction-tuning data seems to positively affect scores on text-only tasks. From a vision-language standpoint, we conclude that image instruction tuning data should not be added to the pre-training mix and only be used in a separate fine-tuning stage. + +![](images/fd6b2b544becad55c8a9b35a9be7780516f28d00b1e90f9877c815b2c1143742.jpg) +Figure 7: Varying the proportion of instruction tuning data in the image mix. Is including instruction tuning data during pre-training is helpful for VLMs? Surprisingly, we find that adding this data to pre-training harms performance. We hypothesize that this may be due to overfitting, or because mixing instruction tuning data with image-caption pairs degrades learning at this scale. + +![](images/aaf0c2914a44b275c22ea9e53d3625be4e38c6366ac22e7fc0be200528f2c2dd.jpg) + +The presence of image instruction tuning data in pre-training harms downstream evaluations. + +# 3.5 THE IMPACT OF FINE-TUNING ON VISION AND TEXT PERFORMANCE + +# Setup + +- $80\%$ pre-trained 1B model +- Image-text pre-trained for 28B tokens: $0.90\%$ text + +$\circ 10\%$ image captions +- Fine-tuning for $x$ epochs + +Figure 8 shows the evolution of the model 1B performance as it is fine-tuned for 1 to 6 epochs. Looking at the stable score, we observe that up to 4 epochs, downstream vision task performance improves and the downstream text performance degrades. Beyond 4 epochs of fine-tuning, both vision and text performance degrade, likely due to overfitting. + +![](images/e7cd1c19953bb743bc3cba3d025a10355c1e6253a891fa4685f2781b03e044cf.jpg) +Figure 8: Varying the number of fine-tuning epochs. We find that fine-tuning for 2-4 epochs after pre-training performs best for vision tasks, with 2 epochs being a sweet spot for maintaining text performance while achieving high vision performance. + +![](images/f9654bb22b01ae164b2ef720db6cd632d09aa03c260a0c39e7e54dc933ae20a5.jpg) + +Fine-tuning for image instruction improves vision-language tasks even beyond one epoch, up to a point, but degrades text-only task performance. + +# 4 RELATED WORK + +The related work covers three subjects, first, two-stage vision language models (VLMs), which rely on pre-training with text-only data, then recent VLMs which introduce vision data earlier in pre-training, and finally, multimodal datasets for VLM training. + +Two-stage VLMs. The standard approach for training vision language models involves first training a large language model on text-only data, and then incorporating vision data in a second fine-tuning phase. This strategy is employed effectively by models including Liu et al. (2024; 2023) (LLaVA and variants), Alayrac et al. (2022) (Flamingo), Li et al. (2023a); Xue et al. (2024) (BLIP-2 and BLIP-3), Laurençon et al. (2024), Laurençon et al. (2023) (IDEFICS and Obelics), Chen et al. (2025) (Janus and Janus-Pro) among others. McKinzie et al. (2024) explore design choices for training VLMs complementary to the ones we assess, namely the vision-language connector choice, the pretraining strategy for the image encoder, and the image resolution, while using a two-stage training strategy with a fixed, pre-trained language model. + +Pre-training with visual data. Bavishi et al. (2023) (Fuyu-8B) is a notable exception which trains a vision-language model from scratch, but the training strategy is not publicly released. Team (2024) introduces a series of early-fusion VLMs, which, similar to our work, introduce image data during pre-training, but choose a specific, handcrafted strategy for training. For multi-modal pre-training, Aghajanyan et al. (2023) find scaling laws for pre-training from text, code, image-text, image and speech data in terms of unimodal and bi-modal combinations. They investigate training dynamics for various mixtures of pre-training data and model sizes in terms of perplexity. Their study is related to ours in the sense of pre-training with mixtures of data, but it differs in that it does not involve any downstream evaluations. We focus specifically on the setting of VLM training, and thoroughly investigate the results on standard benchmarks. + +Datasets Collecting image-text pre-training and instruction data is challenging, due to the low quality of image-text pairs on the internet. Most datasets use a combination of curation and re-categoration to address this, including Desai et al. (2021) (RedCaps), or Thomee et al. (2015) (YFCC-100M). In this work, we specifically rely on recent large-scale, high-quality datasets that perform well for training multimodal models: Changpinyo et al. (2021) (ConceptualCaptions-12M) follows the ConceptualCaptions-3M (Sharma et al., 2018) pipeline, curating images and alt-text pairs from the internet, with relaxed filters to increase the dataset size. Gadre et al. (2024a) (DataComp-1B) uses CLIP-based filtering to curate a high-quality set of 1 billion image-text pairs, and Vasu et al. (2024) (DataCompDR-1B) uses a vision-language model to generate synthetic captions for the original DataComp-1B dataset. Li et al. (2024c) (Recap-DataComp-1B) further improves on this by using a LLaMA3-based LLaVA-1.5 model (Liu et al., 2023) to perform the recategoriation. For finetuning, we use the LLaVA-1.5 (Liu et al., 2024; 2023) mix, which consists of high quality, curated image datasets, along with instruction-tuning data generated using a large language model. Recent datasets further explore interleaved data, where the same sequence counts several images and text piece that relate to each other. Interleaved datasets include OBELICS (Laurençon et al., 2023), the Cauldron (Laurençon et al., 2024), and MINT-1T (Awadalla et al., 2024). We leave the analysis of this data for VLM pretraining to future work. + +# 5 CONCLUSION + +In this paper, we address some key gaps and challenge several common assumptions in vision-language model (VLM) pre-training. Specifically, our work questions the traditional practice of separating text and image pre-training phases, demonstrating that a more integrated approach of incorporating image data during pre-training can yield superior downstream results. We recommend future VLM efforts leverage intermediate pre-training checkpoints to incorporate images before completing the pre-training process. In this setting, it's important to carefully manage the image-to-text ratio: unlike the typical approach where a separate image training stage is done with $100\%$ caption images, this integrated setting requires a balanced image-text ratio to avoid performance degradation. We plan to make our code and our testbed of models publicly available, and we hope that our findings will provide a strong empirical foundation for open-source VLM pre-training. + +# REFERENCES + +Armen Aghajanyan, Lili Yu, Alexis Conneau, Wei-Ning Hsu, Karen Hambardzumyan, Susan Zhang, Stephen Roller, Naman Goyal, Omer Levy, and Luke Zettlemoyer. Scaling laws for generative mixed-modal language models. In International Conference on Machine Learning, pp. 265-279. PMLR, 2023. +Jean-Baptiste Alayrac, Jeff Donahue, Pauline Luc, Antoine Miech, Iain Barr, Yana Hasson, Karel Lenc, Arthur Mensch, Katherine Millican, Malcolm Reynolds, et al. Flamingo: a visual language model for few-shot learning. Advances in neural information processing systems, 35:23716-23736, 2022. +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), pp. 2357-2367, Minneapolis, Minnesota, 2019. Association for Computational Linguistics. doi: 10.18653/v1/N19-1245. URL https://aclanthology.org/N19-1245. +Anas Awadalla, Le Xue, Oscar Lo, Manli Shu, Hannah Lee, Etash Kumar Guha, Matt Jordan, Sheng Shen, Mohamed Awadalla, Silvio Savarese, et al. Mint-1t: Scaling open-source multimodal data by 10x: A multimodal dataset with one trillion tokens. arXiv preprint arXiv:2406.11271, 2024. +Zhangir Azerbayev, Hailey Schoelkopf, Keiran Paster, Marco Dos Santos, Stephen McAleer, Albert Q. Jiang, Jia Deng, Stella Biderman, and Sean Welleck. Llemma: An open language model for mathematics, 2024. URL https://arxiv.org/abs/2310.10631. +Jinze Bai, Shuai Bai, Shusheng Yang, Shijie Wang, Sinan Tan, Peng Wang, Junyang Lin, Chang Zhou, and Jingren Zhou. Qwen-VL: A Versatile Vision-Language Model for Understanding, Localization, Text Reading, and Beyond, August 2023. URL https://arxiv.org/abs/2308.12966v3. +Rohan Bavishi, Erich Elsen, Curtis Hawthorne, Maxwell Nye, Augustus Odena, Arushi Somani, and Sağnak Taşırlar. Fuyu-8b: A multimodal architecture for ai agents, 2023. URL https://www.adept.ai/blog/fuyu-8b. +BIG bench authors. Beyond the imitation game: Quantifying and extrapolating the capabilities of language models. In Transactions on Machine Learning Research (TMLR), 2023. https://openreview.net/forum?id=uyTL5Bvosj. +Lucas Beyer, Andreas Steiner, André Susano Pinto, Alexander Kolesnikov, Xiao Wang, Daniel Salz, Maxim Neumann, Ibrahim Alabdulmohsin, Michael Tschannen, Emanuele Bugliarello, et al. Paligemma: A versatile 3b vlm for transfer. arXiv preprint arXiv:2407.07726, 2024. +Yonatan Bisk, Rowan Zellers, Ronan LeBras, Jianfeng Gao, and Yejin Choi. PIQA: reasoning about physical commonsense in natural language. In The Thirty-Fourth AAAI Conference on Artificial Intelligence, AAAI 2020, The Thirty-Second Innovative Applications of Artificial Intelligence Conference, IAAI 2020, The Tenth AAAI Symposium on Educational Advances in Artificial Intelligence, EAAI 2020, New York, NY, USA, February 7-12, 2020, pp. 7432-7439. AAAI Press, 2020. URL https://aaai.org/ojs/index.php/AAAI/article/view/6239. +Soravit Changpinyo, Piyush Sharma, Nan Ding, and Radu Soricut. Conceptual 12M: Pushing web-scale image-text pre-training to recognize long-tail visual concepts. In CVPR, 2021. +Xiaokang Chen, Zhiyu Wu, Xingchao Liu, Zizheng Pan, Wen Liu, Zhenda Xie, Xingkai Yu, and Chong Ruan. Janus-pro: Unified multimodal understanding and generation with data and model scaling. arXiv preprint arXiv:2501.17811, 2025. +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 Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pp. 2924–2936, Minneapolis, Minnesota, 2019. Association for Computational Linguistics. doi: 10.18653/v1/N19-1300. URL https://aclanthology.org/N19-1300. + +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, 2018. +Karan Desai, Gaurav Kaul, Zubin Aysola, and Justin Johnson. Redcaps: Web-curated image-text data created by the people, for the people, 2021. URL https://arxiv.org/abs/2111.11431. +Samir Yitzhak Gadre, Gabriel Ilharco, Alex Fang, Jonathan Hayase, Georgios Smyrnis, Thao Nguyen, Ryan Marten, Mitchell Wortsman, Dhruba Ghosh, Jieyu Zhang, et al. Datacomp: In search of the next generation of multimodal datasets. In Advances in Neural Information Processing Systems (NeurIPS), volume 36, 2024a. https://arxiv.org/abs/2304.14108. +Samir Yitzhak Gadre, Georgios Smyrnis, Vaishaal Shankar, Suchin Gururangan, Mitchell Wortsman, Rulin Shao, Jean Mercat, Alex Fang, Jeffrey Li, Sedrick Keh, et al. Language models scale reliably with over-training and on downstream tasks. arXiv preprint arXiv:2403.08540, 2024b. +Leo Gao, Jonathan Tow, Baber Abbasi, Stella Biderman, Sid Black, Anthony DiPofi, Charles Foster, Laurence Golding, Jeffrey Hsu, Alain Le Noac'h, Haonan Li, Kyle McDonell, Niklas Muennighoff, Chris Ociepa, Jason Phang, Laria Reynolds, Hailey Schoelkopf, Aviya Skowron, Lintang Sutawika, Eric Tang, Anish Thite, Ben Wang, Kevin Wang, and Andy Zou. A framework for few-shot language model evaluation, 07 2024. URL https://zenodo.org/records/12608602. +Yash Goyal, Tejas Khot, Douglas Summers-Stay, Dhruv Batra, and Devi Parikh. Making the V in VQA matter: Elevating the role of image understanding in Visual Question Answering. In Conference on Computer Vision and Pattern Recognition (CVPR), 2017. +Suchin Gururangan, Mitchell Wortsman, Samir Yitzhak Gadre, Achal Dave, Maciej Kilian, Weijia Shi, Jean Mercat, Georgios Smyrnis, Gabriel Ilharco, Matt Jordan, Reinhard Heckel, Alex Dimakis, Ali Farhadi, Vaishaal Shankar, and Ludwig Schmidt. OpenLM: a minimal but performative language modeling (lm) repository, 2023. https://github.com/mlfoundations/open_lm. +Jordan Hoffmann, Sebastian Borgeaud, Arthur Mensch, Elena Buchatskaya, Trevor Cai, Eliza Rutherford, Diego de Las Casas, Lisa Anne Hendricks, Johannes Welbl, Aidan Clark, et al. Training compute-optimal large language models. In Advances in Neural Information Processing Systems (NeurIPS), 2022. https://arxiv.org/abs/2203.15556. +Drew A Hudson and Christopher D Manning. Gqa: A new dataset for real-world visual reasoning and compositional question answering. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 6700-6709, 2019. +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), pp. 2567-2577, Hong Kong, China, 2019. Association for Computational Linguistics. doi: 10.18653/v1/D19-1259. URL https://aclanthology.org/D19-1259. +Siddharth Karamcheti, Suraj Nair, Ashwin Balakrishna, Percy Liang, Thomas Kollar, and Dorsa Sadigh. Prismatic VLMs: Investigating the Design Space of Visually-Conditioned Language Models, February 2024. URL http://arxiv.org/abs/2402.07865.arXiv:2402.07865 [cs]. +Sahar Kazemzadeh, Vicente Ordonez, Mark Matten, and Tamara Berg. Referitgame: Referring to objects in photographs of natural scenes. In Proceedings of the 2014 conference on empirical methods in natural language processing (EMNLP), pp. 787-798, 2014. +Hugo Laurençon, Lucile Saulnier, Léo Tronchon, Stas Bekman, Amanpreet Singh, Anton Lozhkov, Thomas Wang, Siddharth Karamcheti, Alexander M. Rush, Douwe Kiela, Matthieu Cord, and Victor Sanh. Obelics: An open web-scale filtered dataset of interleaved image-text documents, 2023. +Hugo Laurencon, Léo Tronchon, Matthieu Cord, and Victor Sanh. What matters when building vision-language models?, May 2024. URL http://arxiv.org/abs/2405.02246.arXiv:2405.02246 [cs]. + +Feng Li, Renrui Zhang, Hao Zhang, Yuanhan Zhang, Bo Li, Wei Li, Zejun Ma, and Chunyuan Li. Llava- next- interleave: Tackling multi-image, video, and 3d in large multimodal models. (arXiv:2407.07895), July 2024a. URL http://arxiv.org/abs/2407.07895. arXiv:2407.07895 [cs]. +Jeffrey Li, Alex Fang, Georgios Smyrnis, Maor Ivgi, Matt Jordan, Samir Gadre, Hritik Bansal, Etash Guha, Sedrick Keh, Kushal Arora, Saurabh Garg, Rui Xin, Niklas Muennighoff, Reinhard Heckel, Jean Mercat, Mayee Chen, Suchin Gururangan, Mitchell Wortsman, Alon Albalak, Yonatan Bitton, Marianna Nezhurina, Amro Abbas, Cheng-Yu Hsieh, Dhruba Ghosh, Josh Gardner, Maciej Kilian, Hanlin Zhang, Rulin Shao, Sarah Pratt, Sunny Sanyal, Gabriel Ilharco, Giannis Daras, Kalyani Marathe, Aaron Gokaslan, Jieyu Zhang, Khyathi Chandu, Thao Nguyen, Igor Vasiljevic, Sham Kakade, Shuran Song, Sujay Sanghavi, Fartash Faghri, Sewoong Oh, Luke Zettlemoyer, Kyle Lo, Alaaeldin El-Nouby, Hadi Pouransari, Alexander Toshev, Stephanie Wang, Dirk Groeneveld, Luca Soldaini, Pang Wei Koh, Jenia Jitsev, Thomas Kollar, Alexandros G. Dimakis, Yair Carmon, Achal Dave, Ludwig Schmidt, and Vaishaal Shankar. DataComp-LM: In search of the next generation of training sets for language models, June 2024b. URL http://arxiv.org/abs/2406.11794. arXiv:2406.11794 [cs]. +Junnan Li, Dongxu Li, Silvio Savarese, and Steven Hoi. Blip-2: Bootstrapping language-image pre-training with frozen image encoders and large language models. In International conference on machine learning, pp. 19730–19742. PMLR, 2023a. +Raymond Li, Loubna Ben Allal, Yangtian Zi, Niklas Muennighoff, Denis Kocetkov, Chenghao Mou, Marc Marone, Christopher Akiki, Jia Li, Jenny Chim, et al. Starcoder: may the source be with you! ArXiv preprint, abs/2305.06161, 2023b. URL https://arxiv.org/abs/2305.06161. +Xianhang Li, Haoqin Tu, Mude Hui, Zeyu Wang, Bingchen Zhao, Junfei Xiao, Sucheng Ren, Jieru Mei, Qing Liu, Huangjie Zheng, Yuyin Zhou, and Cihang Xie. What if we recaption billions of web images with llama-3? arXiv preprint arXiv:2406.08478, 2024c. +Yifan Li, Yifan Du, Kun Zhou, Jinping Wang, Wayne Xin Zhao, and Ji-Rong Wen. Evaluating object hallucination in large vision-language models. arXiv preprint arXiv:2305.10355, 2023c. +Haotian Liu, Chunyuan Li, Yuheng Li, and Yong Jae Lee. Improved baselines with visual instruction tuning, 2023. +Haotian Liu, Chunyuan Li, Qingyang Wu, and Yong Jae Lee. Visual instruction tuning. Advances in neural information processing systems, 36, 2024. +Haoyu Lu, Wen Liu, Bo Zhang, Bingxuan Wang, Kai Dong, Bo Liu, Jingxiang Sun, Tongzheng Ren, Zhuoshu Li, Yaofeng Sun, et al. Deepseek-vl: towards real-world vision-language understanding. arXiv preprint arXiv:2403.05525, 2024. +Brandon McKinzie, Zhe Gan, Jean-Philippe Fauconnier, Sam Dodge, Bowen Zhang, Philipp Duffer, Dhruti Shah, Xianzhi Du, Futang Peng, Floris Weers, et al. Mm1: Methods, analysis & insights from multimodal llm pre-training. arXiv preprint arXiv:2403.09611, 2024. +Melissa Roemmele, Cosmin Adrian Bejan, , and Andrew S. Gordon. Choice of plausible alternatives: An evaluation of commonsense causal reasoning. In Association for the Advancement of Artificial Intelligence (AAAI) Spring Symposium, 2011. https://people.ict.usc.edu/~gordon/copa.html. +Piyush Sharma, Nan Ding, Sebastian Goodman, and Radu Soricut. Conceptual captions: A cleaned, hypernymed, image alt-text dataset for automatic image captioning. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 2556-2565, Melbourne, Australia, 2018. Association for Computational Linguistics. doi: 10.18653/v1/P18-1238. URL https://aclanthology.org/P18-1238. +Amanpreet Singh, Vivek Natarajan, Meet Shah, Yu Jiang, Xinlei Chen, Dhruv Batra, Devi Parikh, and Marcus Rohrbach. Towards vqa models that can read. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 8317-8326, 2019. + +Chameleon Team. Chameleon: Mixed-modal early-fusion foundation models. arXiv preprint arXiv:2405.09818, 2024. +Bart Thomee, David A Shamma, Gerald Friedland, Benjamin Elizalde, Karl Ni, Douglas Poland, Damian Borth, and Li-Jia Li. YFCC100M: The new data in multimedia research. ArXiv preprint, abs/1503.01817, 2015. URL https://arxiv.org/abs/1503.01817. +Shengbang Tong, Ellis Brown, Penghao Wu, Sanghyun Woo, Manoj Middepogu, Sai Charitha Akula, Jihan Yang, Shusheng Yang, Adithya Iyer, Xichen Pan, et al. Cambrian-1: A fully open, vision-centric exploration of multimodal llms. arXiv preprint arXiv:2406.16860, 2024. +Pavan Kumar Anasosalu Vasu, Hadi Pouransari, Fartash Faghri, Raviteja Vemulapalli, and Oncel Tuzel. Mobileclip: Fast image-text models through multi-modal reinforced training. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 15963-15974, 2024. +Ke-Jyun Wang, Yun-Hsuan Liu, Hung-Ting Su, Jen-Wei Wang, Yu-Siang Wang, Winston H Hsu, and Wen-Chin Chen. Ocid-ref: A 3d robotic dataset with embodied language for clutter scene grounding. arXiv preprint arXiv:2103.07679, 2021. +Chengyue Wu, Xiaokang Chen, Zhiyu Wu, Yiyang Ma, Xingchao Liu, Zizheng Pan, Wen Liu, Zhenda Xie, Xingkai Yu, Chong Ruan, et al. Janus: Decoupling visual encoding for unified multimodal understanding and generation. arXiv preprint arXiv:2410.13848, 2024a. +Zhiyu Wu, Xiaokang Chen, Zizheng Pan, Xingchao Liu, Wen Liu, Damai Dai, Huazuo Gao, Yiyang Ma, Chengyue Wu, Bingxuan Wang, Zhenda Xie, Yu Wu, Kai Hu, Jiawei Wang, Yaofeng Sun, Yukun Li, Yishi Piao, Kang Guan, Aixin Liu, Xin Xie, Yuxiang You, Kai Dong, Xingkai Yu, Haowei Zhang, Liang Zhao, Yisong Wang, and Chong Ruan. Deepseek-vl2: Mixture-of-experts vision-language models for advanced multimodal understanding, 2024b. URL https://arxiv.org/abs/2412.10302. +Le Xue, Manli Shu, Anas Awadalla, Jun Wang, An Yan, Senthil Purushwalkam, Honglu Zhou, Viraj Prabhu, Yutong Dai, Michael S Ryoo, et al. xgen-mm (blip-3): A family of open large multimodal models. arXiv preprint arXiv:2408.08872, 2024. +Licheng Yu, Patrick Poirson, Shan Yang, Alexander C Berg, and Tamara L Berg. Modeling context in referring expressions. In Computer Vision-ECCV 2016: 14th European Conference, Amsterdam, The Netherlands, October 11-14, 2016, Proceedings, Part II 14, pp. 69-85. Springer, 2016. +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, pp. 4791-4800, Florence, Italy, 2019. Association for Computational Linguistics. doi: 10.18653/v1/P19-1472. URL https://aclanthology.org/P19-1472. +Xiaohua Zhai, Basil Mustafa, Alexander Kolesnikov, and Lucas Beyer. Sigmoid Loss for Language Image Pre-Training. In 2023 IEEE/CVF International Conference on Computer Vision (ICCV), pp. 11941-11952, Paris, France, October 2023. IEEE. ISBN 9798350307184. doi: 10.1109/ICCV51070.2023.01100. URL https://ieeexplore.ieee.org/document/10377550/. +Wanjun Zhong, Ruixiang Cui, Yiduo Guo, Yaobo Liang, Shuai Lu, Yanlin Wang, Amin Saied, Weizhu Chen, and Nan Duan. Agieval: A human-centric benchmark for evaluating foundation models. ArXiv preprint, abs/2304.06364, 2023. URL https://arxiv.org/abs/2304.06364. +Chunting Zhou, Lili Yu, Arun Babu, Kushal Tirumala, Michihiro Yasunaga, Leonid Shamis, Jacob Kahn, Xuezhe Ma, Luke Zettlemoyer, and Omer Levy. Transfusion: Predict the next token and diffuse images with one multi-modal model, 2024. URL https://arxiv.org/abs/2408.11039. + +# A TEXT-ONLY PRE-TRAINING HYPERPARAMETERS + +We preformed initial exploratory experiments with a 79M parameter model and scale our final experiments to a 1B model with settings from Gadre et al. (2024b) given in Table 2. Our text models are trained with the OpenLM (Gururangan et al., 2023) codebase for next token prediction on the DCLM-baseline dataset (Li et al., 2024b). + +Table 2: The two models and set of hyperparameters used in our experiments. Models have number of parameters $N$ , with number of layers $n_{\text{layers}}$ , number of attention heads $n_{\text{heads}}$ , model width $d_{\text{model}}$ , and width per attention head $d_{\text{head}}$ . Batch sizes are global and in units of sequences. Each sequence has 2,048 tokens. A100 GPU hours are at $M = 150$ . For the 1.4B scale, a batch size of 256 performs slightly better than 512. + +
Nn_layersn_headsd_modeld_headWarmupLearning rateBatch sizeTraining tokensA100 hours
79M845121284003e-3512237B1.2k
1.4B24162,04812850001e-22564.3T106k
+ +# B IMAGE-TEXT PRE-TRAINING HYPERPARAMETERS + +We add an image encoder, loaded from a pre-trained model (or randomly initialized, in the case of patch projection). We define a 2-layer MLP with GELU activation to project the image patches from the image encoder dimension to a dimension 4 times larger and then down to the LLM input dimension. + +Image-test pre-training follows the same procedure as text pre-training except that the image patches are not predicted by the auto-regressive model and are masked out of the auto-regressive cross-entropy loss. + +We use the learning rate schedules defined in Figure 3. + +# C IMAGE ENCODING IMPLEMENTATION DETAILS + +We encode each image to the vocabulary space of the language model, with each image taking 729 tokens. When dealing with caption data, we always place the image first before the text, and we add a separator token to separate the image and the text. We then mask out the image and only compute loss over the text tokens. However, we do not use a PrefixLM architecture as used in Beyer et al. (2024) and Zhou et al. (2024). We believe this is a promising direction to explore in the future. + +Meanwhile, when dealing with LLaVA data, we do a similar process of adding the image before the text and masking the image. This time, we also make sure to mask out any system prompt and human question, only keeping the model responses unmasked. We also add a separator token at the end of every human question and model response. + +# D FINE-TUNING HYPERPARAMETERS + +As described in Karamcheti et al. (2024), our image-text instruction tuning dataset is composed of 665K examples. Each sequence that is fed to the model begins with 729 items matching image patch embedding followed by different numbers of embedded text tokens. The model is trained using the Prismatic codebase Karamcheti et al. (2024). Instruction tuning follows the same training strategy as pre-training except that the image patch and question tokens are masked out of the cross-entropy loss. + +We use the following non-default hyperparameters: + +- Learning rate: $3.10^{-4}$ +Warmup ratio: 0.05 +- Adam optimizer: $\beta_{2}:0.95$ +- Finetune epochs: 4 + +- Batch size: 256 +- Image resize strategy: "letterbox" + +# E EVALUATION BENCHMARK DESCRIPTIONS + +# VQA benchmarks: + +VQAv2 (Goyal et al., 2017): General visual reasoning +GQA (Hudson & Manning, 2019): Spatial reasoning +TextVQA (Singh et al., 2019): Text-based reasoning +- POPE (Li et al., 2023c): Yes/No hallucination test + +# Object localisation benchmarks: + +- RefCOCO (Kazemzadeh et al., 2014; Yu et al., 2016): Object localisation +- OCID-Ref (Wang et al., 2021): Cluttered object localisation + +These are a subset of the tasks considered in Karamcheti et al. (2024). We evaluate and report VizWiz results but leave them out of the average performance computation because its system prompt is out of the training distribution and is often misunderstood by the 1b model. The "unanswerable" answer suggested in the prompt is rarely used by the model, which would often answer reasonable but different responses such as empty responses or "I don't know". The exact match scoring does not reflect that, causing a large variance of the results. With different initial random seeds, most results stay similar, but VizWiz results vary by several percentage points. + +We also left out challenge tasks VSR, TallyQA and AI2D because the difficulty of these tasks make them out of scope for small scale models. + +Text benchmarks: The following benchmark descriptions are taken from Li et al. (2024b) + +- AGI Eval LSAT-EN (Zhong et al., 2023) tests for model knowledge in the legal domain and evaluates analytical reasoning capabilities. +- ARC-easy (Clark et al., 2018) contain four-way multiple choice questions taken from grade 3-9 science exams, where questions in the easy dataset require knowledge of basic science, and the challenge questions require some procedural reasoning. +- BigBench (bench authors, 2023) Conceptual combinations 4-way multiple choice question answering dataset which discriminate combinations of objects and attributes that are appropriate to each other or not. +- BoolQ (Clark et al., 2019) binary question answering dataset where the model is expected to answer questions about relevant passages. +- COPA (Roemmele et al., 2011) causal reasoning questions where the model is given two possible outcomes to a scenario and must use commonsense to select the outcome that is more likely. +- HellaSwag (Zellers et al., 2019) a conversational question answering dataset where the model is given a passage and conversation between two participants and then expected to extract an answer from the passage to a question from one of the participants. +- MathQA (Amini et al., 2019) 5-way multiple choice question answering dataset that evaluates math word problem solving capabilities, built on top of AQuA. +- PIQA (Bisk et al., 2020) binary multiple choice question answering dataset that requires the model to use physical commonsense reasoning to answer correctly. +- PubMedQA (Jin et al., 2019) 3-way multiple choice question answering dataset which evaluates the model's ability to answer biomedical research questions given context from a relevant research article. + +# F DETAILED RESULTS + +# F.1 THE IMPACT OF TEXT-ONLY PRE-TRAINING + +Figure 9 shows the detailed vision benchmarks results and global text benchmark results as the initial text-only pre-trained model is trained to completion. All tasks except VizWiz perform the best with the text backbone trained to $80\%$ of completion. + +![](images/b43e0f8d245f36b6d66238c73cec0595c67f6cc0e07e25c9582fba2fb281a58d.jpg) + +![](images/5eb746d9aa486156a7c3ba1ca84bf6f8d2100f4391975b46e5414aeb29799a75.jpg) + +![](images/94dcde811305653326167fbe70ef7a5dee0a229860eec2a10a88a7bf1398c02d.jpg) + +![](images/196e5a232d7c81cc60ae730b71818ef754423485374b15286dbf15d242911234.jpg) + +![](images/2018500aea0cefd4d5c4840f5322660db1ec7ce62d92c83cfabe38e3cf5dde36.jpg) + +![](images/717df5402883d5cdb66b0cb8d936cd8d8981be200ce86cb34abb244e481375af.jpg) + +![](images/33245905ef7251d51f2db3d674efee005bd8f350f46195cb5918fd30ffae083f.jpg) +Figure 9: Evolution of the performance of the 1b model on vision benchmarks and text benchmarks as functions of the text-only pre-training completion. + +![](images/c2292094910de7ebf105ce50fb999e37688bba4a8d2d498d8a746902b97e6ed8.jpg) + +# F.2 THE IMPACT OF ADDING IMAGES BEFORE THE END OF PRE-TRAINING + +For some tasks such as POPE and RefCOCO, the best performance is obtained without any image in the second stage. Most other tasks do benefit from image-text pre-training. + +![](images/9039efe2008c681606943f7625de4a3a6d2ea58505532637024b178df2950975.jpg) + +![](images/d5b6d5b2d6d5b89e65454c86c45bfe675adf900fefc26ab3b0ee0f8110f65725.jpg) + +![](images/c99b8f722373ece3e5a9f702cb3cc0a21b2022b06d02cb5e3cefa123e8328c48.jpg) + +![](images/74c8b8b9c641d0db79e57f8b2c0b6bf9114b4f1ac275dd0f06451237dc7f1146.jpg) + +![](images/595f67ef2bb6e1f688297107b204ba0b4f3533347299b548303477636c43f4dd.jpg) + +![](images/af3171ea49d2d3fac90f15ee6ec67fe0d0cb2f7f106820262c69ae0c3b5cf4f9.jpg) + +![](images/93ce41561dcaea4f0895c4545b6b433bc363d9e2ccf99aa7059ae1431e36f421.jpg) +Figure 10: Evolution of the performance of the 1b model on vision benchmarks and text benchmarks as functions of the ratio of image caption data in the image pre-training phase. + +![](images/651845f6d35b7562bb8ff995db16c488b7bf8ff98b503a20819f9249531f7890.jpg) + +# F.3 THE IMPACT OF FINETUNING ON VISION AND TEXT PERFORMANCE + +The trend of progress over finetuning for individual benchmark is only clear for some benchmarks such as RefCOCO and OCID. For VQA-v2, GQA, TextVQA, and POPE, the best results are not at 4 epochs but less than one percentage point is lost between their maximum performance and their performance at epoch 4. + +![](images/3f9173d43c28f781466bdd2fc8c75a70454a861ab592732181b138c99379599d.jpg) + +![](images/9eb813f8a43178f737c64749f3ea3186e043ef9f8edcc5e5c9ead7ba72b4e78e.jpg) + +![](images/71d23b24aaee9831a20cced3ecb21f8a11bb73de9b74a80be693368da75a2c24.jpg) + +![](images/830655e30cc60dda2d332832fd7824d8270e19c8bdbfc8f3aff8f1f858430063.jpg) + +![](images/8ddf1a205ebf7f0d422d8130e4955b5f8ba9f3c1a124befe81fa0514944c2ca3.jpg) + +![](images/8f7db73f53aa3f4f7426ff4f3a63221ed243a5ed1153ac81c058e34238ac5a98.jpg) + +![](images/3b5aeee2d879031049e61ea600e27aedaf8f256821b97724b7c7e9fa7aa1482d.jpg) +Figure 11: Evolution of the performance of the 1b model on vision benchmarks and text benchmarks as functions of the number of fine-tuning epochs. + +![](images/0080a6f9bccf7c98e396b81af78ec8aef9589dd85c4378cdef9adb3b589f5809.jpg) + +# F.4 THE IMPACT OF ADDING IMAGES FROM THE START WHEN TRAINING FROM SCRATCH + +Although not by a large margin, in this pre-training from scratch experiments, best results are obtained without image in the pre-training mix. + +![](images/de54317a2715d8a9832c8505aaad45474de91745077c78a84c3a9f1c6fb89493.jpg) + +![](images/165ff0a81de4f0fcae72dc92598c382412a498ef1f41565c917f8b7f99ba0876.jpg) + +![](images/76b6a4c4ed537f2213f05b08239b7828d54ffb6a9583999046b855129715e92a.jpg) + +![](images/4e0b55beea952ba98ec7c7ffe646c625f67b12059641b71537bd793b0b6de507.jpg) + +![](images/5fd8d961d1a8bd186485ad9dbb738831564dc2a6bf506533d9a6c46111f2a77c.jpg) + +![](images/0884ce830ebc8f3c9e07d95873be89161ccbf85eba7e0f7c3307abe1224de3bc.jpg) + +![](images/acc347900d3bab12dc5a88454bc202b53af36284485db6df1b402b3910dbbb5f.jpg) +Figure 12: Evolution of the performance of the 1b model trained from scratch on vision benchmarks and text benchmarks as functions of the ratio of image caption data in the image pre-training phase. + +![](images/b4d79289ce1ca21a9a50364edf7abb676b1d24ad8b44c5cf5c11295ef85f27fc.jpg) + +# F.5 THE IMPACT OF INSTRUCTION TUNING DATA DURING PRE-TRAINING + +Including instruction tuning data degrades VQA performance of the downstream model for all tested benchmarks. However, surprisingly, it improves the overall performance on downstream text tasks. We believe this is due to the instruction tuning data that help the model understanding question answering tasks. + +![](images/3591f7171eddba5562d387297cb9b62df705697ce167b499c5a3878256943be0.jpg) + +![](images/c377dca83b205126bfd709d92bf94b87f9ed66014f110c81a1dd6643e4bb7337.jpg) + +![](images/aaa0d11305be790f7d7cd61572f26956393d8ad30836140cf14a63a9971b6857.jpg) + +![](images/88ff4f5ebff95490d4fdcf15b90c63247e5da6f2f8097ad82939e873df13a173.jpg) + +![](images/15706930613d9158fd7191791795aaea11a0b9fe7f62eaf4647cf472a17665f2.jpg) + +![](images/a6d959214952c1a5b6ece5fdf2dac6af2827b1908421f35a07c89b358ea9a0ce.jpg) + +![](images/85eb4536b0cd097e240093d2ac344493e85451e579c078da50ff3758190cf6c3.jpg) +Figure 13: Evolution of the performance of the 1b model on vision benchmarks and text benchmarks as functions of the ratio of image instruction tuning in the image-text pre-training phase. + +![](images/5ef83691df16adc728602ce005a931fb13fad877f84c91a2a278d5dafa4c21da.jpg) + +![](images/41f64171c497797247428145e5fb85a4a0841eb755ad836e3e719c52ccf0503a.jpg) +Figure 14: We train for $\{1,2,4\}$ times the Chinchilla optimal number of tokens for 79M models. The above plots are taken for a $60\%$ checkpoint, with VQA-v2 as the y-axis. Plots from other checkpoints look similar. + +# G TRAINING FOR HIGHER CHINCHILLA SCALES + +In Figure 14, we train a 79M model for up to $4 \times$ the Chinchilla scale, which is approximately an $80 \times$ token multiplier. Overall, the trends for Cx1, Cx2, and Cx4 look quite similar. Consider, for example, the blue (epochs=1) trend lines for Cx1 (circle), Cx2 (cross), and Cx4 (star). We see that all three trend lines generally follow the same shape. The same can be said for the trend lines of the other epoch counts. We believe that this will be very interesting (albeit costly) to test at the 1B level to observe what role model size plays in these scale calculations. + +# H LARGER MODEL SCALES (7B) + +In this paper, we mostly conducted experiments on 1B scales and below. One natural question to ask is whether the results will continue to hold at larger scales. + +Experiments at the 7B scale can be costly, especially for pre-training. For text-only pre-training, we were able to leverage the pre-trained 7B checkpoints from DataComp-LM (Li et al., 2024b). However, DCLM-7B $^{4}$ was set to a schedule of 4.3T tokens but trained for only 2.3T tokens then cooled down. As such, the checkpoints for the $60\%$ , $80\%$ , and $100\%$ runs do not exist. To test if our main claim still holds true in this modified setting, we train and compare the following models: + +1. Introduce images (at a 90:10 text:image ratio) around $50\%$ of the way through pre-training for a DCLM-7B checkpoint (2.3T tokens at a 4.3T token schedule). This is done at 1x Chinchilla tokens (140B tokens). Then fine-tune with LLaVA data for 4 epochs. +2. Take the final cooled-down DCLM-7B checkpoint (2.3T tokens cooled-down for 270B more tokens). For a fair token-matched comparison, we continue training with just text at the + +same token-matched scale as the model above (i.e. 1x Chinchilla tokens). Then fine-tune with LLaVA data for 4 epochs. + +Here, model 1 is basically the method that we are proposing (i.e., adding images to the pre-trained checkpoint before it's fully cooled down), and model 2 is very similar to how many VLMs are conventionally trained. + +Our results are shown in Table 3 below: + +
DatasetModel 1 (with image data in pre-training)Model 2 (no image data in pre-training)
VQAv276.3974.69
GQA61.0860.6
VizWiz10.8811.69
TextVQA0.468280.41624
RefCOCO0.641680.58889
OCID0.461070.39696
POPE0.874780.87113
+ +Table 3: Performance of 7B models on various vision-language tasks. We see that model 1 (with images in pre-training) generally outperforms model 2 (no images in pre-training). This supports the findings that we observed in the smaller scale experiments. + +# I WHAT DO THE RESULTS LOOK LIKE IF WE UNFREEZE ALL THE WEIGHTS? + +There has been a debate about whether or not to freeze the image encoders when training VLMs. Certain papers such as Prismatic (Karamcheti et al., 2024) claim that the performance is better if the encoders are frozen, whereas other papers such as Cambrian (Tong et al., 2024) and PaliGemma (Beyer et al., 2024) claim the opposite. + +We conduct a few experiments to test this ourselves. Our results on the frozen vs unfrozen were conducted on 79M models. We report our results in Table 4. As the results for the unfrozen model were significantly worse across the board, we decided to stick with frozen image encoders for the rest of our experiments. + +# J ABLATIONS + +# J.1 EFFECT OF IMAGE DATASET + +In Table 5 we ablate over the caption dataset we use. We find that DataComp-DR is the best for both vision and text, though the gap is larger in text than in vision. This was one key reason we decided to use DataComp-DR for the majority of our experiments. + +Table 4: All results are taken with the mix of DataComp-DR caption data and DCLM text data and fine-tuned on 3 epochs. Across multiple settings, the unfrozen models perform worse in general. + +
CheckpointFrozen?Text-Image RatioVQA-v2 score
80%yes5%58.71
80%yes30%60.22
80%yes50%60.85
80%no5%68.55
80%no30%69.42
80%no50%71.0
+ +Table 5: Effect of image dataset + +
Dataset MixVision Sta-ble ScoreText Stable Score
DataComp0.46030.1168
DataComp-DR0.46070.1503
CC12M0.45560.1298
Shutterstock0.45180.1310
+ +Table 6: Effect of image encoder + +
Image EncoderVision Stable ScoreText Stable Score
SigLIP0.46070.1503
SigLIP + DINO0.46960.1347
Patch Projection0.15640.1503
+ +Table 7: All models above were trained from a $20\%$ checkpoint on a mix of DataComp-DR caption data and DCLM text data. + +
Random SeedImage RatioFT epochsVQA-v2 score
71%173.83
71%275.39
75%175.36
75%276.39
710%175.39
710%276.5
3651%174.46
3651%275.9
3655%175.39
3655%276.47
36510%175.55
36510%276.58
+ +# J.2 EFFECT OF IMAGE ENCODER + +In Table 6 we ablate over image encoders. Here, we observe that SigLIP and DINO-SigLIP are quite close to each other for vision, with DINO-SigLIP narrowly edging out SigLIP. However, SigLIP is better by a large margin in text. We hence select SigLIP for the majority of our experiments. + +# K RANDOM SEEDS + +One question that arises when comparing our different experiments is to what extent a small variation of the result is significant. To control this factor, we experiment with different random seeds. The resulting variation of the result, shown in Table 7 below, is representative of the variability of our pipeline. Overall, we observe from Table 7 that the variation across seeds is quite small, although the variation may get slightly larger as we go to smaller image ratios such as $1\%$ . + +# L LIMITATIONS AND FUTURE WORK + +While we strive to be thorough in our experiments, the space of exploration of multi-modal transformers is large and costly to cover. Many promising directions remain to be explored in this area. + +- Interleaved images - This is something several recent papers have done (Laurençon et al., 2024; Awadalla et al., 2024; McKinzie et al., 2024). There are currently also several datasets available to use, such as Awadalla et al. (2024) and Laurençon et al. (2023). It is possible that using interleaved images will lead to new interesting results. To better handle this usage, we would need to re-think our image encoding scheme to reduce the sequence length of a sample counting several images. +- Higher token multipliers for 1B models - Right now, we have experiments with higher token multipliers (up to 4 times the Chinchilla (Hoffmann et al., 2022) optimal) for 79M models (Section G). However, we do not have these for 1B, as they can be costly to run. It + +would also be interesting to go beyond 4x Chinchilla, as this would bring our training a lot closer to full pre-training as opposed to the cooldown that we are currently doing. + +- Scaling laws - Through our experimentation at 79M parameter scale and 1B parameter scale, we discovered large differences in the model behavior and results through similar training pipelines. It might be a sign that scaling laws of VLMs are more complex than those of LLMs. More experimentation across model sizes would be needed to confirm if these behavioral shifts persist across scales and data, uncovering the unique scaling laws of Vision-Language Models (VLMs) compared to Large Language Models (LLMs). + +- Image resolution training - This as well as other tricks from PaliGemma (Beyer et al., 2024) contribute to improve performance. However, they add complexity to the model and training pipeline, departing from the mainstream VLM training recipe. While we do not study the compounding effect these choices could have on the factors that we study, we believe these to be orthogonal improvement directions. + +- PrefixLM - Using PrefixLM allows the model to attend bidirectionally over image patches and the task definition. This can possibly interplay with other factors such as freezing vs unfreezing the model, ultimately affecting the downstream performance after pre-training. By bringing part of the model closer to the usual ViT architecture, this could unlock some ability of the model to better capture the image input information, and potentially remove the need for a pre-trained image encoder. + +# M BENCHMARK RESULTS + +To provide further analysis, we detail below the result per benchmark at different stages of our training process. Most text benchmarks see a decreasing score as the model is trained on images and then fine-tuned for visual question answering. Interestingly, AGIEval score actually increases with image training, while PubMedQA sees a sharp decrease in the score. + +
MetricOursOurs (No FT)Base 80%Base 100%LLaMA 3.2 1BQwen 2.5 1.5B
AGIEval32.527.719.428.221.463.6
ARC Easy59.372.374.777.169.580.6
BigBench CC27.230.140.847.627.257.3
BigBench CS35.846.244.646.746.556.5
COPA71.083.086.092.083.085.0
HellaSwag58.266.569.272.865.167.78
MathQA22.925.926.927.330.5240.84
PIQA70.574.476.679.176.076.22
PubMedQA35.038.666.269.665.866.6
Stable-Score15.4421.2625.7329.6723.5235.68
+ +Table 8: Benchmark results at different stages of the training process. "Ours" is our model trained with $10\%$ image captioning and $90\%$ text before 4 epochs of LLaVA fine-tuning. + +To help provide a qualitative assessment of our model performance, we also produce some data samples from VQAv2 with different question types. These samples are available at Zenodo. + +# N COMPARISON WITH PRIOR SOTA MODELS + +While our primary focus in this paper is on studying training recipes, grounding our findings with a comparison to prior state-of-the-art (SOTA) visual language models (VLMs) provides valuable context and strengthens the validity of our results. Below, we present a comparison of our results with those reported by Prismatic VLM and PaliGemma. Although these models are larger, we were unable to find similarly sized models reporting the same set of evaluations as ours. We also plan to evaluate the Qwen-VL-2B-Instruct model and include it in this comparison. + +
MetricOursPrismatic 7BPaliGemma 3B
TextVQA49.0551.7873.2 ± 0.2
RefCOCO61.2973.6277.9 ± 0.1
POPE87.3388.2887.0
GQA61.1164.1667.0 ± 0.3
VQAv276.8279.0585.6 ± 0.2
OCID40.8050.56N/A
Stable Score (No OCID)47.1351.3858.14
Stable Score (With OCID)46.0851.25N/A
+ +Table 9: Comparison of evaluation metrics between our model, Prismatic 7B, and PaliGemma 3B. "Ours" is our model trained with $10\%$ image captioning and $90\%$ text before 4 epochs of LLaVA fine-tuning. \ No newline at end of file diff --git a/ICLR/2025/Should VLMs be Pre-trained with Image Data_/images.zip b/ICLR/2025/Should VLMs be Pre-trained with Image Data_/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..81b65fab11c81449b54cddef9ac9263d297af1a6 --- /dev/null +++ b/ICLR/2025/Should VLMs be Pre-trained with Image Data_/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:25f76de3c4e9307bd3cc5d964780b6c15405be348bb4d6741822a955937347a1 +size 1518965 diff --git a/ICLR/2025/Should VLMs be Pre-trained with Image Data_/layout.json b/ICLR/2025/Should VLMs be Pre-trained with Image Data_/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..34d2b016af4229b949cc03af9a1d163589433d8e --- /dev/null +++ b/ICLR/2025/Should VLMs be Pre-trained with Image Data_/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d4237ca8e4532aac8b1cd3dec53f0a2554d120d2e31a9e110d4a17a67e35c3a4 +size 664823 diff --git a/ICLR/2025/Show-o_ One Single Transformer to Unify Multimodal Understanding and Generation/5f2d61c4-448e-4b0e-9720-21bb6291bfc0_content_list.json b/ICLR/2025/Show-o_ One Single Transformer to Unify Multimodal Understanding and Generation/5f2d61c4-448e-4b0e-9720-21bb6291bfc0_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..b4f01018f247f4a3520aee4ddc2b4c601bbf09ff --- /dev/null +++ b/ICLR/2025/Show-o_ One Single Transformer to Unify Multimodal Understanding and Generation/5f2d61c4-448e-4b0e-9720-21bb6291bfc0_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7a5f182a5e594b2b6e600dd4fd0c62b723f32f09622a16c63bc88e0094b5f6d2 +size 167678 diff --git a/ICLR/2025/Show-o_ One Single Transformer to Unify Multimodal Understanding and Generation/5f2d61c4-448e-4b0e-9720-21bb6291bfc0_model.json b/ICLR/2025/Show-o_ One Single Transformer to Unify Multimodal Understanding and Generation/5f2d61c4-448e-4b0e-9720-21bb6291bfc0_model.json new file mode 100644 index 0000000000000000000000000000000000000000..73cfac3cd8d8d42a644c4c2e2fb9bcbbc2ffacfd --- /dev/null +++ b/ICLR/2025/Show-o_ One Single Transformer to Unify Multimodal Understanding and Generation/5f2d61c4-448e-4b0e-9720-21bb6291bfc0_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7dca37556ab89db323bdb94581d807f5956f65df8f6a867c22cce179f25db1be +size 204629 diff --git a/ICLR/2025/Show-o_ One Single Transformer to Unify Multimodal Understanding and Generation/5f2d61c4-448e-4b0e-9720-21bb6291bfc0_origin.pdf b/ICLR/2025/Show-o_ One Single Transformer to Unify Multimodal Understanding and Generation/5f2d61c4-448e-4b0e-9720-21bb6291bfc0_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..bc3f00ed3bb6f7b7cce46b3d11927986eaf5449d --- /dev/null +++ b/ICLR/2025/Show-o_ One Single Transformer to Unify Multimodal Understanding and Generation/5f2d61c4-448e-4b0e-9720-21bb6291bfc0_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3f2d4740f20ead7c016b275c20a8bded0e82ad93c0c19ada00b6545a69606b84 +size 7822534 diff --git a/ICLR/2025/Show-o_ One Single Transformer to Unify Multimodal Understanding and Generation/full.md b/ICLR/2025/Show-o_ One Single Transformer to Unify Multimodal Understanding and Generation/full.md new file mode 100644 index 0000000000000000000000000000000000000000..46d1f5c91fdc1afe6f6dc620b3bf6714482c4a47 --- /dev/null +++ b/ICLR/2025/Show-o_ One Single Transformer to Unify Multimodal Understanding and Generation/full.md @@ -0,0 +1,684 @@ +# SHOW-O: ONE SINGLE TRANSFORMER TO UNIFY MULTIMODAL UNDERSTANDING AND GENERATION + +Jinheng Xie $^{1\dagger}$ Weijia Mao $^{1\dagger}$ Zochen Bai $^{1\dagger}$ David Junhao Zhang $^{1\dagger}$ Weihao Wang $^{2}$ +Kevin Qinghong Lin $^{1}$ Yuchao Gu $^{1}$ Zhijie Chen $^{2}$ Zhenheng Yang $^{2}$ Mike Zheng Shou $^{1*}$ + +1 Show Lab, National University of Singapore 2 ByteDance + +# ABSTRACT + +We present a unified transformer, i.e., Show-o, that unifies multimodal understanding and generation. Unlike fully autoregressive models, Show-o unifies autoregressive and (discrete) diffusion modeling to adaptively handle inputs and outputs of various and mixed modalities. The unified model flexibly supports a wide range of vision-language tasks including visual question-answering, text-to-image generation, text-guided inpainting/extrapolation, and mixed-modality generation. Across various benchmarks, it demonstrates comparable or superior performance to existing individual models with an equivalent or larger number of parameters tailored for understanding or generation. This significantly highlights its potential as a next-generation foundation model. Code and models are released at https://github.com/showlab/Show-o. + +# 1 INTRODUCTION + +"Alone we can do so little; together we can do so much." - Helen Keller + +Over the past few years, significant advancements have blossomed in the two key pillars of multimodal intelligence: understanding and generation (Fig. 1(a) and (b)). For multimodal understanding, Multimodal Large Language Models (MLLMs) like LLaVA (Liu et al., 2024c) have demonstrated exceptional capabilities in vision-language tasks such as visual question-answering (VQA). For the other pillar of visual generation, denoising diffusion probabilistic models (DDPMs) (Sohl-Dickstein et al., 2015; Ho et al., 2020b) have revolutionized the traditional generative paradigms (Kingma & Welling, 2013; Goodfellow et al., 2014), achieving unprecedented performance in text-to-image/video generation (Podell et al., 2023; Esser et al., 2024; Ho et al., 2022; Wu et al., 2023a). + +Given these achievements in individual fields, it is natural to explore the potential of connecting them. Recent works (Wu et al., 2023b; Ge et al., 2024; Ye et al., 2024a; Dong et al., 2024) have tried to assemble expert models from different domains to form a unified system that can handle both multimodal understanding and generation. However, existing attempts mainly treat each domain independently and often involve individual models responsible for understanding and generation separately (as shown on the left of Fig. 1(c)). For instance, NExT-GPT (Wu et al., 2023b) employs a base language model for multimodal understanding but requires an additional pre-trained diffusion model for image generation. Nonetheless, the mainstream understanding models like LLaVA are of transformer architecture (Vaswani et al., 2017b) while each leading generation models like Stable Diffusion 3 (SD3) (Esser et al., 2024) are just another transformer. This motivates a research question: can one single transformer handle both multimodal understanding and generation? + +Very recently, Chameleon (Team, 2024) has demonstrated this is possible. Specifically, Chameleon enables an early fusion of different modalities to generate both text and image tokens through the same manner of autoregressive modeling. While it is reasonable to model text tokens autoregressively (Touvron et al., 2023; Liu et al., 2024c), it is less clear whether it is better to model image/video patches (or pixels) autoregressively as well. An apparent and significant bottleneck of autoregressively predicting an image is the large number of sampling steps required due to its causal attention, particularly when dealing with images/videos in higher resolution. Further, (continuous) + +![](images/96e8a76a3e1a7235d30f5555bcd65e9c3de58c588da1e9d40b4b51f065086b5e.jpg) + +![](images/4b9f2d3a64614c22eb79694dad57c237ad4e833641b8abd64fbf8c3f1e175859.jpg) + +![](images/2cb512663739087fbaae3eb07775fa72218221b7592c973722d303f80f911963.jpg) + +![](images/e94decf9b5b9b4da93b683ef2cee4d171fc408df8b34b6c2a7d3ced675d447c4.jpg) + +![](images/f131d7a0d0f40e2a12f50ff8c604a277500447ace109bc340aaff8432b3b3c6c.jpg) +Figure 1: Characteristics comparison among understanding only, generation only, and unified (understanding & generation) models. "Vision" and "Language" indicate the representations from specific input modalities. In this context, "Diffusion" represents both continuous and discrete diffusion. + +![](images/077c3c7cee33c2f35c39cb2ec5651c3a702c69a89aaa8a6e8089101c15026f29.jpg) + +![](images/2ebbcdd1c41c08058dddbfc0eae5fad1dfed9320e9dc18624c87c7d3a5f46edc.jpg) + +diffusion models (Podell et al., 2023; Esser et al., 2024) have exhibited superior capabilities in visual generation than autoregressive ones and are in full attention. + +This motivates us to ponder: can such one single transformer involve both autoregressive and diffusion modeling? Here we envision a new paradigm that text is represented as discrete tokens and modeled autoregressively, same with large language models (LLMs), and continuous image pixels are modeled using denoising diffusion. However, it is non-trivial to integrate these two distinct techniques into one single network due to the significant differences between discrete text tokens and continuous image/video representations. Another challenge lies in the fact that existing state-of-the-art diffusion models typically rely on two distinct models, i.e., a text encoder to encode text conditional information and a denoising network to predict noise. + +To this end, we present a novel unified model, i.e., Show-o, capable of addressing both multimodal understanding and generation tasks simultaneously with mixed autoregressive and diffusion modeling (as shown in Fig. 2). Specifically, Show-o is built upon a pre-trained LLM and inherits the autoregressive modeling capability for text-based reasoning. Inspired by Gu et al. (2022); Chang et al. (2022), we employ a simplified discrete denoising diffusion, similar to MaskGIT (Chang et al., 2022), to model discrete image tokens instead of continuous diffusion used in existing works (Ge et al., 2024; Dong et al., 2024). Besides, Show-o inherently encodes text conditional information, eliminating additional text encoders. To accommodate diverse input data and variations of tasks, a text tokenizer and image tokenizer are employed to encode them into discrete tokens, and a unified prompting strategy is proposed further to process these tokens into structure sequences as input. Consequently, given an image accompanying questions, Show-o gives the answers autoregressively. When provided only text tokens, Show-o generates images in a style of discrete denoising diffusion. + +Quantitatively, Show-o demonstrates comparable even better performance to individual models with an equivalent or larger number of parameters across benchmarks. In contrast to autoregressively generating an image, Show-o requires approximately 20 times fewer sampling steps, exhibiting inherent potential in acceleration. Besides, as shown in Fig. 2, Show-o naturally supports various downstream applications like text-guided inpainting and extrapolation, without any fine-tuning. Moreover, we have demonstrated that Show-o has the potential for mixed-modality generation like interleaved video keyframe generation with text descriptions, video understanding, and video generation. This demonstrates the potential of the unified model as a feasible paradigm for long-form video understanding and generation. Beyond, we investigate the impact of dataset scale, image resolution, and different types of image representations (discrete or continuous) on the multimodal understanding performance, presenting systematic insights for the design of a unified model in the future. + +In Fig. 1, we present a comparison of model characteristics between Show-o and existing representative methods across various domains. One can observe that Show-o is a unified model that flexibly involves existing advanced techniques to comprehensively address multimodal understanding and generation. Collectively, the main contributions of this paper can be summarized as: + +- We present a unified model, i.e., Show-o, which unifies multimodal understanding and generation using one single transformer. +- Show-o innovatively unifies autoregressive and (discrete) diffusion modeling within one single transformer, demonstrating versatility in handling both text and images distinctly. +- As a unified model, Show-o demonstrates comparable even better performance to individual baseline models with an equivalent or larger number of parameters in multimodal understanding and generation benchmarks. +- Show-o inherently supports various downstream applications like text-based inpainting and extrapolation, without necessitating any fine-tuning. Besides, it also demonstrates the potential for mixed-modality generation, video understanding, and video generation. +- We explore the impact of dataset scale, image resolution, and different types of representations (discrete or continuous) on multimodal understanding, providing valuable insights for improving multimodal understanding capabilities of a unified model. + +# 2 RELATED WORK + +# 2.1 MULTIMODAL UNDERSTANDING + +Significant advancements in large language models (LLMs) (Touvron et al., 2023; Brown et al., 2020; Chowdhery et al., 2023) have inspired the development of multimodal large language models (MLLMs) (Li et al., 2024; Yin et al., 2023; Bai et al., 2024). Early MLLM efforts, such as LLaVA (Liu et al., 2024c), MiniGPT-4 (Zhu et al., 2023a), and InstructBLIP (Dai et al., 2023), demonstrate notable multimodal understanding capabilities. To integrate LLMs into multimodal domains, these studies explored projecting features from a pre-trained modal-specific encoder, such as CLIP (Radford et al., 2021), into the input space of LLMs, enabling multimodal understanding and reasoning within the transformer backbone. There are various design choices of MLLM (McKinzie et al., 2024; Tong et al., 2024) in vision encoders, feature alignment adapters, and datasets. + +# 2.2 VISUAL GENERATION + +Autoregressive models. Transformer models (Vaswani et al., 2017a; Raffel et al., 2020; Brown et al., 2020; Touvron et al., 2023) have demonstrated great success of autoregressive modeling in natural language processing. Inspired by such progress, previous studies (Parmar et al., 2018; Esser et al., 2021; Ravuri & Vinyals, 2019; Chen et al., 2020; Kondratyuk et al., 2023) directly apply the same autoregressive modeling to learn the dependency of image pixels for image/video generation. For instance, VideoPoet (Kondratyuk et al., 2023) also employs the decoder-only transformer architecture for synthesizing high-quality videos from multimodal inputs. More recently, LlamaGen (Sun et al., 2024) has demonstrated LLM-architecture based image token autoregression. + +Diffusion models. In recent years, diffusion-based methods (Rombach et al., 2022; Ramesh et al., 2022b;a; Peebles & Xie, 2023; Bao et al., 2023; Podell et al., 2023; Chen et al., 2024; Nichol et al., 2021; Xue et al., 2024; Xie et al., 2023; Wu et al., 2023a) have demonstrated exceptional capabilities in text-to-image/video generation. Typically, the denoising diffusion process is operated on the continuous latent space, in which the model is tasked with predicting the added Gaussian noise. In contrast, D3PM (Austin et al., 2021), Mask-predict (Ghazvininejad et al., 2019), ARDM (Hoogeboom et al., 2022), MaskGIT (Chang et al., 2022), UniD3 (Hu et al., 2023), and Copilot4D (Zhang et al., 2024) formulate a discrete corruption process as an alternative to Gaussian diffusion. + +# 2.3 UNIFIED VISION-LANGUAGE FOUNDATION MODEL + +In recent years, an increasing number of studies (Wu et al., 2023b; Tang et al., 2024; Ye et al., 2024a; Aiello et al., 2024; Lu et al., 2024) have focused on unified multimodal language models capable of both comprehension and generation. Some efforts (Zhu et al., 2023b; Sun et al., 2023b;a) use continuous representations interleaved with text tokens for autoregressive modeling to generate images. SEED-X (Ge et al., 2024) proposes a unified and versatile foundation system capable of handling both multimodal understanding and generation tasks. DreamLLM (Dong et al., 2024) also explores + +![](images/dd9db08b49d7d467be7799398543c6f23d70ca66e4c3583f23787ee2db1393b6.jpg) +Figure 2: An overview of Show-o. The input data, regardless of its modalities, is tokenized and then prompted into a formatted input sequence. Show-o processes text tokens autoregressively with causal attention and image tokens in (discrete) diffusion modeling via full attention, and then generates the desired output. Specifically, Show-o can handle image captioning, visual question answering, text-to-image generation, text-guided inpainting/extrapolation, and mixed modality generation. the potential of enabling multimodal comprehension and creation. Chameleon (Team, 2024) introduces token-based mixed-modal models capable of comprehending and generating images. + +# 3 METHODOLOGY + +Preliminaries. Instead of continuous diffusion, this work employs mask token prediction used in MaskGIT as a simplified discrete diffusion modeling to enable a more unified learning objective, i.e., predicting discrete tokens within one single transformer. We draw the connection between mask token prediction used in this work and discrete diffusion modeling in Appendix A. + +# 3.1TOKENIZATION + +Show-o is built upon pre-trained LLMs (Li et al., 2023), it is natural to perform the unified learning on the discrete space. We maintain a unified vocabulary to include discrete text and image tokens. + +Text Tokenization. Show-o is based on a pre-trained LLM such that we utilize the same tokenizer for text data tokenization without any modifications. + +Image Tokenization. Following MAGVIT-v2 (Yu et al., 2023), we train a lookup-free quantizer using a large-scale image data. The quantizer maintains a codebook of size $K = 8$ , 192 and encodes images of $256 \times 256$ resolution into $16 \times 16$ discrete tokens (option (a) in Fig. 3). + +An alternative approach is to use different tokenizers for understanding and generation, respectively. Inspired by existing studies (Liu et al., 2024c;b), we also extract the continuous image representations from the pretrained MAGVIT-v2 and CLIP-ViT (Radford et al., 2021) encoder as input for exploring the improvement of multimodal understanding capabilities (options (b) and (c) in Fig. 3). We will present more details and discuss this exploration in Section 4.6. In the following sections, the default Show-o employs discrete image tokens as input for both multimodal understanding and generation (option (a) in + +![](images/57e840455e067cdc8032b5b9845fa2e67c787a7d2f070779a99a927baabec2ef.jpg) +Figure 3: Optional inputs for multimodal understanding. + +Fig. 3). For simplicity, we only elaborate on the default Show-o in the methodology sections. + +![](images/1b4daf11bb165ce8d25d347903b4a1a2dd87e45776b596a627301863c5e72c60.jpg) +Figure 4: Illustration of the proposed unified prompting format. + +# 3.2 ARCHITECTURE + +Show-o inherits the architecture of existing LLM (Li et al., 2023) without any architecture modifications except for prepending a QK-Norm operation (Dehghani et al., 2023; Wortsman et al., 2023; Team, 2024) to each attention layer. We initialize Show-o with the weights of a pre-trained LLM and expand the size of the embedding layer by incorporating 8,192 new learnable embeddings for discrete image tokens. Unlike state-of-the-art diffusion models that require an additional text encoder, Show-o inherently encodes text conditional information by itself for text-to-image generation. + +Unified Prompting. To perform unified learning on multimodal understanding and generation, we design a unified prompting strategy to format various kinds of input data. Given an image-text pair $(\mathbf{x},\mathbf{y})$ , it is first tokenized into $M$ image tokens $\mathbf{u} = \{u_i\}_{i=1}^M$ and $N$ text tokens $\mathbf{v} = \{v_i\}_{i=1}^N$ by the image and text tokenizer, respectively. We form them into an input sequence according to the type of task in the format illustrated in Fig. 4. Specifically, [MMU] and [T2I] are pre-defined task tokens that indicate the learning task for the input sequence. [SOT] and [EOT] serve as special tokens denoting the start and end of text tokens, respectively. Similarly, [SOI] and [EOI] are pre-defined special tokens marking the start and end of image tokens. + +By employing this prompt design, we can effectively encode various input data for multi-modal understanding, text-to-image generation, and mixed-modality generation as sequential data. This setup enables unified learning to operate seamlessly within sequences across these various tasks. Once trained, we can accordingly prompt Show-o to handle various vision-language tasks including visual question answering and text-to-image generation (as shown in Fig. 2). + +![](images/8f1ed6ab461091e1f0824bca6b2ff2fa837c8cbf01085a6e6f925c9b492ba8c4.jpg) +(a) Multimodal Understanding +Figure 5: Omni-Attention Mechanism (The dark squares represent 'allow to attend', while the white squares indicate 'prevent from attending'). It is a versatile attention mechanism with causal and full attention that adaptively mixes and changes according to the format of the input sequence. + +![](images/8361f52148965cf52677af3cd1c32c4f35de4ae62f89642cd1e0220a527b2b6d.jpg) +(b) Text-to-Image Generation + +![](images/08a1ee4413d5dd1c84aaf3420bed5a5e0691ada331c039b8e759aa8e79ec37db.jpg) +(c) Language Modeling + +![](images/56c1a1f61c5b90202fa9f9c11f80d6c45caec78c3ff55abac3b41e607e06388f.jpg) +(d) Mixed-Modality Generation + +Omni-Attention Mechanism. Different from existing works (Touvron et al., 2023; Team, 2024) that model sequence auto-regressively only, we propose an omni-attention mechanism to enable Show-o to model various types of signals in distinct ways. It is a comprehensive attention mechanism with causal and full attention that adaptively mixes and changes according to the format of the input sequence. We illustrate omni-attention examples for different input sequences in Fig. 5. Specifically, Show-o model text tokens $\mathbf{v}$ within the sequence via causal attention. For image tokens u, Show-o processes them via full attention, allowing each token to comprehensively interact with all others. Given a formatted input sequence, it is apparent that in multimodal understanding (Fig. 5(a)), text tokens in a sequence can attend to all previous image tokens, and in text-to-image generation (Fig. 5(b)), image tokens are able to interact with all preceding text tokens. When given only text tokens, it degrades to causal attention (Fig. 5(c)). + +Training Objectives. To perform both auto-regressive and (discrete) diffusion modeling, we employ two learning objectives: i) Next Token Prediction (NTP) and ii) Mask Token Prediction (MTP). Given a sequence with $M$ image tokens $\mathbf{u} = \{u_1, u_2, \dots, u_M\}$ and $N$ text tokens + +Table 1: Evaluation on multimodal understanding benchmarks. Show-o is currently built upon Phi-1.5 and thus we implement LLaVA-v1.5-Phi-1.5 as our apple-to/apple baseline. Und. and Gen. denote "understanding" and "generation", respectively. $\ddagger$ denotes the improved Show-o that employs CLIP-ViT continuous representations. We highlight the model size of Show-o and LLaVA baseline in green, and we use blue to highlight the larger model size than ours. + +
TypeModel# ParamsPOPE↑MME↑Flickr30k↑VQAv2(test)↑GQA↑MMMU↑
Und. OnlyLLaVA-v1.5 (Liu et al., 2024b)7B85.91510.7-78.562.035.4
InstructBLIP (Dai et al., 2023)13B78.91212.8--49.5-
Qwen-VL-Chat Bai et al. (2023)7B-1487.5-78.257.5-
mPLUG-Owl2 (Ye et al., 2024b)7B85.81450.2-79.456.1-
LLaVA-v1.5-Phi-1.51.3B84.11128.069.675.356.530.7
Und. and Gen.Gemini-Nano-1 (Anil et al., 2023)1.8B---62.7-26.3
CoDI (Tang et al., 2024)---12.8---
Emu (Sun et al., 2023c)13B--77.457.2--
NExT-GPT (Wu et al., 2023b)13B--84.566.7--
SEED-X (Ge et al., 2024)17B84.21435.752.3-47.935.6
DreamLLM (Dong et al., 2024)7B---72.9--
VILA-U (Wu et al., 2024)7B85.81401.8-79.460.831.6
Emu3 (Wang et al., 2024)8B85.2--75.160.3-
Chameleon (Team, 2024)34B--74.766.0--
Show-o (Ours)1.3B80.01097.262.569.458.026.7
Show-o‡ (Ours)1.3B84.51232.967.674.761.027.4
+ +$\mathbf{v} = \{v_{1}, v_{2}, \dots, v_{N}\}$ for multimodal understanding, we maximize the likelihood of text tokens by employing the standard language modeling objective: + +$$ +\mathcal {L} _ {\mathrm {N T P}} = \sum_ {i} \log p _ {\theta} \left(v _ {i} \mid v _ {1}, \dots , v _ {i - 1}, u _ {1}, \dots , u _ {M}\right), \tag {1} +$$ + +where $p(\cdot |\cdot)$ indicates the conditional probability which is modeled by the weights $\theta$ of Show-o and stochastic gradient descent is used to train the model. Note that, if the input sequence involves only text tokens, there are no conditional terms on image tokens $\mathbf{u} = \{u_{1}, u_{2}, \dots, u_{M}\}$ . + +With the proof in Appendix A, we seamlessly integrate the simplified discrete diffusion modeling within Show-o by employing the mask token prediction as a learning objective. Hence, for modeling image tokens $\mathbf{u} = \{u_1, u_2, \dots, u_M\}$ within the input sequence, we first randomly replace the image tokens with the [MASK] token, notated as $u_*$ , at a random ratio (controlling by a time step) to create a masked sequence $\mathbf{u}_* = \{u_*, u_2, \dots, u_*\}$ . An illustration can be found in Fig. 9. Next, we aim to reconstruct the original image token from the masked tokens conditioning on unmasked regions and preceding text tokens by maximizing the following likelihood: + +$$ +\mathcal {L} _ {\mathrm {M T P}} = \sum_ {j} \log p _ {\theta} \left(u _ {j} \mid u _ {*}, u _ {2}, \dots , u _ {*}, u _ {M}, v _ {1}, \dots , v _ {N}\right). \tag {2} +$$ + +Note that the loss is only applied to the masked tokens. Specifically, we follow the sampling strategy used by MaskGIT Chang et al. (2022; 2023) to mask image tokens and reconstruct them via the information from all text and unmasked image tokens within the input sequence. Following the classifier-free guidance introduced by Ho & Salimans (2022), we randomly replace the conditioned text tokens using a null text “” with some probability. + +Given a batch size of input sequences, the overall training loss is the combination of $\mathcal{L}_{\mathrm{MTP}}$ and $\mathcal{L}_{\mathrm{NTP}}$ : + +$$ +\mathcal {L} = \mathcal {L} _ {\mathrm {M T P}} + \alpha \mathcal {L} _ {\mathrm {N T P}}, \tag {3} +$$ + +where $\alpha$ is the hyper-parameter weighting the loss term $\mathcal{L}_{\mathrm{NTP}}$ . The training schedule mainly involves three stages, and we provide more details in Appendix C. + +Inference Stage. In multimodal understanding, given an image accompanying visual questions, Show-o autoregressively predicts textual answers. In visual generation, we use all [MASK] tokens as initial input for Show-o, in which [MASK] tokens will be iteratively replaced by the predicted image tokens within $T$ steps. More inference details are provided in Appendix D. + +# 4 EXPERIMENTS + +# 4.1 EXPERIMENTAL SETUP + +Datasets. We assemble two scales of datasets, i.e., around 35M and 2.0B image-text pairs, and collect around 2M high-quality data for multimodal understanding and generation fine-tuning. Besides, + +![](images/1bf8eab82482acdade0d23ea3fc517ee3b921d79b956c336034bddbaf9077d6b.jpg) +User: Do you think the image is unusual or not? +Figure 6: Comparisons of VQA capabilities between Chameleon and Show-o. + +# Show-o: + +The image is unusual because it depicts a living room with a couch and a table in the middle of the ocean, surrounded by a large body of water. This is not a typical setting for a living room, as living rooms are usually indoors and designed for relaxation and entertainment. The presence of the couch and table in the ocean adds a unique and unexpected element to the scene, making it stand out from typical living room setups. + +# Chameleon: + +The image is unusual because of the transparent and colorful fish and coral in the water. The image is also unusual because of the clear blue sky with white clouds. The unusual objects in the image are the fish and coral in the water. The unusual objects in the image are the fish and coral in the water. The unusual objects in the image are the fish and coral in the water. The unusual objects in the image are the fish and coral in the water. + +RefinedWeb (Penedo et al., 2023) is adopted as text corpora to maintain the language modeling capability. Appendix E provides more details about these datasets. + +Evaluation Details. Following LLaVA (Liu et al., 2024b), we evaluate the multimodal understanding capabilities of Show-o on POPE, MME, Flickr30k, VQAv2, GQA, and MMMU benchmarks. Besides, we adopt Fréchet Inception Distance (FID) on MSCOCO dataset to evaluate the generation fidelity of Show-o. Further, we follow SD3 (Esser et al., 2024) to evaluate the text-to-image generation capabilities of Show-o on the GenEval (Ghosh et al., 2023) benchmark. + +Implementation details. Current version of Show-o is based on Phi-1.5 (1.3B) (Li et al., 2023). In the following, the default Show-o employs discrete image tokens as input for both multimodal understanding and generation. Show- $\mathbf{o}^{\dagger}$ and Show- $\mathbf{o}^{\ddagger}$ indicate the use of continuous image representations from the pre-trained MAGVIT-v2 and CLIP-ViT (corresponding to options (b) and (c) in Fig. 3), respectively, for multimodal understanding. Training details can be found in Appendix F. + +# 4.2 MULTIMODAL UNDERSTANDING + +Quantitative Evaluation. Table 1 presents the multimodal understanding capability of Show-o on public benchmarks, such as image captioning and visual question-answering tasks. i) The current version of Show-o is built upon Phi-1.5 and thus we follow LLaVA to train Show-o's understanding only counterpart as our direct baseline, namely LLaVA-v1.5-Phi-1.5. The proposed Show-o exhibits comparable performance in all evaluation metrics to the baseline LLaVA-v1.5-Phi-1.5, which is dedicated and optimized to only multimodal understanding. This demonstrates the great potential of our framework to unify multimodal understanding and generation in one single transformer. ii) When comparing with understanding only models including InstructBLIP, Qwen-VL-Chat, and mPLUG-Owl2 on multimodal understanding, our model with a much smaller model size also achieves competitive performance on POPE, MME, Flickr30k and VQAv2 benchmarks and performs better on GQA benchmark. iii) Compared with unified models with a much larger number of parameters, such as NExT-GPT-13B and Chameleon-34B, our model also achieves decent performance on Flickr30k benchmark and performs much better on VQAv2 benchmark. + +Qualitative Results. We present Show-o's visual question-answering capability and make comparisons with Chameleon in Fig. 6. It is evident that when presented with a query image, Show-o can respond to commonly asked questions, even addressing the unusual aspects within the image. In the example of Fig. 6, when asked, "Do you think the image is unusual or not", Chameleon fails to correctly identify the unusual aspect. In contrast, Show-o's response, "as living rooms are usually indoors and designed for relaxation and entertainment", is more accurate. + +# 4.3 VISUAL GENERATION + +Results on MSCOCO 30K. We present zero-shot FID of Show-o on MSCOCO 30K in Table 2. It can be observed that, compared to generation models trained with larger numbers of parameters and training images such as GLIDE and DALL-E 2, Show-o achieves a better FID, i.e., 9.24, with only 1.3B parameters and 35M training data. Though GigaGAN, Imagen, and RAPHAEL obtain a relatively better performance + +Table 2: MSCOCO zero-shot FID. Und. and Gen. denote "understanding" and "generation", respectively. + +
TypeMethod# Params# ImagesFID-30K↓
Gen. OnlyDALL-E (Ramesh et al., 2021)12B250M27.50
GLIDE (Nichol et al., 2021)5B250M12.24
LDM (Rombach et al., 2022)1.4B400M12.64
DALL-E 2 (Ramesh et al., 2022a)6.5B650M10.39
SDv1.5 (Rombach et al., 2022)0.9B2000M9.62
GigaGAN (Kang et al., 2023)0.9B2700M9.09
PixArt (Chen et al., 2024)0.6B25M7.32
Imagen (Saharia et al., 2022)3B860M7.27
RAPHAEL (Xue et al., 2024)3B5000M+6.61
Und. and Gen.CoDI (Tang et al., 2024)-400M22.26
LWM (Liu et al., 2024a)7B-12.68
SEED-X (Ge et al., 2024)17B-14.99
DreamLLM (Dong et al., 2024)7B-8.76
Show-o (Ours)1.3B35M9.24
+ +Table 3: Evaluation on the GenEval (Ghosh et al., 2023) benchmark. Und. and Gen. denote "understanding" and "generation", respectively. We highlight the model size of Show-o in green, and we use blue to highlight the larger model size than ours. Obj.: Object. Attri.: Attribute. + +
TypeMethod# ParamsSingle Obj.Two Obj.CountingColorsPositionColor Attr.Overall↑
Gen. OnlyLlamaGen (Sun et al., 2024)0.8B0.710.340.210.580.070.040.32
LDM (Rombach et al., 2022)1.4B0.920.290.230.700.020.050.37
SDv1.5 (Rombach et al., 2022)0.9B0.970.380.350.760.040.060.43
PixArt-alpha (Chen et al., 2024)0.6B0.980.500.440.800.080.070.48
SDv2.1 (Rombach et al., 2022)0.9B0.980.510.440.850.070.170.50
DALL-E 2 (Ramesh et al., 2022a)6.5B0.940.660.490.770.100.190.52
SDXL (Podell et al., 2023)2.6B0.980.740.390.850.150.230.55
SD3 (d=24) (Esser et al., 2024)2B0.980.740.630.670.340.360.62
Und. and Gen.CoDI (Tang et al., 2024)-0.890.160.160.650.020.010.31
LWM (Liu et al., 2024a)7B0.930.410.460.790.090.150.47
SEED-X (Ge et al., 2024)17B0.970.580.260.800.190.140.49
Emu3 Wang et al. (2024)8B------0.66
Transfusion Zhou et al. (2024)7.3B------0.63
Chameleon (Team, 2024)7B------0.39
Show-o (Ours)1.3B0.980.800.660.840.310.500.68
Show-o‡ (Ours)1.3B0.980.850.670.810.280.550.69
+ +than Show-o, they are much larger in model size (3B v.s. 1.3B) and trained with much more data. In comparison to unified models, Show-o also exhibits improvement. However, it is worth noting that FID on MSCOCO 30K may not be a comprehensively accurate assessment of generation fidelity. The reason lies in the fact that existing generation models are commonly fine-tuned with high-quality and aesthetic images that do not align with the distribution of the MSCOCO dataset. + +Results on GenEval. One can observe in Table 3 that when comparing to the model in a similar size such as LDM (1.4B), Show-o obtains significantly better performance in all six metrics, with an improvement of around 0.24 overall. Besides, Show-o achieves a better performance than DALL-E 2, which is 5 times larger in model size, and SDXL. Further, Show-o, with only 1.3B parameters, achieves comparable performance to models with around two times larger number of parameters such as SD3 (2B). It indicates that our unified model's generative capabilities are comparable to or even surpass those of specialized generation models. In comparison to unified models such as CoDI, SEED-X, and Chameleon, Show-o also demonstrates significant improvements. + +Qualitative Results. We show image samples generated by Show-o in Fig. 7. One can observe that Show-o is capable of generating diverse, interesting, and realistic visual content in a resolution of $512 \times 512$ . For example, Show-o can generate a futuristic style of car, a highly detailed face, cute objects, and vivid scenery with vibrant contrast. + +Text-guided Inpainting and Extrapolation. As mentioned, Show-o naturally supports text-based inpainting and extrapolation without requiring any fine-tuning. We illustrate examples in Fig. 8 (a). As shown on the top of the figure, given an input image and inpainting mask, Show-o can inpaint the original red trolley car to a blue sports car with sleek curves and tinted windows based on the user-provided text prompt. Specifically, we first tokenize the original image, mask those tokens to be inpainted, and then Show-o will gradually replace the masked tokens with predicted image tokens. Besides, Show-o is capable of extrapolating the original image horizontally/vertically based on the given text prompt. These cases significantly demonstrate the inherent advantages of Show-o over those autoregressive models for downstream applications. + +# 4.4 MIXED-MODALITY GENERATION OF VIDEO KEYFRAMES AND CAPTIONS + +Here, we explore the mixed-modality generation ability of Show-o based on the text descriptions and video keyframes in the GenHowTo dataset. Given a sequence of interleaved text descriptions and video keyframes (as shown at the bottom of Fig. 4), Show-o is trained to predict the next text tokens or keyframe tokens conditioning on all preceding tokens. Thus, Show-o can generate mixed-modality of text descriptions and video keyframes. Examining a single frame, these tokens are generated in a diffusion manner. When considering the modeling of long sequences, as subsequent keyframes are produced based on all preceding text and image information, this can also be viewed as a form of temporal auto-regressive modeling. + +We have tried to train Show-o using instructional examples and present qualitative examples in Fig. 8 (b). For example, given a question "Can you guide me through making Avocado and Apple Juice", Show-o exhibits the capability to generate video keyframes with text descriptions related to the question. It is apparent that the generated keyframes are temporally consistent. + +![](images/0e93a4bda2e3307582ac591a94e0b38a82ad569c28726c09c01c48498bbcb5f4.jpg) + +![](images/9e02a88a1c36d7824205da782020d69d92422a33db9cce80a62182a5e172b2a4.jpg) + +![](images/04a388011a6c5f81a46ec1ef6a541f34675edbbbba05162e9c1231f4dc3d9617.jpg) + +![](images/9b85c57b154ed05614d0cd1843a311f7bd5682ce3ba3aaeee328a02fbb9a236c.jpg) +Figure 7: Images generated by Show-o. Text prompts are provided in Appendix G. + +![](images/0f3417dc013f417bd929abc8c5022cdcb12dc35a577c936e2f01588dfa8e723b.jpg) + +![](images/2d3b2ae7468e97746f951312eb0406602bcbab546ffc1151cb72dd6770ba97b5.jpg) + +# 4.5VIDEO UNDERSTANDING AND GENERATION + +Beyond image understanding and generation, we have explored Show-o to support video understanding and generation. We inflate the existing pre-trained MAGVIT-v2 to support encoding videos into discrete tokens, compressing an 8 FPS video tensor of $3 \times 17 \times 256 \times 256$ into $5 \times 16 \times 16$ . In this way, following the sequence format and omni-attention of multimodal understanding and generation introduced in Section 3.2, it is convenient to fine-tune the existing Show-o to involve video understanding and generation. One can observe visual examples in Figs. 8 (c) and (d) that Show-o can accurately comprehend and describe the variations in the video and generate consistent video frames with "a jeep car is approaching from a distance". More examples can be found in Appendix H. + +# 4.6 ABLATION STUDIES + +Impact of dataset scale and image resolution on multimodal understanding. As only discrete image tokens are extracted from the vision tokenizer, it is required to learn image token + +Table 4: Impact of dataset scale and image resolution on the learning of discrete image token embeddings for multimodal understanding. + +
# Image-textResolutionPOPEMMEFlickr30kVQAv2(test)GQAMMMU
35M256273.8948.436.259.348.725.1
2.0B256276.21014.948.964.754.225.0
2.0B512280.01097.262.569.458.026.7
+ +embeddings in Show-o from scratch. Unlike aligned image representations from the CLIP well-trained on a large-scale image-text dataset, Show-o necessitates the multimodal alignment between image and text embeddings during the pre-training stages. Here, we study the impact of the dataset scale and image resolution on the learning of discrete image token embeddings for multimodal understanding in Table 4. One can observe that the multimodal understanding capabilities of Show-o are consistently improved when increasing the data scale and image resolution. This reveals that it is required to involve more image-text pairs for multimodal alignment and more image tokens to represent an image for better comprehending the image information. + +As illustrated in Fig. 3(a), the default Show-o adopts the pre-trained MAGVIT-v2 to tokenize input image to discrete tokens, which are then passed to the embedding layer to obtain embeddings as input for multimodal understanding. Beyond, we provide a systematic exploration of different design choices for the input of Show-o to enhance multimodal understanding. Specifically, as shown in Fig. 3(b) and (c), instead of discrete image tokens, we extract the continuous image representations + +![](images/1703473feb0a068ccbdadfd995632a09df9533dd959d64610828bebf1c87d635.jpg) +Original Image + +![](images/4b1adc844fe9e92d655fd9b2ca7775522195991036be2eadee5a71c441b843fd.jpg) +"A blue sports car with sleek curves and tinted windows." + +![](images/dc16ba22b51025fd7ff4702d1e5368e5f6d2dc925c482f3d4ad933f43eff4dab.jpg) +"A serene natural landscape featuring a clear, blue lake surrounded by lush green trees." + +![](images/c8f648eff39005a7dd301d3fca1a174375103b0628de918e471dd203cdb661c4.jpg) + +![](images/50e3f5cc450f0ed6d6038dd5633c59c04cb32a7062f31ae563c24b06dbecb372.jpg) +(a) Text-guided Inpainting and Extrapolation + +![](images/c3c1bd58f9c0ccc43b30c41d100f5208903eadc97689b09b43aacd230e142961.jpg) + +![](images/d27c85b44d3d30a4f4bc039b56c5cac5d7af91e2da7fe8ff45c2c606961701ea.jpg) +User: Can you guide me through making Avocado and Apple Juice? +(1) Apple Peeling/Cutting. + +![](images/841750ba58213f46e0b978c6d0fd45ef0c135e1697fcf800249e9fe148c254fa.jpg) +(2) a person is cutting an apple. + +![](images/588aeb0c0f825a958e6335181bffd89b3a0261ad7ca115bc7852692bfd8aa311.jpg) +(3) a person slicing an apple on a plate. + +![](images/b32f90bad7b1d0b524fd9e2d349fca52e059d9e454c3ca364898860791953793.jpg) +(4) Avocado Peeling/Slicing. + +![](images/11f99b00e5c196deb36945ed53873a300bcb08d02fafa1dfee1204ab8c0cfff2.jpg) +(5) a woman is cutting an avocado on a plate. + +![](images/6e5c03d0171f89260979d163e6ea29a5819c8a12380f4c11910415c10e490063.jpg) +(6) a food processor with avocado in it. + +![](images/f18ddc0676c245ae463aab20985e5c874b071da8d46beeb38cd07ab06c483461.jpg) +User: Describe the video content. + +![](images/4be30a170a975821a358fd82382feb5139be9301ff70f4e3feec12f3bf191d92.jpg) +Generated Text Descriptions with Corresponding Video Keyframes + +![](images/3bc941af5bb41851b033ce7efb8363d28ab276697d54ab01f78690c1cb51cef6.jpg) +(b) Mixed-modality Generation + +![](images/23b606639b6c2d20e73c048db59868c58cde96183e2263e66848f2b07f59bd6e.jpg) + +![](images/a2d6d1574e46a7c2108fdbc812fac81efad1e0ce5571f668ae029b55c2ea4190.jpg) + +![](images/38b188bdc4f63c6a9e78b1ab75f55bd7e9a4c2b6b487e95b1c6341d2fab1cae5.jpg) + +![](images/e162de454dcc3d25c7e170724b7ac967cbac1d3848474b21eea922a351ccd0ec.jpg) +Show-o: The video shows a little girl sitting in a car seat, holding an ice cream cone in her hand. She appears to be enjoying her treat, and her eyes are closed, suggesting she is either asleep or simply taking a moment to relax. The car seat she is sitting on is black, and the background of the video is blurred, indicating that the focus is on the girl and her ice cream. The lighting in the car is bright, and the car seat is positioned in front of a window, providing a view of the outside environment. +Figure 8: Examples of text-guided inpainting/extrapolation, mixed-modality generation, video understanding and generation. 6 frames are sampled from the (generated) video for illustration. + +![](images/c8905570a8c03462ba741c4597afce680e32e58aa7fa8cfe90c0ac69dacb42f3.jpg) + +![](images/ed9c86998d584019a82f97441bf121dc4cf9c3a32eca8327f565daca2747d4c2.jpg) +(c) Video Understanding +"A jeep car is approaching from a distance." +(d) Video Generation + +![](images/aa60c09c5877444f273a6c52fb68d2f71ffcf310af4dfd88880bdd926f766b2c.jpg) + +![](images/9d0fb7caf0019fda401c6c4f5f60d9aa41e71d8c17d0c424c4c276c8e88677b4.jpg) + +![](images/fb6befb22c2064f59ef880fb22a3da822d42daa4289efa7e70c8770a1c9b037a.jpg) + +from the pre-trained MAGVIT-v2 and CLIP-ViT, respectively, as input for Show-o when dealing with multimodal understanding. We provide experimental results and insights in Appendix I. + +Additionally, we present qualitative examples to illustrate the impact of sampling steps and classifier-free guidance for text-to-image generation in Appendix I. In observation, increasing the sampling steps can allow the synthesis of an image that closely adheres to the prompt and improve fidelity. Besides, the classifier-free guidance can significantly make the colors and contents more diverse and consistent with the given text prompt. + +We also discuss the failure modes of Show-o in Appendix K. + +# 5 CONCLUSION + +This paper proposed a unified transformer, i.e., Show-o, to unify multimodal understanding and generation. Show-o for the first time unified autoregressive and (discrete) diffusion modeling that can handle different modalities in distinct ways. Extensive experimental results demonstrated that Show-o is comparable to even better than individual expert models across a wide range of vision-language tasks. This highlighted its potential as a next-generation foundation model. + +# 6 ACKNOWLEDGMENTS + +This research is supported by the National Research Foundation, Singapore under its AI Singapore Programme (AISG Award No:AISG3-RP-2022-030). +We would like to express our sincere gratitude to Henry Hengyuan Zhao for his valuable discussions and insightful feedback on multimodal understanding, Mingrui Wang for his patient assistance in helping us set up the development environment, and Han Yao for providing preprocessed video datasets. + +# REFERENCES + +Emanuele Aiello, LILI YU, Yixin Nie, Armen Aghajanyan, and Barlas Oguz. Jointly training large autoregressive multimodal models. In ICLR, 2024. +Rohan Anil, Sebastian Borgeaud, Yonghui Wu, Jean-Baptiste Alayrac, Jiahui Yu, Radu Soricut, Johan Schalkwyk, Andrew M Dai, Anja Hauth, Katie Millican, et al. Gemini: A family of highly capable multimodal models. arXiv preprint arXiv:2312.11805, 1, 2023. +Jacob Austin, Daniel D Johnson, Jonathan Ho, Daniel Tarlow, and Rianne Van Den Berg. Structured denoising diffusion models in discrete state-spaces. NeurIPS, pp. 17981-17993, 2021. +Jinze Bai, Shuai Bai, Shusheng Yang, Shijie Wang, Sinan Tan, Peng Wang, Junyang Lin, Chang Zhou, and Jingren Zhou. Qwen-vl: A frontier large vision-language model with versatile abilities. CoRR, abs/2308.12966, 2023. +Zechen Bai, Pichao Wang, Tianjun Xiao, Tong He, Zongbo Han, Zheng Zhang, and Mike Zheng Shou. Hallucination of multimodal large language models: A survey. arXiv preprint arXiv:2404.18930, 2024. +Fan Bao, Shen Nie, Kaiwen Xue, Yue Cao, Chongxuan Li, Hang Su, and Jun Zhu. All are worth words: A vit backbone for diffusion models. In CVPR, 2023. +Tom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel M. Ziegler, Jeffrey Wu, Clemens Winter, Christopher Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, and Dario Amodei. Language models are few-shot learners. In NeurIPS, 2020. +Minwoo Byeon, Beomhee Park, Haecheon Kim, Sungjun Lee, Woonhyuk Baek, and Saehoon Kim. Coyo-700m: Image-text pair dataset. https://github.com/kakaobrain/ coyo-dataset, 2022. +Andrew Campbell, Joe Benton, Valentin De Bortoli, Thomas Rainforth, George Deligiannidis, and Arnaud Doucet. A continuous time framework for discrete denoising models. NeurIPS, pp. 28266-28279, 2022. +Huiwen Chang, Han Zhang, Lu Jiang, Ce Liu, and William T Freeman. Maskgit: Masked generative image transformer. In CVPR, pp. 11315-11325, 2022. +Huiwen Chang, Han Zhang, Jarred Barber, AJ Maschinot, Jose Lezama, Lu Jiang, Ming-Hsuan Yang, Kevin Murphy, William T Freeman, Michael Rubinstein, et al. Muse: Text-to-image generation via masked generative transformers. arXiv preprint arXiv:2301.00704, 2023. +Soravit Changpinyo, Piyush Sharma, Nan Ding, and Radu Soricut. Conceptual $12\mathrm{m}$ : Pushing web-scale image-text pre-training to recognize long-tail visual concepts. In CVPR, pp. 3558-3568, 2021. +Junsong Chen, Jincheng Yu, Chongjian Ge, Lewei Yao, Enze Xie, Zhongdao Wang, James T. Kwok, Ping Luo, Huchuan Lu, and Zhenguo Li. Pixart-α: Fast training of diffusion transformer for photorealistic text-to-image synthesis. In ICLR. OpenReview.net, 2024. + +Lin Chen, Jisong Li, Xiaoyi Dong, Pan Zhang, Conghui He, Jiaqi Wang, Feng Zhao, and Dahua Lin. Sharegpt4v: Improving large multi-modal models with better captions. arXiv preprint arXiv:2311.12793, 2023. +Mark Chen, Alec Radford, Rewon Child, Jeffrey Wu, Heewoo Jun, David Luan, and Ilya Sutskever. Generative pretraining from pixels. In ICML, pp. 1691-1703, 2020. +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 First, Michele Catasta, Jason Wei, Kathy Meier-Hellstern, Douglas Eck, Jeff Dean, Slav Petrov, and Noah Fiedel. Palm: Scaling language modeling with pathways. J. Mach. Learn. Res., 24:240:1-240:113, 2023. +Wenliang Dai, Junnan Li, Dongxu Li, Anthony Meng Huat Tiong, Junqi Zhao, Weisheng Wang, Boyang Li, Pascale Fung, and Steven Hoi. Instructlip: Towards general-purpose vision-language models with instruction tuning, 2023. +Mostafa Dehghani, Josip Djolonga, Basil Mustafa, Piotr Padlewski, Jonathan Heek, Justin Gilmer, Andreas Peter Steiner, Mathilde Caron, Robert Geirhos, Ibrahim Alabdulmohsin, Rodolphe Jenatton, Lucas Beyer, Michael Tschannen, Anurag Arnab, Xiao Wang, Carlos Riquelme Ruiz, Matthias Minderer, Joan Puigcerver, Utku Evci, Manoj Kumar, Sjoerd van Steenkiste, Gamaleldin Fathy Elsayed, Aravindh Mahendran, Fisher Yu, Avital Oliver, Fantine Huot, Jasmijn Bastings, Mark Collier, Alexey A. Gritsanko, Vighnesh Birodkar, Cristina Nader Vasconcelos, Yi Tay, Thomas Mensink, Alexander Kolesnikov, Filip Pavetic, Dustin Tran, Thomas Kipf, Mario Lucic, Xiaohua Zhai, Daniel Keysers, Jeremiah J. Harmsen, and Neil Houlsby. Scaling vision transformers to 22 billion parameters. In ICML, pp. 7480-7512, 2023. +Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In CVPR, pp. 248-255, 2009. +Runpei Dong, Chunrui Han, Yuang Peng, Zekun Qi, Zheng Ge, Jinrong Yang, Liang Zhao, Jianjian Sun, Hongyu Zhou, Haoran Wei, Xiangwen Kong, Xiangyu Zhang, Kaisheng Ma, and Li Yi. DreamLLM: Synergistic multimodal comprehension and creation. In ICLR, 2024. +Patrick Esser, Robin Rombach, and Bjorn Ommer. Taming transformers for high-resolution image synthesis. In CVPR, pp. 12873-12883, 2021. +Patrick Esser, Sumith Kulal, Andreas Blattmann, Rahim Entezari, Jonas Müller, Harry Saini, Yam Levi, Dominik Lorenz, Axel Sauer, Frederic Boesel, et al. Scaling rectified flow transformers for high-resolution image synthesis. In ICML, 2024. +Samir Yitzhak Gadre, Gabriel Ilharco, Alex Fang, Jonathan Hayase, Georgios Smyrnis, Thao Nguyen, Ryan Marten, Mitchell Wortsman, Dhruba Ghosh, Jieyu Zhang, et al. Datacomp: In search of the next generation of multimodal datasets. NeurIPS, 2024. +Yuying Ge, Sijie Zhao, Jinguo Zhu, Yixiao Ge, Kun Yi, Lin Song, Chen Li, Xiaohan Ding, and Ying Shan. Seed-x: Multimodal models with unified multi-granularity comprehension and generation. arXiv preprint arXiv:2404.14396, 2024. +Marjan Ghazvininejad, Omer Levy, Yinhan Liu, and Luke Zettlemoyer. Mask-predict: Parallel decoding of conditional masked language models. In EMNLP, pp. 6111-6120, 2019. +Dhruba Ghosh, Hannaneh Hajishirzi, and Ludwig Schmidt. Geneval: An object-focused framework for evaluating text-to-image alignment. In NeurIPS, 2023. + +Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial nets. NeurIPS, 2014. +Shuyang Gu, Dong Chen, Jianmin Bao, Fang Wen, Bo Zhang, Dongdong Chen, Lu Yuan, and Baining Guo. Vector quantized diffusion model for text-to-image synthesis. In CVPR, pp. 10696-10706, 2022. +Jonathan Ho and Tim Salimans. Classifier-free diffusion guidance. arXiv preprint arXiv:2207.12598, 2022. +Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. In NeurIPS, pp. 6840-6851, 2020a. +Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. NeurIPS, pp. 6840-6851, 2020b. +Jonathan Ho, Tim Salimans, Alexey Gritsenko, William Chan, Mohammad Norouzi, and David J. Fleet. Video diffusion models. NeurIPS, 2022. +Emiel Hoogeboom, Alexey A. Gritsenko, Jasmijn Bastings, Ben Poole, Rianne van den Berg, and Tim Salimans. Autoregressive diffusion models. In *ICLR*. OpenReview.net, 2022. +Minghui Hu, Chuanxia Zheng, Zuopeng Yang, Tat-Jen Cham, Heliang Zheng, Chaoyue Wang, Dacheng Tao, and Ponnuthurai N. Suganthan. Unified discrete diffusion for simultaneous vision-language generation. In ICLR, 2023. +Minguk Kang, Jun-Yan Zhu, Richard Zhang, Jaesik Park, Eli Shechtman, Sylvain Paris, and Taesung Park. Scaling up gans for text-to-image synthesis. In CVPR, pp. 10124-10134. IEEE, 2023. +Diederik P Kingma and Max Welling. Auto-encoding variational bayes. arXiv preprint arXiv:1312.6114, 2013. +Alexander Kirillov, Eric Mintun, Nikhila Ravi, Hanzi Mao, Chloe Rolland, Laura Gustafson, Tete Xiao, Spencer Whitehead, Alexander C Berg, Wan-Yen Lo, et al. Segment anything. In ICCV, pp. 4015-4026, 2023. +Dan Kondratyuk, Lijun Yu, Xiuye Gu, José Lezama, Jonathan Huang, Rachel Hornung, Hartwig Adam, Hassan Akbari, Yair Alon, Vighnesh Birodkar, et al. Videopoet: A large language model for zero-shot video generation. arXiv preprint arXiv:2312.14125, 2023. +Chunyuan Li, Zhe Gan, Zhengyuan Yang, Jianwei Yang, Linjie Li, Lijuan Wang, Jianfeng Gao, et al. Multimodal foundation models: From specialists to general-purpose assistants. Foundations and Trends® in Computer Graphics and Vision, 16(1-2):1-214, 2024. +Yuanzhi Li, Sébastien Bubeck, Ronen Eldan, Allie Del Giorno, Suriya Gunasekar, and Yin Tat Lee. Textbooks are all you need ii: phi-1.5 technical report. arXiv preprint arXiv:2309.05463, 2023. +Hao Liu, Wilson Yan, Matei Zaharia, and Pieter Abbeel. World model on million-length video and language with ringattention. arXiv preprint, 2024a. +Haotian Liu, Chunyuan Li, Yuheng Li, and Yong Jae Lee. Improved baselines with visual instruction tuning. In CVPR, pp. 26296-26306, 2024b. +Haotian Liu, Chunyuan Li, Qingyang Wu, and Yong Jae Lee. Visual instruction tuning. NeurIPS, 36, 2024c. +Jiasen Lu, Christopher Clark, Sangho Lee, Zichen Zhang, Savya Khosla, Ryan Marten, Derek Hoiem, and Aniruddha Kembhavi. Unified-io 2: Scaling autoregressive multimodal models with vision language audio and action. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 26439-26455, 2024. +Brandon McKinzie, Zhe Gan, Jean-Philippe Fauconnier, Sam Dodge, Bowen Zhang, Philipp Dufter, Dhruti Shah, Xianzhi Du, Futang Peng, Floris Weers, et al. Mm1: Methods, analysis & insights from multimodal llm pre-training. arXiv preprint arXiv:2403.09611, 2024. + +Alex Nichol, Prafulla Dhariwal, Aditya Ramesh, Pranav Shyam, Pamela Mishkin, Bob McGrew, Ilya Sutskever, and Mark Chen. Glide: Towards photorealistic image generation and editing with text-guided diffusion models. arXiv preprint arXiv:2112.10741, 2021. +Niki Parmar, Ashish Vaswani, Jakob Uszkoreit, Lukasz Kaiser, Noam Shazeer, Alexander Ku, and Dustin Tran. Image transformer. In ICML, pp. 4055-4064, 2018. +William Peebles and Saining Xie. Scalable diffusion models with transformers. In ICCV, pp. 4195-4205, 2023. +Guilherme Penedo, Quentin Malartic, Daniel Hesslow, Ruxandra Cojocaru, Hamza Alobeidli, Alessandro Cappelli, Baptiste Pannier, Ebtesam Almazrouei, and Julien Launay. The refined-web dataset for falcon LLM: outperforming curated corpora with web data only. In NeurIPS, 2023. +Dustin Podell, Zion English, Kyle Lacey, Andreas Blattmann, Tim Dockhorn, Jonas Müller, Joe Penna, and Robin Rombach. Sdxl: Improving latent diffusion models for high-resolution image synthesis. arXiv preprint arXiv:2307.01952, 2023. +Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, Gretchen Krueger, and Ilya Sutskever. Learning transferable visual models from natural language supervision. In ICML, pp. 8748-8763, 2021. +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. +Aditya Ramesh, Mikhail Pavlov, Gabriel Goh, Scott Gray, Chelsea Voss, Alec Radford, Mark Chen, and Ilya Sutskever. Zero-shot text-to-image generation. In ICML, pp. 8821-8831. Pmlr, 2021. +Aditya Ramesh, Prafulla Dhariwal, Alex Nichol, Casey Chu, and Mark Chen. Hierarchical text-conditional image generation with CLIP latents. CoRR, abs/2204.06125, 2022a. +Aditya Ramesh, Prafulla Dhariwal, Alex Nichol, Casey Chu, and Mark Chen. Hierarchical text-conditional image generation with clip latents. arXiv preprint arXiv:2204.06125, 1(2):3, 2022b. +Suman Ravuri and Oriol Vinyals. Classification accuracy score for conditional generative models. NeurIPS, 32, 2019. +Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Björn Ommer. High-resolution image synthesis with latent diffusion models. In CVPR, pp. 10684-10695, 2022. +Chitwan Sahara, William Chan, Saurabh Saxena, Lala Li, Jay Whang, Emily L Denton, Kamyar Ghasemipour, Raphael Gontijo Lopes, Burcu Karagol Ayan, Tim Salimans, et al. Photorealistic text-to-image diffusion models with deep language understanding. NeurIPS, 35:36479-36494, 2022. +Jascha Sohl-Dickstein, Eric Weiss, Niru Maheswaranathan, and Surya Ganguli. Deep unsupervised learning using nonequilibrium thermodynamics. In ICML, pp. 2256-2265, 2015. +Tomáš Souček, Dima Damen, Michael Wray, Ivan Laptev, and Josef Sivic. Genhowto: Learning to generate actions and state transformations from instructional videos. In CVPR, pp. 6561-6571, 2024. +Peize Sun, Yi Jiang, Shoufa Chen, Shilong Zhang, Bingyue Peng, Ping Luo, and Zehuan Yuan. Autoregressive model beats diffusion: Llama for scalable image generation. arXiv preprint arXiv:2406.06525, 2024. +Quan Sun, Yufeng Cui, Xiaosong Zhang, Fan Zhang, Qiying Yu, Zhengxiong Luo, Yueze Wang, Yongming Rao, Jingjing Liu, Tiejun Huang, and Xinlong Wang. Generative multimodal models are in-context learners. CoRR, abs/2312.13286, 2023a. + +Quan Sun, Qiying Yu, Yufeng Cui, Fan Zhang, Xiaosong Zhang, Yueze Wang, Hongcheng Gao, Jingjing Liu, Tiejun Huang, and Xinlong Wang. Generative pretraining in multimodality. CoRR, abs/2307.05222, 2023b. +Quan Sun, Qiying Yu, Yufeng Cui, Fan Zhang, Xiaosong Zhang, Yueze Wang, Hongcheng Gao, Jingjing Liu, Tiejun Huang, and Xinlong Wang. Emu: Generative pretraining in multimodality. In ICLR, 2023c. +Zineng Tang, Ziyi Yang, Chenguang Zhu, Michael Zeng, and Mohit Bansal. Any-to-any generation via composable diffusion. NeurIPS, 36, 2024. +Chameleon Team. Chameleon: Mixed-modal early-fusion foundation models. arXiv preprint arXiv:2405.09818, 2024. +Shengbang Tong, Ellis Brown, Penghao Wu, Sanghyun Woo, Manoj Middepogu, Sai Charitha Akula, Jihan Yang, Shusheng Yang, Adithya Iyer, Xichen Pan, et al. Cambrian-1: A fully open, vision-centric exploration of multimodal llms. arXiv preprint arXiv:2406.16860, 2024. +Hugo Touvron, Thibaut Lavril, Gautier Izacard, Xavier Martinet, Marie-Anne Lachaux, Timothée Lacroix, Baptiste Roziere, Naman Goyal, Eric Hambro, Faisal Azhar, Aurélien Rodriguez, Armand Joulin, Edouard Grave, and Guillaume Lample. Llama: Open and efficient foundation language models. CoRR, abs/2302.13971, 2023. +Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. NeurIPS, 30, 2017a. +Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. NeurIPS, 2017b. +Xinlong Wang, Xiaosong Zhang, Zhengxiong Luo, Quan Sun, Yufeng Cui, Jinsheng Wang, Fan Zhang, Yueze Wang, Zhen Li, Qiying Yu, et al. Emu3: Next-token prediction is all you need. arXiv preprint arXiv:2409.18869, 2024. +Mitchell Wortsman, Peter J Liu, Lechao Xiao, Katie Everett, Alex Alemi, Ben Adlam, John D Co-Reyes, Izzeddin Gur, Abhishek Kumar, Roman Novak, et al. Small-scale proxies for large-scale transformer training instabilities. arXiv preprint arXiv:2309.14322, 2023. +Jay Zhangjie Wu, Yixiao Ge, Xintao Wang, Stan Weixian Lei, Yuchao Gu, Yufei Shi, Wynne Hsu, Ying Shan, Xiaohu Qie, and Mike Zheng Shou. Tune-a-video: One-shot tuning of image diffusion models for text-to-video generation. In ICCV, 2023a. +Shengqiong Wu, Hao Fei, Leigang Qu, Wei Ji, and Tat-Seng Chua. Next-gpt: Any-to-any multi-modal llm. arXiv preprint arXiv:2309.05519, 2023b. +Yecheng Wu, Zhuoyang Zhang, Junyu Chen, Haotian Tang, Dacheng Li, Yunhao Fang, Ligeng Zhu, Enze Xie, Hongxu Yin, Li Yi, et al. Vila-u: a unified foundation model integrating visual understanding and generation. arXiv preprint arXiv:2409.04429, 2024. +Jinheng Xie, Yuexiang Li, Yawen Huang, Haozhe Liu, Wentian Zhang, Yefeng Zheng, and Mike Zheng Shou. Boxdiff: Text-to-image synthesis with training-free box-constrained diffusion. In ICCV, pp. 7452-7461, 2023. +Zeyue Xue, Guanglu Song, Qiushan Guo, Boxiao Liu, Zhuofan Zong, Yu Liu, and Ping Luo. Raphael: Text-to-image generation via large mixture of diffusion paths. NeurIPS, 36, 2024. +Hanrong Ye, De-An Huang, Yao Lu, Zhiding Yu, Wei Ping, Andrew Tao, Jan Kautz, Song Han, Dan Xu, Pavlo Molchanov, et al. X-vila: Cross-modality alignment for large language model. arXiv preprint arXiv:2405.19335, 2024a. +Qinghao Ye, Haiyang Xu, Jiabo Ye, Ming Yan, Anwen Hu, Haowei Liu, Qi Qian, Ji Zhang, and Fei Huang. mplug-owl2: Revolutionizing multi-modal large language model with modality collaboration. In CVPR, pp. 13040–13051, 2024b. + +Shukang Yin, Chaoyou Fu, Sirui Zhao, Ke Li, Xing Sun, Tong Xu, and Enhong Chen. A survey on multimodal large language models. arXiv preprint arXiv:2306.13549, 2023. +Lijun Yu, José Lezama, Nitesh B Gundavarapu, Luca Versari, Kihyuk Sohn, David Minnen, Yong Cheng, Agrim Gupta, Xiuye Gu, Alexander G Hauptmann, et al. Language model beats diffusion–tokenizer is key to visual generation. arXiv preprint arXiv:2310.05737, 2023. +Lunjun Zhang, Yuwen Xiong, Ze Yang, Sergio Casas, Rui Hu, and Raquel Urtasun. Copilot4d: Learning unsupervised world models for autonomous driving via discrete diffusion. In ICLR, 2024. +Chunting Zhou, Lili Yu, Arun Babu, Kushal Tirumala, Michihiro Yasunaga, Leonid Shamis, Jacob Kahn, Xuezhe Ma, Luke Zettlemoyer, and Omer Levy. Transfusion: Predict the next token and diffuse images with one multi-modal model. 2024. URL https://apisemantic scholar.org/CorpusID:271909855. +Deyao Zhu, Jun Chen, Xiaoqian Shen, Xiang Li, and Mohamed Elhoseiny. Minigpt-4: Enhancing vision-language understanding with advanced large language models. CoRR, abs/2304.10592, 2023a. +Jinguo Zhu, Xiaohan Ding, Yixiao Ge, Yuying Ge, Sijie Zhao, Hengshuang Zhao, Xiaohua Wang, and Ying Shan. VL-GPT: A generative pre-trained transformer for vision and language understanding and generation. CoRR, abs/2312.09251, 2023b. + +![](images/22845f875d1ee3661c77e7b13fb58bb0e9064e1a22e3ecf68365b2c3bba07da4.jpg) +Image corruption by adding different level mask (noise) tokens +Figure 9: Illustration of image corruption by adding different level mask (noise) tokens and image generation by iteratively removing mask (noise) tokens in the absorbing discrete diffusion paradigm. + +# APPENDIX + +# A PRELIMINARIES + +In recent years, denoising diffusion probabilistic models (DDPMs) (Ho et al., 2020a) have demonstrated unprecedented performance in text-to-image/video generation in continuous state spaces, particularly exemplified by the popular Stable Diffusion series (Podell et al., 2023; Esser et al., 2024). Concurrently, discrete denoising diffusion probabilistic models (D3PMs) (Austin et al., 2021) have also shown impressive capabilities in modeling data in discrete form, featuring models like VQ-Diffusion (Gu et al., 2022) and Copilot4D (Zhang et al., 2024). Further, MaskGIT (Chang et al., 2022) and Muse (Chang et al., 2023) have demonstrated a simplified discrete diffusion that can effectively model discrete image tokens. Our Show-o model is built upon MaskGIT so that both such discrete visual and textual tokens can share a unified learning objective format. In the following, we provide preliminaries for diffusion models and draw the connection between discrete diffusion and mask token prediction employed in MaskGIT. + +In diffusion models, the forward process $q(\mathbf{x}_{1:T}|\mathbf{x}_0) = \prod_{t=1}^{T} q(\mathbf{x}_t|\mathbf{x}_{t-1})$ corrupts the image data $\mathbf{x}_0 \sim q(\mathbf{x}_0)$ into latent variables $\mathbf{x}_1, \dots, \mathbf{x}_T$ in different noise level. The reverse Markov process is learned to iteratively remove the noises added to the latent variables towards the real image distribution $q(\mathbf{x}_0)$ . In the continuous scenario, the transition distribution $q(\mathbf{x}_t|\mathbf{x}_{t-1})$ is commonly characterized by a Gaussian distribution: + +$$ +q \left(\mathbf {x} _ {t} \mid \mathbf {x} _ {t - 1}\right) = \mathcal {N} \left(\mathbf {x} _ {t} \mid \sqrt {1 - \beta_ {t}} \mathbf {x} _ {t - 1}, \beta_ {t} \mathbf {I}\right), \tag {4} +$$ + +where the mean is $\sqrt{1 - \beta_t}\mathbf{x}_{t - 1}$ and the variance is $\beta_{t}$ . For images tokenized into $K$ (i.e., the codebook size) categorical random variables $\mathbf{x}_t,\mathbf{x}_{t - 1}\in \{1,\dots ,K\}$ and given a [MASK] state, the transition distribution is instead formulated by a stochastic transition matrix $\mathbf{Q}_t\in \mathbb{R}^{(K + 1)\times (K + 1)}$ : + +$$ +q \left(\mathbf {x} _ {t} \mid \mathbf {x} _ {t - 1}\right) = \operatorname {C a t} \left(\mathbf {x} _ {t} \mid \mathbf {x} _ {t - 1} \mathbf {Q} _ {t}\right), \tag {5} +$$ + +where $[\mathbf{Q}_t]_{ij} = q(\mathbf{x}_t = j|\mathbf{x}_{t - 1} = i)$ , $\mathbf{x}_{t - 1}\mathbf{Q}_t$ indicates the row vector-matrix product, and $\mathrm{Cat}(\mathbf{x}_t|\mathbf{x}_{t - 1}\mathbf{Q}_t)$ is a categorical distribution over the one-hot row vector $\mathbf{x}_t$ given by $\mathbf{x}_{t - 1}\mathbf{Q}_t$ . When the transition matrix $\mathbf{Q}_t$ is applied to each image token in a sequence, the marginal and posterior at time step $t$ and $t - 1$ , respectively, are formulated as: + +$$ +q \left(\mathbf {x} _ {t} \mid \mathbf {x} _ {0}\right) = \operatorname {C a t} \left(\mathbf {x} _ {t} \mid \mathbf {x} _ {0} \overline {{\mathbf {Q}}} _ {t}\right), \quad \text {w h e r e} \quad \overline {{\mathbf {Q}}} _ {t} = \mathbf {Q} _ {1} \mathbf {Q} _ {2} \dots \mathbf {Q} _ {t}, +$$ + +$$ +q \left(\mathbf {x} _ {t - 1} \mid \mathbf {x} _ {t}, \mathbf {x} _ {0}\right) = \frac {q \left(\mathbf {x} _ {t} \mid \mathbf {x} _ {t - 1} , \mathbf {x} _ {0}\right) q \left(\mathbf {x} _ {t - 1} \mid \mathbf {x} _ {0}\right)}{q \left(\mathbf {x} _ {t} \mid \mathbf {x} _ {0}\right)} = \operatorname {C a t} \left(\mathbf {x} _ {t - 1} \mid \frac {\mathbf {x} _ {t} \mathbf {Q} _ {t} ^ {\top} \odot \mathbf {x} _ {0} \overline {{\mathbf {Q}}} _ {t - 1}}{\mathbf {x} _ {0} \overline {{\mathbf {Q}}} _ {t} \mathbf {x} _ {t} ^ {\top}}\right), \tag {6} +$$ + +where $q(\mathbf{x}_{t - 1}|\mathbf{x}_t,\mathbf{x}_0) = q(\mathbf{x}_{t - 1}|\mathbf{x}_t)$ because of the Markov property. + +In the following, we introduce the Absorbing-Uniform Discrete Diffusion by defining the stochastic transition matrix $\mathbf{Q}_t$ as follows: + +$$ +\mathbf {Q} _ {t} = \mathbf {Q} _ {t} ^ {a} \mathbf {Q} _ {t} ^ {u}, \tag {7} +$$ + +where $\mathbf{e}_m$ is a one-hot vector with a value of 1 at the index of [MASK] token, $\mathbf{Q}_t^a = (1 - \alpha_t)\mathbf{I} + \alpha_t\mathbf{1}\mathbf{e}_m^\top$ , and $\mathbf{Q}_t^u = \mathbf{I} - \beta_t(\mathbf{I} - \mathbf{e}_m\mathbf{e}_m^\top) + \frac{\beta_t}{(K + 1)}(\mathbf{1} - \mathbf{e}_m)(\mathbf{1} - \mathbf{e}_m)^\top$ . Here, $\alpha_t$ and $\beta_t$ represent the + +probabilities of an image token transforming into the [MASK] token and non-[MASK] token at time step $t$ , respectively. Specifically, the matrix form of $\mathbf{Q}_t$ can be written as: + +$$ +\mathbf {Q} _ {t} = \left[ \begin{array}{c c c c c c} \omega_ {t} + \nu_ {t} & \nu_ {t} & \nu_ {t} & \dots & \nu_ {t} & \alpha_ {t} \\ \nu_ {t} & \omega_ {t} + \nu_ {t} & \nu_ {t} & \dots & \nu_ {t} & \alpha_ {t} \\ \nu_ {t} & \nu_ {t} & \omega_ {t} + \nu_ {t} & \dots & \nu_ {t} & \alpha_ {t} \\ \vdots & \vdots & \vdots & \ddots & \vdots & \vdots \\ \nu_ {t} & \nu_ {t} & \nu_ {t} & \dots & \omega_ {t} + \nu_ {t} & \alpha_ {t} \\ 0 & 0 & 0 & \dots & 0 & 1 \end{array} \right], \tag {8} +$$ + +where $\omega_{t} = (1 - \alpha_{t} - \beta_{t})$ and $\nu_{t} = \frac{\beta_{t}}{(K + 1)}$ . Intuitively, during the corruption process, each image token in the sequence has a probability of $\alpha_{t}$ to be replaced by the [MASK] token, a chance of $\nu_{t}$ to be uniformly diffused, and a probability of $\omega_{k} + \nu_{t}$ remain unchanged. Besides, if a token turns into a [MASK] token, it will stay in the same [MASK] state during the following corruption process. Likewise, $\overline{\mathbf{Q}}_t = \overline{\mathbf{Q}}_t^a\overline{\mathbf{Q}}_t^u$ can be accordingly derived. An illustration of the image corruption process using [MASK] token is provided in Fig. 9. + +The evidence-lower bound (ELBO) for the variational diffusion models is: + +$$ +\begin{array}{l} - \mathcal {L} _ {\mathrm {E L B O}} (\mathbf {x} _ {0}, \theta) = \mathbb {E} _ {q (\mathbf {x} _ {1: T} | \mathbf {x} _ {0})} \left[ - \underbrace {D _ {\mathrm {K L}} [ q (\mathbf {x} _ {T} | \mathbf {x} _ {0}) \| p (\mathbf {x} _ {T}) ]} _ {\mathcal {L} _ {T}} + \underbrace {\log p _ {\theta} (\mathbf {x} _ {0} | \mathbf {x} _ {1})} _ {\mathcal {L} _ {0}} \right. \\ \left. - \sum_ {t = 2} ^ {T} \underbrace {D _ {\mathrm {K L}} \left[ q \left(\mathbf {x} _ {t - 1} \mid \mathbf {x} _ {t} , \mathbf {x} _ {0}\right) \| p _ {\theta} \left(\mathbf {x} _ {t - 1} \mid \mathbf {x} _ {t}\right) \right]} _ {\mathcal {L} _ {t - 1}} \right]. \tag {9} \\ \end{array} +$$ + +Considering the proposition in (Campbell et al., 2022) and the following parameterization of the reverse process: + +$$ +p _ {\theta} \left(\mathbf {x} _ {t - 1} \mid \mathbf {x} _ {t}\right) = \sum_ {\mathbf {x} _ {0}} q \left(\mathbf {x} _ {t - 1} \mid \mathbf {x} _ {t}, \mathbf {x} _ {0}\right) p _ {\theta} \left(\mathbf {x} _ {0} \mid \mathbf {x} _ {t}\right), \tag {10} +$$ + +the variational lower bound can be further expressed under the image distribution $q(\mathbf{x}_0)$ (referring to the proof provided by Zhang et al. (2024) as detailed in the Appendix B): + +$$ +\mathbb {E} _ {q \left(\mathbf {x} _ {0}\right)} \left[ \log p _ {\theta} \left(\mathbf {x} _ {0}\right) \right] \geq \mathbb {E} _ {q \left(\mathbf {x} _ {0}\right)} \left[ - \mathcal {L} _ {\mathrm {E L B O}} \left(\mathbf {x} _ {0}, \theta\right) \right] \geq \sum_ {t = 1} ^ {T} \mathbb {E} _ {q \left(\mathbf {x} _ {0}\right) q \left(\mathbf {x} _ {t} \mid \mathbf {x} _ {0}\right)} \left[ \log p _ {\theta} \left(\mathbf {x} _ {0} \mid \mathbf {x} _ {t}\right) \right] + C. \tag {11} +$$ + +When deriving this lower bound, the discrete diffusion paradigm can be further simplified by restricting each image token to be either unchanged or replaced with the [MASK] token, with no possibility of becoming other categorical variables. The resulting lower bound is effectively the Cross-Entropy loss used in MaskGIT (Chang et al., 2022), which is the mask token prediction to learn a neural network $p_{\theta}$ to reconstruct masked regions of $\mathbf{x}_0$ from the noised $\mathbf{x}_t$ . In this work, we follow MaskGIT to integrate this simplified discrete diffusion paradigm into Show-o because of its simplicity. Further, Muse (Chang et al., 2023) has successfully scaled up such a paradigm for text-to-image models of 3B parameters using 460M image-text pairs. + +# B ALTERNATIVE LOWER BOUND FOR THE VARIATIONAL DIFFUSION + +$$ +\begin{array}{l} \mathbb {E} _ {q (\mathbf {x} _ {0})} [ \log p _ {\theta} (\mathbf {x} _ {0}) ] \\ = \mathbb {E} _ {q (\mathbf {x} _ {0})} [ \log \int p _ {\theta} (\mathbf {x} _ {0}, \mathbf {x} _ {1} \dots \mathbf {x} _ {T}) d \mathbf {x} _ {1} \dots \mathbf {x} _ {T} ] \\ = \mathbb {E} _ {q (\mathbf {x} _ {0})} \left\{\log \mathbb {E} _ {q (\mathbf {x} _ {1: T} | \mathbf {x} _ {0})} \left[ \frac {p _ {\theta} (\mathbf {x} _ {0 : T - 1} | \mathbf {x} _ {T})}{q (\mathbf {x} _ {1: T} | \mathbf {x} _ {0})} p (\mathbf {x} _ {T}) \right] \right\} \\ \geq \mathbb {E} _ {q (\mathbf {x} _ {0}) q (\mathbf {x} _ {1: T} | \mathbf {x} _ {0})} \left[ \log \frac {p _ {\theta} (\mathbf {x} _ {0 : T - 1} | \mathbf {x} _ {T})}{q (\mathbf {x} _ {1 : T} | \mathbf {x} _ {0})} + \log p (\mathbf {x} _ {T}) \right] \\ = \mathbb {E} _ {q (\mathbf {x} _ {0: T})} \left[ \sum_ {t \geq 1} ^ {T} \log \frac {p _ {\theta} (\mathbf {x} _ {t - 1} | \mathbf {x} _ {t})}{q (\mathbf {x} _ {t} | \mathbf {x} _ {t - 1})} + \log p (\mathbf {x} _ {T}) \right] \\ = \mathbb {E} _ {q \left(\mathbf {x} _ {0: T}\right)} \left[ \sum_ {t \geq 1} ^ {T} \log p _ {\theta} \left(\mathbf {x} _ {t - 1} \mid \mathbf {x} _ {t}\right) + \log p \left(\mathbf {x} _ {T}\right) - \sum_ {t \geq 1} ^ {T} \log q \left(\mathbf {x} _ {t} \mid \mathbf {x} _ {t - 1}\right) \right] \\ = \mathbb {E} _ {q (\mathbf {x} _ {0: T})} \left[ \sum_ {t \geq 1} ^ {T} \log \sum_ {\tilde {\mathbf {x}} _ {0}} q \left(\mathbf {x} _ {t - 1} \mid \mathbf {x} _ {t}, \tilde {\mathbf {x}} _ {0}\right) \tilde {p} _ {\theta} \left(\tilde {\mathbf {x}} _ {0} \mid \mathbf {x} _ {t}\right) \right] + \underbrace {\mathbb {E} _ {q \left(\mathbf {x} _ {0 : T}\right)} \left[ \log p \left(\mathbf {x} _ {T}\right) - \sum_ {t \geq 1} ^ {T} \log q \left(\mathbf {x} _ {t} \mid \mathbf {x} _ {t - 1}\right) \right]} _ {C _ {1}} \\ = \mathbb {E} _ {q (\mathbf {x} _ {0: T})} \left[ \sum_ {t \geq 1} ^ {T} \log \sum_ {\tilde {\mathbf {x}} _ {0}} \frac {q \left(\mathbf {x} _ {t - 1} , \tilde {\mathbf {x}} _ {0} \mid \mathbf {x} _ {t}\right)}{q \left(\tilde {\mathbf {x}} _ {0} \mid \mathbf {x} _ {t}\right)} \tilde {p} _ {\theta} \left(\tilde {\mathbf {x}} _ {0} \mid \mathbf {x} _ {t}\right) \right] + C _ {1} \\ = \mathbb {E} _ {q (\mathbf {x} _ {0: T})} \left[ \sum_ {t \geq 1} ^ {T} \log \sum_ {\tilde {\mathbf {x}} _ {0}} \frac {q \left(\tilde {\mathbf {x}} _ {0} \mid \mathbf {x} _ {t - 1}\right)}{q \left(\tilde {\mathbf {x}} _ {0} \mid \mathbf {x} _ {t}\right)} \overbrace {q \left(\mathbf {x} _ {t - 1} \mid \mathbf {x} _ {t}\right)} ^ {q \left(\mathbf {x} _ {t} \mid \mathbf {x} _ {t - 1}\right) q \left(\mathbf {x} _ {t - 1}\right) / q \left(\mathbf {x} _ {t}\right)} \tilde {p} _ {\theta} \left(\tilde {\mathbf {x}} _ {0} \mid \mathbf {x} _ {t}\right) \right] + C _ {1} \\ \geq \mathbb {E} _ {q (\mathbf {x} _ {0: T})} \left[ \sum_ {t \geq 1} ^ {T} \sum_ {\tilde {\mathbf {x}} _ {0}} q (\tilde {\mathbf {x}} _ {0} | \mathbf {x} _ {t - 1}) \log \left(\frac {q (\mathbf {x} _ {t - 1} | \mathbf {x} _ {t})}{q (\tilde {\mathbf {x}} _ {0} | \mathbf {x} _ {t})} \tilde {p} _ {\theta} (\tilde {\mathbf {x}} _ {0} | \mathbf {x} _ {t})\right) \right] + C _ {1} \\ = \mathbb {E} _ {q (\mathbf {x} _ {0: T})} \left[ \sum_ {t \geq 1} ^ {T} \sum_ {\tilde {\mathbf {x}} _ {0}} q \left(\tilde {\mathbf {x}} _ {0} \mid \mathbf {x} _ {t - 1}\right) \log \tilde {p} _ {\theta} \left(\tilde {\mathbf {x}} _ {0} \mid \mathbf {x} _ {t}\right) \right] + C _ {1} + \underbrace {\mathbb {E} _ {q \left(\mathbf {x} _ {0 : T}\right)} \left[ \sum_ {t \geq 1} ^ {T} \sum_ {\tilde {\mathbf {x}} _ {0}} q \left(\tilde {\mathbf {x}} _ {0} \mid \mathbf {x} _ {t - 1}\right) \log \frac {q \left(\mathbf {x} _ {t - 1} \mid \mathbf {x} _ {t}\right)}{q \left(\tilde {\mathbf {x}} _ {0} \mid \mathbf {x} _ {t}\right)} \right]} _ {C _ {2}} \\ = \sum_ {t \geq 1} ^ {T} \mathbb {E} _ {q (\mathbf {x} _ {0}, \mathbf {x} _ {t - 1}, \mathbf {x} _ {t})} \left[ \sum_ {\tilde {\mathbf {x}} _ {0}} q \left(\tilde {\mathbf {x}} _ {0} | \mathbf {x} _ {t - 1}\right) \log \tilde {p} _ {\theta} \left(\tilde {\mathbf {x}} _ {0} | \mathbf {x} _ {t}\right) \right] + C _ {1} + C _ {2} \\ = \sum_ {t \geq 1} ^ {T} \mathbb {E} _ {q (\mathbf {x} _ {0}, \mathbf {x} _ {t - 1}, \mathbf {x} _ {t}) q (\tilde {\mathbf {x}} _ {0} | \mathbf {x} _ {t - 1})} [ \log \tilde {p} _ {\theta} (\tilde {\mathbf {x}} _ {0} | \mathbf {x} _ {t}) ] + C _ {1} + C _ {2} \\ = \sum_ {t \geq 1} ^ {T} \mathbb {E} _ {q (\mathbf {x} _ {0} | \mathbf {x} _ {t - 1}) q (\mathbf {x} _ {t} | \mathbf {x} _ {t - 1}) q (\mathbf {x} _ {t - 1}) q (\tilde {\mathbf {x}} _ {0} | \mathbf {x} _ {t - 1})} [ \log \tilde {p} _ {\theta} (\tilde {\mathbf {x}} _ {0} | \mathbf {x} _ {t}) ] + C _ {1} + C _ {2} \\ = \sum_ {t \geq 1} ^ {T} \mathbb {E} _ {q (\mathbf {x} _ {t} | \mathbf {x} _ {t - 1}) q (\mathbf {x} _ {t - 1}, \tilde {\mathbf {x}} _ {0})} [ \log \tilde {p} _ {\theta} (\tilde {\mathbf {x}} _ {0} | \mathbf {x} _ {t}) ] + C _ {1} + C _ {2} \\ = \sum_ {t \geq 1} ^ {T} \mathbb {E} _ {q (\mathbf {x} _ {t}, \mathbf {x} _ {0})} [ \log \tilde {p} _ {\theta} (\mathbf {x} _ {0} | \mathbf {x} _ {t}) ] + C _ {1} + C _ {2} \\ \end{array} +$$ + +The constants $C_1$ and $C_2$ are: + +$$ +\begin{array}{l} C _ {1} = \mathbb {E} _ {q (\mathbf {x} _ {0: T})} \left[ - \sum_ {t = 1} ^ {T} \log q (\mathbf {x} _ {t} | \mathbf {x} _ {t - 1}) + \underbrace {\log p (\mathbf {x} _ {T})} _ {\text {N o t e t h a t} p (\mathbf {x} _ {T}) = q (\mathbf {x} _ {T})} \right] \\ = \mathbb {E} _ {q (\mathbf {x} _ {0: T})} \left[ - \sum_ {t = 1} ^ {T} \log q (\mathbf {x} _ {t}, \mathbf {x} _ {t - 1}) + \sum_ {t = 0} ^ {T} \log q (\mathbf {x} _ {t}) \right] \\ \end{array} +$$ + +$$ +\begin{array}{l} C _ {2} = \mathbb {E} _ {q (\mathbf {x} _ {0: T})} \left[ \sum_ {t = 1} ^ {T} \log q (\mathbf {x} _ {t - 1} | \mathbf {x} _ {t}) \right] - \mathbb {E} _ {q (\mathbf {x} _ {0: T})} \left[ \sum_ {t = 1} ^ {T} \sum_ {\tilde {\mathbf {x}} _ {0}} q (\tilde {\mathbf {x}} _ {0} | \mathbf {x} _ {t - 1}) \log q (\tilde {\mathbf {x}} _ {0} | \mathbf {x} _ {t}) \right] \\ = \mathbb {E} _ {q (\mathbf {x} _ {0: T})} \left[ \sum_ {t = 1} ^ {T} \log q (\mathbf {x} _ {t}, \mathbf {x} _ {t - 1}) - \sum_ {t = 1} ^ {T} \log q (\mathbf {x} _ {t}) \right] - \sum_ {t = 1} ^ {T} \mathbb {E} _ {q (\mathbf {x} _ {0: T}) q (\tilde {\mathbf {x}} _ {0} | \mathbf {x} _ {t - 1})} [ \log q (\tilde {\mathbf {x}} _ {0} | \mathbf {x} _ {t}) ] \\ \end{array} +$$ + +$$ +C _ {1} + C _ {2} = \mathbb {E} _ {q (\mathbf {x} _ {0: T})} [ \log q (\mathbf {x} _ {0}) - \sum_ {t = 1} ^ {T} \log q (\mathbf {x} _ {0} | \mathbf {x} _ {t}) ] +$$ + +The alternative lower bound can be derived as: + +$$ +\begin{array}{l} \mathbb {E} _ {q (\mathbf {x} _ {0})} [ \log p _ {\theta} (\mathbf {x} _ {0}) ] \geq \sum_ {t = 1} ^ {T} \mathbb {E} _ {q (\mathbf {x} _ {t}, \mathbf {x} _ {0})} [ \log p _ {\theta} (\mathbf {x} _ {0} | \mathbf {x} _ {t}) ] + \mathbb {E} _ {q (\mathbf {x} _ {0: T})} [ \log q (\mathbf {x} _ {0}) - \sum_ {t = 1} ^ {T} \log q (\mathbf {x} _ {0} | \mathbf {x} _ {t}) ] \\ = \sum_ {t = 1} ^ {T} \mathbb {E} _ {q (\mathbf {x} _ {0}) q (\mathbf {x} _ {t} | \mathbf {x} _ {0})} [ \log p _ {\theta} (\mathbf {x} _ {0} | \mathbf {x} _ {t}) ] + C. \\ \end{array} +$$ + +This proof is provided by Zhang et al. (2024). + +# C TRAINING PIPELINE + +Given that the embedding of image tokens is newly initialized, it necessitates large-scale pre-training to align for multimodal understanding and generation. Besides, Show-o eliminates the text encoder to extract text embeddings for text-to-image generation, which poses a significant challenge for achieving effective alignment between text and image content within one single transformer. To this end, we employ a three-stage approach to progressively and effectively train Show-o: + +i) Image Token Embedding and Pixel Dependency Learning: We employ RefinedWeb (Penedo et al., 2023) dataset to train Show-o to maintain the language modeling ability. Meanwhile, ImageNet-1K dataset (Deng et al., 2009) and large-scale image-text pairs are adopted to train Show-o for class-conditional image generation and image captioning, respectively. Here, we directly leverage the class names from ImageNet-1K as textual inputs for learning class-conditional image generation. This stage primarily involves the learning of new learnable embeddings for discrete image tokens, pixel dependency for image generation, and alignment between image and text for image captioning. +ii) Image-Text Alignment for Multimodal Understanding and Generation: Building upon the pre-trained weights, we proceed to involve training of text-to-image generation on the image-text data instead of the ImageNet-1K. This stage mainly focuses on image and text alignment for both image captioning and text-to-image generation. +iii) High-Quality Data Fine-tuning: Lastly, we further refine the pre-trained Show-o model by incorporating filtered high-quality image-text pairs for text-to-image generation and instructional data for multimodal understanding and mixed-modality generation. + +# D INFERENCE DETAILS + +In inference, two types of predictions, i.e., text and image tokens, are involved in Show-o. In multimodal understanding, given the conditional image and questions, text tokens are auto-regressively sampled from the predicted tokens with higher confidence. In visual generation, given $N$ text tokens and $M$ [MASK] tokens as initial input, Show-o predict $M$ logits $\ell^t = \{\ell_i^t\}_{i=1}^M$ in parallel, where + +$\ell_i^t \in \mathbb{R}^{1 \times (K + 1)}$ and $t$ is the time step. Following the work (Chang et al., 2023), we compute both the conditional logit $\ell_c^t$ and unconditional logit $\ell_u^t$ for masked tokens. The final logit $\ell^t$ of each [MASK] token is obtained by the following equation with a guidance scale $w$ : + +$$ +\ell^ {t} = (1 + w) \ell_ {c} ^ {t} - w \ell_ {u} ^ {t}. \tag {12} +$$ + +For each [MASK] token $u_{*}$ at location $i$ , we sample an image token $u_{i}^{t}$ from the codebook based on the predicted probability $p_{i}^{t} = \mathrm{softmax}(\ell_{i}^{t})$ and indicate its predicted score $s_{i} \in \mathbb{R}$ as the confidence of this sampled token. The confidence of the unmasked token is set as 1.0. Next, we compute the number of image tokens $m$ that should be re-masked based on the mask scheduling function $\gamma$ where $m = \lceil \gamma (\frac{t}{T})M\rceil$ . More details of mask scheduling functions can be found in MaskGIT (Chang et al., 2022). Subsequently, we replace the predicted image tokens with [MASK] token $u_{*}$ based on the following metric: + +$$ +u _ {i} ^ {(t + 1)} = \left\{ \begin{array}{l l} u _ {*}, & \text {i f} s _ {i} < \operatorname {s o r t e d} _ {j} \left(s _ {j}\right) [ m ]. \\ u _ {i} ^ {t}, & \text {o t h e r w i s e .} \end{array} \right. \tag {13} +$$ + +The resulting sequence, consisting of the remaining image tokens and [MASK] tokens, will be fed back to Show-o for the subsequent round of prediction until reaching the final time step $T$ . The finalized image tokens are decoded by the image tokenizer into an image. + +# E DATASET DETAILS + +Three types of data are adopted for training Show-o: i) Text-only Data: We employ the publicly available RefinedWeb dataset (Penedo et al., 2023) to preserve the text reasoning capabilities of the pre-trained LLM. This dataset comprises approximately 1 billion instances (equivalent to 968 million individual web pages) and totals 2.8 terabytes of curated text data. ii) Image Data with Class Names: Show-o learns pixel dependencies using 1.28M images sourced from the ImageNet-1K (Deng et al., 2009) dataset. iii) Image-Text Data: For pre-training tasks correspond to multimodal understanding and generation, we assemble roughly 35M image-text pairs from the publicly available datasets including CC12M (Changpinyo et al., 2021), SA1B (Kirillov et al., 2023), and LAION-aesthetics- $12\mathrm{M}^{\dagger}$ . Additionally, we further increase the data scale to around 2.0B by incorporating DataComp (Gadre et al., 2024) and COYO700M (Byeon et al., 2022) with some filtering strategies. Note that, we employ ShareGPT4V (Chen et al., 2023) to re-caption these datasets. Additionally, around 1M internal image-text pairs serve as high-quality text-to-image generation datasets for the final fine-tuning. Following LLaVA-v1.5 (Liu et al., 2024b), we incorporate LLaVA-Pretrain-558K and LLaVA-v1.5-mix-665K for instruction tuning. Moreover, the GenHowTo dataset (Souček et al., 2024) is utilized for mixed-modality generation. + +# F IMPLEMENTATION DETAILS + +We initially conduct joint training of Show-o using the RefinedWeb, a collection of image-text pairs, and the ImageNet-1K for language modeling, image captioning, and class-conditional image generation, respectively, over 500K steps. Subsequently, we replace the class-conditional generation with the training for text-to-image generation using the around 35M image-text pairs for an additional 1,000K steps. The base model is trained on 48 A100 (80GB) GPUs with a total batch size of 1,152. We employ the AdamW optimizer with a weight decay of 0.01, 5,000 steps of warm-up, and an initial learning rate of 1e-4 with a cosine scheduling. Finally, we fine-tune Show-o with around 1M internal high-quality image-text pairs and adhere to the configuration of LLaVA-v1.5 for instruction data tuning. Note that, the current version of Show-o is based on Phi-1.5 (Li et al., 2023). In the following experiment sections, the default Show-o employs discrete image tokens as input for both multimodal understanding and generation. Show-o† and Show-o‡ indicate the use of continuous image representations from the pre-trained MAGVIT-v2 and CLIP-ViT (corresponding to options (b) and (c) in Fig. 3), respectively, for multimodal understanding and we discuss this exploration in Section 4.6. + +Based on the pre-trained Show-o, we continue to train it on the 2.0B image-text pairs for 500K steps and then we increase the image resolution to $512 \times 512$ and train Show-o for an additional + +500K steps. Finally, we fine-tune Show-o with around 1M internal high-quality image-text pairs and adhere to the configuration of LLaVA-v1.5 for instruction data tuning. + +# G TEXT PROMPTS + +"A 3D render of a futuristic car made of glass, driving through a city of mirrors." + +"A colorful cartoon of a tiger camouflaged in an abstract art painting, its stripes merging with the wild brushstrokes." + +"The image features a stylized stained glass illustration of a hummingbird with vibrant colors, set against a backdrop of swirling patterns and a large sun. The composition includes floral elements and intricate details, creating a vivid and dynamic scene that emphasizes the beauty of the bird. The colors range from greens to reds, enhancing the lively and artistic aesthetic of the piece." + +"A 3D render of a surreal explosion scene on the shore of a beautiful white sand beach with crystal clear water. The explosion has a spatter of oil paint with pastel colors and a thick consistency. The explosion is in a quiet and serene environment. A beautiful Japanese woman with a dress compacted to the sea is seen. There are butterfly petals and flowers with an ethereal glow and bioluminescence. There are pink and blue roses, and the overall image has a surreal and dreamlike quality." + +"A hyper-realistic close-up photograph of a woman's face, focusing on the left side. The image is highly detailed and realistic, showing voluminous glossy lips slightly parted, a well-defined nose, and open eyes with long eyelashes that cast shadows on the skin. The eye color is crystal clear almond green. The skin texture is crisp, with incredible detail of natural, lush skin and pores and freckles, with subtle highlights and shadows that give a realistic, close-up appearance." + +"A 3D render of a cute, round rice ball character named Mochi, with big, sparkling eyes that convey curiosity and joy. Its body is a soft, fluffy white with a slight sheen, resembling freshly cooked rice. Mochi has small, rosy cheeks that give it a warm, friendly expression. A tiny smile brightens its face, and it often sports a colorful ribbon tied around its "waist," adding a playful touch. Mochi's arms and feet are cartoonishly short, allowing it to bounce adorably around its surroundings. This time, Mochi is placed against a background that is a vibrant explosion of colors, with bright hues of fuchsia, turquoise, lemon yellow, and emerald green creating a canvas of vibrant contrasts and playful energy. The clashing colors make Mochi's soft white body and rosy cheeks stand out even more, inviting viewers into a world of cheerful exuberance and visual delight." + +# H MORE EXAMPLES OF VIDEO + +We provide more examples of video understanding and generation in Fig. 10. + +# I ABLATION STUDIES + +Impact of Vision Encoder for Multimodal Understanding. The default Show-o employs MAGVIT-v2 to encode images into discrete tokens for both multimodal understanding and generation. Inspired by the literature (Liu et al., 2024b), we investigate the impact of the most popular design choice of vision encoder, i.e., the pre-trained CLIP ViT (Radford et al., 2021), for multimodal understanding. We first compare the two settings using our Show-o model. In Table 5, the comparison between Exp 2 and Exp 4, Exp 3 and Exp 5 clearly demonstrates that continuous representations from CLIP-ViT have significantly better performance on multimodal understanding than that of MAGVIT-v2. This mainly attributes to: i) The CLIP-ViT is pre-trained on a much larger dataset (400M) than that of our pre-trained MAGVIT-v2 (35M); ii) In contrast to image reconstruction learning objective in MAGVIT-v2, the discriminative loss, i.e., image-text matching, in CLIP-ViT makes the extracted representations easier to be adapted for multimodal understanding. + +Impact of Various Representations for Multimodal Understanding. In typical multimodal understanding models like LLaVA, the image representation extraction and cross-modal alignment usually happen in the continuous space. However, image tokenizers such as MAGVIT-v2 naturally yield discrete image tokens. As shown in Table 5, we compare the two types of input, i.e., continuous representations and discrete tokens, in the multimodal understanding scenario. In Exp 6 + +![](images/9933b408bae19a869166ce93317f9b1c8c8f188f17746e4ecfcd9dab3c4e2495.jpg) +Describe the video content. + +![](images/b8a8c72a46fe97f0fedb60fbb7d0ca03e1ac220b9fd2a904cdc2789abb5e612d.jpg) + +![](images/831019f0540e6a0be29d95a05cc595c5afb917f461fbe225f12044483d7867dc.jpg) + +![](images/46d30d7aafb17159cdd8bda4f11825e99fa4d3981fa8a197e47eec1b56ef50a8.jpg) + +![](images/25614316ad4c76259bb0279918ec32264e1e3425d8ef32df557699e47126f2d1.jpg) + +The video features a man in a red shirt who is making a drink by adding various ingredients to a glass. He pours the mixture into a strainer and then adds a lemon slice to the glass. The man then drinks the drink from the glass. + +![](images/b98851cfcd98a94d6ab8547beff57585b3958a4862d71a44f5d27bd96a5d1c1d.jpg) +Describe the video content. + +The video features a woman who is sitting in front of a computer and talking to the camera. She is wearing a blue shirt and has her hands in her lap. Throughout the video, she is seen making various gestures and speaking to the camera. The background of the video is filled with various items, including a clock, a mirror, and a shelf with clothes. The woman's expressions and gestures vary throughout the video, but they are all focused on her conversation. + +![](images/a6ed67f53f6da6712b97dc33f03a93df5a5d65c1f5f5aed053d45fb560fdd225.jpg) +Describe the video content. + +![](images/24cf25d7db5053643250165c2a3df849bd406e90f5a6dca36b489e0e76558482.jpg) + +![](images/69eb1c7e7ce22544dbc42c973c74eb0f09b2904311fed5470bbc9b20fa12a7fc.jpg) + +![](images/d91368bf6ae6dd12fb2fe458623e622aa2b5ccc85d62bdb187b66288d4f895b4.jpg) + +![](images/e0131bf7d71fb7ab8fb588d57f8e2409c8029c041ea85732d9adb3102ea09cb7.jpg) + +The video features a woman in a kitchen who is cooking an omelette. She is shown stirring the eggs in a bowl, adding butter and grated cheese, and then flipping the omelette. The video also includes a cartoon character who is shown cooking an omelette. + +![](images/36f663952410cf6d7f44a7330ecc82d054b3ed8d810b9f18fcdb8ab38217f843.jpg) +"A blue car drives past a white picket fence on a sunny day" + +![](images/c69856b35d2b2e9668b0e38ccf8f2e5cc25a644454821c9fe2b23476db564837.jpg) +"There are two dogs, one brown and one black, playing together in a fenced-in area." +Figure 10: More examples on video understanding and generation. Only some key frames are sampled for illustration. + +Table 5: Ablation studies of various vision encoders and kinds input representations for multimodal understanding. Note that this experiment is based on the Show-o pre-trained on 35M image-text data in a resolution of $256 \times 256$ . + +
#ExpMethodVision EncoderUnified PretrainFeature typePOPEMMEFlickr30kVQAv2(val)GQAMMMU
1LLaVACLIP-ViTXContinuous84.11128.069.673.056.530.67
2Show-o‡CLIP-ViT✓Continuous84.51182.764.371.957.527.4
3Show-o‡CLIP-ViTXContinuous84.51161.668.573.558.729.2
4Show-o†MAGVIT-v2✓Continuous74.3947.833.959.451.026.7
5Show-o†MAGVIT-v2XContinuous65.1800.012.350.843.924.6
6Show-oMAGVIT-v2✓Discrete73.8948.436.257.848.725.1
7Show-oMAGVIT-v2XDiscrete63.8689.14.546.140.528.1
+ +and 7, we use the pre-trained MAGVIT-v2 to extract discrete tokens and train an embedding layer to embed the tokens into the continuous embedding space of the LLM. In Exp 4 and 5, we modify MAGVIT-v2 to output continuous representations without quantization. The cross-modal projection layer follows the setting of LLaVA. The comparison between Exp 5 and Exp 7 reveals that discrete + +"A colorful cartoon of a tiger camouflaged in an abstract art painting, its stripes merging with the wild brushstrokes." + +![](images/f7a3d67e97376c5dad6a18adf15e5004c4b06e085357dda937623ce3f4b9026c.jpg) +Figure 11: Illustration of generated samples using different sampling steps and classifier-free guidance scale $w$ . This experiment is based on the Show-o in a resolution of $512 \times 512$ . + +![](images/71c68f33a16767d97f62ea2792f9873335a65af38e6a91381db7b16098b6a113.jpg) + +![](images/02e48203d78f0898b73614273021a69dbdfc923ec8b6fb6cb2d23511968b3ca1.jpg) + +![](images/cec0c23895ee91ebe38d2275fa019f1d2410e16603a2b506357ac557eadcb54e.jpg) + +![](images/4d2a9cf76f43ce2bd0131c2f5a1d4b2f56de5f0eb1e84e65ce6036989d7801de.jpg) + +![](images/4cf107efeca775160ba2983704dda3d32b1ca7856ae1b797ffa1098df9e2dc88.jpg) + +![](images/93e7c48170f1dd4ae62d1951669fdd4eb8dd1a13f8be98a9bafcadde2096a3df.jpg) +(a) Failure Cases in Multimodal Understanding +What are the words in this image? +Show-o: The words in this image are "closing stock must go down." +Figure 12: Illustration of failure cases of Show-o in multimodal understanding and generation. + +![](images/04e7f1e6a4c32eb992da583c3048e4df00fd376a1f5fb0c8fb1fa2a136355374.jpg) +How many people in this picture? +Show-o: There are three people in the picture. + +![](images/86026b1519d9c2a845f519f815bef286f2a4c369d8d63815c3fade0b2ea63561.jpg) +(b) Failure Cases in Visual Generation +"The word 'mardefly' on a coffee mug" + +![](images/a61277a2e36b0d3d61cb096c37941263c94a802e55b41e8075424517c28be1a6.jpg) +"A group of seven people standing on a snow-covered slope, all wearing skis and posing for a picture." + +tokens show much worse performance on most benchmarks. We attribute the performance gap to that popular multimodal understanding datasets, e.g., LLaVA-Pretrain-558K, are not sufficient to align discrete image tokens into the language space, leading to an unsatisfactory cross-modal understanding. In contrast, continuous representations, already lying in a well-shaped embedding space, are much easier to align. + +Impact of Unified Pre-training for Multimodal Understanding. Our training pipeline involves two-stage unified pre-training to learn image token embedding and image-text alignment for multimodal understanding and generation (as described in Section C). Here we elaborate on the impact of the unified per-training with different vision encoders and types of representations: + +- CLIP-ViT with Continuous Representations. The comparison between Exp 2 and Exp 3 shows that the unified pre-training has a small negative effect on the CLIP ViT-based understanding, as the performance on most benchmarks has marginal degradations. We hypothesize that the MAGVIT-v2 token-based pre-training and the CLIP ViT-based tuning happen in nearly orthogonal dimensions, and the capability of the backbone has been spared to maintain the compatibility of the two tasks. +- MAGVIT-v2 with Continuous Representations. In the comparison between Exp 4 and Exp 5, we also notice a performance improvement brought by the unified pre-training, even though the pre-training uses discrete tokens while the experiments here use continuous features. This comparison further validates the hypothesis that unified pre-training enhances the multimodal understanding and reasoning capabilities of the backbone by diverse multimodal interactions during pre-training. +- MAGVIT-v2 with Discrete Tokens. The comparison between Exp 6 and Exp 7 shows that the unified pre-training has significantly boosted the multimodal understanding performance. This is intuitive since the pre-training also adopts MAGVIT-v2 discrete tokens as image representation. Specifically, we attribute the performance gain to that unified pre-training learns a better cross-modal alignment with large-scale data and enhances the multimodal understanding capabilities of the backbone. + +Impact of Sampling Steps. We present generated results at $512 \times 512$ resolution with varying sampling steps on the left of Fig. 11. With just five steps, Show-o can produce an image that is roughly related to the given prompt. Increasing the sampling steps to 25 allows the synthesis of an image that closely adheres to the prompt. When the sampling step is set as 50, the generated image becomes more detailed and realistic. In contrast, auto-regressive models Team (2024); Sun + +![](images/6c16f96a48802766198e3c4b567c95b965ee5e66fa59d7054a1425ea7c510a64.jpg) +Original image + +![](images/3937fec9bab1747d8d845b044a32a5a7f00b10e51fc62dd32046e266fe629fe8.jpg) +A green apple on the desk + +![](images/9b111c8c052ec5175774d2ee980f489f9430fa7d9997fffbecde69f21ad9e92f.jpg) +A small mouse on the desk + +![](images/4eab31eb501500b38eb591a35d33ce16d4d834664e0d6de9eda1ef094e159504.jpg) +Original image +Figure 13: Mask-free image editing. + +![](images/1a64fa39640c6289978580250b0bcee7e46097d0c068097c963649ef6669e602.jpg) +A blue car in the cartoon style + +![](images/deaf329940c6584d7966d9691116d6338810b50169ee6996432141e5774e4a18.jpg) +A blue car in the oil painting style + +et al. (2024) require 1024 sampling steps to generate an image of the same resolution when the downsampling rate is 16, which is around 20 times more steps than our approach. + +Impact of Classifier-free Guidance. The visual variations of generated images with different classifier-free guidance scales $w$ are illustrated on the right of Fig. 11. It can be observed that the object in the generated images lacks detail without classifier-free guidance. As the classifier-free guidance scale $w$ is gradually increased to 3 and 5, the colors and contents become more diverse and consistent with the given text prompt. + +# J MASK-FREE IMAGE EDITING + +Given an image, it can be converted into discrete image tokens, which can then be subject to iterative random masking for sampling purposes. This process allows for image editing without the need for predefined masks. For instance, as illustrated in Fig. 13, Show-o enables local-region modifications such as "changing the red apple to green" or "replacing the apple with a mouse." Furthermore, Show-o facilitates global style adjustments like "transforming the original image into a cartoon or oil painting style." + +# K FAILURE CASES + +We provide failure cases of Show-o in multimodal understanding and generation in Fig. 12. The current version of Show-o sometimes cannot accurately recognize the text and count the object instances and exhibits challenges in generating correct belongings such as skis for each instance. One can observe that Show-o fails to identify the phrase "closing down" in the left of Fig. 12(a) and is unable to generate the term "mardefly" (as shown left of Fig. 12(b)). This limitation is mainly attributed to the insufficiency of specific data tailored to these scenarios, as our model relies on a limited set of image-text pairs sourced from publicly available datasets and utilizes automatically generated captions. Enriching such kind of data holds promise for addressing these failure modes in Show-o, an aspect that will be explored in the future. \ No newline at end of file diff --git a/ICLR/2025/Show-o_ One Single Transformer to Unify Multimodal Understanding and Generation/images.zip b/ICLR/2025/Show-o_ One Single Transformer to Unify Multimodal Understanding and Generation/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..63d4f50636cd29bcb12ea52dc7fbfab7eefcf099 --- /dev/null +++ b/ICLR/2025/Show-o_ One Single Transformer to Unify Multimodal Understanding and Generation/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:30bf2dc09723261ae65680a496fc55e1a6191edca7a5a3a278dac441d45dffe3 +size 1471580 diff --git a/ICLR/2025/Show-o_ One Single Transformer to Unify Multimodal Understanding and Generation/layout.json b/ICLR/2025/Show-o_ One Single Transformer to Unify Multimodal Understanding and Generation/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..e4959ac69223f0ebee611d5b82e8dd16950a6a0b --- /dev/null +++ b/ICLR/2025/Show-o_ One Single Transformer to Unify Multimodal Understanding and Generation/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:249f0c759ac66990e43cb1fccf2bfe4bd55822cd8f6bcbeefdeb6944a490b509 +size 807834 diff --git a/ICLR/2025/SiMHand_ Mining Similar Hands for Large-Scale 3D Hand Pose Pre-training/6f70d604-a5e9-41cd-9a9d-ae20dbffe38d_content_list.json b/ICLR/2025/SiMHand_ Mining Similar Hands for Large-Scale 3D Hand Pose Pre-training/6f70d604-a5e9-41cd-9a9d-ae20dbffe38d_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..88d857268bf86eed9420bcdab41690d664dff3ab --- /dev/null +++ b/ICLR/2025/SiMHand_ Mining Similar Hands for Large-Scale 3D Hand Pose Pre-training/6f70d604-a5e9-41cd-9a9d-ae20dbffe38d_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f296f472193ec948c025896a7cf55ce987f13e912aaa38df0d414e3063dce8b4 +size 100518 diff --git a/ICLR/2025/SiMHand_ Mining Similar Hands for Large-Scale 3D Hand Pose Pre-training/6f70d604-a5e9-41cd-9a9d-ae20dbffe38d_model.json b/ICLR/2025/SiMHand_ Mining Similar Hands for Large-Scale 3D Hand Pose Pre-training/6f70d604-a5e9-41cd-9a9d-ae20dbffe38d_model.json new file mode 100644 index 0000000000000000000000000000000000000000..8bfbe77d8b4df6f27453c6037549c9b3f22a3d74 --- /dev/null +++ b/ICLR/2025/SiMHand_ Mining Similar Hands for Large-Scale 3D Hand Pose Pre-training/6f70d604-a5e9-41cd-9a9d-ae20dbffe38d_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:48e28ecfebd5b79a0457980cb310d65549dcfbd1a2223f997de227e896f364e7 +size 121317 diff --git a/ICLR/2025/SiMHand_ Mining Similar Hands for Large-Scale 3D Hand Pose Pre-training/6f70d604-a5e9-41cd-9a9d-ae20dbffe38d_origin.pdf b/ICLR/2025/SiMHand_ Mining Similar Hands for Large-Scale 3D Hand Pose Pre-training/6f70d604-a5e9-41cd-9a9d-ae20dbffe38d_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..3073d12d4793cf4175243f639cec99a402ddc1ec --- /dev/null +++ b/ICLR/2025/SiMHand_ Mining Similar Hands for Large-Scale 3D Hand Pose Pre-training/6f70d604-a5e9-41cd-9a9d-ae20dbffe38d_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6fae5b8d4addf57a72a87cde008c8756f477f4419b12fe15cb794c6f143fdb69 +size 4890935 diff --git a/ICLR/2025/SiMHand_ Mining Similar Hands for Large-Scale 3D Hand Pose Pre-training/full.md b/ICLR/2025/SiMHand_ Mining Similar Hands for Large-Scale 3D Hand Pose Pre-training/full.md new file mode 100644 index 0000000000000000000000000000000000000000..07b84aba04276f515a91b1ef5904b2318c65de15 --- /dev/null +++ b/ICLR/2025/SiMHand_ Mining Similar Hands for Large-Scale 3D Hand Pose Pre-training/full.md @@ -0,0 +1,339 @@ +# SIMHAND: MINING SIMILAR HANDS FOR LARGE-SCALE 3D HAND POSE PRE-TRAINING + +Nie Lin $^{1,*}$ , Takehiko Ohkawa $^{1,*}$ , Yifei Huang $^{1,\dagger}$ , Mingfang Zhang $^{1}$ , Minjie Cai $^{2,\dagger}$ , Ming Li $^{1}$ , Ryosuke Furuta $^{1}$ & Yoichi Sato $^{1}$ + +1The University of Tokyo, 2Hunan University +{nielin, ohkawa-t, hyf, mfzhang, mingli, furuta, ysato}@iis.u-tokyo.ac.jp, caiminjie@hnu.edu.cn, li-ming948@g.ecc.u-tokyo.ac.jp + +# ABSTRACT + +We present a framework for pre-training of 3D hand pose estimation from in-the-wild hand images sharing with similar hand characteristics, dubbed SiM-Hand. Pre-training with large-scale images achieves promising results in various tasks, but prior methods for 3D hand pose pre-training have not fully utilized the potential of diverse hand images accessible from in-the-wild videos. To facilitate scalable pre-training, we first prepare an extensive pool of hand images from in-the-wild videos and design our pre-training method with contrastive learning. Specifically, we collect over 2.0M hand images from recent human-centric videos, such as $100DOH$ and $Ego4D$ . To extract discriminative information from these images, we focus on the similarity of hands: pairs of non-identical samples with similar hand poses. We then propose a novel contrastive learning method that embeds similar hand pairs closer in the feature space. Our method not only learns from similar samples but also adaptively weights the contrastive learning loss based on inter-sample distance, leading to additional performance gains. Our experiments demonstrate that our method outperforms conventional contrastive learning approaches that produce positive pairs solely from a single image with data augmentation. We achieve significant improvements over the state-of-the-art method (PeCLR) in various datasets, with gains of $15\%$ on Frei-Hand, $10\%$ on DexYCB, and $4\%$ on AssemblyHands. Our code is available at https://github.com/ut-vision/SiMHand. + +# 1 INTRODUCTION + +Hands serve as a trigger for us to interact with the world, as seen in various human-centric videos. The precise tracking of hand states, such as 3D keypoints, is crucial for video understanding (Sener et al., 2022; Wen et al., 2023), AR/VR interfaces (Han et al., 2022; Wu et al., 2020), and robot learning (Chao et al., 2021; Qin et al., 2022). To this end, 3D hand pose estimation has been studied through constructing labeled datasets (Ohkawa et al., 2023a; Zimmermann et al., 2019; Chao et al., 2021; Ohkawa et al., 2023b) and advancing supervised pose estimators (Cai et al., 2018; Ge et al., 2019; Park et al., 2022; Liu et al., 2024; Fan et al., 2024). However, utilizing large-scale, unannotated hand videos for pre-training remains underexplored, while collections of human-centric videos, like 3,670 hours of videos from Ego4D (Grauman et al., 2022) and 131-day videos from 100DOH (Shan et al., 2020), are readily available. + +In pre-training, contrastive learning has been utilized to learn from unlabeled images like SimCLR (Chen et al., 2020), which maximizes agreement between positive pairs while repelling negatives. Spurr et al. (Spurr et al., 2021) introduce pose equivariant contrastive learning (PeCLR) for 3D hand pose estimation, which aligns the geometry of features encoded from augmented images with affine transformations. However, both SimCLR and PeCLR create positive pairs from a single sample by applying data augmentation, limiting the gains from positive pairs as their hand appearance and backgrounds are identical. Ziani et al. (Ziani et al., 2022) extend the contrastive learning framework to video sequences by treating temporally adjacent hand crops as positive pairs. + +![](images/5cd55ad38f6355db610ce129f13b72480900bc9e30423a0b9daac8ba7e165c9a.jpg) +Figure 1: The pipeline of pre-training and fine-tuning. (Left) Previous pre-training methods (e.g., PeCLR (Spurr et al., 2021)) learn from positive pairs originating from the different augmentations and fine-tune the network on a dataset. (Right) Our method is designed to learn from positive pairs with similar foreground hands, sampled from a pool of hand images in the wild. + +![](images/254e5ed4e2423220b502ea212e75af59146500a33efe00e28e02dc1849efe127.jpg) + +![](images/99f488532f600157103dea5800ca088bbecb0ff4305b77e0fcadba565d0fcec1.jpg) + +However, in-the-wild videos can challenge tracking hands across frames, especially in egocentric views where hands are often unobservable due to camera motion. Meanwhile, this temporal positive sample mining remains the limited appearance variation of hands and backgrounds. + +In this work, we introduce SiMHand, a novel contrastive learning framework for 3D hand pose pre-training, which leverages diverse hand images in the wild, with the largest 3D hand pose pretraining set to date. We specifically collect 2.0M hand images from human-centric videos, from Ego4D (Grauman et al., 2022) and 100DOH (Shan et al., 2020), using an off-the-shelf hand detector (Shan et al., 2020). Our pre-training set significantly exceeds the scale of prior works by two orders of magnitude, such as over 32-47K images in (Spurr et al., 2021) and 86K images from 100DOH in (Ziani et al., 2022). + +Our method focuses on learning discriminative information by mining hands with similar characteristics from various video domains. Based on our observations, contrastive learning can further benefit from discriminating the foreground of hands in varying backgrounds. As shown in Fig. 1, our positive pairs are sourced from different images, offering additional information gains from different types of object interactions, backgrounds, and hand appearances. Specifically, we use an off-the-shelf 2D hand pose estimator (Lugaresi et al., 2019) to identify similar hands from the pretraining set. + +Using the identified similar hands as positive pairs, we further propose adaptive weighting, to dynamically find informative pairs during training. A naive adaptation of the similar hands is to replace the original positive pairs in contrastive learning, but this scheme struggles to exploit how similar the paired hands are. To tackle this, we assign weights based on the similarity scores within the mini-batch in the contrastive learning loss. The weights are designed to have higher values as the similarity of the pairs increases. This allows the optimization of contrastive learning to explicitly consider the proximity of samples, beyond binary discrimination between positives and negatives. + +We validate the effectiveness of the pre-trained networks by fine-tuning on several datasets for 3D hand pose estimation, namely FreiHand (Zimmermann et al., 2019), DexYCB (Chao et al., 2021), and AssemblyHands (Ohkawa et al., 2023b). Our proposed method consistently outperforms conventional contrastive learning methods, SimCLR and PeCLR. Additionally, we conduct extensive ablation experiments to analyze: 1) performance with varying pre-training and fine-tuning data sizes, 2) the effect of adaptive weighting, and 3) the improvement with different levels of similarity. + +In summary, the main contribution of this paper is threefold: + +- We propose SiMHand, a contrastive learning method for 3D hand pose pre-training, leveraging positive samples with similar hands mined from 2.0M in-the-wild hand images. +- We introduce a parameter-free adaptive weighting mechanism in the contrastive learning loss, enabling optimization guidance according to the calculated similarity. +- Our experiments demonstrate that our approach surpasses prior pre-training methods and achieves robust performances across different hand pose datasets. + +# 2 RELATED WORK + +3D hand pose estimation: The task of 3D hand pose estimation aims to regress 3D hand joints. Since annotating 3D hand poses is challenging, only limited labeled datasets are available (Ohkawa et al., 2023a), and most of which are constructed in controlled laboratory settings (Zimmermann et al., 2019; Chao et al., 2021; Moon et al., 2020; Ohkawa et al., 2023b). Given this challenge, two approaches have been proposed to facilitate learning from limited annotations: pseudo-labeling and self-supervised pre-training. Pseudo-labeling methods learn from pseudo-ground-truth assigned on unlabeled images (Chen et al., 2021c; Zheng et al., 2023; Liu et al., 2021; Yang et al., 2021; Ohkawa et al., 2022; Liu et al., 2024). For example, S2Hand (Chen et al., 2021c) attempts to learn 3D pose only from noisy 2D keypoints on a single-view image, while HaMuCo (Zheng et al., 2023) extends such self-supervised learning to multi-view setups. Alternatively, pre-training methods aim to find well-initialized models with unlabeled data for downstream tasks. Prior works propose contrastive learning approaches but rely on relatively small pre-training sets (e.g., 32-47K images in (Spurr et al., 2021) and 86K images in (Ziani et al., 2022)). We collect hand images from large human-centric datasets such as Ego4D (Grauman et al., 2022) and 100DOH (Shan et al., 2020), expanding our pre-training set to 2.0M images. + +Contrastive learning: Contrastive learning has emerged as a powerful technique in self-supervised learning, bringing positive samples closer while pushing negative samples apart (Chopra et al., 2005; Schroff et al., 2015; Song et al., 2016; Sohn, 2016; He et al., 2020; Huang et al., 2023). Standard methods generate positive samples from an identical image with data augmentation (i.e., self-positives) (Grill et al., 2020; Caron et al., 2020; Chen & He, 2021; Radford et al., 2021; Caron et al., 2021), thus the positive supervision doesn't explicitly model inter-sample relationships. To address this, Zhang et al. propose a relaxed extension of self-positives, non-self-positives (Zhang et al., 2022), which share similar characteristics but originate different images, such as images capturing the same scene (Arandjelovic et al., 2016; Ge et al., 2020; Berton et al., 2022; Hausler et al., 2021), the same person ID (Chen et al., 2021a;b), and multi-view images (Jie et al., 2024). The positive supervision from non-self-positives enables considering diverse inter-sample alignment and facilitates the learning of semantics more easily. Zhang et al. identify non-self-positives by searching similar human skeletons from single-view images and adapt in action recognition (Zhang et al., 2022). Jie et al. rely on multi-view (i.e. paired) images to define non-self-positives and propose pairwise weights to adaptively leverage useful multi-view pairs (Jie et al., 2024). Our work proposes the mining of non-self-positives from 2D keypoint cues with additional pair-wise weighting to account for similarity from unpaired data in pre-training. + +# 3 METHOD + +Our approach SiMHand aims to pre-train an encoder for 3D hand pose estimation with large-scale human-centric videos in the wild. We first construct a pre-training set from egocentric and exocentric hand videos (Sec. 3.1). Then, we find similar hand images to define positive pairs across videos (Sec. 3.2). Finally, we incorporate these positive pairs into a contrastive learning framework and employ adaptive weights to improve the effectiveness in pre-training (Sec. 3.3). + +# 3.1 DATA PREPROCESSING + +Our preprocessing involves creating a set of valid hand images for pre-training, which is sampled from a set of $N$ videos: $\{v_{1}, v_{2}, \ldots, v_{N}\}$ . We use an off-the-shelf hand detector (Shan et al., 2020) to select valid frames with visible hands. Given a video frame $I_{\mathrm{full}} \in v_{i}$ , the model detects the existence of the hand and its bounding box, creating hand crops enclosing either hand identity (right/left) from $I_{\mathrm{full}}$ . To avoid bias related to hand identity, we balance the number of right and left hand crops equally and then convert all crops to right-hand images. Then, we create a set of frames for each video $v_{i}$ as $\mathcal{F}_i = \{I_{i,1}, I_{i,2}, \ldots, I_{i,T_i}\}$ , where $I_{i,j} \in \mathbb{R}^{H \times W \times 3}$ represents the processed crop with height $H$ and width $W$ , and $T_{i}$ is the total number of crops in $v_{i}$ . The height $H$ and width $W$ are defined post-resize to give the uniform image size. Using this frame set $\mathcal{F}_i$ , the video dataset can be re-represented as $\mathcal{V} = \{\mathcal{F}_1, \mathcal{F}_2, \ldots, \mathcal{F}_N\}$ . Specifically, we processed two datasets, Ego4D (Grauman et al., 2022) and 100DOH (Shan et al., 2020), to collect 1.0M images from 8K and 21K videos, respectively. More details about our preprocessing can be found in the supplement. + +![](images/05ce395b044cbef56dbf821b9d3b9d2fb72178cb462ab6b4ab49c2d6ec7c4f5a.jpg) +Figure 2: Visualization of similar hand samples in Top-K. Given the query image $(I)$ , the mined similar samples are shown ("Top-1" corresponds to $I^{+}$ in Sec. 3.2). + +# 3.2 MINING SIMILAR HANDS + +To incorporate diverse samples in contrastive learning, we design positive pairs from non-identical images with similar foreground hands. Here we construct a mining algorithm to find similar hands from $\mathcal{V}$ by focusing on pose similarity between hand images. We first extract 2D keypoints from $I$ , embed in the feature space, and search a positive sample. + +Pose embedding: We adopt estimated 2D keypoints (for 21 joints) to find similar hands. We use an off-the-shelf 2D hand pose estimator $\phi$ (Lugaresi et al., 2019), but the outputs are prone to be noisy in testing in the wild. To make it more robust, we obtain a $D$ -dimensional embedding of 2D hand keypoints, $\mathbf{p} \in \mathbb{R}^D$ , for each image $I$ . This serves to reduce the noise effect while preserving the semantics of hands. We use a concatenated 42-dimensional vector as the output of $\phi$ for later use. Particularly, we apply PCA-based dimension reduction, which projects the keypoints vector into a lower-dimensional space of size $D$ . Given the PCA projection matrix $M \in \mathbb{R}^{42 \times D}$ , the pose embedding $\mathbf{p}$ is calculated as $\mathbf{p} = M^T \phi(I)$ . + +Mining: This step is designed to identify a positive sample $I^{+} \in \mathbb{R}^{H \times W \times 3}$ paired with a query image $I$ . We denote the similarity mining logic as $I^{+} = \mathrm{SiM}(I)$ . As shown in Fig. 2, using the closest (neighbor) sample in the PCA space encounters a trivial solution $I, I^{+} \in v_{i}$ , where both images originate from the same video $v_{i}$ . Similarly to (Ziani et al., 2022), the supervision by neighbor samples of the same video has less diversity in backgrounds, hand appearances, and object interactions. Thus we are motivated to find similar hands derived from different videos. Specifically, we search the minimum distance within the set of all frames except for $v_{i}$ , written as $\mathcal{F}_i^c = \bigcup_{k \neq i} \mathcal{F}_k$ . Given an query $I_{i,j}$ , which represents the $j$ -th image of the $i$ -th video, the function $\mathrm{SiM}(\cdot)$ is formulated as + +$$ +\operatorname {S i M} \left(I _ {i, j}\right) = \arg \min _ {x \in \mathcal {F} _ {i} ^ {c}} D \left(M ^ {T} \phi (x), M ^ {T} \phi \left(I _ {i, j}\right)\right), \tag {1} +$$ + +where $D(\cdot ,\cdot)$ is the Euclidean distance metric. + +As a proof of concept, we illustrate examples after our mining $\mathrm{SiM}(\cdot)$ in Fig. 2. We denote "Top-1" (most similar) as our assigned positive sample $I^{+}$ to the query image $I$ . As references, the rest of the figures ("Top-K") represent the $K$ -th similar samples. Our sampling highlights the diversity in captured environments and interactions, while it also suggests that as the rank (distance) increases, the sampled images become dissimilar. Additional visualization results of similar hands can be found in supplement. + +# 3.3 CONTRASTIVE LEARNING FROM SIMILAR HANDS WITH ADAPTIVE WEIGHTING + +We detail our contrastive learning approach (see Fig. 3), learning from mined similar hands with adaptive weighting. + +Overview: The contrastive learning is designed to align positive samples $(I, I^{+})$ in the feature space, constructed in Sec. 3.2, and the rest of negative samples are pushed apart. Following (Chen et al., 2020; Spurr et al., 2021), we treat all mini-batch samples other than the corresponding positive samples as negative samples $I^{-}$ . Feature extraction is performed by two learnable compo + +![](images/ae5fe70fafb4881c8403c691f20642d1808b346d68996c783a6d296099b8d67d.jpg) +Figure 3: Overview of our SiMHand. Starting from the left, hand images $(I, I^{+}, I^{-})$ and their corresponding 2D keypoints are input to the model. After applying random augmentations through transformation $\mathbf{T}$ , both the images and 2D keypoints are spatially transformed. The altered 2D keypoints are then used to compute adaptive weights $w_{\mathrm{pos}}$ and $w_{\mathrm{neg}}$ , which guide contrastive learning by strengthening or weakening the alignment between positive and negative samples. + +nents: an encoder $E(\cdot)$ and a projection head $g(\cdot)$ , which indicates the entire model as $f = g \circ E$ . The extraction is combined with image augmentation $\mathbf{T}$ , which formulated as $\mathbf{z} = f(\mathbf{T}(I))$ and $\mathbf{z}^{+} = f(\mathbf{T}(I^{+}))$ . Applying geometric transformations (e.g., rotation) in $\mathbf{T}$ can cause misalignment between the image and feature spaces; we correct such an error with the inverse transformation $\mathbf{T}^{-1}$ as (Spurr et al., 2021). After applying the inverse transformation to the feature $\mathbf{z}$ , we obtain a feature $\tilde{\mathbf{z}} = \mathbf{T}^{-1}(\mathbf{z})$ , where geometry is aligned to the original images. As such, all anchor, positive, and negative samples are encoded as $\tilde{\mathbf{z}}, \tilde{\mathbf{z}}^{+}$ , and $\tilde{\mathbf{z}}^{-}$ , respectively. + +Adaptive weighting: During learning from our similar hands, we propose an adaptive weighting per pair to focus more on informative samples that provide greater discriminative information. The assigned weights are computed by the predefined similarity metric in Sec. 3.2. Given pre-processed keypoints for two samples within the mini-batch, $\mathbf{k}_1$ , $\mathbf{k}_2$ , the weight $w$ is computed by linear scaling with the Euclidean metric $D(\cdot, \cdot)$ as + +$$ +w = \frac {d _ {\max } - D \left(\mathbf {k} _ {1} , \mathbf {k} _ {2}\right)}{d _ {\max } - d _ {\min }}, \tag {2} +$$ + +where $d_{\mathrm{min}}$ , $d_{\mathrm{max}}$ are the minimum and maximum distances within the mini-batch. This assigned weight $w$ dynamically changes according to the sample statistics in the mini-batch, enabling adaptive attention per iteration. + +To address the distinction between positive and negative sample weighting, we introduce separate weighting terms for positive and negative pairs. Specifically, $w_{\mathrm{pos}}$ corresponds to the weight assigned to positive pairs, while $w_{\mathrm{neg}}$ is used for positive-negative pairs. + +Contrastive loss with weighting: We finally formulate contrastive learning with the proposed weighting scheme. We assume that a mini-batch contains 2N samples in total, including N query samples and their corresponding N positive samples. We introduce separate weighting terms for positives $(I,I^{+})$ and negatives $(I,I^{-})$ as $w_{\mathrm{pos}}$ and $w_{\mathrm{neg}}$ , respectively. With these weights, our constrastive learning loss based on the NT-Xent loss (Chen et al., 2020) is formulated as: + +$$ +\mathcal {L} _ {i} = - \log \frac {\exp \left(w _ {p o s} \cdot \operatorname {s i m} \left(\tilde {\mathbf {z}} _ {i} , \tilde {\mathbf {z}} _ {i} ^ {+}\right) / \tau\right)}{\sum_ {k = 1} ^ {2 N} \mathbb {1} _ {[ k \neq i ]} \exp \left(w _ {n e g} \cdot \operatorname {s i m} \left(\tilde {\mathbf {z}} _ {i} , \tilde {\mathbf {z}} _ {k} ^ {-}\right) / \tau\right)} \tag {3} +$$ + +Here $\tau$ is a temperature parameter, $\mathrm{sim}(\mathbf{z},\bar{\mathbf{z}}) = \frac{\mathbf{z}^T\bar{\mathbf{z}}}{\|\mathbf{z}\|\|\bar{\mathbf{z}}\|}$ is the cosine similarity function. Overall, our adaptive weighting enables considering the importance separately for positive and negative samples, while closer samples are assigned with higher weights and more distant ones receive lower weights. + +# 4 EXPERIMENTS + +In this section, we compare our method with existing baselines for pre-training of the 3D hand pose estimation and conduct ablation experiments to support the validity of our approach. We begin by providing a detailed explanation of the dataset and experimental setup (Sec. 4.1). Next, we demonstrate that our model achieves competitive performance compared with existing methods (Sec. 4.2). Following this, we present the results of ablation studies on weighting design in the pre-training phase (Sec. 4.3). Finally, visualizations are used to illustrate the superiority and efficiency of our approach (Sec. 4.4). + +# 4.1 EXPERIMENTAL SETUP + +Pre-training datasets: We curate a large collection of hand images from two major video datasets, Ego4D (Grauman et al., 2022) and 100DOH (Shan et al., 2020), featuring egocentric and exocentric views respectively. From Ego4D, a vast egocentric video dataset with 3,670 hours of footage, we extracted 1.0M hand images from 8K videos. Similarly, from the exocentric dataset 100DOH, which includes 131 days of YouTube footage, we extract 1.0M hand images from 20K videos. These extensive datasets provide diverse hand-object interactions across different views. We also prepare pre-training data with varying amount. "Exo-X" and "Ego-X" denote 100DOH and Ego4D datasets with X images selected randomly (e.g., $\mathrm{X} = 50\mathrm{K}$ , 100K, ..., 1M, 2M). "Ego&Exo-2M" shows our final set combining both datasets with full images (i.e., 1.0M for each). + +Fine-tuning datasets: We conduct fine-tuning experiments on three datasets with 3D hand pose ground truth in various data size and viewpoints: exocentric datasets from FreiHand (Zimmermann et al., 2019) and DexYCB (Chao et al., 2021), and an egocentric dataset AssemblyHands (Ohkawa et al., 2023b). FreiHand consists of $130.2\mathrm{K}$ training frames and $3.9\mathrm{K}$ test frames, with both green screen and real-world backgrounds. DexYCB contains $325.3\mathrm{K}$ training images and $98.2\mathrm{K}$ test images, focusing on natural hand-object interactions. AssemblyHands, the largest of the three, includes $704.0\mathrm{K}$ training samples and $109.8\mathrm{K}$ test samples, collected in object assembly scenarios. Following (Spurr et al., 2021), we prepare $10\%$ of the labeled FreiHand dataset, which is denoted as "FreiHand*", especially used for ablation studies. This allows us to assess the performance in a limited supervision setting. + +Implementation details: For similar hands mining, we choose the PCA embedding size as $D = 14$ . For the pre-training framework, we use ResNet-50 (He et al., 2016) as the encoder. Throughout the pre-training phase, all models are trained using LARS (You et al., 2017) with ADAM (Kingma & Ba, 2014) optimizer, with the learning rate of 3.2e-3. Following (Spurr et al., 2021), SimCLR employs scale and color jitter as image augmentation, while PeCLR and SiMHand utilize scale, rotation, translation, and color jitter. We use resized images with $128 \times 128$ as the input. We set the temperature parameter $\tau$ of contrastive learning as 0.5. We use 8 NVIDIA V100 GPUs with a batch size of 8192 for pre-training. + +For fine-tuning, we initialize our model with the pre-trained encoder $E(\cdot)$ and then fine-tune with a 3D pose regressor on the labeled datasets. The 3D regressor involves 2D heatmap regression and 3D localization heads, similar to DetNet (Zhou et al., 2020). We use a single NVIDIA V100 GPU with a batch size of 128. We provide more additional details in supplement. + +Evaluation: We use the following evaluation metrics: the mean per joint position error (MPJPE) in millimeters, which compares model predictions against ground-truth data, and the percentage of correct keypoints based on the area under the curve (PCK-AUC), which measures the proportion of predicted keypoints that fall within a specified distance (20mm to 50mm) from the ground truth with varying thresholds. + +Table 1: Comparison with the state of the art. We show 3D hand pose estimation accuracy (MPJPE↓) on the FreiHand (Exo) (Zimmermann et al., 2019), DexYCB (Exo) (Chao et al., 2021) and AssemblyHands (Ego) (Ohkawa et al., 2023b). The best results are highlighted in bold, and the second-best results are underlined. SiMHand achieves the best results across various datasets. + +
MethodPre-trainingFreiHand (Exo)DexYCB (Exo)AssemblyHands (Ego)
MPJPE ↓PCK-AUC ↑MPJPE ↓PCK-AUC ↑MPJPE ↓PCK-AUC ↑
w/o pre-training-19.2185.6119.3684.8019.1785.61
SimCLRExo-1M19.3085.3620.1383.7520.0184.21
Ego-1M19.3685.0920.2283.5020.3283.85
Ego&Exo-2M20.0784.3221.0982.2521.2482.29
PeCLRExo-1M19.5884.7118.3986.3319.1285.64
Ego-1M19.0785.6218.9985.4019.2085.57
Ego&Exo-2M18.1986.7618.0686.8218.8886.03
SiMHand(Ours)Exo-1M16.7388.6617.3487.8418.5086.56
Ego-1M16.1589.4816.9988.3418.2686.95
Ego&Exo-2M15.7990.0416.7188.8618.2386.90
+ +
MethodPre-training sizeFreiHand*
MPJPE ↓PCK-AUC ↑
w/o pre-training-48.1949.17
SimCLR53.9442.54
PeCLREgo-50K47.4249.85
SiMHand35.3263.35
SimCLR53.4943.12
PeCLREgo-100K46.0051.50
SiMHand31.0668.66
SimCLR49.9147.61
PeCLREgo-500K43.1854.15
SiMHand28.2772.97
SimCLR46.1750.62
PeCLREgo-1M34.4264.93
SiMHand23.6879.62
+ +Table 2: Comparison with different pre-training data sizes. *' indicates that we use a small amount of training data for fine-tuning to validate the effectiveness of the pre-trained model. Our method demonstrates a leading advantage across all pre-training data scales. + +![](images/4e149a9e4cc79f14a657a2c8725051bd792aee4e62c3093fcd0618652e0ea057.jpg) +Figure 4: Comparison with different data availability in fine-tuning on Frei-Hand. Variations in the percentage of labeled data correspond to different subsets of the fine-tuning dataset, following the experimental design in (Spurr et al., 2021). + +# 4.2 MAIN RESULTS + +We compare our method with previous works for 3D hand pose estimation (Tab. 1). To make a fair comparison, we evaluate all pre-training datasets of the same size against previous methods. + +Comparison to contrastive learning methods: We compare our pre-training method with previous methods (Chen et al., 2020; Spurr et al., 2021) in 3D hand pose estimation (Tab. 1). We observe that our method significantly outperforms SimCLR and PeCLR across various datasets under the equal pre-training data setups. When we compare our method against a randomly initialized model (w/o pre-training), SiMHand improves performance by $17.7\%$ over the scratch baseline. + +In more details, our approach achieves a $15.31\%$ improvement over previous methods PeCLR with Ego-1M pre-training on the FreiHand. We observe that SimCLR shows limited performance compared to the random initialization. This suggests pre-training without geometric prior (i.e., without geometric augmentation) does not always help hand pose estimation, requiring spatial keypoint regression. In contrast, our method demonstrates significant performance gain on larger datasets, with a $10.53\%$ gain on DexYCB and a $4.90\%$ improvement on AssemblyHands compared to PeCLR. + +Table 3: Ablation study of proposed modules. We compare with and without our proposed modules in different methods. The experimental results demonstrate the generality of our method. + +
Method +(Pre-training size)ProposalsFreiHand*
Similar handsAdaptive weightingMPJPE ↓PCK-AUC ↑
SimCLR××53.4943.12
(Ego-100K)×✓52.58 (1.8% ↓)44.70 (1.58% ↑)
PeCLR××46.0051.50
(Ego-100K)×✓44.61 (3.0% ↓)53.37 (1.87% ↑)
SiMHand✓×31.0668.66
(Ego-100K)✓✓28.84 (7.18% ↓)71.07 (2.41% ↑)
+ +These results confirm that our model consistently achieves superior performance across various fine-tuning datasets. + +Furthermore, we pre-train all methods on the joint pre-training datasets (Ego&Exo-2M). Our approach further improves over the state-of-the-art method (PeCLR), achieving improvements of $13.19\%$ , $7.4\%$ , and $3.4\%$ on the FreiHand, DexYCB, and AssemblyHands, respectively. Compared to the pre-training with 1M samples (Ego-1M), doubling the pretraining data with Ego&Exo-2M results in a $2.28\%$ improvement on the FreiHand dataset. Notably, our method shows particular strength in effectively handling larger, more varied datasets. This robust performance demonstrates that our approach is highly effective and reliable for hand pose pre-training. + +Ego & Exo view analysis: We evaluate how pre-training with egocentric views (Ego4D) and exocentric views (100DOH) affects the performance in datasets with their corresponding views, namely AssemblyHands for egocentric and FreiHand and DexYCB for exocentric views. Interestingly, matching pre-training viewpoints does not consistently enhance performance, indicating that the view gaps have limited effects. Instead, factors like dataset diversity and the characteristics of pretraining methods are more crucial in boosting performance. Combining the two datasets (the last row of Tab. 1) leads to the best performance in all three datasets, underscoring the potential of enriching data diversity with various camera views. + +# 4.3 ABLATION EXPERIMENTS + +This section presents ablation studies on SiMHand, focusing on four aspects: 1) pre-training dataset size, 2) fine-tuning dataset size, 3) adaptive weighting, and 4) Top-K similar hands. First, we examine the size of the pre-training dataset using various methods, showing that our approach maintains superior performance across different sizes (Tab. 2). Second, inspired by (Zimmermann et al., 2019), we explore fine-tuning dataset size, demonstrating significant gains even with limited data (Fig. 4). Furthermore, we also highlight the adaptive weighting design, which consistently outperforms comparison methods (Tab. 3). Finally, we conduct ablation analysis according to different levels of similarity in the assigned positive hand pairs. (Tab. 4). + +Effect of pre-training data size: We study results with different sizes of pre-training data, namely 50K, 100K, 500K, and 1M in Tab. 2. The results demonstrate that SiMHand reliably outperforms the other methods across all settings, with improvement as the pre-training data size increases. With changes in the size of the pre-training data from 50K to 1M, SiMHand achieves a reduction in MPJPE from 35.32 to 23.68. The useful insights we can gather from this table include: 1) The SiMHand method holds a leading advantage across various pre-training size. 2) As the size of the pre-training dataset increases, the improvement for fine-tuning with limited labels is substantial. + +Effect of fine-tuning data size: Fig. 4 illustrates the experiment under different proportions of labeled fine-tuning data, namely $10\%$ , $20\%$ , $40\%$ , and $80\%$ in FreiHand. Note that we denote methods with “-1M/2M” as those pre-trained on the Ego-1M and the Ego&Exo-2M sets, respectively. The results show that SiMHand-1M brings error reduction, achieving remarkably lower MPJPE scores with merely $10\%$ of labeled data. SiMHand-1M delivers the best performance over different size of fine-tuning data, compared to SimCLR-1M and PeCLR-1M. SiMHand-2M further shows improvement over SiMHand-1M, while the gains become marginal as labeled data increase. From + +Table 4: Pre-training performance at different similarity ranks (Top-K). It can be seen that as the similarity rank increases, the pre-training performance deteriorates. + +
Method +(Pre-training size)Top-KFreiHand*
MPJPE ↓PCK-AUC ↑
SiMHand +(Ego-100K)Top-131.0668.66
Top-231.4667.89
Top-531.8567.20
Top-1031.8767.18
Top-5031.5367.59
Top-10031.5467.70
Top-50032.6166.76
Top-100034.0565.14
Top-500035.3462.79
+ +this analysis, we can draw two key conclusions: 1) The improvement resulting from an increase of pre-training data becomes less significant as the amount of fine-tuning data increases; 2) SiM-Hand maintains a strong advantage in scenarios with limited labeled data, particularly when larger pre-training data are used. + +Effect of adaptive weighting: We validate the proposed adaptive weighting and its generality when applied to the other methods in Tab. 3. On the Ego-100K pre-training set, the MPJPE scores after adaptive weighting decrease by $1.8\%$ and $3.0\%$ for SimCLR and PeCLR, respectively, while PCK-AUC increases by $1.58\%$ and $1.87\%$ . This indicates that the proposed weighting excels in its applicability to various pre-training methods. In our SiMHand method, applying adaptive weighting reduces MPJPE from 31.06 to 28.84, a $7.18\%$ decrease, while PCK-AUC improves from 68.66 to 71.07, a $2.41\%$ increase. We find the effectiveness of the proposed weighting when combined with the mined similar hands. + +Learning from Top-K similar hands: We test pre-training with different similarity levels of positive samples in Tab. 4. As illustrated in Fig. 2, we can sample similar pairs according to the distance ranking (e.g., $\mathrm{K} = 1, 2, \ldots, 5000$ ), where Top-1 is used to produce our final results. The performance trend is initially subtle and somewhat fluctuating (Top-1~100) but becomes increasingly pronounced after Top-100. This indicates that as the similarity between positive samples increases, the global trend decreases accordingly. Notably, using Top-5000 similar hand samples as positive samples decreases the MPJPE by $13.78\%$ compared to Top-1. This study provides two insights: 1) Similar samples with subtle noisiness (e.g., $1 \sim 100$ ) exhibit minimal variation in performance, indicating that slight differences in similarity within this range do not significantly impact the pre-training outcome. This suggests that the model is robust to minor variations when the positive samples are highly similar. 2) The results support the validity of using Top-1 positive samples to produce final results, as they consistently exhibit the best performance. This highlights the importance of selecting the most similar samples in contrastive learning. + +# 4.4 VISUALIZATION + +In this section, we compare the fine-tuning results of various pre-training methods through detailed visualizations on different datasets (Fig. 5). The pre-training model is trained on the Ego&Exo-2M dataset and fine-tuned on the FreiHands (Zimmermann et al., 2019) and DexYCB (Chao et al., 2021) datasets, respectively. We provide additional visualization in the supplementary material. + +From the left four columns of Fig. 5, the visualization results show that SiMHand performs better in pose estimation, with results closer to the ground truth, compared to the other methods in FreiHands (Zimmermann et al., 2019) dataset. In particular, SiMHand outperforms the other methods in challenging environments, such as those with varying lighting conditions, by better capturing hand poses. These visual outputs highlight its robustness across various scenarios, solidifying its potential for real-world applications. + +As shown in the right four columns of Fig. 5, we highlight the occluded regions in the original images of DexYCB (Chao et al., 2021) dataset using red circles. The results show that SiMHand is more effective in tackling occlusion problems. Our pre-training method effectively addresses partially + +![](images/bd9ebd4e30299b3e1b5c1f529909f8c6f5faab9c9e65f7ef3fe754c36c142790.jpg) +Figure 5: Visualization of FreiHand (Zimmermann et al., 2019) and DexYCB (Chao et al., 2021). The first four columns on the left display the results for FreiHand, while the last four columns on the right show the results for DexYCB (GT: Ground Truth; PT: Pre-training). It can be observed that SiMHand pre-training method achieves better results. + +occluded images by utilizing similar, though not identical, hand images, where the occluded parts in the query image may be visible in the corresponding similar hand image, and vice versa. + +# 5 CONCLUSION + +We introduce SiMHand, a contrastive learning framework for pre-training 3D hand pose estimators by mining similar hand pairs from large-scale in-the-wild images. Our approach leverages similar hand pairs from diverse videos, significantly enhancing the information gained during pre-training compared with existing methods. Experiments show that our pre-training method achieves competitive performance in 3D hand pose estimation across multiple datasets, outperforming previous pre-training approaches and demonstrating the benefits of large-scale pre-training with in-the-wild images. We hope this work can lay a foundation for future research on pre-training of 3D hand pose estimation. + +# ACKNOWLEDGMENTS + +This work was supported by the JST ACT-X Grant Number JPMJAX2007, JST ASPIRE Grant Number JPMJAP2303, JSPS KAKENHI Grant Number JP24K02956, JP22KF0119, and NSFC Grant Number 62376090. + +# REFERENCES + +R. Arandjelovic, P. Gronat, A. Torii, T. Pajdla, and J. Sivic. Netvlad: CNN architecture for weakly supervised place recognition. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 5297-5307, 2016. +G. Berton, C. Masone, and B. Caputo. Rethinking visual geo-localization for large-scale applications. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 4878-4888, 2022. +Y. Cai, L. Ge, J. Cai, and J. Yuan. Weakly-supervised 3D hand pose estimation from monocular RGB images. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 678-694, 2018. +M. Caron, I. Misra, J. Mairal, P. Goyal, P. Bojanowski, and A. Joulin. Unsupervised learning of visual features by contrasting cluster assignments. In Proceedings of the Advances in Neural Information Processing Systems (NeurIPS), pp. 9912-9924, 2020. +M. Caron, H. Touvron, I. Misra, H. Jégou, J. Mairal, P. Bojanowski, and A. Joulin. Emerging properties in self-supervised vision transformers. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), pp. 9650-9660, 2021. +Y.-W. Chao, W. Yang, Y. Xiang, P. Molchanov, A. Handa, J. Tremblay, Y. S. Narang, K. Van Wyk, U. Iqbal, S. Birchfield, J. Kautz, and D. Fox. DexYCB: A benchmark for capturing hand grasping of objects. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 9044-9053, 2021. +H. Chen, B. Lagadec, and F. Bremond. Ice: Inter-instance contrastive encoding for unsupervised person re-identification. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), pp. 14960-14969, 2021a. +H. Chen, Y. Wang, B. Lagadec, A. Dantcheva, and F. Bremond. Joint generative and contrastive learning for unsupervised person re-identification. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 2004–2013, 2021b. +T. Chen, S. Kornblith, M. Norouzi, and G. E. Hinton. A simple framework for contrastive learning of visual representations. In Proceedings of the International Conference on Machine Learning (ICML), volume 119, pp. 1597-1607, 2020. +X. Chen and K. He. Exploring simple siamese representation learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 15750-15758, 2021. +Y. Chen, Z. Tu, D. Kang, L. Bao, Y. Zhang, X. Zhe, R. Chen, and J. Yuan. Model-based 3d hand reconstruction via self-supervised learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 10451-10460, 2021c. +S. Chopra, R. Hadsell, and Y. LeCun. Learning a similarity metric discriminatively, with application to face verification. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 539-546, 2005. +Z. Fan, T. Ohkawa, L. Yang, N. Lin, Z. Zhou, S. Zhou, J. Liang, Z. Gao, X. Zhang, X. Zhang, F. Li, L. Zheng, F. Lu, K. A. Zeid, B. Leibe, J. On, S. Baek, A. Prakash, S. Gupta, K. He, Y. Sato, O. Hilliges, H. J. Chang, and A. Yao. Benchmarks and challenges in pose estimation for egocentric hand interactions with objects. In Proceedings of the European Conference on Computer Vision (ECCV), 2024. +L. Ge, Z. Ren, Y. Li, Z. Xue, Y. Wang, J. Cai, and J. Yuan. 3D hand shape and pose estimation from a single RGB image. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 10833-10842, 2019. +Y. Ge, H. Wang, F. Zhu, R. Zhao, and H. Li. Self-supervising fine-grained region similarities for large-scale image localization. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 369-386, 2020. +K. Grauman, A. Westbury, E. Byrne, Z. Chavis, A. Furnari, R. Girdhar, J. Hamburger, H. Jiang, M. Liu, X. Liu, M. Martin, T. Nagarajan, I. Radosavovic, S. K. Ramakrishnan, F. Ryan, J. Sharma, M. Wray, M.g Xu, E. Zhongcong Xu, C. Zhao, S. Bansal, D. Batra, V. Cartillier, S. Crane, T. Do, M. Doulaty, A. Erapalli, C. Feichtenhofer, A. Fragomeni, Q. Fu, C. Fuegen, A. Gebreselasie, C. Gonzalez, J. Hillis, X. Huang, Y. Huang, W. Jia, W. Khoo, J. Kolar, S. Kottur, A. Kumar, F. Landini, C. Li, Y. Li, Z. Li, K. Mangalam, R. Modhugu, J. Munro, T. Murrell, T. Nishiyasu, W. Price, P. R. Puentes, M. Ramazanova, L. Sari, K. Somasundaram, A. Southerland, Y. Sugano, R. Tao, M. Vo, Y. Wang, X. Wu, T. Yagi, Y. Zhu, P. Arbelaez + +D. Crandall, D. Damen, G. M. Farinella, B. Ghanem, V. K. Ithapu, C. V. Jawahar, H. Joo, K. Kitani, H. Li, R. Newcombe, A. Oliva, H. Soo Park, J. M. Rehg, Y. Sato, J. Shi, M. Z. Shou, A. Torralba, Lo Torresani, M.i Yan, and J. Malik. Ego4D: Around the world in 3,000 hours of egocentric video. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 18973-18990, 2022. +J. Grill, F. Strub, F. Alché, C. Tallec, P. Richemond, E. Buchatskaya, C. Doersch, B. Avila Pires, Z. Guo, M. Gheshlaghi Azar, B. Piot, K. Kavukcuoglu, R. Munos, and M. Valko. Bootstrap your own latent: A new approach to self-supervised learning. In Proceedings of the Advances in Neural Information Processing Systems (NeurIPS), pp. 21271-21284, 2020. +S. Han, P.-C. Wu, Y. Zhang, B. Liu, L. Zhang, Z. Wang, W. Si, P. Zhang, Y. Cai, T. Hodan, R. Cabezas, L. Tran, M. Akbay, T.-H. Yu, C. Keskin, and R. Wang. UmeTrack: Unified multi-view end-to-end hand tracking for VR. In In Proceedings of the ACM SIGGRAPH Asia Conference, pp. 50:1-50:9, 2022. +S. Hausler, S. Garg, M. Xu, M. Milford, and T. Fischer. Patch-netvlad: Multi-scale fusion of locally-global descriptors for place recognition. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 14141-14152, 2021. +K. He, X. Zhang, S. Ren, and J. Sun. Deep residual learning for image recognition. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 770-778, 2016. +K. He, H. Fan, Y. Wu, S. Xie, and R. Girshick. Momentum contrast for unsupervised visual representation learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 9729-9738, 2020. +Y. Huang, L. Yang, and Y. Sato. Weakly supervised temporal sentence grounding with uncertainty-guided self-training. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 18908-18918, 2023. +X. Jie, S. Chen, Y. Ren, X. Shi, H. Shen, G. Niu, and X. Zhu. Self-weighted contrastive learning among multiple views for mitigating representation degeneration. In Proceedings of the Advances in Neural Information Processing Systems (NeurIPS), pp. 1119-1131, 2024. +D. P. Kingma and J. Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014. +R. Liu, T. Ohkawa, M. Zhang, and Y. Sato. Single-to-dual-view adaptation for egocentric 3d hand pose estimation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 677-686, 2024. +S. Liu, H. Jiang, J. Xu, S. Liu, and X. Wang. Semi-supervised 3D hand-object poses estimation with interactions in time. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 14687-14697, 2021. +C. Lugaresi, J. Tang, H. Nash, C. McClanahan, E. Uboweja, M. Hays, and F. Zhang et al. Mediapipe: A framework for building perception pipelines. arXiv preprint arXiv:1906.08172, 2019. +G. Moon, S.-I. Yu, H. Wen, T. Shiratori, and K. M. Lee. InterHand2.6M: A dataset and baseline for 3D interacting hand pose estimation from a single RGB image. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 548-564, 2020. +T. Ohkawa, Y.-J. Li, Q. Fu, R. Furuta, K. M. Kitani, and Y. Sato. Domain adaptive hand keypoint and pixel localization in the wild. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 68-87, 2022. +T. Ohkawa, R. Furuta, and Y. Sato. Efficient annotation and learning for 3D hand pose estimation: A survey. International Journal on Computer Vision (IJCV), 131:3193-3206, 2023a. +T. Ohkawa, K. He, F. Sener, T. Hodan, L. Tran, and C. Keskin. AssemblyHands: Towards egocentric activity understanding via 3D hand pose estimation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 12999-13008, 2023b. +J. Park, Y. Oh, G. Moon, H. Choi, and K. M. Lee. Handoccnet: Occlusion-robust 3d hand mesh estimation network. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 1486–1495, 2022. +Y. Qin, Y.-H. Wu, S. Liu, H. Jiang, R. Yang, Y. Fu, and X. Wang. DexMV: Imitation learning for dexterous manipulation from human videos. In Proceedings of the European Conference on Computer Vision (ECCV), volume 13699, pp. 570-587, 2022. + +A. Radford, J. Kim, C. Hallacy, A. Ramesh, G. Goh, S. Agarwal, G. Sastry, A. Askell, P. Mishkin, J. Clark, and G. Krueger. Learning transferable visual models from natural language supervision. In Proceedings of the International Conference on Machine Learning (ICML), pp. 8748-8763, 2021. +F. Schroff, D. Kalenichenko, and J. Philbin. Facenet: A unified embedding for face recognition and clustering. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 815-823, 2015. +F. Sener, D. Chatterjee, D. Shelepov, K. He, D. Singhania, R. Wang, and A. Yao. Assembly101: A large-scale multi-view video dataset for understanding procedural activities. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 21096-21106, 2022. +D. Shan, J. Geng, M. Shu, and D. Fouhey. Understanding human hands in contact at internet scale. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 9866-9875, 2020. +K. Sohn. Improved deep metric learning with multi-class n-pair loss objective. In Proceedings of the Advances in Neural Information Processing Systems (NeurIPS), pp. 1857-1865, 2016. +H. Song, Y. Xiang, S. Jegelka, and S. Savarese. Deep metric learning via lifted structured feature embedding. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 4004-4012, 2016. +A. Spurr, U. Iqbal, P. Molchanov, O. Hilliges, and J. Kautz. Weakly supervised 3D hand pose estimation via biomechanical constraints. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 211-228, 2020. +A. Spurr, A. Dahiya, X. Wang, X. Zhang, and O. Hilliges. Self-supervised 3d hand pose estimation from monocular rgb via contrastive learning. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), pp. 11230-11239, 2021. +K. Tango, T. Ohkawa, R. Furuta, and Y. Sato. Background mixup data augmentation for hand and object-in-contact detection. In Proceedings of the European Conference on Computer Vision Workshops (ECCVW), 2022. +T. Tse, K. Kim, A. Leonardis, and H. Chang. Collaborative learning for hand and object reconstruction with attention-guided graph convolution. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 1664-1674, 2022. +Y. Wen, H. Pan, T. Ohkawa, L. Yang, J. Pan, Y. Sato, T. Komura, and W. Wang. Generative hierarchical temporal transformer for hand action recognition and motion prediction. arXiv preprint arXiv:2311.17366, 2023. +M.-Y. Wu, P.-W. Ting, Y.-H. Tang, E. T. Chou, and L.-C. Fu. Hand pose estimation in object-interaction based on deep learning for virtual reality applications. Journal of Visual Communication and Image Representation, 70:102802, 04 2020. +F. Xiong, B. Zhang, Y. Xiao, Z. Cao, T. Yu, J. T. Zhou, and J. Yuan. A2J: anchor-to-joint regression network for 3D articulated pose estimation from a single depth image. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), pp. 793-802, 2019. +L. Yang, S. Chen, and A. Yao. Semihand: Semi-supervised hand pose estimation with consistency. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), pp. 11364-11373, 2021. +Y. You, I. Gitman, and B. Ginsburg. Large batch training of convolutional networks. arXiv preprint arXiv:1708.03888, 2017. +H. Zhang, Y. Hou, W. Zhang, and W. Li. Contrastive positive mining for unsupervised 3d action representation learning. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 36-51, 2022. +X. Zheng, C. Wen, Z. Xue, P. Ren, and J. Wang. Hamuco: Hand pose estimation via multiview collaborative self-supervised learning. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), pp. 20763-20773, 2023. +Y. Zhou, M. Habermann, W. Xu, I. Habibie, C. Theobalt, and F. Xu. Monocular real-time hand shape and motion capture using multi-modal data. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 5346-5355, 2020. + +A. Ziani, Z. Fan, M. Kocabas, S. J. Christen, and O. Hilliges. TempCLR: Reconstructing hands via time-coherent contrastive learning. In Proceedings of the International Conference on 3D Vision (3DV), pp. 627-636, 2022. +C. Zimmermann, D. Ceylan, J. Yang, B. Russell, M. J. Argus, and T. Brox. FreiHAND: A dataset for markerless capture of hand pose and shape from single RGB images. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), pp. 813-822, 2019. + +![](images/8338ed2d65b0dcd77415dff6a03bca4f9b1ed8431e6eb0fe406f15e4631a1212.jpg) +Figure 6: Overview of data preprocessing and similar hands mining. This image illustrates a three-step process for SiMHand pre-training using datasets from Ego4D and 100DOH. Step 1 involves preprocessing the datasets to extract relevant frames. Step 2 employs a hand detector to crop hand regions from these frames, creating a diverse pool of hand images in the wild. Step 3 calculates similarity and ranks the images using a pose estimator and PCA, producing a sorted list of hand poses, from the most similar to the least similar to a given anchor pose. + +# 6 APPENDIX + +# 6.1 CONSTRUCTION OF LARGE-SCALE IN-THE-WILD HAND DATABASE + +This section presents our method for constructing a large-scale hand image dataset by extracting and processing hand images from various video datasets. We outline key preprocessing steps, including 1) preprocessing, 2) hand region detection, and 3) similarity calculation & ranking. + +Preprocessing: We prepare two large-scale video datasets: Ego4D, containing 8k frames, and 100DOH, with 23k frames, both sampled at 1 fps. As shown in Fig. 6, first-person and third-person hand images exhibit significant differences. + +Hand region detection: After extracting frames from Ego4D and 100DOH, we use a lightweight, fixed-weight network to detect hand regions via bounding boxes. Specifically, we adopt the method from (Shan et al., 2020) and store all detected bounding boxes in sequence. This step constructs a large-scale hand image dataset as Tango et al. (2022). + +Similarity calculation & ranking: Once the hand image dataset is built, we use a lightweight, fixed-weight network to extract raw keypoints for each sample via MediaPipe (Lugaresi et al., 2019). To reduce noise, we apply PCA as described in Sec. 3.1. We then compute similarity scores for a given query image $I$ using Eq. 1 and rank the remaining samples accordingly. This process yields a large-scale set of in-the-wild hand images with similar characteristics. For instance, in Ego4D, given a query sample $I$ , we retrieve all similar hand images and construct a ranked sequence, referred to as "Top-K". The Top-1 image in this sequence serves as the positive sample $I^{+}$ for contrastive learning, enhancing the effectiveness of SiMHand pre-training. As shown in Tab. 4, our experiments validate that selecting Top-1 as the positive sample $I^{+}$ is the optimal strategy. + +# 6.2 FINETUNE FOR 3D HAND POSE ESTIMATION + +In the fine-tuning stage, we discard the projection head and fine-tuning only the encoders. We load the pre-training model weights into a heatmap-based 3D hand pose estimation and predition method: DetNet(Zhou et al., 2020). To train DetNet, we utilize a comprehensive loss function designed to optimize both 2D pose estimation and 3D spatial localization. The loss function is defined as: + +$$ +\mathcal {L} _ {\text {h e a t}} + \mathcal {L} _ {\text {l o c}} + \mathcal {L} _ {\text {d e l t a}} + \mathcal {L} _ {\text {r e g}} \tag {4} +$$ + +where $\mathcal{L}_{\mathrm{heat}}$ ensures that the predicted heatmaps $H$ align closely with the ground truth heatmaps $H^{\mathrm{GT}}$ , $\mathcal{L}_{\mathrm{loc}}$ and $\mathcal{L}_{\mathrm{delta}}$ measure the discrepancies between the predicted location maps $L$ and delta maps $D$ and their corresponding ground truth $L^{\mathrm{GT}}$ and $D^{\mathrm{GT}}$ , with $H^{\mathrm{GT}}$ weighting these discrepancies to focus on the maxima of the heatmaps. Additionally, $\mathcal{L}_{\mathrm{reg}}$ is an $L2$ regularization term to + +
MethodPre-training sizeFreiHand*
MPJPE ↓PCK-AUC ↑
PeCLR47.4249.85
TempCLREgo-50K45.1752.40
SiMHand35.3263.35
PeCLR46.0051.50
TempCLREgo-100K44.5453.28
SiMHand31.0668.66
+ +Table 5: Comparison with the TempCLR method.\* indicates that we use a small amount of training data for fine-tuning to validate the effectiveness of the pre-trained model. TempCLR outperforms PeCLR by a modest margin, whereas SiMHand achieves a significant performance improvement over TempCLR. + +prevent overfitting. Note that after passing through the encoder, we made simple adjustments to the model, applying some upsampling to the features to fit the input. + +This multi-task learning framework enables the network to simultaneously learn pose features from 2D images and spatial information from 3D data, enhancing the accuracy and robustness of detection in real-world applications. For more details on fine-tuning, please refer to the (Zhou et al., 2020). + +# 6.3 COMPARISON WITH TEMPCLR METHOD + +We conduct an experimental comparison with the TempCLR (Ziani et al., 2022) method. TempCLR proposes a pre-training framework for 3D hand reconstruction using time-coherent contrastive learning and demonstrates better performance compared to PeCLR (Spurr et al., 2021). Although TempCLR primarily focuses on reconstruction tasks, the parametric model it uses can also output 3D pose results, making it valuable to further compare our method with TempCLR. + +However, TempCLR has certain limitations in data collection and the effectiveness of contrastive learning. First, TempCLR treats hands from adjacent frames as positive samples during training. In dynamic egocentric videos, hand occlusions or detection failures often lead to missed hand crops in neighboring frames. In addition, images from adjacent frames typically lack background diversity, limiting the contribution of positive sample pairs formed from neighboring frames in contrastive learning. + +In contrast to TempCLR, our method, SiMHand, significantly improves performance. SiMHand leverages similar hand images, which provide richer diversity in features, including various types of hand-object interactions, diverse backgrounds, and varying appearances. These features allow SiMHand to effectively increase the diversity of positive samples in contrastive learning, resulting in superior pre-training performance. + +We further validate our approach on two different size of pre-training data, consisting of 50K and 100K hand images from the Ego4D dataset (Grauman et al., 2022). Tab. 5 shows the significant progress made by SiMHand compared to TempCLR and PeCLR. + +From the experimental results, TempCLR demonstrates better performance than PeCLR, which matches the conclusion of the original paper. However, SiMHand provides more valuable positive samples for contrastive learning, leading to better results during the fine-tuning phase of 3D hand pose estimation tasks. + +# 6.4 COMPARISON WITH WEAKLY-SUPERVISED LEARNING SETTING + +We compare our method with a weakly-supervised learning setting that uses 2D noisy keypoints assigned on in-the-wild images. In a weakly-supervised learning setting, noisy 2D keypoints are directly used as supervision signals during network training. The model treats these 2D keypoints as targets, computing the loss between the predicted keypoints and the provided 2D keypoints (e.g., heatmap-based loss). However, our experiments reveal that directly conducting joint training on labeled and unlabeled data results in degraded performance due to the noise and unreliability of + +
SettingUnlabeled dataFreiHand*
MPJPE ↓PCK-AUC ↑
Weakly-supervisedEgo-100K61.6533.92
Pre-training & Fine-tuningEgo-100K31.0668.66
+ +Table 6: Comparison with weakly-supervised learning setting. We observe that directly incorporating noisy labels into the joint training in the weakly-supervised setting leads to a decline in model performance, indicating that applying noisy labels for training presents certain challenges. + +
MethodBackboneDexYCB +MPJPE ↓
Xiong et al. (2019)ResNet5025.57
Spurr et al. (2020)ResNet5022.71
Spurr et al. (2020)HRNet3222.26
Tse et al. (2022)ResNet1821.22
Zhou et al. (2020)ResNet5019.36
SiMHandResNet5016.71
+ +Table 7: Comparison of 3D hand pose estimation methods on DexYCB (Chao et al., 2021). + +
MethodBackboneAssemblyHands MPJPE ↓
Han et al. (2022)ResNet5032.91
Ohkawa et al. (2023b)ResNet5021.92
Zhou et al. (2020)ResNet5019.17
SiMHandResNet5018.23
+ +Table 8: Comparison of 3D hand pose estimation methods on AssemblyHands (Ohkawa et al., 2023b). + +the 2D keypoints. As shown in Tab. 6, without any keypoint filtering or correction, the weakly-supervised method performs significantly worse than our pre-training setting. + +These findings demonstrate that directly incorporating noisy 2D annotations during weakly-supervised training negatively impacts model performance, particularly when the labels contain high levels of noise. + +Before designing our pre-training approach, we identified several limitations of the weakly-supervised setting for large-scale, in-the-wild hand data based on prior experience: (1) Data scale constraints: When the amount of noisy hand data is significantly smaller than the noise-free hand training dataset, it may provide some improvement but it is hard to guarantee that such noisy labels are less in larger datasets (e.g., the two million in-the-wild hand images in this study) and (2) Training efficiency issues: Introducing large-scale noisy data significantly prolongs training time and slows convergence. In contrast, our pre-training method benefits from such large unlabeled hand images with certain noisiness. This highlights our superiority in exploiting pre-training over the weakly-supervised setting. + +# 6.5 COMPARISON WITH THE OTHER 3D HAND POSE ESTIMATION METHODS + +To better assess the value of this work and its position within the broader context, we have included comparisons with other related works in the field of 3D hand pose estimation in this section. + +As shown in Tab. 7 and 8, the comparative results on the DexYCB (Chao et al., 2021) and AssemblyHands (Ohkawa et al., 2023b) datasets further validate the superiority of our approach across multiple standard datasets, demonstrating the effectiveness of our pretraining strategy and its broad potential for real-world applications. + +![](images/4364619ac5f58786b58b6a0b2d8407a84d931d3529af78407dc8099ce36585cf.jpg) +AssemblyHands +Figure 7: Visualization of Hand Pose Estimation Results on AssemblyHands. AssemblyHands Ohkawa et al. (2023b) is a hand pose dataset captured from a first-person perspective during toy assembly. It can be observed that SiMHand pre-training method achieves better results (GT: Ground Truth; PT: Pre-training). + +# 6.6 VISUALIZATION OF HAND POSE ESTIMATION RESULTS ON ASSEMBLYHANDS + +We show the visualization results of hand pose estimation on another dataset, AssemblyHands Ohkawa et al. (2023b). We highlight instances of hand-object occlusion in the data using red circles. As observed with DexYCB (Chao et al., 2021), SiMHand pre-trained model demonstrates superior performance in handling occlusion during the fine-tuning stage compared to the other pre-training methods, showcasing stronger robustness. + +# 6.7 VISUALIZATION OF SIMILAR HANDS + +We present the visualization of Top-K similar hand images used to create positive pairs. As shown in Fig. 8, we visualize a set of Top-K similar hand images. The figure displays the query image alongside its corresponding similar hand sequence (Top-K). At the top of Fig. 8, a timeline indicates that the images are deliberately sampled from consecutive frames of the same video. + +From these visualizations, we derive three key insights: 1) Using adjacent frames from the same video as positive samples in pre-training lacks diversity, as substantial variations may still exist between samples. 2) As the ranking increases, the similarity between hand images decreases significantly, leading to greater differences that may result in inaccurate feature representations during pre-training. 3) Therefore, selecting the Top-1 image is a proper design to assign diverse yet similar positive samples for the query images. + +![](images/99213bb29ea47ce19bb15fb0b3357f4a0f91419ee77a207f00d7cf1229733384.jpg) +Figure 8: Visualization of similar hand samples in Top-K. As the ranking increases, the differences between hand samples become more pronounced. \ No newline at end of file diff --git a/ICLR/2025/SiMHand_ Mining Similar Hands for Large-Scale 3D Hand Pose Pre-training/images.zip b/ICLR/2025/SiMHand_ Mining Similar Hands for Large-Scale 3D Hand Pose Pre-training/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..c1af29ec9407518162aaad8def9d8bfae30cd1d6 --- /dev/null +++ b/ICLR/2025/SiMHand_ Mining Similar Hands for Large-Scale 3D Hand Pose Pre-training/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:253c2d6d01224e9ce8c081c1ddc22ddb2d64657e7e40e132c4f92f7ad1f3d337 +size 1268760 diff --git a/ICLR/2025/SiMHand_ Mining Similar Hands for Large-Scale 3D Hand Pose Pre-training/layout.json b/ICLR/2025/SiMHand_ Mining Similar Hands for Large-Scale 3D Hand Pose Pre-training/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..720797c68cac08f1ae61a1256fa3e5534305258a --- /dev/null +++ b/ICLR/2025/SiMHand_ Mining Similar Hands for Large-Scale 3D Hand Pose Pre-training/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4f2603ad19a6d841916dc336f88a49727dce85daf11312818b1ac6555809633d +size 491015 diff --git a/ICLR/2025/SiReRAG_ Indexing Similar and Related Information for Multihop Reasoning/81ee359b-2d93-4886-9585-779e126a9b28_content_list.json b/ICLR/2025/SiReRAG_ Indexing Similar and Related Information for Multihop Reasoning/81ee359b-2d93-4886-9585-779e126a9b28_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..d7b0ba1270387375e2e3f00c89823d2baea60abb --- /dev/null +++ b/ICLR/2025/SiReRAG_ Indexing Similar and Related Information for Multihop Reasoning/81ee359b-2d93-4886-9585-779e126a9b28_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:50684fc96b4b1162b82dcb67edb91179cc37f6cde6742ed5b7fc39ec9a8f88e3 +size 115307 diff --git a/ICLR/2025/SiReRAG_ Indexing Similar and Related Information for Multihop Reasoning/81ee359b-2d93-4886-9585-779e126a9b28_model.json b/ICLR/2025/SiReRAG_ Indexing Similar and Related Information for Multihop Reasoning/81ee359b-2d93-4886-9585-779e126a9b28_model.json new file mode 100644 index 0000000000000000000000000000000000000000..12b84f50c4195c7aff5507a0e8967a39764ed7fa --- /dev/null +++ b/ICLR/2025/SiReRAG_ Indexing Similar and Related Information for Multihop Reasoning/81ee359b-2d93-4886-9585-779e126a9b28_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:92ea909619fdd91253cdec004d1c6591a96423a6d7c49469933fbcb9150e2182 +size 135191 diff --git a/ICLR/2025/SiReRAG_ Indexing Similar and Related Information for Multihop Reasoning/81ee359b-2d93-4886-9585-779e126a9b28_origin.pdf b/ICLR/2025/SiReRAG_ Indexing Similar and Related Information for Multihop Reasoning/81ee359b-2d93-4886-9585-779e126a9b28_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..29f891a53dab05176a9c1579dd40d52dafed1b61 --- /dev/null +++ b/ICLR/2025/SiReRAG_ Indexing Similar and Related Information for Multihop Reasoning/81ee359b-2d93-4886-9585-779e126a9b28_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1b6b774704d88f3671c9559308cdc10e65d3ab97cb0eabc102fd23e7fbd64f1f +size 910745 diff --git a/ICLR/2025/SiReRAG_ Indexing Similar and Related Information for Multihop Reasoning/full.md b/ICLR/2025/SiReRAG_ Indexing Similar and Related Information for Multihop Reasoning/full.md new file mode 100644 index 0000000000000000000000000000000000000000..0032ea6eca371ecfc492f1f57cc539b74e985efd --- /dev/null +++ b/ICLR/2025/SiReRAG_ Indexing Similar and Related Information for Multihop Reasoning/full.md @@ -0,0 +1,402 @@ +# SIRERAG: INDEXING SIMILAR AND RELATED INFORMATION FOR MULTIHOP REASONING + +Nan Zhang\* Prafulla Kumar Choubey Alexander Fabbri Gabriel Bernadett-Shapiro Rui Zhang\* Prasenjit Mitra Caiming Xiong Chien-Sheng Wu + +\*The Pennsylvania State University $\diamond$ Salesforce AI Research {njz5124,rmz5227,pmitra}@psu.edu {pchoubey,afabbri,gbernadettshapiro,cxiong,wu.jason}@salesforce.com + +# ABSTRACT + +Indexing is an important step towards strong performance in retrieval-augmented generation (RAG) systems. However, existing methods organize data based on either semantic similarity (similarity) or related information (relatedness), but do not cover both perspectives comprehensively. Our analysis reveals that modeling only one perspective results in insufficient knowledge synthesis, leading to suboptimal performance on complex tasks requiring multihop reasoning. In this paper, we propose SIRERAG, a novel RAG indexing approach that explicitly considers both similar and related information. On the similarity side, we follow existing work and explore some variances to construct a similarity tree based on recursive summarization. On the relatedness side, SIRERAG extracts propositions and entities from texts, groups propositions via shared entities, and generates recursive summaries to construct a relatedness tree. We index and flatten both similarity and relatedness trees into a unified retrieval pool. Our experiments demonstrate that SIRERAG consistently outperforms state-of-the-art indexing methods on three multihop datasets (MuSiQue, 2WikiMultiHopQA, and HotpotQA), with an average $1.9\%$ improvement in F1 scores. As a reasonably efficient solution, SIRERAG enhances existing reranking methods significantly, with up to $7.8\%$ improvement in average F1 scores. Our code is available at https://github.com/SalesforceAIResearch/SiReRAG. + +# 1 INTRODUCTION + +Retrieval-augmented generation (RAG) has shown strong potential in augmenting large language models (LLMs) with highly specialized and constantly updated knowledge (Lewis et al., 2020; Gao et al., 2024). Getting rid of fine-tuning LLMs, it is an efficient method for handling users' queries that require domain knowledge. A typical RAG pipeline may involve chunking, embedding, indexing, retrieval with queries, reranking, and LLM response generation (Wang et al., 2024). + +The indexing step is a prerequisite. It focuses on organizing a large amount of data and serves as an upstream step of retrieval. For example, RAPTOR (Sarthi et al., 2024) shows a significant performance improvement by adding recursive summaries to text chunks of a dataset, which demonstrates the potential of adding synthesized information for retrieval. The added recursive summaries combine semantically similar information within a dataset. GraphRAG (Edge et al., 2024), on the other hand, indices an entire corpus via an entity-guided knowledge graph. It then constructs summaries from closely-related entities and their mentions, synthesizing the connections and relatedness among different pieces of information. + +However, none of the existing methods address the importance of indexing from both similarity and relatedness sides, which limits a holistic understanding of the provided dataset. We define similarity as the semantic distance of text pieces and relatedness as the degree of connection of texts based on signals such as entities and propositions. Indexing similar and related information facilitates more comprehensive knowledge integration than indexing individual kind of information. As shown in + +![](images/72534643854683a51e6aeaa8dffdbef4d5b7ffaa1fdc6406522865ea6fb20570.jpg) +Figure 1: Challenges of existing RAG indexing methods for multihop reasoning. Entity 1 and 2 chunks contain similar information while entity 2 and 3 chunks contain related contents. Since synthesizing information only based on entity 1 and 2 (or entity 2 and 3) will lead to a higher probability of a wrong answer, an indexing method that considers both similarity and relatedness is needed to maximize retrieving relevant knowledge for multihop questions. + +![](images/eeacb46f7a318dd63a21cc3af6ef088f1e793e1bb2fae7fd383ebe8a197216cb.jpg) + +Figure 1, a complex question that involves two hops of reasoning requires the retrieval and synthesis of relevant entity chunks. For example, synthesizing entity 1 and 2 chunks would encourage LLMs to generate "Francis Bacon", which is a common mistake. Entity 1 and 2 chunks have close semantic distance. On the other hand, synthesizing entity 2 and 3 chunks would not maximize the probability of the correct answer even when entity 1 chunk is retrieved, since LLMs may struggle to reason about the painter of "Head I" in long-context environment (Liu et al., 2024). In this case, entity 2 and 3 chunks are related due to a shared topic. Therefore, it is important to synthesize both similar and related information in order to maximize the chance of retrieving relevant knowledge, in particular, for multihop reasoning questions. We verify the bottleneck of solely modeling similarity or relatedness through quantitative methods in Section 3 and demonstrate that neither perspective yields the optimal performance. + +In this paper, we propose SIRERAG, which stands for RAG indexing of similarity and relatedness as shown in Figure 2. On the similarity side, SIRERAG follows RAPTOR (Sarthi et al., 2024) to build a recursive tree based on chunk similarity. We adopt a shallow tree with 4 levels in total. On the relatedness side, SIRERAG first extracts entities (e.g., "Sonnet 110" and "William Shakespeare") and fine-grained propositions (e.g., "Sonnet 110 is one of 154 sonnets written by William Shakespeare.") from each text chunk/document using LLMs. We group these propositions into aggregated ones via entities, simply concatenating them with the original order in chunk/document. These proposition aggregates contain related information, because they mention shared entities. Then, recursive summaries with soft clustering are built on top of those aggregated propositions. Finally, we index both trees by flattening nodes in each tree for retrieval. + +We show that SIRERAG is effective on a variety of multihop question answering (QA) datasets including MuSiQue (Trivedi et al., 2022), 2WikiMultiHopQA (Ho et al., 2020), and HotpotQA (Yang et al., 2018). We find SIRERAG consistently outperforms the strongest RAG indexing methods, achieving an average F1 improvement of at least $1.9\%$ . We conduct an ablation study on several components in SIRERAG and observe that adding proposition aggregates to the similar information within a dataset yields the most improvement, which echoes our motivation. SIRERAG is also a reasonably efficient model, as it does not introduce many lengthy or redundant retrieval candidates. + +# 2 RELATED WORK + +RAG RAG is a framework that integrates retrieval mechanisms into generative models to enhance text generation by leveraging external knowledge. This concept has evolved from earlier retrieval-based methods such as DrQA (Chen et al., 2017) and DPR (Karpukhin et al., 2020). Instead of separating retrieval and generation phases, researchers also showed the potential of tightly coupling retrieval and generation into an end-to-end framework (Lewis et al., 2020). + +![](images/d4c24cc0802a2aacaeeb114f1f592e451516b81909c816fffd97809b7cdd9690.jpg) +Figure 2: SIRERAG Tree. We adopt RAPTOR (Sarthi et al., 2024) to construct the similarity tree (left). On the right, we construct the relatedness tree by clustering the propositions based on their entities to get proposition aggregates and having recursive summaries on top. Note that propositions are not included in the relatedness tree, so their connections to proposition aggregates are marked with dashed lines. + +Recent advances in retrieval mechanisms include leveraging LLMs as retrievers (Yu et al., 2023; Sun et al., 2023) and exploring retrieval granularity such as proposition (Chen et al., 2023). Here each proposition is an atomic expression that contains a factoid presented in natural language, which is similar to the propositions used by SIRERAG. Inspired by the idea of retrieval granularity, we combine several different text granularities (entity, propositions, text chunk, and summary) to index data. As a representative work on text segmentation, researchers proposed the first supervised approach to generate hierarchical segmentation structures (Nair et al., 2023). + +RAG Indexing An earlier work (Lewis et al., 2020) shows the benefits of document index on the overall retrieval performance. Most recent works on RAG indexing include RAPTOR that builds a tree with recursive summaries (Sarthi et al., 2024), HippoRAG that leverages the hippocampal indexing theory of human long-term memory for deep knowledge integration (Gutiérrez et al., 2024), and GraphRAG that constructs an entity-guided knowledge graph (Edge et al., 2024). However, all these works overlooked the importance of considering both similarity and relatedness during indexing. Specifically, RAPTOR integrated knowledge only based on similarity, and the other two only considered relatedness to synthesize information. Although these three approaches achieved competitive performance on different kinds of datasets and HippoRAG has the same goal as ours (multihop reasoning benchmarks), SIRERAG is fundamentally different from them in terms of the explicit incorporation of both similar and related knowledge. + +# 3 BOTTLENECK OF SOLELY MODELING SIMILARITY OR RELATEDNESS + +To verify our hypothesis of insufficient knowledge integration when solely modeling similarity or relatedness, we perform different kinds of clustering philosophies on a retrieval corpus of MuSiQue (Trivedi et al., 2022). Using the same retrieval corpus as HippoRAG (Gutiérrez et al., 2024), we obtain 1000 questions from the validation set of MuSiQue along with their candidate passage clusters (each cluster includes supporting and distractor passages). We include distractor passages for a more realistic setting, since they are semantically close and/or related to the supporting candidates. Treating these clusters as the gold labels for different queries, we run our own clustering on all passages based on either similarity or relatedness. + +Following RAPTOR (Sarthi et al., 2024), we use Gaussian Mixture Models (GMMs) to perform soft clustering, assuming that a candidate passage can belong to multiple clusters. For similarity, we run GMMs on the deep representations of all passages to find semantically similar groups. For related- + +Table 1: Coverage percentage between different clusters. MuSiQue clusters include supporting and distractor passages. The "all" setting treats both as gold, while "supporting only" uses only supporting passages as gold. We first show the coverage of supporting or all passages under two clustering philosophies. We then report the overlapping ratio between "supporting only" similarity and relatedness to motivate our work of combining both philosophies. + +
Similarity CoverageRelatedness CoverageOverlapping Ratio
Supporting OnlyAllSupporting OnlyAllOverlap@SimilarityOverlap@Relatedness
Coverage19.14%10.70%13.94%8.51%50.15%68.85%
+ +ness, we first extract the topic of each passage using OpenAI GPT-4o and then cluster passages based on the representations of their topics, because we assume that related passages share similar topics. To obtain deep representations of either passages or topics, we use OpenAI text-embedding-3-small for a balance of performance and efficiency. To evaluate the overlapping ratio among clusters, we convert every cluster into pairwise connections. For instance, given two clusters [1, 2, 3] and [3, 5], the resulting pairwise connections are as follows: “1-2”, “1-3”, “2-3”, and “3-5”. By computing the number of shared pairwise connections between gold clusters and predicted clusters, we aim to see how many pairwise connections from gold labels are covered by our two clustering philosophies, and we believe this coverage is a key indicator of knowledge integration for RAG indexing. We also report the overlapping ratio between “supporting only” similarity and relatedness to make a point of combining both clustering philosophies. + +Table 1 shows the coverage of supporting only or all passages as gold labels. Higher coverage is obtained when we only use supporting passages as gold, which indicates the commonality of supporting ones with respect to distractors. Both philosophies are able to capture this commonality. However, all these percentage scores are low, with the highest one being around one-fifth of the total coverage (19.14%). This indicates a significant insufficiency in knowledge synthesis when we model similarity or relatedness solely. As a result, the chance of retrieving relevant knowledge for multihop reasoning questions could be suboptimal. + +Taking a further step in the supporting-only setting, we find that only $50.15\%$ of the correct similarity connections overlap with the correct relatedness connections. Correct similarity connections are those gold connections covered by similarity, while correct relatedness connections are those covered by relatedness. Conversely, $68.85\%$ of the correct relatedness connections overlap with the correct similarity connections. In other words, predictions based on similarity or relatedness are not identical, and we can potentially leverage both to improve retrieval performance and facilitate a more comprehensive knowledge integration process. Although more customized clustering algorithms of each clustering philosophy can be proposed, combining both similarity and relatedness offers an effective and straightforward solution. + +# 4 METHODOLOGY + +We propose SIRERAG, a RAG indexing framework guided by similarity and relatedness. As shown in Figure 2, its left tree integrates information based on similarity while its right tree integrates information based on relatedness. As a first step, we study an alternative tree design to determine whether we can develop a generalized tree structure for similarity and relatedness trees, and beyond (Section 4.1). After the construction of the similarity tree, we extract propositions and their entities from our multihop reasoning dataset and perform clustering based on entities to synthesize related information (Section 4.2). Indexing separate similarity and relatedness trees (Section 4.3), SIRERAG explicitly models both kinds of information within our dataset. + +# 4.1 EXPLORING A HIERARCHICAL STRUCTURE OF TREES + +For efficiency, we stick to a tree structure to organize texts and explore whether a more structured tree design would offer performance improvement. RAPTOR placed all text chunks at the bottom level and recursive summaries at upper levels, but this design does not closely follow the commonsense + +Table 2: QA performance of having hierarchical text chunks on the validation set of QuALITY. Due to randomization of clustering and generation temperature of LLMs, we run each indexing method for 5 times and compute their average and standard deviation of accuracies. + +
Average AccuracyStandard Deviation
RAPTOR78.880.005
Hierarchical TextChunks78.760.004
+ +definition of a tree (Zhang et al., 2002), where multiple levels of data abstraction are provided. The reason is that different text chunks of a document may showcase different levels of abstraction, which serves as the assumption of many document discourse trees (Maekawa et al., 2024; Liu et al., 2021). For example, text chunks of the introduction section of a research paper are more likely to be more abstractive than those from the methodology section. Therefore, we first explore placing different text chunks on different levels of a tree based on their levels of abstractiveness. + +For this analysis, we choose QuALITY dataset (Pang et al., 2022) instead of multihop reasoning ones, because the documents of QuALITY are longer, resulting in more text chunks than using the other datasets. We prompt GPT-4o to identify a two-level hierarchy for all candidate chunks: low (text chunks describing fine-grained details about a topic) and high (text chunks giving an overview of a topic and summarizing fine-grained details) abstractiveness. Summary nodes will still start from the second level (the level above the bottom level), so the second level will contain both summary nodes (of the low-abstractive chunks) and high-abstractive chunks. As in RAPTOR, nodes of the third level and above are recursive summaries of their children. Using the same text chunks across two methods, we compare RAPTOR against our hierarchical design. Since we simply retrieve the top 10 relevant nodes via an embedding model (text-embedding-3-small) when a query arrives, the idea of hierarchical structure of chunks would affect summary nodes due to the differences of their children. + +As shown in Table 2, we do not observe a clear trend of improvement from using hierarchical text chunks, even averaged over 5 different runs. The RAPTOR tree is relatively more efficient, as identifying hierarchical text chunks and document discourse trees would require additional computation. Thus, we conclude that a more structured tree design would not significantly improve performance, as long as the correct information is indexed to answer a question. Since RAPTOR uses Gaussian Mixture Models and representations of text chunks to perform clustering, it sets a nice example of integrating knowledge based on similarity. We adopt it to construct our similarity tree as shown in the left part of Figure 2. + +# 4.2 SYNTHESIZING INFORMATION BASED ON RELATEDNESS + +For relatedness, we need to synthesize information based on a different philosophy than RAPTOR. Because related information pieces always share some degree of connection (e.g., overlapping subjects), we assume that two text pieces are related if they mention the same entity (e.g., person, location, product, etc). For example, entity 2 and 3 chunks in Figure 1 are unlikely to be clustered in the same group based on similarity, but since they both mention Francis Bacon, we are able to connect them together. + +Modeling Relatedness with Entity-Specific Propositions: To effectively use entities for organizing related content, we first need to determine the appropriate granularity for text pieces. There are three main limitations with directly connecting entities to standard text chunks. First, a chunk often contains information beyond the scope of a specific entity, making it challenging to localize information about one entity, potentially adding noise. Second, aggregating all chunks in an indexing corpus for each entity can result in hundreds of thousands of tokens for each entity, which may lead to long context performance issues, such as losing critical information in the middle Liu et al. (2024) or experiencing low coverage and citation performance Laban et al. (2024). Third, linking with chunks will introduce redundancy as each chunk may be a part of multiple entity clusters. Therefore, inspired by recent works on retrieval granularity (Liu et al., 2023; Chen et al., 2023), we propose to use short entity-specific "propositions" to represent fine-grained knowledge about entities and build our relatedness tree. + +Table 3: Key Statistics for extracted propositions and entities from MuSiQue, 2Wiki, and HotpotQA datasets. We show the number of chunks, propositions, entities, proposition aggregates, and the average, maximum, and minimum number of propositions per entity across the three datasets. + +
Dataset#Chunks#Props.#Ents#Pops Aggs.#Props per Entity
Avg.Max.Min.
MuSiQue11,65654,60550,92620,7882.741681
2Wiki6,11927,69729,49011,1082.491951
HotpotQA9,22147,15346,85618,2782.661651
+ +Proposition 1: Drug sales are reaching record highs as new therapies are developed and approved. + +Entities: [] + +Proposition 2: Drug sales for Eli Lilly's Mounjaro and Novo Nordisk's semaglutide are reaching record highs as new therapies are developed and approved. + +Entities: [Eli Lilly, Mounjaro, Novo Nordisk, Semaglutide] + +Figure 3: Examples of propositions with and without associated entities. + +Extracting Propositions and Entities from Documents: We define a proposition as "a factual statement describing important information (preferably about some entities) from a paragraph". We extract entities and propositions using the Distill-SynthKG pipeline (Choubey et al., 2024), adapting its SynthKG workflow. First, we rewrite chunks of 10K documents from the BAAI/IndustryCorpus1 to resolve entity references, using Meta-Llama-3-70B-Instruct2 (AI@Meta, 2024) with the rewriting prompt shown in Figure 6. Next, we prompt the same LLM to extract entities from these rewritten chunks (prompt is shown in Figure 7). After obtaining these entities, we again prompt the LLM to identify all relevant propositions and their associated entities (prompt is shown in Figure 8). We then consolidate the resulting propositions and entities to fine-tune Mistral-7B-Instruct-v0.33 (Jiang et al., 2023). This smaller fine-tuned model is subsequently used to extract propositions and their associated entities from our multihop datasets. + +Our prompt for extracting propositions and entities does not require every proposition to have associated entities. When we prompt LLMs to generate entities for each proposition, they sometimes produce common nouns as entities for those propositions that lack actually associated entities. This can lead to the clustering of unrelated propositions based on common nouns, potentially introducing noise into the relatedness tree. For example, as illustrated in Figure 3, we prefer to avoid LLMs generating Drug as an entity for proposition 1 due to its ambiguity. Subsequently, we exclude propositions without associated entities when constructing the relatedness tree, ensuring that only high-quality, entity-linked propositions are utilized. The Table 3 provides a detailed breakdown of key statistics for extracted propositions and entities from the MuSiQue, 2Wiki, and HotpotQA datasets. + +From Entity-specific propositions to Relatedness Tree: We concatenate related propositions that share the same entity using exact match to form proposition aggregates. We ensure that all propositions from the same document are grouped together and maintain their original order. By treating these proposition aggregates as pseudo-documents, we apply the same clustering pipeline in RAPTOR to obtain recursive summaries at levels above them and build the relatedness tree. Given that most propositions involve multiple entities, each proposition is associated with several entity clusters, offering two key advantages. First, it effectively mimics soft clustering as a single proposition may belong to multiple aggregates. Secondly, when constructing recursive summaries within the RAPTOR framework, the shared propositions across different aggregates result in high embedding similarity, ensuring that these aggregates remain clustered together even at higher levels in the tree. This relatedness tree forms the right part of SIRERAG as shown in Figure 2. Note that we only index aggregated propositions instead of individual propositions for better inference efficiency. + +# 4.3 INDEXING SIMILARITY AND RELATEDNESS TREES + +We propose to construct similarity and relatedness trees independently. This approach ensures that summary nodes in one tree do not access the clusters of the other, leading to a simpler design. There is another slightly complex design in which we allow summary nodes from one tree to access clusters from the other tree. This interaction may enable summary nodes in both trees to inform and enhance each other, improving their informativeness and consequently performance. However, this approach sacrifices the distinction between similarity and relatedness. Additionally, allowing cross-tree interaction leads to more nodes to cluster at each level as well as requires summarization based on a greater number of nodes per cluster, all of which increases the overall complexity of the system. We experimented with both settings and did not observe performance improvement as shown in Appendix A. Therefore, we opted for the simpler first implementation in our evaluation. + +Flattening all tree nodes, we place them into a unified retrieval pool. In other words, regardless of a node's origin (e.g., bottom or upper levels, similarity or relatedness trees), it is added to a single list containing all nodes. + +# 5 EXPERIMENT SETUP + +# 5.1 DATASETS + +To demonstrate the effectiveness of SIRERAG, we select three representative multihop QA datasets: MuSiQue (Trivedi et al., 2022), 2WikiMultiHopQA (Ho et al., 2020), and HotpotQA (Yang et al., 2018). Using the same corpus as HippoRAG (Gutiérrez et al., 2024), we obtain 1000 questions from each validation set of these three datasets. + +# 5.2 BASELINES + +We select RAPTOR, HippoRAG, and GraphRAG as state-of-the-art retrieval baselines. As discussed above, RAPTOR integrates knowledge based on similarity while the other two approaches focus on relatedness. Specifically, HippoRAG has both indexing and retrieval components, and we use ColBERTv2 (Santhanam et al., 2022) as the retriever of HippoRAG due to its strongest QA performance reported. Although GraphRAG has a different goal (global questions directed at an entire dataset) than ours, we include it to show its performance on multihop QA datasets. Since the queries in our datasets ask fine-grained details, we use the local search function of GraphRAG instead of its global search. Additional details of GraphRAG are specified in Appendix F. + +# 5.3 EVALUATION METRICS + +We use exact match (EM) and F1 scores to measure the QA performance of different models. Both metrics evaluate how accurate a generated answer is with respect to the ground truth. Like RAPTOR (Sarthi et al., 2024), we do not assess retrieval performance directly. The reason is that both SIRERAG and RAPTOR create new candidates (e.g., summary and proposition aggregate) in the retrieval pool, so it would be unfair to compare methods in terms of retrieval scores across different pools. Instead, QA performance is the best indicator of the overall capability of both RAG pipelines. + +We use the average time per query (TPQ) and the time-pool efficiency ratio (TPER) to measure the efficiency of SIRERAG and RAPTOR, as both methods share a significant portion of their retrieval candidates. Average TPQ measures the average time (in seconds) taken to answer a query, and it represents the inference time of a method. For TPER, it computes the growth of total inference time with respect to the growth of the retrieval pool size between two methods: + +$$ +\mathrm {T P E R} = \frac {\text {I n f e r e n c e - T i m e A / I n f e r e n c e - T i m e B}}{\text {P o o l - S i z e A / P o o l - S i z e B}} \tag {1} +$$ + +Setting SIRERAG as method A and a baseline as method B, we aim to ensure that the growth of inference time does not scale proportionally with the increase in the retrieval pool size. The reason behind is that there are many efficiency considerations (e.g., length and redundancy of retrieval candidates) beyond just the sheer number of retrieval candidates. Parallelization could also be designed + +to retrieve candidates simultaneously from similarity and relatedness trees, thereby minimizing the effect of retrieval pool size. A TPER value less than 1 indicates reasonable efficiency, whereas a TPER value greater than 1 signifies low efficiency. + +# 5.4 IMPLEMENTATION DETAILS + +To generate final answer, we use GPT-4o and the same prompt ("answer this question in as fewer number of words as possible.") to answer queries for all methods, since we aim to control the instruction-following capabilities across all methods. We use either GPT-3.5-Turbo or GPT-4o as the choice of LLM if any methods involve LLM calls. We use OpenAI's text-embedding-3-sma11 as the embedding model for all methods. During retrieval, we select top 20 candidates that match the provided query for all methods, because there is a large number of text chunks in our datasets and SIRERAG is expected to perform better when retrieving more due to the incorporation of proposition aggregates and their recursive summaries. + +# 6 RESULTS AND ANALYSIS + +Our results and analysis aim to answer the following research questions: + +- RQ 1: How does SIRERAG compare against other state-of-the-art baselines (sec 6.1)? +- RQ 2: As an important contribution of SIRERAG, is considering both similarity and relatedness an effective method (sec 6.1 and 6.2)? +- RQ 3: What is the effect of each component in SIRERAG(sec 6.2)? +- RQ 4: What is the applicability of SIRERAG(sec 6.3)? +- RQ 5: With the addition of relatedness tree, is S1RERAG an efficient method (sec 6.4)? + +Table 4: QA performance of SIRERAG and baselines. As elaborated in Section 5.4, GPT-4o is used to handle QA for all models, and we use two different LLMs (specified in the parentheses) to build indexing structures. We highlight the best scores using either LLM for indexing in green color. + +
ModelMuSiQue2WikiHotpotQAAverage
EMF1EMF1EMF1EMF1
HippoRAG (GPT-3.5-Turbo)32.6043.7866.4074.0159.9074.2952.9764.03
RAPTOR (GPT-3.5-Turbo)35.3047.4754.9061.2058.1072.4849.4360.38
GraphRAG (GPT-4o)12.1020.2222.5027.4931.7042.7422.1030.15
RAPTOR (GPT-4o)36.4049.0953.8061.4558.0073.0849.4061.21
SIRERAG (GPT-3.5-Turbo)38.9052.0860.4068.2062.5077.3653.9365.88
SIRERAG (GPT-4o)40.5053.0859.6067.9461.7076.4853.9365.83
+ +# 6.1 OVERALL RESULTS + +Our overall results are presented in Table 4. We show results on more datasets (single-hop QA, other multihop QA, and ambiguous questions) in Appendix E to show the generality of SIRERAG across various complex reasoning tasks. Besides quantitative scores, we also conduct our qualitative analysis in Appendix D. + +Improvement over baselines SIRERAG delivers consistent improvement over RAPTOR, HippoRAG, and GraphRAG. With an exception on 2Wiki when comparing against HippoRAG, SIRERAG achieves significantly higher performance than indexing baselines (e.g., approximately $5\%$ higher than RAPTOR on average F1, up to $8.3\%$ improvement of F1 on MuSiQue than HippoRAG, and more than $20\%$ higher than GraphRAG on average EM and F1). This demonstrates the advantage of SIRERAG on multihop QA and modeling both similarity and relatedness. Specifically, SIRERAG outperforms RAPTOR due to the incorporation of a relatedness tree, and it has better overall performance than HippoRAG, because we explicitly model similarity while HippoRAG prioritizes relatedness signals such as nodes with the most edges. We see that HippoRAG is particularly strong on 2Wiki benchmark, which is also reported in its original paper. Thus, we believe 2Wiki is the best fit of HippoRAG, but it has lower performance scores than SIRERAG on other datasets. + +Table 5: Ablation study of SIRERAG. + +
VariantsMuSiQue2WikiHotpotQAAverage
EMF1EMF1EMF1EMF1
SIRERAG40.5053.0859.6067.9461.7076.4853.9365.83
(A): SIRERAG – Re. Summary37.5050.3857.7065.7561.2075.9952.1364.04
(B): SIRERAG + Proposition39.1051.8058.1065.5360.8075.2652.6764.20
(C): (B) – Aggregate34.7047.8253.2060.2258.9073.3848.9360.47
(D): (C) – Re. Summary33.9046.1953.0059.1357.0071.0947.9758.80
(E): Dual Clustering onChunks34.8047.3253.5059.9356.6071.8448.3059.70
+ +One potential reason is that the entity-centric design of 2Wiki may be well-suited for HippoRAG, as noted in the HippoRAG paper. + +As for GraphRAG, it considers relatedness solely, and it delivers the worst performance scores on our datasets. After a manual verification, we find that GraphRAG often provides "I don't know" answers, suggesting that it prefers not to give a concrete answer. Since GraphRAG is designed to handle query-focused summarization of an entire corpus, it is not the most competitive approach in terms of accuracy for existing multihop QA tasks. + +Effect of LLM choice When comparing the performance of SIRERAG using GPT-40 as the LLM against itself using GPT-3.5-Turbo, we find the QA performance is not significantly affected. This phenomenon also holds on RAPTOR. Since the choice of LLM for SIRERAG and RAPTOR only affects summarization results, we believe GPT-3.5-Turbo is a sufficiently good option for both methods. This allows researchers to pursue a more cost-effective solution with SIRERAG for indexing. + +# 6.2 ABLATION STUDY + +To dissect SIRERAG, we perform a comprehensive ablation analysis as shown in Table 5. There are several variances, including (A) remove the recursive summary on the relatedness tree; (B) add all the propositions into the retrieval pool, and keep all aggregated propositions and recursive summary on the relatedness tree; (C) same as (B) but remove aggregated propositions; (D) same as (C) but further remove the recursive summary design on the relatedness tree. + +Entity clustering In (E), we do not maintain a separate relatedness tree and add an additional clustering philosophy to the similarity tree. Specifically, each text chunk in the similarity tree is simplified to, 'This chunk mentions entity 1 and entity 2,' if both entities are extracted by our LLM. We then run GMMs (the same clustering method as RAPTOR) on these simplified chunks. Once the clustering decisions are obtained, we group the original chunks as additional clusters and append these clusters to the similarity tree, allowing higher levels of the tree to incorporate both clustering philosophies. Since entities primarily determine the outcome of this additional clustering approach, we apply entity clustering to model relatedness on the similarity tree. This allows us to eliminate proposition aggregates in order to examine their utility. + +Findings Overall, we observe performance drops across all variations, highlighting the effectiveness of our design for SIRERAG. First, the recursive summary on the relatedness tree proves beneficial, as seen in both (A) and (D). Interestingly, adding more propositions to retrieval negatively impacts performance, as shown in (B). This indicates adding redundant information into the retrieval pool hurts the QA performance, since we keep the aggregated propositions in SIRERAG. From (C), we also find that aggregated propositions are essential, with their removal resulting in a significant performance decline. This is an important indicator that adding grouped knowledge about relatedness to the similarity tree would offer improvements, which echoes the bottlenecks described in Section 3. + +Both (A) and (B) have better performance than RAPTOR (GPT-4o) from Table 4, which indicates the advantage of proposition aggregates. In contrast, although (E) also models both similarity and relatedness, it exhibits a notable decline comparing against S1RERAG. This finding demonstrates the necessity of proposition aggregates of modeling relatedness. Because proposition aggregates reduce noise and information redundancy more effectively than text chunks as described in Section 4.2, they serve as an effective carrier of related dataset contents. + +Table 6: Applicability of SIRERAG when a specific retrieval method is selected. We feed our non-indexing models with the retrieval pool of SIRERAG and see whether QA performance improves. + +
VariantsMuSiQue2WikiHotpotQAAverage
EMF1EMF1EMF1EMF1
BM2525.9035.8853.0058.5857.7071.3245.5355.26
RAPTOR + BM2527.0038.9150.6057.0056.9070.8844.8355.60
SIRERAG + BM2535.0047.6658.2065.7261.7075.8851.6363.09
ColBERTv234.0046.8052.9059.4859.0073.4248.6359.90
RAPTOR + ColBERTv234.2047.1750.3057.5157.9072.3147.4759.00
SIRERAG + ColBERTv238.1051.3256.7064.7460.9075.7251.9063.93
+ +Table 7: Efficiency of SIRERAG and RAPTOR. Since both methods share a significant portion of retrieval candidates, we designate SIRERAG as Method A and RAPTOR as Method B in the TPER columns, as defined in Equation 1. + +
ModelMuSiQue2WikiHotpotQAAverage
TPQ↓TPER↓TPQ↓TPER↓TPQ↓TPER↓TPQ↓TPER↓
RAPTOR1.560-1.437-1.502-1.500-
SIRERAG2.6530.6001.9740.4992.3190.5172.3150.539
+ +# 6.3 APPLICABILITY OF SIRERAG + +We analyze how applicable SIRERAG is when a specific retrieval method is chosen. Therefore, we select BM25 (Robertson & Walker, 1994) and ColBERTv2 (Santhanam et al., 2022) as additional reranking-based options. We run them on the retrieval pool of SIRERAG to demonstrate its utility. We show how SIRERAG can complement these non-indexing options in Table 6. Results show that having SIRERAG benefits both BM25 and ColBERTv2 significantly, which demonstrates the advantage of our solution as the upstream step of these methods. On the other hand, RAPTOR only improves the QA performance on MiSuQue while showing performance degradation on other datasets. Thus, the utility of SIRERAG surpasses that of RAPTOR in the context of multihop reasoning. We also apply SIRERAG on an iterative retrieval method called self-ask (Press et al., 2023) and obtain significant performance improvement as shown in Appendix B. Our method showcases wide applicability on multihop QA across various retrieval methods. + +# 6.4 EFFICIENCY OF SIRERAG + +As shown in Table 7, we compare the efficiency of SIRERAG and RAPTOR using the metrics described in Section 5.3. All the values listed involve the time taken to retrieve the top 20 candidates and prompt GPT-4o to answer the query. + +RAPTOR requires less inference time than SIRERAG on average, which is expected due to SIRERAG's larger retrieval pool. However, with slightly longer inference time, SIRERAG has much better performance as discussed previously. To evaluate whether SIRERAG remains a reasonably efficient method, we compute its TPER values to measure its growth of total inference time relative to its growth of retrieval pool size. Since all its TPER values are well below 1, SIRERAG demonstrates reasonable efficiency without introducing many lengthy or redundant retrieval candidates. + +# 7 CONCLUSION + +In this paper, we identify the bottleneck of solely modeling similarity or relatedness when we need to index a multihop reasoning dataset for knowledge integration. To address it, we introduce SIRERAG, an innovative RAG indexing approach that considers both similarity and relatedness. SIRERAG delivers a consistent improvement over state-of-the-art indexing baselines across several multihop QA benchmarks. + +# REFERENCES + +AI@Meta. Llama 3 model card. 2024. URL https://github.com/meta-llama/llama3/blob/main/MODEL_CARD.md. +Danqi Chen, Adam Fisch, Jason Weston, and Antoine Bordes. Reading Wikipedia to answer open-domain questions. In Regina Barzilay and Min-Yen Kan (eds.), Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 1870-1879, Vancouver, Canada, July 2017. Association for Computational Linguistics. doi: 10.18653/v1/P17-1171. URL https://aclanthology.org/P17-1171. +Tong Chen, Hongwei Wang, Sihao Chen, Wenhao Yu, Kaixin Ma, Xinran Zhao, Dong Yu, and Hongming Zhang. Dense x retrieval: What retrieval granularity should we use? arXiv preprint arXiv:2312.06648, 2023. +Prafulla Kumar Choubey, Xin Su, Man Luo, Xiangyu Peng, Caiming Xiong, Tiep Le, Shachar Rosenman, Vasudev Lal, Phil Mui, Ricky Ho, Phillip Howard, and Chien-Sheng Wu. Distill-synthkg: Distilling knowledge graph synthesis workflow for improved coverage and efficiency, 2024. URL https://arxiv.org/abs/2410.16597. +Darren Edge, Ha Trinh, Newman Cheng, Joshua Bradley, Alex Chao, Apurva Mody, Steven Truitt, and Jonathan Larson. From local to global: A graph rag approach to query-focused summarization. arXiv preprint arXiv:2404.16130, 2024. +Yunfan Gao, Yun Xiong, Xinyu Gao, Kangxiang Jia, Jinliu Pan, Yuxi Bi, Yi Dai, Jiawei Sun, Meng Wang, and Haofen Wang. Retrieval-augmented generation for large language models: A survey, 2024. URL https://arxiv.org/abs/2312.10997. +Bernal Jiménez Gutiérrez, Yiheng Shu, Yu Gu, Michihiro Yasunaga, and Yu Su. Hipporag: Neurobiologically inspired long-term memory for large language models. arXiv preprint arXiv:2405.14831, 2024. +Xanh Ho, Anh-Khoa Duong Nguyen, Saku Sugawara, and Akiko Aizawa. Constructing a multihop QA dataset for comprehensive evaluation of reasoning steps. In Donia Scott, Nuria Bel, and Chengqing Zong (eds.), Proceedings of the 28th International Conference on Computational Linguistics, pp. 6609-6625, Barcelona, Spain (Online), December 2020. International Committee on Computational Linguistics. doi: 10.18653/v1/2020.coling-main.580. URL https://aclanthology.org/2020.coling-main.580. +Shayekh Bin Islam, Md Asib Rahman, K S M Tozammel Hossain, Enamul Hoque, Shafiq Joty, and Md Rizwan Parvez. Open-RAG: Enhanced retrieval augmented reasoning with open-source large language models. In Yaser Al-Onaizan, Mohit Bansal, and Yun-Nung Chen (eds.), Findings of the Association for Computational Linguistics: EMNLP 2024, pp. 14231-14244, Miami, Florida, USA, November 2024. Association for Computational Linguistics. doi: 10.18653/v1/2024-findings-emnlp.831. URL https://aclanthology.org/2024-findings-emnlp.831. +Albert Q. Jiang, Alexandre Sablayrolles, Arthur Mensch, Chris Bamford, Devendra Singh Chaplot, Diego de las Casas, Florian Bressand, Gianna Lengyel, Guillaume Lample, Lucile Saulnier, Lélio Renard Lavaud, Marie-Anne Lachaux, Pierre Stock, Teven Le Scao, Thibaut Lavril, Thomas Wang, Timothée Lacroix, and William El Sayed. Mistral 7b, 2023. URL https://arxiv.org/abs/2310.06825. +Vladimir Karpukhin, Barlas Oguz, Sewon Min, Patrick Lewis, Ledell Wu, Sergey Edunov, Danqi Chen, and Wen-tau Yih. Dense passage retrieval for open-domain question answering. In Bonnie Webber, Trevor Cohn, Yulan He, and Yang Liu (eds.), Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pp. 6769-6781, Online, November 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020.emnlp-main.550. URL https://aclanthology.org/2020.emnlp-main.550. +Philippe Laban, Alexander R Fabbri, Caiming Xiong, and Chien-Sheng Wu. Summary of a haystack: A challenge to long-context llms and rag systems. arXiv preprint arXiv:2407.01370, 2024. + +Patrick Lewis, Ethan Perez, Aleksandra Piktus, Fabio Petroni, Vladimir Karpukhin, Naman Goyal, Heinrich Kuttler, Mike Lewis, Wen-tau Yih, Tim Roktaschel, Sebastian Riedel, and Douwe Kiela. Retrieval-augmented generation for knowledge-intensive nlp tasks. In H. Larochelle, M. Ranzato, R. Hadsell, M.F. Balcan, and H. Lin (eds.), Advances in Neural Information Processing Systems, volume 33, pp. 9459-9474. Curran Associates, Inc., 2020. URL https://proceedings.neurips.cc/paper_files/paper/2020/file/6b493230205f780e1bc26945df7481e5-Paper.pdf. +Nelson F Liu, Kevin Lin, John Hewitt, Ashwin Paranjape, Michele Bevilacqua, Fabio Petroni, and Percy Liang. Lost in the middle: How language models use long contexts. Transactions of the Association for Computational Linguistics, 12:157-173, 2024. +Yixin Liu, Alexander R Fabbri, Yilun Zhao, Pengfei Liu, Shafiq Joty, Chien-Sheng Wu, Caiming Xiong, and Dragomir Radev. Towards interpretable and efficient automatic reference-based summarization evaluation. arXiv preprint arXiv:2303.03608, 2023. +Zhengyuan Liu, Ke Shi, and Nancy F Chen. Dmrst: A joint framework for document-level multilingual rst discourse segmentation and parsing. arXiv preprint arXiv:2110.04518, 2021. +Aru Maekawa, Tsutomu Hirao, Hidetaka Kamigaito, and Manabu Okumura. Can we obtain significant success in RST discourse parsing by using large language models? In Yvette Graham and Matthew Purver (eds.), Proceedings of the 18th Conference of the European Chapter of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 2803-2815, St. Julian's, Malta, March 2024. Association for Computational Linguistics. URL https://aclanthology.org/2024.eacl-long.171. +Inderjeet Nair, Aparna Garimella, Balaji Vasan Srinivasan, Natwar Modani, Niyati Chhaya, Srikrishna Karanam, and Sumit Shekhar. A neural CRF-based hierarchical approach for linear text segmentation. In Andreas Vlachos and Isabelle Augenstein (eds.), Findings of the Association for Computational Linguistics: EACL 2023, pp. 883-893, Dubrovnik, Croatia, May 2023. Association for Computational Linguistics. doi: 10.18653/v1/2023-findings-eacl.65. URL https://aclanthology.org/2023-findings-eacl.65. +Richard Yuanzhe Pang, Alicia Parrish, Nitish Joshi, Nikita Nangia, Jason Phang, Angelica Chen, Vishakh Padmakumar, Johnny Ma, Jana Thompson, He He, and Samuel Bowman. QuALITY: Question answering with long input texts, yes! In Marine Carpuat, Marie-Catherine de Marneffe, and Ivan Vladimir Meza Ruiz (eds.), Proceedings of the 2022 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pp. 5336-5358, Seattle, United States, July 2022. Association for Computational Linguistics. doi: 10. 18653/v1/2022.naacl-main.391. URL https://aclanthology.org/2022.naacl-main.391. +Ofir Press, Muru Zhang, Sewon Min, Ludwig Schmidt, Noah Smith, and Mike Lewis. Measuring and narrowing the compositionality gap in language models. In Houda Bouamor, Juan Pino, and Kalika Bali (eds.), Findings of the Association for Computational Linguistics: EMNLP 2023, pp. 5687-5711, Singapore, December 2023. Association for Computational Linguistics. doi: 10.18653/v1/2023-findings-emnlp.378. URL https://aclanthology.org/2023.findings-emnlp.378. +Stephen E Robertson and Steve Walker. Some simple effective approximations to the 2-poisson model for probabilistic weighted retrieval. In SIGIR'94: Proceedings of the Seventeenth Annual International ACM-SIGIR Conference on Research and Development in Information Retrieval, organised by Dublin City University, pp. 232-241. Springer, 1994. +Keshav Santhanam, Omar Khattab, Jon Saad-Falcon, Christopher Potts, and Matei Zaharia. ColBERTv2: Effective and efficient retrieval via lightweight late interaction. In Marine Carpuat, Marie-Catherine de Marneffe, and Ivan Vladimir Meza Ruiz (eds.), Proceedings of the 2022 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pp. 3715-3734, Seattle, United States, July 2022. Association for Computational Linguistics. doi: 10.18653/v1/2022.naacl-main.272. URL https://aclanthology.org/2022.nacl-main.272. + +Parth Sarthi, Salman Abdullah, Aditi Tuli, Shubh Khanna, Anna Goldie, and Christopher D Manning. Raptor: Recursive abstractive processing for tree-organized retrieval. arXiv preprint arXiv:2401.18059, 2024. +Ivan Stelmakh, Yi Luan, Bhuwan Dhingra, and Ming-Wei Chang. ASQA: Factoid questions meet long-form answers. In Yoav Goldberg, Zornitsa Kozareva, and Yue Zhang (eds.), Proceedings of the 2022 Conference on Empirical Methods in Natural Language Processing, pp. 8273–8288, Abu Dhabi, United Arab Emirates, December 2022. Association for Computational Linguistics. doi: 10.18653/v1/2022.emnlp-main.566. URL https://aclanthology.org/2022.emnlp-main.566. +Zhiqing Sun, Xuezhi Wang, Yi Tay, Yiming Yang, and Denny Zhou. Recitation-augmented language models, 2023. URL https://arxiv.org/abs/2210.01296. +Yixuan Tang and Yi Yang. Multihop-rag: Benchmarking retrieval-augmented generation for multi-hop queries, 2024. URL https://arxiv.org/abs/2401.15391. +Harsh Trivedi, Niranjan Balasubramanian, Tushar Khot, and Ashish Sabharwal. Musique: Multihop questions via single-hop question composition, 2022. URL https://arxiv.org/abs/2108.00573. +Xiaohua Wang, Zhenghua Wang, Xuan Gao, Feiran Zhang, Yixin Wu, Zhibo Xu, Tianyuan Shi, Zhengyuan Wang, Shizheng Li, Qi Qian, Ruicheng Yin, Changze Lv, Xiaqing Zheng, and Xuanjing Huang. Searching for best practices in retrieval-augmented generation, 2024. URL https://arxiv.org/abs/2407.01219. +Zhilin Yang, Peng Qi, Saizheng Zhang, Yoshua Bengio, William Cohen, Ruslan Salakhutdinov, and Christopher D. Manning. HotpotQA: A dataset for diverse, explainable multi-hop question answering. In Ellen Riloff, David Chiang, Julia Hockenmaier, and Jun'ichi Tsujii (eds.), Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pp. 2369-2380, Brussels, Belgium, October-November 2018. Association for Computational Linguistics. doi: 10.18653/v1/D18-1259. URL https://aclanthology.org/D18-1259. +Wenhao Yu, Dan Iter, Shuohang Wang, Yichong Xu, Mingxuan Ju, Soumya Sanyal, Chenguang Zhu, Michael Zeng, and Meng Jiang. Generate rather than retrieve: Large language models are strong context generators, 2023. URL https://arxiv.org/abs/2209.10063. +Jun Zhang, Adrian Silvescu, and Vasant Honavar. Ontology-driven induction of decision trees at multiple levels of abstraction. In Abstraction, Reformulation, and Approximation: 5th International Symposium, SARA 2002 Kananaskis, Alberta, Canada August 2-4, 2002 Proceedings 5, pp. 316-323. Springer, 2002. + +# A AN ALTERNATIVE DESIGN OF ALLOWING CROSS- TREE INTERACTION + +We discuss an alternative design of combining similarity and relatedness trees. Specifically, this design combines nodes from both sides in the same pool for finding additional clusters and performing summarization at every tree level. In other words, we find additional clusters by concatenating the nodes of both trees, which considers cross-tree interaction instead of keeping them separate. + +As shown in Table 8, the performance of considering cross-tree interaction is slightly lower than SIRERAG. Therefore, it is more efficient to keep trees separate in order to reduce the overall complexity of the system as discussed in Section 4.3. + +# B ADDITIONAL EXPERIMENT ON OTHER NON-INDEXING METHODS + +Although there are many existing methods that work on multihop reasoning tasks, SIRERAG is about indexing corpus data under RAG setup. In other words, instead of being our baselines, other non-indexing works (Press et al., 2023; Islam et al., 2024) focus on other dimensions of improving performance on complex reasoning tasks. + +Table 8: QA performance of two designs: separating similarity and relatedness trees (S1RERAG) and allowing cross-tree interaction. + +
VariantsMuSiQue2WikiHotpotQAAverage
EMF1EMF1EMF1EMF1
SIRERAG40.5053.0859.6067.9461.7076.4853.9365.83
Cross-tree interaction40.2053.0658.3065.2560.3075.7152.9364.67
+ +Table 9: QA performance of closed-book and self-ask. We feed self-ask with the unified retrieval pool of SIRERAG and see whether performance benefits from that. + +
ModelMuSiQue2WikiHotpotQAAverage
EMF1EMF1EMF1EMF1
Closed-book10.022.019.034.029.044.019.333.3
Self-ask31.2044.3555.0061.9957.1071.1147.7759.15
SIRERAG + self-ask36.5049.1257.2065.1359.7074.0751.1362.77
+ +To further demonstrate the applicability of SIRERAG, we have run two additional sets of experiments: (1) the closed-book setting, and (2) an iterative retrieval method (Press et al., 2023) called self-ask specifically designed for multihop reasoning. The closed-book setting means to directly get the final answer from GPT-4o without any retrieval. For self-ask, we prompt GPT-4o in two iterations without using a search engine. In the first iteration, the model is prompted to propose follow-up questions and provide answers to them. In the second iteration, GPT-4o is instructed to answer the final question by incorporating the follow-up thought process. We feed the model with a one-shot example and 10 retrieved candidates that match the final question in both iterations. For the self-ask retrieval pool, we use either all text chunks or SIRERAG. + +Similar to Table 6, our experiment in Table 9 on self-ask shows that SIRERAG can complement existing methods for optimal performance. We see that the closed-book setting yields the worst performance, which indicates that LLMs' parametric knowledge alone does not offer a decent performance on our datasets. Then, we see SIRERAG successfully improves the scores of self-ask, demonstrating its wide applicability. By leveraging SIRERAG's retrieval pool, we view our method as an augmentation to other non-indexing methods for multihop reasoning, rather than as a competitor. + +Efficiency-wise, we show TPQ of using both S1RERAG and self-ask in Table 10. By having S1RERAG, the TPQ of self-ask increases by approximately 1.2 seconds over the three datasets. Since self-ask requires two iterations of LLM prompting in our implementation, the increase in TPQ is relatively small compared to the significant performance improvement brought by S1RERAG. + +# C RETRIEVAL POOL SIZE + +The retrieval pool sizes of SIRERAG on MuSiQue, 2Wiki, and HotpotQA are 35070, 19100, and 29934 respectively. The retrieval pool sizes of RAPTOR on MuSiQue, 2Wiki, and HotpotQA are 12371, 6939, and 10031 respectively. SIRERAG's retrieval pool size is slightly less than three times the size of RAPTOR's. Considering the discussion on TPER in Section 6.4, we believe our method is reasonably efficient. + +# D AN EXAMPLE SIRERAG TREE + +Using the question "who is the father of the artist who painted Head I?" as an example, we focus on the relevant part of the SIRERAG tree in Figure 4 to conduct our qualitative analysis. + +For the multihop question in Figure 1 (correct answer: Nicholas Bacon), the MuSiQue corpus contains one relevant paragraph stating, "Francis Bacon was born on 22 January 1561 at York House + +![](images/7ad52c55bff25f46778f551f25577f1a579852c607f957fa0d06f5ab23d6b7ac.jpg) +Figure 4: Relevant part of the SIRERAG tree for the question: "who is the father of the artist who painted Head I?". + +![](images/6428a5b8fce63e9e498e661f1e2d01e2821d9d5064301f5da943817c3494f42d.jpg) + +Table 10: Efficiency of using self-ask with SIRERAG. We show TPQ on MuSiQue, 2Wiki, and HotpotQA datasets. + +
ModelMuSiQue TPQ2Wiki TPQHotpotQA TPQAverage TPQ
Self-ask2.722.212.292.41
SIRERAG + self-ask4.533.073.303.63
+ +near the Strand in London, the son of Sir Nicholas Bacon...”. This paragraph is a leaf node of the similarity tree shown in Figure 4. The similarity tree for the entire MuSiQue corpus has two more mentions (both mentions are in summary nodes) of Nicholas Bacon, one of which reads: "...Francis Bacon: Born on 22 January 1561, son of Sir Nicholas Bacon and Anne Cooke Bacon..." The addition of our relatedness tree adds two more mentions of Nicholas Bacon: one is in a proposition aggregate ("...Francis Bacon was the son of Sir Nicholas Bacon, Lord Keeper of the Great Seal, and Anne (Cooke) Bacon... Head I is a small oil and tempera on hardboard painting by Francis Bacon, completed in 1948..."), and the other one is a summary node ("The text provides detailed genealogical and biographical information about several individuals from different families and historical periods... Francis Bacon was the son of Sir Nicholas Bacon and Anne (Cooke) Bacon, making William Cecil, 1st Baron Burghley, his uncle..."). Thus, our similarity tree (RAPTOR tree) has three mentions of Nicholas Bacon, but none of them contains Head I information. SIRERAG has five mentions of Nicholas Bacon, and one of them (the proposition aggregate) contains Head I information. This proposition aggregate groups several propositions together via the entity "Francis Bacon". Because this node is the only retrieval candidate that fully matches the question, retrieving it would maximize the chance of generating the correct answer. If we use the RAPTOR tree only, we will + +not have this retrieval candidate. We believe this is an excellent example of how a comprehensive knowledge integration process can enhance the performance of RAG in multihop reasoning. + +# E PERFORMANCE ON SINGLE-HOP QA, MULTIHOP-RAG, AND AMBIGUOUS QUESTIONS + +To showcase the generality of SIRERAG on more datasets of complex reasoning tasks, we run the comparison between SIRERAG and RAPTOR on single-hop questions and MultiHop-RAG dataset (Tang & Yang, 2024). We also try ASQA dataset (Stelmakh et al., 2022) that contains ambiguous factoid questions. For single-hop questions, we use MuSiQue dataset and collect all the decomposed questions of multihop queries. We filter out some decomposed questions if they are still multihop or are based on another question. As a result, we end up with 502 single-hop questions from MuSiQue. As for MultiHop-RAG, it is a more recent dataset. We filter all unanswerable questions and randomly select 350 "comparison" queries and 350 "inference" queries, which forms a pool of 700 queries in total. + +Moreover, the primary difference between the multihop QA datasets and ASQA is that ASQA requires LLMs to reason across multiple perspectives (e.g., disambiguated questions) of an ambiguous question and organize their generation into a coherent and detailed answer. We report scores on ASQA based on all 948 ambiguous questions of its development set. + +Table 11 shows the performance scores of RAPTOR and our method. On the single-hop questions, SIRERAG still outperforms RAPTOR, but the lead narrows compared to the scores in Table 4. Since all queries in MuSiQue involve at least two hops, we observe that an increased number of reasoning hops positively impacts SIRERAG's performance. This is because single-hop questions may not require comprehensive knowledge synthesis, as they only involve retrieving the relevant chunks for the single hop. However, with more hops, we not only need to retrieve relevant chunks but also synthesize them comprehensively. SIRERAG also delivers better performance on MultiHop-RAG, which echoes our main experiment. + +Table 11 also displays STR-EM (string exact match), Disambig-F1, and Disambiguation-Rouge metrics for ASQA dataset. Specifically, STR-EM and Disambig-F1 dissect RAG answers to ambiguous questions into multiple perspectives and measure their accuracy with respect to each disambiguated question. Disambiguation-Rouge serves as an overall statistic that incorporates both ROUGE (with respect to the references) and accuracy scores. We see SIRERAG delivers a consistent improvement over RAPTOR, which again demonstrates the benefit of adopting SIRERAG on ambiguous queries. + +Our comprehensive selection of datasets demonstrates the generality and contribution of SIRERAG across various complex reasoning tasks, with the most significant improvement observed in multihop QA. + +# F ADDITIONAL GRAPHRAG DETAILS + +We adhere to GraphRAG documentation4 to construct its indexing structure and handle QA. Following the recommendation, we use its "auto tuning" to generate domain adapted prompts for the creation of its knowledge graph. We use the default values for most hyperparameters, except that we set the response type to "a few words" and do not include covariates during indexing. + +# G LLM PROMPTS + +The prompt we use to perform summarization on a cluster of nodes is "summarize the provided text, including as many key details as needed". This prompt is the same as RAPTOR. In Section 3, we use "identify the high-level topic of this paragraph as concise as possible" to extract the topic of each passage. As mentioned in Section 4.1, the prompt used for identifying a two-level hierarchy for all chunks is shown in Figure 5. As mentioned in Section 4.2, the LLM prompt for rewriting chunks is shown in Figure 6, the prompt for extracting named entities from rewritten chunks is shown in Figure 7, and the prompt for extracting propositions is shown in Figure 8. + +Table 11: QA performance on single-hop questions, MultiHop-RAG, and ASQA. + +
ModelSingle-HopMultiHop-RAGASQA
EMF1EMF1STR-EMDisambig-F1Disambiguation-Rouge
RAPTOR73.9080.6785.4386.3751.4740.3042.72
SIRERAG74.1082.6487.5788.4152.8141.8243.47
+ +```txt +## Instructions +1. Group sentences based on their topic and abstractiveness. +2. For each sentence group define metadata consisting of topic and the abstractiveness level. +3. There are two abstractiveness levels: + a. low: sentences describe fine-grained details about the topic + b. high: sentences gives an overview of the topic, summarizing fine-grained details. +4. Ensure that each group consists of contiguous sentences. +5. Respond using the below json format. +{ + "group_1": + { + "sentences": [list of sentence ids], + "topic": "topic of the group", + "abstractiveness": "high" + }, + "group_2": + { + "sentences": [list of sentence ids], + "topic": "topic of the group", + "abstractiveness": "low" + }, + "group_3": + { + "sentences": [list of sentence ids], + "topic": "topic of the group", + "abstractiveness": "high" +} +``` + +Figure 5: Prompt of identifying a two-level hierarchy for all candidate chunks. + +# Previous paragraph from Document: + +Gualala, the isolated Mendocino Coast town with a name that leaves most visitors tongue-tied, is on a new list of the 50 best places to live in the United States. Men's Journal magazine describes Gualala as an outpost of adventure lifestyle in its latest edition, which goes on sale today. The magazine describes Gualala (pronounced wa-LA-la by locals) as one of the below-the-radar places to make a move on before the word gets out.There were five such cities. The others were Homer, Alaska; Newport, Vt.; Logan, Utah; and Walla Walla, Wash. Rolling Stone magazine's Jann Wenner publishes Men's Journal, which has a paid circulation of about 620,000. Gualala joined three other California communities on the magazine's list: Santa Cruz, Mammoth Lakes and Bishop. We were looking for places that combined affordability, proximity to outdoor adventure and a generally undiscovered quality of life,said Erica Kestenbaum, a spokeswoman for Men's Journal. + +# Instruction: + +Rewrite the below paragraph by resolving all entity coreferences with the preceding paragraph from document. + +- Resolve all inter-sentence pronoun references. +- Make sure that all pronouns in a sentence refers to some named entity with in the same sentence. +- Explicitly mention entity names wherever necessary to remove ambiguity from a sentence. Remember to make each sentence clear and unambiguous. +- For each entity, use only the one most informative name. +- Do not generate anything except the rewritten paragraph. + +# Paragraph: + +She said isolation played a factor. In Northern California, it's particularly difficult to find a beautiful coastal setting that isn't entirely overrun, she said. Gualala residents Monday were largely unaware of the magazine listing or the attention it could bring to the old logging town turned tourist center. A few coastal residents chuckled about any notion of affordability, given an influx of newcomers who've driven the median housing price to $580,000 compared to the median family income of$ 47,778. Others recalled an era when the Gualala region was better known for the logging of ancient redwoods, marijuana growing and boisterous beer drinking at the historic Gualala Hotel. Still there was a certain pride to the magazine's designation. Yvette White, a 25-year resident who works at the Gualala Sport; Tackle shop, said she's proud her town made it on the list. + +# Output: + +Erica Kestenbaum said isolation played a factor. In Northern California, it's particularly difficult to find a beautiful coastal setting that isn't entirely overrun, Erica Kestenbaum said. Gualala residents Monday were largely unaware of the Men's Journal magazine listing or the attention it could bring to the old logging town turned tourist center. A few coastal residents of Gualala chuckled about any notion of affordability, given an influx of newcomers who've driven the Gualala's median housing price to $580,000 compared to the median family income of$ 47,778. Other Gualala residents recalled an era when the Gualala region was better known for the logging of ancient redwoods, marijuana growing and boisterous beer drinking at the historic Gualala Hotel. Still there was a certain pride to the Men's Journal magazine's designation. Yvette White, a 25-year Gualala resident who works at the Gualala Sport; Tackle shop, said she's proud her town made it on the list. + +# Previous paragraph from Document: [previous paragraph] + +# Instruction: + +Rewrite the below paragraph by resolving all entity coreferences with the preceding paragraph from document. + +- Resolve all inter-sentence pronoun references. +- Make sure that all pronouns in a sentence refers to some named entity with in the same sentence. +- Explicitly mention entity names wherever necessary to remove ambiguity from a sentence. Remember to make each sentence clear and unambiguous. +- For each entity, use only the one most informative name. +- Do not generate anything except the rewritten paragraph. + +# Paragraph: [paragraph ] + +# Output: + +Figure 6: Prompt for rewriting a paragraph (e.g., a document chunk) by resolving entity coreferences. + +Extract all named entities from the document. Also generate the type for each entity. + +# Instructions + +- Generate only the most informative name for each named entity. Example: if John P., Parker, John Parker are coreferential, only generate John Parker. +- Use your best understanding best on the domain of paragraph to decide appropriate entity types. +- Respond using json format provided below. + +```json +{ "n1":{"name":"entity_name", "type":"entity_type_label"}, "n2": {}, } +``` + +Below is an example for reference. + +Paragraph: Tucked into Eli Lilly's year-end earnings report, the company revealed positive results from Synergy-NASH—its phase 2 study of tirzepatide in adults in nonalcoholic steatohepatitis (NASH), also known as metabolic dysfunction-associated steatohepatitis (MASH). Output: + +```json +{ "n1": {"name": "Eli Lilly", "type": "Organization"}, "n2": {"name": "Synergy-NASH", "type": "Clinical Trial"}, "n4": {"name": "tirzepatide", "type": "Drug"}, "n5": {"name": "nonalcoholic steatohepatitis", "type": "Disease"}, "n6": {"name": "metabolic dysfunction-associated steatohepatitis", "type": "Disease"}, "n7": {"name": "year-end earnings report", "type": "Document"} } +``` + +Figure 7: Prompt for extracting entities from a document (e.g., a rewritten chunk). + +```txt +Extract all facts from the document. For each fact, also generate all semantic triplets. Instructions Consistently use the most informative name for each named entity in all facts and triplets. - Avoid pronouns or ambiguous references in facts and triplets. Instead, directly include all relevant named entities in facts. - Ensure that each semantic triplet contains head entity, predicate, and tail entity. - Ensure that at least one (preferably both) entity in each semantic triplet is present in the given entities list. Respond using json format provided below: { "f1":{ "fact": "A factual statement describing important information (preferably about some entities) from the paragraph", "triplets: ["entity 1", "predicate", "entity 2"], ["entity 1", "predicate", "entity 3"] }, "f2": {}, } Below is an example for reference. Paragraph: Locked in a heated battle with Novo Nordisk's semaglutide franchise, Eli Lilly's tirzepatide is beginning to come into its own--both with regards to sales and amid attempts to show the dual GIP/GLP-1 agonist can strike out beyond diabetes and obesity. As Mounjaro, tirzepatide won its first FDA nod in Type 2 diabetes back in May 2022. An obesity approval followed last November, with that formulation of tirzepatide adopting the commercial moniker Zepbound. In 2023's fourth quarter, Mounjaro generated a whopping $2.2 billion in sales, a nearly eight-fold increase over the $279 million it pulled down during the same stretch in 2022. Year-to-date, the drug brought home around $5.2 billion in revenues, Lilly said in an earnings release Tuesday. Zepbound, for its part, generated $175.8 million during its first quarter on the market. Overall, Lilly reeled in around $9.4 billion in fourth-quarter sales, growing 28% over the $7.3 billion it made for the quarter in 2022. Entities: Eli Lilly, Novo Nordisk, Tirzepatide, Semaglutide, GLP-1, GIP, FDA, Mounjaro, Zepbound Output: { "f1": { "fact": "Eli Lilly's tirzepatide is competing with Novo Nordisk's semaglutide franchise.", "triplets": ["Eli Lilly", "competing with", "Novo Nordisk"], ["Tirzepatide", "is competing with", "Semaglutide"]] "f2": { "fact": "Eli Lilly is trying to show tirzepatide, the dual GIP/GLP-1 agonist, can strike out beyond diabetes and obesity.", "triplets": ["Eli Lilly", "is trying to show", "Tirzepatide"], ["Tirzepatide", "is a", "dual GIP/GLP-1 agonist"], ["Tirzepatide", "can treat beyond", "Diabetes"], ["Tirzepatide", "can treat beyond", "Obesity"]] "f3": { "fact": "Tirzepatide, under the brand name Mounjaro, received its first FDA approval for Type 2 diabetes in May 2022.", "triplets": ["Tirzepatide", "branded as", "Mounjaro"], ["Mounjaro", "won", "FDA approval"], ["FDA approval", "for", "Type 2 diabetes"], ["FDA approval", "was in", "May 2022"]] "f4": { "fact": "Tirzepatide, under the brand name Zepbound, received an obesity approval in November 2022.", "triplets": ["Tirzepatide", "was branded as", "Zepbound"], ["Zepbound", "received", "Obesity approval"], ["Obesity approval", "was in", "November 2022"]} "f5": { "fact": "Mounjaro generated $2.2 billion in sales in the fourth quarter of 2023, an eight-fold increase from the $279 million during the same period in 2022.", "triplets": ["Mounjaro", "2023's fourth quarter sales", "$2.2 billion sales"], ["Mounjaro", "2022's fourth quarter sales", "$279 million"]} "f6": { "fact": "Mounjaro brought in around $5.2 billion in revenues year-to-date in 2023, Lilly said in an earnings release Tuesday", "triplets": ["Mounjaro", "2023 sales year-to-date", "$5.2 billion revenues"]} "f7": { "fact": "Zepbound generated $175.8 million in sales in its first quarter on the market.", "triplets": ["Zepbound", "first quarter sales", "$175.8 million"]} "f8": { "fact": "Eli Lilly's fourth-quarter sales were around $9.4 billion, a 28% increase over the $7.3 billion during the same period in 2022.", "triplets": ["Eli Lilly", "2023 fourth-quarter sales", "$9.4 billion.", ["Eli Lilly", "2022 fourth-quarter sales", "$7.3 billion.", } } +``` + +Figure 8: Prompt for extracting propositions (e.g., facts) and their corresponding entities from a document. \ No newline at end of file diff --git a/ICLR/2025/SiReRAG_ Indexing Similar and Related Information for Multihop Reasoning/images.zip b/ICLR/2025/SiReRAG_ Indexing Similar and Related Information for Multihop Reasoning/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..0dfcf56d202113f6ed1ac8f9236bb4e0cf14b4f8 --- /dev/null +++ b/ICLR/2025/SiReRAG_ Indexing Similar and Related Information for Multihop Reasoning/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dd833ed0f35c0187d771e9be33203ce27185404a139e3643985da7b4cdb981b7 +size 600153 diff --git a/ICLR/2025/SiReRAG_ Indexing Similar and Related Information for Multihop Reasoning/layout.json b/ICLR/2025/SiReRAG_ Indexing Similar and Related Information for Multihop Reasoning/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..4fe61188b1d1241343b111ad6039131779856de2 --- /dev/null +++ b/ICLR/2025/SiReRAG_ Indexing Similar and Related Information for Multihop Reasoning/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:35fa761d81f190cc9be0446fdfb94faf5ae0f79fd2e853fcb3fe8ac7b031ccf3 +size 408072 diff --git a/ICLR/2025/SigDiffusions_ Score-Based Diffusion Models for Time Series via Log-Signature Embeddings/50472967-a8ac-40b5-9c36-7304455b07af_content_list.json b/ICLR/2025/SigDiffusions_ Score-Based Diffusion Models for Time Series via Log-Signature Embeddings/50472967-a8ac-40b5-9c36-7304455b07af_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..2ea21de660e97174d5627ca55a241d283592780b --- /dev/null +++ b/ICLR/2025/SigDiffusions_ Score-Based Diffusion Models for Time Series via Log-Signature Embeddings/50472967-a8ac-40b5-9c36-7304455b07af_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2a9760910d4061424159112368f7340c50e598ff2bb241c70bce282506d35b72 +size 231515 diff --git a/ICLR/2025/SigDiffusions_ Score-Based Diffusion Models for Time Series via Log-Signature Embeddings/50472967-a8ac-40b5-9c36-7304455b07af_model.json b/ICLR/2025/SigDiffusions_ Score-Based Diffusion Models for Time Series via Log-Signature Embeddings/50472967-a8ac-40b5-9c36-7304455b07af_model.json new file mode 100644 index 0000000000000000000000000000000000000000..9a29a2f430d348036722302e91d56f3057b59bf8 --- /dev/null +++ b/ICLR/2025/SigDiffusions_ Score-Based Diffusion Models for Time Series via Log-Signature Embeddings/50472967-a8ac-40b5-9c36-7304455b07af_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7c1d9fcccbb713dc3c9eca2ad5052d3c9f5d5ef78c51c53e23e87dd4f1897399 +size 270810 diff --git a/ICLR/2025/SigDiffusions_ Score-Based Diffusion Models for Time Series via Log-Signature Embeddings/50472967-a8ac-40b5-9c36-7304455b07af_origin.pdf b/ICLR/2025/SigDiffusions_ Score-Based Diffusion Models for Time Series via Log-Signature Embeddings/50472967-a8ac-40b5-9c36-7304455b07af_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..080bbcec295bb0247f9fb0c603887ce40526a088 --- /dev/null +++ b/ICLR/2025/SigDiffusions_ Score-Based Diffusion Models for Time Series via Log-Signature Embeddings/50472967-a8ac-40b5-9c36-7304455b07af_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0f0f631fa05b3d6fd93279b030316e7a29860f8e0e3c5531ee0616c68b87af79 +size 1404377 diff --git a/ICLR/2025/SigDiffusions_ Score-Based Diffusion Models for Time Series via Log-Signature Embeddings/full.md b/ICLR/2025/SigDiffusions_ Score-Based Diffusion Models for Time Series via Log-Signature Embeddings/full.md new file mode 100644 index 0000000000000000000000000000000000000000..ae7ddcaea1c4b8519f8f33b8cd2c4d625deb8e40 --- /dev/null +++ b/ICLR/2025/SigDiffusions_ Score-Based Diffusion Models for Time Series via Log-Signature Embeddings/full.md @@ -0,0 +1,1231 @@ +# SIGDIFFUSIONS: SCORE-BASED DIFFUSION MODELS FOR TIME SERIES VIA LOG-SIGNATURE EMBEDDINGS + +Barbora Barancikova + +Department of Computing Imperial College London + +Zhuoyue Huang + +Department of Mathematics Imperial College London + +Christopher Salvi + +Department of Mathematics Imperial College London + +# ABSTRACT + +Score-based diffusion models have recently emerged as state-of-the-art generative models for a variety of data modalities. Nonetheless, it remains unclear how to adapt these models to generate long multivariate time series. Viewing a time series as the discretisation of an underlying continuous process, we introduce SigDiffusion, a novel diffusion model operating on log-signature embeddings of the data. The forward and backward processes gradually perturb and denoise log-signatures while preserving their algebraic structure. To recover a signal from its log-signature, we provide new closed-form inversion formulae expressing the coefficients obtained by expanding the signal in a given basis (e.g. Fourier or orthogonal polynomials) as explicit polynomial functions of the log-signature. Finally, we show that combining SigDiffusions with these inversion formulae results in high-quality long time series generation, competitive with the current state-of-the-art on various datasets of synthetic and real-world examples. + +# 1 INTRODUCTION + +Time series generation has gained significant attention in recent years due to the growing demand for high-quality data augmentation in fields such as healthcare (Trottet et al., 2023) and finance (Hwang et al., 2023). Since sampling rates are often arbitrary and non-uniform, it is natural to assume that the data is collected from measurements of some underlying physical system evolving in continuous time. This perspective calls for modelling tools capable of processing temporal signals as continuous functions of time. We will often refer to such functions as paths. + +The idea of representing a path via its iterated integrals has been the object of numerous mathematical studies, including geometry (Chen, 1957; 1958) control theory (Fliess et al., 1983), and stochastic analysis (Lyons, 1998). The collection of these iterated integrals is known as the signature of a path. Thanks to its rich algebraic and analytic properties summarised in Section 2, the signature is an efficient-to-compute, universal feature map for time series evolving in continuous time. As a result, signature methods have recently become mainstream in many areas of machine learning dealing with irregular time series, from deep learning (Kidger et al., 2019; Morrill et al., 2021; Cirone et al., 2023; 2024) to kernel methods (Salvi et al., 2021a; Lemercier et al., 2021b; Issa et al., 2024), with applications in quantitative finance (Arribas et al., 2020; Salvi et al., 2021b; Horvath et al., 2023; Pannier & Salvi, 2024), cybersecurity (Cochrane et al., 2021), weather forecasting (Lemercier et al., 2021a), and causal inference (Manten et al., 2024). For a concise summary of this topic, we refer the interested reader to Fermanian et al. (2023b). + +Score-based diffusion models have emerged as a powerful framework for modelling complex distributions in computer vision, audio, and text (Song et al., 2020; Biloš et al., 2023; Popov et al., 2021; Cai et al., 2020; Voleti et al., 2022). These models perturb the observed data distribution through a forward diffusion process, adding noise until an easy-to-sample base distribution is reached. A new sample from the learned data distribution is then generated by reversing the noising process using a learned score function of the data conditional on the noise level. Despite recent efforts summarised in Section 4, it remains unclear how to adapt score-based diffusion models for generating long signals in continuous time. + +Contributions In this paper, we make use of the log-signature, a compressed version of the signature, as a parameter-free Lie algebra embedding for time series. In Section 2.3, we introduce SigDiffusion, a new diffusion model that gradually perturbs and denoises log-signatures preserving their algebraic structure. To recover a path from its log-signature embedding, we provide novel closed-form inversion formulae in Section 3. Notably, we prove that the coefficients of the expansion of a path in a given basis, such as Fourier or orthogonal polynomials, can be expressed as explicit polynomial functions on the log-signature. Our results provide a major improvement over existing signature inversion algorithms (see Section 5.1) which suffer from scalability issues and are only effective on simple examples of short piecewise-linear paths. In Section 5, we demonstrate how the combination of SigDiffusions with our inversion formulae provides a time series generative approach, competitive with state-of-the-art diffusion models for temporal data on various datasets of synthetic and real-world examples. + +# 2 GENERATING LOG-SIGNATURES WITH SCORE-BASED DIFFUSION MODELS + +We begin this section by recalling the relevant background material before introducing our SigDiffusion model. We will limit ourselves to reporting only the key properties of signatures and the notation necessary for the inversion formulae in Section 3. Additional examples of signature computations can be found in Appendix A.3. + +# 2.1 THE (LOG)SIGNATURE + +Let $x:[0,1]\to \mathbb{R}^d$ be a smooth $d$ -dimensional time series defined on a time interval [0, 1]. We will equivalently refer to this object as a path. The step- $n$ signature $S^{\leq n}(x)$ of $x$ is defined as the following collection of iterated integrals + +$$ +S ^ {\leq n} (x) = \left(1, S _ {1} (x), \dots , S _ {n} (x)\right) \tag {1} +$$ + +where + +$$ +S _ {k} (x) = \int_ {0 \leq t _ {1} < \dots < t _ {k} \leq 1} d x _ {t _ {1}} \otimes \dots \otimes d x _ {t _ {k}} \quad \text {f o r} 1 \leq k \leq n +$$ + +and $\otimes$ denotes the tensor product. Intuitively, one can view the signature as a set of tensors of increasing dimension, where the value of the $m$ -th tensor at the index $i_1, i_2, \ldots, i_m$ represents a measure of "interaction" between the $i_1, i_2, \ldots, i_m$ -th channels of $x$ . This makes the signature transform particularly effective at capturing information about the shape of multivariate time series. + +Example 2.1. Assume $d = 2$ , and denote the two channels of $x$ as $x = (x^{1}, x^{2})$ . Then $S_{1}(x), S_{2}(x)$ are tensors with shape [2] and [2, 2] respectively + +$$ +S _ {1} (x) = \int_ {0} ^ {1} d x _ {t _ {1}} = \left( \begin{array}{c} \int_ {0} ^ {1} d x _ {t _ {1}} ^ {1} \\ \int_ {0} ^ {1} d x _ {t _ {1}} ^ {2} \end{array} \right), +$$ + +$$ +S _ {2} (x) = \int_ {0} ^ {1} \int_ {0} ^ {t _ {2}} d x _ {t _ {1}} \otimes d x _ {t _ {2}} = \left( \begin{array}{c c} \int_ {0} ^ {1} \int_ {0} ^ {t _ {2}} d x _ {t _ {1}} ^ {1} d x _ {t _ {2}} ^ {1} & \int_ {0} ^ {1} \int_ {0} ^ {t _ {2}} d x _ {t _ {1}} ^ {2} d x _ {t _ {2}} ^ {1} \\ \int_ {0} ^ {1} \int_ {0} ^ {t _ {2}} d x _ {t _ {1}} ^ {1} d x _ {t _ {2}} ^ {2} & \int_ {0} ^ {1} \int_ {0} ^ {t _ {2}} d x _ {t _ {1}} ^ {2} d x _ {t _ {2}} ^ {2} \end{array} \right). +$$ + +Denoting the standard basis of $\mathbb{R}^d$ as $e_1, e_2, \ldots, e_d$ we define a basis of the space of $k$ -dimensional tensors as + +$$ +e _ {i _ {1} i _ {2} \dots i _ {k}} = e _ {i _ {1}} \otimes e _ {i _ {2}} \otimes \dots \otimes e _ {i _ {k}}, \quad \text {f o r} \quad 1 \leq i _ {1}, \dots , i _ {k} \leq d \text {a n d} 0 \leq k \leq n. +$$ + +We refer to these basis elements as words. In Section 3, we will make use of the notation $\langle e_{i_1 i_2 \ldots i_k}, S^{\leq n}(x) \rangle \in \mathbb{R}$ to extract the $(i_1, \ldots, i_k)^{th}$ element of the $k$ -th signature tensor $S_k(x)$ . + +Words can be manipulated by two key operations: the shuffle product $\sqcup$ and right half-shuffle product $\succ$ . The shuffle product of two words of length $r$ and $s$ (with $r + s \leq n$ ) is defined as the sum over the $\binom{r+s}{s}$ ways of interleaving the two words. For a formal definition, we refer readers to Reutenauer (2003, Section 1.4). Much of the internal structure of the signature is characterized by the shuffle identity (see Lemma A.0.1), which uses the shuffle and half-shuffle products to describe the relationship between elements of higher and lower-order signature tensors. This identity is crucial + +in our derivation of the inversion formulae in Appendix C. A rigorous algebraic explanation of these concepts is provided in Appendix A.1. + +Moreover, it turns out that the space of signatures has the structure of a step- $n$ free nilpotent Lie group $\mathcal{G}^n(\mathbb{R}^d)$ . We denote by $\mathcal{L}^n(\mathbb{R}^d)$ the unique Lie algebra associated with $\mathcal{G}^n(\mathbb{R}^d)$ , and we call its elements log-signatures. $\mathcal{G}^n(\mathbb{R}^d)$ is the image of the $\mathcal{L}^n(\mathbb{R}^d)$ under the exponential map + +$$ +\mathcal {G} ^ {n} \left(\mathbb {R} ^ {d}\right) = \exp \left(\mathcal {L} ^ {n} \left(\mathbb {R} ^ {d}\right)\right) \tag {2} +$$ + +where, in the case of signatures, exp denotes the tensor exponential defined in Appendix A.2. Furthermore, one can use the tensor logarithm (see Equation (13)) to convert log-signatures to signatures. These two operations are mutually inverse. + +We note that the Lie algebra $\mathcal{L}^n (\mathbb{R}^d)$ is a vector space of dimension $\beta (d,n)$ with + +$$ +\beta (d, n) = \sum_ {k = 1} ^ {n} \frac {1}{k} \sum_ {i | k} \mu \left(\frac {k}{i}\right) d ^ {i}, +$$ + +where $\mu$ is the Möbius function (Reutenauer, 2003). Crucially, the Lie algebra is isomorphic to the Euclidean space $\mathbb{R}^{\beta(d,n)}$ , which motivates the diffusion model architecture in Section 2.3. + +# 2.2 SIGNATURE AS A TIME SERIES EMBEDDING + +The (log)signature exhibits additional properties making it an especially interesting object in the context of generative modelling for sequential data. In this section we summarise such properties without providing technical details, as these have been discussed at length in various texts in the literature. For a thorough review, we refer the interested reader to Cass & Salvi (2024, Chapter 1). + +At first glance, computing the (log)signature seems intractable for general time series. However, an elegant and efficient computation is possible due to Chen's relation + +Lemma 2.0.1 (Chen's relation). For any two smooth paths $x, y:[0,1]\to \mathbb{R}^d$ the following holds + +$$ +S ^ {\leq n} (x * y) = S ^ {\leq n} (x) \cdot S ^ {\leq n} (y), \tag {3} +$$ + +where $*$ denotes path-concatenation, and $\cdot$ is the signature tensor product defined in Equation (11). + +Combining Chen's relation with the fact that the signature of a linear path is simply the tensor exponential of its increment (see Example A.2) provides us with an efficient algorithm for computing signatures of piecewise linear paths. This approach eliminates the need to calculate integrals when computing signature embeddings. See Appendix A.3 for simple examples of computations. + +Furthermore, the (log)signature is invariant under reparameterisations. This property essentially allows the signature transform to act as a filter that removes an infinite dimensional group of symmetries given by time reparameterisations. The action of reparameterising a path can be thought of as sampling its observations at a different frequency, resulting in robustness to irregular sampling. Another important property of the signature is the factorial decay in the magnitude of its coefficients (Cass & Salvi, 2024, Proposition 1.2.3). This fast decay implies that truncating the signature at a sufficiently high level retains the bulk of the critical information about the underlying path. + +The signature is unique for certain classes of paths, ensuring a one-to-one identifiability with the underlying path. An example of such classes is given by paths which share an identical, strictly monotone coordinate and are started at the same origin. More general examples are discussed in Cass & Salvi (2024, Section 4.1). This property is important if one is interested, as we are, in recovering the path from its signature. Yet, providing a viable algorithm for inverting the signature has, until now, been challenging; valid but non-scalable solutions have been proposed only for special classes of piecewise linear paths (Chang & Lyons, 2019; Germanian et al., 2023a; Kidger et al., 2019). In Section 3 we provide new closed-form inversion formulae that address this limitation. + +# 2.3 DIFFUSION MODELS ON LOG-SIGNATURE EMBEDDINGS + +As described in Section 2.1, any element of $\mathcal{G}^n (\mathbb{R}^d)$ corresponds to the step- $n$ signature of a smooth path. Taking the tensor logarithm in Equation (13) then implies that an arbitrary element of $\mathcal{L}^n (\mathbb{R}^d)$ + +![](images/bacc2991909dc907fc420daa530a6fd6c74dec2db25f63560b8e629fb5eec735.jpg) +Figure 1: SigDiffusions pipeline. The signatures of a time series dataset are points distributed in a non-Euclidean space (Lie group). Converting to log-signatures maps them to a Euclidean space (Lie algebra) where standard diffusion models operate. Calculating the log-signature embedding and its inverse (blue box) are fully deterministic operations, which greatly simplifies the learning task. The log-signatures serve as inputs to a score-based diffusion model (orange box). Step 6 is enabled by our newly derived closed-form inversion formulae. + +corresponds to the step- $n$ log-signature of a smooth path. Because the Lie algebra $\mathcal{L}^n(\mathbb{R}^d)$ is a linear space, adding two log-signatures yields another log-signature. Furthermore, the dimensionality $\beta(d,n)$ of $\mathcal{L}^n(\mathbb{R}^d)$ is strictly smaller than $\frac{d^{n+1}-1}{d-1}$ , making the log-signature a more compact representation of a path than the signature while retaining the same information. We can leverage these two properties to run score-based diffusion models on $\mathcal{L}^n(\mathbb{R}^d)$ , followed by an explicit signature inversion, which we discuss in the next section. Figure 1 presents an overview of the proposed idea, which we demonstrate experimentally in Section 5 to be an efficient and high-quality method for generating multivariate time series. + +We briefly recall that score-based diffusion models progressively corrupt data with noise until it reaches a tractable form, then learn to reverse this process to generate new samples from the underlying data distribution $p(\mathbf{x})$ . A neural network is used to estimate the gradient of the log probability density, known as the score (Song & Ermon, 2019), $s_{\theta}(t,\mathbf{x}) \approx \nabla_{\mathbf{x}}\log p_t(\mathbf{x})$ at each injected noise level $t$ . We model the forward data perturbation process with a stochastic differential equation (SDE) of the form + +$$ +d \mathbf {x} = - \frac {1}{2} \beta (t) \mathbf {x} d t + \sqrt {\beta (t)} d \mathbf {w}, \mathbf {x} (0) \sim \text {d a t a} \tag {4} +$$ + +where $\beta (t)$ is linear over $t\in [0,1]$ . The corresponding reverse diffusion process follows a reverse-time SDE (Anderson, 1982) $d\mathbf{x} = \left[-\frac{1}{2}\beta (t)\mathbf{x} - \beta (t)\nabla_{\mathbf{x}}\log p_t(\mathbf{x})\right]dt + \sqrt{\beta(t)} d\overline{\mathbf{w}}$ where $t$ flows backwards from $T$ to 0 and $\overline{\mathbf{w}}$ is Brownian motion with a negative time step $dt$ . The initial point $\mathbf{x}(T)$ is sampled from a standard Gaussian distribution. Following previous work (Ho et al., 2020; Bilos et al., 2023; Yuan & Qiao, 2024), we use a simple transformer architecture with sinusoidal positional embeddings of $t$ to model $s_\theta$ . + +# 3 SIGNATURE INVERSION + +In this section, we provide explicit signature inversion formulae. We do so by expressing the coefficients of the expansion of a path in the Fourier or orthogonal polynomial bases as a linear function on the signature. The necessary background material on orthogonal polynomials and Fourier series can be found in Appendix B. + +Throughout this section, $x:[0,1]\to \mathbb{R}$ will denote a 1-dimensional smooth path. The results in the sequel can be naturally extended to multidimensional paths by applying the same procedure channel by channel. Depending on the type of basis we chose to represent the path, we will often need to reparameterise the path from the interval [0, 1] to a specified time interval $[a,b]$ and augment it with time as well as with additional channels $c^1,c^2,\ldots ,c^r:[a,b]\to \mathbb{R}$ , tailor-made for the specific type of inversion. We denote the augmented path by $\hat{x} (t) = (t,c^{1}(t),\dots,c^{r}(t),x(t))\in \mathbb{R}^{r + 2}$ . Note that these transformations are fully deterministic and do not affect the complexity of the generation task outlined in Section 2.3. Furthermore, we will use the shorthand notation $S(\hat{x})$ for the step- $n$ signature $S^{\leq n}(\hat{x})$ throughout the section, and assume that the truncation level $n$ is always high enough to retrieve the desired number of basis coefficients. All proofs can be found in Appendix C. + +# 3.1 INVERSION VIA FOURIER COEFFICIENTS + +In this section, we derive closed-form expressions for retrieving the first $n$ Fourier coefficients of a path from its signature. First, recall that the Fourier series of a $2\pi$ -periodic path $x(t)$ up to order $n \in \mathbb{N}$ is $x_{n}(t) = a_{0} + \sum_{n=1}^{n} (a_{n}\cos(nt) + b_{n}\sin(nt))$ where $a_{0}, a_{n}, b_{n}$ are defined as + +$$ +a _ {0} = \frac {1}{2 \pi} \int_ {0} ^ {2 \pi} x (t) d t, \tag {5} +$$ + +$$ +a _ {n} = \frac {1}{\pi} \int_ {0} ^ {2 \pi} x (t) \cos (n t) d t, \tag {6} +$$ + +$$ +b _ {n} = \frac {1}{\pi} \int_ {0} ^ {2 \pi} x (t) \sin (n t) d t. \tag {7} +$$ + +Theorem 3.1. Let $x:[0,2\pi ]\to \mathbb{R}$ be a periodic smooth path such that $x(0) = 0$ , and consider the augmentation $\hat{x} (t) = (t,\sin (t),\cos (t) - 1,x(t))\in \mathbb{R}^4$ . Then the following relations hold + +$$ +a _ {0} = \frac {1}{2 \pi} \langle e _ {4} \succ e _ {1}, S (\hat {x}) \rangle , +$$ + +$$ +a _ {n} = \frac {1}{\pi} \sum_ {k = 0} ^ {n} \sum_ {q = 0} ^ {k} \binom {n} {k} \binom {k} {q} \cos \left(\frac {1}{2} (n - k) \pi\right) \left\langle \left(e _ {4} \sqcup e _ {2} ^ {\sqcup n - k} \sqcup e _ {3} ^ {\sqcup q}\right) \succ e _ {1}, S (\hat {x}) \right\rangle , \tag {8} +$$ + +$$ +b _ {n} = \frac {1}{\pi} \sum_ {k = 0} ^ {n} \sum_ {q = 0} ^ {k} {\binom {n} {k}} {\binom {k} {q}} \sin (\frac {1}{2} (n - k) \pi) \langle (e _ {4} \sqcup e _ {2} ^ {\sqcup n - k} \sqcup e _ {3} ^ {\sqcup q}) \succ e _ {1}, S (\hat {x}) \rangle . +$$ + +# 3.2 INVERSION VIA ORTHOGONAL POLYNOMIALS + +To accommodate path generation use cases for which a non-Fourier representation is more suitable, next we derive formulae for inverting the signature using expansions of the path in orthogonal polynomial bases. Recall that any orthogonal polynomial family $(p_n)_{n\in \mathbb{N}}$ with a weight function $\omega :[a,b]\to \mathbb{R}$ satisfies a three-term recurrence relation + +$$ +p _ {n} (t) = \left(A _ {n} t + B _ {n}\right) p _ {n - 1} (t) + C _ {n} p _ {n - 2} (t), \quad n \geq 2, \tag {9} +$$ + +with $p_0(t) = 1$ and $p_1(t) = A_1t + B_1$ . Also, note that any smooth (or at least square-integrable) path $x(t)$ with $x(a) = 0$ can be approximated arbitrarily well as $x(t) \approx \sum_{n=0}^{\infty} \alpha_n p_n(t)$ where $\alpha_n$ is the $n$ -th orthogonal polynomial coefficient + +$$ +\alpha_ {n} = \frac {1}{\left(p _ {n} , p _ {n}\right)} \int_ {a} ^ {b} x (t) p _ {n} (t) \omega (t) d t, \tag {10} +$$ + +and $(\cdot, \cdot)$ denotes the inner product $(f, g) = \int_{a}^{b} f(t)g(t)\omega(t)dt$ . We include several examples of such polynomial families in Appendix B. + +Theorem 3.2. Let $x:[a,b] \to \mathbb{R}$ be a smooth path such that $x(a) = 0$ . Consider the augmentation $\hat{x}(t) = (t,\omega(t)x(t)) \in \mathbb{R}^2$ , where $\omega(t)$ corresponds to the weight function of a system of orthogonal polynomials $(p_n)_{n \in \mathbb{N}}$ and is well defined on the closed and compact interval $[a,b]$ . Then there exists a linear combination $\ell_n$ of words such that the $n^{th}$ coefficient in Equation (10) satisfies $\alpha_n = \langle \ell_n, S(\hat{x}) \rangle$ . Furthermore, the sequence $(\ell_n)_{n \in \mathbb{N}}$ satisfies the following recurrence relation + +$$ +\ell_ {n} = A _ {n} \frac {(p _ {n - 1} , p _ {n - 1})}{(p _ {n} , p _ {n})} e _ {1} \succ \ell_ {n - 1} + (A _ {n} a + B _ {n}) \frac {(p _ {n - 1} , p _ {n - 1})}{(p _ {n} , p _ {n})} \ell_ {n - 1} + C _ {n} \frac {(p _ {n - 2} , p _ {n - 2})}{(p _ {n} , p _ {n})} \ell_ {n - 2}, +$$ + +with + +$$ +\ell_ {0} = \frac {A _ {0}}{(p _ {0} , p _ {0})} e _ {2 1} \quad a n d \quad \ell_ {1} = \frac {A _ {1}}{(p _ {1} , p _ {1})} (e _ {1 2 1} + e _ {2 1 1}) + \frac {A _ {1} a + B _ {1}}{(p _ {1} , p _ {1})} e _ {2 1}. +$$ + +Remark. The results in Theorem 3.2 require signatures of $\hat{x} = (t, w(t)x(t))$ . However, sometimes one may only have signatures of $\tilde{x} = (t, x(t))$ . In Appendix C.2 we propose an alternative method by approximating the weight function as a Taylor series. + +# 3.3 INVERSION TIME COMPLEXITY + +The inversion formulae all boil down to evaluating specific linear combinations of signature terms. Evaluating a linear functional has a time complexity linear in the size of the signature. Since this evaluation is repeated for each of the $n$ recovered basis coefficients, the total number of operations is $nm$ , where $n$ in the number of basis coefficients and $m$ is the length of the signature truncated at level $n + 2$ . For a $d$ -dimensional path, length of a step- $N$ signature is $\frac{d^{N + 1} - 1}{d - 1}$ , giving the inversion a time complexity of $O(nd^{n + 2})$ . + +# 4 RELATED WORK + +Multivariate time series generation Generating multivariate time series has been an active area of research in the past several years, predominantly relying on generative adversarial networks (GANs) (Goodfellow et al., 2014). Simple recurrent neural networks acting as generators and discriminators (Mogren, 2016; Esteban et al., 2017) later evolved into encoder-decoder architectures where the adversarial generation occurs in a learned latent space (Yoon et al., 2019; Pei et al., 2021; Jeon et al., 2022). To generate time series in continuous time, architectures based on neural differential equations in the latent space (Rubanova et al., 2019; Yildiz et al., 2019) have emerged as generalisations of RNNs. More flexible alternatives have since been proposed in the forms of neural controlled differential equations (Kidger et al., 2020) and state space ODEs (Zhou et al., 2023). + +Diffusion models for time series generation There are a number of denoising probabilistic diffusion models (DDPMs) currently at the forefront of time series synthesis, such as DiffTime (Ho et al., 2020), which reformulates the constrained time series generation problem in terms of conditional denoising diffusion (Tashiro et al., 2021). Most recently, Diffusion-TS (Yuan & Qiao, 2024) has demonstrated superior performance on benchmark datasets and long time series by disentangling temporal features via a Fourier-based training objective. To learn long-range dependencies, both the aforementioned methods use transformer-based (Vaswani et al., 2017) diffusion functions. Many recent efforts attempt to generalise score-based diffusion to infinite-dimensional function spaces (Kerrigan et al., 2022; Dutordoir et al., 2023; Phillips et al., 2022; Lim et al., 2023). However, unlike their discrete-time counterparts, they have not yet been benchmarked on a variety of real-world temporal datasets. An exception to this is a diffusion framework proposed by Biloš et al. (2023), which synthesises continuous time series by replacing the time-independent noise corruption with samples from a Gaussian process, forcing the diffusion to remain in the space of continuous functions. Another promising approach for training diffusion models in function space is the Denoising Diffusion Operators (DDOs) method (Lim et al., 2023). While it has not been previously applied to time series, our evaluation in Section 5 demonstrates its strong performance in this context. Additionally, there is a growing body of recent literature focusing on application-specific time series generation via diffusion models, such as speech enhancement (Lay et al., 2023; Lemercier et al., 2023), soft sensing (Dai et al., 2023), and battery charging behaviour (Li et al., 2024). + +Signature inversion The uniqueness property of signatures mentioned in Section 2.2 has motivated several previous attempts to answer the question of inverting the signature transform, mostly as theoretical contributions focusing on one specific class of paths (Lyons & Xu, 2017; Chang et al., 2016; Lyons & Xu, 2018). The only fast and scalable signature inversion strategy to date is the Insertion method (Chang & Lyons, 2019), which provides an algorithm and theoretical error bounds for inverting piecewise linear paths. It was recently optimised (Fermanian et al., 2023a) and released as a part of the Signatory (Kidger et al., 2019) package. There are also examples of inversion via deep learning (Kidger et al., 2019) and evolutionary algorithms (Buehler et al., 2020), but they provide no convergence guarantees and become largely inefficient when deployed on real-world time series. + +# 5 EXPERIMENTS + +In Section 5.1, we demonstrate that the newly proposed signature inversion method achieves more accurate reconstructions than the previous Insertion (Chang & Lyons, 2019; Germanian et al., 2023a) and Optimisation (Kidger et al., 2019) methods. We also analyse the inversion quality and time complexity across different families of orthogonal polynomials. In Section 5.2, we show that (log)signatures, + +![](images/cd13b4dc1f150909238f63929e2497df2dd5dde667743f76dc7639fdbfa45247.jpg) +Figure 2: Comparison of different inversion methods. + +![](images/f1fc2e8df4eab3d36ddabaf10ac1a004ea6e90bd573c28f619cb140b151eaf57.jpg) + +combined with our closed-form inversion, provide an exceptionally effective embedding for time series diffusion models. Section 5.2.1 visualises the trade-off between the precision of time series representation and model complexity introduced by the choice of the signature truncation level. In Section 5.2.2, we present experiments demonstrating that generating step-4 log-signatures via the pipeline outlined in Figure 1 outperforms other recent time series diffusion models across several standard metrics. + +# 5.1 INVERSION EVALUATION + +We perform experiments to evaluate the proposed analytical signature inversion formulae derived in Section 3 via several families of orthogonal bases. Using example paths given by sums of random sine waves with injected Gaussian noise, we reconstruct the original paths from their step-12 signatures. Figure 2 compares inversion of these paths via Legendre and Fourier coefficients to the Insertion method (Chang & Lyons, 2019; Germanian et al., 2023a) and Optimisation method (Kidger et al., 2019), showcasing the improvement in inversion quality provided by our explicit inversion formulae. Figure 3 presents the time consumption against the $L_{2}$ error as the degree of polynomials increases. Notably, the factor holding the most influence over the reconstruction quality is the truncation level of + +![](images/53765be921b38268fb506719caa4e05ff89671a5e16ebcd58e899a3207f58ee3.jpg) +Figure 3: $L_{2}$ error of signature inversion via orthogonal polynomials with respect to the polynomial order $N$ and time. Error and time are calculated by an average over 15 paths with 200 sample points. + +![](images/9c73d4cbcf199cf7346201da9b54ebc9710cb122a2f11b78272d0274968cdfba.jpg) + +the signature, as it bounds the order of polynomials we can retrieve. We refer the interested reader to a discussion about inversion quality in Appendix D. Namely, Figures 11 and 12 show more examples of inverted signatures using different types of paths and polynomial bases. + +# 5.2 GENERATING LONG TIME SERIES + +In this section, we introduce the SigDiffusions pipeline for generating multivariate time series by the following strategy, also illustrated in Figure 1: + +1. Choose an orthogonal basis and order $N$ sufficient to represent the time series with enough detail to retain its meaningful components while smoothing out unnecessary noise. +2. Compute the log-signatures of the time series, augmented as described in Section 3 and truncated at level $N + 2$ . + +3. Train and sample a score-based diffusion model to generate the log-signatures. +4. Invert the synthetic log-signatures back to time series using our formulae from Section 3. + +# 5.2.1 TIME SERIES REPRESENTATION AND MODEL CAPACITY + +Here, we highlight the trade-off between model capacity and the faithfulness of the time series representation as given by its truncated Fourier series. Since the signature inversion formulae are exact, the inversion quality depends only on how well the underlying signal is approximated by the retrieved Fourier basis coefficients. When the primary goal is to model the overall shape of a multivariate time series, it is sufficient to truncate the signature, and thus the Fourier series, at a low level. Low truncation levels capture most of this information, smooth out high-order noise, and simplify the generation task. In contrast, modelling signals with high-frequency components requires higher signature truncation levels, raising the complexity of the diffusion task. As the signature size grows exponentially with the truncation level, generating highly oscillatory time series with high fidelity becomes increasingly constrained by the model's capacity. To illustrate this, we show the generated samples from SigDiffusions trained on a noisy Lotka-Volterra system with different log-signature truncation levels in Figure 4. At each truncation level, the log-signatures become progressively more difficult to generate accurately. + +![](images/5da776875c69fa002260a9bb0fa35fb76060751ca22a938b5e4d861fddde3a24.jpg) +Figure 4: Time series representation and model capacity trade-off. Left to right: real sample from a noisy Lotka-Volterra system, sample generated by SigDiffusion with signature truncation level 3, 4, 5, 6. + +# 5.2.2 GENERATING STEP-4 LOG-SIGNATURES + +We now demonstrate the exceptional ability of signatures to capture the shape and cross-channel dependencies of time series at low truncation levels. We show that SigDiffusions applied to step-4 log-signatures, combined with Fourier inversion, outperform state-of-the-art diffusion-based models on the task of generating 1000-point-long time series. + +Datasets We perform experiments on five different time series datasets: Sines (Yoon et al., 2019) - a dataset of 5-dimensional sine curves with randomly sampled frequency and phase, Predator-prey (Biloš et al., 2023) - a two-dimensional continuous system evolving according to a set of ODEs, Household Electric Power Consumption (HEPC) (UCI Machine Learning Repository, 2024) - the univariate voltage feature from a real-world dataset of household power consumption, Exchange Rates (Lai et al., 2018; Lai, 2017) - a real-world dataset containing daily exchange rates of 8 currencies, and Weather (Kolle, 2024) - a real-world dataset reporting weather measurements. + +Metrics We use the metrics established in Yoon et al. (2019). The Discriminative Score reports the out-of-sample accuracy of a recurrent neural network (RNN) classifier trained to distinguish between real and generated time series. To improve readability, we report values offset by 0.5, so that in the ideal case, where real and generated samples are indistinguishable by the classifier, this metric will approach 0. The Predictive Score measures the loss of a next-point predictor RNN trained exclusively on synthetic data, with the loss evaluated on the real test data set. In the case of univariate time series, the RNN predicts the value of the time series 20 time points ahead, instead of predicting the value of an unseen channel. We also run the Kolmogorov-Smirnov (KS) test on marginal distributions of random batches of ground truth and generated paths. We repeat this test 1000 times with a batch size of 64 and report the mean KS score with the mean Type I error for a $5\%$ significance threshold. Since the cross-channel terms of the log-signature are not necessary for the inversion methods, we generate a concatenated vector of the log-signatures of each separate dimension plus the augmentation described in Section 3. + +Table 1: Results for generating time series of length 1000. + +
DatasetModelDiscriminative ScorePredictive Score
SinesSigDiffusion (ours)0.100±.0260.191±.004
DDO (γ = 1)0.040±.0250.187±.003
Diffusion-TS0.291±.0700.365±.006
CSPD-GP (RNN)0.468±.0300.244±.012
CSPD-GP (Transformer)0.493±.0030.390±.023
Predator-preySigDiffusion (ours)0.184±.0580.056±.000
DDO (γ = 10)0.211±.0800.056±.000
Diffusion-TS0.500±.0000.482±.023
CSPD-GP (RNN)0.168±.0240.057±.000
CSPD-GP (Transformer)0.498±.0030.919±.002
HEPCSigDiffusion (ours)0.070±.0320.050±.012
DDO (γ = 1)0.081±.0190.044±.001
Diffusion-TS0.438±.0570.066±.022
CSPD-GP (RNN)0.415±.0450.108±.002
CSPD-GP (Transformer)0.500±.0000.551±.028
Exchange RatesSigDiffusion (ours)0.278±.0620.057±.001
DDO (γ = 1)0.326±.1020.094±.004
Diffusion-TS0.401±.1960.120±.016
CSPD-GP (RNN)0.500±.0010.273±.100
CSPD-GP (Transformer)0.500±.0000.432±.074
WeatherSigDiffusion (ours)0.350±.0800.168±.001
DDO (γ = 10)0.356±.1960.307±.007
Diffusion-TS0.498±.0030.438±.035
CSPD-GP (RNN)0.500±.0000.505±.007
CSPD-GP (Transformer)0.500±.0000.490±.000
+ +Benchmarks Table 1 lists the time series generation performance metrics compared with four recent diffusion model architectures specifically designed to handle long or continuous-time paths: + +- Diffusion-TS (Yuan & Qiao, 2024) This model introduces a novel Fourier-based training objective to disentangle temporal features of different functionalities. This interpretable decomposition strategy makes the model particularly robust to varying time series lengths, demonstrating strong performance relative to other benchmarks as the training time series become longer. +- CSPD-GP (Biloš et al., 2023) This approach replaces the time-independent noise corruption mechanism with samples drawn from a Gaussian process, effectively modelling diffusion on time series as a process occurring within the space of continuous functions. CSPD-GP (RNN) and CSPD-GP (Transformer) refer to score-based diffusion models with the score function either being an RNN or a transformer. +- Denoising Diffusion Operators (DDO) (Lim et al., 2023) These models generalise diffusion models to function spaces with a Hilbert space-valued Gaussian process to perturb the input data. Additionally, they use neural operators for the score function, ensuring consistency with the underlying function space formulation. DDO's kernel smoothness hyperparameter $\gamma$ is tuned and reported for each dataset. + +We compute the metrics using 1000 samples from each model. Table 2 shows the model sizes and training times, demonstrating that SigDiffusion outperforms the other models while also having the most efficient architecture. Table 4 in the Appendix evaluates the time series marginals using the KS test. More details about the experimental setup can be found in Appendix E. + +Table 2: Comparison of model sizes. + +
DatasetModelParametersTraining TimeSampling Time
SinesSigDiffusion (ours)229K8 min11 sec
DDO (γ = 1)4.12M3.6 h42 min
Diffusion-TS4.18M57 min15 min
CSPD-GP (RNN)759K9 min1 min
CSPD-GP (Transformer)973K15 min5 min
Predator-preySigDiffusion (ours)211K8 min12 sec
DDO (γ = 10)4.12M3.5 h42 min
Diffusion-TS4.17M55 min14 min
CSPD-GP (RNN)758K8 min1 min
CSPD-GP (Transformer)972K16 min5 min
HEPCSigDiffusion (ours)206K8 min12 sec
DDO (γ = 1)4.12M2.6 h42 min
Diffusion-TS4.17M50 min15 min
CSPD-GP (RNN)758K4 min1 min
CSPD-GP (Transformer)972K9 min5 min
Exchange ratesSigDiffusion (ours)247 K9 min11 sec
DDO (γ = 1)4.12M3.6 h42 min
Diffusion-TS4.29 M1.2 h20 min
CSPD-GP (RNN)760 K11 min1 min
CSPD-GP (Transformer)974 K15 min6 min
WeatherSigDiffusion (ours)282K8 min12 sec
DDO (γ = 10)4.12M3.6 h42 min
Diffusion-TS4.3 M1.4 h20 min
CSPD-GP (RNN)763 K14 min1 min
CSPD-GP (Transformer)975 K17 min6 min
+ +# 6 CONCLUSION AND FUTURE WORK + +In this paper, we introduced SigDiffusion, a new diffusion model that gradually perturbs and denoises log-signature embeddings of long time series, preserving their Lie algebraic structure. To recover the path from its log-signature, we proved that the coefficients of the expansion of a path in a given basis, such as Fourier or orthogonal polynomials, can be expressed as explicit linear functionals on the signature, or equivalently as polynomial functions on the log-signature. These results provide explicit signature inversion formulae, representing a major improvement over signature inversion algorithms previously proposed in the literature. Finally, we demonstrated how combining SigDiffusion with these inversion formulae provides a powerful generative approach for time series that is competitive with state-of-the-art diffusion models for temporal data. + +As this is the first work on diffusion models for time series using signature embeddings, there are still many research directions to explore. To mitigate the rapid growth in the number of required signature features for high-frequency signals described in Section 5.2.1, future work could explore alternative embeddings to the signature. For example, other types of path developments derived from rough path theory, which embed temporal signals into (compact) Lie groups, such as those proposed by Cass & Turner (2024), may offer a more parsimonious representation. These alternatives retain many of the desirable properties of signatures, including the availability of a flat-space Lie algebra. However, it remains unclear how an inversion mechanism would work in these cases. Finally, it would be interesting to understand how discrete-time signatures (Diehl et al., 2023) could be leveraged to encode discrete sequences on Lie groups and potentially perform diffusion-based generative modelling for text. + +# ACKNOWLEDGMENTS + +Barbora Barancikova is supported by UK Research and Innovation [UKRI Centre for Doctoral Training in AI for Healthcare grant number EP/S023283/1]. + +# REFERENCES + +Brian DO Anderson. Reverse-time diffusion equation models. Stochastic Processes and their Applications, 12(3):313-326, 1982. +Imanol Perez Arribas, Christopher Salvi, and Lukasz Szpruch. Sig-sdes model for quantitative finance. In Proceedings of the First ACM International Conference on AI in Finance, pp. 1-8, 2020. +Kendall. Atkinson. Theoretical Numerical Analysis A Functional Analysis Framework. Texts in Applied Mathematics, 39. Springer New York, New York, NY, 3rd ed. 2009. edition, 2009. ISBN 1-282-33318-6. +Marin Biloš, Kashif Rasul, Anderson Schneider, Yuriy Nevmyvaka, and Stephan Gunnemann. Modeling temporal data as continuous functions with stochastic process diffusion. In International Conference on Machine Learning, pp. 2452-2470. PMLR, 2023. +Hans Buehler, Blanka Horvath, Terry Lyons, Imanol Perez Arribas, and Ben Wood. A data-driven market simulator for small data environments. arXiv preprint arXiv:2006.14498, 2020. +Ruojin Cai, Guandao Yang, Hadar Averbuch-Elor, Zekun Hao, Serge Belongie, Noah Snavely, and Bharath Hariharan. Learning gradient fields for shape generation. In Computer Vision-ECCV 2020: 16th European Conference, Glasgow, UK, August 23-28, 2020, Proceedings, Part III 16, pp. 364-381. Springer, 2020. +Thomas Cass and Christopher Salvi. Lecture notes on rough paths and applications to machine learning. arXiv preprint arXiv:2404.06583, 2024. +Thomas Cass and William F Turner. Free probability, path developments and signature kernels as universal scaling limits. arXiv preprint arXiv:2402.12311, 2024. +Jiawei Chang and Terry Lyons. Insertion algorithm for inverting the signature of a path. arXiv preprint arXiv:1907.08423, 2019. +Jiawei Chang, Nick Duffield, Hao Ni, and Weijun Xu. Signature inversion for monotone paths, 2016. +Kuo-Tsai Chen. Integration of paths, geometric invariants and a generalized baker-hausdorff formula. Annals of Mathematics, 65(1):163-178, 1957. +Kuo-Tsai Chen. Integration of paths-a faithful representation of paths by noncommutative formal power series. Transactions of the American Mathematical Society, 89(2):395-407, 1958. +WL Chow. On system of linear partial differential equations of the first order. Mathematische Annalen, 117(1):98-105, 1939. +Nicola Muca Cirone, Maud Lemercier, and Christopher Salvi. Neural signature kernels as infinite-width-depth-limits of controlled resnets. In International Conference on Machine Learning, pp. 25358-25425. PMLR, 2023. +Nicola Muca Cirone, Antonio Orvieto, Benjamin Walker, Christopher Salvi, and Terry Lyons. Theoretical foundations of deep selective state-space models. arXiv preprint arXiv:2402.19047, 2024. +Thomas Cochrane, Peter Foster, Varun Chhabra, Maud Lemercier, Terry Lyons, and Christopher Salvi. Sk-tree: a systematic malware detection algorithm on streaming trees via the signature kernel. In 2021 IEEE international conference on cyber security and resilience (CSR), pp. 35-40. IEEE, 2021. +Andrea Coletta, Sriram Gopalakrishnan, Daniel Borrajo, and Svitlana Vyetrenko. On the constrained time-series generation problem. Advances in Neural Information Processing Systems, 36, 2024. + +Yun Dai, Chao Yang, Kaixin Liu, Angpeng Liu, and Yi Liu. Timeddpm: Time series augmentation strategy for industrial soft sensing. IEEE Sensors Journal, 2023. +Joscha Diehl, Kurusch Ebrahimi-Fard, and Nikolas Tapia. Generalized iterated-sums signatures. Journal of Algebra, 632:801-824, 2023. +Vincent Dutordoir, Alan Saul, Zoubin Ghahramani, and Fergus Simpson. Neural diffusion processes. In International Conference on Machine Learning, pp. 8990-9012. PMLR, 2023. +Cristóbal Esteban, Stephanie L Hyland, and Gunnar Ratsch. Real-valued (medical) time series generation with recurrent conditional gans. arXiv preprint arXiv:1706.02633, 2017. +Adeline Germanian, Jiawei Chang, Terry Lyons, and Gérard Biau. The insertion method to invert the signature of a path. arXiv preprint arXiv:2304.01862, 2023a. +Adeline Germanian, Terry Lyons, James Morrill, and Christopher Salvi. New directions in the applications of rough path theory. IEEE BITs the Information Theory Magazine, 2023b. +Michel Fliess, Moustanir Lamnabhi, and Françoise Lamnabhi-Lagarrigue. An algebraic approach to nonlinear functional expansions. IEEE transactions on circuits and systems, 30(8):554-570, 1983. +Peter K Friz and Nicolas B Victoir. Multidimensional stochastic processes as rough paths: theory and applications, volume 120. Cambridge University Press, 2010. +Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial nets. Advances in neural information processing systems, 27, 2014. +Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. Advances in neural information processing systems, 33:6840-6851, 2020. +Blanka Horvath, Maud Lemercier, Chong Liu, Terry Lyons, and Christopher Salvi. Optimal stopping via distribution regression: a higher rank signature approach. arXiv preprint arXiv:2304.01479, 2023. +Yechan Hwang, Jinsu Lim, Young-Jun Lee, and Ho-Jin Choi. Augmentation for context in financial numerical reasoning over textual and tabular data with large-scale language model. In NeurIPS 2023 Second Table Representation Learning Workshop, 2023. +Mourad Ismail. Classical and quantum orthogonal polynomials in one variable/. Encyclopedia of mathematics and its applications; v. 98. Cambridge University Press, Cambridge, 2005. ISBN 9780521782012. +Zacharia Issa, Blanka Horvath, Maud Lemercier, and Christopher Salvi. Non-adversarial training of neural sdes with signature kernel scores. Advances in Neural Information Processing Systems, 36, 2024. +Jinsung Jeon, Jeonghak Kim, Haryong Song, Seunghyeon Cho, and Noseong Park. Gt-gan: General purpose time series synthesis with generative adversarial networks. Advances in Neural Information Processing Systems, 35:36999-37010, 2022. +Angelos Katharopoulos, Apoorv Vyas, Nikolaos Pappas, and François Fleuret. Transformers are rnns: Fast autoregressive transformers with linear attention. In International conference on machine learning, pp. 5156-5165. PMLR, 2020. +Gavin Kerrigan, Justin Ley, and Padhraic Smyth. Diffusion generative models in infinite dimensions. arXiv preprint arXiv:2212.00886, 2022. +Patrick Kidger, Patric Bonnier, Imanol Perez Arribas, Christopher Salvi, and Terry Lyons. Deep signature transforms. Advances in Neural Information Processing Systems, 32, 2019. +Patrick Kidger, James Morrill, James Foster, and Terry Lyons. Neural controlled differential equations for irregular time series. Advances in Neural Information Processing Systems, 33:6696-6707, 2020. + +Olaf Kolle. Documentation of the weather station on top of the roof of the institute building of the max-planck-institute for biogeochemistry. https://www.bgc-jena.mpg.de/wetter/, 2024. Accessed: 2024-08-24. +Guokun Lai. Multivariate time series data sets. https://github.com/laiguokun/multivariate-time-series-data, 2017. Accessed: 2024-08-24. +Guokun Lai, Wei-Cheng Chang, Yiming Yang, and Hanxiao Liu. Modeling long-and short-term temporal patterns with deep neural networks. In The 41st international ACM SIGIR conference on research & development in information retrieval, pp. 95-104, 2018. +Bunlong Lay, Simon Welker, Julius Richter, and Timo Gerkmann. Reducing the prior mismatch of stochastic differential equations for diffusion-based speech enhancement. arXiv preprint arXiv:2302.14748, 2023. +Jean-Marie Lemercier, Julius Richter, Simon Welker, and Timo Gerkmann. Storm: A diffusion-based stochastic regeneration model for speech enhancement and dereverberation. IEEE/ACM Transactions on Audio, Speech, and Language Processing, 2023. +Maud Lemercier, Christopher Salvi, Thomas Cass, Edwin V Bonilla, Theodoros Damoulas, and Terry J Lyons. Siggpde: Scaling sparse gaussian processes on sequential data. In International Conference on Machine Learning, pp. 6233-6242. PMLR, 2021a. +Maud Lemercier, Christopher Salvi, Theodoros Damoulas, Edwin Bonilla, and Terry Lyons. Distribution regression for sequential data. In International Conference on Artificial Intelligence and Statistics, pp. 3754-3762. PMLR, 2021b. +Siyang Li, Hui Xiong, and Yize Chen. Diffcharge: Generating ev charging scenarios via a denoising diffusion model. IEEE Transactions on Smart Grid, 2024. +Jae Hyun Lim. Score-based diffusion models in function space. https://github.com/lim0606/ddo, 2023. Accessed: 2024-09-21. +Jae Hyun Lim, Nikola B Kovachki, Ricardo Baptista, Christopher Beckham, Kamyar Azizzadenesheli, Jean Kossaifi, Vikram Voleti, Jiaming Song, Karsten Kreis, Jan Kautz, et al. Score-based diffusion models in function space. arXiv preprint arXiv:2302.07400, 2023. +Terry J Lyons. Differential equations driven by rough signals. Revista Matematica Iberoamericana, 14(2):215-310, 1998. +Terry J Lyons and Weijun Xu. Hyperbolic development and inversion of signature. Journal of Functional Analysis, 272(7):2933-2955, 2017. +Terry J Lyons and Weijun Xu. Inverting the signature of a path. Journal of the European Mathematical Society, 20(7):1655-1687, 2018. +Benoit B Mandelbrot and John W Van Ness. Fractional brownian motions, fractional noises and applications. SIAM review, 10(4):422-437, 1968. +Georg Manten, Cecilia Casolo, Emilio Ferrucci, Søren Wengel Mogensen, Christopher Salvi, and Niki Kilbertus. Signature kernel conditional independence tests in causal discovery for stochastic processes. arXiv preprint arXiv:2402.18477, 2024. +Olof Mogren. C-rnn-gan: Continuous recurrent neural networks with adversarial training. arXiv preprint arXiv:1611.09904, 2016. +James Morrill, Christopher Salvi, Patrick Kidger, and James Foster. Neural rough differential equations for long time series. In International Conference on Machine Learning, pp. 7829-7838. PMLR, 2021. +Alexandre Pannier and Christopher Salvi. A path-dependent pde solver based on signature kernels. arXiv preprint arXiv:2403.11738, 2024. + +Hengzhi Pei, Kan Ren, Yuqing Yang, Chang Liu, Tao Qin, and Dongsheng Li. Towards generating real-world time series data. In 2021 IEEE International Conference on Data Mining (ICDM), pp. 469-478. IEEE, 2021. +Angus Phillips, Thomas Seror, Michael Hutchinson, Valentin De Bortoli, Arnaud Doucet, and Emile Mathieu. Spectral diffusion processes. arXiv preprint arXiv:2209.14125, 2022. +Vadim Popov, Ivan Vovk, Vladimir Gogoryan, Tasnama Sadekova, and Mikhail Kudinov. Grad-tts: A diffusion probabilistic model for text-to-speech. In International Conference on Machine Learning, pp. 8599-8608. PMLR, 2021. +Rimhak Ree. Lie elements and an algebra associated with shuffles. Annals of Mathematics, 68(2): 210-220, 1958. +Jeremy Reizenstein. Calculation of iterated-integral signatures and log signatures. arXiv preprint arXiv:1712.02757, 2017. +Christophe Reutenauer. Free lie algebras. In Handbook of algebra, volume 3, pp. 887-903. Elsevier, 2003. +Yulia Rubanova, Ricky TQ Chen, and David K Duvenaud. Latent ordinary differential equations for irregularly-sampled time series. Advances in neural information processing systems, 32, 2019. +Christopher Salvi, Thomas Cass, James Foster, Terry Lyons, and Weixin Yang. The signature kernel is the solution of a goursat pde. SIAM Journal on Mathematics of Data Science, 3(3):873-899, 2021a. +Christopher Salvi, Maud Lemercier, Chong Liu, Blanka Horvath, Theodoros Damoulas, and Terry Lyons. Higher order kernel mean embeddings to capture filtrations of stochastic processes. Advances in Neural Information Processing Systems, 34:16635-16647, 2021b. +Christopher Salvi, Joscha Diehl, Terry Lyons, Rosa Preiss, and Jeremy Reizenstein. A structure theorem for streamed information. Journal of Algebra, 634:911-938, 2023. +Yang Song and Stefano Ermon. Generative modeling by estimating gradients of the data distribution. Advances in neural information processing systems, 32, 2019. +Yang Song, Jascha Sohl-Dickstein, Diederik P Kingma, Abhishek Kumar, Stefano Ermon, and Ben Poole. Score-based generative modeling through stochastic differential equations. arXiv preprint arXiv:2011.13456, 2020. +Morgan Stanley. Msml: Morgan stanley machine learning. https://github.com/morganstanley/MSML, 2024. Accessed: 2024-05-21. +Yusuke Tashiro, Jiaming Song, Yang Song, and Stefano Ermon. Csdi: Conditional score-based diffusion models for probabilistic time series imputation. Advances in Neural Information Processing Systems, 34:24804-24816, 2021. +Cécile Trotsett, Manuel Schürch, Amina Mollaysa, Ahmed Allam, and Michael Krauthammer. Generative time series models with interpretable latent processes for complex disease trajectories. In Deep Generative Models for Health Workshop NeurIPS 2023, 2023. +UCI Machine Learning Repository. Electric power consumption dataset. https://www.kaggle.com/datasets/uciml/electric-power-consumption-data-set, 2024. Accessed: 2024-05-21. +Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. Advances in neural information processing systems, 30, 2017. +Pascal Vincent. A connection between score matching and denoising autoencoders. Neural computation, 23(7):1661-1674, 2011. + +Vikram Voleti, Alexia Jolicoeur-Martineau, and Chris Pal. Mcvd-masked conditional video diffusion for prediction, generation, and interpolation. Advances in neural information processing systems, 35:23371-23385, 2022. +Cagatay Yildiz, Markus Heinonen, and Harri Lahdesmaki. Ode2vae: Deep generative second order odes with bayesian neural networks. Advances in Neural Information Processing Systems, 32, 2019. +Jinsung Yoon. Timegan: Temporal generative adversarial networks for time-series synthesis - main script. https://github.com/jsyoon0823/TimeGAN/blob/master/main_timegan.py, 2024. Accessed: 2024-05-21. +Jinsung Yoon, Daniel Jarrett, and Mihaela Van der Schaar. Time-series generative adversarial networks. Advances in neural information processing systems, 32, 2019. +Xinyu Yuan. Diffusion-ts: Diffusion models for time series. https://github.com/Y-debug-sys/Diffusion-TS, 2024. Accessed: 2024-05-21. +Xinyu Yuan and Yan Qiao. Diffusion-TS: Interpretable diffusion for general time series generation. In The Twelfth International Conference on Learning Representations, 2024. URL https://openreview.net/forum?id=4h1apFjO99. +Linqi Zhou, Michael Poli, Winnie Xu, Stefano Massaroli, and Stefano Ermon. Deep latent state space models for time-series generation. In International Conference on Machine Learning, pp. 42625-42643. PMLR, 2023. + +# APPENDIX + +This appendix is structured in the following way. In Appendix A we complement the material presented in Section 2 with additional details on the signature. In Appendix B, we provide examples of orthogonal polynomial families one can use for signature inversion due to the derived inversion formulae in Section 3. In Appendix C we provide proofs for the signature inversion Theorem 3.1 and Theorem 3.2. Appendix D contains additional examples and discussion about the quality of signature inversion by different bases. Appendix E provides details on the implementation of experiments. + +# A ADDITIONAL DETAILS ON THE SIGNATURE + +In this section, we establish the foundational algebraic framework for signatures in Appendix A.1. We then provide a mathematically rigorous definition of the (log)signature in Appendix A.2, building upon the introduction in Section 2. The section concludes with illustrative signature computation examples in Appendix A.3. + +# A.1 ALGEBRAIC SETUP + +For any positive integer $n \in \mathbb{N}$ , we consider the truncated tensor algebra over $\mathbb{R}^d$ + +$$ +T ^ {n} (\mathbb {R} ^ {d}) := \bigoplus_ {k = 0} ^ {n} (\mathbb {R} ^ {d}) ^ {\otimes k}, +$$ + +where $\otimes$ denotes the outer product of vector spaces. For any scalar $\alpha \in \mathbb{R}$ , we denote by $T_{\alpha}^{n}(\mathbb{R}^{d}) = \{A \in T^{n}(\mathbb{R}^{d}): A_{0} = \alpha\}$ the hyperplane of elements in $T^{n}(\mathbb{R}^{d})$ with the $0^{th}$ term equal to $\alpha$ . + +$T^n(\mathbb{R}^d)$ is a non-commutative algebra when endowed with the tensor product $\cdot$ defined for any two elements $A = (A_0, A_1, \ldots, A_n)$ and $B = (B_0, B_1, \ldots, B_n)$ of $T^n(\mathbb{R}^d)$ as follows + +$$ +A \cdot B = \left(C _ {0}, C _ {1}, \dots , C _ {n}\right) \in T ^ {n} \left(\mathbb {R} ^ {d}\right), \quad \text {w h e r e} \quad C _ {k} = \sum_ {i = 0} ^ {k} A _ {i} \otimes B _ {k - i} \in \left(\mathbb {R} ^ {d}\right) ^ {\otimes k}. \tag {11} +$$ + +The standard basis of $\mathbb{R}^d$ is denoted by $e_1, e_2, \ldots, e_d$ . We will refer to these basis elements as letters. Elements of the induced standard basis of $T^n(\mathbb{R}^d)$ are often referred to as words and abbreviated + +$$ +e _ {i _ {1} i _ {2} \dots i _ {k}} = e _ {i _ {1}} \otimes e _ {i _ {2}} \otimes \dots \otimes e _ {i _ {k}}, \quad \text {f o r} \quad 1 \leq i _ {1}, \dots , i _ {k} \leq d \text {a n d} 0 \leq k \leq n. +$$ + +We will make use of the dual pairing notation $\langle e_{i_1i_2\dots i_k},A\rangle \in \mathbb{R}$ to denote the $(i_1,\dots ,i_k)^{th}$ element of a tensor $A\in T^{n}(\mathbb{R}^{d})$ . This pairing is extended by linearity to any linear combination of words. + +Following Reutenauer (2003), the truncated tensor algebra $T^n(\mathbb{R}^d)$ carries several additional algebraic structures. + +Firstly, it is a Lie algebra, where the Lie bracket is the commutator + +$$ +[ A, B ] = A \cdot B - B \cdot A \quad \text {f o r} A, B \in T ^ {n} (\mathbb {R} ^ {d}). +$$ + +We denote by $\mathcal{L}^n (\mathbb{R}^d)$ the smallest Lie subalgebra of $T^n (\mathbb{R}^d)$ containing $\mathbb{R}^d$ . We note that the Lie algebra $\mathcal{L}^n (\mathbb{R}^d)$ is a vector space of dimension $\beta (d,n)$ with + +$$ +\beta (d, n) = \sum_ {k = 1} ^ {n} \frac {1}{k} \sum_ {i | k} \mu \left(\frac {k}{i}\right) d ^ {i}, +$$ + +where $\mu$ is the Möbius function (Reutenauer, 2003). Bases of this space are known as Hall bases (Reutenauer, 2003; Reizenstein, 2017). One of the most well-known bases is the Lyndon basis indexed by Lyndon words. A Lyndon word is a word occurring lexicographically earlier than any word obtained by cyclically rotating its elements. + +Secondly, $T^n(\mathbb{R}^d)$ is also a commutative algebra with respect to the shuffle product $\sqcup$ . On basis elements, the shuffle product of two words of length $r$ and $s$ (with $r + s \leq n$ ) is the sum over the + +$\binom{r+s}{s}$ ways of interleaving the two words. For a more formal definition, see Reutenauer (2003, Section 1.4). + +Related to the shuffle product is the right half-shuffle product $\succ$ defined recursively as follows: for any two words $e_{i_1\dots i_r}$ and $e_{j_1\dots j_s}$ and letter $e_j$ + +$$ +e _ {i _ {1} \dots i _ {r}} \succ e _ {j} = e _ {i _ {1} \dots i _ {r} j} \quad \text {a n d} \quad e _ {i _ {1} \dots i _ {r}} \succ e _ {j _ {1} \dots j _ {s}} = \left(e _ {i _ {1} \dots i _ {r}} \succ e _ {j _ {1} \dots j _ {s - 1}} + e _ {j _ {1} \dots j _ {s - 1}} \succ e _ {i _ {1} \dots i _ {r}}\right) \cdot e _ {j _ {s}}. +$$ + +The right half-shuffle product will be useful for carrying out computations in the next section. Note that the following relation between shuffle and right half-shuffle products holds (Salvi et al., 2023) + +$$ +e _ {i _ {1} \dots i _ {r}} \sqcup e _ {j _ {1} \dots j _ {s}} = e _ {i _ {1} \dots i _ {r}} \succ e _ {j _ {1} \dots j _ {s}} + e _ {j _ {1} \dots j _ {s}} \succ e _ {i _ {1} \dots i _ {r}}. +$$ + +Equipped with this algebraic setup, we can now introduce the signature. + +# A.2 THE (LOG)SIGNATURE + +Let $x:[0,1]\to \mathbb{R}^d$ be a smooth path. The step- $n$ signature $S^{\leq n}(x)$ of $x$ is defined as the following collection of iterated integrals + +$$ +S ^ {\leq n} (x) = \left(1, S _ {1} (x), \dots , S _ {n} (x)\right) \in T _ {1} ^ {n} (\mathbb {R} ^ {d}) \tag {12} +$$ + +where + +$$ +S _ {k} (x) = \int_ {0 \leq t _ {1} < \dots < t _ {k} \leq 1} d x _ {t _ {1}} \otimes \dots \otimes d x _ {t _ {k}} \in (\mathbb {R} ^ {d}) ^ {\otimes k} \quad \text {f o r} 1 \leq k \leq n. +$$ + +An important property of the signature is usually referred to as the shuffle identity. This result is originally due to Ree (1958). For a modern proof see (Cass & Salvi, 2024, Theorem 1.3.10). + +Lemma A.0.1 (Shuffle identity). (Ree, 1958) Let $x:[0,1]\to \mathbb{R}^d$ be a smooth path. For any two words $e_{i_1\dots i_r}$ and $e_{j_1\dots j_s}$ , with $0\leq r,s\leq n$ , the following two identities hold + +$$ +\left\langle e _ {i _ {1} \dots i _ {r}} \sqcup e _ {j _ {1} \dots j _ {s}}, S ^ {\le n} (x) \right\rangle = \left\langle e _ {i _ {1} \dots i _ {r}}, S ^ {\le n} (x) \right\rangle \left\langle e _ {j _ {1} \dots j _ {s}}, S ^ {\le n} (x) \right\rangle , +$$ + +$$ +\left\langle e _ {i _ {1} \dots i _ {r}} \succ e _ {j _ {1} \dots j _ {s}}, S ^ {\le n} (x) \right\rangle = \int_ {0} ^ {1} \left\langle e _ {i _ {1} \dots i _ {r}}, S ^ {\le n} (x) _ {t} \right\rangle d \left\langle e _ {j _ {1} \dots j _ {s}}, S ^ {\le n} (x) _ {t} \right\rangle , +$$ + +where $S^{\leq n}(x)_t$ is the step- $n$ signature of the path $x$ restricted to the interval $[0, t]$ . + +An example of simple computations using the shuffle identity is presented in Appendix A.3. + +Moreover, it turns out that the signature is more than just a generic element of $T_1^n(\mathbb{R}^d)$ ; in fact, its range has the structure of a Lie group as we shall explain next. Recall that the tensor exponential exp and the tensor logarithm log are maps from $T^n(\mathbb{R}^d)$ to itself defined as follows + +$$ +\exp (A) := \sum_ {k \geq 0} \frac {1}{k !} A ^ {\otimes k} \quad \text {a n d} \quad \log (\mathbf {1} + A) = \sum_ {k \geq 1} \frac {(- 1) ^ {k - 1}}{k} (A) ^ {\otimes k} \tag {13} +$$ + +where $\mathbf{1} = (1,0,\dots,0) \in T^n(\mathbb{R}^d)$ . It is a well-known fact that $\exp : T_0^n(\mathbb{R}^d) \to T_1^n(\mathbb{R}^d)$ and $\log : T_1^n(\mathbb{R}^d) \to T_0^n(\mathbb{R}^d)$ are mutually inverse. + +The step- $n$ free nilpotent Lie group is the image of the free Lie algebra under the exponential map + +$$ +\mathcal {G} ^ {n} \left(\mathbb {R} ^ {d}\right) = \exp \left(\mathcal {L} ^ {n} \left(\mathbb {R} ^ {d}\right)\right) \subset T _ {1} ^ {n} \left(\mathbb {R} ^ {d}\right). \tag {14} +$$ + +As its name suggests, $\mathcal{G}^n (\mathbb{R}^d)$ is a Lie group and plays a central role in the theory of rough paths (Friz & Victoir, 2010). + +Here comes the connection with signatures. It is established by the following fundamental result due to Chen (1957; 1958), which can also be viewed as a consequence of Chow's results in Chow (1939). + +Lemma A.0.2 (Chen-Chow). (Chen, 1957; 1958; Chow, 1939) The step- $n$ free nilpotent Lie group $\mathcal{G}^n(\mathbb{R}^d)$ is precisely the image of the step- $n$ signature map in Equation (12) when the latter is applied to all smooth paths in $\mathbb{R}^d$ + +$$ +\mathcal {G} ^ {n} (\mathbb {R} ^ {d}) = \{S ^ {\leq n} (x) \mid x: [ 0, 1 ] \rightarrow \mathbb {R} ^ {d} \text {s m o o t h} \}. +$$ + +# A.3 SIMPLE EXAMPLES OF SIGNATURE COMPUTATIONS + +In the following examples, we alter the notation so that for a path $x:[a,t]\to \mathbb{R}^d$ , the tensor representing the $k$ -th level of the signature computed on an interval $[a,t]$ is denoted as + +$$ +S (x) _ {a, t} ^ {(k)} = \left(S (x) _ {a, t} ^ {i _ {1}, \dots , i _ {k}}: i _ {1}, \dots , i _ {k} \in \{1, \dots , d \}\right) \in \left(\mathbb {R} ^ {d}\right) ^ {\otimes k}. \tag {15} +$$ + +Furthermore, we can express the value of $S(x)_{a,t}^{(k)}$ at a particular set of indices $i_1, \ldots, i_k \in \{1, \ldots, d\}$ as a $k$ -fold iterated integral + +$$ +S (x) _ {a, t} ^ {i _ {1}, \dots , i _ {k}} = \int_ {a < t _ {1} < \dots < t _ {k} < t} d x _ {t _ {1}} ^ {i _ {1}} \dots d x _ {t _ {k}} ^ {i _ {k}}. \tag {16} +$$ + +We assume that the signature is always truncated at a sufficiently high level $n$ , allowing us to denote the step- $n$ signature simply as + +$$ +S (x) _ {a, t} = \left(1, S (x) _ {a, t} ^ {(1)}, S (x) _ {a, t} ^ {(2)}, S (x) _ {a, t} ^ {(3)}, \dots , S (x) _ {a, t} ^ {(n)}\right) \in T _ {1} ^ {n} (\mathbb {R} ^ {d}). \tag {17} +$$ + +Example A.1 (Geometric interpretation of a 2-dimensional path). Consider a path $\hat{x} : [0,9] \to \mathbb{R}^2$ , where $\hat{x} = (x_t^1, x_t^2) = (t, x(t))$ . Here, $x(t)$ is defined as + +$$ +x _ {t} ^ {2} = x (t) = \left\{ \begin{array}{l l} \sqrt {3} t & \qquad t \in [ 0, 2 ] \\ 2 \sqrt {3} & \qquad t \in [ 2, 8 ] , \\ \sqrt {3} t - 6 \sqrt {3} & \qquad t \in [ 8, 9 ] \end{array} \right. +$$ + +which is continuous and piecewise differentiable. In this case, $\dot{x}_t^1 = 1$ , and $\dot{x}_t^2$ can be expressed as + +$$ +\dot {x} _ {t} ^ {2} = \dot {x} (t) = \left\{ \begin{array}{l l} \sqrt {3} & \qquad t \in (0, 2) \\ 0 & \qquad t \in (2, 8) . \\ \sqrt {3} & \qquad t \in (8, 9) \end{array} \right. +$$ + +One can compute the step- $n$ signature of $\hat{x}$ as + +$$ +\begin{array}{l} S (\hat {x}) _ {0, 9} = (1, S (\hat {x}) _ {0, 9} ^ {(1)}, S (\hat {x}) _ {0, 9} ^ {(2)}, S (\hat {x}) _ {0, 9} ^ {(3)}, \dots , S (\hat {x}) _ {0, 9} ^ {(n)}) \\ = (1, S (\hat {x}) _ {0, 9} ^ {1}, S (\hat {x}) _ {0, 9} ^ {2}, S (\hat {x}) _ {0, 9} ^ {1, 2}, S (\hat {x}) _ {0, 9} ^ {2, 1}, S (\hat {x}) _ {0, 9} ^ {1, 1, 1}, \ldots , S (\hat {x}) _ {0, 9} ^ {i _ {1}, \ldots , i _ {n}}), \\ \end{array} +$$ + +where + +$$ +S (\hat {x}) _ {0, 9} ^ {1} = \int_ {0 < s < 9} d x _ {s} ^ {1} = x _ {9} ^ {1} - x _ {0} ^ {1} = 9 +$$ + +$$ +S (\hat {x}) _ {0, 9} ^ {2} = \int_ {0 < s < 9} d x _ {s} ^ {2} = x _ {9} ^ {2} - x _ {0} ^ {2} = 3 \sqrt {3} +$$ + +$$ +S (\hat {x}) _ {0, 9} ^ {1, 1} = \int_ {0 < r < s < 9} d x _ {r} ^ {1} d x _ {s} ^ {1} = \int_ {0 < s < 9} x _ {s} ^ {1} d x _ {s} ^ {1} = \frac {1}{2} \left(x _ {s} ^ {1}\right) ^ {2} \Bigg | _ {0} ^ {9} = \frac {8 1}{2} +$$ + +$$ +S (\hat {x}) _ {0, 9} ^ {1, 2} = \int_ {0 < r < s < 9} d x _ {r} ^ {1} d x _ {s} ^ {2} = \int_ {0 < s < 9} s d x _ {s} ^ {2} = \int_ {0 < s < 9} s \dot {x} _ {s} ^ {2} d s = \left. \frac {\sqrt {3}}{2} s ^ {2} \right| _ {0} ^ {2} + \left. \frac {\sqrt {3}}{2} s ^ {2} \right| _ {8} ^ {9} = \frac {2 1}{2} \sqrt {3} +$$ + +$$ +S (\hat {x}) _ {0, 9} ^ {2, 1} = \int_ {0 < r < s < 9} d x _ {r} ^ {2} d x _ {s} ^ {1} = \int_ {0 < s < 9} x _ {s} ^ {2} d s = \frac {\sqrt {3}}{2} s ^ {2} \Big | _ {0} ^ {2} + 2 \sqrt {3} s \Big | _ {2} ^ {8} + \frac {\sqrt {3}}{2} s ^ {2} - 6 \sqrt {3} s \Big | _ {8} ^ {9} = \frac {3 3}{2} \sqrt {3} +$$ + +$$ +S (\hat {x}) _ {0, 9} ^ {2, 2} = \int_ {0 < r < s < 9} d x _ {r} ^ {2} d x _ {s} ^ {2} = \int_ {0 < s < 9} x _ {s} ^ {2} d x _ {s} ^ {2} = \frac {1}{2} \left(x _ {s} ^ {2}\right) ^ {2} \Bigg | _ {0} ^ {9} = \frac {2 7}{2}. +$$ + +From Figure 5, let $A_{-}$ and $A_{+}$ represent the signed value of the shaded region. The signed Lévy area of the path is defined as $A_{-} + A_{+}$ . In this case, the signed Lévy area is $-3\sqrt{3}$ . Surprisingly, + +$$ +\frac {1}{2} \left(S (\hat {x}) _ {0, 9} ^ {1, 2} - S (\hat {x}) _ {0, 9} ^ {2, 1}\right) = \frac {1}{2} \left(\frac {2 1}{2} \sqrt {3} - \frac {3 3}{2} \sqrt {3}\right) = - 3 \sqrt {3} = A _ {-} + A _ {+}, +$$ + +which is exactly the signed Lévy area. + +![](images/b1f945a4bb6e1ee013147bda7ea6b4884d19a782f5f3d9fc7e88b8ffd7070660.jpg) +Figure 5: Path in Example A.1. The shaded region represents the signed Lévy area. + +Another important example is given by the signature of linear paths. + +Example A.2 (Signatures of linear paths). Suppose there is a linear path $x:[a,b]\to \mathbb{R}^d$ . Then the path $x$ is linear in terms of $t$ , i.e. + +$$ +x _ {t} = x _ {a} + \frac {t - a}{b - a} (x _ {b} - x _ {a}). +$$ + +It follows that its derivative can be written as + +$$ +d x _ {t} = \frac {(x _ {b} - x _ {a})}{b - a} d t. +$$ + +Recalling the definition of a signature, it holds that + +$$ +\begin{array}{l} S (x) _ {a, b} ^ {i _ {1}, \dots , i _ {k}} = \int_ {a < t _ {1} < \dots < t _ {k} < b} d x _ {t _ {1}} ^ {i _ {1}} \dots d x _ {t _ {k}} ^ {i _ {k}} \\ = \frac {\prod_ {j = 1} ^ {k} \left(x _ {b} ^ {i _ {j}} - x _ {a} ^ {i _ {j}}\right)}{(b - a) ^ {k}} \int_ {a < t _ {1} < \dots < t _ {k} < b} d t _ {1} \dots d t _ {k} \\ = \frac {\prod_ {j = 1} ^ {k} \left(x _ {b} ^ {i _ {j}} - x _ {a} ^ {i _ {j}}\right)}{(b - a) ^ {k}} \frac {(b - a) ^ {k}}{k !} \\ = \frac {\prod_ {j = 1} ^ {k} \left(x _ {b} ^ {i _ {j}} - x _ {a} ^ {i _ {j}}\right)}{k !}. \\ \end{array} +$$ + +Therefore, the whole step- $n$ signature can be expressed as a tensor exponential of the linear increment $x_{b} - x_{a}$ + +$$ +S (x) _ {a, b} ^ {(k)} = \frac {\left(x _ {b} - x _ {a}\right) ^ {\otimes k}}{k !}, +$$ + +$$ +\begin{array}{l} S (x) _ {a, b} = \sum_ {k = 0} ^ {n} \frac {\left(x _ {b} - x _ {a}\right) ^ {\otimes k}}{k !} \\ = \exp_ {\otimes} \left(x _ {b} - x _ {a}\right). \\ \end{array} +$$ + +Chen's identity in Lemma 2.0.1 is one of the most fundamental algebraic properties of the signature as it describes the behaviour of the signature under the concatenation of paths. + +Definition A.1 (Concatenation). Consider two smooth paths $x: [a, b] \to \mathbb{R}^d$ and $y: [b, c] \to \mathbb{R}^d$ . Define the concatenation of $x$ and $y$ , denoted by $x * y$ as a path $[a, c] \to \mathbb{R}^d$ + +$$ +(x * y) _ {t} := \left\{ \begin{array}{l l} x _ {t} & \quad \text {i f a \leq t \leq b} \\ x _ {b} - y _ {b} + y _ {t} & \quad \text {i f b \leq t \leq c} \end{array} \right.. +$$ + +Chen's identity in Lemma 2.0.1 provides a method to simplify the analysis of longer paths by converting them into manageable shorter ones. If we have a smooth path $x:[t_0,t_n]\to \mathbb{R}^d$ , then inductively, we can decompose the signature of $x$ to + +$$ +S (x) _ {t _ {0}, t _ {n}} = S (x) _ {t _ {0}, t _ {1}} \cdot S (x) _ {t _ {1}, t _ {2}} \cdot \dots \cdot S (x) _ {t _ {n - 1}, t _ {n}}. +$$ + +Moreover, if we have a time series $(t_0,x_0),\dots,(t_n,x_n)\in \mathbb{R}^{d + 1}$ , we can treat $x$ as a piecewise linear path interpolating the data. Based on Example A.2, one can observe that + +$$ +S (x) _ {t _ {0}, t _ {n}} = \exp_ {\otimes} \left(x _ {t _ {1}} - x _ {t _ {0}}\right) \cdot \exp_ {\otimes} \left(x _ {t _ {2}} - x _ {t _ {1}}\right) \cdot \cdot \cdot \cdot \exp_ {\otimes} \left(x _ {t _ {n}} - x _ {t _ {n - 1}}\right), +$$ + +which is widely used in Python packages such as esig or iisignature. + +Example A.3 (Example of shuffle identity). Consider a smooth path $x = (x_{t}^{1},x_{t}^{2}):[a,b]\to \mathbb{R}^{2}$ . By integration by parts, we have + +$$ +\begin{array}{l} \langle e _ {1}, S (x) _ {a, b} \rangle \langle e _ {2}, S (x) _ {a, b} \rangle = \int_ {a < t < b} d x _ {t} ^ {1} \int_ {a < t < b} d x _ {t} ^ {2} \\ = \int_ {a < t < b} \dot {x} _ {t} ^ {1} d t \int_ {a < t < b} \dot {x} _ {t} ^ {2} d t \\ \stackrel {\mathrm {b y p a r t s}} {=} \int_ {a < t < b} \langle e _ {2}, S (x) _ {a, t} \rangle \dot {x} _ {t} ^ {1} d t + \int_ {a < t < b} \langle e _ {1}, S (x) _ {a, t} \rangle \dot {x} _ {t} ^ {2} d t \\ = \langle e _ {2, 1}, S (x) _ {a, b} \rangle + \langle e _ {1, 2}, S (x) _ {a, b} \rangle . \\ \end{array} +$$ + +By the shuffle identity, we have + +$$ +\begin{array}{l} \langle e _ {1}, S (x) _ {a, b} \rangle \langle e _ {2}, S (x) _ {a, b} \rangle = \langle e _ {1}, S (x) _ {a, b} \rangle \langle e _ {2}, S (x) _ {a, b} \rangle \\ = \langle e _ {1} \sqcup e _ {2}, S (x) _ {a, b} \rangle \\ = \left\langle e _ {1, 2} + e _ {2, 1}, S (x) _ {a, b} \right\rangle \\ = \left\langle e _ {1, 2}, S (x) _ {a, b} \right\rangle + \left\langle e _ {2, 1}, S (x) _ {a, b} \right\rangle , \\ \end{array} +$$ + +which is exactly the same as what we derived via integration by parts. + +Example A.4 (Example of half-shuffle computations). Consider a two-dimensional, real-valued smooth path $\hat{x} = (t,x(t)):[a,b]\to \mathbb{R}^2$ with $x(a) = 0$ . The elements of the first truncation level of the signature can be retrieved as follows: + +$$ +\langle e _ {1}, S (\hat {x}) _ {a, t} \rangle = \int_ {a} ^ {t} d s = t - a, \quad \langle e _ {2}, S (\hat {x}) _ {a, t} \rangle = \int_ {a} ^ {t} d (x (s)) = x (t) - x (a) = x (t). +$$ + +Then, one can express all integrals in terms of powers of $t - a$ and $x(t)$ by signatures of $\hat{x}$ . For example, let $n, m \in \mathbb{N}_0$ , + +$$ +\begin{array}{l} \int_ {a} ^ {b} (t - a) ^ {n} x (t) ^ {m} d t = \int_ {a} ^ {b} (t - a) ^ {n} x (t) ^ {m} d (t - a) \\ = \int_ {a} ^ {b} \left(\langle e _ {1}, S (\hat {x}) _ {a, t} \rangle\right) ^ {n} \left(\langle e _ {2}, S (\hat {x}) _ {a, t} \rangle\right) ^ {m} d \left(\langle e _ {1}, S (\hat {x}) _ {a, t} \rangle\right) \\ = \left\langle \left(e _ {1} ^ {\sqcup n} \sqcup e _ {2} ^ {\sqcup n m}\right) \succ e _ {1}, S (\hat {x}) _ {a, b} \right\rangle . \\ \end{array} +$$ + +# B ORTHOGONAL POLYNOMIALS AND FOURIER SERIES + +In this section, we introduce the background material on orthogonal polynomials and the Fourier series necessary for the signature inversion formulae presented in the next section. + +# B.1 ORTHOGONAL POLYNOMIALS + +# B.1.1 INNER PRODUCT AND ORTHOGONALITY + +Consider a dot product $(x,y) = \sum_{i=1}^{n} x_i y_i$ , where $x, y \in \mathbb{R}^n$ . For some weights $w_1, \dots, w_n \in \mathbb{R}_+$ , we can also define the weighted dot product $(x,y)_w = \sum_{i=1}^{n} w_i x_i y_i$ , where $(\cdot, \cdot)_w$ can be written as $(\cdot, \cdot)$ for simplicity. + +For $p \in [1, \infty)$ , $L_w^p(\Omega)$ is the linear space of measurable functions from $\Omega$ to $\mathbb{R}$ such that their weighted $p$ -norms are bounded, i.e. + +$$ +L _ {w} ^ {2} (\Omega) = \left\{v \text {i s m e a s u r a b l e i n} \Omega \left| \int_ {\Omega} | v (t) | ^ {2} w (t) d t < \infty \right. \right\}. +$$ + +For example, let $d\alpha$ be a non-negative Borel measure supported on the interval $[a,b]$ and $\mathbb{V} = L_w^2 (a,b)$ . One can define $(f,g) = \int_{a}^{b}f(t)g(t)d\alpha (t)$ as a Stieltjes integral for all $f,g\in \mathbb{V}$ . Note that if $\alpha (t)$ is absolutely continuous, which will be the setting throughout this section, then one can find a weight density $w(t)$ such that $d\alpha (t) = w(t)dt$ . In this case, the definition of the inner product over a function space reduces to an integral with respect to a weight function, i.e., + +$$ +(f, g) = \int_ {a} ^ {b} f (t) g (t) w (t) d t. +$$ + +We can then consider an orthogonal polynomial system to be orthogonal with respect to the weight function $w$ . We denote $\mathbb{P}[t] \subset L_w^2(\Omega)$ as the space of all polynomials. A polynomial of degree $n$ , $p \in \mathbb{P}_n[t]$ , is monic if the coefficient of the $n$ -th degree is one. + +Definition B.1 (Orthogonal polynomials). For an arbitrary vector space $\mathbb{V}$ , $u$ and $v$ are orthogonal if $(u, v) = 0$ for all $u, v \in \mathbb{V}$ . When $\mathbb{V} = \mathbb{P}[t]$ , a sequence of polynomials $(p_n)_{n \in \mathbb{N}} \in \mathbb{P}[t]$ is called orthogonal with respect to a weight function $w$ if for all $m \neq n$ , + +$$ +(p _ {n}, p _ {m}) = \int p _ {n} (t) p _ {m} (t) w (t) d t = 0, +$$ + +where $\deg(p_n) = n$ is the degree of a polynomial. Furthermore, we say the sequence of orthogonal polynomials is orthonormal if $(p_n, p_n) = 1$ for all $n \in \mathbb{N}$ . + +For simplification, the inner product notation $(\cdot ,\cdot)$ will be used without specifying the integral formulation for the orthogonal polynomials. To construct a sequence of orthogonal polynomials in Definition B.1, one can follow the Gram-Schmidt orthogonalisation process, which is stated below. + +Theorem B.1 (Gram-Schmidt orthogonalisation). The polynomial system $(p_n)_{n\in \mathbb{N}}$ with respect to the inner product $(\cdot ,\cdot)$ can be constructed recursively by + +$$ +p _ {0} = 1, \quad p _ {n} = t ^ {n} - \sum_ {i = 1} ^ {n - 1} \frac {\left(t ^ {n} , p _ {i}\right)}{\left(p _ {i} , p _ {i}\right)} p _ {i} \quad f o r n \geq 1. \tag {18} +$$ + +From the orthogonalisation process in Theorem B.1, we can see that the $n$ -th polynomial $p_n$ has degree $n$ exactly, which means $(p_n)_{n \in \mathbb{N}}$ is a basis spanning $\mathbb{P}[t]$ . Furthermore, the orthogonal construction makes the orthogonal polynomial system an orthogonal basis with respect to the corresponding inner product. The following proposition forms an explicit expression for coefficients of $(p_k)_{k \in \{0, \dots, n\}}$ in an arbitrary $n$ -th degree polynomial. + +Proposition B.1.1 (Orthogonal polynomial expansion). Consider an arbitrary polynomial $x(t) \in \mathbb{P}_n[t]$ . One can express $x(t)$ by a sequence of orthogonal polynomials $(p_k)_{k \in \{0, \dots, n\}}$ , i.e., + +$$ +x (t) = \sum_ {k = 0} ^ {n} \frac {\left(p _ {k} , x\right)}{\left(p _ {k} , p _ {k}\right)} p _ {k} (t). +$$ + +Remark. We have stated the orthogonal polynomial expansion for $x \in \mathbb{P}_n[t]$ . In general, by the closure of orthogonal polynomial systems in $L_w^2(a,b)$ , arbitrary $f \in L_w^2(a,b)$ can be written as an infinite sequence of orthogonal polynomials. + +$$ +f (t) = \sum_ {k = 0} ^ {\infty} \frac {(p _ {k} , f)}{(p _ {k} , p _ {k})} p _ {k} (t). +$$ + +The $N$ -th degree approximation of $f$ is the best approximating polynomial with a degree less or equal to $N$ , denoted by + +$$ +P _ {N} f (t) = \sum_ {k = 0} ^ {N} \frac {\left(p _ {k} , f\right)}{\left(p _ {k} , p _ {k}\right)} p _ {k} (t). \tag {19} +$$ + +# B.1.2 BASIC PROPERTIES + +Here, we will list the main properties of orthogonal polynomials significant for our application. + +# THE THREE-TERM RECURRANCE RELATION + +Theorem B.2 (Three-term recurrence relation). A system of orthogonal polynomials $(p_n)_{n\in \mathbb{N}}$ with respect to a weight function $w$ satisfies the three-term recurrence relation. + +$$ +p _ {0} (t) = 1, \quad p _ {1} (t) = A _ {1} t + B _ {1}, \quad p _ {n + 1} (t) = (A _ {n + 1} t + B _ {n + 1}) p _ {n} (t) + C _ {n + 1} p _ {n - 1} (t), +$$ + +for all $n\in \mathbb{N}$ , and $A_{i} > 0$ for all $i\in \mathbb{N}_0$ + +Before proving the recurrence relation, we will first show that an orthogonal polynomial is orthogonal to all polynomials with a degree lower than that of itself. + +Lemma B.2.1. A polynomial $q(t) \in \mathbb{P}_n[t]$ satisfies $(q, r) = 0$ for all $r(t) \in \mathbb{P}_m[t]$ with $m < n$ if and only if $q(t) = p_n(t)$ up to some constant coefficient, where $p_n(t)$ denotes the orthogonal polynomial with degree $n$ . + +Proof. $\Rightarrow$ : Consider $q(t) = \alpha_n t^n + O(t^{n-1})$ and $p_n(t) = \tilde{\alpha}_n t^n + O(t^{n-1})$ . Then we define + +$$ +s (t) = q (t) - \frac {\alpha_ {n}}{\tilde {\alpha} _ {n}} p _ {n} (t) = O (t ^ {n - 1}), +$$ + +which has a degree at most $n - 1$ . Therefore, for all $m < n$ , + +$$ +(s, p _ {m}) = (q, p _ {m}) - \frac {\alpha_ {n}}{\tilde {\alpha} _ {n}} (p _ {n}, p _ {m}) = 0. +$$ + +The former inner product $(q,p_m) = 0$ by assumption, while the latter inner product $(p_n,p_m) = 0$ by orthogonality. By Proposition B.1.1, + +$$ +s (t) = \sum_ {m = 0} ^ {n - 1} \frac {\left(p _ {m} , s\right)}{\left(p _ {m} , p _ {m}\right)} p _ {m} (t) = 0 \quad \Longrightarrow \quad q (t) = \frac {\tilde {\alpha} _ {n}}{\alpha_ {n}} p _ {n} (t). +$$ + +$\Longleftarrow$ : Consider $r(t) = \sum_{k=0}^{m} r_k p_k(t)$ . Let $q(t) = c p_n(t)$ . Using the linearity of the inner product and orthogonality of $(p_n)_{n \in \mathbb{N}}$ , for all $m < n$ , + +$$ +(q, r) = \left(c p _ {n} (t), \sum_ {k = 0} ^ {m} r _ {k} p _ {k} (t)\right) = c \sum_ {k = 0} ^ {m} r _ {k} (p _ {n} (t), p _ {k} (t)) = 0. +$$ + +![](images/c3e666f6353f98df67e6d0dafa89f6065fa875d1939154d7c31da467dae1b964.jpg) + +Now, we have enough tools to prove the famous three-term recurrence relation. + +Proof of Theorem B.2. Consider a sequence of orthogonal polynomials $(p_n)_{n\in \mathbb{N}}$ . When $n = 1$ , $p_1$ can be expressed as $A_{1}t + B_{1}$ for $A_{1},B_{1}\in \mathbb{R}$ . This is because $p_1$ is an element in an orthogonal basis with degree 1. Based on the inner product of orthogonal polynomials, + +$$ +(p _ {k}, t p _ {n}) = \int t p _ {k} (t) p _ {n} (t) w (t) d t = (t p _ {k}, p _ {n}). +$$ + +Therefore, for $0 \leq k < n - 1$ , we have $(p_k, tp_n) = 0$ by Lemma B.2.1. Since $tp_n(t)$ has degree $n + 1$ , by Proposition B.1.1, + +$$ +\begin{array}{l} t p _ {n} (t) = \sum_ {k = 0} ^ {n + 1} \frac {\left(p _ {k} , t p _ {n}\right)}{\left(p _ {k} , p _ {k}\right)} p _ {k} (t) = \sum_ {k = n - 1} ^ {n + 1} \frac {\left(p _ {k} , t p _ {n}\right)}{\left(p _ {k} , p _ {k}\right)} p _ {k} (t) = \alpha_ {n - 1} p _ {n - 1} (t) + \alpha_ {n} p _ {n} (t) + \alpha_ {n + 1} p _ {n + 1} (t) \\ \Longrightarrow p _ {n + 1} = \left(\frac {1}{\alpha_ {n + 1}} t - \frac {\alpha_ {n}}{\alpha_ {n + 1}}\right) p _ {n} (t) - \frac {\alpha_ {n - 1}}{\alpha_ {n + 1}} p _ {n - 1} (t). \\ \end{array} +$$ + +![](images/aab99a50a5c8af61a90cdea6af33858f261c21c6961e44c2660512f70c62cd8b.jpg) + +Remark. Recurrence is the core property of orthogonal polynomials in our setting, as one can find higher-order coefficients based on lower-order coefficients given the analytical form of the orthogonal polynomials. This idea coincides with the shuffle identity of signatures. As stated in Theorem 3.2, one can construct an explicit recurrence relation for the coefficients of orthogonal polynomials by linear functionals acting on signatures. + +# APPROXIMATION RESULTS FOR FUNCTIONS IN $L_{w}^{2}$ + +Without loss of generality, consider $f \in L_w^2 (-1,1)$ , as we can always transform an arbitrary interval $[a,b]$ linearly into the interval $[-1,1]$ . Recall the $N$ -th degree approximation $P_{N}f(t)$ defined in Equation (19). The uniform convergence of the $N$ -th degree approximation $P_{N}f(t)$ to $f$ can be found in Atkinson (2009), where we obtain + +$$ +\frac {1}{\sqrt {2 \pi}} \| f - P _ {N} f \| _ {2} \leq \| f - P _ {N} f \| _ {\infty} \leq (1 + \| P _ {N} \|) \| f - q \| _ {\infty}, \qquad q \in \mathbb {P} _ {N}, +$$ + +where $\| P_N\|$ relates to the system of orthogonal polynomials, and $\| f - q\|_{\infty}$ depends on the smoothness of $f$ . In the case of Chebyshev polynomials, where the weight function is $w(t) = 1 / \sqrt{1 - t^2}$ , $\| P_N\| = \frac{4}{\pi}\log n + \mathcal{O}(1)$ (Atkinson, 2009). For some $\alpha \in (0,1]$ , + +$$ +\| f - P _ {N} f \| _ {2} \leq c _ {k} \frac {\log N}{N ^ {k + \alpha}} \quad \text {f o r} N \geq 2. +$$ + +This bound result is shown numerically in Figure 6. + +![](images/28c89371f9d58ff0e91fc7b87738ba24662e740bc120dec2a40edce187414dd1.jpg) + +![](images/57ba30d96730157d7d2e4fe90ee61610a3a2dc6cc5b4a60a967793759f25b032.jpg) + +![](images/ec4ffcd7da3573f43719762c484f007fd63d4c009020bad0180bb38b2e017ff6.jpg) + +![](images/a1a902d73f3bd401f284386a228e985894a078fb33b00d8d7550dc23ebdc9246.jpg) + +![](images/2640796c02624272fdd0bece885ce72a32ead35aba56cef7004540e8f426d31b.jpg) +Figure 6: The approximation quality (left) and convergence of the $L_{2}$ error (right) for Chebyshev polynomials of increasing degree $N$ . As $N$ increases, the colours change from blue to red in the left column. Paths are given by (top to bottom): $x_{1}(t) = \cos(10t) - \sin(2\pi t)$ , $x_{2}(t) = \sin(10t) + e^{2t} - t$ , $x_{3}(t) = 2|2t - 1| - 1$ . + +![](images/38918e0f3c7983d28eac1235f07abc4ae88ca458be016d0c295bfb2a59969620.jpg) + +# B.1.3 EXAMPLES + +In this subsection, we will provide two general orthogonal polynomial families, Jacobi polynomials and Hermite polynomials, which will be used for signature inversion in the next section. Figure 7 visualises the first few polynomials of these two kinds. + +![](images/e1262b7abf45995d6473ae1e0b3c2d97f688a796c1fbcd0bfb9978e412758ae5.jpg) +Figure 7: Visualisation of the first 7 Legendre and Hermite polynomials. + +![](images/52f8ab945ca2a248a8c60874aa8bb78e329dd1199876f626070e2f10ec52980d.jpg) + +# JACOBI POLYNOMIALS + +Jacobi polynomials $p_n^{(\alpha, \beta)}$ are a system of orthogonal polynomials with respect to the weight function $w: (-1, 1) \to \mathbb{R}$ such that + +$$ +w (t; \alpha , \beta) = (1 - t) ^ {\alpha} (1 + t) ^ {\beta}. +$$ + +There are many well-known special cases of Jacobi polynomials, such as Legendre polynomials $p_n^{(0,0)}$ and Chebyshev polynomials $p_n^{(-1/2,-1/2)}$ . In general, the analytical expression of Jacobi polynomials (Ismail, 2005) is defined by the hypergeometric function ${}_2F_1$ : + +$$ +p _ {n} ^ {(\alpha , \beta)} (t) = \frac {(\alpha + 1) _ {n}}{n !} _ {2} F _ {1} (- n, 1 + \alpha + \beta + n; \alpha + 1; \frac {1}{2} (1 - t)), +$$ + +where $(\alpha + 1)_n$ is the Pochhammer's symbol. For orthogonality, Jacobi polynomials satisfy + +$$ +\int_ {- 1} ^ {1} (1 - t) ^ {\alpha} (1 + t) ^ {\beta} p _ {m} ^ {(\alpha , \beta)} (t) p _ {n} ^ {(\alpha , \beta)} (t) = \frac {2 ^ {\alpha + \beta + 1} \Gamma (n + \alpha + 1) \Gamma (n + \beta + 1)}{(2 n + \alpha + \beta + 1) \Gamma (n + \alpha + \beta + 1) n !} \delta_ {n m}, \qquad \alpha , \beta > - 1, +$$ + +where $\delta_{mn}$ is the Kronecker delta. For fixed $\alpha, \beta$ , the recurrence relation of Jacobi polynomials is + +$$ +\begin{array}{l} p _ {n} ^ {(\alpha , \beta)} (t) = \frac {2 n + \alpha + \beta - 1}{2 n (n + \alpha + \beta) (2 n + \alpha + \beta - 2)} \left((2 n + \alpha + \beta) (2 n + \alpha + \beta - 2) t + \alpha^ {2} - \beta^ {2}\right) p _ {n - 1} ^ {(\alpha , \beta)} (t) \\ - \frac {(n + \alpha - 1) (n + \beta - 1) (2 n + \alpha + \beta)}{n (n + \alpha + \beta) (2 n + \alpha + \beta - 2)} p _ {n - 2} ^ {(\alpha , \beta)} (t). \\ \end{array} +$$ + +# HERMITE POLYNOMIALS + +Hermite polynomials are a system of orthogonal polynomials with respect to the weight function $w: (-\infty, \infty) \to \mathbb{R}$ such that $w(t) = \exp(-t^2/2)$ . These are called the probabilist's Hermite polynomials, which we will use throughout the section. There is another form called the physicist's Hermite polynomials with respect to the weight function $w(t) = \exp(-t^2)$ . The explicit expression of the probabilist's Hermite polynomials can be written as + +$$ +H _ {n} (t) = n! \sum_ {m = 0} ^ {\lfloor \frac {n}{2} \rfloor} \left(- \frac {1}{2}\right) ^ {m} \frac {t ^ {n - 2 m}}{m ! (n - 2 m) !}, +$$ + +with the orthogonality property + +$$ +\int_ {- \infty} ^ {\infty} H _ {m} (t) H _ {n} (t) e ^ {- \frac {t ^ {2}}{2}} d t = \sqrt {2 \pi} n! \delta_ {m n}. \tag {20} +$$ + +Lastly, we state the recurrence relation of Hermite polynomials as $H_{n + 1}(t) = xH_n(t) - nH_{n - 1}(t)$ . Note that the weight of Hermite polynomials can be viewed as an unnormalised normal distribution. If we are more interested in a particular region far away from the origin, we can define a "shift-and-scale" version of Hermite polynomials with respect to the weight + +$$ +w ^ {t _ {0}, \epsilon} (t) = \exp \left(\left(t - t _ {0}\right) ^ {2} / 2 \epsilon^ {2}\right), +$$ + +where $t_0$ denotes the new centre, and $\epsilon$ is the standard deviation. Let $(H_n^{t_0,\epsilon})_{n\in \mathbb{N}}$ denote the shift-andscale Hermite polynomials. Then, the orthogonality property is + +$$ +\int_ {- \infty} ^ {\infty} H _ {m} ^ {t _ {0}, \epsilon} (t) H _ {n} ^ {t _ {0}, \epsilon} (t) e ^ {- \frac {(t - t _ {0}) ^ {2}}{2 \epsilon^ {2}}} d t = \epsilon \int_ {- \infty} ^ {\infty} H _ {m} ^ {t _ {0}, \epsilon} (t _ {0} + \epsilon y) H _ {n} ^ {t _ {0}, \epsilon} (t _ {0} + \epsilon y) e ^ {- \frac {y ^ {2}}{2}} d y, +$$ + +by substitution $y = (t - t_0) / \epsilon$ . Hence, if + +$$ +H _ {n} ^ {t _ {0}, \epsilon} (t _ {0} + \epsilon y) = H _ {n} (y), \quad n \in \mathbb {N}, \tag {21} +$$ + +then $(H_n^{t_0,\epsilon})_{n\in \mathbb{N}}$ is an orthogonal polynomial system with orthogonality + +$$ +\int_ {- \infty} ^ {\infty} H _ {m} ^ {t _ {0}, \epsilon} (t) H _ {n} ^ {t _ {0}, \epsilon} (t) e ^ {- \frac {(t - t _ {0}) ^ {2}}{2 \epsilon^ {2}}} d t = \epsilon \int_ {- \infty} ^ {\infty} H _ {m} (y) H _ {n} (y) e ^ {- \frac {y ^ {2}}{2}} d y = \epsilon \sqrt {2 \pi} n! \delta_ {m n}, +$$ + +which follows from the orthogonality of Hermite polynomials in Equation (20). Similarly, the connection between Hermite and shift-and-scale Hermite polynomials in Equation (21) provides a way to find the explicit form and recurrence relation of $(H_n^{t_0,\epsilon})_{n\in \mathbb{N}}$ , which are + +$$ +H _ {n} ^ {t _ {0}, \epsilon} (t) = n! \sum_ {m = 0} ^ {\lfloor \frac {n}{2} \rfloor} \left(- \frac {1}{2}\right) ^ {m} \frac {1}{m ! (n - 2 m) !} \left(\frac {t - t _ {0}}{\epsilon}\right) ^ {n - 2 m}, \tag {22} +$$ + +$$ +H _ {n + 1} ^ {t _ {0}, \epsilon} (t) = \frac {1}{\epsilon} \left(t - t _ {0}\right) H _ {n} ^ {t _ {0}, \epsilon} (t) - n H _ {n - 1} ^ {t _ {0}, \epsilon} (t). \tag {23} +$$ + +Remark. Note that there is a simple expression for $(H_n^{t_0,\epsilon})_{n\in \mathbb{N}}$ at $t = t_0$ . One can easily observe that + +$$ +H _ {n} ^ {t _ {0}, \epsilon} (t _ {0}) = \left\{ \begin{array}{l l} \left(- \frac {1}{2}\right) ^ {\frac {n}{2}} \frac {n !}{\frac {n}{2} !} & \text {f o r e v e n n} \\ 0 & \text {f o r o d d n} \end{array} \right.. +$$ + +# B.2 FOURIER SERIES + +One can also represent a function by a trigonometric series. Here, we only present a brief introduction to the Fourier series, providing complementary details to the main result in Theorem 3.1. + +# B.2.1 TRIGONOMETRIC SERIES + +Let $f \in L^{1}(-\pi, \pi)$ . The Fourier series of $f$ is defined by + +$$ +F (t) = \frac {a _ {0}}{2} + \sum_ {k = 1} ^ {\infty} \left(a _ {k} \cos (k t) + b _ {k} \sin (k t)\right), +$$ + +where + +$$ +a _ {k} = \frac {1}{\pi} \int_ {- \pi} ^ {\pi} f (t) \cos (k t) d x, \qquad k \geq 0 +$$ + +$$ +b _ {k} = \frac {1}{\pi} \int_ {- \pi} ^ {\pi} f (t) \sin (k t) d x, \qquad k \geq 1, +$$ + +which can be derived from the orthogonal bases $\{\cos kt\}_k$ and $\{\sin kt\}_k$ . More generally, we can extend the period to $2l \in \mathbb{R}$ . For $f \in L^1(-l,l)$ and $k \in \mathbb{Z}$ , + +$$ +F (t) = \sum_ {n = - \infty} ^ {\infty} c _ {k} e ^ {i \frac {2 \pi}{l} k t}, \quad c _ {k} = \frac {1}{l} \int_ {0} ^ {l} f (t) e ^ {- i \frac {2 \pi}{l} k t} d t. \tag {24} +$$ + +In the setting of the Fourier series, the expression for the $k$ -th coefficient $c_{k}$ in the exponential form can be defined as a linear functional $\mathcal{L}_k(x) = c_k^x$ on the space of Fourier series, for $x\in L^{1}(-l,l)$ . + +# B.2.2 CONVERGENCE + +Under some regularity conditions, $F(t)$ converges to $f(t)$ (Atkinson, 2009). To examine the convergence of the Fourier series, we define the partial sum of the Fourier series as + +$$ +S _ {N} f (t) = \frac {a _ {0}}{2} + \sum_ {k = 1} ^ {N} \left(a _ {k} \cos (k t) + b _ {k} \sin (k t)\right). +$$ + +Now we present pointwise convergence and uniform convergence results (Atkinson, 2009) of the Fourier series for various functions. + +Theorem B.3 (Pointwise convergence for bounded variation). For a $2\pi$ -periodic function $f$ of bounded variation on $[- \pi, \pi]$ , its Fourier series at an arbitrary $t$ converges to + +$$ +\frac {1}{2} \left(f (t ^ {-}) + f (t ^ {+})\right). +$$ + +Theorem B.4 (Uniform convergence for piecewise smooth functions). If $f$ is a $2\pi$ -periodic piecewise smooth function, + +(a) if $f$ is also continuous, then the Fourier series converges uniformly and continuously to $f$ ; +(b) if $f$ is not continuous, then the Fourier series converges uniformly to $f$ on every closed interval without discontinuous points. + +Theorem B.5 (Uniform error bounds). Let $f \in C_p^{k,\alpha}(2\pi)$ be a 2π-periodic $k$ -times continuously differentiable function that is Hölder continuous with the exponent $\alpha \in (0,1]$ . Then, the 2-norm and infinity-norm bound of the partial sum $S_N f$ can be expressed as + +$$ +\frac {1}{\sqrt {2 \pi}} \| f - S _ {N} f \| _ {2} \leq \| f - S _ {N} f \| _ {\infty} \leq c _ {k} \frac {\log N}{N ^ {k + \alpha}}, \quad \text {f o r} N \geq 2. +$$ + +For functions only defined on an interval $[a,b]$ , we can always shift and extend them to be $2\pi$ -periodic functions. These theorems guarantee the convergence of common functions we will use in later experiments. To illustrate this, Figure 8 compares the convergence theorem bounds to numerical approximation results. Note that compared with the path $x_{2}(t) = \sin (10t) + e^{2t} - t$ , the other 2 paths have better empirical convergence results. The main reason is that the Fourier series of $x_{2}$ at $t = \pm 1$ does not pointwise converge to $x_{2}(\pm 1)$ . Since the Fourier series treats the interval $[-1,1]$ as one period over $\mathbb{R}$ , by Theorem B.3, the series will converge to $(x_{2}(-1) + x_{2}(1)) / 2$ at $t = \pm 1$ , leading to incorrect convergence at boundaries. This property also arises in real-world non-periodic time series, leading us to introduce the mirror augmentation later in Appendix E. + +Comparing Figures 6 and 8, one can observe that orthogonal polynomials are better at approximating continuously differentiable paths, while the Fourier series is better at estimating paths with spikes, and its computation is more stable in the long run. In a later section, Figure 9 provides a summary of convergence results for different types of orthogonal polynomials and Fourier series, which also match the results shown here. + +# B.3 APPROXIMATION QUALITY OF ORTHOGONAL POLYNOMIALS AND FOURIER SERIES + +Finally, we present a numerical comparison of the approximation results given by the methods introduced above. + +In particular, we will visualise the approximation results of the following objects: + +Legendre polynomials: $w(t) = 1$ +- two types of Jacobi polynomials: $w(t) = \sqrt{1 + t}$ , $w(t) = \sqrt{1 - t}$ +- three types of shift-and-scale Hermite polynomials with different variance for pointwise approximation: $\epsilon = 0.1, 0.05, 0.01$ +Fourier series + +For pointwise approximation via the Hermite polynomials, each sample point $t_i$ of the function will be approximated by a system of Hermite polynomials centred at the point $t_i$ , i.e., $(H_n^{t_i,\epsilon})_{n\in \mathbb{N}}$ . To test the approximation quality, we simulate random polynomial functions and random trigonometric functions. The $L_2$ error is then obtained by an average over 10 functions of each type. + +# B.3.1 APPROXIMATION RESULTS + +Figure 9 demonstrates the reduction in $L_{2}$ error as the order of orthogonal polynomials and Fourier series increases. Among all the bases considered, the Fourier series provides the least accurate approximation for both path types. This is due to its inability to guarantee pointwise convergence at $\pm 1$ , which is caused by boundary inconsistencies. Three types of Jacobi polynomials, including + +![](images/b517297826857a1fde93c749df814e2b5c9c5dce7afa4eed9e39efd10e60176a.jpg) + +![](images/fb660d73ad0991f82781253cd04b1cf53d67cc463a6e2b20821a0a5c4ef1c110.jpg) + +![](images/8fbb29bd6abdbb61461cbfe5e9501042e6d7e39be44be1f282c6ea0b5773fbfd.jpg) + +![](images/d5d1dad525177979158ed0b5b6201cf8bbc58bbfc3d4899a439be81321c03dfd.jpg) + +![](images/06ea347231a89b20a6dafedd247f1338c1143e574bd4e95402ef5602118ab0e3.jpg) +Figure 8: Approximation (left) and $L_{2}$ convergence (right) results for Fourier series by increasing order $N$ , with the same experimental setting as Figure 6. + +![](images/5690d0e7df33f39ab0061aeaf3f0a49ac5bc910b40562751a4e0b31fa4abfd98.jpg) + +Legendre polynomials, show comparable approximation results, with a slight edge in convergence observed for Legendre polynomials. On the other hand, Hermite polynomials exhibit a much lower approximation error due to their shifting focus on the point of interest. However, decreasing $\epsilon$ to sharpen the focus on sample points can cause the coefficients of Hermite polynomials to inflate rapidly. This behaviour is consistent with the analytic form and recurrence relation of the shift-and-scale Hermite polynomials, as detailed in Equation (22) and Equation (23). As a result, Hermite polynomials with $\epsilon = 0.01$ do not outperform those with $\epsilon = 0.05$ . The step-like pattern of decrease observed in Hermite polynomials can be traced back to Remark B.1.3. Figure 10 shows the $L_{2}$ approximation error of different bases for two of our real-world datasets. Here, we see that apart from using shift-and-scale Hermite polynomials which come with additional complexity (see Figure 3), the Fourier series seems to be the best candidate for approximation. + +![](images/98f420a6dc1ad8c05e94065851b78d9e22d143e9aebc9d361207cb2eedca95f1.jpg) +Figure 9: $L_{2}$ approximation error using different bases. The figures (from left to right) are the corresponding error averaged over 10 random polynomial and trigonometric functions. + +![](images/94158c5ad53b2be250156f57afd12635085387b77b4d72a494689b073685014b.jpg) + +To mitigate computational expense, we henceforth use Hermite polynomials with $\epsilon = 0.05$ as the representative of the Hermite family. The findings presented in Figures 9 and 10 play a crucial role + +![](images/99b49112e645171d61b2b696873dbbfd94bf555ba93f5ecfcc3080b90af41993.jpg) +Figure 10: Real data $L_{2}$ approximation error using different bases. The figures (from left to right) are the corresponding error averaged over 10 random samples from the HEPC and Exchange rates datasets. + +![](images/ebf964b5714acb0e28c02b6ba9ab4e0c366cf7d58902e3bf75d6f00b0085cc77.jpg) + +in our signature inversion method, as they establish a benchmark for the best possible performance attainable in path reconstruction from signatures. + +# C PROOFS OF SIGNATURE INVERSION + +In this section, we present the formal proofs of the signature inversion Theorem 3.2 and Theorem 3.1, along with the remark in Section 3.2 about Taylor approximation of the weight function. + +# C.1 PROOF OF ORTHOGONAL POLYNOMIAL INVERSION THEOREM 3.2 + +Recall the statement in Theorem 3.2 deriving the $n$ -th polynomial coefficient $\alpha_{n}$ (see Equation (10)) via a recurrence relation: + +Let $x:[a,b] \to \mathbb{R}$ be a smooth path such that $x(a) = 0$ . Consider the augmentation $\hat{x}(t) = (t,\omega(t)x(t)) \in \mathbb{R}^2$ , where $\omega(t)$ corresponds to the weight function of a system of orthogonal polynomials $(p_n)_{n \in \mathbb{N}}$ , and is well defined on the closed and compact interval $[a,b]$ . Then, there exists a linear combination $\ell_n$ of words such that the $n^{th}$ coefficient in Equation (10) satisfies $\alpha_n = \langle \ell_n, S(\hat{x}) \rangle$ . Furthermore, the sequence $(\ell_n)_{n \in \mathbb{N}}$ satisfies the following recurrence relation + +$$ +\ell_ {n} = A _ {n} \frac {\left(p _ {n - 1} , p _ {n - 1}\right)}{\left(p _ {n} , p _ {n}\right)} e _ {1} \succ \ell_ {n - 1} + \left(A _ {n} a + B _ {n}\right) \frac {\left(p _ {n - 1} , p _ {n - 1}\right)}{\left(p _ {n} , p _ {n}\right)} \ell_ {n - 1} + C _ {n} \frac {\left(p _ {n - 2} , p _ {n - 2}\right)}{\left(p _ {n} , p _ {n}\right)} \ell_ {n - 2}, +$$ + +with + +$$ +\ell_ {0} = \frac {A _ {0}}{\left(p _ {0} , p _ {0}\right)} e _ {2 1} \quad \text {a n d} \quad \ell_ {1} = \frac {A _ {1}}{\left(p _ {1} , p _ {1}\right)} \left(e _ {1 2 1} + e _ {2 1 1}\right) + \frac {A _ {1} a + B _ {1}}{\left(p _ {1} , p _ {1}\right)} e _ {2 1}. +$$ + +Proof. One can express the first two coefficients in an orthogonal polynomial expansion of $x$ by the signature: + +$$ +\begin{array}{l} \alpha_ {0} = \frac {1}{(p _ {0} , p _ {0})} \int_ {a} ^ {b} A _ {0} x (t) \omega (t) d t \\ = \langle \frac {A _ {0}}{(p _ {0} , p _ {0})} e _ {2} \succ e _ {1}, S (\hat {x}) \rangle \\ = \left\langle \frac {A _ {0}}{\left(p _ {0} , p _ {0}\right)} e _ {2 1}, S (\hat {x}) \right\rangle \\ = \langle \ell_ {0}, S (\hat {x}) \rangle , \\ \end{array} +$$ + +$$ +\begin{array}{l} \alpha_ {1} = \frac {1}{(p _ {1} , p _ {1})} \int_ {a} ^ {b} (A _ {1} t + B _ {1}) x (t) \omega (t) d t \\ = \frac {A _ {1}}{\left(p _ {1} , p _ {1}\right)} \int_ {a} ^ {b} (t - a) x (t) \omega (t) d t + \frac {A _ {1} a + B _ {1}}{\left(p _ {1} , p _ {1}\right)} \int_ {a} ^ {b} x (t) \omega (t) d t \\ = \frac {A _ {1}}{\left(p _ {1} , p _ {1}\right)} \langle \left(e _ {1} \sqcup e _ {2}\right) \succ e _ {1}, S (\hat {x}) \rangle + \frac {A _ {1} a + B _ {1}}{\left(p _ {1} , p _ {1}\right)} \langle e _ {2 1}, S (\hat {x}) \rangle \\ = \left\langle \frac {A _ {1}}{\left(p _ {1} , p _ {1}\right)} \left(e _ {1 2 1} + e _ {2 1 1}\right) + \frac {A _ {1} a + B _ {1}}{\left(p _ {1} , p _ {1}\right)} e _ {2 1}, S (\hat {x}) \right\rangle \\ = \langle \ell_ {1}, S (\hat {x}) \rangle . \\ \end{array} +$$ + +Then one can find $\ell_{n}$ recursively by multiplying both sides of Equation (9) by $x(t)\omega (t)$ and integrating on $[a,b]$ : + +$$ +\begin{array}{l} \int_ {a} ^ {b} p _ {n} (t) x (t) \omega (t) d t = \int_ {a} ^ {b} (A _ {n} t + B _ {n}) p _ {n - 1} (t) x (t) \omega (t) d t + \int_ {a} ^ {b} C _ {n} p _ {n - 2} (x) x (t) \omega (t) d t \\ = A _ {n} \int_ {a} ^ {b} (t - a) d \left(\int_ {a} ^ {t} p _ {n - 1} (s) x (s) \omega (s) d s\right) \\ + \left(A _ {n} a + B _ {n}\right) \int_ {a} ^ {b} p _ {n - 1} (t) x (t) \omega (t) d t \\ + C _ {n} \int_ {a} ^ {b} p _ {n - 2} (x) x (t) \omega (t) d t. \\ \end{array} +$$ + +By definition of $\alpha_{n}$ + +$$ +\int_ {a} ^ {b} p _ {n} (t) x (t) \omega (t) d = (p _ {n}, p _ {n}) \alpha_ {n} = (p _ {n}, p _ {n}) \langle \ell_ {n}, S (\hat {x}) \rangle , +$$ + +$$ +A _ {n} \int_ {a} ^ {b} (t - a) d \left(\int_ {a} ^ {t} p _ {n - 1} (s) x (s) \omega (s) d s\right) = A _ {n} \left(p _ {n - 1}, p _ {n - 1}\right) \langle e _ {1} \succ \ell_ {n - 1}, S (\hat {x}) \rangle , +$$ + +$$ +\left(A _ {n} a + B _ {n}\right) \int_ {a} ^ {b} p _ {n - 1} (t) x (t) \omega (t) d t = \left(A _ {n} a + B _ {n}\right) \left(p _ {n - 1}, p _ {n - 1}\right) \langle \ell_ {n - 1}, S (\hat {x}) \rangle , +$$ + +$$ +C _ {n} \int_ {a} ^ {b} p _ {n - 2} (x) x (t) \omega (t) d t = C _ {n} (p _ {n - 2}, p _ {n - 2}) \langle \ell_ {n - 2}, S (\hat {x}) \rangle . +$$ + +Therefore, the recurrence relation of the linear functions on the signature retrieving the coefficients of orthogonal polynomials is + +$$ +\begin{array}{l} \langle \ell_ {n}, S (\hat {x}) \rangle = A _ {n} \frac {\left(p _ {n - 1} , p _ {n - 1}\right)}{\left(p _ {n} , p _ {n}\right)} \langle e _ {1} \succ \ell_ {n - 1}, S (\hat {x}) \rangle \\ + \left(A _ {n} a + B _ {n}\right) \frac {\left(p _ {n - 1} , p _ {n - 1}\right)}{\left(p _ {n} , p _ {n}\right)} \langle \ell_ {n - 1}, S (\hat {x}) \rangle \\ + C _ {n} \frac {\left(p _ {n - 2} , p _ {n - 2}\right)}{\left(p _ {n} , p _ {n}\right)} \langle \ell_ {n - 2}, S (\hat {x}) \rangle . \\ \end{array} +$$ + +![](images/6d75dfe53a88b326c88ab2cd9fa90fae8a64cf99129a42779ea36ef90870717d.jpg) + +Several assumptions are made in order to derive the recurrence relation. Namely, the interval defined on the inner space must be compact, and the weight function $\omega(t)$ should be well-defined on the closed interval $[a, b]$ . These assumptions can limit the range of applicable orthogonal polynomial families. For example, since the range of Hermite polynomials is unbounded, they are not suitable for our inversion. However, by using a shift-and-scale version of these polynomials, where most of the weight density is concentrated at a particular point, their weight can be numerically truncated to a compact interval. One can centre the weight density using a small enough $\epsilon$ and shift it to a point of interest $t_i$ . Since the non-zero density region is now concentrated in a small interval, Theorem 3.2 can be applied to the truncated density over this interval. The relationship between the original Hermite polynomials and the shift-and-scale Hermite polynomials is given by Equation (21). + +# C.2 REMARK ON THE TAYLOR APPROXIMATION OF THE WEIGHT FUNCTION + +The results in Theorem 3.2 require signatures of $\hat{x} = (t, w(t)x(t))$ . However, sometimes one may only have signatures of $\tilde{x} = (t, x(t))$ . Here, we propose a theoretically applicable method by approximating the weight function as a Taylor polynomial. + +Consider the Taylor approximation of $\omega$ around $t = a$ , i.e., + +$$ +\omega (t) \approx \sum_ {i = 0} ^ {M} \frac {d ^ {i} \omega}{d t ^ {i}} \Big | _ {t = a} (t - a) ^ {i} = \sum_ {i = 0} ^ {M} \omega_ {i} (t - a) ^ {i}. +$$ + +Letting $\tilde{x}_t = (t, x(t))$ and + +$$ +c _ {i} := \left(e _ {2} \sqcup e _ {1} ^ {\sqcup i}\right) \succ e _ {1} = i! \left(e _ {2 1 \dots 1} + e _ {1 2 1 \dots 1} + \dots + e _ {1 \dots 1 2 1}\right), +$$ + +we have + +$$ +\begin{array}{l} \alpha_ {0} = \frac {1}{(p _ {0} , p _ {0})} \int_ {a} ^ {b} A _ {0} x (t) \omega (t) d t \\ = \frac {A _ {0}}{\left(p _ {0} , p _ {0}\right)} \sum_ {i = 0} ^ {M} \omega_ {i} \int_ {a} ^ {b} (t - a) ^ {i} x (t) d t \\ = \left\langle \frac {A _ {0}}{\left(p _ {0} , p _ {0}\right)} \sum_ {i = 0} ^ {M} \omega_ {i} \left(e _ {2} \sqcup e _ {1} ^ {\sqcup i}\right) \succ e _ {1}, S (\tilde {x}) \right\rangle \\ = \left\langle \frac {A _ {0}}{\left(p _ {0} , p _ {0}\right)} \sum_ {i = 0} ^ {M} \omega_ {i} c _ {i}, S (\tilde {x}) \right\rangle \\ = \langle \ell_ {0}, S (\tilde {x}) \rangle , \\ \end{array} +$$ + +$$ +\begin{array}{l} \alpha_ {1} = \frac {1}{(p _ {1} , p _ {1})} \int_ {a} ^ {b} (A _ {1} t + B _ {1}) x (t) \omega (t) d t \\ = \frac {1}{\left(p _ {1} , p _ {1}\right)} \int_ {a} ^ {b} \left(A _ {1} (t - a) + A _ {1} a + B _ {1}\right) x (t) \omega (t) d t \\ = \frac {1}{\left(p _ {1} , p _ {1}\right)} \sum_ {i = 0} ^ {M} \omega_ {i} \int_ {a} ^ {b} \left(A _ {1} (t - a) ^ {i + 1} + \left(A _ {1} a + B _ {1}\right) (t - a) ^ {i}\right) x (t) d t \\ = \left\langle \frac {1}{\left(p _ {1} , p _ {1}\right)} \sum_ {i = 0} ^ {M} \omega_ {i} \left(A _ {1} \left(e _ {2} \sqcup e _ {1} ^ {\sqcup i + 1}\right) + \left(A _ {1} a + B _ {1}\right) \left(e _ {2} \sqcup e _ {1} ^ {\sqcup i}\right)\right) \succ e _ {1}, S (\tilde {x}) \right\rangle \\ = \left\langle \frac {1}{(p _ {1} , p _ {1})} \sum_ {i = 0} ^ {M} \omega_ {i} \left(A _ {1} c _ {i + 1} + \left(A _ {1} a + B _ {1}\right) c _ {i}\right), S (\tilde {x}) _ {a, b} \right\rangle \\ = \left\langle \ell_ {1}, S (\tilde {x}) \right\rangle \\ \end{array} +$$ + +By induction, the same relation as Theorem 3.2 holds + +$$ +\ell_ {n} = A _ {n} \frac {\left(p _ {n - 1} , p _ {n - 1}\right)}{\left(p _ {n} , p _ {n}\right)} e _ {1} \succ \ell_ {n - 1} + \left(A _ {n} a + B _ {n}\right) \frac {\left(p _ {n - 1} , p _ {n - 1}\right)}{\left(p _ {n} , p _ {n}\right)} \ell_ {n - 1} + C _ {n} \frac {\left(p _ {n - 2} , p _ {n - 2}\right)}{\left(p _ {n} , p _ {n}\right)} \ell_ {n - 2}. +$$ + +There are several reasons why we consider the Taylor approximation method "theoretically applicable." The expansion of the weight function around a point $a$ can be hard to find analytically, and even if the series is found, it may diverge. If the series does converge, we still need to determine the number of terms required to meet a certain error tolerance. Furthermore, if the convergence rate is slow, more terms are needed in the series. This leads to higher necessary signature truncation levels and consequently also higher computational complexity. + +# C.3 PROOF OF FOURIER INVERSION IN THEOREM 3.1 + +Recall the statement in Theorem 3.1 deriving the Fourier coefficients $a_0, a_n, b_n$ (see Equations (5), (6), (7)) of a path as follows: + +Let $x:[0,2\pi ]\to \mathbb{R}$ be a periodic smooth path such that $x(0) = 0$ , and consider the augmentation $\hat{x} (t) = (t,\sin (t),\cos (t) - 1,x(t))\in \mathbb{R}^4$ . Then the following relations hold + +$$ +a _ {0} = \frac {1}{2 \pi} \langle e _ {4} \succ e _ {1}, S (\hat {x}) \rangle , +$$ + +$$ +a _ {n} = \frac {1}{\pi} \sum_ {k = 0} ^ {n} \sum_ {q = 0} ^ {k} {\binom {n} {k}} {\binom {k} {q}} \cos (\frac {1}{2} (n - k) \pi) \langle (e _ {4} \sqcup e _ {2} ^ {\sqcup n - k} \sqcup e _ {3} ^ {\sqcup q}) \succ e _ {1}, S (\hat {x}) \rangle , +$$ + +$$ +b _ {n} = \frac {1}{\pi} \sum_ {k = 0} ^ {n} \sum_ {q = 0} ^ {k} {\binom {n} {k}} {\binom {k} {q}} \sin (\frac {1}{2} (n - k) \pi) \langle (e _ {4} \sqcup e _ {2} ^ {\sqcup n - k} \sqcup e _ {3} ^ {\sqcup q}) \succ e _ {1}, S (\hat {x}) \rangle . +$$ + +Proof. By Multiple-Angle formulas, we have + +$$ +\sin (n t) = \sum_ {k = 0} ^ {n} \binom {n} {k} \cos^ {k} (t) \sin^ {n - k} (t) \sin \left(\frac {1}{2} (n - k) \pi\right), \tag {25} +$$ + +$$ +\cos (n t) = \sum_ {k = 0} ^ {n} \binom {n} {k} \cos^ {k} (t) \sin^ {n - k} (t) \cos \left(\frac {1}{2} (n - k) \pi\right). \tag {26} +$$ + +We can now connect Equation (7), Equation (25), and the shuffle identity of the signature described in Lemma A.0.1 to obtain an expression for $b_{n}$ as + +$$ +\begin{array}{l} b _ {n} = \frac {1}{\pi} \int_ {0} ^ {2 \pi} x (t) \sin (n t) d t \\ = \frac {1}{\pi} \int_ {0} ^ {2 \pi} x (t) \sum_ {k = 0} ^ {n} \binom {n} {k} \cos^ {k} (t) \sin^ {n - k} (t) \sin (\frac {1}{2} (n - k) \pi) d t \\ = \frac {1}{\pi} \sum_ {k = 0} ^ {n} \binom {n} {k} \sin (\frac {1}{2} (n - k) \pi) \int_ {0} ^ {2 \pi} x (t) \cos^ {k} (t) \sin^ {n - k} (t) d t \\ = \frac {1}{\pi} \sum_ {k = 0} ^ {n} \binom {n} {k} \sin \left(\frac {1}{2} (n - k) \pi\right) \int_ {0} ^ {2 \pi} x (t) \left(\left(\cos (t) - 1\right) + 1\right) ^ {k} \sin^ {n - k} (t) d t \tag {27} \\ = \frac {1}{\pi} \sum_ {k = 0} ^ {n} {\binom {n} {k}} \sin (\frac {1}{2} (n - k) \pi) \int_ {0} ^ {2 \pi} x (t) \sin^ {n - k} (t) \sum_ {q = 0} ^ {k} {\binom {k} {q}} (\cos (t) - 1) ^ {q} d t \\ = \frac {1}{\pi} \sum_ {k = 0} ^ {n} \sum_ {q = 0} ^ {k} {\binom {n} {k}} {\binom {k} {q}} \sin (\frac {1}{2} (n - k) \pi) \int_ {0} ^ {2 \pi} x (t) \sin^ {n - k} (t) (\cos (t) - 1) ^ {q} d t \\ = \frac {1}{\pi} \sum_ {k = 0} ^ {n} \sum_ {q = 0} ^ {k} {\binom {n} {k}} {\binom {k} {q}} \sin (\frac {1}{2} (n - k) \pi) \langle (e _ {4} \sqcup e _ {2} ^ {\sqcup n - k} \sqcup e _ {3} ^ {\sqcup q}) \succ e _ {1}, S (\hat {x}) \rangle . \\ \end{array} +$$ + +Table 3: Polynomial/Fourier basis orders used in Figures 11 and 12. + +
Approximation methodOrder nLevel of truncated signature
Legendre10n+2=12
Jacobi(0, 0.5)10n+2=12
Jacobi(0.5, 0)10n+2=12
Hermite (ε = 0.05)2n+2=4
Fourier10n+2=12
+ +Similarly, we rearrange Equation (6) with Equation (26) to obtain the formula for $a_{n}$ + +$$ +\begin{array}{l} a _ {n} = \frac {1}{\pi} \int_ {0} ^ {2 \pi} x (t) \cos (n t) d t \\ = \frac {1}{\pi} \sum_ {k = 0} ^ {n} \sum_ {q = 0} ^ {k} \binom {n} {k} \binom {k} {q} \cos \left(\frac {1}{2} (n - k) \pi\right) \langle \left(e _ {4} \sqcup e _ {2} ^ {\sqcup n - k} \sqcup e _ {3} ^ {\sqcup q}\right) \succ e _ {1}, S (\hat {x}) \rangle . \tag {28} \\ \end{array} +$$ + +Finally, we get $a_0$ immediately as + +$$ +a _ {0} = \frac {1}{2 \pi} \int_ {0} ^ {2 \pi} x (t) d t = \left\langle e _ {4} \succ e _ {1}, S (\hat {x}) \right\rangle . \tag {29} +$$ + +![](images/79b95ff2797cf9198aa9cdf0217158453410b4482573d7f73841f49335c8cb3a.jpg) + +# D VISUALISING INVERSION BY DIFFERENT BASES + +We demonstrate the quality of signature inversion on paths generated from fractional Brownian motion (Mandelbrot & Van Ness, 1968) (see Figure 11), and two of our real-world datasets (see Figure 12) using five different polynomial and Fourier bases. The orders of the bases recovered in these figures are listed in Table D, establishing a relationship with the levels of truncated signatures. The reconstruction results are influenced by three main factors: + +1. the degree/order of the bases, $n$ , and the corresponding levels of truncated signatures; +2. the complexity of the paths, such as frequency and smoothness; +3. the weight function of the orthogonal polynomials. + +Factor 1 plays a crucial role in path reconstruction by providing a theoretical bound on the inversion error, as the order of the retrieved polynomial and Fourier coefficients is constrained by the truncation level of the signature. Recall Figure 9, which demonstrates that increasing the basis order improves the approximation quality, implying that reconstructions from higher-level signatures will more closely approximate the original path. + +Factor 2 also plays a crucial role in the quality of approximation. A comparison between the first and second columns of Figure 11 shows that all bases can approximate the simpler path in the second column more accurately. Consequently, more complex paths may lead to less satisfactory inversion results due to the limitations of the bases, as previously discussed in Section 5.2.1. + +Compared to the previous factors, factor 3 has a relatively minor impact on the reconstruction process. As shown in Figure 12, the left tail of the Jacobi(0,0.5) approximation and the right tail of the Jacobi(0.5,0) approximation tend to diverge as their weight functions approach zero at $t \to \pm 1$ . Meanwhile, the signature inversion using Hermite polynomials, performed on a pointwise basis, remains precise even at lower polynomial degrees, as each sample point is estimated at the centre of the weight function. + +# EXPERIMENT DETAILS + +In this section, we provide additional details about the experimental setup. The accompanying code can be found at https://github.com/Barb0ra/SigDiffusions. + +![](images/f87115e912be5928f3afb13527b40872cef4c78445c7370f68e6511e11e80d8d.jpg) + +![](images/32bc30f9a98adec52021d0e1e8624ac4fbf8b1d978e4f603598e8b7f16bbfa97.jpg) + +![](images/f0093569d03b06addb2281422f165d5cf9a105718076f7e1136204abab546d39.jpg) + +![](images/c55dce0c963a74cf29d428eddd905e71f88a1323bc1bf2b28ca2150efc985997.jpg) + +![](images/6e8f96a41d63c4d828b9297724283bff259b265aba47963e899793619b21c1fa.jpg) + +![](images/835d0df5c207a06fe0a7faa7ef5b90ebcff72db7f3e39ca9e6aabef4e728ba3c.jpg) + +![](images/07b1b8699dea8e74210839ae2b4df7f2e51db82a423db892c07345874ecd218e.jpg) + +![](images/55f960b636ae9911e890334c731e52fa84eb7f85097bb69d15f937d17d603fbe.jpg) + +![](images/9d0728bc8459fae1e39684ebb8e3b0c97682ca97e87e6aac89baf437c79b4e75.jpg) +Figure 11: Inversion results on fractional Brownian motion with Hurst 0.5 and 0.9, with approximation bases (from top to bottom) Legendre (Jacobi(0,0)), Jacobi(0,0.5), Jacobi(0.5,0), Hermite $(\epsilon = 0.05)$ and Fourier. + +![](images/4901324575d18e53fe13801ffc504ead9cf534fa280e6e5b86d302660768419e.jpg) + +![](images/dd84ab4f6d093ebfd5a26ab285471dafc42a5b5c626219928ab2499cf1ce3da7.jpg) + +![](images/c2ac88adc41840cfdffe94553ad87e83cea8cd67cfd5f1a8e3a64701f7433682.jpg) + +![](images/3cf7bbb194e6dc111681bfce68ea7b0e5a80a3e0c6ff9b14eb031dd8f3bb0f41.jpg) + +![](images/291b01f986bad90312b554266ef013d44f20ed6dd6e9b8067c845167c65603b5.jpg) + +![](images/67f11f8b5b9a238d992d719362e3e4933e05742bff3a6e66ed96e5985204bab6.jpg) + +![](images/4b6a5dfa842ba667f46410fc00ad02e16b9adf16c8bc8e8cdb612dcf5b67b086.jpg) + +![](images/3c9dfc68996a0dc5f8991ead6305dbe8ae3ab29a0d48b82da45eebdcc0250e8e.jpg) + +![](images/5c7eea93da0b3a040f98a97b52710d1a102065599cf8eb2d5b45f8b2a798aef5.jpg) + +![](images/0a0bd9c30b62eedda1c55c4a7f8e3434928ecfb63270a397f576b6773c8fa542.jpg) +Figure 12: Inversion results on real-world time series. The left column is a sample from the HEPC dataset. The right column is a sample from the Exchange rates dataset (for readability, we only plot one of the eight dimensions). The approximation bases (from top to bottom) are Legendre (Jacobi(0,0)), Jacobi(0,0.5), Jacobi(0.5,0), Hermite ( $\epsilon = 0.05$ ) and Fourier. + +![](images/9dc4f9df9f1f3d6069e94414bfb9b72c6e430a27ad0b500e745ba366829ce8b1.jpg) + +Table 4: KS Test average scores and type I errors on the margins of time series of length 1000. + +
DatasetModelt=300t=500t=700t=900
SinesSigDiffusion (ours)0.25, 50%0.22, 31%0.24, 40%0.23, 38%
DDO (\( \gamma = 1 \))0.17, 7%0.16, 5%0.20, 15%0.23, 33%
Diffusion-TS0.77, 100%0.50, 100%0.48, 100%0.48, 100%
CSPD-GP (RNN)0.62, 100%0.45, 82%0.48, 95%0.55, 99%
CSPD-GP (Transformer)0.57, 100%0.49, 100%0.51, 99%0.60, 100%
Predator-preySigDiffusion (ours)0.20, 20%0.29, 76%0.23, 39%0.22, 35%
DDO (\( \gamma = 10 \))0.34, 92%0.30, 85%0.36, 96%0.40, 100%
Diffusion-TS1.00, 100%1.00, 100%1.00, 100%0.99, 100%
CSPD-GP (RNN)0.27, 56%0.25, 47%0.32, 74%0.31, 79%
CSPD-GP (Transformer)0.79, 100%0.78, 100%0.79, 100%0.74, 100%
HEPCSigDiffusion (ours)0.20, 16%0.18, 9%0.19, 12%0.21, 22%
DDO (\( \gamma = 1 \))0.25, 46%0.23, 38%0.25, 46%0.25, 51%
Diffusion-TS0.85, 100%0.87, 100%0.82, 100%0.88, 100%
CSPD-GP (RNN)0.52, 100%0.53, 100%0.55, 100%0.56, 100%
CSPD-GP (Transformer)1.00, 100%1.00, 100%1.00, 100%1.00, 100%
Exchange ratesSigDiffusion (ours)0.31, 80%0.28, 67%0.28, 65%0.31, 74%
DDO (\( \gamma = 1 \))0.24, 41%0.24, 42%0.25, 45%0.25, 45%
Diffusion-TS0.72, 100%0.71, 100%0.70, 100%0.69, 100%
CSPD-GP (RNN)0.59, 100%0.56, 100%0.55, 100%0.56, 100%
CSPD-GP (Transformer)1.00, 100%0.99, 100%0.98, 100%0.99, 100%
WeatherSigDiffusion (ours)0.35, 82%0.34, 80%0.33, 76%0.34, 78%
DDO (\( \gamma = 10 \))0.26, 45%0.27, 52%0.26, 46%0.26, 47%
Diffusion-TS0.49, 100%0.50, 100%0.50, 100%0.49, 100%
CSPD-GP (RNN)0.57, 100%0.56, 100&0.56, 100%0.56, 100%
CSPD-GP (Transformer)0.91, 100%0.92, 100%0.91, 100%0.91, 100%
+ +We follow the score-based generative diffusion via a variance-preserving SDE paradigm proposed in Song & Ermon (2019). We tune $\overline{\beta}_{min}$ and $\overline{\beta}_{max}$ in Equation (4) to be 0.1 and 5 respectively. We use a denoising score-matching (Vincent, 2011) objective for training the score network $s_{\theta}$ . For sampling, we discretise the probability flow ODE + +$$ +d \mathbf {x} _ {t} = - \frac {1}{2} \beta (t) \left[ \mathbf {x} _ {t} + s _ {\theta} (t, \mathbf {x} _ {t}) \right] d t, t \in [ 0, 1 ] \tag {30} +$$ + +with an initial point $\mathbf{x}_1 \sim \mathcal{N}(0, I)$ . To solve the discretised ODE, we use a Tsit5 solver with 128 time steps. We adopt the implementation of the Predictive and Discriminative Score metrics from TimeGAN (Yoon, 2024). To satisfy the conditions for Fourier inversion, we augment the paths with additional channels as described in Theorem 3.1, and we add an extra point to the beginning of each path, making it start with 0. + +The model architecture remains fixed throughout the experiments as a transformer with 4 residual layers, a hidden size of 64, and 4 attention heads. Note that other relevant works (Yuan & Qiao, 2024; Coletta et al., 2024; Bilos et al., 2023) follow a very similar or bigger architecture. We use the Adam optimiser. We run the experiments on an NVIDIA GeForce RTX 4070 Ti GPU. Table 4 details additional KS test performance metrics (see Section 5). + +For the task of generating time series described in Section 5.2, we fix the number of samples to 1000, the batch size to 128, the number of epochs to 1200, and the learning rate to 0.001. The details variable across datasets are listed in Table 5. We reserve 1000 points from each dataset as an unseen test set for metric calculation. + +The mirror augmentation For many datasets, we might not wish to assume path periodicity as required in the Fourier inversion conditions in Theorem 3.1. We observed that a useful trick in this case is to concatenate the path with a reversed version of itself before performing the additional augmentations. We denote this the mirror augmentation. Table 5 indicates the datasets for which this augmentation is performed. + +Table 5: Datasets for long time series generation. + +
DatasetMirror augmentationData pointsDimensions
SinesYes100005
HEPCNo102421
Predator-preyNo100002
Exchange ratesNo65888
WeatherNo1034014
+ +Datasets As previously described in Section 5, we measure the performance of SigDiffusions on two synthetic (Sines and Predator-prey) and three real-world (HEPC, Exchange Rates, Weather) public datasets. We generate Sines the same way the Sine dataset is generated in TimeGAN (Yoon et al., 2019), by sampling sine curves at a random phase and frequency but changing the sampling rate to 1000. Predator-prey is a dataset consisting of sample trajectories of a two-dimensional system of ODEs adopted from Biloš et al. (2023) + +$$ +\dot {x} = \frac {2}{3} x - \frac {2}{3} x y, \tag {31} +$$ + +$$ +\dot {y} = x y - y. +$$ + +We generate Predator-prey on a time grid of 1000 points on the interval $t \in [0,10]$ . HEPC (UCI Machine Learning Repository, 2024) is a household electricity consumption dataset collected minutewise for 47 months from 2006 to 2010. We slice the dataset to windows of length 1000 with a stride of 200, yielding a dataset of 10242 entries. We select the voltage feature to generate as a univariate time series. We use the Exchange Rates dataset provided in Lai et al. (2018); Lai (2017) and slice it with a stride of 1, yielding 6588 time series. Lastly, the Weather dataset was measured and published by the Max-Planck-Institute for Biogeochemistry (Kolle, 2024). We take the first 14 features from this dataset describing the pressure, temperature, humidity, and wind conditions, and we slice the time series with a stride of 5 to get 10340 samples. + +**Benchmarks** We compare our models to four recent diffusion models for long time series generation: Diffusion-TS (Yuan & Qiao, 2024), DDO (Lim et al., 2023), and two variants of CSPD-GP (Biloš et al., 2023) - one with an RNN for a score function and one with a transformer. For Diffusion-TS and CSPD-GP, we keep the model configurations as they were proposed in the authors' implementations for datasets with similar dimensions and number of data points. One exception to this is halving the batch size for transformer-based architectures due to memory constraints. We also halve the number of epochs to preserve the proposed number of training steps. As DDO has previously only been implemented on image-shaped data, we alter the code in the authors' GitHub implementation to generate samples of shape (time series length x 1 x number of channels). We always report the performance for the RBF kernel smoothness hyperparameter $\gamma \in [0.05, 0.2, 1, 5, 10]$ corresponding to the highest predictive score. We train the model for 300 epochs (see Appendix Section J of the DDO paper by Lim et al. (2023)) with a batch size of 32 and keep the remaining hyperparameters as proposed for the Volcano dataset. Table 2 shows the number of parameters and computation times for each model. We use the publicly available code to run the benchmarks: + +- https://github.com/morganstanley/MSML (Stanley, 2024) +- https://github.com/Y-debug-sys/Diffusion-TS (Yuan, 2024) +- https://github.com/lim0606/ddo (Lim, 2023) + +Experiments with the truncation level To produce Figure 4, we use a dataset generated by Equation (31), discretised to 25 points. To add non-trivial high-frequency components, we include sine and cosine waves of the first eight Fourier frequencies, with random amplitudes drawn from a standard normal distribution. To keep the model architecture consistent and avoid memory issues at higher truncation levels, we use the linearised attention mechanism from Katharopoulos et al. (2020) with a relu kernel, instead of the full attention mechanism. We also reduce the model's hidden size from 64 to 32. \ No newline at end of file diff --git a/ICLR/2025/SigDiffusions_ Score-Based Diffusion Models for Time Series via Log-Signature Embeddings/images.zip b/ICLR/2025/SigDiffusions_ Score-Based Diffusion Models for Time Series via Log-Signature Embeddings/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..2713b61b3dea85093080fb290c2a285fd2a1929f --- /dev/null +++ b/ICLR/2025/SigDiffusions_ Score-Based Diffusion Models for Time Series via Log-Signature Embeddings/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:56e5498323d1b0dffc82150ff33db30ddaff41c711d0c728796ec8dff8b752fa +size 2241351 diff --git a/ICLR/2025/SigDiffusions_ Score-Based Diffusion Models for Time Series via Log-Signature Embeddings/layout.json b/ICLR/2025/SigDiffusions_ Score-Based Diffusion Models for Time Series via Log-Signature Embeddings/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..c1fa397eaf63687db8247cb873bb82c89b1d0445 --- /dev/null +++ b/ICLR/2025/SigDiffusions_ Score-Based Diffusion Models for Time Series via Log-Signature Embeddings/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:db8ee5fc8634167be19964c457e37bd91e75097dfce0b52c298419726fa60a04 +size 1308698 diff --git a/ICLR/2025/SimPER_ A Minimalist Approach to Preference Alignment without Hyperparameters/001a3b46-2bff-4d62-be61-9e80ed6c8d79_content_list.json b/ICLR/2025/SimPER_ A Minimalist Approach to Preference Alignment without Hyperparameters/001a3b46-2bff-4d62-be61-9e80ed6c8d79_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..f60f8fdf9e0633a4a194c036a29e056fc146e095 --- /dev/null +++ b/ICLR/2025/SimPER_ A Minimalist Approach to Preference Alignment without Hyperparameters/001a3b46-2bff-4d62-be61-9e80ed6c8d79_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:26f451d4af06f211ed8b07e16af94f79d0a776243f83a752146c4b45ebdf650d +size 137083 diff --git a/ICLR/2025/SimPER_ A Minimalist Approach to Preference Alignment without Hyperparameters/001a3b46-2bff-4d62-be61-9e80ed6c8d79_model.json b/ICLR/2025/SimPER_ A Minimalist Approach to Preference Alignment without Hyperparameters/001a3b46-2bff-4d62-be61-9e80ed6c8d79_model.json new file mode 100644 index 0000000000000000000000000000000000000000..2030216a8543a7fe03982070d166bfe5b2300f8e --- /dev/null +++ b/ICLR/2025/SimPER_ A Minimalist Approach to Preference Alignment without Hyperparameters/001a3b46-2bff-4d62-be61-9e80ed6c8d79_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0d833886e04f347c6bfe84ff8c532784712aa890496dc972570ef115e29ffa12 +size 173979 diff --git a/ICLR/2025/SimPER_ A Minimalist Approach to Preference Alignment without Hyperparameters/001a3b46-2bff-4d62-be61-9e80ed6c8d79_origin.pdf b/ICLR/2025/SimPER_ A Minimalist Approach to Preference Alignment without Hyperparameters/001a3b46-2bff-4d62-be61-9e80ed6c8d79_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..f080b11f65d5eedf73bff245b77288382f01561f --- /dev/null +++ b/ICLR/2025/SimPER_ A Minimalist Approach to Preference Alignment without Hyperparameters/001a3b46-2bff-4d62-be61-9e80ed6c8d79_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2a155a3d7706cdc8605148b3a870e9a4b5defed751f58cac3b03e13524e38a49 +size 1303254 diff --git a/ICLR/2025/SimPER_ A Minimalist Approach to Preference Alignment without Hyperparameters/full.md b/ICLR/2025/SimPER_ A Minimalist Approach to Preference Alignment without Hyperparameters/full.md new file mode 100644 index 0000000000000000000000000000000000000000..4310ff4b4f3176fabec9095959b6ccb3eddf1c04 --- /dev/null +++ b/ICLR/2025/SimPER_ A Minimalist Approach to Preference Alignment without Hyperparameters/full.md @@ -0,0 +1,557 @@ +# SIMPER: A MINIMALIST APPROACH TO PREFERENCE ALIGNMENT WITHOUT HYPERPARAMETERS + +Teng Xiao $^{1*}$ , Yige Yuan $^{2*}$ , Zhengyu Chen $^{3}$ , Mingxiao Li $^{4}$ , Shangsong Liang $^{5}$ , Zhaochun Ren $^{6}$ , Vasant G Honavar $^{1}$ + +$^{1}$ Pennsylvania State University $^{2}$ University of Chinese Academy of Sciences + +3Meituan Inc 4Tencent AI Lab 5Sun Yat-Sen University 6Leiden University tengxiao@psu.edu, yuanyige923@gmail.com, vhonavar@psu.edu + +# ABSTRACT + +Existing preference optimization objectives for language model alignment require additional hyperparameters that must be extensively tuned to achieve optimal performance, increasing both the complexity and time required for fine-tuning large language models. In this paper, we propose a simple yet effective hyperparameter-free preference optimization algorithm for alignment. We observe that promising performance can be achieved simply by optimizing inverse perplexity, which is calculated as the inverse of the exponentiated average log-likelihood of the chosen and rejected responses in the preference dataset. The resulting simple learning objective, SimPER (Simple alignment with Perplexity optimization), is easy to implement and eliminates the need for expensive hyperparameter tuning and a reference model, making it both computationally and memory efficient. Extensive experiments on widely used real-world benchmarks, including MT-Bench, AlpacaEval 2, and 10 key benchmarks of the Open LLM Leaderboard with 5 base models, demonstrate that SimPER consistently and significantly outperforms existing approaches—even without any hyperparameters or a reference model. For example, despite its simplicity, SimPER outperforms state-of-the-art methods by up to 5.7 points on AlpacaEval 2 and achieves the highest average ranking across 10 benchmarks on the Open LLM Leaderboard. The source code for SimPER is publicly available at the Github: https://github.com/tengxia01/SimPER. + +# 1 INTRODUCTION + +Learning from preference data plays a crucial role in fine-tuning large language models to ensure that pretrained LLMs are aligned with human or societal values and preferences (Bai et al., 2022; Ouyang et al., 2022; Stiannon et al., 2020). In recent years, reinforcement learning from human feedback (RLHF) (Ouyang et al., 2022; Christiano et al., 2017) has been proposed for fine-tuning language models based on human preferences. In the RLHF pipeline (Ouyang et al., 2022), a reward model is first fit to a dataset of human preferences in the form of a classifier between chosen and rejected responses. Next, an LLM policy is trained using RL algorithms such as proximal policy optimization (PPO) (Schulman et al., 2017) to generate responses given the input prompts with high reward. + +While RLHF produces models with impressive capabilities across diverse tasks, ranging from programming to creative writing, it introduces notable complexities into the training process (Engstrom et al., 2020; Rafailov et al., 2024), involving inefficient and unstable optimization, as well as training on separate reward and policy models. This potentially worsens the sample complexity and compromises efficient convergence. To address these issues, offline preference fine-tuning (Tajwar et al., 2024) methods, such as DPO (Rafailov et al., 2024), IPO (Azar et al., 2024), and KTO (Ethayarajh et al., 2024a), have been proposed to replace RLHF with supervised learning on human preference data. More recently, SimPO (Meng et al., 2024) eliminates the need for a reference model, making DPO more compute and memory efficient. These methods eliminate the need for explicit reward modeling by directly using the likelihood of language model policy to define a implicit reward fitted to the preference data, while achieving notable competitive performance (Tajwar et al., 2024). + +![](images/a80410c5875d9c10cedbc1a0aa7521dc483d42f5a9b16bf16535263ee504fe9c.jpg) +Figure 1: Evaluation on the MT-Bench Score (1-10) of SimPO and our SimPER across different large language models reveals the high sensitivity and instability of SimPO with respect to its hyperparameter $\gamma$ across models. In contrast, our SimPER, which operates without any hyperparameters in the objective function, consistently and significantly outperforms SimPO across a wide range of models. Additional experimental evidence on other widely used benchmarks is provided in Section 4. + +However, these methods require additional hyperparameters that must be carefully tuned as shown in Table 1, and the performance of current preference optimization methods, such as DPO, KTO, IPO, and others, is highly sensitive to these hyperparameters across different LLMs, as already shown by (HuggingFace, 2023; Liu et al., 2024a; Meng et al., 2024; Liu et al., 2024c; Wu et al., 2024). In Figure 1, we also show that tuning hyperparameters is also crucial to achieve optimal performance with the recent state-of-the-art + +Table 1: State-of-the-art preference fine-tuning losses are compared in terms of properties: hyperparameters, the number of hyperparameters, and the elimination of the reference model (see Appendix B.2 for details of these methods and hyperparameters). + +
MethodHyperparameters#Hyperparametersw/o Reference Model
DPOβ1X
IPOβ1X
KTOλl,λw,β3X
CPOλ,β2✓
SLiCδ,λ2✓
SimPOγ,β2✓
SimPER-0✓
+ +algorithm SimP0, which eliminates the need for a reference model. This challenge largely prevents us from aligning large language models in real-world applications, given that a single post-training process for alignment is usually very expensive and takes a long time (Dubey et al., 2024). To this end, we ask an important research question for large language model alignment: Can we design an efficient and effective hyperparameter-free preference optimization method for alignment? + +In this paper, we answer this question affirmatively. We propose SimPER (Simple alignment with Perplexity optimization), a simple yet effective offline preference optimization objective that eliminates the need for a reference model and any tunable hyperparameters. The key to SimPER is directly optimizing the reverse perplexity of chosen and rejected responses within the preference dataset. Perplexity (Jelinek et al., 1977) is a well-known evaluation metric for language modeling, commonly used to assess a model's ability to process long text. It is calculated as the inverse of the exponentiated average log-likelihood of the responses. SimPER achieves alignment by solving a reverse perplexity optimization problem, minimizing perplexity over the chosen response while maximizing perplexity over the rejected response, enabling the model to better align with human preferences. Our simple SimPER validates that perplexity is also an effective optimization indicator for LLM alignment. + +Moreover, our further analysis proves that, unlike optimizing Kullback-Leibler divergence (KLD) in SimPO, our algorithm effectively minimizes the Total Variation distance (TVD). From a gradient perspective, the robust nature of TVD balances gradients from positive and negative responses, which ensures that the contribution from negative samples does not overshadow those from its positive counterpart, thereby mitigating the issue of decreasing the likelihood of chosen response during preference optimization as noticed by recent works (Meng et al., 2024; Pal et al., 2024). + +We empirically demonstrate that SimPER enjoys promising performance on extensive benchmarks such as the Open LLM Leaderboard (Beeching et al., 2023a), MT-Bench (Zheng et al., 2023), and AlpacaEval 2 (Li et al., 2023b). Despite its simplicity, our results show that SimPER consistently and significantly outperforms existing approaches across various large language models, without the need for any hyperparameters and a reference model in the objective function for alignment. + +# 2 RELATED WORK + +Reinforcement Learning from Human Feedback (RLHF) is an effective technique designed to align LLMs with human preferences (Christiano et al., 2017). The training process for RLHF includes + +three stages: initial supervised fine-tuning (Zhou et al., 2024; Xia et al., 2024), training of the reward model from human preference data (Gao et al., 2023a; Xiao & Wang, 2021), and policy optimization using reinforcement learning, notably Proximal Policy Optimization (PPO) (Schulman et al., 2017). While RLHF provides significant benefits in various domains, such as instruction-following (Ouyang et al., 2022), safety alignment (Bai et al., 2022), and truthfulness enhancement (Tian et al., 2023), it requires a more complex training pipeline compared to traditional supervised learning methods. + +Recent literature highlights the inherent complexity of online preference optimization algorithms, driving the exploration of more efficient offline alternatives. A notable advancement is Direct Preference Optimization (DPO) (Rafailov et al., 2024), which eliminates the need for explicit reward modeling by directly using the likelihood of policy to define an implicit reward fitted to the preference data. Inspired by DPO, various methods such as IPO (Azar et al., 2024), KTO (Ethayarajh et al., 2024b), and others (Yuan et al., 2024a; Xu et al., 2024; Hong et al., 2024; Xiao et al., 2024b;a) have been proposed. While these approaches are effective, they typically necessitate an extensive search for one or more hyperparameters, as well as the use of a reference model. Recently, SimPO (Meng et al., 2024) removed the need for a reference model in DPO, yet introduced two additional hyperparameters: the reward scaling factor and the target reward margin, which require significant manual tuning. Tuning hyperparameters often entails an iterative trial-and-error process, resulting in substantial computational overhead, particularly for large-scale language models. In this paper, we introduce SimPER, a simple yet effective objective that eliminates the need for costly hyperparameter tuning and a reference model, thus enhancing both learning and memory efficiency in practice. + +Also worth mentioning is a body of work on perplexity (Jelinek et al., 1977) in language modeling. Researchers use perplexity, an evaluation metric aligned with the causal language modeling objective of LLMs, to assess whether a test input falls within the LLM's expertise and how it relates to the LLM's pretraining data (Chen et al., 2024b; Marion et al., 2023; Gonen et al., 2023). A lower perplexity indicates that the model's predictions are generally more accurate, while a higher perplexity suggests that the model finds the content more unpredictable. Recent work (Ankner et al., 2024; Muennighoff et al., 2024) also uses perplexity to identify high-quality subsets of large-scale text datasets that improve performance. Perplexity has also been used to fuse knowledge from multiple models (Mavromatis et al., 2024). As perplexity provides a sequence-length normalized expression of the model's confidence, recent works have utilized the inverse perplexity score to detect hallucinations (Valentin et al., 2024) and for confidence estimation (Liu et al., 2024b). In contrast to these works, we propose a simple yet effective alignment objective based on perplexity, demonstrating that perplexity is also a surprisingly effective indicator for achieving alignment on preference data. + +# 3 THE PROPOSED METHOD + +# 3.1 BACKGROUND + +Notations. We consider the problem of preference fine-tuning: Let the text sequences $\mathbf{x} = [x_1, x_2, \ldots]$ denote the prompt, and $\mathbf{y}_w = [y_1, y_2, \ldots]$ and $\mathbf{y}_l = [y_1, y_2, \ldots]$ denote two responses, sampled from the reference policy $\pi_{\mathrm{ref}}(\mathbf{y} \mid \mathbf{x})$ . The response pairs are then presented to an oracle who express preferences for responses given the prompt, denoted as $\mathbf{y}_w \succ \mathbf{y}_l \mid \mathbf{x}$ , where $\mathbf{y}_w$ and $\mathbf{y}_l$ denote chosen and rejected responses, respectively. Given dataset $\mathcal{D}$ , containing preference $(\mathbf{x}, \mathbf{y}_w, \mathbf{y}_l)$ , the goal is to learn a language model policy $\pi_\theta(\mathbf{y} \mid \mathbf{x})$ parameterized by $\theta$ for aligning human preference. + +DPO. DPO (Rafailov et al., 2024) is one of the most popular offline preference optimization methods. Instead of learning an explicit reward model like RLHF, DPO uses the log-likelihood of the policy to implicitly represent the reward function via a closed-form expression with the optimal policy: + +$$ +r (\mathbf {x}, \mathbf {y}) = \beta \left(\log \pi_ {\boldsymbol {\theta}} (\mathbf {y} \mid \mathbf {x}) - \log \pi_ {\mathrm {r e f}} (\mathbf {y} \mid \mathbf {x})\right) + \beta \log Z (\mathbf {x}). \tag {1} +$$ + +DPO aims to optimize $\pi_{\pmb{\theta}}$ based on the Bradley-Terry (BT) preference model (Bradley & Terry, 1952), $p\left(\mathbf{y}_w\succ \mathbf{y}_l\mid x\right) = \sigma \left(r(\mathbf{x},\mathbf{y}_w) - r\left(\mathbf{x},\mathbf{y}_l\right)\right)$ , and with the following maximum likelihood objective: + +$$ +\mathcal {L} _ {\mathrm {D P O}} (\boldsymbol {\theta}; \mathcal {D}) = \mathbb {E} _ {(\mathbf {x}, \mathbf {y} _ {w}, \mathbf {y} _ {l}) \sim \mathcal {D}} \left[ - \log \sigma \left(\beta \log \frac {\pi_ {\boldsymbol {\theta}} (\mathbf {y} _ {w} \mid \mathbf {x})}{\pi_ {\mathrm {r e f}} (\mathbf {y} _ {w} \mid \mathbf {x})} - \beta \log \frac {\pi_ {\boldsymbol {\theta}} (\mathbf {y} _ {l} \mid \mathbf {x})}{\pi_ {\mathrm {r e f}} (\mathbf {y} _ {l} \mid \mathbf {x})}\right) \right], \tag {2} +$$ + +where $\beta$ is a tunable hyperparameter controlling the deviation from the reference model. + +IPO. The Identity Preference Optimization (IPO) (Azar et al., 2024) also avoids a reward learning process and potentially unstable RL training. Specifically, IPO chooses to directly minimize the + +following squared loss regression problems by defining an alternative reward function: + +$$ +\mathcal {L} _ {\mathrm {I P O}} (\boldsymbol {\theta}; \mathcal {D}) = \mathbb {E} _ {(\mathbf {x}, \mathbf {y} _ {w}, \mathbf {y} _ {l}) \sim \mathcal {D}} \left[ \left(\log \frac {\pi_ {\boldsymbol {\theta}} (\mathbf {y} _ {w} \mid \mathbf {x}) \pi_ {\mathrm {r e f}} (\mathbf {y} _ {l} \mid \mathbf {x})}{\pi_ {\boldsymbol {\theta}} (\mathbf {y} _ {l} \mid \mathbf {x}) \pi_ {\mathrm {r e f}} (\mathbf {y} _ {w} \mid \mathbf {x})} - \frac {1}{2 \beta}\right) ^ {2} \right], \tag {3} +$$ + +where $\beta$ is also a hyperparameter. A potential advantage of IPO over DPO is that these methods don't assume a specific preference model, like BT, and can work with general preference probabilities. + +SimPO. Simple Preference Optimization (SimPO) (Meng et al., 2024) has recently been proposed to eliminate the need for a reference model in DPO while achieving promising performance. SimPO optimizes the length-regularized probability of response pairs with a margin based on the BT model: + +$$ +\mathcal {L} _ {\text {S i m P O}} (\boldsymbol {\theta}; \mathcal {D}) = \mathbb {E} _ {(\mathbf {x}, \mathbf {y} _ {w}, \mathbf {y} _ {l}) \sim \mathcal {D}} \left[ - \log \sigma \left(\frac {\beta}{| \mathbf {y} _ {w} |} \log \pi_ {\boldsymbol {\theta}} (\mathbf {y} _ {w} \mid \mathbf {x}) - \frac {\beta}{| \mathbf {y} _ {l} |} \log \pi_ {\boldsymbol {\theta}} (\mathbf {y} _ {l} \mid \mathbf {x}) - \gamma\right) \right], \tag {4} +$$ + +where $\gamma$ is an additional hyperparameter indicating a target reward margin. In practice, minimizing the above preference fine-tuning objective, or any other contrastive objectives such as those of KTO (Ethayarajh et al., 2024b) and SLiC (Zhao et al., 2023) (see Appendix B.2), requires extensive hyperparameter tuning. These hyperparameters (e.g., $\beta$ and $\gamma$ ) play a critical role in alignment performance, as shown by (Bai et al., 2022; Liu et al., 2024a; Meng et al., 2024) (also see Figure 1), and need to be manually adjusted to achieve optimal performance, significantly increasing complexity and time cost. In this paper, we address this limitation by proposing a simple yet effective alignment objective, SimPER, which eliminates the need for a reference model and any tunable hyperparameters required by previous work, making the alignment process on large language model more efficient. + +# 3.2 THE LEARNING OBJECTIVE OF SIMPER + +In this section, we elaborate on SimPER. The key idea behind SimPER is to encourage the model to minimize the perplexity of the chosen response while simultaneously maximizing the perplexity of the rejected response within the preference dataset. Specifically, we optimize the inverse perplexity, which is calculated as the inverse of the exponentiated average negative log-likelihood of the response. The average log-likelihood of the response under the policy model $\pi_{\theta}$ is defined as follows: + +$$ +r _ {\boldsymbol {\theta}} (\mathbf {x}, \mathbf {y}) = \log p _ {\boldsymbol {\theta}} (\mathbf {y} \mid \mathbf {x}) = \frac {1}{| \mathbf {y} |} \log \pi_ {\boldsymbol {\theta}} (\mathbf {y} \mid \mathbf {x}) = \frac {1}{| \mathbf {y} |} \sum_ {i = 1} ^ {| \mathbf {y} |} \log \pi_ {\boldsymbol {\theta}} \left(\mathbf {y} _ {i} \mid \mathbf {x}, \mathbf {y} _ {< i}\right), \tag {5} +$$ + +where $p_{\theta}(\mathbf{y} \mid \mathbf{x}) = \pi_{\theta}(\mathbf{y} \mid \mathbf{x})^{\frac{1}{|\mathbf{y}|}}$ is the defined geometric mean over the sequence of token probabilities. The perplexity is defined as the exponentiated its average negative log-likelihood as: + +$$ +\operatorname {P e r p l e x i t y} (\mathbf {y} \mid \mathbf {x}) = \exp \left(- r _ {\theta} (\mathbf {y} \mid \mathbf {x})\right) = \exp \left(- \frac {1}{| \mathbf {y} |} \log \pi_ {\theta} (\mathbf {y} \mid \mathbf {x})\right), \tag {6} +$$ + +and serves as a metric closely tied to the causal language modeling objective, allowing us to assess whether a new input aligns with the model's knowledge and how it corresponds to the pretraining data (Jelinek et al., 1977; Marion et al., 2023; Gonen et al., 2023). Leveraging perplexity as a measurement of how well a language model predicts the response given the prompt, we formulate the alignment with preference data as an optimization problem that does not require any hyperparameters and a reference model during training. Formally, our SimPER learning objective is given as follows: + +$$ +\begin{array}{l} \mathcal {L} _ {\text {S i m P E R}} (\boldsymbol {\theta}; \mathcal {D}) = - \text {P e r p l e x i t y} ^ {- 1} \left(\mathbf {y} _ {w} \mid \mathbf {x}\right) + \text {P e r p l e x i t y} ^ {- 1} \left(\mathbf {y} _ {l} \mid \mathbf {x}\right) (7) \\ = - \exp \left(\frac {1}{| \mathbf {y} _ {w} |} \log \pi_ {\boldsymbol {\theta}} \left(\mathbf {y} _ {w} \mid \mathbf {x}\right)\right) + \exp \left(\frac {1}{| \mathbf {y} _ {l} |} \log \pi_ {\boldsymbol {\theta}} \left(\mathbf {y} _ {l} \mid \mathbf {x}\right)\right), (8) \\ \end{array} +$$ + +where we directly optimize the reverse perplexity of the chosen and rejected response as the reverse perplexity, i.e., the geometric mean over the sequence of token probabilities, effectively quantifies the model confidence as shown in (Valentin et al., 2024; Liu et al., 2024b). Intuitively, SimPER increases the likelihood of the chosen response and decreases the likelihood of rejected response by optimizing the reverse perplexity, effectively aligning the language model with the preference data. + +In summary, SimPER employs a simple yet effective formulation that directly aligns with the perplexity generation metric, eliminating the need for a reference model. We empirically find that SimPER still achieves a strong performance without requiring any hyperparameters, unlike previous methods. + +![](images/ec4463f43d1164f46866bad8382b748da7d7dc3e3bc5084e4dd6c7dacc765632.jpg) +Figure 3: The training dynamics during training of SimPER and SimPO with different hyperparameters on the Mistral-7B (Results on Llama3-8B can be found in Section 4.2). We can observe that SimPER exhibits the least decline in chosen likelihoods, while still achieving the most significant increase in likelihood margins of rejected and chosen, compared to SimPO across various hyperparameters. + +![](images/fcbe7db6e132afce01d223fdcb9a0b8ae0804938d4a8867e4281e40b50932e1e.jpg) + +![](images/5daf3cd065f047f1a77f779d238242617b52a2dcb61ed03cf92f7512d82eeed4.jpg) + +# 3.3 ANALYSIS AND DISCUSSION + +In this section, we provide a gradient and divergence analysis to further understand our SimPER, + +Gradient Analysis. We examine the gradients of SimPER and the state-of-the-art method DPO (Rafailov et al., 2024) and SimPO (Meng et al., 2024) and to glean some insight into the optimization process. Note that our analysis also holds for other methods such as IPO (Azar et al., 2024) and SLiC (Zhao et al., 2023). One advantage of the SimPER framework is that the gradients of both chosen and rejected responses are more balanced, thus, we can prevent the model from overfitting the rejected responses. We first analyze the following gradients of DPO and SimPO: + +$$ +\nabla_ {\boldsymbol {\theta}} \mathcal {L} _ {\mathrm {D P O}} (\boldsymbol {\theta}; \mathcal {D}) = - \beta \mathbb {E} _ {(\mathbf {x}, \mathbf {y} _ {w}, \mathbf {y} _ {l}) \sim \mathcal {D}} \left[ w _ {\boldsymbol {\theta}} \cdot \left(\frac {\nabla_ {\boldsymbol {\theta}} \pi_ {\boldsymbol {\theta}} (\mathbf {y} _ {w} \mid \mathbf {x})}{\pi_ {\boldsymbol {\theta}} (\mathbf {y} _ {w} \mid \mathbf {x})} - \frac {\nabla_ {\boldsymbol {\theta}} \pi_ {\boldsymbol {\theta}} (\mathbf {y} _ {l} \mid \mathbf {x})}{\pi_ {\boldsymbol {\theta}} (\mathbf {y} _ {l} \mid \mathbf {x})}\right) \right] \tag {9} +$$ + +$$ +\nabla_ {\boldsymbol {\theta}} \mathcal {L} _ {\operatorname {S i m P O}} (\boldsymbol {\theta}; \mathcal {D}) = - \beta \mathbb {E} _ {(\mathbf {x}, \mathbf {y} _ {w}, \mathbf {y} _ {l}) \sim \mathcal {D}} \left[ d _ {\boldsymbol {\theta}} \cdot \left(\frac {\nabla_ {\boldsymbol {\theta}} p _ {\boldsymbol {\theta}} \left(\mathbf {y} _ {w} \mid \mathbf {x}\right)}{p _ {\boldsymbol {\theta}} \left(\mathbf {y} _ {w} \mid \mathbf {x}\right)} - \frac {\nabla_ {\boldsymbol {\theta}} p _ {\boldsymbol {\theta}} \left(\mathbf {y} _ {l} \mid \mathbf {x}\right)}{p _ {\boldsymbol {\theta}} \left(\mathbf {y} _ {l} \mid \mathbf {x}\right)}\right) \right], \tag {10} +$$ + +where the weights $w_{\theta} = \sigma (\beta \log \frac{\pi_{\theta}(\mathbf{y}_l|\mathbf{x})}{\pi_{\mathrm{ref}}(\mathbf{y}_l|\mathbf{x})} - \beta \log \frac{\pi_{\theta}(\mathbf{y}_w|\mathbf{x})}{\pi_{\mathrm{ref}}(\mathbf{y}_w|\mathbf{x})})$ and $d_{\theta} = \sigma (\frac{\beta}{|\mathbf{y}_l|}\log \pi_{\theta}(\mathbf{y}_l|\mathbf{x}) - \frac{\beta}{|\mathbf{y}_w|}\log \pi_{\theta}(\mathbf{y}_w|\mathbf{x}) + \gamma)$ represent the gradient weight in DPO and SimPO, respectively. $p_{\theta}$ is the geometric mean over the sequence of token probabilities defined in Equation (5). It can be seen that the gradient of the model probability weighted by the reciprocal of the model probability on this rejected response. If the rejection likelihood $\pi_{\theta}(\mathbf{y}_l\mid \mathbf{x})\to 0$ or $p_{\theta}(\mathbf{y}_l\mid \mathbf{x})\to 0$ , the norm of the gradient on rejected response will be large, which leads to a huge step of parameter update towards decreasing the likelihood of rejected response compared to the increasing of the chosen response. + +For instance, in DPO, the gradient ratio between the decrease in the probability of rejected responses and the increase in the probability of chosen responses is as follows: $\frac{\pi_{\theta}(\mathbf{y}_w|\mathbf{x})}{\pi_{\theta}(\mathbf{y}_l|\mathbf{x})}\cdot \frac{\nabla_{\theta}\pi_{\theta}(\mathbf{y}_l|\mathbf{x})}{\nabla_{\theta}\pi_{\theta}(\mathbf{y}_w|\mathbf{x})}$ , which becomes infinite when $\pi_{\theta}(\mathbf{y}_l\mid \mathbf{x})\to 0$ . A larger gradient ratio leads to a faster reduction in the probability of a rejected response compared to that of a chosen response, resulting in a more pronounced decrease for rejected responses, which explains why DPO and SimPO tend to push the model to decrease the likelihood of both chosen and rejected responses during training, as shown in Figure 3. This occurs because rejected and chosen responses often share some tokens, leading to a decline in performance on reasoning-heavy tasks, such as math and coding, as demonstrated in several recent studies (Meng et al., 2024; Pal et al., 2024; Pang et al., 2024; Chen et al., 2024a). For comparison, we calculate the gradient of our SimPER with respect to $\theta$ using Equation (8): + +$$ +\nabla_ {\boldsymbol {\theta}} \mathcal {L} _ {\text {S i m P E R}} (\boldsymbol {\theta}; \mathcal {D}) = - \mathbb {E} _ {(\mathbf {x}, \mathbf {y} _ {w}, \mathbf {y} _ {l}) \sim \mathcal {D}} \left[ \nabla_ {\boldsymbol {\theta}} p _ {\boldsymbol {\theta}} \left(\mathbf {y} _ {w} \mid \mathbf {x}\right) - \nabla_ {\boldsymbol {\theta}} p _ {\boldsymbol {\theta}} \left(\mathbf {y} _ {l} \mid \mathbf {x}\right) \right], \tag {11} +$$ + +Where the gradient ratio between rejected and chosen responses is constant, it has a smaller norm than SimPO (Equation 10). This means that the unlearning of rejected responses is more conservative, and SimPER reduces the gradient imbalance issue between chosen and rejected responses. As shown in Figure 3, SimPER effectively prevents the likelihood of chosen responses from decreasing significantly compared to SimPO, while still achieving substantial margins between the likelihood of chosen and rejected responses. Our experiments also show that SimPER significantly outperforms SimPO. + +Divergence Analysis. We next present a theoretical analysis of SimPER, demonstrating its key properties that are advantageous for fine-tuning LLMs with preferences. Recent works (Tajwar et al., + +2024; Xiao et al., 2024b; Ji et al., 2024) identify mode-seeking behavior as a crucial property for preference alignment, as it reduces the likelihood of rejected responses. In what follows, we show that SimPER also theoretically promotes mode-seeking behavior by optimizing the Total Variation distance (TVD) between the model distribution $\pi_{\theta}$ and the distribution of chosen response. For simplicity, we remove the length averaging from SimPER for the analysis. + +Theorem 3.1. Minimizing SFT with respect to $\theta$ is approximately minimizing the KLD between $\pi_{\theta}$ and the distribution of the chosen response in the preference dataset, while minimizing our SimPER is approximately minimizing the TVD. + +$$ +\min _ {\boldsymbol {\theta}} \mathcal {L} _ {\mathrm {S F T}} \Rightarrow \min _ {\boldsymbol {\theta}} \operatorname {K L} \left(\pi_ {\text {c h o s e n}} (\mathbf {y} \mid \mathbf {x}) \| \pi_ {\boldsymbol {\theta}} (\mathbf {y} \mid \mathbf {x})\right) = \sum_ {\mathbf {y} \in \mathcal {Y}} \pi_ {\text {c h o s e n}} (\mathbf {y} \mid \mathbf {x}) \log \frac {\pi_ {\text {c h o s e n}} (\mathbf {y} \mid \mathbf {x})}{\pi_ {\boldsymbol {\theta}} (\mathbf {y} \mid \mathbf {x})} \tag {12} +$$ + +$$ +\min _ {\boldsymbol {\theta}} \mathcal {L} _ {\text {S i m P E R}} \Rightarrow \min _ {\boldsymbol {\theta}} \operatorname {T V} \left(\pi_ {\text {c h o s e n}} (\mathbf {y} \mid \mathbf {x}) \| \pi_ {\boldsymbol {\theta}} (\mathbf {y} \mid \mathbf {x})\right) = \frac {1}{2} \sum_ {\mathbf {y} \in \mathcal {Y}} \left| \pi_ {\text {c h o s e n}} (\mathbf {y} \mid \mathbf {x}) - \pi_ {\boldsymbol {\theta}} (\mathbf {y} \mid \mathbf {x}) \right| \tag {13} +$$ + +The proof is provided in Appendix A. This theorem demonstrates that SimPER asymptotically optimizes the TVD (Van Handel, 2014; Ji et al., 2023) between the chosen data distributions and the model distribution. In theory, while SimPER and SFT aim to discover identical optimal policies, achieving this in practice would require full data coverage and infinite computation. These requirements are not met in practice, and hence, the choice of divergences and the optimization procedure affects performance. TVD measures the average absolute difference between $\pi_{\mathrm{chosen}}$ and $\pi_{\theta}$ in all possible text sequences, and SimPER learns to properly allocate its probability mass to best represent the main portion of the distribution of the chosen response, while ignoring outliers. This promotes mode-seeking behavior, which concentrates the probability mass on certain high-reward regions. In contrast, the KLD in SFT encourages assigning equal probability to all overestimation of the long tail of the target distribution, as illu + +![](images/b8f5b81d3b4e489660bd754e900373fcb05e1929f052edddf12f0ca4b1b745c9.jpg) +Figure 2: Illustration of the characteristics of KLD and TVD. While SFT exhibits mass-covering behavior by minimizing forward KL, SimPER exhibits mode-seeking behavior, similar to RLHF (Tajwar et al., 2024), by minimizing TVD. + +In summary, forward KLD encourages all chosen responses in datasets to have equal probability, leading to an overestimation of the long tail of the target distribution, whereas reverse TVD sharpens the probability mass on certain high-reward regions of chosen response. Thus, alignment commits to generating a certain subset of high-reward responses, which is more effectively realized by promotes mode-seeking behavior as shown in recent works (Tajwar et al., 2024; Xiao et al., 2024b). + +# 4 EXPERIMENTS + +Models. Following (Meng et al., 2024), we perform alignment with several families of open-source models, Llama3-8B (Base and Instruct.) (Dubey et al., 2024) and Mistral-7B (Base and Instruct.) (Jiang et al., 2023a). We also use Pythia-2.8B (Biderman et al., 2023; Rafailov et al., 2024). + +Datasets. For the Llama3-8B-Base and Mistral-7B-Base setups, we follow the same training pipeline as Zephyr (Tunstall et al., 2023) and evaluate SimPER on the widely used benchmark dataset for preference fine-tuning: the UltraFeedback Binarized dataset (Cui et al., 2023; Tunstall et al., 2023). For the Llama3-8B-Instruct and Mistral-7B-Instruct setups, we evaluate using the on-policy datasets generated by SimPO (Meng et al., 2024). Specifically, we use prompts from UltraFeedback and regenerates the chosen and rejected response pairs with the SFT models. For each prompt, it generates five responses using the SFT model with sampling. We then use lvm-blender/PairRM (Jiang et al., 2023b) to score the five responses, selecting the highest-scoring one as the chosen response and the lowest-scoring one as the rejected response. For Pythia-2.8B, Anthropropic-HH dataset (Bai et al., 2022) is used for dialogue generation to produce helpful and harmless responses (Rafailov et al., 2024). + +Evaluation benchmarks. Following previous work (Rafailov et al., 2024; Tunstall et al., 2023), we evaluate methods fine-tuned on the benchmarks on HuggingFace Open LLM Leaderboard v1 and v2 (Gao et al., 2023b) and instruction-following benchmarks (AlpacaEval2, MT-Bench). For evaluation on Anthropic-HH, we use GPT-4 for zero-shot pair-wise evaluation, consistent with human judgments (see prompts in Appendix B.1). The task and evaluation details are given in Appendix B.1. + +Table 2: AlpacaEval 2 (Li et al., 2023a) and MT-Bench (Zheng et al., 2023) results under the four settings. LC and WR denote length-controlled and raw win rate, respectively. Our SimPER can achieve surprisingly good performance without any hyperparameters across various settings. + +
MethodMistral-7B-BaseMistral-7B-InstructLlama3-8B-BaseLlama3-8B-Instruct
AlpacaEval 2MT-BenchAlpacaEval 2MT-BenchAlpacaEval 2MT-BenchAlpacaEval 2MT-Bench
LC (%)WR (%)GPT-4LC (%)WR (%)GPT-4LC (%)WR (%)GPT-4LC (%)WR (%)GPT-4
SFT8.46.26.317.114.77.56.24.66.626.025.38.1
DPO15.112.57.326.824.97.618.215.57.740.337.98.0
SLiC10.98.97.424.124.67.812.313.77.626.927.58.1
IPO11.89.47.220.320.37.814.414.27.435.635.68.3
KTO13.19.17.024.523.67.714.212.47.833.131.88.2
CPO9.88.96.823.828.87.510.88.17.428.932.28.0
SimPO21.520.87.332.134.87.622.020.37.744.740.58.0
SimPER22.421.37.537.839.57.825.222.97.748.545.78.2
+ +Table 3: Evaluation results on various tasks from the Huggingface Open Leaderboard show that our simple yet effective SimPER achieves superior or comparable performance to other, more complex preference fine-tuning methods, despite eliminating both hyperparameters and the reference model. Although SimPO (Meng et al., 2024) also eliminates the reference model, our SimPER demonstrates significant improvements over it across various settings without relying on any hyperparameters. + +
MethodMMLU-PROIFEvalBBHGPQAMUSRMATHGSM8KARCTruthfulQAWinogradAvg. Rank
Mistral-7B BaseDPO26.7310.4943.2728.4443.651.3621.7661.2653.0676.804.7
SLiC26.5212.4542.3327.9333.741.3833.7455.3848.3677.355.0
IPO25.8711.5240.5928.1542.151.2527.1460.8445.4477.585.4
KTO27.5112.0343.6629.4543.172.3438.5162.3756.6077.272.5
CPO27.0413.3242.0528.4542.152.1533.0657.0047.0776.484.5
SimPO27.1310.6342.9429.0339.682.4922.2162.6350.6877.543.8
SimPER27.8415.8343.9930.1243.952.5733.0263.5053.6476.252.0
LLama3-8B BaseDPO31.5833.6147.8032.2340.484.5338.6764.4253.4876.804.2
SLiC31.1132.3746.5333.2940.553.9248.8261.4354.9577.274.5
IPO30.1831.5246.7832.6139.584.0222.6762.8854.2072.226.4
KTO31.1637.1047.9833.7240.214.1438.9763.1455.7676.094.0
CPO30.9538.5747.1733.1541.594.2546.9361.6954.2976.164.2
SimPO31.6137.5548.3833.2240.084.2331.5465.1959.4676.323.4
SimPER31.9941.7848.6233.8046.034.6151.0267.0662.5976.241.3
Mistral-7B InstructDPO26.8122.8945.4628.1946.431.8935.2566.8968.4076.323.8
SLiC25.6929.5345.2427.0443.901.9539.6559.9065.3076.325.3
IPO25.7527.8543.8126.6143.552.0239.4263.3167.3675.855.8
KTO27.4635.4245.3428.1945.772.3538.8065.7268.4375.913.2
CPO26.8536.8145.0128.1543.282.2838.7463.2367.3876.804.4
SimPO27.1037.5245.7028.0444.712.1935.2566.8968.4076.323.3
SimPER27.8539.8446.1728.3644.922.5140.1166.1368.7876.401.5
LLama3-8B InstructDPO35.8644.5748.3131.0439.028.2349.8163.9959.0174.663.0
SLiC33.2544.0147.5530.5238.108.2966.5761.2653.2376.164.6
IPO32.9743.2746.3130.9538.588.0258.2361.9554.6473.095.5
KTO35.0040.1247.1529.7038.107.6357.0163.5758.1573.405.2
CPO34.5644.0848.5130.0838.817.7567.4062.2954.0173.724.4
SimPO35.0943.0548.9531.2939.158.1650.7262.8060.7073.323.5
SimPER36.6846.0649.5131.7139.358.9968.6162.3755.7175.721.7
+ +Baselines. We compare SimPER with the following preference optimization methods: DPO (Rafailov et al., 2024), SLiC (Zhao et al., 2023), IPO (Azar et al., 2024), KTO (Ethayarajh et al., 2024b), CPO (Xu et al., 2024) and SimPO (Meng et al., 2024). As shown in (Meng et al., 2024), hyperparameter tuning is crucial for achieving optimal performance of preference optimization methods. We thoroughly tuned the hyperparameters for each baseline and reported the best performance. More details of baselines and the hyperparameter search space can be found in Appendix B.2. + +# 4.1 MAIN RESULTS ON BENCHMARKS + +Results on Instruction-following Benchmarks. In Table 2, we report the performance on the widely-used instruction-following benchmarks: MT-Bench and AlpacaEval 2. A notable improvement in the performance of SimPER on MT-Bench, as well as on AlpacaEval 2, is observed. Notably, the Llama3 fine-tuned by SimPER surpassed the performance of best baseline by 4.9 to 5.2 points on the AlpacaEval 2 win rate across base and instruct settings, demonstrating that SimPER, while + +![](images/8666a88ad629d7be3f9968ca906d05261eb3dfe014ccf4e6498b933bee7f1cd2.jpg) +Figure 5: The training dynamics during training of SimPER and SimPO with different hyperparameters on the Llama3-8B-Base. We can observe that SimPER exhibits the least decline in chosen likelihoods, while still achieving the most significant increase in likelihood margins of rejected and chosen, compared to SimPO across various hyperparameters, and better performance as shown in Table 2. + +eliminating the need for hyperparameters and a reference model, still achieves strong performance. Moreover, SimPER consistently achieves superior performance on LC win rate, demonstrating that it can generate high-quality response without substantially increasing response length. We find that MT-Bench exhibits poor separability across different methods, likely due to the limited scale of its evaluation data and its single-instance scoring protocol. This finding aligns with observations reported in (Meng et al., 2024; Li et al., 2024). Nevertheless, on MT-Bench, SimPER can still consistently achieve superior or comparable performance across various models. Additionally, we provide examples generated by both SimPO and SimPER in Appendix C. These examples demonstrate that SimPER shows strong promise in aligning language models, ensuring that the generated responses are not only high-quality but also better structured and more reasonable. + +Results on Downstream Tasks. In Table 3, we present a comparative analysis of performance gains in downstream tasks on the HuggingFace Leadboard, along with a comparative ranking across all tasks. As shown in the table, SimPER, despite its simplicity, achieves remarkable improvements over SimPO and DPO, particularly on challenging reasoning benchmarks such as IFEval, MMLU-PRO and Math. Our results demonstrate that SimPER is highly effective in improving performance across various models. Notably, SimPER outperforms the best baseline by 1.48 to 4.2 points on IFEval across various models. The average improvements over SimPO are especially notable in Mistral-Base and Llama3-Base. SimPER, despite its simplicity, achieves the best overall performance. These consistent and significant improvements highlight the robustness and effectiveness + +of SimPER. In particular, SimPER outperforms the recent SimPO by 19.48 points in GSM8K and 4.23 points in IFEval on Llama3-Base. On GSM8K, SimPER consistently achieves superior performance, though it is occasionally surpassed by CPO on Mistral-Base. We hypothesize that these improvements over SimPO can be attributed to the reduced decrease in the likelihood of chosen responses; As the likelihood of a chosen response decreases, it results in suboptimal performance, particularly in mathematical reasoning and coding tasks, where the chosen responses are very likely ground-truth answers, as also shown in (Pal et al., 2024; Yuan et al., 2024b). These observations suggest the strong potential of SimPER in real-world applications due to the elimination of hyperparameters and the reference model in the loss function, making it more computationally and memory efficient. + +![](images/6defcfc4a84eced9463e5055b5c0f706d9e9af7771216846b98ce0131613f9e8.jpg) +Figure 4: The win rates, computed by GPT-4, in comparison to the chosen responses of test prompts in the Anthropic-HH dataset. + +Results on Safety Alignment. The benchmarks used above focus mainly on helpfulness. To further evaluate the effectiveness of SimPER in safety alignment on Pythia-2.8B following (Rafailov et al., 2024), we use the Anthropic-HH dataset. Figure 4 shows the win rates computed by GPT-4 over the chosen responses in the test set of Anthropic-HH. Remarkably, SimPER aligns better with human preferences than SimPO, DPO, and IPO, achieving win rates of approximately $60\%$ against the chosen responses, indicating that SimPER shows strong promise in terms of aligning language models and can ensure that the generated responses are not only high-quality but also safe and harmless. + +![](images/b3757aeca2311f4a1b20386f19078ee1d249c7b2d390252a7f3e4d3787ff3b6e.jpg) + +![](images/aa5e3ca45408a41e6e2ef82d60d417af4ec53163b82e69d34b3a1a400e28add1.jpg) +Figure 6: Analyzing perplexity density and response length correlation on Mistral-7B-Base and Llama-3-8B-Base. SimPER not only achieves lower perplexity but also does not exploit length bias. Table 4: Ablation Study Results on Mistral-7B-Base and Llama3-8B-Base: Evaluating the Effects of Removing Length Normalization (w/o LN) and Incorporating a Reference Model (w/ Ref.). + +
MethodOpen LLM Leaderboard v2Open LLM Leaderboard v1
MMLU ProIFEvalBBHGPQAMUSRMATHGSM8KARCTruthfulQAWinograd
Mistral-7B BaseSimPER27.8415.8343.9930.1243.952.5731.9263.5053.6476.25
- w/o LN25.371.6641.7629.8744.843.2528.7359.8140.5777.03
- w/ Ref.27.3116.3243.9930.5440.742.1126.9161.8643.6276.72
Llama3-8B BaseSimPER31.9941.7848.6233.8046.034.6151.0267.0662.5976.24
- w/o LN30.0836.3148.6232.0545.373.1744.2860.5846.8776.64
- w/ Ref.32.0636.7149.3031.7141.534.6145.1963.4050.8475.77
+ +# 4.2 ABLATIONS AND FURTHER ANALYSIS + +Results on Ablation Study. In Table 4, we evaluated the effects of removing length normalization (w/o LN) and incorporating a reference model (w/ Ref.) in SimPER on the Open LLM Leaderboard. Removing length normalization generally leads to a decline in performance across most tasks, except for a slight improvement in the Winograd. Incorporating a reference model typically results in a performance decrease. However, it does lead to slight improvements in specific tasks such as IFEval, GPQA, and BBH for the Mistral-7B-Base model, and in MMLU Pro, BBH, and MATH for the Llama3-8B-Base model. Based on this ablation study, we can conclude that maintaining length normalization and removing the reference model generally enhances the performance of our method. + +Analysis on Perplexity Density. As shown in Figure 6, the analysis of perplexity density on the held-out test set indicates that SimPER consistently achieves a lower perplexity compared to SimPO. Specifically, on Mistral-7B-Base, the density peak of SimPER is reduced by approximately 1 relative to SimPO, and on the Llama-3-8B-Base, it is reduced by approximately 2. These suggest that SimPER is capable of generating more predictable and coherent responses by directly optimizing the perplexity. + +Analysis on Response Length Correlation. Spearman correlation between response length and log probabilities in Figure 6 shows that SimPER exhibits a significantly lower correlation compared to DPO, and is comparable to SimPO, suggesting that SimPER does not exploit length bias and generate longer sequences. In contrast, SimPER results in a spearman correlation coefficient similar to the SimPO (Meng et al., 2024). Our results demonstrate that SimPER, despite its simplicity, consistently and significantly outperforms existing approaches without substantially increasing response length. + +# 5 CONCLUSION + +In this paper, we propose a simple yet effective alignment method for large language models, named SimPER. SimPER eliminates the need for both hyperparameters and a reference model while achieving strong performance. The key idea of SimPER is to directly optimize the reverse perplexity of both the chosen and rejected responses in the preference dataset. Specifically, we minimize the perplexity over the chosen response while maximizing the perplexity over the rejected response, ensuring that the model produces responses with high preference scores. We also provide a theoretical understanding of SimPER, demonstrating that it can mitigate the problem of gradient imbalance between the chosen and rejected responses during optimization. Furthermore, we show that SimPER implicitly exhibits mode-seeking behavior, leading to strong alignment performance. Extensive experiments on widely used benchmarks demonstrate that SimPER significantly outperforms state-of-the-art methods. + +# ACKNOWLEDGMENT + +The work of Vasant G Honavar and Teng Xiao was supported in part by grants from the National Science Foundation (2226025, 2225824), the National Center for Advancing Translational Sciences, and the National Institutes of Health (UL1 TR002014). + +# REFERENCES + +Zachary Ankner, Cody Blakeney, Kartik Sreenivasan, Max Marion, Matthew L Leavitt, and Mansheej Paul. Perplexed by perplexity: Perplexity-based data pruning with small reference models. arXiv preprint arXiv:2405.20541, 2024. +Mohammad Gheshlaghi Azar, Zhaohan Daniel Guo, Bilal Piot, Remi Munos, Mark Rowland, Michal Valko, and Daniele Calandriello. A general theoretical paradigm to understand learning from human preferences. In AISTATS, pp. 4447-4455, 2024. +Yuntao Bai, Andy Jones, Kamal Ndousse, Amanda Askell, Anna Chen, Nova DasSarma, Dawn Drain, Stanislav Fort, Deep Ganguli, Tom Henighan, et al. Training a helpful and harmless assistant with reinforcement learning from human feedback. arXiv preprint arXiv:2204.05862, 2022. +Edward Beeching, Clémentine Fourrier, Nathan Habib, Sheon Han, Nathan Lambert, Nazneen Rajani, Omar Sanseviero, Lewis Tunstall, and Thomas Wolf. Open llm leaderboard. Hugging Face, 2023a. +Edward Beeching, Clémentine Fourrier, Nathan Habib, Sheon Han, Nathan Lambert, Nazneen Rajani, Omar Sanseviero, Lewis Tunstall, and Thomas Wolf. Open llm leaderboard (2023-2024). https://huggingface.co/spaces/open-llm-leaderboard-old/open_11m_leaderboard, 2023b. +Stella Biderman, Hailey Schoelkopf, Quentin Gregory Anthony, Herbie Bradley, Kyle O'Brien, Eric Hallahan, Mohammad Aflah Khan, Shivanshu Purohit, USVSN Sai Prashanth, Edward Raff, et al. Pythia: A suite for analyzing large language models across training and scaling. In ICML, pp. 2397-2430, 2023. +Ralph Allan Bradley and Milton E Terry. Rank analysis of incomplete block designs: I. the method of paired comparisons. Biometrika, pp. 324-345, 1952. +Huayu Chen, Guande He, Hang Su, and Jun Zhu. Noise contrastive alignment of language models with explicit rewards. arXiv preprint arXiv:2402.05369, 2024a. +Yukang Chen, Shengju Qian, Haotian Tang, Xin Lai, Zhijian Liu, Song Han, and Jiaya Jia. Longlora: Efficient fine-tuning of long-context large language models. ICLR, 2024b. +Paul F Christiano, Jan Leike, Tom Brown, Miljan Martic, Shane Legg, and Dario Amodei. Deep reinforcement learning from human preferences. NeurIPS, 30, 2017. +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, 2018. +Karl Cobbe, Vineet Kosaraju, Mohammad Bavarian, Mark Chen, Heewoo Jun, Lukasz Kaiser, Matthias Plappert, Jerry Tworek, Jacob Hilton, Reiichiro Nakano, et al. Training verifiers to solve math word problems. arXiv preprint arXiv:2110.14168, 2021. +Ganqu Cui, Lifan Yuan, Ning Ding, Guanming Yao, Wei Zhu, Yuan Ni, Guotong Xie, Zhiyuan Liu, and Maosong Sun. Ultrafeedback: Boosting language models with high-quality feedback. arXiv preprint arXiv:2310.01377, 2023. +Abhimanyu Dubey, Abhinav Jauhri, Abhinav Pandey, Abhishek Kadian, Ahmad Al-Dahle, Aiesha Letman, Akhil Mathur, Alan Schelten, Amy Yang, Angela Fan, et al. The llama 3 herd of models. arXiv preprint arXiv:2407.21783, 2024. + +Logan Engstrom, Andrew Ilyas, Shibani Santurkar, Dimitris Tsipras, Firdaus Janoos, Larry Rudolph, and Aleksander Madry. Implementation matters in deep policy gradients: A case study on ppo and trpo. In *ICLR*, 2020. +Kawin Ethayarajh, Winnie Xu, Niklas Muennighoff, Dan Jurafsky, and Douwe Kiela. Model alignment as prospect theoretic optimization. ICML, 2024a. +Kawin Ethayarajh, Winnie Xu, Niklas Muennighoff, Dan Jurafsky, and Douwe Kiela. Kto: Model alignment as prospect theoretic optimization. ICML, 2024b. +Clémentine Fourrier, Nathan Habib, Alina Lozovskaya, Konrad Szafer, and Thomas Wolf. Open llm leaderboard v2. https://huggingface.co/spaces/open-llm-leaderboard/open_llm_leaderboard, 2024. +Leo Gao, John Schulman, and Jacob Hilton. Scaling laws for reward model overoptimization. In ICML, pp. 10835-10866, 2023a. +Leo Gao, Jonathan Tow, Baber Abbasi, Stella Biderman, Sid Black, Anthony DiPofi, Charles Foster, Laurence Golding, Jeffrey Hsu, Alain Le Noac'h, Haonan Li, Kyle McDonell, Niklas Muennighoff, Chris Ociepa, Jason Phang, Laria Reynolds, Hailey Schoelkopf, Aviya Skowron, Lintang Sutawika, Eric Tang, Anish Thite, Ben Wang, Kevin Wang, and Andy Zou. A framework for few-shot language model evaluation, 12 2023b. URL https://zenodo.org/records/10256836. +Hila Gonen, Srini Iyer, Terra Blevins, Noah A Smith, and Luke Zettlemoyer. Demystifying prompts in language models via perplexity estimation. EMNLP, 2023. +Dan Hendrycks, Collin Burns, Saurav Kadavath, Akul Arora, Steven Basart, Eric Tang, Dawn Song, and Jacob Steinhardt. Measuring mathematical problem solving with the math dataset, 2021. URL https://arxiv.org/abs/2103.03874. +Jiwoo Hong, Noah Lee, and James Thorne. Orpo: Monolithic preference optimization without reference model. arXiv preprint arXiv:2403.07691, pp. 5, 2024. +HuggingFace. Preference tuning: Fine-tuning language models with human feedback. https://huggingface.co/blog/pref-tuning, 2023. +Fred Jelinek, Robert L Mercer, Lalit R Bahl, and James K Baker. Perplexity—a measure of the difficulty of speech recognition tasks. The Journal of the Acoustical Society of America, pp. S63-S63, 1977. +Haozhe Ji, Pei Ke, Zhipeng Hu, Rongsheng Zhang, and Minlie Huang. Tailoring language generation models under total variation distance. In ICLR, 2023. +Haozhe Ji, Cheng Lu, Yilin Niu, Pei Ke, Hongning Wang, Jun Zhu, Jie Tang, and Minlie Huang. Towards efficient and exact optimization of language model alignment. arXiv preprint arXiv:2402.00856, 2024. +Albert Q Jiang, Alexandre Sablayrolles, Arthur Mensch, Chris Bamford, Devendra Singh Chaplot, Diego de las Casas, Florian Bressand, Gianna Lengyel, Guillaume Lample, Lucile Saulnier, et al. Mistral 7b. arXiv preprint arXiv:2310.06825, 2023a. +Dongfu Jiang, Xiang Ren, and Bill Yuchen Lin. Llm-blender: Ensembling large language models with pairwise ranking and generative fusion. arXiv preprint arXiv:2306.02561, 2023b. +Diederik P Kingma. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014. +Tianle Li, Wei-Lin Chiang, Evan Frick, Lisa Dunlap, Banghua Zhu, Joseph E Gonzalez, and Ion Stoica. From live data to high-quality benchmarks: The arena-hard pipeline, april 2024. URL https://lmsys.org/blog/2024-04-19-arena-hard, 2024. +Xuechen Li, Tianyi Zhang, Yann Dubois, Rohan Taori, Ishaan Gulrajani, Carlos Guestrin, Percy Liang, and Tatsunori B. Hashimoto. AlpacaEval: An automatic evaluator of instruction-following models. *GitHub repository*, 2023a. + +Xuechen Li, Tianyi Zhang, Yann Dubois, Rohan Taori, Ishaan Gulrajani, Carlos Guestrin, Percy Liang, and Tatsunori B Hashimoto. Alpacaeval: An automatic evaluator of instruction-following models, 2023b. +Stephanie Lin, Jacob Hilton, and Owain Evans. TruthfulQA: Measuring how models mimic human falsehoods. In Smaranda Muresan, Preslav Nakov, and Aline Villavicencio (eds.), ACL, pp. 3214-3252, 2022. +Tianlin Liu, Shangmin Guo, Leonardo Bianco, Daniele Calandriello, Quentin Berthet, Felipe Llinares-López, Jessica Hoffmann, Lucas Dixon, Michal Valko, and Mathieu Blondel. Decoding-time realignment of language models. ICML, 2024a. +Xin Liu, Muhammad Khalifa, and Lu Wang. Littcab: Lightweight language model calibration over short-and long-form responses. *ICLR*, 2024b. +Yixin Liu, Pengfei Liu, and Arman Cohan. Understanding reference policies in direct preference optimization. arXiv preprint arXiv:2407.13709, 2024c. +Max Marion, Ahmet Üstün, Luiza Pozzobon, Alex Wang, Marzieh Fadaee, and Sara Hooker. When less is more: Investigating data pruning for pretraining llms at scale. ArXiv, 2023. +Costas Mavromatis, Petros Karypis, and George Karypis. Pack of llms: Model fusion at test-time via perplexity optimization. arXiv preprint arXiv:2404.11531, 2024. +Yu Meng, Mengzhou Xia, and Danqi Chen. Simpo: Simple preference optimization with a reference-free reward. arXiv preprint arXiv:2405.14734, 2024. +Niklas Muennighoff, Alexander Rush, Boaz Barak, Teven Le Scao, Nouamane Tazi, Aleksandra Piktus, Sampo Pyysalo, Thomas Wolf, and Colin A Raffel. Scaling data-constrained language models. NeurIPS, 2024. +Long Ouyang, Jeffrey Wu, Xu Jiang, Diogo Almeida, Carroll Wainwright, Pamela Mishkin, Chong Zhang, Sandhini Agarwal, Katarina Slama, Alex Ray, et al. Training language models to follow instructions with human feedback. NeurIPS, pp. 27730-27744, 2022. +Arka Pal, Deep Karkhanis, Samuel Dooley, Manley Roberts, Siddartha Naidu, and Colin White. Smaug: Fixing failure modes of preference optimisation with dpo-positive. *Arxiv*, 2024. +Richard Yuanzhe Pang, Weizhe Yuan, Kyunghyun Cho, He He, Sainbayar Sukhbaatar, and Jason Weston. Iterative reasoning preference optimization. arXiv preprint arXiv:2404.19733, 2024. +Rafael Rafailov, Archit Sharma, Eric Mitchell, Christopher D Manning, Stefano Ermon, and Chelsea Finn. Direct preference optimization: Your language model is secretly a reward model. NeurIPS, 36, 2024. +David Rein, Betty Li Hou, Asa Cooper Stickland, Jackson Petty, Richard Yuanzhe Pang, Julien Dirani, Julian Michael, and Samuel R. Bowman. Gpqa: A graduate-level google-proof q&a benchmark, 2023. URL https://arxiv.org/abs/2311.12022. +Keisuke Sakaguchi, Ronan Le Bras, Chandra Bhagavatula, and Yejin Choi. Winogrande: An adversarial winograd schema challenge at scale. Communications of the ACM, pp. 99-106, 2021. +John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms. arXiv preprint arXiv:1707.06347, 2017. +Zayne Sprague, Xi Ye, Kaj Bostrom, Swarat Chaudhuri, and Greg Durrett. Musr: Testing the limits of chain-of-thought with multistep soft reasoning. 2310.16049, 2024. +Nisan Stiannon, Long Ouyang, Jeffrey Wu, Daniel Ziegler, Ryan Lowe, Chelsea Voss, Alec Radford, Dario Amodei, and Paul F Christiano. Learning to summarize with human feedback. NeurIPS, pp. 3008-3021, 2020. +Mirac Suzgun, Nathan Scales, Nathanael Scharli, Sebastian Gehrmann, Yi Tay, Hyung Won Chung, Aakanksha Chowdhery, Quoc V. Le, Ed H. Chi, Denny Zhou, and Jason Wei. Challenging big-bench tasks and whether chain-of-thought can solve them. 2210.09261, 2022. + +Fahim Tajwar, Anikait Singh, Archit Sharma, Rafael Rafailov, Jeff Schneider, Tengyang Xie, Stefano Ermon, Chelsea Finn, and Aviral Kumar. Preference fine-tuning of llms should leverage suboptimal, on-policy data. arXiv preprint arXiv:2404.14367, 2024. +Katherine Tian, Eric Mitchell, Huaxiu Yao, Christopher D Manning, and Chelsea Finn. Fine-tuning language models for factuality. arXiv preprint arXiv:2311.08401, 2023. +Lewis Tunstall, Edward Beeching, Nathan Lambert, Nazneen Rajani, Kashif Rasul, Younes Belkada, Shengyi Huang, Leandro von Werra, Clémentine Fourrier, Nathan Habib, et al. Zephyr: Direct distillation of lm alignment. arXiv preprint arXiv:2310.16944, 2023. +Simon Valentin, Jinmiao Fu, Gianluca Detommaso, Shaoyuan Xu, Giovanni Zappella, and Bryan Wang. Cost-effective hallucination detection for llms. arXiv preprint arXiv:2407.21424, 2024. +Ramon Van Handel. Probability in high dimension. Lecture Notes (Princeton University), pp. 2-3, 2014. +Yubo Wang, Xueguang Ma, Ge Zhang, Yuansheng Ni, Abhranil Chandra, Shiguang Guo, Weiming Ren, Aaran Arulraj, Xuan He, Ziyan Jiang, Tianle Li, Max Ku, Kai Wang, Alex Zhuang, Rongqi Fan, Xiang Yue, and Wenhu Chen. Mmlu-pro: A more robust and challenging multi-task language understanding benchmark, 2024. URL https://arxiv.org/abs/2406.01574. +Yuqiao Wen, Zichao Li, Wenyu Du, and Lili Mou. f-divergence minimization for sequence-level knowledge distillation. In ACL, pp. 10817-10834, 2023. +Junkang Wu, Yuexiang Xie, Zhengyi Yang, Jiancan Wu, Jinyang Gao, Bolin Ding, Xiang Wang, and Xiangnan He. beta-dpo: Direct preference optimization with dynamic beta. *Arxiv*, 2024. +Mengzhou Xia, Sadhika Malladi, Suchin Gururangan, Sanjeev Arora, and Danqi Chen. Less: Selecting influential data for targeted instruction tuning. In ICML, 2024. +Teng Xiao and Donglin Wang. A general offline reinforcement learning framework for interactive recommendation. In Proceedings of the AAAI Conference on Artificial Intelligence, 2021. +Teng Xiao, Mingxiao Li, Yige Yuan, Huaisheng Zhu, Chao Cui, and Vasant G Honavar. How to leverage demonstration data in alignment for large language model? a self-imitation learning perspective. arXiv preprint arXiv:2410.10093, 2024a. +Teng Xiao, Yige Yuan, Huaisheng Zhu, Mingxiao Li, and Vasant G. Honavar. Cal-dpo: Calibrated direct preference optimization for language model alignment. Advances in Neural Information Processing Systems, 37, 2024b. +Haoran Xu, Amr Sharaf, Yunmo Chen, Weiting Tan, Lingfeng Shen, Benjamin Van Durme, Kenton Murray, and Young Jin Kim. Contrastive preference optimization: Pushing the boundaries of llm performance in machine translation. In ICML, 2024. +Hongyi Yuan, Zheng Yuan, Chuanqi Tan, Wei Wang, Songfang Huang, and Fei Huang. Rrhf: Rank responses to align language models with human feedback. NeurIPS, 2024a. +Lifan Yuan, Ganqu Cui, Hanbin Wang, Ning Ding, Xingyao Wang, Jia Deng, Boji Shan, Huimin Chen, Ruobing Xie, Yankai Lin, et al. Advancing llm reasoning generalists with preference trees. arXiv preprint arXiv:2404.02078, 2024b. +Yao Zhao, Rishabh Joshi, Tianqi Liu, Misha Khalman, Mohammad Saleh, and Peter J Liu. Slic-hf: Sequence likelihood calibration with human feedback. arXiv preprint arXiv:2305.10425, 2023. +Lianmin Zheng, Wei-Lin Chiang, Ying Sheng, Siyuan Zhuang, Zhanghao Wu, Yonghao Zhuang, Zi Lin, Zhuohan Li, Dacheng Li, Eric Xing, et al. Judging LLM-as-a-judge with MT-Bench and Chatbot Arena. In NeurIPS Datasets and Benchmarks Track, 2023. +Chunting Zhou, Pengfei Liu, Puxin Xu, Srinivasan Iyer, Jiao Sun, Yuning Mao, Xuezhe Ma, Avia Efrat, Ping Yu, Lili Yu, et al. Lima: Less is more for alignment. NeurIPS, 36, 2024. +Jeffrey Zhou, Tianjian Lu, Swaroop Mishra, Siddhartha Brahma, Sujoy Basu, Yi Luan, Denny Zhou, and Le Hou. Instruction-following evaluation for large language models. 2311.07911, 2023. + +# A PROOFS OF THEOREM 3.1 + +To prove Theorem 3.1 in the main paper, we first present the following Lemmas: + +Lemma A.1. Given the model conditional distribution $\pi_{\theta}(\mathbf{y}\mid \mathbf{x}) = \prod_{i = 1}^{\lvert\mathbf{y}\rvert}\pi_{\theta}\left(\mathbf{y}_{i}\mid \mathbf{x},\mathbf{y}_{< i}\right)$ and data distribution $\pi_{\mathrm{data}}(\mathbf{y}\mid \mathbf{x}) = \prod_{i = 1}^{\lvert\mathbf{y}\rvert}\pi_{\mathrm{data}}\left(\mathbf{y}_{i}\mid \mathbf{x},\mathbf{y}_{< i}\right)$ , then we have the following relationship between the sequence-level TVD objective and its token-level factorization: + +$$ +\operatorname {T V} \left(\pi_ {\text {d a t a}} (\mathbf {y} \mid \mathbf {x}), \pi_ {\theta} (\mathbf {y} \mid \mathbf {x})\right) \leq \mathbb {E} _ {\mathbf {y} \sim \pi_ {\text {d a t a}} (\mathbf {y} \mid \mathbf {x})} \left[ \sum_ {i = 1} ^ {| \mathbf {y} |} \operatorname {T V} \left(\pi_ {\text {d a t a}} ^ {< i} \left(\mathbf {y} _ {i}\right), \pi_ {\theta} ^ {< i} \left(\mathbf {y} _ {i}\right)\right) \right], \tag {14} +$$ + +where $\pi_{\mathrm{data}}^{ More helpful: "<"1" or "2"> + +Table 5: Prompt for GPT-4 evaluation for the safety alignment task on the Anthropic-HH dataset. {dialogue history}, {Response 1} and {Response 2} are placeholders. + +DPO Direct Preference Optimization (Rafailov et al., 2024) uses log-likelihood differences to implicitly represent the reward function, eliminating the need for explicit reward model like RLHF. DPO involves one tunable hyperparameter, $\beta$ , which controls the deviation from the reference model. + +$$ +\mathcal {L} _ {\mathrm {D P O}} (\boldsymbol {\theta}; \mathcal {D}) = \mathbb {E} _ {(\mathbf {x}, \mathbf {y} _ {w}, \mathbf {y} _ {l}) \sim \mathcal {D}} \left[ - \log \sigma (\beta \log \frac {\pi (\mathbf {y} _ {w} \mid \mathbf {x})}{\pi_ {\mathrm {r e f}} (\mathbf {y} _ {w} \mid \mathbf {x})} - \beta \log \frac {\pi (\mathbf {y} _ {l} \mid \mathbf {x})}{\pi_ {\mathrm {r e f}} (\mathbf {y} _ {l} \mid \mathbf {x})}) \right]. +$$ + +IPO Identity Preference Optimization (Azar et al., 2024) minimizes a squared loss regression problem by defining an alternative reward function, avoiding unstable RL training. IPO involves one hyperparameter, $\beta$ , to adjust the reward margin. + +$$ +\mathcal {L} _ {\mathrm {I P O}} (\theta ; \mathcal {D}) = \mathbb {E} _ {(\mathbf {x}, \mathbf {y} _ {w}, \mathbf {y} _ {l}) \sim \mathcal {D}} \left[ \left(\log \frac {\pi_ {\theta} (\mathbf {y} _ {w} \mid \mathbf {x}) \pi_ {\mathrm {r e f}} (\mathbf {y} _ {l} \mid \mathbf {x})}{\pi_ {\theta} (\mathbf {y} _ {l} \mid \mathbf {x}) \pi_ {\mathrm {r e f}} (\mathbf {y} _ {w} \mid \mathbf {x})} - \frac {1}{2 \beta}\right) ^ {2} \right]. +$$ + +CPO Contrastive Preference Optimization (Xu et al., 2024) uses log-likelihood as the reward and is trained alongside a Supervised Fine-Tuning (SFT) objective. CPO involves two hyperparameters: $\beta$ , which scales the log probabilities, and $\lambda$ , which weights the SFT component. + +$$ +\mathcal {L} _ {\mathrm {C P O}} (\theta ; \mathcal {D}) = - \log \sigma (\beta \log \pi_ {\theta} (\mathbf {y} _ {w} \mid \mathbf {x}) - \beta \log \pi_ {\theta} (\mathbf {y} _ {l} \mid \mathbf {x})) - \lambda \log \pi_ {\theta} (\mathbf {y} _ {w} \mid \mathbf {x}). +$$ + +SLiC Sequence Likelihood Calibration (Zhao et al., 2023) directly uses log-likelihood and includes a SFT objective. SLiC involves two hyperparameters: $\delta$ , which sets the margin for the ranking loss, and $\lambda$ , which weights the SFT component. + +$$ +\mathcal {L} _ {\mathrm {S L i C}} (\theta ; \mathcal {D}) = \max \left(0, \delta - \log \pi_ {\theta} (\mathbf {y} _ {w} \mid \mathbf {x}) + \log \pi_ {\theta} (\mathbf {y} _ {l} \mid \mathbf {x})\right) - \lambda \log \pi_ {\theta} (\mathbf {y} _ {w} \mid \mathbf {x}). +$$ + +SimPO Simple Preference Optimization (Meng et al., 2024) eliminates the need for a reference model and optimizes a length-regularized probability of response pairs. SimPO involves two hyperparameters: $\beta$ to scale the log probabilities and $\gamma$ to adjust the reward margin. + +$$ +\mathcal {L} _ {\mathrm {S i m P O}} (\theta ; \mathcal {D}) = \mathbb {E} _ {(\mathbf {x}, \mathbf {y} _ {w}, \mathbf {y} _ {l}) \sim \mathcal {D}} \left[ - \log \sigma \left(\beta \log \pi_ {\theta} (\mathbf {y} _ {w} | \mathbf {x}) - \beta \log \pi_ {\theta} (\mathbf {y} _ {l} | \mathbf {x})\right) - \gamma \right]. +$$ + +KTO Kahneman-Tversky Optimization (Ethayarajh et al., 2024b) learns from non-paired preference data. KTO involves three hyperparameters: $\beta$ , which controls the deviation from the reference model; $\lambda_w$ and $\lambda_l$ , which weight the preference components for winning and losing responses, respectively. + +$$ +\mathcal {L} _ {\mathrm {K T O}} (\theta ; \mathcal {D}) = - \lambda_ {w} \sigma \left(\beta \log \frac {\pi_ {\theta} \left(\mathbf {y} _ {w} \mid \mathbf {x}\right)}{\pi_ {\mathrm {r e f}} \left(\mathbf {y} _ {w} \mid \mathbf {x}\right)} - z _ {\mathrm {r e f}}\right) + \lambda_ {l} \sigma \left(z _ {\mathrm {r e f}} - \beta \log \frac {\pi_ {\theta} \left(\mathbf {y} _ {l} \mid \mathbf {x}\right)}{\pi_ {\mathrm {r e f}} \left(\mathbf {y} _ {l} \mid \mathbf {x}\right)}\right), \tag {33} +$$ + +where $z_{\mathrm{ref}} = \mathbb{E}_{(x,y)\sim \mathcal{D}}\left[\beta \mathrm{KL}\left(\pi_{\theta}(\mathbf{y}|\mathbf{x})||\pi_{\mathrm{ref}}(\mathbf{y}|\mathbf{x})\right)\right]$ + +# B.3 IMPLEMENTATION DETAILS + +Training Hyperparameters. For general hyperparameters, we adhered strictly to the settings used in SimPO. We applied the following hyperparameters: For the SFT stage, we use a learning rate of $2 \times 10^{-5}$ . For both the SFT and the preference optimization stages, we use a batch size of 128, a maximum sequence length of 2048, and a cosine learning rate schedule with $10\%$ warmup steps for one epoch, all through the Adam optimizer (Kingma, 2014). We maintain these settings consistently to ensure uniformity and comparability across experiments. + +For method-specific hyperparameters, we also followed the search strategy from SimPO, noting that our method does not require any additional hyperparameters beyond the learning rate. Specifically, for different baseline methods, each with its own set of additional hyperparameters, the search strategy is in Table 6. Each method is individually search for the learning rates in $[3e - 7,5e - 7,6e - 7,1e - 6]$ . + +Table 6: Search ranges for hyperparameters across baseline methods + +
MethodHyperparameter Search Range
DPOβ ∈ [0.01, 0.05, 0.1]
IPOτ ∈ [0.01, 0.1, 0.5, 1.0]
CPOλ = 1.0 +β ∈ [0.01, 0.05, 0.1]
SLiCλ ∈ [0.1, 0.5, 1.0, 10.0] +δ ∈ [0.1, 0.5, 1.0, 2.0]
KTOλl = λw = 1.0 +β ∈ [0.01, 0.05, 0.1]
SimPOβ ∈ [2.0, 2.5] +γ ∈ [0.3, 0.5, 1.0, 1.2, 1.4, 1.6]
+ +Evaluation Hyperparameters. The hyperparameters for evaluation on AlpacaEval 2 adhere to SimPO, with a temperature of 0.7 for the Mistral-Base setting, a temperature of 0.5 for the Mistral-Instruct setting, and a temperature of 0.9 for both Llama3 settings. The hyperparameters for evaluation on MT-Bench are set according to the official decoding configuration, which specifies distinct sampling temperatures for various categories. + +Computation Resources. All the training experiments in this paper were conducted on $4 \times$ NVIDIA A100 (80G) GPUs with 128 batchsize, based on the alignment-handbook repo. $^3$ + +# C CASE STUDY + +In this section, we present examples of comparisons between SimPER and the baseline SimPO. + +# Prompt Does the 5 second rule actually exist? + +SimPER The "5 second rule" is an urban legend that claims that if food falls on the floor, it is still safe to eat as long as you pick it up within 5 seconds. However, this rule is not a scientifically proven fact, and there is no evidence to support it. Here are some reasons why the 5-second rule is not a reliable method for determining food safety: + +1. Bacteria and viruses can transfer quickly: Bacteria and viruses can transfer from surfaces to food within seconds. The amount of time that passes between a food item's contact with a contaminated surface and its being picked up can affect the likelihood of bacterial or viral transmission. +2. Contamination levels on floors and surfaces: The level of contamination on floors and surfaces can vary widely depending on the environment, the cleanliness of the area, and the presence of moisture. Even if a surface is dry, bacteria and viruses can still be present. +3. Personal hygiene: The cleanliness of your hands, the surface you place the food on, and the utensils you use to pick up the food all play a role in food safety. Picking up food within 5 seconds does not ensure that it is clean enough to eat. +4. Temperature: The temperature of food can also affect the risk of bacterial or viral contamination. Food that has been at room temperature for a prolonged time, even if picked up quickly, may still harbor dangerous bacteria. + +Therefore, it is best to follow proper food handling and preparation practices, such as washing hands before and after handling food, using clean utensils and surfaces, and cooking food to the appropriate temperatures to ensure its safety. + +SimPO The "5-second rule" refers to a popular myth or belief that suggests touching food on the ground for less than five seconds makes it safe to consume without contamination. However, this rule does not exist scientifically. According to food safety guidelines, bacteria can transfer from contaminated surfaces to food within seconds, regardless of the elapsed time. The duration of contact between the food and contaminated surfaces plays a crucial role in determining the likelihood of bacterial transfer, but it's not limited to five seconds. Cross-contamination occurs when bacteria from unwashed hands, dirty utensils, or contaminated surfaces come into contact with food, leading to potential foodborne illnesses. Therefore, adhering to proper hygiene practices, such as washing hands, cleaning surfaces, and cooking food thoroughly, remains essential to prevent food contamination. In summary, there is no scientific basis for the "5-second rule," and relying solely on this belief could increase the risk of consuming contaminated food." + +Table 7: An AlpacaEval 2 generation from the Llama-3-8B-Base model trained with SimPER and SimP0. Alpaca-Eval-GPT4-Turbo prefers SimPER over SimP0. Compared to SimP0, the generation by SimPER is better structured, with hierarchical discussions that make it more helpful. + +# Prompt How do I make escargot? + +# SimPER Here's a general recipe for making escargot: + +# Ingredients: + +- 1 pound fresh snails (escargots) +- 1/4 cup butter, at room temperature +- 1 clove garlic, minced +- 2 tablespoons finely chopped parsley +- 2 tablespoons finely chopped shallots +- 2 tablespoons dry white wine +- 2 tablespoons lemon juice +- 1/4 teaspoon ground black pepper +- 1/4 cup eyebrows +- 1/4 cup grated Parmesan cheese +- Salt, to taste +- 1 tablespoon olive oil + +# Equipment: + +- Snail shells +- Foil +-A heavy-bottomed skillet +-A wooden spoon +-A baking dish +-A fine-mesh strainer +-A small saucepan +-A mixing bowl +- Parchment paper + +# Instructions: + +1. Preheat the oven to 375F (190C) +2. Scrub the snails under cool running water to remove any dirt or debris. Discard any snails that are not alive. Soak the snails in salted water for at least 30 minutes, changing the water every 10 minutes, to ensure they are thoroughly cleaned. +3. In a small saucepan, melt the butter over low heat. Add the minced garlic, parsley, and shallots, and cook for 1-2 minutes until fragrant. +4. Remove the garlic mixture from the heat and stir in the white wine, lemon juice, and black pepper. Season with salt to taste. +5. In a mixing bowl, combine the breadcrumbs and grated Parmesan cheese. +6. Place the snail shells on a sheet of foil and arrange them in a baking dish. Spoon the garlic butter mixture into the shells, filling each one about 34 full. +7. Sprinkle the breadcrumb mixture over the top of each snail. +8. Cover the snail shells with foil. +9. Bake in the preheated oven for 12-15 minutes or until the breadcrumbs are golden brown and the snails have cooked through. +10. Remove the dish from the oven, carefully remove the foil, and place a small piece of parchment paper over the top of each shell. +11. Return the dish to the oven and continue baking for 1-2 minutes to crisp up the breadcrumbs. +12. Remove the dish from the oven, and let the escargots cool for a few minutes. +13. In a heavy-bottomed skillet, heat the olive oil over medium-high heat. Strain the garlic butter mixture through a fine-mesh strainer into the skillet, and cook for 1-2 minutes until slightly reduced and thickened. +14. To serve, spoon the garlic butter onto small plates, arrange the escargots on the plates, and drizzle the remaining garlic butter over the top. +Note: Escargot shells are available for purchase at specialty food stores or online. If you don't have escargot shells, you can use mushroom caps or even small ramekins. +Enjoy your delicious escargot! + +SimPO Here's a general recipe for making escargot: + +# Ingredients: + +- 1 pound fresh or canned snails (escargots), cleaned and cooked +- 1/2 cup unsalted butter, softened +- 2 cloves garlic, minced +- 1 tablespoon finely chopped fresh parsley +- 1 tablespoon finely chopped fresh thyme +- 1/4 teaspoon red pepper flakes (optional) +- Salt and freshly ground black pepper, to taste +- 24-30 small, hollowed-out garlic cloves or escargot shells + +# Instructions: + +1. Preheat your oven to 450F (230C). +2. Prepare the garlic cloves or escargot shells by gently scraping out the pulp with knife, leaving a thin layer intact. Rinse them under running water and pat dry. +3. In a mixing bowl, combine softened butter, minced garlic, chopped parsley, thyme, red pepper flakes (if using), salt, and black pepper. Mix well until blended. +4. Spoon a generous amount of seasoned butter into each garlic clove or escargot shell, filling them almost to the top. +5. Arrange the filled shells in a baking dish, preferably one with individual wells or indentations, spaced evenly apart. +6. Place the cooked snails into each shell, making sure they fit snugly. +7. Bake the escargot for 8-10 minutes, or until the butter has melted and bubbled around the edges, and the snails are heated through. +8. Remove the dish from the oven and serve immediately, accompanied by crusty bread, toasted baguette slices, or crackers. +9. To eat, use a small fork or escargot spoon to extract the snails from their shells, dip them into the remaining garlic butter, and enjoy! + +Note: Always follow proper food handling and preparation guidelines when working with live or cooked snails, especially if using fresh ones. Ensure they are properly cleaned, cooked, and stored according to recommended safety practices. + +Table 8: An AlpacaEval 2 generation from the Mistral-7B-Base model trained with SimPER and SimP0. Alpaca-Eval-GPT4-Turbo prefers SimPER over SimP0. Compared to SimP0, the generation by SimPER is better structured, with hierarchical discussions that make it more helpful. + +
PromptMick pays his teacher $800 for 40 lessons worth 2 hours each. If this will be all he is going to pay for his lessons, how much did he receive?
SimPERMick did not receive any money. The $800 he paid to his teacher is the total cost for the 40 lessons, which is 40 x 2 hours = 80 total hours of lessons. Since he only paid for the lessons, he will not receive any money back. Confidence: 95%
SimPOMick received $800. Confidence: 95%
+ +Table 9: An AlpacaEval 2 generation from the Llama-3-8B-Base model trained with SimPER and SimP0. Alpaca-Eval-GPT4-Turbo prefers SimPER over SimP0. Compared to SimP0, SimPER's output provides clearer step-by-step reasoning. \ No newline at end of file diff --git a/ICLR/2025/SimPER_ A Minimalist Approach to Preference Alignment without Hyperparameters/images.zip b/ICLR/2025/SimPER_ A Minimalist Approach to Preference Alignment without Hyperparameters/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..a7a417c93a8facfd706aabb74313a028c40f4477 --- /dev/null +++ b/ICLR/2025/SimPER_ A Minimalist Approach to Preference Alignment without Hyperparameters/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fc6782d516ddf5fcd834e85b32ca4c9503971b0b9c1d9da3c2921a26dc777df2 +size 952389 diff --git a/ICLR/2025/SimPER_ A Minimalist Approach to Preference Alignment without Hyperparameters/layout.json b/ICLR/2025/SimPER_ A Minimalist Approach to Preference Alignment without Hyperparameters/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..cc21ab462f712cab72201cd4af9c095c9dec2a1c --- /dev/null +++ b/ICLR/2025/SimPER_ A Minimalist Approach to Preference Alignment without Hyperparameters/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3a7f44ae2dec46ab01b14e67f6eca73fda4373ca77c2f2864e269edc46114164 +size 612683 diff --git a/ICLR/2025/SimXRD-4M_ Big Simulated X-ray Diffraction Data and Crystal Symmetry Classification Benchmark/3adee509-88bb-4647-9a9d-f163391e5f3f_content_list.json b/ICLR/2025/SimXRD-4M_ Big Simulated X-ray Diffraction Data and Crystal Symmetry Classification Benchmark/3adee509-88bb-4647-9a9d-f163391e5f3f_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..7165351fd9cfd86db300da7964ec1ed9f1588c20 --- /dev/null +++ b/ICLR/2025/SimXRD-4M_ Big Simulated X-ray Diffraction Data and Crystal Symmetry Classification Benchmark/3adee509-88bb-4647-9a9d-f163391e5f3f_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:05c4e73483d87f5ec23adc9e48b2bbfdc44578d96894cd5e8c57481f82e01ef5 +size 150255 diff --git a/ICLR/2025/SimXRD-4M_ Big Simulated X-ray Diffraction Data and Crystal Symmetry Classification Benchmark/3adee509-88bb-4647-9a9d-f163391e5f3f_model.json b/ICLR/2025/SimXRD-4M_ Big Simulated X-ray Diffraction Data and Crystal Symmetry Classification Benchmark/3adee509-88bb-4647-9a9d-f163391e5f3f_model.json new file mode 100644 index 0000000000000000000000000000000000000000..ac1ce4a395764648afb19b9c1dc942c5fb57afb0 --- /dev/null +++ b/ICLR/2025/SimXRD-4M_ Big Simulated X-ray Diffraction Data and Crystal Symmetry Classification Benchmark/3adee509-88bb-4647-9a9d-f163391e5f3f_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b4057e532620937cfad68f13c43bf08391dfbfa277ef221e11e9782c8e30d962 +size 181738 diff --git a/ICLR/2025/SimXRD-4M_ Big Simulated X-ray Diffraction Data and Crystal Symmetry Classification Benchmark/3adee509-88bb-4647-9a9d-f163391e5f3f_origin.pdf b/ICLR/2025/SimXRD-4M_ Big Simulated X-ray Diffraction Data and Crystal Symmetry Classification Benchmark/3adee509-88bb-4647-9a9d-f163391e5f3f_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..6a2f9acff41f22a120f20f72a5f0e562ec513bd6 --- /dev/null +++ b/ICLR/2025/SimXRD-4M_ Big Simulated X-ray Diffraction Data and Crystal Symmetry Classification Benchmark/3adee509-88bb-4647-9a9d-f163391e5f3f_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:62be22ca32311a6f095994afc7445b3ece7b1c5c68a513a8d2c8914ddca0335b +size 7358467 diff --git a/ICLR/2025/SimXRD-4M_ Big Simulated X-ray Diffraction Data and Crystal Symmetry Classification Benchmark/full.md b/ICLR/2025/SimXRD-4M_ Big Simulated X-ray Diffraction Data and Crystal Symmetry Classification Benchmark/full.md new file mode 100644 index 0000000000000000000000000000000000000000..7ab4371e23090d88b19f5f56dca674ad7aea4787 --- /dev/null +++ b/ICLR/2025/SimXRD-4M_ Big Simulated X-ray Diffraction Data and Crystal Symmetry Classification Benchmark/full.md @@ -0,0 +1,508 @@ +# SIMXRD-4M: BIG SIMULATED X-RAY DIFFRACTION DATA AND CRYSTAL SYMMETRY CLASSIFICATION BENCHMARK + +Bin Cao $^{1*}$ , Yang Liu $^{2,4*}$ , Zinan Zheng $^{2*}$ , Ruifeng Tan $^{1,3}$ , Jia Li $^{2,4\dagger}$ , Tong-yi Zhang $^{1,3\dagger}$ + +1Guangzhou Municipal Key Laboratory of Materials Informatics, Advanced Materials Thrust, +The Hong Kong University of Science and Technology (Guangzhou) +$^{2}$ Data Science and Analytics Thrust, The Hong Kong University of Science and Technology (Guangzhou) +$^{3}$ Sustainable Energy and Environment Thrust, The Hong Kong University of Science and Technology (Guangzhou) +4The Hong Kong University of Science and Technology + +# ABSTRACT + +Powder X-ray diffraction (XRD) patterns are highly effective for crystal identification and play a pivotal role in materials discovery. Although machine learning (ML) has advanced the analysis of powder XRD patterns, progress has been constrained by the limited availability of training data and established benchmarks. To address this, we introduce SimXRD-4M, the largest open-source simulated XRD pattern dataset to date, aimed at accelerating the development of crystallographic informatics. We developed a novel XRD simulation method that incorporates comprehensive physical interactions, resulting in a high-fidelity database. SimXRD comprises 4,065,346 simulated powder XRD patterns, representing 119,569 unique crystal structures under 33 simulated conditions that reflect real-world variations. We benchmark 21 sequence models in both in-library and out-of-library scenarios and analyze the impact of class imbalance in long-tailed crystal label distributions. Remarkably, we find that: (1) current neural networks struggle with classifying low-frequency crystals, particularly in out-of-library situations; (2) models trained on SimXRD can generalize to real experimental data. + +# 1 INTRODUCTION + +Symmetry identification is a fundamental and crucial step for materials characterization and design. Specifically, Powder X-ray diffraction (XRD) analysis is exceptionally potent in probing microstructure, due to its sensitivity to atomic arrangement and the element specificity of atom scattering power. The diffraction pattern reflects the atomic arrangement of the diffracting material, as depicted in Figure 1, serving as a fingerprint for the crystals. + +Traditional methods involve a search-match process (Altomare et al., 2008) among numerous known powder diffraction patterns. Given a target XRD pattern, it iterates through candidates in databases until satisfactory alignment is achieved, known as the search-match method. Although this approach is prevalent, it is time-consuming (Altomare et al., 2008; Lv et al., 2024; International Centre for Diffraction Data) due to two issues: (1) high dependency on human intervention. Matching processes rely on domain-specific programs that require frequent human-assisted tuning during program execu + +![](images/333c4e954539472160f11293cf54819e778c2558a0370e6cb771be08d2612ff7.jpg) +Figure 1: The X-ray diffraction patterns of crystal $\mathrm{Tb}_2\mathrm{BaCoO}_5$ and $\mathrm{PbSO_4}$ + +![](images/5d596cae9a9bd2502740609992f1eded7cdb3974e20b6bd16b129091bd7ddedb.jpg) + +tion; (2) diffraction is a complex, multi-physical coupling process, making structure analysis challenging even for experienced domain experts. + +Inspired by the remarkable progress of machine learning models, recent studies (Lee et al., 2020; Szymanski et al., 2021; Maffettone et al., 2021; Wang et al., 2020; Salgado et al., 2023) have attempted to train neural networks on simulated XRD datasets to increase the efficiency of symmetry identification. They treat XRD patterns as sequences and aim to classify them into specific crystal systems or space groups. More recent studies (Guo et al., 2024a;b; Li et al., 2024; Cao et al., 2025; Riesel et al., 2024; Lai et al., 2024) on powder XRD for crystal prediction and generation have employed advanced ML architectures, achieving significant progress and noteworthy results. + +Despite significant progress, several limitations exist in current model development and evaluation: + +- Lack of a large-scale and high-quality dataset: Previous research has largely been confined to specific materials (Fatimah et al., 2022; Lee et al., 2020; Wang et al., 2020). For example, Lee et al. (Lee et al., 2020) focus on mixtures of 38 distinct binary and ternary crystals in the Sr-Li-Al-O inorganic compounds. Additionally, the geometric similarity of crystals and experimental physical factors can result in XRD patterns with similar peak distributions. The introduction of large-scale databases presents new challenges. Therefore, sufficient coverage of structures and close alignment with experimental patterns under different physical conditions is necessary for developing models with high generalization ability. +- Insufficient evaluation on real XRD patterns: While symmetry classification aims to recognize symmetry from experimental measurements, most studies train and evaluate model performance on simulated data. Considering the potential bias between simulated and real XRD patterns, models may overfit simulated data and fail to generalize to real data. +- Limited exploration on out-library identification: Most studies focus on in-library identification. This involves training a neural network to generalize across different experimental settings for the same set of crystals. In contrast, out-library identification aims to generalize to entirely new crystals. This approach is crucial for discovering novel materials but receives insufficient attention. + +The limited scale of experimental data presents two significant challenges in this field: (1) insufficient data to adequately test generative capabilities, and (2) difficulty in effectively utilizing such small-scale experimental datasets for model tuning, even within a transfer learning framework, let alone for training a model solely based on experimental data. To address this dilemma, we developed high-fidelity simulation data as a solution. Our results demonstrate no observable differences in model performance between simulated and experimental test datasets, providing evidence of the high quality of the simulations. Crafting a high-fidelity simulated XRD pattern dataset is challenging due to the complexity of domain-specific processes, such as determining crystal stability, configuring instruments, and accounting for physical environmental factors. In this work, we present a novel XRD simulation method (Appendix B.4) that incorporates comprehensive physical interactions. Using this method, we developed SimXRD, the largest open-source and physically detailed dataset aimed at advancing this interdisciplinary field. We source crystals from the Materials Project (MP) (Jain et al., 2013) database and apply rigorous filtering to remove crystals with broken symmetry, duplicates, or discrepancies in space group classification. Consequently, SimXRD comprises 4,065,346 X-ray powder diffraction patterns covering 119,569 distinct crystal structures simulated under various conditions, including grain size, orientation, internal stress, inelastic scattering, thermal vibration, instrumental zero shift, noise and others. + +We benchmark both the in-library and out-library symmetry identification performance on SimXRD of 21 models, which can be divided into three types of sequence models: convolution neural networks (i.e., the backbone of existing symmetry classification models), recurrent models, and transformers. Through extensive experiments, we discover that: + +- Long-tail distribution: The class labels follow a heavy long-tailed distribution. Most models are biased toward the high-frequency classes and fail to predict the low-frequency classes, especially in space group classification. To provide insights into model designs, we evaluate the model performance under different objective functions and find that label smoothing and focal loss yield better results. + +Table 1: Summaries of existing powder XRD datasets. ICSD refers to the commercial Inorganic Crystal Structure Database. MP denotes the open-sourced Material Project. + +
Dataset#XRD Pattern#StructureOpen AccessSimulatedCrystal SourceYear
RRUFF (Lafuente et al., 2015)3,0023,002✓×-2015
XRDSP (Suzuki et al., 2020)169,536169,536✓✓ICSD2020
CNN (Lee et al., 2020)1,785,405170×✓ICSD2020
PQNet (Dong et al., 2021)250,0001✓✓ICSD2021
XRDAutoAnalyzer (Szymanski et al., 2021)38,250150✓✓ICSD2021
XRDISAllYouNeed (Lee et al., 2022)328,503189,476&139,0271×✓ICSD&MP2022
AdvancedXRDAnalysis (Lee et al., 2023)29,569,650197,131×✓ICSD2023
CrySTINet (Chen et al., 2024)100100✓✓ICSD2024
CPICANN (Cao, 2024)692,19023,073✓✓COD2024
SimXRD4,065,346119,569✓✓MP2024
+ +- Out-library generalization: Out-library classification is challenging, as it requires models to learn from long-tailed data and generalize to XRD patterns of unobserved crystals. Thus, the model performance of out-library classification is generally reduced compared to that of in-library classification. +- Experimental data generalization: The ability to generalize to real experimental data is a gold standard for symmetry identification models. Remarkably, we found that models trained on the proposed SimXRD are able to achieve comparable or even better results on the real dataset (RRUFF), validating the contribution of our dataset construction. + +We highlight that our findings provide the research community a clearer insight into the current progress in XRD analysis. Additionally, we have made the SimXRD database, simulation code, benchmark models, evaluation process and tutorial notebooks into a repository: https://github.com/Bin-Cao/SimXRD. + +# 2 RELATED WORK + +# 2.1 EXISTING DATASETS + +Several datasets have been developed to train neural models for crystallography. Table 1 provides a summary of these datasets, compared across several key dimensions: + +- Dataset Size: Existing open-source databases either contain relatively small structures tailored to specific purposes (Chen et al., 2024; Dong et al., 2021; Szymanski et al., 2021; Lee et al., 2020) or consider limited environmental settings (Chen et al., 2024; Suzuki et al., 2020). Crystal structure databases form the backbone of XRD pattern databases. Although the database developed by Lee et al. (Lee et al., 2022; 2023) encompasses nearly all the crystals in the Inorganic Crystal Structure Database (ICSD) (Zagorac et al., 2019) and the Materials Project (MP) (Jain et al., 2013), it contains a significant number of repeated crystals with broken symmetries. Additionally, it does not sufficiently account for various physical conditions, resulting in a relatively small XRD pattern database. SimXRD, by contrast, employs the entire MP database of January 2024, totaling 154,718 crystal structures. During the generation of the SimXRD database, we applied screening methods to improve crystal quality. Additionally, we simulate XRD patterns under various environments to meet the academic-industry requirements. +- Availability: Most pattern datasets are openly available, as indicated in Table 1, though some datasets can only be retrieved upon reasonable request (Lee et al., 2020; 2022; 2023). Additionally, published diffraction pattern datasets are saved in various formats, requiring specific data loaders provided by the authors. In contrast, the SimXRD-4M dataset developed in our work is fully accessible and features an easier workflow for machine learning training, easily integrable with TensorFlow or PyTorch frameworks. +- Simulation vs. Experiments: Among the existing datasets, only the RRUFF Project (La-fuente et al., 2015) aims to create a comprehensive set of high-quality spectral data from well-characterized minerals. Since its inception in 2005 (RRUFF, 2005), RRUFF has compiled a collection of 3,002 high-quality experimental powder XRD patterns as of March 2024. Conducting + +the experiments is time-consuming. Thus, recent studies have employed domain-specific software to generate simulated data. Earlier studies primarily relied on widely-used software tools, such as Pymatgen (Ong et al., 2013), FullProf (Rodriguez-Carvajal, 2001), and GSAS-II (Toby & Von Dreele, 2013), to simulate patterns for training. However, these approaches often showed varying degrees of performance degradation when applied to experimental test sets. SimXRD addresses these limitations by employing the newly developed PysimXRD, which accounts for a wider range of real-world conditions, including grain size, internal stress, external temperature variations, grain orientation, instrument drift, instrument noise, detector geometry, and scattering-induced background. This comprehensive approach ensures higher fidelity in data generation, improving the robustness of the resulting models. + +# 2.2 SYMMETRY IDENTIFICATION + +Most existing methods for symmetry identification rely on one-dimensional convolutional neural networks for building classification models. The models developed in recent years have primarily focused on CNN architectures (Dong et al., 2021; Wang et al., 2020; Park et al., 2017). In particular, they focus on designing CNNs with deep layers (Lee et al., 2022) and large kernel sizes (Le et al., 2023), ensemble CNNs (Maffettone et al., 2021; Szymanski et al., 2021), and CNNs without dropout (Lee et al., 2020) and pooling layers (Salgado et al., 2023). However, whether CNNs can address long-tailed distributions, as well as the performance of other sequence models, remain underexplored. + +# 3 SIMXRD-4M DATASET + +# 3.1 PRELIMINARIES + +Crystal symmetry Symmetry in crystallography is a fundamental property of the orderly arrangements of atoms in crystals (Su et al., 2024). Each atomic arrangement possesses certain symmetry elements, which are transformations that leave the arrangement unchanged. These elements include rotation, translation, reflection, and inversion. The specific symmetry elements present in a crystalline solid determine its shape and influence its physical properties. Crystals are classified based on their geometry and symmetry elements, falling into one of 7 crystal systems, and could further divide into 230 space groups (Clegg, 2023). Further details are provided in AppendixB.1. + +XRD pattern Powder XRD patterns offer a one-dimensional representation of the three-dimensional diffraction pattern and are the most common experimental measurement. Specifically, each one-dimensional powder X-ray diffraction pattern in SimXRD is presented in the format of d-I (lattice plane distance-intensity), where the x-axis represents lattice plane distances and the y-axis represents corresponding intensities, as shown in Figure 2. The diffraction pattern we provide is a 1D tensor with 3501 elements. These points represent lattice plane distances, equally spaced from $1.199\AA$ to $8.853\AA$ , with a step size of $0.0176\AA$ . This corresponds to a typical experimental setup for a two-theta diffractometer (copper target), where the diffraction angle is scanned from $10^{\circ}$ to $80^{\circ}$ with a step size of $0.02^{\circ}$ . The d-I pattern is independent of the wavelength of the incident X-rays, making it universally applicable across all experimental X-ray sources. Lattice plane distances denote the detected atomic directions. Some distances lack peaks due to geometric constraints from the lattice cell and extinction effects (Lund et al., 2010) under diffraction. The relative intensity is normalized, with the maximum intensity set to 100, making the pattern independent of the incident X-ray intensity. + +# 3.2 DATA GENERATION AND PROCESSING + +Crystal data The crystal structures used in this study were sourced from Material Project (Jain et al., 2013), a comprehensive, searchable database containing information on solid-state materials and molecules. It provides detailed data on the physical properties of these materials, such as elastic tensors, band structures, and formation energies, derived from electronic structure calculations, providing a more comprehensive reference for crystal studies. We utilize the latest dataset, denoted as MP-2024.1, which includes a total of 154,718 crystallographic structures as of January 2024. + +![](images/4e23337ea85813e90cd1d47c15ae558e5d068aa8de80239d9535416f1878df15.jpg) + +![](images/9e2305949bff1921b9d7e3f98e04265d5ab34a83a015633e923d678bf25c8c90.jpg) +Figure 2: (A) The workflow of the large simulated XRD database and symmetry classification benchmark consists of four main components: (1) Retrieval of crystal data from the Materials Project database. (2) Multiphysical coupling simulations to generate high-fidelity powder XRD patterns. (3) Application of three machine learning model types, CNNs, recurrent models, and transformers, for benchmarking the database.(4) Symmetry classification, which maps powder XRD patterns to specific space groups and crystal systems. (B) Experimental XRD pattern of a Li-rich layered oxide cathode $(\mathrm{Li_2MnO_3})$ was compared with simulated pattern generated using PysimXRD. The simulation incorporates multiphysical coupling, producing patterns that closely match experimental measurement with minimal residual errors. + +Crystal Filtering To ensure consistency between recorded space group numbers (crystal systems) and atomic arrangements, and to enhance the quality of crystal structures, we performed a thorough examination of each structure in the MP database. We used Spglib (Togo et al., 2024), a library designed for identifying and managing crystal symmetries, to analyze all structures. Structures exhibiting broken symmetry, duplication, or discrepancies in space groups were excluded. Additionally, only structures containing up to 500 atoms per lattice cell (conventional unit cell) were retained, effectively covering nearly all inorganic materials in the MP dataset. A total of 119,569 crystal structures were screened. Further details are given in Appendix A.1. + +Simulation in SimXRD Figure 2 illustrates the overall simulation process. The experimental XRD patterns depend on both the crystal's intricate structure and practical factors, including the sample's state and instrumental parameters. Our goal is to simulate this process using domain-specific custom software Pysimxrd (Appendix B.4). First, we specify the environmental settings and then compute the XRD patterns for the given crystals. By varying the environmental param + +eters, we generate all samples in the SimXRD dataset. We systematically analyze the physical conditions affecting the XRD profiles, categorizing them into factors that influence the sample's internal structure and those affect instrumental measurements. These parameters, along with their respective value ranges, are outlined in the Appendix B.4. For each input crystal, we randomly combine these physical conditions within reasonable ranges, repeating the process 33 times to simulate XRD patterns across diverse environments. Each XRD pattern is standardized, with the x-axis values (lattice plane distance) uniformly set based on the experimental settings, resulting in a vector of 3501 dimensions. The y-axis values (diffraction intensity) are simulated according to the crystal structure and diffraction conditions. + +# 3.3 DATA ANALYSIS + +Long-tailed distribution The distribution of space groups on a logarithmic scale is shown in Figure 3. The space groups in the MP dataset are ranked in descending order, and their frequencies are plotted on a logarithmic scale. This reveals differences in frequency spanning several orders of magnitude. The data clearly exhibit a highly imbalanced, long-tailed distribution. Since MP-2024.1 serves as a comprehensive database of commonly occurring material systems, this distribution imbalance is inherent to the physical population of crystals in nature. This imbalance can lead to biased model performance, as the model may be more inclined to predict the majority class, leading to lower accuracy for the minority classes. Since minority crystals are also important for material discovery, addressing long-tailed sequence learning is crucial for symmetry identification. However, existing models do not consider this challenge, making it necessary to evaluate their performance across different classes. The detailed space group distribution and the energy distribution of crystals are presented in Appendix A.1. + +Case study A case study is conducted to investigate the difference between experimental and simulated XRD patterns of $\mathrm{Li}_2\mathrm{MnO}_3$ . Initially, the physical states of the tested sample and the experimental settings were obtained using a refinement method (see Appendix B.7). Subsequently, the XRD pattern was generated inversely using the Pysimxrd. Figure 2 (B) shows the results where we can observe that the generated profile exhibits extreme similarity to the experimental measurements(Lei et al., 2024). Therefore, by altering the physical states within a reasonable range, other patterns corresponding to different experimental settings can be generated. Such simulation allows us to obtain high-quality data in a relatively efficient manner, compared to experiment + +![](images/1a0de7365c1e8fcf1cb5f41dc9f1ad5fc9d256a679c02b51a8c370af96bc4d4f.jpg) +Figure 3: The distribution of space groups on logarithmic scale + +# 4 BENCHMARK + +# 4.1 PROBLEM DEFINITION + +Symmetry classification Formally, SimXRD treats the problem as a multi-class sequence classification task. Given the XRD pattern $\mathbf{X} = [x_{1}, x_{2}, \dots, x_{n}] \in \mathbb{R}^{n}$ where $x_{i}$ is the $i$ -th intensity value and $\mathbf{X}$ is arranged by lattice plane distance, the goal is to predict its symmetry $\mathbf{Y} \in \mathbb{R}^{k}$ . Here $n$ is the feature dimension which is 3501 in our dataset. For crystal system classification, $k = 7$ , and for space group classification, $k = 230$ . We did not consider practical factors such as average grain size and stress as input variables, since these are not directly measurable in real-world diffraction experiments. + +In/Out-library crystallographic tasks In-library classification aims to generalize across different experimental environments for the same set of structures. Consequently, the training and testing datasets consist the same structures but with varying simulation parameters. In contrast, out-library classification seeks to generalize to different crystals. Therefore, the training and testing datasets consist of different types of crystals. More details are provided in Appendix B.2. + +Table 2: Results of in library crystal system classification and space group classification. Inference time is measured for a batch size of 100 samples and experiments are run on a GeForce RTX 3090 GPU. + +
Model # Conv. # Dropout # Pooling EnsembleRef.Crystal SystemSpace Group
AccuracyF1PrecisionRecall Time (ms)AccuracyF1PrecisionRecall Time (ms)
CNN13✓AvgPool×(Park et al., 2017)0.5590.4180.4270.4313.20.2410.0020.0013.4
CNN22×MaxPool×(Lee et al., 2020)0.4660.2360.2220.2831.80.2410.0020.0011.9
CNN33×MaxPool×(Lee et al., 2020)0.5310.3280.3150.3693.50.2410.0020.0013.6
CNN47✓MaxPool×(Wang et al., 2020)0.3160.0690.0450.1431.40.2410.0020.0011.4
CNN53✓AvgPool✓(Maffettone et al., 2021)0.5170.3940.4890.3780.60.2950.0220.0250.6
CNN67✓MaxPool×(Dong et al., 2021)0.3160.0690.0450.14365.00.2410.0020.00165.0
CNN76✓MaxPool✓(Szymanski et al., 2021)0.8620.8630.8870.8456.80.5880.1240.1476.9
CNN814✓MaxPool×(Lee et al., 2022)0.3770.1620.1480.2213.10.2410.0020.0013.1
CNN93✓MaxPool×(Le et al., 2023)0.7950.8170.8260.8101.90.5990.5970.6811.9
CNN104✓MaxPool×(Le et al., 2023)0.8700.8880.8920.8851.80.7050.7920.8531.8
CNN113✓None×(Salgado et al., 2023)0.9020.9220.9320.9144.80.7580.7500.7350.828
0.2410.0020.001
0.3880.1350.320
0.6310.8110.850
+ +# 4.2 EXPERIMENTAL SETTING + +Dataset split For in-library classification, a fundamental task in crystallography, the dataset is randomly split according to the types of simulated environments, resulting in $119,569 \times 30$ training instances, $119,569 \times 1$ validation instances, and $119,569 \times 2$ testing instances. The data recorded for training, validation, and testing include crystals from different simulated environments (e.g., grain size, stress, temperature). Under out-of-library settings, the training and testing XRD patterns are generated from non-overlapping crystals. This setup yields $83,698 \times 33$ training instances, $11,957 \times 33$ validation instances, and $23,914 \times 33$ testing instances. + +Baselines We consider the following three types of sequence classification models: + +- CNN-based Models: We evaluate all existing CNN architectures proposed for symmetry identification. Since most models do not have specific names, we classify them based on their number of convolution layers, pooling layers, and whether they use ensemble learning or dropout layers. Table 2 summarizes the existing 11 CNN models. +- Recurrent Models: We select three basic recurrent neural networks: RNN (Medsker & Jain, 1999), LSTM (Hochreiter & Schmidhuber, 1997), and GRU (Chung et al., 2014). Additionally, since XRD patterns can be viewed from both forward and backward, we also evaluate the performance of bidirectional RNN, LSTM, and GRU (Schuster & Paliwal, 1997). +- Transformers: Transformers have proven effective in variety of sequence modeling tasks. We evaluate the performance of the raw transformer (Vaswani et al., 2017) and two advanced transformer models - iTransformer (Liu et al., 2023) and PatchTST (Nie et al., 2023). + +Besides these models, we also include MLP as a straightforward baseline. For recurrent models and transformers, we first use them to learn sequence representations, and then employ an MLP to predict the symmetry. + +Implementation details We use the following hyper-parameters across all experiments: Batch size of 128 and learning rate of $2.5 \times 10^{-4}$ . All models are trained for 50 epochs with an early stopping patience of 3. We use the Cross-Entropy function to measure the difference between predictions and the ground truth. The performance of the models is evaluated using accuracy, macro F1-score, macro precision, and macro recall as metrics. All models are implemented using the PyTorch (Paszke et al., 2019) library and trained on GeForce RTX 3090 GPU. + +Table 3: Results of weighted classification, label smoothing, and Focal loss on crystal system and space group classification. + +
Crystal System Classification
TrainingWeighted classificationLabel smoothingFocal loss
MetricF1PrecisionRecallF1PrecisionRecallF1PrecisionRecall
CNN10.5650.5380.6420.5780.5870.5750.6070.6080.610
CNN20.6900.6590.7340.4970.4930.5060.5110.5060.518
CNN30.6990.6650.7650.7230.7650.6980.5360.5290.546
CNN40.2290.1910.3900.0660.0430.1420.0660.0430.142
CNN50.3970.3790.4680.3820.4310.3750.3130.3390.321
CNN60.0690.0460.1420.0690.0460.1420.0690.0460.142
CNN70.7400.7100.7930.8630.8870.8440.8510.8710.836
CNN80.5460.5330.6250.5660.5900.5590.5540.6870.547
CNN90.7800.7480.8240.8020.8200.7880.8140.8030.807
CNN100.8000.7670.8480.8770.8980.8600.8440.8570.834
CNN110.8110.7970.8450.9310.9430.9210.8870.8950.882
MLP0.0690.0460.1420.0690.0460.1420.0690.0460.142
RNN0.1540.1840.2360.1800.2000.1960.1670.1970.187
LSTM0.0860.1530.1710.7060.7210.6970.7010.7120.701
GRU0.7690.7370.8210.7830.7990.7710.7270.7420.717
Bidirectional-RNN0.1690.1840.2380.1440.1920.1760.1590.1500.179
Bidirectional-LSTM0.7170.6840.7890.7950.8190.7750.6220.6530.602
Bidirectional-GRU0.7040.6740.7770.8610.8630.8630.8450.8430.847
Transformer0.1340.1610.1780.1300.1690.1560.1290.1710.156
iTransformer0.5450.5160.6430.5900.6180.5800.6040.6300.598
PatchTST0.6720.6430.7450.7100.7350.6910.7140.7220.709
Space Group Classification
CNN10.0000.0000.0050.0020.0010.0050.0020.0010.005
CNN20.0000.0000.0050.0020.0010.0050.0020.0010.005
CNN30.0000.0000.0050.0020.0010.0050.0020.0010.005
CNN40.0010.0000.0050.0020.0010.0050.0020.0010.005
CNN50.0330.0280.0560.0020.0010.0050.0020.0010.005
CNN60.0000.0010.0050.0020.0010.0050.0020.0010.005
CNN70.2200.2170.3770.1240.1430.1310.2500.2250.217
CNN80.0000.0000.0050.0020.0010.0050.0020.0010.005
CNN90.3910.3250.7390.3700.6480.3030.5820.6740.535
CNN100.2000.2230.6490.5420.8060.4520.7740.8510.732
CNN110.0000.0000.0050.6150.8360.5250.7510.7410.815
MLP0.0000.0000.0050.0020.0010.0050.0020.0010.005
RNN0.0000.0020.0060.0030.0010.0060.0030.0010.005
LSTM0.0000.0000.0060.1430.2100.1370.1400.2060.137
GRU0.2150.1800.6100.1850.2610.1760.2270.1920.653
Bidirectional-RNN0.0040.0060.0100.0030.0020.0060.0040.0050.009
Bidirectional-LSTM0.1480.1350.5180.1770.2780.1660.1770.2750.159
Bidirectional-GRU0.0880.0990.2760.2970.4750.2460.4720.6380.416
Transformer0.0010.0010.0060.0020.0020.0050.0020.0020.005
iTransformer0.0830.0960.3870.0920.1720.0900.1730.3650.149
PatchTST0.1210.1230.3860.6770.8010.6090.7190.8080.665
+ +# 4.3 RESULTS + +In-library classification Table 2 displays the baseline performance and inference time for the classification of crystal systems and space groups. Based on the results, we make the following observations: + +- Most existing CNN models are unsuitable for symmetry identification within the large scale of the SimXRD database. It is clear that the crystal system classification accuracies of several CNNs, e.g., CNN 4 and 6 are on par with that of MLP. As shown in the additional results in Appendix A.2, the reason for this is that their predictions are heavily biased by high frequency classes, making them unable to predict low-frequency classes effectively. This limitation is even more apparent in space group classification, where the accuracy of most CNNs (i.e., CNN 1-4, 6, and 8) is 0.241, indicating that their outputs are almost fixed to the most frequent space group. +- Convolutional neural networks without pooling have achieved the best performance in most tasks, consistent with the findings of previous work (Salgado et al., 2023). Since the peak maximum and the relative value among peaks in XRD patterns are closely related to the atom arrangement of crystals, employing pooling layers may lead to information loss, which can affect peak identification and result in lower accuracy. + +Table 4: Results of out-library symmetry identification. + +
TaskCrystal System ClassificationSpace Group Classification
ModelAccuracyF1PrecisionRecallAccuracyF1PrecisionRecall
CNN10.6270.4370.5650.4720.2850.0030.0020.006
CNN20.6060.4190.4280.4250.2850.0030.0020.006
CNN30.6590.5010.4960.5070.2850.0030.0020.006
CNN40.3780.0780.0540.1420.2850.0030.0020.006
CNN50.4950.2780.2850.2830.2850.0030.0020.006
CNN60.3780.0780.0540.1420.2850.0030.0020.006
CNN70.6730.6070.6330.6080.4290.0530.0500.072
CNN80.6120.4520.4480.4970.2860.0030.0010.006
CNN90.6750.6320.6290.6440.4390.0990.1370.113
CNN100.6920.6590.6500.6740.4300.1070.1680.121
CNN110.7020.6720.6590.6900.4810.1360.1670.150
MLP0.3780.0780.0540.1420.2850.0030.0020.006
RNN0.4090.1620.1490.1780.2740.0030.0020.009
LSTM0.6570.5750.5830.5890.4310.0700.0920.085
GRU0.7070.6780.6560.7090.4800.1100.1430.125
Bidirectional-RNN0.4030.1570.1460.1740.2950.0040.0030.008
Bidirectional-LSTM0.7040.6630.6540.6780.3490.0350.0440.051
Bidirectional-GRU0.7220.6990.6970.7050.4980.1380.1920.149
Transformer0.3760.1380.2310.1580.2850.0030.0050.006
iTransformer0.6060.4950.5190.5260.3670.0530.0850.064
PatchTST0.6560.6160.6120.6270.3750.0670.0930.082
+ +- Bidirectional recurrent models consistently outperform their unidirectional counterparts. These results highlight an important physical attribute of XRD patterns: ensuring the consistent retrieval of crystal information through bidirectional pattern reading. This property is distinct from previous sequence tasks such as text and time-series classification, necessitates further model design considerations. +- The raw transformer encounters difficulties when dealing with the long-tailed sequence problem. However, compared to the raw transformer, we observe that PatchTST achieves a significant performance improvement, demonstrating that subsequence-level patches are beneficial for peak identification and further enhancing classification performance. + +Long-tailed objective functions The long-tailed distribution significantly impedes the symmetry identification of XRD patterns. To address this issue, we further train all baseline models using the following techniques: (1) Weighted classification that reweights training instances based on the inverse of class frequency; (2) Label smoothing that applies cross-entropy with targets smoothed towards a uniform distribution; (3) Focal loss that focuses on hard-to-classify examples by downweighting the loss for easy examples. The results are presented in Table 3. These results show that weighted classification does not improve model performance. This lack of improvement is likely because increasing the importance of minority classes leads to a decrease in accuracy for the majority classes. In contrast, label smoothing and focal loss generally generally yield better results for both crystal system and space group classification, suggesting promising research directions for model designs. + +Out-library classification Different splitting mechanisms are essential for preliminary experiments. Consequently, we conduct experiments using out-of-library settings, where the training and testing XRD patterns come from non-overlapping structures. To ensure that the training, validation, and test datasets consist of distinct crystals, we randomly partition the dataset by crystal type. The results are detailed in Table 4. Based on the findings, we have the following observations: + +- Performance decrease compared to in-library classification. This decline is anticipated, as out-of-library classification requires models to generalize across different crystal types, which presents a greater challenge. +- The relative model performances align with the results from in-library identification, with Bidirectional-GRU and CNN11 achieving higher scores. However, there is a noticeable decline in out-of-library cases, as the models need to account for varying extinction effects across different space groups, which introduces significant challenges. +- Models such as CNN1-4, CNN6, CNN8, MLP, and Transformer exhibit poor performance in out-of-library identification, with accuracy scores around $24\%$ , close to random prediction. This + +Table 5: Generalization experiments on RRUFF dataset. + +
TaskCrystal System ClassificationSpace Group Classification
ModelAccuracyF1PrecisionRecallAccuracyF1PrecisionRecall
CNN10.6230.5420.5630.5390.2410.0040.0020.010
CNN20.4250.2100.1780.1430.2410.0040.0020.010
CNN30.5060.3130.3970.3320.2410.0040.0020.010
CNN40.2970.0650.0420.1430.2410.0040.0020.010
CNN50.5300.4020.5110.3840.3020.0430.0450.051
CNN60.2970.0650.0420.1430.2410.0040.0020.010
CNN70.8680.8770.8990.8600.5770.2020.2050.222
CNN80.2970.0650.0420.1430.2410.0040.0020.010
CNN90.7920.8190.8320.8090.6150.5000.5550.486
CNN100.8590.8850.8930.8790.6960.6850.7410.669
CNN110.8930.9200.9300.9140.7660.7000.7540.687
MLP0.3250.0700.0460.1430.2410.0040.0020.010
RNN0.3770.1650.2030.1850.2450.0060.0040.013
LSTM0.7230.7350.7470.7310.5220.2300.2750.230
GRU0.7740.8010.8170.7880.5750.3600.4210.357
Bidirectional-RNN0.3650.1520.1900.1840.2450.0050.0030.013
Bidirectional- LSTM0.7880.8130.8200.8080.5530.3670.4190.354
Bidirectional-GRU0.8040.8450.8640.8340.6360.4480.5120.429
Transformer0.3540.1380.2190.1650.2410.0040.0020.010
iTransformer0.6290.6120.6580.6070.3920.1430.1560.151
PatchTST0.7230.7640.7850.7500.6350.6960.7480.687
+ +underscores the need for further development of domain-specific models to effectively address the challenges of out-of-library identification. + +Experimental data generalization A generalization experiment is conducted using the experimental RRUFF dataset. We train and validate all baseline models on SimXRD and then test their performance on RRUFF. The results are presented in Table 5. The findings indicate that the models generally achieve consistent performance on both SimXRD and RRUFF. Notably, CNN 11 consistently delivers the best accuracy, even surpassing its performance on SimXRD (e.g., CNN 11 in space group classification). Models that exhibited lower accuracy on SimXRD (e.g., CNN 1-6) also perform poorly on RRUFF. + +# 5 CONCLUSION + +In this paper, we introduce SimXRD, the largest open-source XRD pattern dataset for symmetry identification. Data analysis reveals that the symmetry labels follow a long-tailed distribution. We evaluate 21 models on two different splitting patterns (in-library and out-of-library) and find that most existing models struggle to accurately predict the symmetry of low-frequency classes, even when addressing for class imbalance. This limitation hinders their real-world applicability. Our results emphasize the importance of modeling long-tailed sequence classification and conducting comprehensive comparison to accurately assess the capabilities of various models. To promote further research and advancements in symmetry identification algorithms, we make both SimXRD and the simulation code available as open-source. + +Limitations While SimXRD improves upon previous datasets in terms of sample size, crystal quality, and accessibility, the long-tailed and imbalanced label distribution remains an inherent limitation. The distribution of crystallographic symmetry arises through natural processes and is invariant to human intervention, making such biases difficult to address in any dataset. Potential solutions include developing class-imbalanced algorithms or incorporating additional information about the target crystals. + +Future works We view SimXRD as an evolving project and are committed to its ongoing development. Future plans include: (1) Developing long-tailed sequence classification models through techniques such as data augmentation (Chu et al., 2020; Zheng et al., 2024) or enhancing features via graph inputs Liu et al. (2024a); (2) Exploring training approaches like multi-stage learning to address the imbalanced nature of XRD patterns; (3) Designing data augmentation strategies Liu et al. (2024b) for XRD patterns, while ensuring that methods like random swapping do not generate instances that violate underlying physical principles. + +# ACKNOWLEDGMENTS + +This work is supported by the Guangzhou-HKUST(GZ) Joint Funding Program (Nos. 2023A03J0003 and 2023A03J0103) and is funded by National Natural Science Foundation of China Grant No. 72371217, the Guangzhou Industrial Informatic and Intelligence Key Laboratory No. 2024A03J0628, the Nansha Key Area Science and Technology Project No. 2023ZD003, and Project No. 2021JC02X191. + +# REFERENCES + +Angela Altomare, Corrado Cuocci, Carmelo Giacovazzo, Anna Moliterni, and Rosanna Rizzi. Qualx: a computer program for qualitative analysis using powder diffraction data. Journal of Applied Crystallography, 41(4):815-817, 2008. +BH Armstrong. Spectrum line profiles: the voigt function. Journal of Quantitative Spectroscopy and Radiative Transfer, 7(1):61-88, 1967. +G Caglioti, AT Paoletti, and FP Ricci. Choice of collimators for a crystal spectrometer for neutron diffraction. *Nuclear Instruments*, 3(4):223-228, 1958. +Barnie Cao, Daniel Anderson, and Luke Davis. Asugnn: an asymmetric-unit-based graph neural network for crystal property prediction. Applied Crystallography, 58(1), 2025. +Bin Cao. Cpicann. https://huggingface.co/datasets/caobin/datasetCPICANN, 2024. Accessed: 2024-05-21. +Litao Chen, Bingxu Wang, Wentao Zhang, Shisheng Zheng, Zhefeng Chen, Mingzheng Zhang, Cheng Dong, Feng Pan, and Shunning Li. Crystal structure assignment for unknown compounds from x-ray diffraction patterns with deep learning. Journal of the American Chemical Society, 146(12):8098-8109, 2024. +Peng Chu, Xiao Bian, Shaopeng Liu, and Haibin Ling. Feature space augmentation for long-tailed data. In ECCV, volume 12374, pp. 694-710, 2020. +Junyoung Chung, Caglar Gulcehre, KyungHyun Cho, and Yoshua Bengio. Empirical evaluation of gated recurrent neural networks on sequence modeling. arXiv preprint arXiv:1412.3555, 2014. +William Clegg. Space groups-the final frontier: a tutorial guided tour of some entries in international tables for crystallography volume a. Crystallography Reviews, 29(4):228-246, 2023. +Hongyang Dong, Keith T Butler, Dorota Matras, Stephen WT Price, Yaroslav Odarchenko, Rahul Khatry, Andrew Thompson, Vesna Middelkoop, Simon DM Jacques, Andrew M Beale, et al. A deep convolutional neural network for real-time full profile analysis of big powder diffraction data. NPJ Computational Materials, 7(1):74, 2021. +Siti Fatimah, Risti Ragadhita, Dwi Fitria Al Husaeni, and Asep Bayu Dani Nandiyanto. How to calculate crystallite size from x-ray diffraction (xrd) using scherrer method. ASEAN Journal of Science and Engineering, 2(1):65-76, 2022. +Gabe Guo, Judah Goldfeder, Ling Lan, Aniv Ray, Albert Hanming Yang, Boyuan Chen, Simon JL Billinge, and Hod Lipson. Towards end-to-end structure determination from x-ray diffraction data using deep learning. npj Computational Materials, 10(1):209, 2024a. +Gabe Guo, Tristan Saidi, Maxwell Terban, Simon JL Billinge, and Hod Lipson. Diffusion models are promising for ab initio structure solutions from nanocrystalline powder diffraction data. arXiv preprint arXiv:2406.10796, 2024b. +Sepp Hochreiter and Jürgen Schmidhuber. Long short-term memory. Neural computation, 9(8): 1735-1780, 1997. +JH Hubbell, WH McMaster, N Kerr Del Grande, and JH Mallett. International tables for x-ray crystallography. Vol. IV, pp. 45-70, 1974. + +International Centre for Diffraction Data. Mdi jade software. https://www.icdd.com/ mdi-jade/. Accessed: 2024-05-18. +Anubhav Jain, Shyue Ping Ong, Geoffroy Hautier, Wei Chen, William Davidson Richards, Stephen Dacek, Shreyas Cholia, Dan Gunter, David Skinner, Gerbrand Ceder, et al. Commentary: The materials project: A materials genome approach to accelerating materials innovation. $APL$ materials, 1(1), 2013. +Barbara Lafuente, Robert T Downs, Hexiong Yang, Nate Stone, Thomas Armbruster, Rosa Micaela Danisi, et al. The power of databases: the rruff project. Highlights in mineralogical crystallography, 1:25, 2015. +Qingsi Lai, Lin Yao, Zhifeng Gao, Siyuan Liu, Hongshuai Wang, Shuqi Lu, Di He, Liwei Wang, Cheng Wang, and Guolin Ke. End-to-end crystal structure prediction from powder x-ray diffraction. arXiv preprint arXiv:2401.03862, 2024. +Nam Q Le, Michael Pekala, Alexander New, Edwin B Gienger, Christine Chung, Timothy J Montalbano, Elizabeth A Pogue, Janna Domenico, and Christopher D Stiles. Deep learning models to identify common phases across material systems from x-ray diffraction. The Journal of Physical Chemistry C, 127(44):21758-21767, 2023. +Armel Le Bail. Whole powder pattern decomposition methods and applications: A retrospection. Powder diffraction, 20(4):316-326, 2005. +Armel Le Bail, Huguette Duroy, and Jean Louis Fourquet. Ab-initio structure determination of lisbwo6 by x-ray powder diffraction. Materials Research Bulletin, 23(3):447-452, 1988. +Byung Do Lee, Jin-Woong Lee, Woon Bae Park, Joonseo Park, Min-Young Cho, Satendra Pal Singh, Myoungho Pyo, and Kee-Sun Sohn. Powder x-ray diffraction pattern is all you need for machine-learning-based symmetry identification and property prediction. Advanced Intelligent Systems, 4 (7):2200042, 2022. +Byung Do Lee, Jin-Woong Lee, Junuk Ahn, Seonghwan Kim, Woon Bae Park, and Kee-Sun Sohn. A deep learning approach to powder x-ray diffraction pattern analysis: Addressing generalizability and perturbation issues simultaneously. Advanced Intelligent Systems, 5(9):2300140, 2023. +Jin-Woong Lee, Woon Bae Park, Jin Hee Lee, Satendra Pal Singh, and Kee-Sun Sohn. A deep-learning technique for phase identification in multiphase inorganic compounds using synthetic xrd powder patterns. Nature communications, 11(1):86, 2020. +Tongxing Lei, Bin Cao, Wenbo Fu, Xiuling Shi, Zhiyu Ding, Qi Zhang, Junwei Wu, Kaikai Li, and Tong-Yi Zhang. A li-rich layered oxide cathode with remarkable capacity and prolonged cycle life. Chemical Engineering Journal, pp. 151522, 2024. +Qi Li, Rui Jiao, Liming Wu, Tiannian Zhu, Wenbing Huang, Shifeng Jin, Yang Liu, Hongming Weng, and Xiaolong Chen. Powder diffraction crystal structure determination using generative models. arXiv preprint arXiv:2409.04727, 2024. +Yang Liu, Jiashun Cheng, Haihong Zhao, Tingyang Xu, Peilin Zhao, Fugee Tsung, Jia Li, and Yu Rong. SEGNO: Generalizing equivariant graph neural networks with physical inductive biases. In ICLR, 2024a. +Yang Liu, Zinan Zheng, Yu Rong, and Jia Li. Equivariant graph learning for high-density crowd trajectories modeling. TMLR, 2024b. ISSN 2835-8856. +Yong Liu, Tengge Hu, Haoran Zhang, Haixu Wu, Shiyu Wang, Lintao Ma, and Mingsheng Long. itransformer: Inverted transformers are effective for time series forecasting. CoRR, abs/2310.06625, 2023. +Kristina Lund, Norihiro Muroyama, and Osamu Terasaki. Accidental extinction in powder xrd intensity of porous crystals: Mesoporous carbon crystal cmk-5 and layered zeolite-nanosheets. Microporous and mesoporous materials, 128(1-3):71-77, 2010. + +Luca Lutterotti, Henry Pilliere, Christophe Fontugne, Philippe Boullay, and Daniel Chateigner. Full-profile search-match by the rietveld method. Journal of applied crystallography, 52(3):587-598, 2019. +Binfeng Lv, Zhenjie Feng, Xiaowei Sun, Jian Cao, Yu Gao, Shihui Chang, Cheng Dong, and Jincang Zhang. iqual: a new computer program for qualitative phase analysis with efficient search-match capability. Journal of Applied Crystallography, 57(2), 2024. +Phillip M Maffettone, Lars Banko, Peng Cui, Yury Lysogorskiy, Marc A Little, Daniel Olds, Alfred Ludwig, and Andrew I Cooper. Crystallography companion agent for high-throughput materials discovery. Nature Computational Science, 1(4):290-297, 2021. +K Maniammal, G Madhu, and V Biju. X-ray diffraction line profile analysis of nanostructured nickel oxide: Shape factor and convolution of crystallite size and microstrain contributions. Physica E: Low-dimensional Systems and Nanostructures, 85:214-222, 2017. +Larry Medsker and Lakhmi C Jain. Recurrent neural networks: design and applications. 1999. +RP Millane. R factors in x-ray fiber diffraction. ii. largest likely r factors. Acta Crystallographica Section A: Foundations of Crystallography, 45(8):573-576, 1989. +MAR Miranda and JM Sasaki. The limit of application of the scherrer equation. Acta Crystallographica Section A: Foundations and Advances, 74(1):54-65, 2018. +Yuqi Nie, Nam H. Nguyen, Phanwadee Sinthong, and Jayant Kalagnanam. A time series is worth 64 words: Long-term forecasting with transformers. In ICLR, 2023. +Shyue Ping Ong, William Davidson Richards, Anubhav Jain, Geoffroy Hautier, Michael Kocher, Shreyas Cholia, Dan Gunter, Vincent L Chevrier, Kristin A Persson, and Gerbrand Ceder. Python materials genomics (pymatgen): A robust, open-source python library for materials analysis. Computational Materials Science, 68:314-319, 2013. +Woon Bae Park, Jiyong Chung, Jaeyoung Jung, Keemin Sohn, Satendra Pal Singh, Myoungho Pyo, Namsoo Shin, and K-S Sohn. Classification of crystal structure using a convolutional neural network. IUCrJ, 4(4):486-494, 2017. +Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, et al. Pytorch: An imperative style, high-performance deep learning library. Advances in neural information processing systems, 32, 2019. +GS Pawley. Unit-cell refinement from powder diffraction scans. Journal of Applied Crystallography, 14(6):357-361, 1981. +Eric A Riesel, Tsach Mackey, Hamed Nilforoshan, Minkai Xu, Catherine K Badding, Alison B Altman, Jure Leskovec, and Danna E Freedman. Crystal structure determination from powder diffraction patterns with generative machine learning. Journal of the American Chemical Society, 146(44):30340-30348, 2024. +HM Rietveld. Line profiles of neutron powder-diffraction peaks for structure refinement. Acta Crystallographica, 22(1):151-152, 1967. +Hugo M Rietveld. A profile refinement method for nuclear and magnetic structures. Journal of applied Crystallography, 2(2):65-71, 1969. +Juan Rodríguez-Carvajal. An introduction to the program fullprof 2000. Version July, 54, 2001. +Mario Enrique Rodriguez-Garcia, Martin Adelaido Hernandez-Landaverde, Jose Miguel Delgado, Cristian Felipe Ramirez-Gutierrez, Marius Ramirez-Cardona, Beatrix M Millan-Malo, and Sandra Milena Londoño-Restrepo. Crystalline structures of the main components of starch. Current Opinion in Food Science, 37:107-111, 2021. +RRUFF. Ruff, 2005. URL https://gsa.confex.com/gsa/2005AM/webprogram/Paper92745.html. Accessed: 2024-05-21. + +Jerardo E Salgado, Samuel Lerman, Zhaotong Du, Chenliang Xu, and Niaz Abdolrahim. Automated classification of big x-ray diffraction data using deep learning models. npj Computational Materials, 9(1):214, 2023. +Mike Schuster and Kuldip K Paliwal. Bidirectional recurrent neural networks. IEEE transactions on Signal Processing, 45(11):2673-2681, 1997. +Tianhao Su, Bin Cao, Shunbo Hu, Musen Li, and Tong-Yi Zhang. Cgwgan: crystal generative framework based on wyckoff generative adversarial network. Journal of Materials Informatics, 4 (4):N-A, 2024. +Yuta Suzuki, Hideitsu Hino, Takafumi Hawaii, Kotaro Saito, Masato Kotsugi, and Kanta Ono. Symmetry prediction and knowledge discovery from x-ray diffraction patterns using an interpretable machine learning approach. *Scientific reports*, 10(1):21790, 2020. +EC Svensson, VF Sears, ADB Woods, and P Martel. Neutron-diffraction study of the static structure factor and pair correlations in liquid he 4. Physical Review B, 21(8):3638, 1980. +Nathan J Szymanski, Christopher J Bartel, Yan Zeng, Qingsong Tu, and Gerbrand Ceder. Probabilistic deep learning approach to automate the interpretation of multi-phase diffraction spectra. Chemistry of Materials, 33(11):4204-4215, 2021. +Brian H Toby. R factors in rietveld analysis: How good is good enough? Powder diffraction, 21(1): 67-70, 2006. +Brian H Toby and Robert B Von Dreele. Gsas-ii: the genesis of a modern open-source all purpose crystallography software package. Journal of Applied Crystallography, 46(2):544-549, 2013. +Atsushi Togo, Kohei Shinohara, and Isao Tanaka. Spglib: a software library for crystal symmetry search, 2024. +David Turnbull. Phase changes. In Solid state physics, volume 3, pp. 225-306. 1956. +University College London. X-ray powder diffraction quality assurance tables, date accessed. URL http://pd.chem.ucl.ac.uk/pxrd/qa/smtable.htm. +Laurens Van der Maaten and Geoffrey Hinton. Visualizing data using t-sne. Journal of machine learning research, 9(11), 2008. +B Van Laar and WB Yelon. The peak in neutron powder diffraction. Journal of Applied crystallography, 17(2):47-54, 1984. +Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. In Neurips, pp. 5998-6008, 2017. +Hong Wang, Yunchao Xie, Dawei Li, Heng Deng, Yunxin Zhao, Ming Xin, and Jian Lin. Rapid identification of x-ray diffraction patterns based on very limited data by interpretable convolutional neural networks. Journal of chemical information and modeling, 60(4):2004-2011, 2020. +Dejan Zagorac, H Müller, S Ruehl, J Zagorac, and Silke Rehme. Recent developments in the inorganic crystal structure database: theoretical crystal structure data and related features. Journal of applied crystallography, 52(5):918-925, 2019. +Zinan Zheng, Yang Liu, Jia Li, Jianhua Yao, and Yu Rong. Relaxing continuous constraints of equivariant graph neural networks for broad physical dynamics learning. In KDD, pp. 4548-4558, 2024. + +# A ADDITIONAL RESULTS + +# A.1 LONG-TAILED DISTRIBUTION AND FORMATION ENERGY + +The distributions of space groups and crystal systems are shown in Figure 4A and B. The formation energy $(E_{f})$ of a configuration represents the energy required or released during its formation. Thus, the formation process can be either endothermic or exothermic. A more negative formation energy indicates greater structural and thermal stability Turnbull (1956). Figures 4C and D illustrate the formation energy per atom across 154,718 crystal structures in MP-2024.1 and 119,569 crystal structures in SimXRD. Figure 4C highlights the high-quality crystal data in MP-2024.1, with $90.33\%$ of structures exhibiting negative formation energy. In comparison, the crystal data in SimXRD shows a negative formation energy rate of $92.18\%$ , indicating that the excluded crystals are primarily unstable. This high-quality structural data forms the foundation of XRD pattern databases. + +![](images/00cfc75c4268c470ecc9acbabe2a97411246ed6253a5063398c8968afacea99a.jpg) +A +Figure 4: The statics of dataset. (A) The distribution of structures contained in the SimXRD database across various space groups (uniformly divided into 5 categories according to the frequency) and (B) crystal systems (C) The distribution of -formation energy/atom of crystals contained in MP-2024.1 and (D) SimXRD. Space groups 89, 103, and 104 have been excluded from Figure A to enhance clarity, each appearing only once. + +![](images/4cf522f642fb4fe8f9cb6a9e7890503b87175fef707500fc72fce23c43e43e72.jpg) + +![](images/69ffbeb6b889a579f62fa4139cf6cf956413ce78a5681670c92ed1acff460251.jpg) + +![](images/6078543ab11e90687ad4d969f15fbe57c947e14989ae1e00756e3c1fd5c8bdab.jpg) + +![](images/a03a9da53e5029e335c51603fa78a2b5a193e29d4a5940d468503a336a88bac6.jpg) + +![](images/7a4c74dcf5901f3b9af278ab9638f53163346f1236e668ca629d1031c0ce4680.jpg) +B + +![](images/df355dc998cf0e098ab01d38fe4326b81fe24eba005bd3f43a2c3a25872b0953.jpg) +c + +![](images/e4937ae4180a8fbb0893b7b68df331175742d468223df9c14490aef9a3703fcb.jpg) +D + +# A.2 PERFORMANCE W.R.T. LONG-TAILED DISTRIBUTION + +To further investigate the model's performance, we display the accuracy of each crystal system and space group at different frequencies in Figure 5 under in-library symmetry identification. To better visualize the model performance on space groups, we divided the results of 280 space groups into 5 categories according to their frequency (the same as Figure 4). From the results, we observe the following: + +- In crystal system classification, the performance of most CNN models, the raw RNN, and transformers is affected by the frequency of crystal systems. They cannot predict the XRD patterns of Cubic and Hexagonal symmetry (their accuracies are almost zero). In contrast, multiple domain-specific CNN (i.e., CNN 7, 9, 10, 11), LSTM, GRU, and advanced Transformers (i.e., Transformer and PatchTST) can mitigate long-tail distributions. + +![](images/96c44574bc2806b74786805455bfa6915fc98aeaf497eeb265059eb82ff8561d.jpg) + +![](images/adbcbd622a503ea63d56d0e3949e161f65b1f2ea094af48c97dc73e5535d778e.jpg) +Figure 5: Classification accuracy of each model w.r.t. crystal systems and space groups. The same as Figure 4(A), Space groups are classified into 5 categories based on their frequency. $N$ denotes the number of crystals. + +![](images/b1155a485122a0e259e21222af83a4831f492bb599c52172008fb50e9cdf3e03.jpg) + +![](images/b5e2175da625ff708d3c35290c43dfc6bf3a47369deb911c37cb34744ba78763.jpg) + +![](images/812ed9114613447ebc29a7b40655ed7f518935afa28bee583461673dd7fec0d1.jpg) + +![](images/78280e302bea1e23c8db9e3e055680d2e80199874a3b59e4e4e5fe367cb56344.jpg) + +- Space group classification is more challenging than crystal system classification. Most models can only predict space groups with high frequency and struggle predict most low-frequency space groups. Surprisingly, PatchTST achieves comparable performance with the best models in all low-frequency space groups. Given that PatchTST is a model specifically tailored for time series forecasting, its performance on XRD pattern classification still has considerable room for improvement. + +# A.3 PARAMETERS INTERVALS STUDY + +To study how simulation parameters influence model performance on SimXRD, we perform an additional comparison by dividing the testing instances into three distinct intervals based on their key simulation parameters: + +- Category 1: Grain size $(\mathrm{nm}) \in [2, 10]$ , atomic thermal offset $(\mathring{\mathrm{A}}) \in [0.4, 0.5]$ , orientation randomness $(\%) \in [30, 40]$ , zero shifting $(^{\circ}) \in [1, 1.2]$ . +- Category 2: Grain size $(\mathrm{nm}) \in [40, 50]$ , atomic thermal offset $(\mathring{\mathrm{A}}) \in [0, 0.1]$ , orientation randomness $(\%) \in [0, 10]$ , zero shifting $(^{\circ}) \in [0, 0.2]$ . +- Category 3: The parameter domain excludes Category 1 and Category 2. + +The three parameter categories represent three simulated experimental scenarios: Category 1 reflects a high degree of peak broadening and external influence, while Category 2 is aligned with relative ideal conditions, exhibiting lower broadening and noise. Category 3 represents an intermediate state between the two. The accuracy of space group classification is displayed in Table 6. The results indicate that the baselines generally perform better in Category 2 and exhibit the lowest accuracy in Category 1, underscoring the challenges of modeling experimental XRD patterns in more complex physical situations. These insights highlight the need for developing a high-fidelity database that encompasses diverse crystals and covers a sufficient range of practical scenarios. + +Table 6: Parameter Categories comparison of crystal systems & space group + +
TaskCrystal System ClassificationSpace Group Classification
MetricCategory1Category2Category3Category1Category2Category3
CNN10.5230.5530.5540.2500.2330.241
CNN20.4520.4670.4640.2500.2330.241
CNN30.3180.3840.3070.2500.2330.241
CNN40.3750.3050.3020.2500.2330.241
CNN50.5000.5450.5260.3120.2860.295
CNN60.3750.3050.3020.2500.2330.241
CNN70.7810.8940.8620.4370.5660.575
CNN80.3750.3050.3020.2500.2330.241
CNN90.7810.8230.7850.3430.6460.609
CNN100.8120.9080.8680.4060.7270.704
CNN110.6560.9080.8950.5620.8230.775
MLP0.3120.3270.3240.2500.2330.241
RNN0.4680.3830.3670.2180.2360.245
LSTM0.5930.7610.7270.2810.5770.515
GRU0.5310.7930.7650.4370.5960.575
Bidirectional-RNN0.3430.3620.3650.2500.2360.245
Bidirectional-LSTM0.7810.8370.7900.4370.6000.559
Bidirectional-GRU0.6560.8180.8000.4370.5960.575
Transformer0.3750.3640.3380.2500.2330.240
iTransformer0.5000.6620.6270.3120.3780.388
PatchTST0.5620.7450.7200.4370.6720.631
+ +# A.4 FEATURE ANALYSIS + +We also analyze the relative feature importance map to provide model interpretability, as shown in Figure 6. By masking features in powder XRD patterns, we observe the impact of the masked features on the model's inference by calculating the relative accuracy drop. This approach reflects the relative importance of the masked features for model classification. As expected, masking critical features results in a significant drop in accuracy. + +To further investigate, we categorize peak features into five groups based on their intensity: (1) Peaks with intensities within the $0 - 20\%$ maximum intensity range, (2) Peaks within the $20 - 40\%$ intensity range, (3) Peaks within the $40 - 60\%$ intensity range, (4) Peaks within the $60 - 80\%$ intensity range, and (5) Peaks within the $80 - 100\%$ intensity range. We evaluate the model's inference performance with these masked features, as shown in Figure 6. The results demonstrate a clear trend: when high-intensity peaks, particularly those in category 5, are masked, a significant accuracy drop is observed across all baselines. This indicates that the ML model heavily relies on high-intensity peaks, similar to the "characteristic peaks" identified in search-match approaches. + +Interestingly, for models that perform well on relative tasks, masking peaks in categories 3 or 4 also noticeably affects performance. This suggests that these models capture more comprehensive pattern characteristics by giving attention to relatively weak intensity peaks. Such behavior is reasonable for deep neural networks, as they extract more detailed information rather than relying solely on the 'three strongest diffraction peaks'. This leads to better performance. + +Comparing the results of CNN11, BiGRU, and PatchTST, three models that performed relatively well in these symmetry identification tasks, we observe distinct strategies for decision-making. CNN11 places greater emphasis on characteristic peaks in category 5, indicating that its inference approach aligns closely with the traditional search-match method. PatchTST follows a similar trend, but the relative accuracy drop is more pronounced, suggesting that PatchTST captures a broader range of peak characteristics compared to CNN11. In contrast, BiGRU exhibits a gradient in the accuracy drop, indicating that it selectively focuses on relatively strong peaks while progressively reducing emphasis on weaker peaks based on their intensity. This strategy is intuitively reasonable, as weaker peaks are more susceptible to noise. These observations suggest that bidirectional architectures, such as BiGRU, may provide a promising solution for studying powder XRD data, as concluded in the main text. + +![](images/e74844822a8af614adaf1451b0810b5c08c0400ccdf1bb3c9a3a2d9ce2d1885f.jpg) +Figure 6: The relative classification accuracy drops when peak features are masked across all baselines. These features are categorized into five groups based on their intensity. 1: Peaks with intensities within the $0 - 20\%$ maximum intensity range, 2: Peaks within the $20 - 40\%$ intensity range, 3: Peaks within the $40 - 60\%$ intensity range, 4: Peaks within the $60 - 80\%$ intensity range, and 5: Peaks within the $80 - 100\%$ intensity range. + +# B ADDITIONAL BACKGROUND + +# B.1 MORE DETAILS ABOUT CRYSTAL SYMMETRY + +The seven crystal systems are cubic(#1), hexagonal(#2), tetragonal(#3), orthorhombic(#4), trigonal(#5), monoclinic(#6), and triclinic(#7). Crystals can be diagrammatically represented by an orderly stacking of lattice cells, whose shape determines the crystal system to which they belong. Unit cells of identical shape can have lattice points, representing an atom or group of atoms, at their centers or faces, in addition to the corners. These additional lattice points further divide the seven crystal systems into 14 Bravais lattices, which are then subdivided into 32 crystal classes, or point groups. Each point group corresponds to a possible combination of rotations, reflections, inversions, and improper rotations. When translational elements are included, these point groups yield the 230 space groups (Clegg, 2023). + +# B.2 IN-LIBRARY AND OUT-OF-LIBRARY TASKS + +In-library identification is a fundamental task in crystallography that aims to accurately identify crystal types based on XRD patterns measured in various environments. Since 1938, crystallographers have been documenting all discovered structures and archiving them as Powder Diffraction Files (PDFs). By comparing and retrieving these PDFs, researchers can determine the structures of studied materials by matching them with historical data. With advancements in computing, numerous software programs have been developed to assist in the search-match process. + +A related concept is out-of-library identification, which involves discovering previously unknown structures that lack recorded data. This process depends on symmetry identification to determine the basic space group information, followed by subsequent refinement. Traditionally, the geometric characteristics of a crystal system are determined based on physical properties, such as electrical conductivity, optical behavior, and thermal properties. The space group is then identified by examining extinction effects. Next, the ideal chemical formula is determined based on the estimated number of atoms and Wyckoff positions. Validation is performed using techniques such as Rietveld refinement and site optimization. + +Therefore, we provided two types of splits: + +- In-library Classification: In our in-library benchmark, the dataset is divided based on different simulation environments. Both the training and testing datasets contain the same structures, but under varying simulation conditions. This setup corresponds to in-library identification in XRD phase analysis. +- Out-of-library Classification: In our out-of-library benchmark, the dataset is split according to crystal types. The training and testing datasets consist of different structures, mirroring the out-of-library identification process in XRD phase analysis. + +# B.3 SEARCH-MATCH APPROACH + +Conventionally, the primary method for in-library phase identification in X-ray powder diffraction patterns is the search-match approach, which consists of three main steps. Initially, (d, I) values, representing interplanar spacing (d) and intensity (I) of each peak, are extracted from the pattern. Subsequently, potential phases are sought from diffraction databases based on characteristic d values, such as Hanawalt indexes (University College London, date accessed). Following this, candidate phases are compared to the (d, I) values of the pattern using a scoring system to assess alignment, aiding in selecting the most suitable candidate phase. This process iterates until satisfactory alignment is achieved for most (d, I) values. A recent study (Lutterotti et al., 2019) employs an approach utilizing the Rietveld method for conducting a Full Profile Search-Match (FPSM). Crystal structures selected from databases are automatically aligned with raw data via the Rietveld method, culminating in a score determined by $R_{wp}$ (Millane, 1989). The phase with the highest score is acknowledged, and this iterative procedure persists until specified criteria are met. Subsequently, a Rietveld quantification is executed to ascertain the weight fraction of each phase. Despite advancements in computer technology that have enabled new qualitative methods, the core workflow of the search-match ap + +proach remains unchanged: matching experimental data with database entries, which contain partial information abstracted from raw diffraction patterns, and calculating a corresponding score. + +# B.4 XRD PATTERN SIMULATION + +Powder XRD provides a one-dimensional representation of three-dimensional diffraction patterns and is the most common experimental measurement, as shown in Figure 8. These patterns reflect the relative arrangement of atoms in three-dimensional space. The interaction of X-rays with condensed materials during diffraction involves elastic collisions between photons and electrons. Consequently, factors that affect atomic arrangement and electron behavior influence the shape of the diffraction pattern, emphasizing the need for high-fidelity simulation technologies. To address this gap, we developed Pysimxrd. + +The diffraction vector $\mathbf{G}^*$ is defined as + +$$ +\left| \mathbf {G} ^ {*} \right| = \frac {2 \sin \theta}{\lambda}, \tag {1} +$$ + +where $\lambda$ is the wavelength of the scattered particle and $\theta = 2\theta /2$ , with $2\theta$ being the angle between the incident and diffracted beams. In three dimensions, scattering occurs only at a discrete set of reciprocal vectors, $\mathbf{K}$ , forming the reciprocal lattice, + +$$ +\mathbf {K} = h \mathbf {a} ^ {*} + k \mathbf {b} ^ {*} + l \mathbf {c} ^ {*}, \tag {2} +$$ + +where $\mathbf{a}^*$ , $\mathbf{b}^*$ , and $\mathbf{c}^*$ are the reciprocal lattice vectors, and $h$ , $k$ , and $l$ are constants. The diffraction condition is defined as + +$$ +2 \pi \mathbf {G} ^ {*} = \mathbf {K}. \tag {3} +$$ + +The $x$ -axis of simulation patterns $d$ is the reciprocal of $|\mathbf{G}^{*}|$ , i.e., $d = 1 / |\mathbf{G}^{*}|$ . + +The diffraction intensity $I$ on each diffraction vector $\mathbf{G}^*$ for a single phase is determined by + +$$ +I \left(\mathbf {G} ^ {*}\right) = S F ^ {*} F \varnothing L P O D + I ^ {\mathrm {B G}}, \tag {4} +$$ + +where $S$ denotes the scale factor, $F$ is the structure factor, $F^{*}$ is the complex conjugate of $F$ , $\varnothing$ is the profile function, $L$ is the Lorentz-polarization factor, $P$ is the multiplicity, $O$ is the preferred orientation factor, $D$ is the Debye-Waller factor, and $I^{\mathrm{BG}}$ is the background intensity. The structure factor is computed as: + +$$ +F = \sum_ {j = 1} ^ {N} f _ {j} e ^ {2 \pi i \mathbf {G} ^ {*} \cdot \mathbf {R}}, \tag {5} +$$ + +where $f_{j}$ is the form factor Hubbell et al. (1974) in XRD, $\mathbf{R}$ is the lattice coordinate of atom $j$ , and $N$ is the total number of atoms in a lattice cell. + +The Lorentz-polarization $L$ is calculated by, + +$$ +L = \frac {1 + \cos^ {2} 2 \theta}{\sin^ {2} \theta \cos \theta}, \tag {6} +$$ + +where $\theta = \arcsin \left(\frac{\lambda|\mathbf{G}^{*}|}{2}\right)$ . The multiplicity $P$ is determined by counting the number of diffraction vectors present within an Ewald diffraction sphere. The Debye-Waller factor $D$ is calculated by, + +$$ +D = e ^ {- 2 M}, \tag {7} +$$ + +where $M = \frac{6h^2T}{mk\Theta^2}\left(\phi \left(\frac{\Theta}{T}\right) + \frac{\Theta}{4T}\right)\left(\sin^2\theta\right) / \lambda$ , $h$ is Planck's constant, $m$ is atom mass, $k$ is Boltzmann constant, $\Theta$ is the average characteristic temperature, $T$ is absolute temperature, and $\phi (\Theta /T)$ is the Debye function. + +The profile function $(\varnothing)$ is modeled by convolving various factors, including diffraction, detector geometry, and noise factors etc. The simulated peaks are calculated by: + +$$ +y (x) = W * G * S. \tag {8} +$$ + +Here, $*$ denotes the convolution process, and $W$ , $G$ , and $S$ represent the contributions to the observed XRD pattern from diffraction emission, instrumental factors, and the noise mixture, respectively. $S$ is modeled as a Gaussian peak. + +The $W$ is a Voigt function Armstrong (1967), + +$$ +W = \frac {1}{\sigma \sqrt {2 \pi}} \int_ {- \infty} ^ {\infty} \left[ \frac {\gamma}{(2 \theta - t) ^ {2} + \gamma^ {2}} \right] \exp \left(- \frac {(2 \theta - t) ^ {2}}{2 \sigma^ {2}}\right) d t. \tag {9} +$$ + +Peak broadening is correlated with the Full Width at Half Maximum (FWHM, $\Gamma$ ), where $2\gamma = 2\sqrt{2\ln 2}\sigma = \Gamma$ Caglioti et al. (1958). $\Gamma$ is calculated by Scherrer's equation Miranda & Sasaki (2018) related to finite grain size. + +The geometrical factorVan Laar & Yelon (1984), $G$ , accounts for the actual dimensions of the detectors and the powder sample. It is defined as follows: + +$$ +D (2 \alpha , 2 \theta) = \frac {\delta I (2 \theta)}{\delta (2 \alpha)} d (2 \alpha), \tag {10} +$$ + +$$ +G (2 \alpha , 2 \theta) = \frac {L}{4 H S h \cos (2 \alpha)} \int d z, \tag {11} +$$ + +where $2\alpha$ represents the Bragg angle. The detector is slit-shaped, with a height of $2H$ , and the sample has a height of $2S$ . $L$ denotes the distance between the sample and the detector. + +The simulation environments in our study encompass three key aspects. The first aspect pertains to the sample, where we simulate the average grain size, the ideal orientation effect of the powder, and the lattice cell's extinction and torsional deformation under internal stress. The second aspect involves the testing conditions, accounting for factors such as atomic thermal vibrations at room temperature, air scattering-induced signal noise, and instrumental vibration-induced noise. The third aspect relates to the diffractometer, including the zero shift of the angular position and detector's geometry. + +The adjustable parameters of the simulation environments include: + +- Finite grain size (for Voigt peaks): the average grain size is set as a random number in the range of $2\mathrm{nm}$ to $50\mathrm{nm}$ to replicate the degree of experimental broadening (Maniammal et al., 2017). Instrumental broadening becomes apparent in the experimental patterns as convolution with the crystal peak occurs. Typically, in the refinement process, it is common to separate observed peaks into Voigt and instrumental components. However, quantifying the instrumental component proves challenging as it varies with the diffraction angle. Therefore, in our simulations, we opt for a smaller grain size than realistic to accurately replicate the degree of experimental broadening. Pysimxrd can also model the asymmetric peak by convolving the instrumental geometry factors in equation 11. If a convolution peak is applied, the grain size range must be adjusted accordingly. +- Orientation: the ideal powder sample is assumed to have no orientation, however, this is impossible. The orientation effect arises from the uneven distribution of small grains in the incident beam, leading to an uneven distribution of reciprocal sites across the reciprocal spheres of the powder sample. To simulate the impact of orientation, we set the intensity by perturbation within a $40\%$ range based on the ideal simulation to mimic the orientation randomness. +- Thermal vibration: the temperature is converted to the kinetic energy of atoms, which is simulated by allowing atoms to shift from their average positions within a range of 0.01-0.5 angstrom. +- Internal stress: internal stress is simulated by applying elastic deformation of the recorded lattice constant by up to $10\%$ . +- Instrument zero shifting: the zero shift is simulated by randomly translating $2\theta$ within -1.2 to 1.2 degrees. +- Instrument noise: $2\%$ Gaussian white noise is added to the entire pattern to reflect instrument noise. + +- Inelastic Scattering: A sixth-order polynomial function is employed to simulate the background distribution, encompassing phenomena such as Compton scattering, fluorescence, and multiple scattering. This simulated background is then integrated into the XRD pattern with a $2\%$ ratio. + +![](images/b430b86d1a255a78ed569f03914c71f577266c63f8b87962a48f8065157b6efb.jpg) + +![](images/f5c57fea5c2649e1e2d284bb273ce73ad658d0dd503164401ea768f914f6a106.jpg) + +![](images/1e1f87f03ff0b1e44876a287111aab165f7917adc4d871ff114b21e3ff594e39.jpg) +Figure 7: Comparison of simulation pattern with experimental pattern of $\mathrm{PbSO_4}$ (A) The generated $\mathrm{PbSO_4}$ powder XRD without considering the simulation environment. (B) The generated $\mathrm{PbSO_4}$ powder XRD based on a set of parameters that account for finite grain size, orientation, thermal vibrations, and internal stress. (C) The generated $\mathrm{PbSO_4}$ powder XRD with an extended set of parameters that further include zero-shift correction, noise, peak convolution, and background effects. (D) The experimentally observed data. Note: The $\mathrm{PbSO_4}$ structure corresponds to entry 1010950.cif from the Crystallography Open Database. The parameter sets used in the simulations were optimized by minimizing the differences between the simulated and experimental patterns, rather than being randomly assigned. All patterns were converted to Q-space using a wavelength of $1.54\AA$ . + +![](images/09e7e11e06e43b80559be274abb88b7a3ecb32b23be8cd439ad0cb391809234f.jpg) + +As illustrated in Figure 7, the multiphysical coupling observed in experimental XRD can be incorporated into the simulation parameter space by introducing more realistic conditions. Specifically, considering factors such as orientation, thermal vibrations, zero-shift corrections, noise, and other sources of randomness significantly improves the realism of the simulations. These parameters collectively influence the arrangement of peaks, their intensities, and overall shapes in the diffraction pattern. + +# B.5 CRYSTAL AND DIFFRACTION + +Among various investigative methods, diffraction analysis stands out as exceptionally potent for probing microstructure, primarily due to its sensitivity to atomic arrangement and the element specificity of atom scattering power. Each intensity maximum, termed a line profile or peak, within a diffraction pattern reflects the atomic arrangement along certain direction of the diffracting material. + +Powder X-ray diffraction, in particular, furnishes a remarkably diverse array of structural details, encoded in the material- and instrument-specific distribution of coherently scattered monochromatic wave intensity, with wavelengths corresponding to lattice spacing. The X-rays are generated by a cathode ray tube, filtered to produce monochromatic radiation, collimated for concentration, and directed towards the sample. When conditions satisfy Bragg's Law, which relates the wavelength + +of electromagnetic radiation to the diffraction angle and lattice spacing in a crystalline sample, the incident rays interact with the sample to produce constructive interference and a diffracted ray, as shown in Figure 8. + +The diffracted X-rays are subsequently detected, processed, and quantified. By scanning the sample across a range of diffraction angles, all possible diffraction directions of the lattice are accessible due to the random orientation of powder sample. + +# B.6 SYMMETRY RECOGNITION IN STRUCTURE DETERMINATION + +Pattern refinement (Rietveld, 1967; 1969) is essential for accurately determining the crystal structure in diffraction studies. In XRD refinement, the initial step involves identifying the crystal phase of the given XRD pattern. This is crucial because it facilitates the calculation of the static structure factor (Svensson et al., 1980), which aids in determining atomic sites during refinement. + +Using existing crystal databases, the commonly employed search-match approach retrieves potential structures that match the observed pattern, effectively performing in-library identification. The matched structure, along with basic crystallographic information such as crystal symmetry, serves as a foundational element for further analysis. In out-of-library situations, the geometry of the crystal lattice must be established from scratch, as there is no recorded structure history. By solving the diffraction indices corresponding to a set of lattice planes for each diffraction peak, a process known as indexing calculation (Rodriguez-Garcia et al., 2021), the crystal symmetry can be determined. + +Whether the observed patterns are from in-library or out-of-library crystals, symmetry identification combined with indexing is a universal method for determining lattice geometry to initiate the refinement process. This is why many researchers seek a general method for deriving the symmetry of structures based on diffraction patterns. Once the fundamental crystallographic information is obtained, techniques such as pattern decomposition and Rietveld refinement (Rietveld, 1967; 1969; Le Bail, 2005) are employed. + +These methodologies help determine atomic sites, temperature factors, grain sizes, residual stress, and other intricate structural details from the diffraction patterns, thereby contributing to the comprehensive understanding of a crystal structure. + +![](images/abf28f6a231bcd6b10ae200a467a5c1cebd21adee9387f7aa4bdc221a7d7ab24.jpg) +Figure 8: Experimental procedure for recording XRD patterns. + +# B.7 WHOLE POWDER PATTERN FITTING AND REFINEMENT + +Structure refinement is an effective method for determining crystal structures. Traditionally, refinement begins with a set of reasonably estimated parameters with physical significance. Accurately identifying the structure's space group aids in establishing rational parameters. However, without prior structural knowledge, this process becomes trial and error. Although identifying the space group initiates the process, its validation relies on refinement outcomes. + +A significant advancement in powder diffraction fitting for structure refinement emerged with the Rietveld method (Rietveld, 1967; 1969), which pioneered whole pattern fitting over the analysis of individual, non-overlapping Bragg diffraction peaks. The Whole Powder Pattern Fitting (WPPF) approach within the Rietveld method uses profile intensity calculations and a least-squares algorithm for structure refinement. By minimizing the disparities between observed experimental profiles and theoretical profiles, it extracts all structural information. Once fitting reaches its limit, the parameters in the theoretical model represent the only determinable physical information. SimXRD's pattern simulation also relies on the structural information contained within the theoretical model. The Pawley(Pawley, 1981) and Le Bail(Le Bail et al., 1988) methods, two widely used WPPF techniques, are developed after the Rietveld method. + +These parameters with physical significance are diverse, and one important type is peak shape parameters. The parameters of each diffraction peak (positions, intensities, and shapes) within a whole XRD pattern offer detailed structural insights from different aspects, making their quantitative and + +accurate extraction from the overall XRD profile highly significant. This quantification of peak information and the subsequent derivation of physical parameters constitute the essence of the refinement endeavor. + +# B.8 SIM2REAL GAP + +To illustrate the advantages of Pysimxrd in generating high-fidelity powder XRD patterns, we compared its performance with a widely recognized software, GSAS-II (Toby & Von Dreele, 2013). The simulation process involves the use of refinement software, starting with the determination of suitable parameter sets through the refinement procedure provided by each software. The lattice constants derived from these refinements are summarized in Table 7. Once the parameters are confirmed, the corresponding simulation patterns are generated. + +Table 7: Derived crystal structures in refinement. + +
Lattice Constants (Å)
ModelsCrystalsabcαβγ
PysimxrdMn2O39.4082(2)9.4082(2)9.4082(2)909090
PysimxrdRuO24.5381(7)4.5381(7)3.1248(4)909090
GSAS-IIMn2O39.4197(1)9.4197(1)9.4197(1)909090
GSAS-IIRuO24.5351(8)4.5351(8)3.1226(0)909090
+ +Two experimental powder XRD patterns were obtained using an X'Pert Pro MPD (Panalytical) in Bragg-Brentano geometry with a copper X-ray source ( $\lambda_{\mathrm{K - \alpha}} = 1.5406\AA$ ). The samples used were $\mathrm{Mn_2O_3}$ and $\mathrm{RuO_2}$ crystals. As shown in Figure 9, Pysimxrd and GSAS-II demonstrated comparable accuracy in reconstructing the $\mathrm{Mn_2O_3}$ pattern. However, Pysimxrd showed significant advantages in reconstructing the $\mathrm{RuO_2}$ pattern. This superiority stems from Pysimxrd's ability to account for a broader range of simulation environments and its greater flexibility in tuning parameters, which resulted in a more accurate reconstruction with lower R-factors. + +![](images/b77785250e864b2b0110b21d71bc8b3bbf07a5f512b6e20e80b81515a200d526.jpg) + +![](images/e42ebddb5014fda8310caa1e9e218fc0387a88bcabe91bd015a62ba2ab1316fa.jpg) + +![](images/9de072b74cc142542bb7c58d82d23eecb3039957a24f3fbf74d28b81bb6a4cfd.jpg) +Figure 9: Comparison of simulated and experimental patterns: (A) The $\mathrm{Mn_2O_3}$ pattern simulated using Pysimxrd. (B) The $\mathrm{Mn_2O_3}$ pattern simulated using GSAS-II. (C) The $\mathrm{RuO_2}$ pattern simulated using Pysimxrd. (D) The $\mathrm{RuO_2}$ pattern simulated using GSAS-II. The R-factors, calculated as (Toby, 2006), are used to evaluate the quality of the fitting. + +![](images/0d9b5246e3fb15e480045d6f489d4e729024234aa3904aa713ed173339260210.jpg) + +# B.9 THE T-SNE PLOTS OF POWDER XRD PATTERNS + +We also computed t-SNE plots (Van der Maaten & Hinton, 2008) based on XRD patterns, along with their corresponding crystal systems and space groups, as shown in Figure 10. The results indicate that the projection plots for both SimXRD and RRUFF exhibit bilateral symmetry and distinct manifolds. However, due to the limited data in RRUFF, the two datasets show some discrepancies, reflected in the differences in crystal system and space group distributions across the XRD patterns. + +![](images/5ce77a341a4a5a8e52e478cfd399bdc486f10752a3c7c7e53fdf01c12bfa9991.jpg) + +![](images/a8794348ca220cb8b33658be0ed824562b47184ad0ed6960664652c083b8d330.jpg) + +![](images/cc4668aa64567f9891405dce1ced862bfe4921c76f818fd60e2520210a13d6c0.jpg) +Figure 10: (A) The t-SNE plot for XRD patterns in the SimXRD validation dataset. (B) The t-SNE plot for XRD patterns in the RRUFF dataset. Numbers 1-7 represent the seven crystal systems (Appendix B.1), while 1-230 correspond to the space groups. + +![](images/450732e9238053c0da78334c228b610dead6f2e4b87204a27066349ab5c95fa1.jpg) \ No newline at end of file diff --git a/ICLR/2025/SimXRD-4M_ Big Simulated X-ray Diffraction Data and Crystal Symmetry Classification Benchmark/images.zip b/ICLR/2025/SimXRD-4M_ Big Simulated X-ray Diffraction Data and Crystal Symmetry Classification Benchmark/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..d9077885769d6c7e58df56939b45352871cdae47 --- /dev/null +++ b/ICLR/2025/SimXRD-4M_ Big Simulated X-ray Diffraction Data and Crystal Symmetry Classification Benchmark/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f230dd36bba0d6e698bbb2dae30135de7c2d51a6407b279dc57e92cf96739c4e +size 1548580 diff --git a/ICLR/2025/SimXRD-4M_ Big Simulated X-ray Diffraction Data and Crystal Symmetry Classification Benchmark/layout.json b/ICLR/2025/SimXRD-4M_ Big Simulated X-ray Diffraction Data and Crystal Symmetry Classification Benchmark/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..11d425a93e4a5a9639780fc0f0925a038919d566 --- /dev/null +++ b/ICLR/2025/SimXRD-4M_ Big Simulated X-ray Diffraction Data and Crystal Symmetry Classification Benchmark/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a5d21a02e89baa7e032b0fcf678c972ae93a1f3b987532d7960d985fa7f779a7 +size 685781 diff --git a/ICLR/2025/Simple Guidance Mechanisms for Discrete Diffusion Models/3046dc0d-7c73-4996-982c-ac63e3774102_content_list.json b/ICLR/2025/Simple Guidance Mechanisms for Discrete Diffusion Models/3046dc0d-7c73-4996-982c-ac63e3774102_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..fa5af3e2c60ec8024389dfa89ec16b6756c98531 --- /dev/null +++ b/ICLR/2025/Simple Guidance Mechanisms for Discrete Diffusion Models/3046dc0d-7c73-4996-982c-ac63e3774102_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5797e2e233d4034e111cf50e39933e3802e5757f3b398614eeeeafceef765ebb +size 296597 diff --git a/ICLR/2025/Simple Guidance Mechanisms for Discrete Diffusion Models/3046dc0d-7c73-4996-982c-ac63e3774102_model.json b/ICLR/2025/Simple Guidance Mechanisms for Discrete Diffusion Models/3046dc0d-7c73-4996-982c-ac63e3774102_model.json new file mode 100644 index 0000000000000000000000000000000000000000..ff37e5492a5d39a8e3ac80f2ffc1fc7e8a913d8a --- /dev/null +++ b/ICLR/2025/Simple Guidance Mechanisms for Discrete Diffusion Models/3046dc0d-7c73-4996-982c-ac63e3774102_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:98536cda143395d2503ed73e5b851586c3495ae5da8247d23031071189e79593 +size 342292 diff --git a/ICLR/2025/Simple Guidance Mechanisms for Discrete Diffusion Models/3046dc0d-7c73-4996-982c-ac63e3774102_origin.pdf b/ICLR/2025/Simple Guidance Mechanisms for Discrete Diffusion Models/3046dc0d-7c73-4996-982c-ac63e3774102_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..c759aa2bcfc567d8d55a7620f5079ae532e36e4d --- /dev/null +++ b/ICLR/2025/Simple Guidance Mechanisms for Discrete Diffusion Models/3046dc0d-7c73-4996-982c-ac63e3774102_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d02b07c9ee3489f5a777e009551d54d5c34d7fd31a6776bc910992bb57e95c29 +size 1908729 diff --git a/ICLR/2025/Simple Guidance Mechanisms for Discrete Diffusion Models/full.md b/ICLR/2025/Simple Guidance Mechanisms for Discrete Diffusion Models/full.md new file mode 100644 index 0000000000000000000000000000000000000000..a21ec29400197da6560386d97a378c98710077c9 --- /dev/null +++ b/ICLR/2025/Simple Guidance Mechanisms for Discrete Diffusion Models/full.md @@ -0,0 +1,1127 @@ +# SIMPLE GUIDANCE MECHANISMS FOR DISCRETE DIFFUSION MODELS + +Yair Schiff*, Subham Sekhar Sahoo†, Hao Phung†, Guanghan Wang†, Alexander Rush, & Volodymyr Kuleshov + +Department of Computer Science, Cornell University + +{yzs2,sss284,gw354,htp26,amr459,vk379}@cornell.edu + +Hugo Dalla-Torre, Sam Boshar, Bernardo P. de Almeida, & Thomas Pierrot +InstaDeep + +{h.dalla-torre,s.boshar,b.dealmeida,t.pierrot}@instadeep.com + +# ABSTRACT + +Diffusion models for continuous data gained widespread adoption owing to their high quality generation and control mechanisms. However, controllable diffusion on discrete data faces challenges given that continuous guidance methods do not directly apply to discrete diffusion. Here, we provide a straightforward derivation of classifier-free and classifier-based guidance for discrete diffusion, as well as a new class of diffusion models that leverage uniform noise and that are more guidable because they can continuously edit their outputs. We improve the quality of these models with a novel continuous-time variational lower bound that yields state-of-the-art performance, especially in settings involving guidance or fast generation. Empirically, we demonstrate that our guidance mechanisms combined with uniform noise diffusion improve controllable generation relative to autoregressive and diffusion baselines on several discrete data domains, including genomic sequences, small molecule design, and discretized image generation. Code to reproduce our experiments is available here. + +# 1 INTRODUCTION + +Diffusion models (Sohl-Dickstein et al., 2015; Ho et al., 2020) gained widespread adoption in image generation and signal processing in part due to their high controllability via mechanisms such as classifier-based (Dhariwal & Nichol, 2021a) and classifier-free guidance (Nichol et al., 2021; Ho & Salimans, 2022). Tasks where guidance plays a key role include MRI denoising (Song & Ermon, 2019), 3D reconstruction (Poole et al., 2022; Gao et al., 2024), and conditional generation (Saharia et al., 2022; Gokaslan et al., 2024). + +However, applying controllable diffusion-based generation to tasks where the data is discrete (e.g., molecule design or text generation) presents challenges. First, standard diffusion models and their guidance mechanisms are not directly applicable, since they require taking gradients with respect to the data, and these are not defined in discrete settings. Second, popular discrete extensions of diffusion (Sahoo et al., 2024a; Shi et al., 2024) cannot perform multiple editing passes on generated tokens, hence are not ideal for controllable generation. Third, the performance of discrete diffusion models (measured by perplexity) lags behind autoregressive (AR) models, especially for classes of diffusion that are amenable to control, such as uniform noise (Austin et al., 2021; Lou et al., 2023). + +Here, we propose discrete diffusion models and guidance mechanisms that are effective at controllable generation and that address the above challenges. First, we provide straightforward and easy-to-implement adaptations of classifier-based and classifier-free guidance for discrete diffusion models. Second, we revisit uniform noise diffusion language models (UDLM), which undo random token perturbations and are particularly amenable to guidance, since they can repeatedly edit their samples (Austin et al., 2021) and thus correct errors. We address performance issues that plagued + +![](images/27a018ffd21312aa49bc74b08c618e2dd4464603e6959c4f0be62e9a9840de8b.jpg) +Figure 1: (Left) Adapting guidance to discrete diffusion. Models output a factorized discrete distribution for each denoised token. With our guidance mechanisms, we adjust these probabilities according to a guidance model - either a conditional diffusion model in classifier-free guidance (Section 3.1) or a separately trained classifier for classifier-based guidance (Section 3.2). (Right) Relative to autoregressive models, which make local predictions one token at a time, discrete diffusion models denoise the entire sequence at every iteration, allowing for more guidable outputs. + +![](images/d91bf804248187dfd24457a922fbeb395652a84ca993d8b2456942185a1b0775.jpg) + +previous iterations of uniform noise discrete diffusion by deriving a continuous-time version of the evidence lower bound, which tightens the variational gap (Kingma et al., 2021; Sahoo et al., 2024a). + +We demonstrate the effectiveness of guidance with discrete diffusion models on several domains: genomics, molecule strings, and discretized images. We find that discrete diffusion models are more controllable than AR when paired with classifier-free guidance. Moreover, our proposed classifier-based method improves upon previous guidance mechanisms for diffusion (Gruver et al., 2024) and AR (Dathathri et al., 2019; Yang & Klein, 2021). Our language modeling experiments also reveal that contrary to a widely-held belief (Austin et al., 2021; Lou et al., 2023), uniform noise diffusion can attain state-of-the-art performance on small vocabulary datasets (e.g., molecules, DNA) and that UDLM attains a new state-of-the-art in perplexity among uniform noise diffusion models. + +In summary, our contributions are as follows: + +- We provide simple and effective discrete classifier-based and classifier-free guidance. +- We introduce UDLM, a class of discrete diffusion models particularly amenable to guidance, for which we derive a tightened ELBO that significantly improves their performance. +- Across three domains, we demonstrate that discrete guidance yields better controllable generation compared to strong AR baselines and previous diffusion guidance methods. + +# 2 BACKGROUND + +Notation Let $\mathcal{V}$ be the space of all one-hot tokens over some vocabulary consisting of $N$ unique characters: $\mathcal{V} = \{\mathbf{z} \in \{0,1\}^N : \sum_i \mathbf{z}_i = 1\} \subset \Delta^N$ , where $\Delta^N$ represents the simplex over $N$ categories. Let $\mathbf{1}$ be a $N$ -dimensional column vector of all ones, and denote the Hadamard product between two vectors as $\odot$ . We define $\mathbf{z}^{(1:L)}$ as a sequence of $L$ tokens, where $\mathbf{z}^{(\ell)} \in \mathcal{V}$ , for all tokens $\ell \in \{1,\dots,L\}$ , and use $\mathcal{V}^L$ to denote the set of all such sequences. Finally, let $\operatorname{Cat}(\cdot; p)$ denote the categorical distribution with probability vector $p \in \Delta^N$ . + +# 2.1 DISCRETE DIFFUSION MODELS + +Diffusion models are a class of generative models defined by a denoising network $p_{\theta}$ that is trained to remove noise from latent variables $\mathbf{z}_t$ . These latents are generated by a fixed corruption process $q$ that, starting from clean data $\mathbf{x}$ drawn from the data distribution $q(\mathbf{x})$ , increasingly adds more noise to $\mathbf{z}_t$ , as $t$ increases (Sohl-Dickstein et al., 2015; Song & Ermon, 2019; Ho et al., 2020). + +In discrete denoising diffusion probabilistic models (D3PM; Austin et al. (2021)), the noising process is defined in terms of a transition matrix $Q_{t|s}$ whose $(i,j)^{\mathrm{th}}$ entry is the probability of transitioning to the $i$ -th state at time $t$ given the $j$ -th state at time $s$ . This induces a Markov corruption process where we have $q(\mathbf{z}_t\mid \mathbf{z}_s) = \mathrm{Cat}(\mathbf{z}_t;Q_{t|s}\mathbf{z}_s)$ . + +Sahoo et al. (2024a) build off this framework to introduce specialized algorithms that are both simpler and more effective than the general D3PM framework. They focus on a specific class of forward processes from D3PM that can be defined as interpolations between clean data and a noisy prior $\pi$ , and we adopt their notation below: + +$$ +q \left(\mathbf {z} _ {t} \mid \mathbf {x}\right) = \operatorname {C a t} \left(\mathbf {z} _ {t}; \alpha_ {t} \mathbf {x} + (1 - \alpha_ {t}) \boldsymbol {\pi}\right), \tag {1} +$$ + +where $\alpha_{t} = \alpha(t)$ is a noise schedule monotonically decreasing in $t$ . Defining $\alpha_{t|s} = \alpha_{t} / \alpha_{s}$ , this class of processes admit the following posteriors + +$$ +q \left(\mathbf {z} _ {s} \mid \mathbf {z} _ {t}, \mathbf {x}\right) = \operatorname {C a t} \left(\mathbf {z} _ {s}; \frac {\left[ \alpha_ {t \mid s} \mathbf {z} _ {t} + \left(1 - \alpha_ {t \mid s}\right) \mathbf {1} \boldsymbol {\pi} ^ {\top} \mathbf {z} _ {t} \right] \odot \left[ \alpha_ {s} \mathbf {x} + \left(1 - \alpha_ {s}\right) \boldsymbol {\pi} \right]}{\alpha_ {t} \mathbf {z} _ {t} ^ {\top} \mathbf {x} + \left(1 - \alpha_ {t}\right) \mathbf {z} _ {t} ^ {\top} \boldsymbol {\pi}}\right). \tag {2} +$$ + +Of note, for absorbing-state diffusion, where $\pi = [\mathrm{MASK}]$ , a one-hot vector at the special [MASK] token index, Sahoo et al. (2024a) show that if $\mathbf{z}_t \neq [\mathrm{MASK}]$ then $q(\mathbf{z}_s|\mathbf{z}_t,\mathbf{x}) = \mathrm{Cat}(\mathbf{z}_s;\mathbf{z}_t)$ , which reflects the fact that unasked tokens at time $t$ must remain unmasked for all time $s < t$ . + +# 2.2 DIFFUSION GUIDANCE + +For continuous data, diffusion models have demonstrated state-of-the-art controllable generation by means of classifier-based (Sohl-Dickstein et al., 2015; Dhariwal & Nichol, 2021a) and classifier-free guidance (Nichol et al., 2021; Ho & Salimans, 2022; Sahara et al., 2022). These approaches rely on different ways of expressing the score of a distribution conditioned on $y$ . + +Classifier-based Classifier-based generation employs a diffusion model to iteratively sample from a tempered distribution $p^{\gamma}(\mathbf{z}_s \mid y, \mathbf{z}_t) \propto p(y \mid \mathbf{z}_s)^{\gamma} p_{\theta}(\mathbf{z}_s \mid \mathbf{z}_t)$ , where $\gamma$ represents an inverse temperature parameter, $p_{\theta}(\mathbf{z}_s \mid \mathbf{z}_t)$ is a pre-trained diffusion model, and $p(y \mid \mathbf{z}_s)$ is a classifier: + +$$ +\nabla_ {\mathbf {z} _ {s}} \log p ^ {\gamma} \left(\mathbf {z} _ {s} \mid y, \mathbf {z} _ {t}\right) = \gamma \nabla_ {\mathbf {z} _ {s}} \log p (y \mid \mathbf {z} _ {s}) + \nabla_ {\mathbf {z} _ {s}} \log p _ {\theta} \left(\mathbf {z} _ {s} \mid \mathbf {z} _ {t}\right). \tag {3} +$$ + +Classifier-free We can also observe that applying Bayes' rule to $p(y \mid x)$ and differentiating with respect to the input yields $\nabla_{\mathbf{x}} \log p(y \mid x) = \nabla_{\mathbf{x}} \log p(x \mid y) - \nabla_{\mathbf{x}} \log p(x)$ . Applying this to $p(y \mid \mathbf{z}_s)$ and plugging into (3) gives us the formulation for classifier-free guidance: + +$$ +\begin{array}{l} \nabla_ {\mathbf {z} _ {s}} \log p ^ {\gamma} (\mathbf {z} _ {s} \mid y, \mathbf {z} _ {t}) = \gamma \cdot \left[ \nabla_ {\mathbf {z} _ {s}} \log p _ {\theta} (\mathbf {z} _ {s} \mid y, \mathbf {z} _ {t}) - \nabla_ {\mathbf {z} _ {s}} \log p _ {\theta} (\mathbf {z} _ {s} \mid \mathbf {z} _ {t}) \right] + \nabla_ {\mathbf {z} _ {s}} \log p _ {\theta} (\mathbf {z} _ {s} \mid \mathbf {z} _ {t}) \\ = \gamma \nabla_ {\mathbf {z} _ {s}} \log p _ {\theta} \left(\mathbf {z} _ {s} \mid y, \mathbf {z} _ {t}\right) + (1 - \gamma) \nabla_ {\mathbf {z} _ {s}} \log p _ {\theta} \left(\mathbf {z} _ {s} \mid \mathbf {z} _ {t}\right). \tag {4} \\ \end{array} +$$ + +with $p_{\theta}(\mathbf{z}_s \mid y, \mathbf{z}_t)$ conditionally and $p_{\theta}(\mathbf{z}_s \mid \mathbf{z}_t)$ unconditionally trained diffusion models. + +# 3 GUIDANCE ALGORITHMS FOR DISCRETE DIFFUSION + +Applying guidance to discrete diffusion is challenging because guidance terms are not differentiable with respect to the discrete representations $\mathbf{z}_t$ (Gruver et al., 2024). Here, we introduce two guidance algorithms for discrete diffusion that circumvent the issue of non-differentiability. As in Section 2.2, we formalize the guidance term as a probability $p(y|\mathbf{z})\in \Delta^K$ , where $y\in \{1,\dots ,K\}$ is one of $K$ possible classes, and we begin with the distribution that controls the strength of the guidance term via the $\gamma$ temperature parameter (with $c$ denoting the logarithm of the normalization constant): + +$$ +\log p ^ {\gamma} \left(\mathbf {z} _ {s} \mid y, \mathbf {z} _ {t}\right) = \gamma \log p (y \mid \mathbf {z} _ {s}, \mathbf {z} _ {t}) + \log p \left(\mathbf {z} _ {s} \mid \mathbf {z} _ {t}\right) + c. \tag {5} +$$ + +# 3.1 CLASSIFIER-FREE GUIDANCE + +Guidance for a Single Token To derive classifier-free guidance, we apply Bayes' rule to the first term on the right-hand side of (5): + +$$ +\log p ^ {\gamma} \left(\mathbf {z} _ {s} \mid y, \mathbf {z} _ {t}\right) = \gamma \log p \left(\mathbf {z} _ {s} \mid y, \mathbf {z} _ {t}\right) - \gamma \log p \left(\mathbf {z} _ {s} \mid \mathbf {z} _ {t}\right) + \gamma \log p (y \mid \mathbf {z} _ {t}) + \log p \left(\mathbf {z} _ {s} \mid \mathbf {z} _ {t}\right) + c. +$$ + +Absorbing $\gamma \log p(y\mid \mathbf{z}_t)$ into the constant $c$ and grouping terms yields: + +$$ +\log p ^ {\gamma} \left(\mathbf {z} _ {s} \mid y, \mathbf {z} _ {t}\right) = \gamma \log p \left(\mathbf {z} _ {s} \mid y, \mathbf {z} _ {t}\right) + (1 - \gamma) \log p \left(\mathbf {z} _ {s} \mid \mathbf {z} _ {t}\right) + c. \tag {6} +$$ + +Extension to Sequences In the derivation for (6), we can replace the single-token latent variables with sequences of multiple tokens: + +$$ +\begin{array}{l} \log p ^ {\gamma} \left(\mathbf {z} _ {s} ^ {(1: L)} \mid y, \mathbf {z} _ {t} ^ {(1: L)}\right) = \gamma \log p \left(\mathbf {z} _ {s} ^ {(1: L)} \mid y, \mathbf {z} _ {t} ^ {(1: L)}\right) + (1 - \gamma) \log p \left(\mathbf {z} _ {s} ^ {(1: L)} \mid \mathbf {z} _ {t} ^ {(1: L)}\right) + c, \tag {7} \\ \Longrightarrow p ^ {\gamma} \left(\mathbf {z} _ {s} ^ {(1: L)} \mid y, \mathbf {z} _ {t} ^ {(1: L)}\right) \propto p \left(\mathbf {z} _ {s} ^ {(1: L)} \mid y, \mathbf {z} _ {t} ^ {(1: L)}\right) ^ {\gamma} p \left(\mathbf {z} _ {s} ^ {(1: L)} \mid \mathbf {z} _ {t} ^ {(1: L)}\right) ^ {(1 - \gamma)} \\ \end{array} +$$ + +Discrete Classifier-Free Guidance We can model the probabilities in (7) by training a conditional denoising diffusion network $p_{\theta}(\mathbf{z}_s^{(1:L)} \mid y, \mathbf{z}_t^{(1:L)})$ and an unconditional one $p_{\theta}(\mathbf{z}_s^{(1:L)} \mid \mathbf{z}_t^{(1:L)})$ . In practice, we train these models in tandem by randomly 'dropping out' or 'masking' the conditioner during training to simulate the unconditional diffusion model. Each of these distributions is thus modeled to factorize independently along the sequence length dimension of $\mathbf{z}_s^{(1:L)}$ when conditioned on $\mathbf{z}_t^{(1:L)}$ , allowing us to efficiently sample from the tempered guidance distribution as follows: + +$$ +p _ {\theta} ^ {\gamma} \left(\mathbf {z} _ {s} ^ {(1: L)} \mid \mathbf {z} _ {t} ^ {(1: L)}, y\right) = \prod_ {\ell = 1} ^ {L} \frac {1}{Z ^ {(\ell)}} p _ {\theta} \left(\mathbf {z} _ {s} ^ {(\ell)} \mid y, \mathbf {z} _ {t} ^ {(1: L)}\right) ^ {\gamma} p _ {\theta} \left(\mathbf {z} _ {s} ^ {(\ell)} \mid \mathbf {z} _ {t} ^ {(1: L)}\right) ^ {(1 - \gamma)}, \tag {8} +$$ + +where $Z^{(\ell)} = \sum_{\mathbf{z}_s'}p_\theta (\mathbf{z}_s'|\mathbf{z}_t^{(1:L)},y)^\gamma p_\theta (\mathbf{z}_s'|\mathbf{z}_t^{(1:L)})^{(1 - \gamma)}$ is the per-token partition function. + +We refer to this method as D-CFG for Discrete Classifier-Free Guidance. + +# 3.2 CLASSIFIER-BASED GUIDANCE + +Guidance for a Single Token Exponentiating (5) lets us draw classifier-guided samples from the following tempered distribution: + +$$ +p ^ {\gamma} \left(\mathbf {z} _ {s} \mid \mathbf {z} _ {t}, y\right) = \frac {p \left(y \mid \mathbf {z} _ {s} , \mathbf {z} _ {t}\right) ^ {\gamma} p \left(\mathbf {z} _ {s} \mid \mathbf {z} _ {t}\right)}{\sum_ {\mathbf {z} _ {s} ^ {\prime}} p \left(y \mid \mathbf {z} _ {s} ^ {\prime} , \mathbf {z} _ {t}\right) ^ {\gamma} p \left(\mathbf {z} _ {s} ^ {\prime} \mid \mathbf {z} _ {t}\right)}, \tag {9} +$$ + +which we can tractably normalize, as we only sum over the $N$ possible values of a single token $\mathbf{z}_s$ . + +Extension to Sequences Unfortunately, extending (9) to sequences is not trivial, since the classifier $p(y \mid \mathbf{z}_s^{(1:L)}, \mathbf{z}_t^{(1:L)})$ does not necessarily factorize independently across the sequence, which would potentially force us to compute a normalization constant with $N^L$ terms, accounting for every possible value of $\mathbf{z}_s^{(1:L)}$ . To alleviate this issue, we require the assumption that conditioned on $\mathbf{z}_t^{(1:L)}$ , the tempered distribution $p^\gamma(\mathbf{z}_s^{(1:L)} \mid \mathbf{z}_t^{1:L}, y)$ factorizes independently across tokens. Therefore, we can focus on the tempered distribution of each token $\mathbf{z}_s^{(\ell)}$ , for $\ell \in 1, \ldots, L$ : + +$$ +p ^ {\gamma} \left(\mathbf {z} _ {s} ^ {(\ell)} \mid \mathbf {z} _ {t} ^ {(1: L)}, y\right) \propto p (y \mid \mathbf {z} _ {s} ^ {(\ell)}, \mathbf {z} _ {t} ^ {(1: L)}) ^ {\gamma} p \left(\mathbf {z} _ {s} ^ {(\ell)} \mid \mathbf {z} _ {t} ^ {(1: L)}\right). \tag {10} +$$ + +Discrete Classifier-Based Guidance We first introduce the following additional notation: given $\mathbf{z}^{(1:L)}$ , let $\tilde{\mathcal{Z}}_{\ell}(\mathbf{z}^{(1:L)})$ be the set of sequences $\tilde{\mathbf{z}}^{(1:L)}$ for which $\tilde{\mathbf{z}}^{(\ell')} = \mathbf{z}^{(\ell')}$ for all $\ell' \neq \ell$ , i.e., the set of sequences that are either the same as or only differ in position $\ell$ relative to $\mathbf{z}^{(1:L)}$ . We can sample from $p^{\gamma}(\mathbf{z}_s^{(\ell)} \mid \mathbf{z}_t^{(1:L)}, y)$ by training a classifier $p_\phi : \mathcal{V}^L \to \Delta^K$ on noised latents $\mathbf{z}_t^{(1:L)}$ for $t \in [0,1]$ and use this to model the first term on the right-hand side of (10) by only evaluating $p_\phi$ on sequences for which $\mathbf{z}_s^{(1:L)}$ and $\mathbf{z}_t^{(1:L)}$ differ by at most the token at position $\ell$ : + +$$ +p (y \mid \mathbf {z} _ {s} ^ {(\ell)}, \mathbf {z} _ {t} ^ {(1: L)}) \approx p _ {\phi} (y \mid \tilde {\mathbf {z}} ^ {(1: L)}), \quad \text {f o r} \tilde {\mathbf {z}} ^ {(1: L)} = \left[ \mathbf {z} _ {t} ^ {(1: \ell - 1)}, \mathbf {z} _ {s} ^ {(\ell)}, \mathbf {z} _ {t} ^ {(\ell + 1: L)} \right] \in \tilde {\mathcal {Z}} _ {\ell} (\mathbf {z} _ {t} ^ {(1: L)}). +$$ + +We additionally train an unconditional denoising network $p_{\theta}(\mathbf{z}_s^{(\ell)} \mid \mathbf{z}_t^{(1:L)})$ and then sample from the re-normalized distribution: + +$$ +p _ {\phi , \theta} ^ {\gamma} \left(\mathbf {z} _ {s} ^ {(1: L)} \mid \mathbf {z} _ {t} ^ {(1: L)}, y\right) = \prod_ {\ell = 1} ^ {L} \frac {p _ {\phi} (y \mid \tilde {\mathbf {z}} ^ {(1 : L)}) ^ {\gamma} p _ {\theta} \left(\mathbf {z} _ {s} ^ {(\ell)} \mid \mathbf {z} _ {t} ^ {(1: L)}\right)}{\sum_ {\tilde {\mathbf {z}} ^ {(1 : L)}} p _ {\phi} (y \mid \tilde {\mathbf {z}} ^ {(1: L)}) ^ {\gamma} p _ {\theta} \left(\mathbf {z} _ {s} ^ {(\ell)} \mid \mathbf {z} _ {t} ^ {(1: L)}\right)}. \tag {11} +$$ + +Restricting the summation in the denominators of (11) to $\tilde{\mathcal{Z}}_{\ell}(\mathbf{z}_{t}^{(1:L)})$ makes normalization tractable, as we are only summing over $N$ terms. + +We refer to our method as D-CBG for Discrete Classifier-Based Guidance. Our method can be thought of as an adaptation of the successful FUDGE (Yang & Klein, 2021) approach, which guides AR generation, to discrete diffusion, similar to how NOS (Gruver et al., 2024) extended the AR guidance mechanism of PPLM (Dathathri et al., 2019) to diffusion models. + +First Order Approximation While tractable, this formulation suffers from the drawback that at each denoising step we must perform $\mathcal{O}(L\cdot N)$ forward passes through the classifier model, which can quickly become impractical for larger vocabularies and longer sequences. Similarly to Grathwohl et al. (2021), Vignac et al. (2022), we can treat the classifier $p_{\phi}$ as a continuous function of the one-hot inputs $\tilde{\mathbf{z}}^{(1:L)}\in \mathbb{R}^{L\times N}$ and use the first order Taylor approximation of $\log p_{\phi}$ to efficiently compute $p_{\phi}(y\mid \tilde{\mathbf{z}}^{(1:L)})$ with only a single forward and backward pass through the classifier model: + +$$ +\begin{array}{l} p _ {\phi} (y \mid \tilde {\mathbf {z}} ^ {(1: L)}) = \exp \left(\log \frac {p _ {\phi} (y \mid \tilde {\mathbf {z}} ^ {(1 : L)})}{p _ {\phi} (y \mid \mathbf {z} _ {t} ^ {(1 : L)})} + \log p _ {\phi} (y \mid \mathbf {z} _ {t} ^ {(1: L)})\right) \\ \approx \exp \left(\left(\tilde {\mathbf {z}} ^ {(1: L)} - \mathbf {z} _ {t} ^ {(1: L)}\right) ^ {T} \nabla_ {\mathbf {z} _ {t} ^ {(1: L)}} \log p _ {\phi} (y \mid \mathbf {z} _ {t} ^ {(1: L)}) + \log p _ {\phi} (y \mid \mathbf {z} _ {t} ^ {(1: L)})\right). \tag {12} \\ \end{array} +$$ + +# 4 UNIFORM DIFFUSION LANGUAGE MODELS + +While masked diffusion models have demonstrated better language modeling compared to other discrete diffusion (Austin et al., 2021; Lou et al., 2023), we argue that they are less amenable to guidance, since once a token is unmasked at some time $t$ it remains so for all $s < t$ . In contrast, for uniform noising, intermediate latents can be refined multiple times during the denoising process. We therefore revisit categorical uniform noise discrete diffusion, where $\pi = u \coloneqq 1 / N$ . Our aim is that by analyzing this class of diffusion models more carefully, we can reduce the gap to absorbing-state and yield performant models that are more easily steered by the guidance tools we developed above. + +# 4.1 UNIFORM NOISE DIFFUSION + +Discrete Time Likelihood Bound We start with the variational lower bound that is defined by a general diffusion process. For discrete-time diffusion, i.e., some finite steps $T$ , we define $t(i) = (i + 1) / T$ and $s(i) = i / T$ for $i$ in $0, \dots, T$ . Denoting the Kullback-Leibler divergence as $D_{\mathrm{KL}}$ , the denoising network $p_{\theta}$ is trained to minimize a variational upper bound (NELBO), which is given by: + +$$ +\mathbb {E} _ {q} \left[ \underbrace {- \log p _ {\theta} (\mathbf {x} | \mathbf {z} _ {t (0)})} _ {\mathcal {L} _ {\text {r e c o n s}}} + \underbrace {\sum_ {i = 1} ^ {T} D _ {\mathrm {K L}} \left[ q \left(\mathbf {z} _ {s (i)} \mid \mathbf {z} _ {t (i)} , \mathbf {x}\right) \| p _ {\theta} \left(\mathbf {z} _ {s (i)} \mid \mathbf {z} _ {t (i)}\right) \right]} _ {\mathcal {L} _ {\text {d i f f u s i o n}}} \right] + \underbrace {D _ {\mathrm {K L}} \left[ q \left(\mathbf {z} _ {t (T)} \mid \mathbf {x}\right) \| p _ {\theta} \left(\mathbf {z} _ {t (T)}\right) \right]} _ {\mathcal {L} _ {\text {p r i o r}}}, \tag {13} +$$ + +When clear, we drop the explicit dependence of $t$ and $s$ on the discrete step $i$ . + +Uniform Noise Forward Process We focus on uniform noise diffusion using the interpolating discrete diffusion framework (Sahoo et al., 2024a; Zhao et al., 2024; Zheng et al., 2023). When letting $\pi = u$ , the input $x$ transitions to a random state with some probability at each time step. Crucially, after $x$ changes once, it can do so again. When $\pi = u$ , the posterior from (2) becomes + +$$ +q \left(\mathbf {z} _ {s} \mid \mathbf {z} _ {t}, \mathbf {x}\right) = \operatorname {C a t} \left(\mathbf {z} _ {s}; \frac {N \alpha_ {t} \mathbf {z} _ {t} \odot \mathbf {x} + \left(\alpha_ {t | s} - \alpha_ {t}\right) \mathbf {z} _ {t} + \left(\alpha_ {s} - \alpha_ {t}\right) \mathbf {x} + \frac {\left(\alpha_ {s} - \alpha_ {t}\right) (1 - \alpha_ {s})}{N \alpha_ {s}} \mathbf {1}}{N \alpha_ {t} \langle \mathbf {z} _ {t} , \mathbf {x} \rangle + 1 - \alpha_ {t}}\right) \tag {14} +$$ + +Denoising Process The optimal form for the reverse diffusion process $p_{\theta}$ matches (14): in fact setting $p_{\theta}$ to (14) reduces the KL terms in (13) to zero. However, setting $p_{\theta}$ to exactly (14) is not possible because it cannot be a function $\mathbf{x}$ (which $p_{\theta}$ is generating). Therefore, we introduce a predictive model $\mathbf{x}_{\theta}(\mathbf{z}_t,t):\mathcal{V}\times [0,1]\to \Delta^N$ of the 'clean' data given a noisy latent $\mathbf{z}_t$ at time $t$ . We use $\mathbf{x}_{\theta}$ to parameterize the denoising process as $p_{\theta}(\mathbf{z}_s\mid \mathbf{z}_t) = q(\mathbf{z}_s\mid \mathbf{z}_t,\mathbf{x} = \mathbf{x}_{\theta})$ , yielding: + +$$ +p _ {\theta} \left(\mathbf {z} _ {s} \mid \mathbf {z} _ {t}\right) = \operatorname {C a t} \left(\mathbf {z} _ {s}; \frac {N \alpha_ {t} \mathbf {z} _ {t} \odot \mathbf {x} _ {\theta} + \left(\alpha_ {t | s} - \alpha_ {t}\right) \mathbf {z} _ {t} + \left(\alpha_ {s} - \alpha_ {t}\right) \mathbf {x} _ {\theta} + \frac {\left(\alpha_ {s} - \alpha_ {t}\right) \left(1 - \alpha_ {s}\right)}{N \alpha_ {s}} \mathbf {1}}{N \alpha_ {t} \langle \mathbf {z} _ {t} , \mathbf {x} _ {\theta} \rangle + 1 - \alpha_ {t}}\right), \tag {15} +$$ + +Note that this minimizes the $\mathcal{L}_{\mathrm{diffusion}}$ term in (13) precisely when $\mathbf{x}_{\theta} = \mathbf{x}$ , as desired. To simplify notation, we omit below the explicit dependence of $\mathbf{x}_{\theta}$ on $t$ . + +# 4.2 IMPROVED LIKELIHOOD BOUNDS IN CONTINUOUS TIME + +We now present our contribution to uniform noise discrete diffusion modeling. We leverage the above formulation to develop an improved NELBO by taking $T \to \infty$ and analyzing each term $\mathcal{L}_{\mathrm{recons}}$ , $\mathcal{L}_{\mathrm{diffusion}}$ , $\mathcal{L}_{\mathrm{prior}}$ in (13). This yields three improvements: (1) a simple and elegant closed-form expression for the NELBO that is easier to reason about; (2) an analytical reduction of $\mathcal{L}_{\mathrm{recons}}$ , $\mathcal{L}_{\mathrm{prior}}$ to zero, which tightens the NELBO; (3) a further tightening via the continuous-time extension of $\mathcal{L}_{\mathrm{diffusion}}$ , as in Kingma et al. (2021) and Sahoo et al. (2024a;b). + +Prior Loss $(\mathcal{L}_{\mathrm{prior}})$ Given that we define our corruption process as an interpolation between clean data and a limiting distribution, for any noise schedules where $\alpha_{t(T)} = 0$ , the distribution $q(\mathbf{z}_{t(T)}) = \pi$ . Therefore, we can simply define $p_{\theta}(\mathbf{z}_{t(T)}) = \pi$ , and the KL divergence in $\mathcal{L}_{\mathrm{prior}}$ evaluates to zero. + +Reconstruction Loss $(\mathcal{L}_{\mathrm{recons}})$ For $\mathcal{L}_{\mathrm{recons}}$ , if our noise schedule is such that $T \to \infty \implies \alpha_{t(0)} = 1$ (i.e., $t(0) = 1 / T$ ), then the marginal $q(\mathbf{z}_{\frac{1}{T}} \mid \mathbf{x}) \to \operatorname{Cat}(\mathbf{z}_{\frac{1}{T}}; \mathbf{x})$ . That is, in the limit, the first latent vector is identically equal to the clean data. We can thus parameterize our denoising network such that at time $t(0)$ the function simply copies its inputs: $\mathbf{x}_{\theta}(\mathbf{z}_{\frac{1}{T}}, 1 / T) = \mathbf{z}_{\frac{1}{T}}$ . Additionally, we note that our choice of parameterization for $p_{\theta}$ implies that $p_{\theta}(\mathbf{x} \mid \mathbf{z}_{\frac{1}{T}}) = \mathbf{x}_{\theta}(\mathbf{z}_{\frac{1}{T}}, 1 / T)$ . Thus in the continuous time limit, we have: + +$$ +\lim _ {T \to \infty} \mathbb {E} _ {q} [ \mathcal {L} _ {\mathrm {r e c o n s}} ] = \lim _ {T \to \infty} \mathbb {E} _ {q} [ \log p _ {\theta} (\mathbf {x} | \mathbf {z} _ {\frac {1}{T}}) ] = \lim _ {T \to \infty} \mathbb {E} _ {q} [ \log (\langle \mathbf {x}, \mathbf {x} _ {\theta} (\mathbf {z} _ {\frac {1}{T}}, 1 / T) \rangle) ] = 0. +$$ + +Diffusion Loss $(\mathcal{L}_{\mathrm{diffusion}})$ Turning finally to the diffusion loss term $\mathcal{L}_{\mathrm{diffusion}}$ , we first define the shorthand $D_{\mathrm{KL}}[q_t||p_\theta] = D_{\mathrm{KL}}[[q(\mathbf{z}_s|\mathbf{z}_t,\mathbf{x})||p_\theta(\mathbf{z}_s|\mathbf{z}_t)]]$ and then re-write this loss term as an expectation over $t$ uniformly sampled from $1 / T, 2 / T, \ldots, T$ : + +$$ +\mathcal {L} _ {\text {d i f f u s i o n}} = \sum_ {i = 1} ^ {T} D _ {\mathrm {K L}} \left[ q _ {i / T} \| p _ {\theta} \right] = T \cdot \mathbb {E} _ {t \sim \{1 / T, 2 / T, \dots , T \}} D _ {\mathrm {K L}} \left[ q _ {t} \| p _ {\theta} \right]. \tag {16} +$$ + +Plugging in our expressions for the true and predicted posteriors from (14) and (15) into (16), then taking $T \to \infty$ , we get (see Appendix A for details): + +$$ +\begin{array}{l} \lim _ {T \rightarrow \infty} \mathcal {L} _ {\text {d i f f u s i o n}} = \lim _ {T \rightarrow \infty} \mathbb {E} _ {t \sim \{1 / T, 2 / T, \dots , T \}} T \cdot D _ {\mathrm {K L}} [ q _ {t} \| p _ {\theta} ] = \int_ {t = 0} ^ {t = 1} \lim _ {T \rightarrow \infty} T \cdot D _ {\mathrm {K L}} [ q _ {t} \| p _ {\theta} ] \mathrm {d} t \\ = \int_ {t = 0} ^ {t = 1} \left[ \frac {\alpha_ {t} ^ {\prime}}{N \alpha_ {t}} \left[ \frac {N}{\bar {\mathbf {x}} _ {i}} - \frac {N}{(\bar {\mathbf {x}} _ {\theta}) _ {i}} - \sum_ {j \text {s . t .} (\mathbf {z} _ {t}) _ {j} = 0} \left(\frac {\bar {\mathbf {x}} _ {j}}{\bar {\mathbf {x}} _ {i}}\right) \log \left[ \left(\frac {(\bar {\mathbf {x}} _ {\theta}) _ {i} \cdot \bar {\mathbf {x}} _ {j}}{(\bar {\mathbf {x}} _ {\theta}) _ {j} \cdot \bar {\mathbf {x}} _ {i}}\right) \right] \right] \right] d t, \tag {17} \\ \end{array} +$$ + +where $\mathbf{x}_j$ denotes the $j^{\mathrm{th}}$ index of a vector $\mathbf{x}$ , $\bar{\mathbf{x}} = N\alpha_t\mathbf{x} + (1 - \alpha_t)\mathbf{1}$ , $\bar{\mathbf{x}}_\theta = N\alpha_t\mathbf{x}_\theta + (1 - \alpha_t)\mathbf{1}$ and we define $i = \arg \max_{j\in [N]}(\mathbf{z}_t)_j$ to be the non-zero entry of $\mathbf{z}_t$ . + +Combining our arguments regarding $\mathcal{L}_{\mathrm{prior}}$ and $\mathcal{L}_{\mathrm{recons}}$ with (17), yields our final tight bound: + +$$ +\mathcal {L} ^ {\infty} = \int_ {t = 0} ^ {t = 1} \mathbb {E} _ {q} \left[ \frac {\alpha_ {t} ^ {\prime}}{N \alpha_ {t}} \left[ \frac {N}{\bar {\mathbf {x}} _ {i}} - \frac {N}{(\bar {\mathbf {x}} _ {\theta}) _ {i}} - \sum_ {j \text {s . t .} (\mathbf {z} _ {t}) _ {j} = 0} \left(\frac {\bar {\mathbf {x}} _ {j}}{\bar {\mathbf {x}} _ {i}}\right) \log \left[ \left(\frac {(\bar {\mathbf {x}} _ {\theta}) _ {i} \cdot \bar {\mathbf {x}} _ {j}}{(\bar {\mathbf {x}} _ {\theta}) _ {j} \cdot \bar {\mathbf {x}} _ {i}}\right) \right] \right] \right] d t. \tag {18} +$$ + +Extension to Sequences Extending training with (18) from $\mathbf{x} \in \mathcal{V}$ to sequences $\mathbf{x}^{(1:L)} \in \mathcal{V}^L$ , we make the assumption that the denoising process factorizes independently across tokens when conditioned on a sequence of noisy latents $\mathbf{z}_t^{(1:L)}$ . In this case, we use a single model $\mathbf{x}_{\theta}^{(\ell)}(\mathbf{z}_t^{(1:L)}, t)$ for predicting each token $\ell \in \{1, \dots, L\}$ in a sequence, and we train with the sequence-level objective: + +$$ +\mathcal {L} ^ {\infty} = \int_ {t = 0} ^ {t = 1} \mathbb {E} _ {q} \sum_ {\ell} \left[ \frac {\alpha_ {t} ^ {\prime}}{N \alpha_ {t}} \left[ \frac {N}{\bar {\mathbf {x}} _ {i} ^ {(\ell)}} - \frac {N}{\left(\bar {\mathbf {x}} _ {\theta} ^ {(\ell)}\right) _ {i}} - \sum_ {j \text {s . t .} \left(\mathbf {z} _ {t} ^ {(\ell)}\right) _ {j} = 0} \left(\frac {\bar {\mathbf {x}} _ {j} ^ {(\ell)}}{\bar {\mathbf {x}} _ {i} ^ {(\ell)}}\right) \log \left[ \left(\frac {\left(\bar {\mathbf {x}} _ {\theta} ^ {(\ell)}\right) _ {i} \cdot \bar {\mathbf {x}} _ {j} ^ {(\ell)}}{\left(\bar {\mathbf {x}} _ {\theta} ^ {(\ell)}\right) _ {j} \cdot \bar {\mathbf {x}} _ {i} ^ {(\ell)}}\right) \right] \right] \right] d t. \tag {19} +$$ + +We dub models trained with our refined objective Uniform Diffusion Language Models (UDLM). + +# 5 EXPERIMENTS + +Datasets For our language modeling experiments, we examine several discrete domains: reference genomes from tens species (Species10), the QM9 small molecule dataset (Ruddigkeit et al., 2012; Ramakrishnan et al., 2014), where molecules are represented by SMILES strings (Weininger, 1988), CIFAR10 discretized images (Krizhevsky et al., 2009), and three NLP datasets consisting of text8 (Mahoney, 2011), Amazon Review (McAuley & Leskovec, 2013; Zhang et al., 2015), and the one billion words dataset (LM1B; Chelba et al. (2014)). These datasets cover a range of domains and vocabularies of varying sizes (see Table 1). For guidance experiments, we explore species-specific sequence generation, molecular property maximization, and class-conditional image generation. + +# 5.1 LANGUAGE MODELING WITH UNIFORM NOISE DISCRETE DIFFUSION + +Our language modeling experiments show that (1) contrary to a widely-held belief, uniform noise diffusion can attain state-of-the-art performance on small vocabulary datasets (Table 1), and that (2) our UDLM are state-of-the-art among uniform noise diffusion (Tables 2 and 3). + +In Table 1, despite previous evidence indicating that absorbing-state discrete diffusion greatly outperforms uniform noise, we find a more nuanced story. Namely, for smaller vocabulary regimes, the gap between MDLM and UDLM is negligible, with UDLM even outperforming absorbing-state on certain datasets. Even within a single domain, we find a trend between vocabulary size and performance gap, with the text8 results of UDLM on par with MDLM, and a more persistent gap for larger vocabularies. Intuitively, for larger vocabulary regimes, uniform noise diffusion models need to predict over a combinatorially larger set of potential clean data + +Table 1: UDLM performs best with smaller vocabs. Perplexity $(\downarrow)$ on various datasets. Best values are bolded. * indicates values reported from early stopping on the validation set; otherwise validation performance at the end of training is used. †From Sahoo et al. (2024a). $From Lou et al. (2023). + +
|Vocab.|ARMDLMUDLM
Species10122.883.17≤3.15≤
QM9*402.192.12≤2.02≤
CIFAR10256-9.14≤11.21≤
text8352.35$2.62≤2.71≤
Amazon*30,52221.6724.93≤27.27≤
LM1B30,52222.32†27.04‡31.28≤
+ +sequences compared to absorbing-state; smaller vocabularies reduce this complexity. + +![](images/df74e6bb585a45b42454f6f5dbcd022a6dc8370b3c763eb9c3c6f93c0ebfaff7.jpg) +Figure 2: $T\to \infty$ improves validation PPL $(\downarrow)$ on Amazon dataset. + +Secondly, despite the persisting gap between absorbing and uniform noise discrete diffusion for larger vocabulary NLP datasets, we note that models trained with UDLM close this gap, as evidenced in Tables 2 and 3, where we show that UDLM attains the best reported uniform noise discrete diffusion language modeling performance. + +Ablating Continuous Time Formulation In Figure 2, we see the effect of increasing $T$ and using our continuous time NELBO. The curves represent validation perplexity on the Amazon Polarity dataset at various training steps, and we observe that increasing $T$ indeed improves language modeling with UDLM, i.e., $T = \infty$ , performing best. + +# 5.2 GUIDED DISCRETE DIFFUSION + +Our guidance results indicate that (1) classifier-free guidance is more useful when paired with diffusion models compared to AR (Table 4) and that (2) our proposed D-CBG is the best classifier-based method for discrete guidance, especially when combined with UDLM (Table 5 & Figure 3). + +Baselines For guidance experiments, our primary baseline is the dominant AR approach. We compare to three flavors of guided AR. The first is applying D-CFG to AR models. We also use the established control mechanisms of Plug-and-play language models (PPLM; Dathathri et al. (2019)) and FUDGE (Yang & Klein, 2021). To demonstrate the better performance of our D-CBG method, we compare to Gruver et al. (2024) (NOS), an extension of PPLM to discrete diffusion. + +Table 2: UDLM outperforms other uniform discrete diffusion on text8. Best value is bolded & best uniform diffusion value is underlined. ${}^{ \dagger }$ From Lou et al. (2023). *From Shi et al. (2024). + +
MethodBPC (↓)
Autoregressive
IAF/SCF† (Ziegler & Rush, 2019)1.88
Argmax Flow† (Hoogeboom et al., 2021)1.39
Discrete Flow† (Tran et al., 2019)1.23
Autoregressive†1.23
Non-autoregressive
Mult. Diffusion† (Hoogeboom et al., 2021)1.72≤
MAC† (Shih et al., 2022)1.40≤
BFN† (Graves et al., 2023)1.41≤
D3PM Absorb† (Austin et al., 2021)1.45≤
SEDD Absorb† (Lou et al., 2023)1.39≤
MDLM (Sahoo et al., 2024a) (Retrained)1.38≤
MD4* (Shi et al., 2024)1.37≤
GenMD4* (Shi et al., 2024)1.34≤
Discrete Uniform Diffusion
D3PM Uniform† (Austin et al., 2021)1.61≤
SEDD Uniform† (Lou et al., 2023)1.47≤
UDLM (Ours)1.44≤
+ +Table 3: UDLM outperforms other uniform discrete diffusion on LM1B. Best value is bold & best discrete uniform diffusion value is underlined. $^\dagger$ From Sahoo et al. (2024a). $^\ast$ From Lou et al. (2023). $\$$ From Austin et al. (2021). + +
MethodPPL (↓)
Autoregressive†
Transformer-X (Dai et al., 2019)23.5
OmniNet (Tay et al., 2021)21.5
Transformer22.32
Diffusion†
BERT-Mouth (Wang & Cho, 2019)142.89≤
D3PM Absorb (Austin et al., 2021)77.50≤
Diffusion-LM (Li et al., 2022)118.62≤
DiffusionBert (Wang & Cho, 2019)63.78≤
SEDD Absorb (Lou et al., 2023)32.79≤
MDLM (Sahoo et al., 2024a)27.04≤
Discrete Uniform Diffusion
D3PM Uniform$ (Austin et al., 2021)137.9≤
SEDD Uniform* (Lou et al., 2023)40.25≤
UDLM (Ours)31.28≤
+ +Hyperparameters For both D-CFG and D-CBG, we vary the strength of the $\gamma$ parameter. Although the original FUDGE formulation simply uses $\gamma = 1$ , we also perform a search for this baseline. For PPLM and NOS, we vary the parameters of the Langevin sampling that updates models' hidden representation, i.e., number of update steps $n$ , step size $\eta$ , and fluency KL weight $\gamma_{kl}$ (see Dathathri et al. (2019) and Gruver et al. (2024) for more details). For all methods, we display the best performing hyperparameter configuration in the main table results, and defer the full sweep to Appendix E. + +Species-specific Genome Generation For genomic sequences, we evaluate D-CFG with diffusion compared to with AR. We train on sequences of 32,768 nucleotides, using base-pair level tokenization and conditionally generate 64 sequences for each class. We train a small classifier to distinguish between generated and validation set sequences and report the area under the receiver operator curve for this classifier (Disc. AUROC). Values closer to 0.5 indicate that the classifier is unable to distinguish between synthetic and true sequences (Sarkar et al., 2024). To measure the controllability, we train a separate classifier on the Species10 dataset and measure macro F1 score of this 'oracle' classifier on the generated sequences. Results of this experiment are presented in Table 4. For reference, we also provide metrics + +Table 4: Diffusion decoding with D-CFG is more controllable than AR for genomic sequences. Mean $\pm$ standard deviation reported from five random seeds. Best values are bolded. + +
ModelD-CFG γDisc. AUROC (↓)F1 (↑)
Random-1.000.07
AR10.53±0.0750.87±0.011
AR20.90±0.0510.81±0.009
AR30.97±0.0180.74±0.022
MDLM10.51±0.0590.88±0.011
MDLM20.74±0.0370.91±0.009
MDLM30.93±0.0310.78±0.007
UDLM10.52±0.0440.91±0.01
UDLM20.61±0.0430.93±0.009
UDLM30.87±0.0510.94±0.007
+ +for randomly generating sequences with nucleotide frequencies proportional to species representation in the data. We find that both MDLM and UDLM are able to better generate sequences that match the desired control parameter, with higher F1 scores relative to AR. Moreover, UDLM is able to outperform MDLM in satisfying this control. Importantly, we find that only UDLM is amenable to increasing the guidance parameter $\gamma$ , where its metrics improves while AR and MDLM metrics degrade. Finally, of note, the diffusion model generation for this experiment is accomplished with far fewer function evaluations compared to AR. Whereas AR must decode each of the 32,768 tokens, because MDLM and UDLM can decode multiple tokens in parallel, we generate with $T = 512$ . + +Table 5: Guidance with discrete diffusion models better balances the generation of valid and novel molecules with maximizing the property of interest, drug likeness (QED) / ring count, compared to AR. Validity, novelty, and mean QED / ring count for novel sequences are measured for generated sequences from each method. Mean ± standard deviation reported from five random seeds. Best values are bolded. + +
MethodGuidanceValid (↑)QED Novel (↑)Mean (↑)Valid (↑)Ring Count Novel (↑)Mean (↑)
Original Data-133k133k0.47133k133k1.74
Classifier-free
ARD-CFG946.4±9.079.4±6.40.60±0.00441.4±11.177.8±2.34.83±0.08
MDLMD-CFG317.4±11.595.8±9.00.60±0.0190.0±8.260.0±7.55.26±0.15
UDLMD-CFG1013.6±2.564.0±5.10.62±0.00998.2±4.5216.2±13.04.88±0.04
Classifier-based
ARFUDGE924.4±12.153.0±3.50.61±0.00281.2±5.0103.6±4.84.89±0.10
ARPPLM1007.2±2.3142.0±14.20.45±0.001009.8±1.9140.6±16.51.92±0.09
MDLMD-CBG417.6±19.7116.6±8.90.58±0.00113.0±8.885.6±8.84.75±0.23
MDLMNOS506.0±29.5240.4±16.00.45±0.01247.8±14.0193.6±13.13.51±0.22
UDLMD-CBG994.8±2.963.8±8.10.61±0.00897.2±11.6432.0±19.14.84±0.02
UDLMNOS547.8±10.6158.8±11.00.47±0.00573.8±13.0244.4±13.13.96±0.07
+ +![](images/e81dc5826fb735f020623424a788e9a452c05c26f1d91ceaf4dc365c137849a6.jpg) +Figure 3: Diffusion models extend the steer-ability Pareto frontier. (Left) D-CBG outperforms FUDGE classifier guidance when maximizing drug-likeness (QED). (Right) D-CFG with diffusion better trades-off novel generation and ring-count maximization compared to AR. + +![](images/e2173abb699063ac3e3342762d94f45f428d3df03b7e4e8d896e13353955c0ef.jpg) + +Table 6: Guidance improves FID & IS on CIFAR10. Finite- (D3PM) vs. continuous-time (MDLM / UDLM). Best values are bolded. †From Austin et al. (2021). + +
FID (↓)IS (↑)
D3PM Absorb†41.286.26
MDLM33.756.74
MDLM D-CFG15.569.02
D3PM Uniform†51.275.99
UDLM33.656.86
UDLM D-CFG23.218.66
+ +Molecular Property Maximization For QM9, we investigate novel generation of sequences that maximize either drug-likeness (QED; Bickerton et al. (2012)) or number of rings present in the molecule. We only report values for which we generated at least 50 novel sequences (out of 1,024). In Table 5, for D-CFG, we see that all methods perform comparably when maximizing drug likeness, but that MDLM and UDLM are better suited for the structural property of ring count. For classifier-based guidance mechanisms, we again find that both QED and ring count, D-CBG with discrete diffusion best trades-off maximizing these properties while generating valid and novel sequences compared to AR or diffusion with NOS. + +Class-conditional Image Generation In Table 6, we see that both MDLM and UDLM outperform finite-time counterparts (in the form of D3PM (Austin et al., 2021)) with improved image quality + +metrics of Fréchet inception distance (FID; Heusel et al. (2017)) and Inception Score (IS; Salimans et al. (2016)). This is especially true when we add guidance using D-CFG. MDLM / UDLM samples are generated with $T = 1000$ . + +Ablation: Faster Sampling In Table 7, we explore using faster inference settings (smaller $T$ ) where diffusion models predict multiple pixels in parallel. These results focus on the CIFAR10 dataset; see Appendix E.3 for additional experiments on other datasets. MDLM's performance deteriorates with smaller $T$ , whereas UDLM is robust to this setting. This validates a key motivation behind UDLM: in settings where MDLM 'locks in' certain predictions that it cannot change, UDLM is more resilient given that all tokens can change throughout the decoding process. + +# 6 RELATED WORKS, DISCUSSION, AND CONCLUSION + +Discrete Diffusion Recent works have examined interpolating discrete diffusion (Ou et al., 2024; Sahoo et al., 2024a; Shi et al., 2024; Zhao et al., 2024; Zheng et al., 2023), a special case of the general framework from D3PM (Austin et al., 2021). Our UDLM method most closely aligns to the state-of-the-art discrete diffusion of Ou et al. (2024), Sahoo et al. (2024a), and Shi et al. (2024) that focus on absorbing state diffusion. Similar to these works, we provide a continuous time NELBO leading to performance gains, but we focus on uniform noise. Of note, other extensions of D3PM that do not start from the variational perspective, instead rely on the formalisms of continuous time Markov chains (CTMC) (Campbell et al., 2022) and concrete score matching (Lou et al., 2023), but + +Table 7: UDLM is robust to faster sampling. CIFAR10 images sampled from a conditional model $(\mathrm{D - CFG}_{\gamma = 1})$ . Best values per $T$ are bolded. + +
ModelFID (↓)IS (↑)
T=128
MDLM64.095.81
UDLM30.487.30
T=1024
MDLM27.947.14
UDLM26.707.43
+ +are less performant than works such as MDLM and our method. Also stemming from CTMC are extensions of flow-based (Lipman et al., 2022) approaches to discrete data (Campbell et al., 2024; Gat et al., 2024). In Appendix C, we discuss connections of our work to CTMC in more detail. + +Guidance Leveraging continuous embeddings of discrete data, Diffusion-LM (Li et al., 2022) uses Langevin sampling with CBG. Similarly, SSD-LM (Han et al., 2022) perform Gaussian noising on the logits of a bi-directional model, which they combine with pre-trained classifiers to perform CBG with Langevin dynamics. LD4LG (Lovelace et al., 2024) implement CFG on continuous embeddings. Stark et al. (2024) use flow-matching on the simplex to perform CFG and CBG on continuous representations. Wang et al. (2023) perform guidance using auxiliary semantic latent variables. In contrast, to these continuous formulations for discrete data, our work adapts guidance mechanisms directly to the discrete domain. + +FUDGE (Yang & Klein, 2021) can be viewed as the AR analog to our D-CBG. DiGress (Vignac et al., 2022) uses a similar first-order approximation to resolve the intractability of the normalizing constant. In our work, we derive a tractable expression for classifier-based guidance and simply use the Taylor approximation to speed up computation in large sequence length and vocabulary size regimes. Sanchez et al. (2023) derives an equivalent formulation for D-CFG and use it to better enforce AR models' adherence to prefix prompts. FreeGress (Ninniri et al., 2024) also offer a comparable method to D-CFG, but focus on graph diffusion models. Most similar to our method, is the concurrent work of Nisonoff et al. (2024), which derives classifier-based and classifier-free guidance for discrete diffusion and flow models. However, this work is highly tailored to models that leverage the formalism of CTMC, and guidance is applied to the rate matrices. See Appendix B for details on relating our guidance methods to Nisonoff et al. (2024). + +Conclusion In search of a more controllable diffusion process, in this work, we derived a tight variational bound for uniform noise discrete diffusion, closing the gap to state-of-the-art absorbing-state diffusion models. We also highlighted that contrary to previous findings, in small vocabulary regimes, uniform noise is on par or better than absorbing state. We then demonstrated that straightforward adaptations of classifier-based and classifier-free guidance can offer improved guided generation relative to AR models. We found that with classifier-free mechanisms, diffusion models are more amenable to control without sacrificing quality of generated sequences. We also demonstrated that our classifier-based method is better than previous ones for both AR and diffusion models. + +# ACKNOWLEDGMENTS AND DISCLOSURE OF FUNDING + +We thank Nate Gruver for useful discussions regarding NOS. This work was supported by NSF CAREER grants (#2145577 and #2037519) and an NIH MIRA grant (#1R35GM151243-01). + +# REFERENCES + +Jacob Austin, Daniel D Johnson, Jonathan Ho, Daniel Tarlow, and Rianne Van Den Berg. Structured denoising diffusion models in discrete state-spaces. Advances in Neural Information Processing Systems, 34:17981-17993, 2021. +G Richard Bickerton, Gaia V Paolini, Jérémy Besnard, Sorel Muresan, and Andrew L Hopkins. Quantifying the chemical beauty of drugs. Nature chemistry, 4(2):90-98, 2012. +Andrew Campbell, Joe Benton, Valentin De Bortoli, Thomas Rainforth, George Deligiannidis, and Arnaud Doucet. A continuous time framework for discrete denoising models. Advances in Neural Information Processing Systems, 35:28266-28279, 2022. +Andrew Campbell, Jason Yim, Regina Barzilay, Tom Rainforth, and Tommi Jaakkola. Generative flows on discrete state-spaces: Enabling multimodal flows with applications to protein co-design. arXiv preprint arXiv:2402.04997, 2024. +Ciprian Chelba, Tomas Mikolov, Mike Schuster, Qi Ge, Thorsten Brants, Phillip Koehn, and Tony Robinson. One billion word benchmark for measuring progress in statistical language modeling, 2014. +Zihang Dai, Zhilin Yang, Yiming Yang, Jaime Carbonell, Quoc V Le, and Ruslan Salakhutdinov. Transformer-xl: Attentive language models beyond a fixed-length context. arXiv preprint arXiv:1901.02860, 2019. +Sumanth Dathathri, Andrea Madotto, Janice Lan, Jane Hung, Eric Frank, Piero Molino, Jason Yosinski, and Rosanne Liu. Plug and play language models: A simple approach to controlled text generation. arXiv preprint arXiv:1912.02164, 2019. +Prafulla Dhariwal and Alexander Nichol. Diffusion models beat gans on image synthesis. Advances in neural information processing systems, 34:8780-8794, 2021a. +Prafulla Dhariwal and Alexander Nichol. Diffusion models beat gans on image synthesis. Advances in neural information processing systems, 34:8780-8794, 2021b. +Ruiqi Gao, Aleksander Holynski, Philipp Henzler, Arthur Brussee, Ricardo Martin-Brualla, Pratul Srinivasan, Jonathan T. Barron, and Ben Poole. Cat3d: Create anything in 3d with multi-view diffusion models, 2024. URL https://arxiv.org/abs/2405.10314. +Itai Gat, Tal Remez, Neta Shaul, Felix Kreuk, Ricky TQ Chen, Gabriel Synnaeve, Yossi Adi, and Yaron Lipman. Discrete flow matching. arXiv preprint arXiv:2407.15595, 2024. +Aaron Gokaslan, Feder Cooper, Jasmine Collins, Landan Seguin, Austin Jacobson, Mihir Patel, Jonathan Frankle, Cory Stephenson, and Volodymyr Kuleshov. Commoncanvas: Open diffusion models trained on creative-commons images. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 8250-8260, 2024. +Will Grathwohl, Kevin Swersky, Milad Hashemi, David Duvenaud, and Chris Maddison. Oops i took a gradient: Scalable sampling for discrete distributions. In International Conference on Machine Learning, pp. 3831-3841. PMLR, 2021. +Alex Graves, Rupesh Kumar Srivastava, Timothy Atkinson, and Faustino Gomez. Bayesian flow networks. arXiv preprint arXiv:2308.07037, 2023. +Nate Gruver, Samuel Stanton, Nathan Frey, Tim GJ Rudner, Isidro Hotzel, Julien LaFrance-Vanasse, Arvind Rajpal, Kyunghyun Cho, and Andrew G Wilson. Protein design with guided discrete diffusion. Advances in neural information processing systems, 36, 2024. + +Albert Gu and Tri Dao. Mamba: Linear-time sequence modeling with selective state spaces. arXiv preprint arXiv:2312.00752, 2023. +Xiaochuang Han, Sachin Kumar, and Yulia Tsvetkov. Ssd-lm: Semi-autoregressive simplex-based diffusion language model for text generation and modular control. arXiv preprint arXiv:2210.17432, 2022. +Martin Heusel, Hubert Ramsauer, Thomas Unterthiner, Bernhard Nessler, and Sepp Hochreiter. Gans trained by a two time-scale update rule converge to a local nash equilibrium. Advances in neural information processing systems, 30, 2017. +Jonathan Ho and Tim Salimans. Classifier-free diffusion guidance. arXiv preprint arXiv:2207.12598, 2022. +Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. Advances in neural information processing systems, 33:6840-6851, 2020. +Emiel Hoogeboom, Didrik Nielsen, Priyank Jaini, Patrick Forre, and Max Welling. Argmax flows and multinomial diffusion: Learning categorical distributions. Advances in Neural Information Processing Systems, 34:12454-12465, 2021. +Frank P Kelly. Reversibility and stochastic networks. Cambridge University Press, 2011. +Diederik Kingma, Tim Salimans, Ben Poole, and Jonathan Ho. Variational diffusion models. Advances in neural information processing systems, 34:21696-21707, 2021. +Alex Krizhevsky, Geoffrey Hinton, et al. Learning multiple layers of features from tiny images, 2009. +Greg Landrum et al. Rdkit: A software suite for cheminformatics, computational chemistry, and predictive modeling. *Greg Landrum*, 8(31.10):5281, 2013. +Xiang Li, John Thickstun, Ishaan Gulrajani, Percy S Liang, and Tatsunori B Hashimoto. DiffusionIm improves controllable text generation. Advances in Neural Information Processing Systems, 35:4328-4343, 2022. +Yaron Lipman, Ricky TQ Chen, Heli Ben-Hamu, Maximilian Nickel, and Matt Le. Flow matching for generative modeling. arXiv preprint arXiv:2210.02747, 2022. +Aaron Lou, Chenlin Meng, and Stefano Ermon. Discrete diffusion language modeling by estimating the ratios of the data distribution. arXiv preprint arXiv:2310.16834, 2023. +Justin Lovelace, Varsha Kishore, Chao Wan, Eliot Shekhtman, and Kilian Q Weinberger. Latent diffusion for language generation. Advances in Neural Information Processing Systems, 36, 2024. +Matt Mahoney. Text8 dataset, 2011. URL http://mattmahoney.net/dc/textdata. +Julian McAuley and Jure Leskovec. Hidden factors and hidden topics: understanding rating dimensions with review text. In Proceedings of the 7th ACM conference on Recommender systems, pp. 165-172, 2013. +Chenlin Meng, Kristy Choi, Jiaming Song, and Stefano Ermon. Concrete score matching: Generalized score matching for discrete data. Advances in Neural Information Processing Systems, 35: 34532-34545, 2022. +Alex Nichol, Prafulla Dhariwal, Aditya Ramesh, Pranav Shyam, Pamela Mishkin, Bob McGrew, Ilya Sutskever, and Mark Chen. Glide: Towards photorealistic image generation and editing with text-guided diffusion models. arXiv preprint arXiv:2112.10741, 2021. +Matteo Ninniri, Marco Podda, and Davide Bacciu. Classifier-free graph diffusion for molecular property targeting. In Joint European Conference on Machine Learning and Knowledge Discovery in Databases, pp. 318-335. Springer, 2024. +Hunter Nisonoff, Junhao Xiong, Stephan Allenspach, and Jennifer Listgarten. Unlocking guidance for discrete state-space diffusion and flow models. arXiv preprint arXiv:2406.01572, 2024. + +Nuala A O'Leary, Mathew W Wright, J Rodney Brister, Stacy Ciufo, Diana Haddad, Rich McVeigh, Bhanu Rajput, Barbara Robbertse, Brian Smith-White, Danso Ako-Adjei, Alexander Astashyn, Azat Badretdin, Yiming Bao, Olga Blinkova, Vyacheslav Brover, Vyacheslav Chetvernin, Jinna Choi, Eric Cox, Olga Ermolaeva, Catherine M Farrell, Tamara Goldfarb, Tripti Gupta, Daniel Haft, Eneida Hatcher, Wratko Hlavina, Vinita S Joardar, Vamsi K Kodali, Wenjun Li, Donna Maglott, Patrick Masterson, Kelly M McGarvey, Michael R Murphy, Kathleen O'Neill, Shashikant Pajar, Sanjida H Rangwala, Daniel Rausch, Lillian D Riddick, Conrad Schoch, Andrei Shkeda, Susan S Storz, Hanzhen Sun, Francoise Thibaud-Nissen, Igor Tolstoy, Raymond E Tully, Anjana R Vatsan, Craig Wallin, David Webb, Wendy Wu, Melissa J Landrum, Avi Kimchi, Tatiana Tatusova, Michael DiCuccio, Paul Kitts Terence D Murphy and Kim D Pruitt. Reference sequence (RefSeq) database at NCBI: current status, taxonomic expansion, and functional annotation. Nucleic Acids Res., 44(D1):D733-45, January 2016. +Jingyang Ou, Shen Nie, Kaiwen Xue, Fengqi Zhu, Jiacheng Sun, Zhenguo Li, and Chongxuan Li. Your absorbing discrete diffusion secretly models the conditional distributions of clean data. arXiv preprint arXiv:2406.03736, 2024. +William Peebles and Saining Xie. Scalable diffusion models with transformers. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 4195-4205, 2023. +Ben Poole, Ajay Jain, Jonathan T Barron, and Ben Mildenhall. Dreamfusion: Text-to-3d using 2d diffusion. arXiv preprint arXiv:2209.14988, 2022. +Alec Radford, Jeff Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. Language models are unsupervised multitask learners, 2019. +Raghunathan Ramakrishnan, Pavlo O Dral, Matthias Rupp, and O Anatole Von Lilienfeld. Quantum chemistry structures and properties of 134 kilo molecules. Scientific data, 1(1):1-7, 2014. +Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In Medical image computing and computer-assisted intervention—MICCAI 2015: 18th international conference, Munich, Germany, October 5-9, 2015, proceedings, part III 18, pp. 234-241. Springer, 2015. +Lars Ruddigkeit, Ruud Van Deursen, Lorenz C Blum, and Jean-Louis Reymond. Enumeration of 166 billion organic small molecules in the chemical universe database gdb-17. Journal of chemical information and modeling, 52(11):2864-2875, 2012. +Chitwan Sahara, William Chan, Saurabh Saxena, Lala Li, Jay Whang, Emily L Denton, Kamyar Ghasemipour, Raphael Gontijo Lopes, Burcu Karagol Ayan, Tim Salimans, et al. Photorealistic text-to-image diffusion models with deep language understanding. Advances in neural information processing systems, 35:36479-36494, 2022. +Subham Sekhar Sahoo, Marianne Arriola, Yair Schiff, Aaron Gokaslan, Edgar Marroquin, Justin T Chiu, Alexander Rush, and Volodymyr Kuleshov. Simple and effective masked diffusion language models. arXiv preprint arXiv:2406.07524, 2024a. +Subham Sekhar Sahoo, Aaron Gokaslan, Chris De Sa, and Volodymyr Kuleshov. Diffusion models with learned adaptive noise. arXiv preprint arXiv:2312.13236, 2024b. +Tim Salimans, Ian Goodfellow, Wojciech Zaremba, Vicki Cheung, Alec Radford, and Xi Chen. Improved techniques for training gans. Advances in neural information processing systems, 29, 2016. +Guillaume Sanchez, Honglu Fan, Alexander Spangher, Elad Levi, Pawan Sasanka Ammanamchi, and Stella Biderman. Stay on topic with classifier-free guidance. arXiv preprint arXiv:2306.17806, 2023. +Anirban Sarkar, Ziqi Tang, Chris Zhao, and Peter Koo. Designing dna with tunable regulatory activity using discrete diffusion. bioRxiv, pp. 2024-05, 2024. +Yair Schiff, Chia-Hsiang Kao, Aaron Gokaslan, Tri Dao, Albert Gu, and Volodymyr Kuleshov. Caduceus: Bi-directional equivariant long-range dna sequence modeling. arXiv preprint arXiv:2403.03234, 2024. + +Philippe Schwaller, Teodoro Laino, Théophile Gaudin, Peter Bolgar, Christopher A Hunter, Costas Bekas, and Alpha A Lee. Molecular transformer: A model for uncertainty-calibrated chemical reaction prediction. ACS central science, 5(9):1572-1583, 2019. +Jiaxin Shi, Kehang Han, Zhe Wang, Arnaud Doucet, and Michalis K Titsias. Simplified and generalized masked diffusion for discrete data. arXiv preprint arXiv:2406.04329, 2024. +Andy Shih, Dorsa Sadigh, and Stefano Ermon. Training and inference on any-order autoregressive models the right way. Advances in Neural Information Processing Systems, 35:2762-2775, 2022. +Jascha Sohl-Dickstein, Eric Weiss, Niru Maheswaranathan, and Surya Ganguli. Deep unsupervised learning using nonequilibrium thermodynamics. In International conference on machine learning, pp. 2256-2265. PMLR, 2015. +Yang Song and Stefano Ermon. Generative modeling by estimating gradients of the data distribution. Advances in neural information processing systems, 32, 2019. +Hannes Stark, Bowen Jing, Chenyu Wang, Gabriele Corso, Bonnie Berger, Regina Barzilay, and Tommi Jaakkola. Dirichlet flow matching with applications to dna sequence design. arXiv preprint arXiv:2402.05841, 2024. +Jianlin Su, Yu Lu, Shengfeng Pan, Ahmed Murtadha, Bo Wen, and Yunfeng Liu. Roformer: Enhanced transformer with rotary position embedding. arXiv preprint arXiv:2104.09864, 2021. +Haoran Sun, Lijun Yu, Bo Dai, Dale Schuurmans, and Hanjun Dai. Score-based continuous-time discrete diffusion models. arXiv preprint arXiv:2211.16750, 2022. +Yi Tay, Mostafa Dehghani, Vamsi Aribandi, Jai Gupta, Philip M Pham, Zhen Qin, Dara Bahri, Da-Cheng Juan, and Donald Metzler. Omninet: Omnidirectional representations from transformers. In International Conference on Machine Learning, pp. 10193-10202. PMLR, 2021. +Dustin Tran, Keyon Vafa, Kumar Agrawal, Laurent Dinh, and Ben Poole. Discrete flows: Invertible generative models of discrete data. Advances in Neural Information Processing Systems, 32, 2019. +Clement Vignac, Igor Krawczuk, Antoine Siraudin, Bohan Wang, Volkan Cevher, and Pascal Frossard. Digress: Discrete denoising diffusion for graph generation. arXiv preprint arXiv:2209.14734, 2022. +Alex Wang and Kyunghyun Cho. Bert has a mouth, and it must speak: Bert as a markov random field language model. arXiv preprint arXiv:1902.04094, 2019. +Yingheng Wang, Yair Schiff, Aaron Gokaslan, Weishen Pan, Fei Wang, Christopher De Sa, and Volodymyr Kuleshov. Infodiffusion: Representation learning using information maximizing diffusion models. In International Conference on Machine Learning, pp. 36336-36354. PMLR, 2023. +David Weininger. Smiles, a chemical language and information system. 1. introduction to methodology and encoding rules. Journal of chemical information and computer sciences, 28(1):31-36, 1988. +Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumont, Clement Delangue, Anthony Moi, Pierrick Cistac, Tim Rault, Rémi Louf, Morgan Funtowicz, Joe Davison, Sam Shleifer, Patrick von Platen, Clara Ma, Yacine Jernite, Julien Plu, Canwen Xu, Teven Le Scao, Sylvain Gugger, Mariama Drame, Quentin Lhoest, and Alexander M. Rush. Transformers: State-of-the-art natural language processing. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing: System Demonstrations, pp. 38-45, Online, October 2020. Association for Computational Linguistics. URL https://www.aclweb.org/anthology/2020.emnlp-demos.6. +Kevin Yang and Dan Klein. Fudge: Controlled text generation with future discriminators. arXiv preprint arXiv:2104.05218, 2021. + +Xiang Zhang, Junbo Zhao, and Yann LeCun. Character-level convolutional networks for text classification. Advances in neural information processing systems, 28, 2015. +Lingxiao Zhao, Xueying Ding, Lijun Yu, and Leman Akoglu. Improving and unifying discrete&continuous-time discrete denoising diffusion. arXiv preprint arXiv:2402.03701, 2024. +Lin Zheng, Jianbo Yuan, Lei Yu, and Lingpeng Kong. A reparameterized discrete diffusion model for text generation. arXiv preprint arXiv:2302.05737, 2023. +Zachary Ziegler and Alexander Rush. Latent normalizing flows for discrete sequences. In International Conference on Machine Learning, pp. 7673-7682. PMLR, 2019. + +# CONTENTS + +1 Introduction 1 +2 Background 2 + +2.1 Discrete Diffusion Models 2 +2.2 Diffusion Guidance 3 + +3 Guidance Algorithms for Discrete Diffusion 3 + +3.1 Classifier-free Guidance 3 +3.2 Classifier-based Guidance 4 + +4 Uniform Diffusion Language Models 5 + +4.1 Uniform Noise Diffusion 5 +4.2 Improved Likelihood Bounds in Continuous Time 6 + +5 Experiments 7 + +5.1 Language Modeling with Uniform Noise Discrete Diffusion 7 +5.2 Guided Discrete Diffusion 7 + +6 Related Works, Discussion, and Conclusion 10 + +A Continuous Time Discrete Uniform Diffusion 17 +B Relating Guidance to CTMC 19 + +B.1 CTMC Formulation of D-CFG 20 +B.2 CTMC Formulation of D-CBG 21 + +C Relating UDLM to CTMC 22 + +C.1 Equivalence of UDLM ELBO and SEDD ELBO 23 + +D Experimental Details 25 + +D.1 Dataset Details 25 +D.2 Architectural Details 27 +D.3 Training Configurations 28 +D.4 Guidance Details 28 + +D.4.1Baselines 28 +D.4.2 D-CFG Details 29 +D.4.3 D-CBG Details 30 + +D.5 Guidance Evaluation Details 30 + +D.5.1 Genomic Sequences Metrics 30 +D.5.2 CIFAR10 Quality Metrics 30 + +D.5.3 QM9 Guidance Metrics 31 + +E Guidance Ablation Results 31 + +E.1 Effect of Varying Guidance Hyperparameters 31 +E.2 Effect of Using First Order Approximation in D-CBG 33 +E.3 Effect of Varying $T$ 33 + +F Unconditional Sample Generation 34 + +# A CONTINUOUS TIME DISCRETE UNIFORM DIFFUSION + +Here, we derive a continuous time formulation $(T\to \infty)$ for the diffusion loss term $\mathcal{L}_{\mathrm{diffusion}}$ when using the uniform distribution as the limiting distribution of the diffusion process. + +For uniform noise diffusion, we define a limiting distribution $\mathbf{u} = \mathbf{1} / N$ , where $\mathbf{1}$ represents the column vector of all ones, and $N$ the size of the vocabulary. We adopt the assumption from MDLM (Sahoo et al., 2024a) that our diffusion process interpolates between clean data and noise: + +$$ +q \left(\mathbf {z} _ {t} \mid \mathbf {x}\right) = \operatorname {C a t} \left(\mathbf {z} _ {t}; \alpha_ {t} \mathbf {x} + (1 - \alpha_ {t}) \boldsymbol {\pi}\right) \tag {20} +$$ + +and the marginals are given as + +$$ +q \left(\mathbf {z} _ {t} \mid \mathbf {z} _ {s}\right) = \operatorname {C a t} \left(\mathbf {z} _ {t}; \alpha_ {t | s} \mathbf {z} _ {s} + (1 - \alpha_ {t | s}) \boldsymbol {\pi}\right), \tag {21} +$$ + +where $\alpha_{t|s} = \alpha_t / \alpha_s$ . + +Following Austin et al. (2021), we can derive the posterior: + +$$ +q \left(\mathbf {z} _ {s} \mid \mathbf {z} _ {t}, \mathbf {x}\right) = \operatorname {C a t} \left(\mathbf {z} _ {s}; \frac {\left[ \alpha_ {t | s} \mathbf {z} _ {t} + \left(1 - \alpha_ {t | s}\right) \mathbf {1} \boldsymbol {\pi} ^ {\top} \mathbf {z} _ {t} \right] \odot \left[ \alpha_ {s} \mathbf {x} + \left(1 - \alpha_ {s}\right) \boldsymbol {\pi} \right]}{\alpha_ {t} \left\langle \mathbf {z} _ {t} , \mathbf {x} \right\rangle + \left(1 - \alpha_ {t}\right) \mathbf {z} _ {t} ^ {\top} \boldsymbol {\pi}}\right). \tag {22} +$$ + +Using $\pi = u$ as defined above, we get the following: + +$$ +\begin{array}{l} q \left(\mathbf {z} _ {s} \mid \mathbf {z} _ {t}, \mathbf {x}\right) = \operatorname {C a t} \left(\mathbf {z} _ {s}; \frac {\alpha_ {t} \mathbf {z} _ {t} \odot \mathbf {x} + \frac {\left(\alpha_ {t \mid s} - \alpha_ {t}\right)}{N} \mathbf {z} _ {t} + \frac {\left(\alpha_ {s} - \alpha_ {t}\right)}{N} \mathbf {x} + \frac {\left(1 - \alpha_ {t \mid s}\right) \left(1 - \alpha_ {s}\right)}{N ^ {2}} \mathbf {1}}{\alpha_ {t} \langle \mathbf {z} _ {t} , \mathbf {x} \rangle + \frac {\left(1 - \alpha_ {t}\right)}{N}}\right) (23) \\ = \operatorname {C a t} \left(\mathbf {z} _ {s}; \frac {N \alpha_ {t} \mathbf {z} _ {t} \odot \mathbf {x} + (\alpha_ {t | s} - \alpha_ {t}) \mathbf {z} _ {t} + (\alpha_ {s} - \alpha_ {t}) \mathbf {x} + \frac {(\alpha_ {s} - \alpha_ {t}) (1 - \alpha_ {s})}{N \alpha_ {s}} \mathbf {1}}{N \alpha_ {t} \langle \mathbf {z} _ {t} , \mathbf {x} \rangle + 1 - \alpha_ {t}}\right). (24) \\ \end{array} +$$ + +For the denoising distribution, we replace $\mathbf{x}$ by $\mathbf{x}_{\theta}$ : + +$$ +p _ {\theta} \left(\mathbf {z} _ {s} \mid \mathbf {z} _ {t}\right) = \operatorname {C a t} \left(\mathbf {z} _ {s}; \frac {N \alpha_ {t} \mathbf {z} _ {t} \odot \mathbf {x} _ {\theta} + \left(\alpha_ {t | s} - \alpha_ {t}\right) \mathbf {z} _ {t} + \left(\alpha_ {s} - \alpha_ {t}\right) \mathbf {x} _ {\theta} + \frac {\left(\alpha_ {s} - \alpha_ {t}\right) \left(1 - \alpha_ {s}\right)}{\alpha_ {s} N} \mathbf {1}}{N \alpha_ {t} \left\langle \mathbf {z} _ {t} , \mathbf {x} _ {\theta} \right\rangle + 1 - \alpha_ {t}}\right). \tag {25} +$$ + +Let us now look at the diffusion loss term in the NELBO: + +$$ +T \cdot D _ {\mathrm {K L}} \left(q \left(\mathbf {z} _ {s} \mid \mathbf {z} _ {t}, \mathbf {x}\right) \mid \left| p _ {\theta} \left(\mathbf {z} _ {s} \mid \mathbf {z} _ {t}\right) \right.\right) = T \cdot \sum_ {j \in [ N ]} q \left(\mathbf {z} _ {s} \mid \mathbf {z} _ {t}, \mathbf {x}\right) _ {j} \log \left(\frac {q \left(\mathbf {z} _ {s} \mid \mathbf {z} _ {t} , \mathbf {x}\right) _ {j}}{p _ {\theta} \left(\mathbf {z} _ {s} \mid \mathbf {z} _ {t}\right) _ {j}}\right). \tag {26} +$$ + +Letting $i = \arg \max_{j\in [N]}(\mathbf{z}_t)_j$ be the non-zero entry of $\mathbf{z}_t$ , we can break up this KL into two terms: + +$$ +\begin{array}{l} T \cdot D _ {\mathrm {K L}} \left(q \left(\mathbf {z} _ {s} \mid \mathbf {z} _ {t}, \mathbf {x}\right) \mid \left| p _ {\theta} \left(\mathbf {z} _ {s} \mid \mathbf {z} _ {t}\right)\right)\right) = \underbrace {T \cdot q \left(\mathbf {z} _ {s} \mid \mathbf {z} _ {t} , \mathbf {x}\right) _ {i} \log \left(\frac {q \left(\mathbf {z} _ {s} \mid \mathbf {z} _ {t} , \mathbf {x}\right) _ {i}}{p _ {\theta} \left(\mathbf {z} _ {s} \mid \mathbf {z} _ {t}\right) _ {i}}\right)} _ {\text {T e r m 1}} \\ + \underbrace {T \cdot \sum_ {\substack {j \in [ N ] \\ \text {s.t.} (\mathbf {z} _ {t}) _ {j} = 0}} q \left(\mathbf {z} _ {s} \mid \mathbf {z} _ {t} , \mathbf {x}\right) _ {j} \log \left(\frac {q \left(\mathbf {z} _ {s} \mid \mathbf {z} _ {t} , \mathbf {x}\right) _ {j}}{p _ {\theta} \left(\mathbf {z} _ {s} \mid \mathbf {z} _ {t}\right) _ {j}}\right)} _ {\text {Term 2}}. \tag{27} \\ \end{array} +$$ + +We now examine each of these terms taking $T \to \infty$ , or equivalently, using $s = t - \frac{1}{T} \Rightarrow T = \frac{1}{t - s}$ , taking $s \to t$ . + +Term 1: + +$$ +\begin{array}{l} \lim _ {s \to t} \frac {1}{t - s} \cdot \frac {N \alpha_ {t} \mathbf {x} _ {i} + \alpha_ {t | s} - \alpha_ {t} + (\alpha_ {s} - \alpha_ {t}) \mathbf {x} _ {i} + \frac {(\alpha_ {s} - \alpha_ {t}) (1 - \alpha_ {s})}{\alpha_ {s} N}}{N \alpha_ {t} \mathbf {x} _ {i} + 1 - \alpha_ {t}} \\ \cdot \log \left[ \frac {\frac {N \alpha_ {t} \mathbf {x} _ {i} + \alpha_ {t | s} - \alpha_ {t} + \left(\alpha_ {s} - \alpha_ {t}\right) \mathbf {x} _ {i} + \frac {\left(\alpha_ {s} - \alpha_ {t}\right) \left(1 - \alpha_ {s}\right)}{\alpha_ {s} N}}{N \alpha_ {t} \mathbf {x} _ {i} + 1 - \alpha_ {t}}}{\frac {N \alpha_ {t} (\mathbf {x} _ {\theta}) _ {i} + \alpha_ {t | s} - \alpha_ {t} + \left(\alpha_ {s} - \alpha_ {t}\right) (\mathbf {x} _ {\theta}) _ {i} + \frac {\left(\alpha_ {s} - \alpha_ {t}\right) \left(1 - \alpha_ {s}\right)}{\alpha_ {s} N}}{N \alpha_ {t} (\mathbf {x} _ {\theta}) _ {i} + 1 - \alpha_ {t}}} \right] \tag {28} \\ \end{array} +$$ + +As $s \to t$ , the coefficient on the log term will approach 1. Additionally both the numerator and the denominator inside the log term will approach 1, thus the entire log term will approach 0. Combining this with the fact that $t - s$ will approach 0, gives us the indeterminate form of $0 / 0$ , hence we apply L'Hôpital's rule to (28). Writing $q$ and $p_{\theta}$ as functions of $s$ , when we differentiate the log term we get: + +$$ +\begin{array}{l} \frac {d}{d s} \log \left[ \frac {q (s)}{p _ {\theta} (s)} \right] = \frac {d}{d s} \log q (s) - \frac {d}{d s} \log p _ {\theta} (s) \\ = \frac {\frac {d}{d s} q (s)}{q (s)} - \frac {\frac {d}{d s} p _ {\theta} (s)}{p _ {\theta} (s)} \tag {29} \\ \end{array} +$$ + +Let's look at each derivative term in (29): + +$$ +\begin{array}{l} \lim _ {s \to t} \frac {d}{d s} q (s) = \lim _ {s \to t} \frac {\frac {- \alpha_ {s} ^ {\prime} \alpha_ {t}}{\alpha_ {s} ^ {2}} + \alpha_ {s} ^ {\prime} (\mathbf {x} _ {\theta}) _ {i} + \frac {N \alpha_ {s} [ \alpha_ {s} ^ {\prime} (1 - \alpha_ {s}) - \alpha_ {s} ^ {\prime} (\alpha_ {s} - \alpha_ {t}) ] - [ N \alpha_ {s} ^ {\prime} (\alpha_ {s} - \alpha_ {t}) (1 - \alpha_ {s}) ]}{N \alpha_ {s} ^ {2}}}{N \alpha_ {t} \mathbf {x} _ {i} + 1 - \alpha_ {t}} \\ = \frac {\frac {- \alpha_ {t} ^ {\prime}}{\alpha_ {t}} + \alpha_ {t} ^ {\prime} \mathbf {x} _ {i} + \frac {\alpha_ {t} ^ {\prime} (1 - \alpha_ {t})}{N \alpha_ {t}}}{N \alpha_ {t} \mathbf {x} _ {i} + 1 - \alpha_ {t}} \\ = \frac {\alpha_ {t} ^ {\prime}}{N \alpha_ {t}} \Big [ \frac {- N + N \alpha_ {t} \mathbf {x} _ {i} + 1 - \alpha_ {t}}{N \alpha_ {t} \mathbf {x} _ {i} + 1 - \alpha_ {t}} \Big ] \\ = \frac {\alpha_ {t} ^ {\prime}}{N \alpha_ {t}} \left[ 1 - \frac {N}{N \alpha_ {t} \mathbf {x} _ {i} + 1 - \alpha_ {t}} \right] \tag {30} \\ \end{array} +$$ + +Similarly, + +$$ +\lim _ {s \rightarrow t} \frac {d}{d s} p _ {\theta} (s) = \frac {\alpha_ {t} ^ {\prime}}{N \alpha_ {t}} \left[ 1 - \frac {N}{N \alpha_ {t} (\mathbf {x} _ {\theta}) _ {i} + 1 - \alpha_ {t}} \right] \tag {31} +$$ + +Note that when taking $s \to t$ , both $q(s)$ and $p_{\theta}(s)$ evaluate to 1. Additionally, differentiating $\frac{1}{t - s}$ with respect to $s$ evaluates to $-1$ . When combining these facts and plugging (30) and (31) into (29), (28) becomes + +$$ +\begin{array}{l} \lim _ {s \to t} \mathrm {T e r m 1} = \frac {- \alpha_ {t} ^ {\prime}}{N \alpha_ {t}} \Big [ 1 - \frac {N}{N \alpha_ {t} \mathbf {x} _ {i} + 1 - \alpha_ {t}} \Big ] + \frac {\alpha_ {t} ^ {\prime}}{N \alpha_ {t}} \Big [ 1 - \frac {N}{N \alpha_ {t} (\mathbf {x} _ {\theta}) _ {i} + 1 - \alpha_ {t}} \Big ] \\ = \boxed {\frac {\alpha_ {t} ^ {\prime}}{N \alpha_ {t}} \left[ \frac {N}{N \alpha_ {t} \mathbf {x} _ {i} + 1 - \alpha_ {t}} - \frac {N}{N \alpha_ {t} (\mathbf {x} _ {\theta}) _ {i} + 1 - \alpha_ {t}} \right]} \tag {32} \\ \end{array} +$$ + +Term 2: + +$$ +\lim _ {s \rightarrow t} \frac {1}{t - s} \cdot \sum_ {\substack {j \in [ N ]\\\text {s.t.} (\mathbf {z} _ {t}) _ {j} = 0}} \frac {(\alpha_ {s} - \alpha_ {t}) \mathbf {x} _ {j} + \frac {(\alpha_ {s} - \alpha_ {t}) (1 - \alpha_ {s})}{N \alpha_ {s}}}{N \alpha_ {t} \mathbf {x} _ {i} + 1 - \alpha_ {t}} \log \left[ \frac {\frac {(\alpha_ {s} - \alpha_ {t}) \mathbf {x} _ {j} + \frac {(\alpha_ {s} - \alpha_ {t}) (1 - \alpha_ {s})}{N \alpha_ {s}}}{N \alpha_ {t} \mathbf {x} _ {i} + 1 - \alpha_ {t}}}{\frac {(\alpha_ {s} - \alpha_ {t}) (\mathbf {x} _ {\theta}) _ {j} + \frac {(\alpha_ {s} - \alpha_ {t}) (1 - \alpha_ {t})}{N \alpha_ {s}}}{N \alpha_ {t} (\mathbf {x} _ {\theta}) _ {i} + 1 - \alpha_ {t}}} \right] \tag{33} +$$ + +For each term in the summation, $\frac{1}{t - s}$ times the coefficient on the log term will have an indeterminate form of $0 / 0$ as $s\to t$ . We therefore apply L'Hôpital's rule to this coefficient: + +$$ +\lim _ {s \rightarrow t} \frac {1}{t - s} \cdot \frac {\left(\alpha_ {s} - \alpha_ {t}\right) \mathbf {x} _ {j} + \frac {\left(\alpha_ {s} - \alpha_ {t}\right)\left(1 - \alpha_ {s}\right)}{N \alpha_ {s}}}{N \alpha_ {t} \mathbf {x} _ {i} + 1 - \alpha_ {t}} = \frac {- \alpha_ {t} ^ {\prime}}{N \alpha_ {t}} \left[ \frac {N \alpha_ {t} \mathbf {x} _ {j} + 1 - \alpha_ {t}}{N \alpha_ {t} \mathbf {x} _ {i} + 1 - \alpha_ {t}} \right] \tag {34} +$$ + +Now, for the log term, we exchange the limit with the continuous log function and have that both the numerator and the denominator go to zero as $s \to t$ . We therefore apply L'Hôpital's rule here as well: + +$$ +\begin{array}{l} \log \lim _ {s \to t} \left[ \frac {\frac {(\alpha_ {s} - \alpha_ {t}) \mathbf {x} _ {j} + \frac {(\alpha_ {s} - \alpha_ {t}) (1 - \alpha_ {s})}{N \alpha_ {s}}}{N \alpha_ {t} \mathbf {x} _ {i} + 1 - \alpha_ {t}}}{\frac {(\alpha_ {s} - \alpha_ {t}) (\mathbf {x} _ {\theta}) _ {j} + \frac {(\alpha_ {s} - \alpha_ {t}) (1 - \alpha_ {t})}{N \alpha_ {s}}}{N \alpha_ {t} (\mathbf {x} _ {\theta}) _ {i} + 1 - \alpha_ {t}}} \right] = \log \lim _ {s \to t} \left[ \frac {\frac {d}{d s} \frac {(\alpha_ {s} - \alpha_ {t}) \mathbf {x} _ {j} + \frac {(\alpha_ {s} - \alpha_ {t}) (1 - \alpha_ {s})}{N \alpha_ {s}}}{N \alpha_ {t} \mathbf {x} _ {i} + 1 - \alpha_ {t}}}{\frac {d}{d s} \frac {(\alpha_ {s} - \alpha_ {t}) (\mathbf {x} _ {\theta}) _ {j} + \frac {(\alpha_ {s} - \alpha_ {t}) (1 - \alpha_ {t})}{N \alpha_ {s}}}{N \alpha_ {t} (\mathbf {x} _ {\theta}) _ {i} + 1 - \alpha_ {t}}} \right] \\ = \log \left[ \left(\frac {N \alpha_ {t} (\mathbf {x} _ {\theta}) _ {i} + 1 - \alpha_ {t}}{N \alpha_ {t} \mathbf {x} _ {i} + 1 - \alpha_ {t}}\right) \left(\frac {\alpha_ {t} ^ {\prime} \mathbf {x} _ {j} + \frac {\alpha_ {t} ^ {\prime} (1 - \alpha_ {t})}{N \alpha_ {t}}}{\alpha_ {t} ^ {\prime} (\mathbf {x} _ {\theta}) _ {j} + \frac {\alpha_ {t} ^ {\prime} (1 - \alpha_ {t})}{N \alpha_ {t}}}\right) \right] \\ = \log \left[ \left(\frac {N \alpha_ {t} (\mathbf {x} _ {\theta}) _ {i} + 1 - \alpha_ {t}}{N \alpha_ {t} \mathbf {x} _ {i} + 1 - \alpha_ {t}}\right) \left(\frac {\frac {\alpha_ {t} ^ {\prime}}{N \alpha_ {t}} (N \alpha_ {t} \mathbf {x} _ {j} + 1 - \alpha_ {t})}{\frac {\alpha_ {t} ^ {\prime}}{N \alpha_ {t}} (N \alpha_ {t} (\mathbf {x} _ {\theta}) _ {j} + 1 - \alpha_ {t})}\right) \right] \\ = \log \left[ \left(\frac {N \alpha_ {t} (\mathbf {x} _ {\theta}) _ {i} + 1 - \alpha_ {t}}{N \alpha_ {t} \mathbf {x} _ {i} + 1 - \alpha_ {t}}\right) \left(\frac {N \alpha_ {t} \mathbf {x} _ {j} + 1 - \alpha_ {t}}{N \alpha_ {t} (\mathbf {x} _ {\theta}) _ {j} + 1 - \alpha_ {t}}\right) \right] \\ = \log \left[ \left(\frac {N \alpha_ {t} (\mathbf {x} _ {\theta}) _ {i} + 1 - \alpha_ {t}}{N \alpha_ {t} (\mathbf {x} _ {\theta}) j + 1 - \alpha_ {t}}\right) \left(\frac {N \alpha_ {t} \mathbf {x} _ {j} + 1 - \alpha_ {t}}{N \alpha_ {t} \mathbf {x} _ {i} + 1 - \alpha_ {t}}\right) \right] \tag {35} \\ \end{array} +$$ + +Multiplying (34) by (35), we get: + +$$ +\lim _ {s \rightarrow t} \text {T e r m} 2 = \boxed {\frac {- \alpha_ {t} ^ {\prime}}{N \alpha_ {t}} \sum_ {\substack {j \in [ N ]\\\text {s.t.} (\mathbf {z} _ {t}) _ {j} = 0}} \left(\frac {N \alpha_ {t} \mathbf {x} _ {j} + 1 - \alpha_ {t}}{N \alpha_ {t} \mathbf {x} _ {i} + 1 - \alpha_ {t}}\right) \log \left[ \left(\frac {N \alpha_ {t} (\mathbf {x} _ {\theta}) _ {i} + 1 - \alpha_ {t}}{N \alpha_ {t} (\mathbf {x} _ {\theta}) j + 1 - \alpha_ {t}}\right) \left(\frac {N \alpha_ {t} \mathbf {x} _ {j} + 1 - \alpha_ {t}}{N \alpha_ {t} \mathbf {x} _ {i} + 1 - \alpha_ {t}}\right) \right]} (3 6)} +$$ + +Combining Terms 1 and 2: Using (32) and (36), the final KL term in the continuous time limit is: + +$$ +\begin{array}{l} \lim _ {T \to \infty} T \cdot D _ {\mathrm {K L}} (q | | p _ {\theta}) = \frac {\alpha_ {t} ^ {\prime}}{N \alpha_ {t}} \bigg [ \frac {N}{N \alpha_ {t} \mathbf {x} _ {i} + 1 - \alpha_ {t}} - \frac {N}{N \alpha_ {t} (\mathbf {x} _ {\theta}) _ {i} + 1 - \alpha_ {t}} \\ -\sum_{\substack{j\in [N]\\ \text{s.t.} (\mathbf{z}_{t})_{j} = 0}}\left(\frac{N\alpha_{t}\mathbf{x}_{j} + 1 - \alpha_{t}}{N\alpha_{t}\mathbf{x}_{i} + 1 - \alpha_{t}}\right)\log \left[\left(\frac{N\alpha_{t}(\mathbf{x}_{\theta})_{i} + 1 - \alpha_{t}}{N\alpha_{t}(\mathbf{x}_{\theta})j + 1 - \alpha_{t}}\right)\left(\frac{N\alpha_{t}\mathbf{x}_{j} + 1 - \alpha_{t}}{N\alpha_{t}\mathbf{x}_{i} + 1 - \alpha_{t}}\right)\right]\Bigg]. \\ \end{array} +$$ + +Defining $\bar{\mathbf{x}} = N\alpha_{t}\mathbf{x} + (1 - \alpha_{t})\mathbf{1}$ and $\bar{\mathbf{x}}_{\theta} = N\alpha_{t}\mathbf{x}_{\theta} + (1 - \alpha_{t})\mathbf{1}$ , as in Section 4.2, yields the desired result. + +# B RELATING GUIDANCE TO CTMC + +Below we demonstrate how our proposed guidance mechanisms from Section 3 admit straightforward continuous-time extensions. In concurrent work, Nisonoff et al. (2024) use the formalisms of continuous time Markov chains (CTMC) to derive similar guidance formulas, which we show are equivalent to the continuous-time extensions of our work. + +Background on CTMC In the CTMC formulation, the key quantity of interest is the rate matrix $R_{t} \in \mathbb{R}^{N \times N}$ . In analogy to the discrete time transition matrices $Q_{t}$ , which define the transition probabilities between states, these rate matrices define the instantaneous rate of change between states in continuous time. More formally, letting $\delta(\mathbf{x}, \mathbf{y})$ be the Kronecker delta function that equals 1 if $\mathbf{x} = \mathbf{y}$ and 0 otherwise, and using $\mathbf{z}$ and $\mathbf{z}'$ to denote observed values of the latents, we can define the forward noising process using $R_{t}$ as follows: + +$$ +q \left(\mathbf {z} _ {t} = \mathbf {z} ^ {\prime} \mid \mathbf {z} _ {s} = \mathbf {z}\right) = \delta_ {\mathbf {z}, \mathbf {z} ^ {\prime}} + R _ {t} \left(\mathbf {z}, \mathbf {z} ^ {\prime}\right) \frac {1}{T} + o \left(\frac {1}{T}\right) \tag {37} +$$ + +where $o(1 / T)$ indicates terms that vanish more quickly than $1 / T$ . Note that when clear from the context, we use the shorthand $\delta_{\mathbf{z},\mathbf{z}'} \coloneqq \delta(\mathbf{z},\mathbf{z}')$ . Recall that we defined $s = t - \frac{1}{T}$ . In continuous + +time, as $T \to \infty$ , $o(1 / T)$ terms are ignored, and we have + +$$ +R _ {t} \left(\mathbf {z}, \mathbf {z} ^ {\prime}\right) = \lim _ {T \rightarrow \infty} \frac {q \left(\mathbf {z} _ {t} = \mathbf {z} ^ {\prime} \mid \mathbf {z} _ {t - (1 / T)} = \mathbf {z}\right) - \delta_ {\mathbf {z} , \mathbf {z} ^ {\prime}}}{1 / T}, \tag {38} +$$ + +hence our treatment of $R_{t}$ as the 'instantaneous' rate of state transitions. + +Importantly, processes defined as in (37) have known time reversals given by (Kelly, 2011; Sun et al., 2022): + +$$ +q \left(\mathbf {z} _ {s} = \mathbf {z} \mid \mathbf {z} _ {t} = \mathbf {z} ^ {\prime}\right) = \delta_ {\mathbf {z} ^ {\prime}, \mathbf {z}} + \check {R} _ {t} \left(\mathbf {z} ^ {\prime}, \mathbf {z}\right) \frac {1}{T} + o \left(\frac {1}{T}\right), \tag {39} +$$ + +where $\tilde{R}_t$ represents the reverse rate matrix which is related to the forward matrix as follows: + +$$ +\check {R} _ {t} \left(\mathbf {z} ^ {\prime}, \mathbf {z}\right) = \frac {q \left(\mathbf {z} _ {t} = \mathbf {z} ^ {\prime}\right)}{q \left(\mathbf {z} _ {t} = \mathbf {z}\right)} R _ {t} \left(\mathbf {z}, \mathbf {z} ^ {\prime}\right), \quad \text {i f} \mathbf {z} ^ {\prime} \neq \mathbf {z}, \tag {40} +$$ + +with $\check{R}_t(\mathbf{z},\mathbf{z}) = -\sum_{\mathbf{z}'\neq \mathbf{z}}\check{R}_t(\mathbf{z}',\mathbf{z})$ , which ensures that the rows of $\check{R}_t$ sum to zero (i.e., mass cannot be created or destroyed). Note that in (40), we are scaling the forward rate matrix by a ratio of the unconditional marginals: $q(\mathbf{z}_t = \mathbf{z}') / q(\mathbf{z}_t = \mathbf{z})$ . + +We remark that in the derivations for guidance in Nisonoff et al. (2024), they slightly change the form of (39) to: + +$$ +q \left(\mathbf {z} _ {s} = \mathbf {z} \mid \mathbf {z} _ {t} = \mathbf {z} ^ {\prime}\right) = \delta_ {\mathbf {z} ^ {\prime}, \mathbf {z}} \left(1 + \tilde {R} _ {t} \left(\mathbf {z} ^ {\prime}, \mathbf {z} ^ {\prime}\right)\right) (1 / T) + \left(1 - \delta_ {\mathbf {z} ^ {\prime}, \mathbf {z}}\right) \tilde {R} _ {t} \left(\mathbf {z} ^ {\prime}, \mathbf {z}\right) (1 / T) + o (1 / T). \tag {41} +$$ + +Sampling with Learned Reverse Rate Matrices Assuming we have a learned model $R_{t,\theta}(\mathbf{z}',\mathbf{z})$ that approximates the true reverse rates (see Campbell et al. (2022) or Campbell et al. (2024) for details), we can generate from this model by drawing samples from the limiting distribution $\mathbf{z}_1\sim \pmb{\pi}$ and using a forward Euler discretization to sample a chain of latents that end in samples $\mathbf{x}\sim q(\mathbf{x})$ (Campbell et al., 2024): + +$$ +\mathbf {z} _ {s} \sim \operatorname {C a t} \left(\mathbf {z} _ {s}; \delta \left(\mathbf {z} _ {t} = \mathbf {z} ^ {\prime}, \mathbf {z} _ {s}\right) + (1 / T) \cdot R _ {t, \theta} \left(\mathbf {z} _ {t} = \mathbf {z} ^ {\prime}, \mathbf {z} _ {s}\right)\right), \tag {42} +$$ + +where $1 / T$ represents the discretization step size and, as above, $s = t - 1 / T$ . Additionally, note that here we follow the convention of diffusion models and let the time variable go from $t = 1 \rightarrow 0$ to indicate moving from noise towards signal, in contrast with the flow matching literature, where the reverse time convention is used (Lipman et al., 2022; Campbell et al., 2024). + +# B.1 CTMC FORMULATION OF D-CFG + +In Nisonoff et al. (2024), guidance is achieved by scaling the parametrized reverse rate matrix $R_{t,\theta}$ . Predictor-free guidance (the analogous method to D-CFG) is presented as: + +$$ +R _ {t, \theta} ^ {\gamma} \left(\mathbf {z} _ {t} = \mathbf {z} ^ {\prime}, \mathbf {z} _ {s} \mid y\right) = R _ {t, \theta} \left(\mathbf {z} _ {t} = \mathbf {z} ^ {\prime}, \mathbf {z} _ {s} \mid y\right) ^ {\gamma} \cdot R _ {t, \theta} \left(\mathbf {z} _ {t} = \mathbf {z} ^ {\prime}, \mathbf {z} _ {s}\right) ^ {(1 - \gamma)}, \tag {43} +$$ + +where $R_{t,\theta}(\cdot \mid y)$ is the learned reverse rate when conditioned on $y$ . + +We now present the continuous-time extension of D-CFG and show that it is proportional to using the predictor-free guided reverse rate from (43) in conjunction with the forward Euler sampling from (42). Starting from the formulation of D-CFG from our work (where we make more explicit which variables are free / set) + +$$ +p ^ {\gamma} \left(\mathbf {z} _ {s} \mid \mathbf {z} _ {t} = \mathbf {z} ^ {\prime}, y\right) \propto p _ {\theta} \left(\mathbf {z} _ {s} \mid \mathbf {z} _ {t} = \mathbf {z} ^ {\prime}, y\right) ^ {\gamma} \cdot p _ {\theta} \left(\mathbf {z} _ {s} \mid \mathbf {z} _ {t} = \mathbf {z} ^ {\prime}\right) ^ {(1 - \gamma)}, +$$ + +when using the forward Euler sampling scheme, we can plug in the formulation from (41) (with the true reverse rate replaced with the approximate one) into the right-hand side of this equation to get + +$$ +\begin{array}{l} p ^ {\gamma} \left(\mathbf {z} _ {s} \mid \mathbf {z} _ {t} = \mathbf {z} ^ {\prime}, y\right) \propto \\ \left[ \left(\delta (\mathbf {z} _ {t} = \mathbf {z} ^ {\prime}, \mathbf {z} _ {s}) (1 + R _ {t, \theta} (\mathbf {z} _ {t} = \mathbf {z} ^ {\prime}, \mathbf {z} _ {s} = \mathbf {z} ^ {\prime} \mid y)) (1 / T) + (1 - \delta (\mathbf {z} _ {t} = \mathbf {z} ^ {\prime}, \mathbf {z} _ {s})) R _ {t, \theta} (\mathbf {z} _ {t} = \mathbf {z} ^ {\prime}, \mathbf {z} _ {s} \mid y) (1 / T)\right) ^ {\gamma} \right. \\ \left. + \left(\delta (\mathbf {z} _ {t} = \mathbf {z} ^ {\prime}, \mathbf {z} _ {s}) (1 + R _ {t, \theta} (\mathbf {z} _ {t} = \mathbf {z} ^ {\prime}, \mathbf {z} _ {s} = \mathbf {z} ^ {\prime})) (1 / T) + (1 - \delta (\mathbf {z} _ {t} = \mathbf {z} ^ {\prime}, \mathbf {z} _ {s})) R _ {t, \theta} (\mathbf {z} _ {t} = \mathbf {z} ^ {\prime}, \mathbf {z} _ {s}) (1 / T)\right) ^ {(1 - \gamma)} \right] \\ = \left[ \delta (\mathbf {z} _ {t} = \mathbf {z} ^ {\prime}, \mathbf {z} _ {s}) (1 + R _ {t, \theta} (\mathbf {z} _ {t} = \mathbf {z} ^ {\prime}, \mathbf {z} _ {s} = \mathbf {z} ^ {\prime} \mid y)) ^ {\gamma} \cdot (1 + R _ {t, \theta} (\mathbf {z} _ {t} = \mathbf {z} ^ {\prime}, \mathbf {z} _ {s} = \mathbf {z} ^ {\prime})) ^ {(1 - \gamma)} (1 / T) \right. \\ \left. + \left(1 - \delta \left(\mathbf {z} _ {t} = \mathbf {z} ^ {\prime}, \mathbf {z} _ {s}\right)\right) R _ {t, \theta} \left(\mathbf {z} _ {t} = \mathbf {z} ^ {\prime}, \mathbf {z} _ {s} \mid y\right) ^ {\gamma} \cdot R _ {t, \theta} \left(\mathbf {z} _ {t} = \mathbf {z} ^ {\prime}, \mathbf {z} _ {s}\right) ^ {(1 - \gamma)} (1 / T) \right] \\ = \left[ \delta (\mathbf {z} _ {t} = \mathbf {z} ^ {\prime}, \mathbf {z} _ {s}) (1 + R _ {t, \theta} ^ {\gamma} (\mathbf {z} _ {t} = \mathbf {z} ^ {\prime}, \mathbf {z} _ {s} = \mathbf {z} ^ {\prime} \mid y)) (1 / T) \right. \\ \left. + \left(1 - \delta (\mathbf {z} _ {t} = \mathbf {z} ^ {\prime}, \mathbf {z} _ {s})\right) R _ {t, \theta} ^ {\gamma} (\mathbf {z} _ {t} = \mathbf {z} ^ {\prime}, \mathbf {z} _ {s} \mid y) (1 / T) \right], \\ \end{array} +$$ + +where the first equality comes from the fact that all cross terms involving $\delta (\mathbf{z}_t = \mathbf{z}',\mathbf{z})\cdot (1 - \delta (\mathbf{z}_t = \mathbf{z}',\mathbf{z}))$ evaluate to zero, allowing us to aggregate terms under the exponents $\gamma$ and $1 - \gamma$ , and the second equality comes from (43). + +# B.2 CTMC FORMULATION OF D-CBG + +While for classifier-free guidance, we did not need to distinguish between latent variables with a single token and those representing sequences of tokens (as argued in Section 3.1), below we make this distinction explicit by including superscripts $(\ell)$ and $(1:L)$ on variables $\mathbf{z}_s,\mathbf{z}_t$ . However, for notational simplicity we omit theses subscripts on variables that denote realized values, such as $\mathbf{z}'$ . + +In Nisonoff et al. (2024), predictor guided rates (the analog to our D-CBG) are attained by scaling $R_{t,\theta}$ as follows: + +$$ +R _ {t, \theta} ^ {\gamma} \left(\mathbf {z} _ {t} ^ {(1: L)} = \mathbf {z} ^ {\prime}, \mathbf {z} _ {s} ^ {(1: L)} \mid y\right) = \left(\frac {p _ {\phi} \left(y \mid \mathbf {z} _ {s} ^ {(1 : L)} , \mathbf {z} _ {t} ^ {(1 : L)} = \mathbf {z} ^ {\prime}\right)}{p _ {\phi} \left(y \mid \mathbf {z} _ {s} ^ {(1 : L)} = \mathbf {z} ^ {\prime} , \mathbf {z} _ {t} ^ {(1 : L)} = \mathbf {z} ^ {\prime}\right)}\right) ^ {\gamma} R _ {t, \theta} \left(\mathbf {z} _ {t} ^ {(1: L)} = \mathbf {z} ^ {\prime}, \mathbf {z} _ {s} ^ {(1: L)}\right), \tag {44} +$$ + +where $p_{\phi}$ is an external classifier. Given the factorization assumptions of the forward and reverse processes, the reverse rate matrix in the CTMC formulation is only non-zero at entries where its arguments differ in (at most) one dimension (Campbell et al., 2022; 2024; Nisonoff et al., 2024). Thus, the classifier only needs to be evaluated on candidates for which latents differ in at most one token, which coincides with the argument / classifier we introduce in Section 3.2. The formulation in (44) can be further simplified to (see Nisonoff et al. (2024) for details): + +$$ +R _ {t, \theta} ^ {\gamma} \left(\mathbf {z} _ {t} ^ {(1: L)} = \mathbf {z} ^ {\prime}, \mathbf {z} _ {s} ^ {(1: L)} \mid y\right) = \frac {p _ {\phi} (y \mid \mathbf {z} _ {s} ^ {(1 : L)})}{p _ {\phi} (y \mid \mathbf {z} _ {s} ^ {(1 : L)} = \mathbf {z} _ {t} ^ {(1: L)} = \mathbf {z} ^ {\prime})} R _ {t, \theta} \left(\mathbf {z} _ {t} ^ {(1: L)} = \mathbf {z} ^ {\prime}, \mathbf {z} _ {s} ^ {(1: L)}\right), \tag {45} +$$ + +where for each $\ell$ , using the notation introduced in Section 3.2, we only evaluate $p_{\phi}$ on $\mathbf{z}_s^{(1:L)} \in \tilde{\mathcal{Z}}_\ell(\mathbf{z}_t^{(1:L)})$ . + +As in Appendix B.1, we present the continuous-time extension of D-CBG and show that it is proportional to sampling using the reverse rate matrix in (45) (with Euler discretization for sampling). + +Let $R_{t,\theta}^{(\ell)}$ represent the rate matrix corresponding to transitions where all dimensions are kept the same except for potentially the one corresponding to the $\ell^{\mathrm{th}}$ token. We follow a similar derivation to that used in Appendix B.1 and start with our formulation for D-CBG: + +$$ +p ^ {\gamma} (\mathbf {z} _ {s} ^ {(\ell)} \mid \mathbf {z} _ {t} ^ {(1: L)}, y) \propto p _ {\phi} (y \mid \tilde {\mathbf {z}} ^ {(1: L)}) ^ {\gamma} p _ {\theta} (\mathbf {z} _ {s} ^ {(\ell)} \mid \mathbf {z} _ {t} ^ {(1: L)}), +$$ + +where recall that $\tilde{\mathbf{z}}^{(1:L)} = \left[\mathbf{z}_t^{(1:\ell -1)},\mathbf{z}_s^{(\ell)},\mathbf{z}_t^{(\ell +1:L)}\right]$ . We then plug in the formulation for the approximate reverse rate to get: + +$$ +\begin{array}{l} p ^ {\gamma} (\mathbf {z} _ {s} ^ {(\ell)} \mid \mathbf {z} _ {t} ^ {(1: L)} = \mathbf {z} ^ {\prime}, y) \propto \\ p _ {\phi} (y \mid \tilde {\mathbf {z}} ^ {(1: L)}) ^ {\gamma} \cdot \left(\delta \left(\mathbf {z} _ {t} ^ {(1: L)} = \mathbf {z} ^ {\prime}, \mathbf {z} _ {s} ^ {(1: L)}\right) \left(1 + R _ {t, \theta} ^ {(\ell)} \left(\mathbf {z} _ {t} ^ {(1: L)} = \mathbf {z} ^ {\prime}, \mathbf {z} _ {s} ^ {(1: L)} = \mathbf {z} ^ {\prime}\right)\right) \left(1 / T\right) \right. \\ \left. + \left(1 - \delta \left(\mathbf {z} _ {t} ^ {(1: L)} = \mathbf {z} ^ {\prime}, \mathbf {z} _ {s} ^ {(1: L)}\right)\right) R _ {t, \theta} ^ {(\ell)} \left(\mathbf {z} _ {t} ^ {(1: L)} = \mathbf {z} ^ {\prime}, \mathbf {z} _ {s} ^ {(1: L)}\right) (1 / T)\right) \\ \propto \left(\frac {p _ {\phi} (y \mid \tilde {\mathbf {z}} ^ {(1 : L)})}{p _ {\phi} (y \mid \mathbf {z} _ {t} ^ {(1 : L)} = \mathbf {z} ^ {\prime})}\right) ^ {\gamma} \cdot \left(\delta (\mathbf {z} _ {t} = \mathbf {z} ^ {\prime}, \mathbf {z} _ {s}) (1 + R _ {t, \theta} ^ {(\ell)} (\mathbf {z} _ {t} = \mathbf {z} ^ {\prime}, \mathbf {z} _ {s} = \mathbf {z} ^ {\prime})) (1 / T) \right. \\ \left. + \left(1 - \delta \left(\mathbf {z} _ {t} = \mathbf {z} ^ {\prime}, \mathbf {z} _ {s}\right)\right) R _ {t, \theta} ^ {(\ell)} \left(\mathbf {z} _ {t} ^ {(1: L)} = \mathbf {z} ^ {\prime}, \mathbf {z} _ {s} ^ {(1: L)}\right) (1 / T)\right), \\ \end{array} +$$ + +where the second proportionality comes from the fact that $p_{\phi}(y \mid \mathbf{z}_t^{(1:L)} = \mathbf{z}^{\prime})$ is simply a constant. Therefore, we have shown the equivalence between our D-CBG method and the predictor guidance method introduced in Nisonoff et al. (2024). + +# C RELATING UDLM TO CTMC + +Similar to Sahoo et al. (2024a), our work tackles the problem of discrete diffusion from the variational perspective and analyzes the ELBO in the continuous time limit. In contrast, other works, such as Campbell et al. (2022) and Lou et al. (2023), have extended the discrete diffusion framework proposed in Austin et al. (2021) using the formalisms of CTMC. In this section, we relate these two approaches. + +Forward Rate Matrices for Uniform Noise Recall from the analysis in Appendix A that we can use L'Hospital's rule to evaluate $\lim_{T\to \infty}T\cdot (1 - \alpha_{t|s}) = -\alpha_t' / \alpha_t$ . Now, using (21) from above, for $\mathbf{z}'\neq \mathbf{z}$ we have + +$$ +q \left(\mathbf {z} _ {t} = \mathbf {z} ^ {\prime} \mid \mathbf {z} _ {s} = \mathbf {z}\right) = \frac {1 - \alpha_ {t | s}}{N}. \tag {46} +$$ + +Combining this with (38), we have that: + +$$ +R _ {t} \left(\mathbf {z}, \mathbf {z} ^ {\prime}\right) = \lim _ {T \rightarrow \infty} T \cdot \frac {1 - \alpha_ {t | s}}{N} = - \frac {\alpha_ {t} ^ {\prime}}{N \alpha_ {t}}. \tag {47} +$$ + +Now for $\mathbf{z}' = \mathbf{z}$ , again from (21), we have + +$$ +q \left(\mathbf {z} _ {t} = \mathbf {z} \mid \mathbf {z} _ {s} = \mathbf {z}\right) = \alpha_ {t | s} + \frac {1 - \alpha_ {t | s}}{N}, \tag {48} +$$ + +which combines with (38) to yield: + +$$ +R _ {t} (\mathbf {z}, \mathbf {z}) = \lim _ {T \rightarrow \infty} T \cdot \left(\alpha_ {t | s} + \frac {1 - \alpha_ {t | s}}{N} - 1\right) = \frac {1 - N}{N} \lim _ {T \rightarrow \infty} T \cdot \left(1 - \alpha_ {t | s}\right) = \frac {- \alpha_ {t} ^ {\prime}}{N \alpha_ {t}} (1 - N). \tag {49} +$$ + +Alternatively, for (49), we could have relied on the property that $R_{t}(\mathbf{z},\mathbf{z}) = -\sum_{\mathbf{z}^{\prime}\neq \mathbf{z}}R_{t}(\mathbf{z},\mathbf{z}^{\prime})$ . + +Writing (47) and (49) as a single expression, gives: + +$$ +R _ {t} \left(\mathbf {z}, \mathbf {z} ^ {\prime}\right) = - \frac {\alpha_ {t} ^ {\prime}}{N \alpha_ {t}} \left[ \mathbf {1 1} ^ {\top} - N \mathbf {I} \right]. \tag {50} +$$ + +# C.1 EQUIVALENCE OF UDLM ELBO AND SEDD ELBO + +Below, we demonstrate that the variational lower bound from (18) used to train UDLM is equivalent to the lower bound derived in SEDD (Lou et al., 2023), for a specific parameterization of the denoising score matching. + +Notation To facilitate the discussion, we introduce a notational shorthand $q_{t}(\mathbf{z}^{\prime}) = q(\mathbf{z}_{t} = \mathbf{z}^{\prime})$ and $q_{t}(\mathbf{z}^{\prime} \mid \mathbf{x}) = q(\mathbf{z}_{t} = \mathbf{z}^{\prime} \mid \mathbf{x})$ . + +In SEDD, the quantity of interest is the ratio of probabilities in the reverse rate matrix equation given in (40), and they train a parametric model to learn this so-called concrete score (Meng et al., 2022): + +$$ +s _ {\theta} (\mathbf {z}) _ {\mathbf {z} ^ {\prime}} \approx \frac {q _ {t} \left(\mathbf {z} ^ {\prime}\right)}{q _ {t} (\mathbf {z})}. \tag {51} +$$ + +Since the unconditional marginals in this ratio are intractable, SEDD proposes a tractable denoising score-based objective. Importantly, they show that the denoising score-based objective they use for training serves as variational bound and derive the following expression for Negative Evidence Lower Bound (NELBO): + +NELBOSEDD + +$$ += \mathbb {E} _ {t \in [ 0, 1 ], \mathbf {z} \sim q _ {t} (\cdot | \mathbf {x})} \left[ \sum_ {\mathbf {z} ^ {\prime} \neq \mathbf {z} _ {t}} R _ {t} (\mathbf {z}, \mathbf {z} ^ {\prime}) \left(\mathbf {s} _ {\theta} (\mathbf {z}) _ {\mathbf {z} ^ {\prime}} - \frac {q _ {t} (\mathbf {z} ^ {\prime} | \mathbf {x})}{q _ {t} (\mathbf {z} | \mathbf {x})} \log \mathbf {s} _ {\theta} (\mathbf {z}) _ {\mathbf {z} ^ {\prime}} + K \left(\frac {q _ {t} (\mathbf {z} ^ {\prime} | \mathbf {x})}{q _ {t} (\mathbf {z} | \mathbf {x})}\right)\right) \right], \tag {52} +$$ + +where $K(a) = a(\log a - 1)$ , for $a \in \mathbb{R}^+$ . + +SEDD with Interpolating Uniform Noise From (1) we have $q_{t}(\mathbf{z}|\mathbf{x}) = \alpha_{t}\mathbf{x}_{i} + (1 - \alpha_{t}) / N$ where $i$ is the non-zero index of the one-hot vector $\mathbf{z}$ , i.e., $\mathbf{z}_i = 1$ . Thus, the 'true' conditional score in (52) can be written as + +$$ +\frac {q _ {t} \left(\mathbf {z} ^ {\prime} \mid \mathbf {x}\right)}{q _ {t} (\mathbf {z} \mid \mathbf {x})} = \frac {\alpha_ {t} \mathbf {x} _ {j} + (1 - \alpha_ {t}) / N}{\alpha_ {t} \mathbf {x} _ {i} + (1 - \alpha_ {t}) / N} = \frac {N \alpha_ {t} \mathbf {x} _ {j} + (1 - \alpha_ {t})}{N \alpha_ {t} \mathbf {x} _ {i} + (1 - \alpha_ {t})}, \tag {53} +$$ + +where we use $i$ and $j$ to denote the non-zero indices of the one-hot vectors $\mathbf{z}$ and $\mathbf{z}'$ , respectively. + +Using Mean Parameterization in SEDD NELBO In our work, we use the mean parameterization: we predict the 'clean' data given noisy observations using the model that we denote as $\mathbf{x}_{\theta}$ . Note that (52) is minimized if + +$$ +\mathbf {s} _ {\theta} (\mathbf {z}) _ {\mathbf {z} ^ {\prime}} = \frac {q _ {t} (\mathbf {z} ^ {\prime} | \mathbf {x})}{q _ {t} (\mathbf {z} | \mathbf {x})}. +$$ + +Thus, we can replace $\mathbf{x}$ in (53) to extract a score model from our parameterization: + +$$ +\mathbf {s} _ {\theta} (\mathbf {z}) _ {\mathbf {z} ^ {\prime}} = \frac {\alpha_ {t} \left(\mathbf {x} _ {\theta}\right) _ {j} + (1 - \alpha_ {t}) / N}{\alpha_ {t} \left(\mathbf {x} _ {\theta}\right) _ {i} + (1 - \alpha_ {t}) / N} = \frac {N \alpha_ {t} \left(\mathbf {x} _ {\theta}\right) _ {j} + (1 - \alpha_ {t})}{N \alpha_ {t} \left(\mathbf {x} _ {\theta}\right) _ {i} + (1 - \alpha_ {t})}. \tag {54} +$$ + +We now show two useful identities that come from this parameterization. First, + +$$ +\begin{array}{l} \sum_ {\mathbf {z} ^ {\prime} \neq \mathbf {z}} \mathbf {s} _ {\theta} (\mathbf {z}) _ {\mathbf {z} ^ {\prime}} = \sum_ {j \neq i} \frac {\alpha_ {t} (\mathbf {x} _ {\theta}) _ {j} + (1 - \alpha_ {t}) / N}{\alpha_ {t} (\mathbf {x} _ {\theta}) _ {i} + (1 - \alpha_ {t}) / N} \\ = \frac {\alpha_ {t} [ \sum_ {j \neq i} (\mathbf {x} _ {\theta}) _ {j} ] + \sum_ {j \neq i} (1 - \alpha_ {t}) / N}{\alpha_ {t} (\mathbf {x} _ {\theta}) _ {i} + (1 - \alpha_ {t}) / N} \\ = \frac {\alpha_ {t} [ \sum_ {j \neq i} (\mathbf {x} _ {\theta}) _ {j} ] + (1 - \alpha_ {t}) (N - 1) / N}{\alpha_ {t} (\mathbf {x} _ {\theta}) _ {i} + (1 - \alpha_ {t}) / N} \\ = \frac {\alpha_ {t} [ 1 - (\mathbf {x} _ {\theta}) _ {i} ] + (1 - \alpha_ {t}) - (1 - \alpha_ {t}) / N}{\alpha_ {t} (\mathbf {x} _ {\theta}) _ {i} + (1 - \alpha_ {t}) / N} \\ = \frac {\alpha_ {t} + (1 - \alpha_ {t}) - \alpha_ {t} (\mathbf {x} _ {\theta}) _ {i} - (1 - \alpha_ {t}) / N}{\alpha_ {t} (\mathbf {x} _ {\theta}) _ {i} + (1 - \alpha_ {t}) / N} \\ = \frac {1 - \alpha_ {t} (\mathbf {x} _ {\theta}) _ {i} - (1 - \alpha_ {t}) / N}{\alpha_ {t} (\mathbf {x} _ {\theta}) _ {i} + (1 - \alpha_ {t}) / N} \\ = \frac {1}{\alpha_ {t} \left(\mathbf {x} _ {\theta}\right) _ {i} + (1 - \alpha_ {t}) / N} - 1 \\ = \frac {N}{N \alpha_ {t} (\mathbf {x} _ {\theta}) _ {i} + (1 - \alpha_ {t})} - 1 \tag {55} \\ \end{array} +$$ + +The same logic can be applied to show that + +$$ +\sum_ {\mathbf {z} ^ {\prime} \neq \mathbf {z}} \frac {q _ {t} \left(\mathbf {z} ^ {\prime} \mid \mathbf {x}\right)}{q _ {t} (\mathbf {z} \mid \mathbf {x})} = \sum_ {j \neq i} \frac {\alpha_ {t} \mathbf {x} _ {j} + (1 - \alpha_ {t}) / N}{\alpha_ {t} \mathbf {x} _ {i} + (1 - \alpha_ {t}) / N} = \frac {N}{N \alpha_ {t} \mathbf {x} _ {i} + (1 - \alpha_ {t})} - 1. \tag {56} +$$ + +Equivalence Between NELBO $_{\text{SED}}$ and NELBO $_{\text{UDLM}}$ We can now use the identities from (55) and (56) to demonstrate that NELBO $_{\text{SED}}$ (52) is equivalent to NELBO $_{\text{UDLM}}$ (18). + +NELBOSEDD + +$$ +\begin{array}{l} = \mathbb {E} _ {t \in [ 0, 1 ], \mathbf {z} \sim q _ {t} (\cdot | \mathbf {x})} \left[ \sum_ {\mathbf {z} ^ {\prime} \neq \mathbf {z}} R _ {t} (\mathbf {z}, \mathbf {z} ^ {\prime}) \left(\mathbf {s} _ {\theta} (\mathbf {z}) _ {\mathbf {z} ^ {\prime}} - \frac {q _ {t} (\mathbf {z} ^ {\prime} | \mathbf {x})}{q _ {t} (\mathbf {z} | \mathbf {x})} \log \mathbf {s} _ {\theta} (\mathbf {z}) _ {\mathbf {z} ^ {\prime}} + K \left(\frac {q _ {t} (\mathbf {z} ^ {\prime} | \mathbf {x})}{q _ {t} (\mathbf {z} | \mathbf {x})}\right)\right) \right] \\ = \mathbb {E} _ {t \in [ 0, 1 ], \mathbf {z} \sim q _ {t} (. | \mathbf {x})} \left[ \sum_ {\mathbf {z} ^ {\prime} \neq \mathbf {z}} - \frac {\alpha_ {t} ^ {\prime}}{N \alpha_ {t}} \left(\mathbf {s} _ {\theta} (\mathbf {z}) _ {\mathbf {z} ^ {\prime}} - \frac {q _ {t} \left(\mathbf {z} ^ {\prime} | \mathbf {x}\right)}{q _ {t} (\mathbf {z} | \mathbf {x})} \log \mathbf {s} _ {\theta} (\mathbf {z}) _ {\mathbf {z} ^ {\prime}} + K \left(\frac {q _ {t} \left(\mathbf {z} ^ {\prime} | \mathbf {x}\right)}{q _ {t} (\mathbf {z} | \mathbf {x})}\right)\right) \right] \quad \text {f r o m (4 7)} \\ = \mathbb {E} _ {t \in [ 0, 1 ], \mathbf {z} \sim q _ {t} (. | \mathbf {x})} \left[ \frac {\alpha_ {t} ^ {\prime}}{N \alpha_ {t}} \left(- \sum_ {\mathbf {z} ^ {\prime} \neq \mathbf {z}} \mathbf {s} _ {\theta} (\mathbf {z}) _ {\mathbf {z} ^ {\prime}} + \sum_ {\mathbf {z} ^ {\prime} \neq \mathbf {z}} \frac {q _ {t} (\mathbf {z} ^ {\prime} | \mathbf {x})}{q _ {t} (\mathbf {z} | \mathbf {x})} \log \mathbf {s} _ {\theta} (\mathbf {z}) _ {\mathbf {z} ^ {\prime}} - \sum_ {\mathbf {z} ^ {\prime} \neq \mathbf {z}} K \left(\frac {q _ {t} (\mathbf {z} ^ {\prime} | \mathbf {x})}{q _ {t} (\mathbf {z} | \mathbf {x})}\right)\right) \right] \\ \end{array} +$$ + +Recall that $K(a) = a \log a - a$ + +$$ += \mathbb {E} _ {t \in [ 0, 1 ], \mathbf {z} \sim q _ {t} (\cdot | \mathbf {x})} \frac {\alpha_ {t} ^ {\prime}}{N \alpha_ {t}} \left[ - \sum_ {\mathbf {z} ^ {\prime} \neq \mathbf {z}} \mathbf {s} _ {\theta} (\mathbf {z}) _ {\mathbf {z} ^ {\prime}} + \sum_ {\mathbf {z} ^ {\prime} \neq \mathbf {z}} \frac {q _ {t} (\mathbf {z} ^ {\prime} | \mathbf {x})}{q _ {t} (\mathbf {z} | \mathbf {x})} \log \mathbf {s} _ {\theta} (\mathbf {z}) _ {\mathbf {z} ^ {\prime}} - \sum_ {\mathbf {z} ^ {\prime} \neq \mathbf {z}} \frac {q _ {t} (\mathbf {z} ^ {\prime} | \mathbf {x})}{q _ {t} (\mathbf {z} | \mathbf {x})} \log \frac {q _ {t} (\mathbf {z} ^ {\prime} | \mathbf {x})}{q _ {t} (\mathbf {z} | \mathbf {x})} + \sum_ {\mathbf {z} ^ {\prime} \neq \mathbf {z}} \frac {q _ {t} (\mathbf {z} ^ {\prime} | \mathbf {x})}{q _ {t} (\mathbf {z} | \mathbf {x})} \right] +$$ + +Using (55) and (56) we get, + +$$ +\begin{array}{l} = \mathbb {E} _ {t \in [ 0, 1 ], \mathbf {z} \sim q _ {t} (\cdot | \mathbf {x})} \frac {\alpha_ {t} ^ {\prime}}{N \alpha_ {t}} \left[ - \frac {N}{\alpha_ {t} N (\mathbf {x} _ {\theta}) _ {i} + (1 - \alpha_ {t})} + \frac {N}{\alpha_ {t} N \mathbf {x} _ {i} + (1 - \alpha_ {t})} \right] \\ \left. + \sum_ {\mathbf {z} ^ {\prime} \neq \mathbf {z}} \frac {q _ {t} (\mathbf {z} ^ {\prime} | \mathbf {x})}{q _ {t} (\mathbf {z} | \mathbf {x})} \log \mathbf {s} _ {\theta} (\mathbf {z}) _ {\mathbf {z} ^ {\prime}} - \sum_ {\mathbf {z} ^ {\prime} \neq \mathbf {z}} \frac {q _ {t} (\mathbf {z} ^ {\prime} | \mathbf {x})}{q _ {t} (\mathbf {z} | \mathbf {x})} \log \frac {q _ {t} (\mathbf {z} ^ {\prime} | \mathbf {x})}{q _ {t} (\mathbf {z} | \mathbf {x})} \right] \\ \end{array} +$$ + +$$ +\begin{array}{l} = \mathbb {E} _ {t \in [ 0, 1 ], \mathbf {z} \sim q _ {t} (\cdot | \mathbf {x})} \frac {\alpha_ {t} ^ {\prime}}{N \alpha_ {t}} \left[ - \frac {N}{\alpha_ {t} N (\mathbf {x} _ {\theta}) _ {i} + (1 - \alpha_ {t})} + \frac {N}{\alpha_ {t} N \mathbf {x} _ {i} + (1 - \alpha_ {t})} \right. \\ \left. - \sum_ {\mathbf {z} ^ {\prime} \neq \mathbf {z}} \frac {q _ {t} (\mathbf {z} ^ {\prime} | \mathbf {x})}{q _ {t} (\mathbf {z} | \mathbf {x})} \log \left(\frac {1}{\mathbf {s} _ {\theta} (\mathbf {z}) _ {\mathbf {z} ^ {\prime}}} \frac {q _ {t} (\mathbf {z} ^ {\prime} | \mathbf {x})}{q _ {t} (\mathbf {z} | \mathbf {x})}\right) \right] \\ \end{array} +$$ + +Using (53) and (54) we get, + +$$ +\begin{array}{l} = \mathbb {E} _ {t \in [ 0, 1 ], \mathbf {z} \sim q _ {t} (.. | \mathbf {x})} \frac {\alpha_ {t} ^ {\prime}}{N \alpha_ {t}} \left[ \frac {N}{\alpha_ {t} N \mathbf {x} _ {i} + (1 - \alpha_ {t})} - \frac {N}{\alpha_ {t} N (\mathbf {x} _ {\theta}) _ {i} + (1 - \alpha_ {t})} \right. \\ \left. - \sum_ {\mathbf {z} ^ {\prime} \neq \mathbf {z}} \frac {\alpha_ {t} N \mathbf {x} _ {j} + (1 - \alpha_ {t})}{\alpha_ {t} N \mathbf {x} _ {i} + (1 - \alpha_ {t})} \log \left(\frac {\alpha_ {t} N (\mathbf {x} _ {\theta}) _ {i} + (1 - \alpha_ {t})}{\alpha_ {t} N (\mathbf {x} _ {\theta}) _ {j} + (1 - \alpha_ {t})} \cdot \frac {\alpha_ {t} N \mathbf {x} _ {j} + (1 - \alpha_ {t})}{\alpha_ {t} N \mathbf {x} _ {i} + (1 - \alpha_ {t})}\right) \right] \\ \end{array} +$$ + +$$ += \mathrm {N E L B O} _ {\mathrm {U D L M}} +$$ + +# D EXPERIMENTAL DETAILS + +# D.1 DATASET DETAILS + +In this section, we provide more details, e.g., source, train/validation splits, etc., for the the datasets used in this work. For an overview, please see Table 8. + +Species10 This dataset is a composite of reference genomes from ten diverse species: Arabidopsis thaliana, Caenorhabditis elegans, Danio rerio, Drosophila melanogaster, Felis catus, Gallus gallus, Gorilla gorilla, Homo sapiens, Mus musculus, and Salmo trutta, which were downloaded from NCBI refseq database (O'Leary et al., 2016). In Table 9, we provide the assembly accession IDs used to download the reference genomes. Genomes were chunked into non-overlapping segments of 32,768 nucleotides and were tokenized using base-pair-level tokenization. + +Training and validation sets were randomly split using $95\% / 5\%$ . In Table 10, we specify the size and relative species composition of each split. For guidance, we use the species label. This + +Table 8: Relevant details for datasets used in this work. + +
DatasetTokenizerVocab. SizeInput sizePadding?
Species10Base-pair1232,768No
QM9Regex (Schwaller et al., 2019)4032Yes
CIFAR10Binned Pixel Intensity25632×32×3No
text8Character35256No
Amazonbert-base-uncased30,522128Yes
LM1Bbert-base-uncased30,522128Yes
+ +Table 9: Species genomes accession IDs + +
SpeciesAssembly Accession
Arabidopsis thalianaGCF_000001735.4_TAIR10.1
Caenorhabditis elegansGCF_000002985.6_WBcel1235
Danio rerioGCF_000002035.6_GRCz11
Drosophila melanogasterGCF_000001215.4_Release_6_plus_ISO1_MT
Felis catusGCF_018350175.1_F.catus_Fca126_mat1.0
Gallus gallusGCF_016699485.2_bGalGal1.mat.broiler.GRCg7b
Gorilla gorillaGCF_029281585.2_NHGRI_mGorGor1-v2.0_pri
Homo sapiensGCF_000001405.40_GRCh38.p14
Mus musculusGCF_000001635.27_GRCm39
Salmo truttaGCF_901001165.1_fSalTru1.1
+ +dataset is made available here: https://huggingface.co/datasets/yairschiff/ ten_species. + +QM9 Molecules The QM9 dataset comes from Ruddigkeit et al. (2012) and Ramakrishnan et al. (2014). The dataset is comprised of $\sim 133\mathrm{k}$ small molecules. We process the dataset using the RDKit library (Landrum et al., 2013) to extract 'canonical' SMILES string representations and add the annotations for drug-likeness (QED) and ring-counts. The data are tokenized using a regular expression from Schwaller et al. (2019), which is available here: https://huggingface.co/yairschiff/qm9-tokenizer. We used input lengths of 32 tokens (with right-sided padding) for pre-training and generation experiments. + +Training and validation sets were randomly split using $95\%$ / $5\%$ . For guidance, we use a cutoff of $90^{\text{th}}$ percentile for QED / ring count to generate binary labels. This dataset is made available here: https://huggingface.co/datasets/yairschiff/qm9. + +CIFAR10 This widely-used image dataset contains RGB images with $32 \times 32$ pixels per channel. We use the provided train and test splits of 50,000 training images and 10,000 validation images. The dataset contains 10 classes of roughly equal proportion. We tokenize the dataset by rounding to integer pixel intensity values in the range [0, 255]. For guidance, we use the image class label. + +text8 The dataset was downloaded from http://mattmahoney.net/dc/text8.zip. Data was tokenized at the character level using the lower case letters $\left[\mathrm{a}^{\prime}-\mathrm{z}^{\prime}\right]$ and a white-space character. The data was broken into non-overlapping chunks of 256 tokens. + +The first 90M characters were used for the training set and the final 5M characters were used as a validation set. + +Amazon Review The Amazon Review dataset was downloaded from https://huggingface.co/datasets/fancyzhx/amazon_polarity. We tokenize using the bert-base-uncased tokenizer. Sequences were padded to a max input length of 128 tokens. + +Table 10: Species10 train and validation splits statistics. Proportion of each species in the training and validation sets. Overall split size is indicated in parentheses in the column header. + +
SpeciesTrain (95% ≈ 16.5B bps)Validation (5% ≈ 869M bps)
Arabidopsis thaliana0.680.77
Caenorhabditis elegans0.580.58
Danio rerio9.509.29
Drosophila melanogaster0.080.73
Felis catus13.9414.05
Gallus gallus6.045.93
Gorilla gorilla20.4020.19
Homo sapiens18.8919.22
Mus musculus15.6915.60
Salmo trutta13.4913.64
+ +Train and validation splits were used from the downloaded data, with $3.6\mathrm{M}$ sequences in the training data and 400k sequences in the validation set. + +LM1B This dataset was downloaded from https://huggingface.co/datasets/billion-word-benchmark/lmlb. We tokenize using the bert-base-uncased tokenizer. Sequences were padded to a max input length of 128 tokens. + +We use the train and validation splits provided in the downloaded data. After chunking the data, our training set consisted of 7M sequences and our validation set consisted of 72k sequences. + +# D.2 ARCHITECTURAL DETAILS + +In Table 11, we provide an overview of the architectures and parameter counts of the models used for each dataset. + +Table 11: Architectures used when training on various datasets. + +
DatasetArchitectureParameter Count
Species10Mamba (AR) / Caduceus (Diffusion)3.5 M (AR) / 4.8 M (Diffusion)
QM9Transformer92.4 M
CIFAR10UNet35.8 M
Text8Transformer92.4 M
AmazonTransformer139 M
LM1BTransformer139 M
+ +Genomics Caduceus For the Species10 experiments, we use Mamba-based models (Gu & Dao, 2023). The AR model is a standard next-token-prediction Mamba backbone with 8 blocks and hidden dimension 256. For the diffusion models we train with a variant of the Caduceus architecture from Schiff et al. (2024), also with 8 blocks and hidden dimension 256. Specifically, we use the non-reverse complementary equivariant version of Caduceus, dubbed Caduceus-Ph in Schiff et al. (2024), which is similar to the AR Mamba, but with bi-directional Mamba blocks that use strategic weight tying to limit the parameter count: $3.5\mathrm{M}$ parameters of AR vs. $4.8\mathrm{M}$ for diffusion models. + +CIFAR10 UNet We adopt the UNet (Ronneberger et al., 2015) as a main backbone for both MDLM and UDLM, following (Ho et al., 2020). Network configurations are presented in Table 12. Specifically, we follow Austin et al. (2021) and Campbell et al. (2022) and use the original UNet backbone from DDPM (Ho et al., 2020), adding an extra discretized truncated logistic transformation to network outputs. To enable conditioning on labels, we add a label embedding layer which is added to the time embeddings, inspired by ADM network (Dhariwal & Nichol, 2021b). + +Table 12: Architecture details for CIFAR10 UNet. + +
MDLMUDLM
Vocab size258256
Number of ResNet blocks per scale22
Base channels128128
Channel multiplier per scale(1,2,2,2)(1,2,2,2)
Attention resolutions1616
Time conditioningFalseTrue
Conditional embedding dimension128128
Number of Params35.8M35.8M
+ +QM9 and NLP Transformer For both the QM9 and NLP datasets (Amazon, text8, and LM1B), we use the same Diffusion Transformer (Peebles & Xie, 2023) with adaLN for conditioning on time (for uniform noise diffusion models) and class (for guided generation). The Transformer for each dataset differs only in the word-embedding size, which is determined by the vocabulary size of the datasets' corresponding tokenizer. Our Transformer consists of 12 layers, a hidden dimension of 768, and 12 attention heads. We use RoPE (Su et al., 2021) as the positional embeddings. + +# D.3 TRAINING CONFIGURATIONS + +In Table 13, we detail the hyperparameter setup for each of the language modeling experiments in Section 5.1. + +All diffusion models were trained and evaluated using a log-linear noise schedule. + +Of note, for CIFAR10, our models are trained for 300K iterations as opposed to 1.5M iterations, as in D3PM (Austin et al., 2021). + +Table 13: Training hyper-parameters for all included experiments. + +
Species10QM9CIFAR10text8AmazonLM1B
Train steps30K25K300K1000K184K1000K
Context size32,7683232×32×3256128128
Batch size322048512512512512
LR2e-33e-42e-43e-43e-43e-4
Optim.ADAM (0.9, 0.999)ADAM (0.9, 0.999)ADAM (0.9, 0.999)ADAM (0.9, 0.999)ADAM (0.9, 0.999)ADAM (0.9, 0.999)
LR sched.Cosine decay 3e-6 min.Cosine decay 3e-6 min.----
LR warmup steps3K1K5K2.5K2.5K2.5K
GPU count848888
GPU typeA5000A6000A100A100A5000A100
+ +# D.4 GUIDANCE DETAILS + +# D.4.1 BASELINES + +FUDGE Implementation FUDGE is a classifier-based autoregressive guidance method proposed by Yang & Klein (2021). FUDGE first trains a classifier on all possible prefixes. Instead of directly sampling from $p(\mathbf{x}^{(\ell)} \mid \mathbf{x}^{(1:\ell - 1)})$ , FUDGE samples from the perturbed conditional distribution $p(y \mid \mathbf{x}^{(1:\ell)}) p(\mathbf{x}^{(\ell)} \mid \mathbf{x}^{(1:\ell - 1)})$ where $y$ denotes the classifier label, $\mathbf{x}^{(1:\ell - 1)}$ denotes the already + +decoded tokens and $\mathbf{x}^{(\ell)}$ stands for possible token to be generated. For efficiency, FUDGE truncates $\mathbf{x}^{(\ell)}$ to the topk tokens with the largest unconditional log-likelihood. Although not in the original FUDGE formulation, following the classifier-based guidance in diffusion models (Dhariwal & Nichol (2021b)), we introduce the temperature variable $\gamma$ and sample from the perturbed distribution: + +$$ +\frac {p \left(\mathbf {x} ^ {(\ell)} \mid \mathbf {x} ^ {(1 : \ell - 1)}\right) p ^ {\gamma} (y \mid \mathbf {x} ^ {(1 : \ell)})}{\sum_ {\mathbf {x} ^ {(\ell)}} p \left(\mathbf {x} ^ {(\ell)} \mid \mathbf {x} ^ {(1 : \ell - 1)}\right) p ^ {\gamma} (y \mid \mathbf {x} ^ {(1 : \ell)})} +$$ + +In our QM9 experiments, topk is set as the vocabulary size, which is 40. When training the classifier, we use a smaller classification model using the same dataset specified in Appendix D.1. The smaller backbone DiT consists of 8 layers, 8 attention heads, and a hidden dimension of 512. We use the same hyperparameters as those specified in Table 13. + +PPLM Implementation Inspired by the approximate Metropolis-adjusted Langevin (MALA), Plug and Play language model (PPLM; Dathathri et al. (2019)) introduces guidance by conducting gradient updates on the hidden representations of a language model. PPLM first rewrites the autoregressive language models' decoding process using the KV-cache mechanism (Wolf et al., 2020): $\mathbf{x}_{t + 1},H_{t + 1} = LM(\mathbf{x}_t,H_t)$ , where $\mathbf{x}_t$ denotes the token at time step $t$ and $H_{t}$ is defined as $[(K_{t}^{(1)},V_{t}^{(1)}),\dots,(K_{t}^{(l)},V_{t}^{(l)}]$ in which $l$ is the number of layers. When decoding the token $\mathbf{x}_{t + 1}$ at time step $t + 1$ , PPLM initializes the perturbation term $\Delta H_{t}$ as 0, and then performs $n$ updates, following the gradient ascend formula: + +$$ +\Delta H _ {t} \leftarrow \Delta H _ {t} + \eta \frac {\nabla_ {\Delta H _ {t}} [ \log (p (y \mid H _ {t} + \Delta H _ {t})) - \gamma_ {K L} D _ {K L} (p (\mathbf {x} _ {t + 1} \mid H _ {t} + \Delta H _ {t}) | | p (\mathbf {x} _ {t + 1} \mid H _ {t})) ]}{\| \nabla_ {\Delta H _ {t}} [ \log (p (y \mid H _ {t} + \Delta H _ {t})) - \gamma_ {K L} D _ {K L} (p (\mathbf {x} _ {t + 1} \mid H _ {t} + \Delta H _ {t}) | | p (\mathbf {x} _ {t + 1} \mid H _ {t}))) \|}. +$$ + +PPLM then generates the perturbed probability distribution $p_{perb}(\mathbf{x}_{t+1} \mid H_t + \Delta H_t)$ using $H_t + \Delta H_t$ and decodes $\mathbf{x}_{t+1}$ using the fused probability distribution $\frac{1}{\beta} p_{perb}^{\gamma_{gm}}(\mathbf{x}_{t+1} \mid H_t + \Delta H_t) p_{unperb}^{1 - \gamma_{gm}}(\mathbf{x}_{t+1} \mid H_t)$ , where $\beta$ is the normalization factor. Following Dathathri et al. (2019), in our experiments $\gamma_{kl}$ is set as 0.01 and $\gamma_{gm}$ is set as 0.95. $\eta$ and $n$ are decided by grid search. + +For the QM9 experiments, when training the classifier for PPLM, we use the same dataset specified in Appendix D.1. We use the same hyperparameters as those specified in Table 13, except the LR peak is reduced to $3\mathrm{e}^{-5}$ and minimum is reduced to $3\mathrm{e}^{-7}$ . + +NOS Implementation To implement the NOS baseline from Gruver et al. (2024), we train a classifier where we use the same backbone as the unconditional diffusion model (see Appendix D.2 for architecture details), and we initialize and freeze weights using the pre-trained unconditional diffusion model. We then mean pool the last hidden embeddings of the backbone and linearly project them to the classification logits. This final projection layer represents the only trainable parameters of the guidance model. + +At inference, we perform Langevin sampling following Algorithm 2 from Gruver et al. (2024). In our experiments, we denote step-size for the Langevin sampling by $\eta$ , the number of steps by $n$ , and the weight on the 'stability' / 'fluency' KL penalty by $\gamma_{kl}$ . + +For the QM9 experiments, when training the classifier for NOS, we use the same dataset specified in Appendix D.1. We use the same hyperparameters as those specified in Table 13, except the LR peak is reduced to $3\mathrm{e}^{-5}$ and minimum is reduced to $3\mathrm{e}^{-7}$ . + +# D.4.2 D-CFG DETAILS + +When implementing D-CFG we train a single AR / discrete diffusion model (see Appendix D.2 for architecture details) where we randomly drop out the class condition by replacing it with a class [MASK] token. The class condition is fused into models using the implementation of adaptive layer norm from Peebles & Xie (2023). We use $10\%$ rate for masking / dropping-out the condition. + +At inference time, we perform two forward passes through the model, one with condition provided to compute the conditional probability $p_{\theta}(\mathbf{z}_s \mid \mathbf{z}_t, y)$ and one where the condition is masked to compute the unconditional probability $p_{\theta}(\mathbf{z}_s \mid \mathbf{z}_t)$ . These values are then used as described in Section 3.1. + +# D.4.3 D-CBG DETAILS + +For D-CBG in the QM9 experiment, we train a smaller classification model using the same dataset specified in Appendix D.1. The smaller backbone DiT consists of 8 layers, 8 attention heads, and a hidden dimension of 512. We apply mean pooling on the final hidden representations before linearly projecting to the classification logits. We use the same hyperparameters as those specified in Table 13. + +We train the model on noised inputs using a log-linear schedule, where the type of corruption applied corresponds to the diffusion model to which guidance is applied. + +# D.5 GUIDANCE EVALUATION DETAILS + +# D.5.1 GENOMIC SEQUENCES METRICS + +Below we describe the quality and control metrics used in the species-specific genome generation experiment. + +$k$ -mer JS To compute the $k$ -mer distribution shift, for each species, we create counts for each of the unique 3mers and 6mers for that species in the validation set and 64 generated sequences for that species. We then compute the Jensen-Shannon divergence between those categorical histograms. Finally we take a weighted average of these distances across species where the weights are given by the relative species proportion in the validation dataset. See Table 10 for the relative proportions. + +Discriminator AUROC For the discriminator AUROC metric, we train a HyenaDNA model with 2 layers and hidden dimension 128. This model was downloaded from https://huggingface.co/LongSafari/hyenadna-small-32k-seqlen-hf, modified (we reduced the number of layers and hidden dimension), and initialized from scratch. We mean pool the final layer embeddings and linearly project them to the binary classification logits. The model is trained on the 640 generated sequences, which are labeled as the negative class, and 640 randomly selected sequences from the ground truth validation set (64 sequences per species), which are labeled as the positive class. This dataset of 1,280 sequences is randomly split into $95\%$ train and $5\%$ validation. The discriminator is trained with batch size of 8, learning rate of $1\mathrm{e}^{-4}$ , and the ADAM optimizer for 5 epochs to minimize binary cross entropy loss on the classification of real vs. generated sequences. We report the AUROC from the final epoch on the $5\%$ validation split of this classification dataset. + +Oracle F1 Finally, controllability is measured by the macro-averaged F1 of an oracle model on the 640 generated sequences. Our oracle model is a separate HyenaDNA model with 8 layers and hidden dimension 256, which has 6.6M parameters. This model was downloaded and initialized from scratch from https://huggingface.co/LongSafari/hyenadna-small-32k-seqlen-hf. We mean pool the final layer embeddings and linearly project them to the ten category classification logits. This model was trained on the full Species10 dataset as described in Appendix D.1. For reference, in Table 14 we present the classification results of the this oracle model on the $5\%$ validation set of the original data. We see that other than difficulty distinguishing between human and gorilla genomes, the model can serve as a near perfect oracle. + +# D.5.2 CIFAR10 QUALITY METRICS + +For evaluation, we randomly samples 50,000 images for each model and the tools provided here: https://github.com/w86763777/pytorch-image-generation-metrics.git, as described in Campbell et al. (2022). + +FID Fréchet inception distance (Heusel et al., 2017) is a common metric in image generation where the divergence between real and generated data is measured to reflect the alignment of two distributions. The metric uses features extracted from a pretrained Inception-v3 model on ImageNet-1K to estimate the mean and variance of the input data. The difference of two multi-dimensional Gaussian distributions is measured by Wasserstein-2 distance or Fréchet distance $d(\cdot)$ as follows: + +Table 14: Evaluation of HyenaDNA 'oracle' classifier on Species10 validation split. + +
SpeciesPrecisionRecallF1
Arabidopsis thaliana1.000.991.00
Caenorhabditis elegans1.001.001.00
Danio rerio1.001.001.00
Drosophila melanogaster1.001.001.00
Felis catus1.001.001.00
Gallus gallus1.001.001.00
Gorilla gorilla0.630.450.52
Homo sapiens0.540.720.62
Mus musculus1.000.970.98
Salmo trutta1.000.980.99
+ +$$ +\begin{array}{l} F I D = d (\mathcal {N} (\mu_ {\text {r e a l}}, \Sigma_ {\text {r e a l}}), \mathcal {N} (\mu_ {\text {f a k e}}, \Sigma_ {\text {f a k e}})) = \| \mu_ {\text {r e a l}} - \mu_ {\text {f a k e}} \| + \\ \| \mathrm {T r} (\Sigma_ {\text {r e a l}} + \Sigma_ {\text {f a k e}} - 2 (\Sigma_ {\text {r e a l}} \Sigma_ {\text {f a k e}}) ^ {0. 5}) \| \quad (5 7) \\ \end{array} +$$ + +IS Inception Score (Salimans et al., 2016) is an alternative measure of how well generated images are aligned with human judgement. IS also utilizes Inception-v3 model to compute label distribution $p(y|x)$ for each generated image. IS focuses on two criteria: (1) A generated image should contain a distinct class object, meaning its label distribution is expected to have low entropy; (2) The generated images should vary across multiple classes, so the marginal distribution, $p(y) = \int_z p(y|G(z))dz$ , is expected to have high entropy, ideally approaching a uniform distribution. The formula is presented as below: + +$$ +I S = \exp \left[ \mathbb {E} _ {x} \mathrm {K L} (p (y | x) \| p (y)) \right], \tag {58} +$$ + +F1 F1 is used as a proxy for satisfying the desired conditional generation of generated samples by a pre-trained classifier on CIFAR10. We use a pretrained Vision Transformer model downloaded from https://huggingface.co/edadaltocg/vit_basePatch16_224_in21k_ft_cifar10 and fine-tuned on CIFAR10. + +# D.5.3 QM9 GUIDANCE METRICS + +For the guidance experiments in QM9, we generate 2,048 sequences of length 32. The reported metrics are explained below. + +Validity Validity is measured by whether the generated SMILES string can be parsed by the RDKit library (Landrum et al., 2013). Any strings that fail to be parsed are counted as invalid. + +Novelty Novelty is measured by the number of valid and unique sequences that are not present in the original QM9 dataset. + +Property Mean / Median Finally, we also report the mean and median of the novel generated sequence for the property of interest, QED or ring count. These quantities are computed using the RDKit library. + +# E GUIDANCE ABLATION RESULTS + +# E.1 EFFECT OF VARYING GUIDANCE HYPERPARAMETERS + +For each of the guidance experiments, we perform a hyerparameter search on the guidance parameters, e.g., $\gamma$ in D-CFG and D-CBG. Below we present results from these searches for the various guidance experiments. + +Species-specific Genome Generation In this experiment we vary $\gamma \in \{1,2,3\}$ for D-CFG applied to AR, MDLM, and UDLM. Additionally, for MDLM and UDLM we vary the number of sampling steps $T \in \{128,256,512\}$ . + +Results presented in Table 15 highlight that UDLM is more amenable to guidance than either AR or MDLM in this setting. UDLM achieves better quality and control metrics, and AR and MDLM performance degrades as $\gamma$ , this is not the case for UDLM. + +Table 15: Varying $\gamma$ for species-specific generation with AR, MDLM, UDLM using D-CFG. Mean $\pm$ standard deviation reported from repeated generation of 640 sequences (64 per species) using five different random seeds. + +
D-CFGγT3-mer JS (↓)6-mer JS (↓)Disc. AUROC (↓)F1 (↑)
AR
132,7680.03 ± 0.0020.07 ± 0.0040.53 ± 0.0750.87 ± 0.011
232,7680.05 ± 0.0030.12 ± 0.0040.90 ± 0.0510.81 ± 0.009
332,7680.07 ± 0.0020.15 ± 0.0020.97 ± 0.0180.74 ± 0.022
MDLM
11280.02 ± 0.0010.06 ± 0.0010.51 ± 0.0730.88 ± 0.01
12560.02 ± 0.0020.06 ± 0.0030.55 ± 0.0390.88 ± 0.006
15120.02 ± 0.0010.06 ± 0.0010.51 ± 0.0590.88 ± 0.011
21280.06 ± 0.0010.11 ± 0.0030.71 ± 0.0130.90 ± 0.011
22560.05 ± 0.0010.10 ± 0.0020.77 ± 0.0270.91 ± 0.009
25120.05 ± 0.0010.11 ± 0.0030.74 ± 0.0370.91 ± 0.009
31280.12 ± 0.0020.20 ± 0.0030.94 ± 0.0310.78 ± 0.009
32560.11 ± 0.0020.19 ± 0.0050.91 ± 0.0250.78 ± 0.01
35120.11 ± 0.0040.20 ± 0.0050.93 ± 0.0310.78 ± 0.007
UDLM
11280.02 ± 0.0010.05 ± 0.0010.55 ± 0.0410.90 ± 0.006
12560.02 ± 0.0020.06 ± 0.0020.56 ± 0.0420.91 ± 0.006
15120.02 ± 0.0020.06 ± 0.0030.52 ± 0.0440.91 ± 0.01
21280.05 ± 0.0030.12 ± 0.0040.52 ± 0.020.92 ± 0.006
22560.05 ± 0.0020.13 ± 0.0040.59 ± 0.0430.91 ± 0.005
25120.05 ± 0.0020.13 ± 0.0020.61 ± 0.0430.93 ± 0.009
31280.08 ± 0.0030.19 ± 0.0040.80 ± 0.0480.93 ± 0.009
32560.08 ± 0.0020.20 ± 0.0040.81 ± 0.0840.92 ± 0.005
35120.08 ± 0.0020.20 ± 0.0030.87 ± 0.0510.94 ± 0.007
+ +QM9 In this section, we list the hyperparameter grid search results for QM9 drug likeliness (QED) maximization using + +- AR D-CFG (Table 16), AR FUDGE (Table 17), AR PPLM (Table 18), +- MDLM D-CFG (Table 19), MDLM D-CBG (Table 20), MDLM NOS (Table 21), +- UDLM D-CFG (Table 22), UDLM D-CBG (Table 23), and UDLM NOS (Table 24). + +We also list the grid search results for QM9 ring count maximization guidance results with + +- AR D-CFG (Table 25), AR FUDGE (Table 26) AR PPLM (Table 27), +- MDLM D-CFG (Table 28) MDLM D-CBG (Table 29), MDLM NOS (Table 30), +- UDLM D-CFG (Table 31), UDLM D-CBG (Table 32), UDLM NOS (Table 33). + +CIFAR10 In Table 34, we explore the effect of $\gamma \in 1,2,3,4,5$ in conditional image generation. For this table, we use $T = 1000$ . We find that increasing $\gamma$ generally leads to better IS and F1 scores for both MDLM and UDLM. For FID, MDLM achieves better scores as $\gamma$ increases. However, the impact of $\gamma$ is weaker for UDLM, as the model's FID score worsens when $\gamma$ exceeds 2. We also plot + +Table 16: Varying $\gamma$ for maximizing drug-likeness (QED) guidance with AR D-CFG. Validity, novelty, and mean QED for novel sequences are reported. Mean $\pm$ standard deviation reported from repeated generation of 1,024 sequences using five different random seeds. The setting reported in the main paper is bolded. + +
γNum. Valid (↑)Num. Novel (↑)QED Mean (↑)
11013.0 ± 4.982.6 ± 2.970.57 ± 0.00
21001.4 ± 5.3779.2 ± 9.340.59 ± 0.00
3946.4 ± 8.9979.4 ± 6.350.60 ± 0.00
4777.2 ± 15.3986.8 ± 8.730.59 ± 0.00
5591.8 ± 10.4377.8 ± 9.120.58 ± 0.00
+ +Table 17: Varying $\gamma$ for maximizing drug-likeness (QED) guidance with AR FUDGE. Validity, novelty, and mean QED for novel sequences are reported. Mean $\pm$ standard deviation reported from repeated generation of 1,024 sequences using five different random seeds. The setting reported in the main paper is bolded. + +
γNum. Valid (↑)Num. Novel (↑)QED Mean (↑)
1998.4 ± 3.21113.0 ± 7.180.56 ± 0.00
2985.2 ± 6.4688.8 ± 5.50.58 ± 0.01
3973.8 ± 4.9790.8 ± 7.660.59 ± 0.00
4963.4 ± 8.5386.4 ± 14.050.59 ± 0.00
5949.6 ± 10.7174.6 ± 9.070.60 ± 0.00
6935.0 ± 9.3364.6 ± 7.090.60 ± 0.00
7924.4 ± 12.0553.0 ± 3.540.61 ± 0.00
8902.8 ± 16.0846.6 ± 4.040.62 ± 0.00
9876.6 ± 13.0334.8 ± 3.630.62 ± 0.01
10873.8 ± 11.2129.2 ± 2.770.62 ± 0.01
+ +visual outputs of different $\gamma$ in Figure 4. As $\gamma$ is increased, the appearance and the shape of a class object become more refined and sharpened. + +# E.2 EFFECT OF USING FIRST ORDER APPROXIMATION IN D-CBG + +The data for this analysis is available in Tables 20, 23, 29, and 32. We present it graphically in Figure 5. In these plots, we use $T = 32$ for diffusion generation. + +QED We see that for drug-likeness (QED) maximization, using the full D-CBG without the first order approximation leads to a boost in performance for both MDLM and UDLM. + +Ring Count When maximizing ring count, we again find that for UDLM, not relying on the first order approximation improves performance with both more novel molecule generation and higher ring counts. For MDLM, however, we observe instability for $\gamma > 1$ , as the model tends to decode the full sequence early on in the generation process and cannot recover from mistakes. The first order approximation for MDLM does not appear to suffer from this same instability. + +# E.3 EFFECT OF VARYING $T$ + +Species10 In Table 15, we see the effect of increasing $T$ on the genomic sequence generation. In this setting $T \in \{128, 256, 512\}$ is orders of magnitude smaller than sequence length $L = 32768$ . We see a positive relationship between decoding steps and sample quality for both MDLM and UDLM. + +QM9 In Figure 6, we see that for both properties (QED and ring count), MDLM benefits significantly from increasing $T$ . In contrast, UDLM appears to have more consistent results across varying + +Table 18: Varying $n$ (the number of Langevin steps) and $\eta$ (the step size) for maximizing drug-likeness (QED) guidance with AR PPLM. Validity, novelty, and mean QED for novel sequences are measured for generated sequences from each method. Mean $\pm$ standard deviation reported from repeated generation of 1,024 sequences using five different random seeds. The setting reported in the main paper is bolded. + +
nηNum. Valid (↑)Num. Novel (↑)Novel QED Mean (↑)
100.0401009.6 ± 2.61140.4 ± 18.190.46 ± 0.01
100.1001008.8 ± 2.17138.4 ± 17.240.46 ± 0.01
300.0401008.8 ± 2.77137.8 ± 16.830.45 ± 0.00
300.1001007.2 ± 2.28142.0 ± 14.20.45 ± 0.00
+ +Table 19: Varying $\gamma$ for maximizing drug-likeness (QED) guidance with MDLM D-CFG. Validity, novelty, and mean QED for novel sequences are reported. Mean $\pm$ standard deviation reported from repeated generation of 1,024 sequences using five different random seeds. The setting reported in the main paper is bolded. + +
γNum. Valid (↑)Num. Novel (↑)Novel QED Mean (↑)
1561.0 ± 6.08182.8 ± 10.520.56 ± 0.00
2449.8 ± 8.7142.8 ± 8.470.59 ± 0.01
3317.4 ± 11.595.8 ± 9.040.60 ± 0.01
4226.0 ± 10.3479.0 ± 6.360.59 ± 0.01
5163.4 ± 7.8668.4 ± 3.580.59 ± 0.01
+ +number of decoding steps. Note that for the D-CBG results in this section we do not use the first order approximation for maximizing QED and we do use it for maximizing ring count. + +CIFAR10 In Table 35, we present additional $T$ beyond those presented in Table 7 in Section 5.2. As discussed in the main paper results, we find that UDLM is able to accommodate this faster inference setting better than MDLM, owing to the ability of UDLM to recover from 'mistakes.' + +# F UNCONDITIONAL SAMPLE GENERATION + +In this section, we evaluate unconditional samples generated from models trained on LM1B. In Table 36, we report generative perplexity for 1,024 unconditionally generated sequences. We use GPT-2 Large (Radford et al., 2019) downloaded from https://huggingface.co/openai-community/gpt2-large to compute generative perplexity. In Table 37, we present random examples of sample generation. + +Table 20: Varying $\gamma$ for maximizing drug-likeness (QED) guidance with MDLM D-CBG. We also report results for both using the first order approximation and not using it. Validity, novelty, and mean QED for novel sequences are reported. Mean $\pm$ standard deviation reported from repeated generation of 1,024 sequences using five different random seeds. The setting reported in the main paper is bolded. + +
γUse Approx.Num. Valid (↑)Num. Novel (↑)Novel QED Mean (↑)
1False526.4 ± 16.53170.8 ± 14.690.56 ± 0.00
1True476.0 ± 15.23221.4 ± 7.570.46 ± 0.01
2False524.8 ± 22.04139.0 ± 11.790.58 ± 0.00
2True363.4 ± 17.57172.4 ± 9.420.47 ± 0.01
3False417.6 ± 19.69116.6 ± 8.910.58 ± 0.00
3True244.0 ± 13.38114.0 ± 6.160.47 ± 0.01
4False200.4 ± 10.3166.4 ± 7.70.58 ± 0.00
4True174.6 ± 11.2683.6 ± 3.510.49 ± 0.02
5False24.6 ± 3.2111.6 ± 2.30.58 ± 0.01
5True120.6 ± 6.6948.4 ± 5.410.50 ± 0.01
6False0.2 ± 0.450.2 ± 0.450.12 ± 0.26
6True96.4 ± 4.0435.0 ± 5.240.50 ± 0.02
7False0.0 ± 0.000.0 ± 0.000.00 ± 0.00
7True85.4 ± 9.8128.6 ± 5.320.51 ± 0.01
8False0.0 ± 0.000.00 ± 0.000.00 ± 0.00
8True77.0 ± 8.6324.8 ± 6.760.55 ± 0.01
9False0.0 ± 0.000.0 ± 0.000.00 ± 0.00
9True71.2 ± 10.9421.6 ± 6.730.55 ± 0.01
10False0.0 ± 0.000.0 ± 0.000.00 ± 0.00
10True72.6 ± 7.1321.2 ± 1.790.55 ± 0.02
+ +$$ +\gamma = 1 \quad \boxed { \begin{array}{c c c c c c c c c} \end{array} } +$$ + +$$ +\gamma = 2 \quad \text {图} +$$ + +$$ +\gamma = 3 \quad \begin{array}{c c c c c c c c c} & & & & & & & \\ & & & & & & & \\ & & & & & & & \\ & & & & & & & \\ & & & & & & & \\ & & & & & & & \\ & & & & & & & \\ & & & & & & & \\ +$$ + +$$ +\gamma = 4 \quad \begin{array}{c c c c c c c c c} & & & & & & & & \\ & & & & & & & & \\ & & & & & & & & \\ & & & & & & & & \\ & & & & & & & & \\ & & & & & & & & \\ & & & & & & & & \\ \end{array} +$$ + +$$ +\begin{array}{c c} \text {M D L M} & \text {U D L M} \\ \hline \end{array} +$$ + +Figure 4: Illustration of varying $\gamma$ on CIFAR10. + +Table 21: Varying $n$ (the number of Langevin steps), $\eta$ (the step size),and ${\gamma }_{kl}$ (the stability regularization coefficient) for maximizing drug-likeness (QED) guidance with MDLM NOS. Validity, novelty, and mean ring count for novel sequences are measured for generated sequences from each method. Mean $\pm$ standard deviation reported from repeated generation of 1,024 sequences using five different random seeds. The setting reported in the main paper is bolded. + +
nηγklNum. Valid (↑)Num. Novel (↑)Novel QED Mean (↑)
10.0010.000509.4 ± 23.78238.2 ± 8.870.45 ± 0.00
10.0010.001509.4 ± 23.78238.2 ± 8.870.45 ± 0.00
10.0010.010509.4 ± 23.78238.2 ± 8.870.45 ± 0.00
10.0100.000510.00 ± 24.24238.8 ± 7.820.45 ± 0.00
10.0100.001509.4 ± 24.15238.6 ± 7.770.45 ± 0.00
10.0100.010509.4 ± 24.15238.6 ± 7.770.45 ± 0.00
10.1000.000507.4 ± 29.98240.2 ± 14.820.45 ± 0.00
10.1000.001507.4 ± 29.98240.2 ± 14.820.45 ± 0.00
10.1000.010507.4 ± 29.98240.2 ± 14.820.45 ± 0.00
11.0000.000461.0 ± 29.21233.2 ± 15.160.44 ± 0.00
11.0000.001461.0 ± 29.21233.2 ± 15.160.44 ± 0.00
11.0000.010461.0 ± 29.21233.2 ± 15.160.44 ± 0.00
15.0000.000185.8 ± 8.23127.0 ± 8.250.42 ± 0.01
15.0000.001185.8 ± 8.23127.0 ± 8.250.42 ± 0.01
15.0000.010185.8 ± 8.23127.0 ± 8.250.42 ± 0.01
50.0010.000509.4 ± 24.67237.0 ± 9.670.45 ± 0.00
50.0010.001509.4 ± 24.67237.0 ± 9.670.45 ± 0.00
50.0010.010509.4 ± 24.67237.0 ± 9.670.45 ± 0.00
50.0100.000509.2 ± 26.2238.4 ± 8.790.45 ± 0.01
50.0100.001509.2 ± 26.2238.4 ± 8.790.45 ± 0.01
50.0100.010509.2 ± 26.2238.4 ± 8.790.45 ± 0.01
50.1000.000505.6 ± 29.52239.8 ± 16.360.45 ± 0.01
50.1000.001505.6 ± 29.52239.8 ± 16.360.45 ± 0.01
50.1000.010506.0 ± 29.45240.4 ± 16.010.45 ± 0.01
51.0000.000461.0 ± 29.21233.2 ± 15.160.44 ± 0.00
51.0000.001461.6 ± 28.4233.2 ± 14.770.44 ± 0.00
51.0000.010459.8 ± 28.6231.2 ± 13.720.44 ± 0.00
55.0000.000185.8 ± 8.23127.0 ± 8.250.42 ± 0.01
55.0000.001186.2 ± 8.98127.2 ± 8.790.42 ± 0.01
55.0000.010186.0 ± 9.59127.0 ± 9.460.42 ± 0.01
100.0010.000509.6 ± 25.58238.0 ± 9.770.45 ± 0.00
100.0010.001509.0 ± 25.46237.4 ± 9.560.45 ± 0.00
100.0010.010509.0 ± 25.46237.4 ± 9.560.45 ± 0.00
100.0100.000508.2 ± 25.77238.4 ± 11.080.45 ± 0.00
100.0100.001508.2 ± 25.77238.4 ± 11.080.45 ± 0.00
100.0100.010508.2 ± 25.77238.4 ± 11.080.45 ± 0.00
100.1000.000504.2 ± 26.75238.2 ± 14.810.45 ± 0.01
100.1000.001505.0 ± 26.84238.8 ± 15.250.45 ± 0.01
100.1000.010504.2 ± 26.75238.2 ± 14.810.45 ± 0.01
101.0000.000461.0 ± 29.21233.2 ± 15.160.44 ± 0.00
101.0000.001461.0 ± 28.31232.8 ± 14.080.44 ± 0.00
101.0000.010460.6 ± 28.41231.8 ± 12.990.45 ± 0.00
105.0000.000185.8 ± 8.23127.0 ± 8.250.42 ± 0.01
105.0000.001186.4 ± 7.92127.4 ± 7.960.42 ± 0.01
105.0000.010190.4 ± 10.48130.4 ± 9.630.42 ± 0.01
+ +Table 22: Varying $\gamma$ for maximizing drug-likeness (QED) guidance with UDLM D-CFG. Validity, novelty, and mean QED for novel sequences are reported. Mean $\pm$ standard deviation reported from repeated generation of 1,024 sequences using five different random seeds. The setting reported in the main paper is bolded. + +
γNum. Valid (↑)Num. Novel (↑)Novel QED Mean (↑)
11003.4 ± 5.4682.0 ± 15.280.57 ± 0.00
21017.6 ± 1.8264.2 ± 3.960.60 ± 0.00
31017.2 ± 0.8461.2 ± 7.190.61 ± 0.00
41019.0 ± 1.4161.6 ± 9.130.61 ± 0.00
51013.6 ± 2.5164.0 ± 5.10.62 ± 0.00
+ +Table 23: Varying $\gamma$ for maximizing drug-likeness (QED) guidance with UDLM D-CBG. We also report results for both using the first order approximation and not using it. Validity, novelty, and mean QED for novel sequences are reported. Mean $\pm$ standard deviation reported from repeated generation of 1,024 sequences using five different random seeds. The setting reported in the main paper is bolded. + +
γUse Approx.Num. Valid (↑)Num. Novel (↑)Novel QED Mean (↑)
1False933.4 ± 7.5134.6 ± 7.330.53 ± 0.01
1True996.4 ± 5.86132.2 ± 8.870.47 ± 0.01
2False911.2 ± 8.14119.8 ± 16.470.57 ± 0.01
2True974.8 ± 8.26110.6 ± 9.530.49 ± 0.01
3False941.0 ± 11.3196.4 ± 8.820.58 ± 0.01
3True925.0 ± 8.09111.4 ± 9.560.51 ± 0.01
4False961.8 ± 7.9877.0 ± 7.550.59 ± 0.00
4True866.4 ± 17.6793.8 ± 10.280.52 ± 0.00
5False967.6 ± 1.5277.8 ± 10.830.59 ± 0.01
5True828.2 ± 17.8586.2 ± 13.010.53 ± 0.01
6False976.2 ± 7.9278.6 ± 12.920.60 ± 0.00
6True821.0 ± 11.2279.8 ± 7.190.54 ± 0.00
7False982.4 ± 3.2173.8 ± 6.910.60 ± 0.00
7True798.6 ± 5.6482.2 ± 7.660.55 ± 0.00
8False986.4 ± 4.9866.6 ± 8.530.61 ± 0.01
8True789.8 ± 15.0969.2 ± 6.760.55 ± 0.01
9False992.8 ± 6.368.0 ± 1.220.61 ± 0.00
9True798.4 ± 11.0668.2 ± 10.50.57 ± 0.01
10False994.8 ± 2.8663.8 ± 8.110.61 ± 0.00
10True783.2 ± 13.8867.0 ± 3.080.56 ± 0.01
+ +Table 24: Varying $n$ (the number of Langevin steps), $\eta$ (the step size),and ${\gamma }_{kl}$ (the stability regularization coefficient) for maximizing drug-likeness (QED) guidance with UDLM NOS. Validity, novelty, and mean ring count for novel sequences are measured for generated sequences from each method. Mean $\pm$ standard deviation reported from repeated generation of 1,024 sequences using five different random seeds. The setting reported used in the main paper is bolded. + +
nηγklNum. Valid (↑)Num. Novel (↑)Novel QED Mean (↑)
10.0010.0001000.8 ± 2.77145.6 ± 8.440.46 ± 0.00
10.0010.0011000.8 ± 2.77145.6 ± 8.440.46 ± 0.00
10.0010.0101000.8 ± 2.77145.8 ± 8.040.46 ± 0.00
10.0100.0001001.0 ± 3.0147.0 ± 7.810.46 ± 0.01
10.0100.0011001.0 ± 3.0147.0 ± 7.810.46 ± 0.01
10.0100.0101001.0 ± 3.0147.0 ± 7.810.46 ± 0.01
10.1000.000999.2 ± 4.6146.4 ± 6.880.46 ± 0.01
10.1000.001999.2 ± 4.6146.4 ± 6.880.46 ± 0.01
10.1000.010999.2 ± 4.6146.4 ± 6.880.46 ± 0.01
11.0000.000992.2 ± 5.63152.0 ± 7.250.46 ± 0.00
11.0000.001992.2 ± 5.63152.0 ± 7.250.46 ± 0.00
11.0000.010992.2 ± 5.63152.0 ± 7.250.46 ± 0.00
15.0000.000357.4 ± 20.84106.4 ± 12.660.47 ± 0.01
15.0000.001357.4 ± 20.84106.4 ± 12.660.47 ± 0.01
15.0000.010357.4 ± 20.84106.4 ± 12.660.47 ± 0.01
50.0010.0001000.8 ± 2.77147.0 ± 7.910.46 ± 0.00
50.0010.0011000.8 ± 2.77147.0 ± 7.910.46 ± 0.00
50.0010.0101000.8 ± 2.77147.0 ± 7.910.46 ± 0.00
50.0100.0001000.4 ± 2.3146.0 ± 8.970.46 ± 0.01
50.0100.0011000.4 ± 2.3146.0 ± 8.970.46 ± 0.01
50.0100.0101000.4 ± 2.3146.0 ± 8.970.46 ± 0.01
50.1000.0001000.4 ± 5.68144.8 ± 5.360.46 ± 0.01
50.1000.0011000.2 ± 5.63144.4 ± 5.180.46 ± 0.01
50.1000.0101000.2 ± 5.63145.2 ± 5.220.46 ± 0.01
51.0000.000992.2 ± 5.63152.0 ± 7.250.46 ± 0.00
51.0000.001991.8 ± 4.21151.0 ± 5.660.46 ± 0.01
51.0000.010994.0 ± 5.74151.4 ± 5.680.46 ± 0.01
55.0000.000357.4 ± 20.84106.4 ± 12.660.47 ± 0.01
55.0000.001373.8 ± 13.2109.0 ± 8.090.47 ± 0.01
55.0000.010456.6 ± 10.29135.8 ± 11.410.47 ± 0.01
100.0010.0001000.8 ± 2.77146.8 ± 8.140.46 ± 0.01
100.0010.0011000.8 ± 2.77146.8 ± 8.140.46 ± 0.01
100.0010.0101001.0 ± 2.74146.2 ± 8.040.46 ± 0.01
100.0100.0001000.8 ± 2.77146.4 ± 10.640.46 ± 0.00
100.0100.0011001.0 ± 3.46146.0 ± 10.460.46 ± 0.00
100.0100.0101000.6 ± 3.13146.4 ± 10.090.46 ± 0.00
100.1000.0001001.2 ± 5.26144.6 ± 3.290.46 ± 0.01
100.1000.0011000.6 ± 5.68144.4 ± 2.880.46 ± 0.01
100.1000.0101000.6 ± 6.31144.8 ± 1.920.46 ± 0.01
101.0000.000992.2 ± 5.63152.0 ± 7.250.46 ± 0.00
101.0000.001991.0 ± 3.81149.8 ± 6.220.46 ± 0.01
101.0000.010993.6 ± 5.55150.6 ± 3.970.46 ± 0.00
105.0000.000357.4 ± 20.84106.4 ± 12.660.47 ± 0.01
105.0000.001386.0 ± 15.02111.4 ± 6.350.47 ± 0.01
105.0000.010547.8 ± 10.57158.8 ± 10.990.47 ± 0.00
+ +Table 25: Varying $\gamma$ for maximizing ring count guidance with AR D-CFG. Validity, novelty, and mean ring count for novel sequences are reported. Mean $\pm$ standard deviation reported from repeated generation of 1,024 sequences using five different random seeds. The setting reported in the main paper is bolded. + +
γNum. Valid (↑)Num. Novel (↑)Novel Ring Count Mean (↑)
11003.4 ± 4.72189.0 ± 6.444.53 ± 0.07
2966.6 ± 5.32217.4 ± 14.54.76 ± 0.10
3856.4 ± 10.21213.0 ± 12.754.81 ± 0.08
4647.6 ± 16.07137.4 ± 9.214.75 ± 0.10
5441.4 ± 11.0877.8 ± 2.284.83 ± 0.08
+ +Table 26: Varying $\gamma$ for maximizing ring count guidance with AR FUDGE. Validity, novelty, and mean ring count for novel sequences are reported. Mean $\pm$ standard deviation reported from repeated generation of 1,024 sequences using five different random seeds. The setting reported in the main paper is **bolded**. + +
γNum. Valid (↑)Num. Novel (↑)Novel Ring Count Mean (↑)
1956.8 ± 3.11220.2 ± 27.534.50 ± 0.10
2861.6 ± 6.07239.4 ± 20.894.70 ± 0.06
3847.2 ± 8.44266.4 ± 13.764.80 ± 0.06
4704.0 ± 5.2241.0 ± 18.374.87 ± 0.04
5281.2 ± 4.97103.6 ± 4.834.89 ± 0.10
650.6 ± 5.8619.4 ± 4.345.02 ± 0.23
78.6 ± 4.344.0 ± 1.584.89 ± 0.44
81.0 ± 1.410.4 ± 0.552.20 ± 3.03
90.0 ± 0.00.0 ± 0.00.00 ± 0.00
100.0 ± 0.00.0 ± 0.00.00 ± 0.00
+ +Table 27: Varying $n$ (the number of Langevin steps) and $\eta$ (the step size) for maximizing ring count guidance with AR PPLM. Validity, novelty, and mean ring count for novel sequences are measured for generated sequences from each method. Mean $\pm$ standard deviation reported from repeated generation of 1,024 sequences using five different random seeds. The setting reported in the main paper is bolded. + +
nηNum. Valid (↑)Num. Novel (↑)Novel Ring Count Mean (↑)
100.041009.8 ± 1.92140.6 ± 16.471.92 ± 0.09
100.11009.6 ± 2.07140.2 ± 16.251.92 ± 0.06
300.041010.0 ± 2.35139.4 ± 14.741.91 ± 0.09
300.11010.0 ± 1.58138.6 ± 10.311.88 ± 0.12
+ +Table 28: Varying $\gamma$ for maximizing ring count guidance with MDLM D-CFG. Validity, novelty, and mean ring count for novel sequences are reported. Mean $\pm$ standard deviation reported from repeated generation of 1,024 sequences using five different random seeds. The setting reported in the main paper is bolded. + +
γNum. Valid (↑)Num. Novel (↑)Novel Ring Count Mean (↑)
1465.0 ± 18.56273.8 ± 11.954.52 ± 0.05
2363.6 ± 17.5215.6 ± 11.14.85 ± 0.05
3242.4 ± 15.85144.6 ± 16.895.01 ± 0.08
4152.2 ± 4.4497.4 ± 5.085.10 ± 0.13
590.0 ± 8.1560.0 ± 7.525.26 ± 0.15
+ +Table 29: Varying $\gamma$ for maximizing ring count guidance with MDLM D-CBG. We also report results for both using the first order approximation and not using it. Validity, novelty, and mean ring count for novel sequences are reported. Mean $\pm$ standard deviation reported from repeated generation of 1,024 sequences using five different random seeds. The setting reported in the main paper is bolded. + +
γUse Approx.Num. Valid (↑)Num. Novel (↑)Novel Ring Count Mean (↑)
1False143.8 ± 6.61121.2 ± 7.015.00 ± 0.07
1True455.4 ± 24.81229.4 ± 15.212.52 ± 0.11
2False0.4 ± 0.550.4 ± 0.553.00 ± 4.47
2True327.6 ± 15.82176.4 ± 17.32.82 ± 0.15
3False0.0 ± 0.00.0 ± 0.00.00 ± 0.00
3True223.8 ± 15.01136.0 ± 9.83.25 ± 0.26
4False0.0 ± 0.00.0 ± 0.00.00 ± 0.00
4True158.0 ± 9.27106.6 ± 7.133.73 ± 0.19
5False0.0 ± 0.00.0 ± 0.00.00 ± 0.00
5True135.0 ± 9.994.4 ± 11.064.11 ± 0.26
6False0.0 ± 0.00.0 ± 0.00.00 ± 0.00
6True122.8 ± 11.389.8 ± 7.824.41 ± 0.11
7False0.0 ± 0.00.0 ± 0.00.00 ± 0.00
7True116.4 ± 12.585.4 ± 10.384.59 ± 0.10
8False0.0 ± 0.00.0 ± 0.00.00 ± 0.00
8True121.2 ± 12.9192.6 ± 11.954.54 ± 0.16
9False0.0 ± 0.00.0 ± 0.00.00 ± 0.00
9True112.2 ± 12.2887.4 ± 11.844.70 ± 0.17
10False0.0 ± 0.00.0 ± 0.00.00 ± 0.00
10True113.0 ± 8.7585.6 ± 8.824.75 ± 0.23
+ +![](images/a04ed740641b67a307c68a6fe372ae9cf59e035558c78a1419f844e36a4ca22d.jpg) +Figure 5: Ablating the use of first order approximation when applying D-CBG to discrete diffusion models. (Left) Maximizing drug-likeness (QED). (Right) Maximizing ring count. + +![](images/35651a29395692674354e42505c51e4bad3ecaab8040c243bbcf1edca8eafab1.jpg) + +Table 30: Varying $n$ (the number of Langevin steps), $\eta$ (the step size),and ${\gamma }_{kl}$ (the stability regularization coefficient) for maximizing ring count guidance with MDLM NOS. Validity, novelty, and mean ring count for novel sequences are measured for generated sequences from each method. Mean $\pm$ standard deviation reported from repeated generation of 1,024 sequences using five different random seeds. The setting reported used in the main paper is bolded. + +
nηγklNum. Valid (↑)Num. Novel (↑)Novel Ring Count Mean (↑)
10.0010.000508.8 ± 24.18237.0 ± 8.572.41 ± 0.16
10.0010.001508.8 ± 24.18237.0 ± 8.572.41 ± 0.16
10.0010.010508.8 ± 24.18237.0 ± 8.572.41 ± 0.16
10.0100.000509.6 ± 24.27237.0 ± 10.372.41 ± 0.16
10.0100.001509.6 ± 24.27237.4 ± 10.452.41 ± 0.16
10.0100.010509.6 ± 24.27237.0 ± 10.372.41 ± 0.16
10.1000.000505.2 ± 25.71237.4 ± 13.22.46 ± 0.15
10.1000.001504.4 ± 25.59236.4 ± 12.662.46 ± 0.15
10.1000.010505.2 ± 25.71237.4 ± 13.22.46 ± 0.15
11.0000.000458.4 ± 26.28250.00 ± 12.352.79 ± 0.14
11.0000.001458.4 ± 26.28250.00 ± 12.352.79 ± 0.14
11.0000.010458.4 ± 26.28250.00 ± 12.352.79 ± 0.14
15.0000.000187.0 ± 11.6141.4 ± 13.963.08 ± 0.24
15.0000.001187.0 ± 11.6141.4 ± 13.963.08 ± 0.24
15.0000.010187.0 ± 11.6141.4 ± 13.963.08 ± 0.24
50.0010.000509.8 ± 24.71237.6 ± 9.792.4 ± 0.16
50.0010.001510.00 ± 24.66237.6 ± 9.792.4 ± 0.16
50.0010.010510.00 ± 24.66237.6 ± 9.792.4 ± 0.16
50.0100.000509.4 ± 24.44238.0 ± 11.472.42 ± 0.17
50.0100.001509.2 ± 24.43237.8 ± 11.212.42 ± 0.17
50.0100.010509.4 ± 24.42238.0 ± 11.252.42 ± 0.17
50.1000.000506.0 ± 21.25238.6 ± 11.742.48 ± 0.17
50.1000.001506.4 ± 20.21238.0 ± 10.542.48 ± 0.14
50.1000.010505.0 ± 21.06236.6 ± 10.062.48 ± 0.16
51.0000.000458.4 ± 26.28250.00 ± 12.352.79 ± 0.14
51.0000.001464.4 ± 21.0252.4 ± 11.952.79 ± 0.14
51.0000.010466.4 ± 22.04254.0 ± 11.382.78 ± 0.1
55.0000.000187.0 ± 11.6141.4 ± 13.963.08 ± 0.24
55.0000.001213.6 ± 17.36164.0 ± 18.333.31 ± 0.19
55.0000.010247.8 ± 13.97193.6 ± 13.133.51 ± 0.22
100.0010.000509.0 ± 24.14237.2 ± 8.72.41 ± 0.16
100.0010.001509.8 ± 24.28238.0 ± 9.02.4 ± 0.17
100.0010.010509.8 ± 24.28238.0 ± 9.02.4 ± 0.17
100.0100.000510.4 ± 24.42239.4 ± 10.212.43 ± 0.14
100.0100.001510.2 ± 24.41239.6 ± 10.362.42 ± 0.14
100.0100.010510.00 ± 24.4239.6 ± 10.362.43 ± 0.14
100.1000.000504.0 ± 19.26238.4 ± 10.742.48 ± 0.19
100.1000.001505.6 ± 18.15239.6 ± 10.362.48 ± 0.16
100.1000.010506.4 ± 18.66240.4 ± 9.792.48 ± 0.17
101.0000.000458.4 ± 26.28250.00 ± 12.352.79 ± 0.14
101.0000.001471.4 ± 18.01257.8 ± 10.892.8 ± 0.1
101.0000.010473.2 ± 18.86257.0 ± 7.912.76 ± 0.12
105.0000.000187.0 ± 11.6141.4 ± 13.963.08 ± 0.24
105.0000.001225.6 ± 17.47176.8 ± 18.653.32 ± 0.17
105.0000.010265.4 ± 12.62206.6 ± 10.883.47 ± 0.24
+ +Table 31: Varying $\gamma$ for maximizing ring count guidance with UDLM D-CFG. Validity, novelty, and mean ring count for novel sequences are reported. Mean $\pm$ standard deviation reported from repeated generation of 1,024 sequences using five different random seeds. The setting reported in the main paper is bolded. + +
γNum. Valid (↑)Num. Novel (↑)Novel Ring Count Mean (↑)
1979.0 ± 8.83276.8 ± 17.344.54 ± 0.05
2998.2 ± 6.83229.0 ± 8.944.75 ± 0.08
3998.2 ± 4.49216.2 ± 12.994.88 ± 0.04
4989.6 ± 5.94211.4 ± 2.884.85 ± 0.08
5968.6 ± 7.89209.4 ± 13.24.84 ± 0.06
+ +Table 32: Varying $\gamma$ for maximizing ring count guidance with UDLM D-CBG. We also report results for both using the first order approximation and not using it. Validity, novelty, and mean ring count for novel sequences are reported. Mean $\pm$ standard deviation reported from repeated generation of 1,024 sequences using five different random seeds. The setting reported in the main paper is bolded. + +
γUse Approx.Num. Valid (↑)Num. Novel (↑)Novel Ring Count Mean (↑)
1False797.4 ± 9.91279.0 ± 23.374.12 ± 0.04
1True978.4 ± 3.91166.0 ± 11.812.49 ± 0.07
2False829.4 ± 11.59336.4 ± 10.554.54 ± 0.03
2True892.2 ± 12.19171.2 ± 13.593.09 ± 0.08
3False862.6 ± 7.73363.8 ± 12.764.70 ± 0.03
3True763.8 ± 11.52198.8 ± 10.763.76 ± 0.09
4False880.6 ± 19.15393.0 ± 12.394.74 ± 0.08
4True705.8 ± 14.69215.2 ± 15.064.30 ± 0.14
5False889.2 ± 12.4404.0 ± 9.644.76 ± 0.03
5True726.8 ± 15.64245.8 ± 6.834.47 ± 0.07
6False898.6 ± 21.13427.6 ± 13.814.79 ± 0.06
6True757.6 ± 10.38277.6 ± 8.734.55 ± 0.04
7False898.2 ± 9.26436.4 ± 8.794.80 ± 0.06
7True779.4 ± 17.29295.6 ± 22.184.62 ± 0.06
8False897.2 ± 11.58432.0 ± 19.074.84 ± 0.02
8True796.6 ± 15.84304.4 ± 10.014.66 ± 0.06
9False903.2 ± 3.96445.8 ± 13.144.83 ± 0.05
9True811.8 ± 7.82328.4 ± 7.54.66 ± 0.02
10False891.6 ± 12.18431.4 ± 11.464.76 ± 0.05
10True816.6 ± 15.14359.8 ± 21.874.70 ± 0.05
+ +Table 33: Varying $n$ (the number of Langevin steps), $\eta$ (the step size),and ${\gamma }_{kl}$ (the stability regularization coefficient) for maximizing ring count guidance with UDLM NOS. Validity,novelty, and mean ring count for novel sequences are measured for generated sequences from each method. Mean $\pm$ standard deviation reported from repeated generation of 1,024 sequences using five different random seeds. The setting reported used in the main paper is bolded. + +
nηγklNum. Valid (↑)Num. Novel (↑)Novel Ring Count Mean (↑)
10.0010.0001000.8 ± 2.77146.2 ± 7.262.10 ± 0.08
10.0010.0011000.8 ± 2.77146.2 ± 7.262.10 ± 0.08
10.0010.0101000.8 ± 2.77146.2 ± 7.262.10 ± 0.08
10.0100.0001001.0 ± 2.45147.2 ± 8.442.10 ± 0.09
10.0100.0011000.8 ± 2.17147.4 ± 8.562.10 ± 0.09
10.0100.0101001.0 ± 2.45147.2 ± 8.442.10 ± 0.09
10.1000.0001000.8 ± 4.92148.2 ± 7.662.13 ± 0.09
10.1000.0011000.8 ± 4.92148.2 ± 7.662.13 ± 0.09
10.1000.0101000.8 ± 4.92148.2 ± 7.662.13 ± 0.09
11.0000.000988.6 ± 5.5161.6 ± 10.742.47 ± 0.11
11.0000.001988.6 ± 5.5161.6 ± 10.742.47 ± 0.11
11.0000.010988.6 ± 5.5161.6 ± 10.742.47 ± 0.11
15.0000.000323.6 ± 15.18109.4 ± 12.243.41 ± 0.09
15.0000.001323.6 ± 15.18109.4 ± 12.243.41 ± 0.09
15.0000.010323.6 ± 15.18109.4 ± 12.243.41 ± 0.09
50.0010.0001000.8 ± 2.77146.6 ± 7.52.10 ± 0.08
50.0010.0011000.8 ± 2.77146.6 ± 7.52.10 ± 0.08
50.0010.0101000.8 ± 2.77146.6 ± 7.52.10 ± 0.08
50.0100.0001000.8 ± 2.86148.2 ± 6.942.11 ± 0.10
50.0100.0011000.8 ± 2.86148.0 ± 7.042.11 ± 0.10
50.0100.0101000.8 ± 2.86147.8 ± 7.42.12 ± 0.10
50.1000.0001001.0 ± 4.24149.0 ± 5.292.14 ± 0.13
50.1000.0011001.0 ± 4.24149.0 ± 5.292.14 ± 0.13
50.1000.0101001.0 ± 4.24149.0 ± 6.02.14 ± 0.13
51.0000.000988.6 ± 5.5161.6 ± 10.742.47 ± 0.11
51.0000.001990.2 ± 5.26162.2 ± 9.962.46 ± 0.11
51.0000.010989.4 ± 4.83160.4 ± 7.572.44 ± 0.11
55.0000.000323.6 ± 15.18109.4 ± 12.243.41 ± 0.09
55.0000.001413.0 ± 16.17166.8 ± 18.953.92 ± 0.05
55.0000.010573.8 ± 13.03244.4 ± 13.053.96 ± 0.07
100.0010.0001001.0 ± 2.74146.8 ± 7.332.09 ± 0.09
100.0010.0011001.0 ± 2.74146.8 ± 7.332.09 ± 0.09
100.0010.0101001.0 ± 2.74146.8 ± 7.332.09 ± 0.09
100.0100.0001001.0 ± 3.08147.8 ± 7.462.12 ± 0.10
100.0100.0011001.0 ± 3.08147.8 ± 7.462.12 ± 0.10
100.0100.0101000.6 ± 3.78147.2 ± 6.982.12 ± 0.10
100.1000.0001000.0 ± 4.74150.4 ± 7.092.15 ± 0.13
100.1000.0011000.0 ± 4.74151.0 ± 6.782.14 ± 0.12
100.1000.0101000.0 ± 4.74150.6 ± 6.152.15 ± 0.13
101.0000.000988.6 ± 5.5161.6 ± 10.742.47 ± 0.11
101.0000.001990.6 ± 5.55162.0 ± 9.642.45 ± 0.09
101.0000.010993.0 ± 3.46163.6 ± 9.892.47 ± 0.09
105.0000.000323.6 ± 15.18109.4 ± 12.243.41 ± 0.09
105.0000.001454.6 ± 12.78188.8 ± 12.243.96 ± 0.05
105.0000.010670.0 ± 6.4276.8 ± 20.623.81 ± 0.07
+ +Table 34: Ablation results of $\gamma$ values on CIFAR10. Best values for each model are bolded. + +
FID (↓)IS (↑)F1 (↑)
MDLM D-CFG
γ = 127.947.140.76
γ = 218.628.240.95
γ = 316.198.780.99
γ = 415.569.020.99
γ = 515.739.191.00
UDLM D-CFG
γ = 126.707.430.81
γ = 220.758.340.96
γ = 321.318.520.98
γ = 423.218.660.99
γ = 526.158.600.99
+ +![](images/f8f11d18d3c461b88bc44531d1bf8b8524c70c4f4fa1f94fd0be6f244aa7569e.jpg) + +![](images/4d6a10c2d8af716f6e527d21d6862985e40641270c97ec8bcdf4ca20bd0b6aed.jpg) + +![](images/6678422bd861e33f18e064b2d55893ef416bd38f6686d941582bd5a022ccaafe.jpg) +Figure 6: Effect of varying $T$ on QM9 guidance generation. (Top Left) Maximizing drug-likeness (QED) using D-CFG. (Bottom Left) Maximizing drug-likeness (QED) using D-CBG. (Top Right) Maximizing ring count using D-CFG. (Bottom Right) Maximizing ring count using D-CBG. + +![](images/dc00e419e1c9abe6eb9684473ff7539d61a5c4fc8af056350602e5c2610b5f26.jpg) + +Table 35: Varying $T$ for CIFAR10 conditional generation. 50k images sampled from a conditional model (D-CFG $\gamma = 1$ ). F1 metric from a separate classifier trained to identify the class label used for the conditional generation. Best metric per $T$ is bolded. + +
ModelFID (↓)IS (↑)F1 (↑)
T = 128
MDLM64.095.810.63
UDLM30.487.300.80
T = 256
MDLM41.536.510.70
UDLM28.307.400.81
T = 512
MDLM31.976.890.74
UDLM27.127.430.74
T = 1024
MDLM27.947.140.81
UDLM26.707.430.81
+ +Table 36: Generative Perplexity (Gen. PPL; using GPT-2 Large) for unconditional sample generation from models trained on LM1B. Best value is bolded. + +
ModelTGen. PPL (↓)
AR12867.46
MDLM16170.64
MDLM32140.47
MDLM64130.62
MDLM128120.93
MDLM256119.96
MDLM512118.34
MDLM1024116.80
UDLM1682.09
UDLM3279.80
UDLM6479.93
UDLM12879.87
UDLM25679.07
UDLM51279.14
UDLM102478.22
+ +Table 37: Generated samples for unconditional generation from models trained on LM1B. + +
Model - TGenerated Text
AR - 128“[CLS] to move the global economy away from inappropriate trade practices and build an environment that rewards innovation. i. e. samples of seed money by jim mellon, paul pompa jr., gil familier, vanessa thomas, george rothman, george whitacre, john ziemba, mark sweitzer, little george nowi, thayer evans and allison gallagher. i. e. yang if you don’t wanna fly, the statistics means you are going to make your rocket arm - rolls. [CLS] savings that made the difference in someone’s life cannot be made in another country without foreign assistance on their [CLS]”
MDLM - 16“[CLS] mezzo ev of dream spirits. [CLS] to naval cadets i didn’t want mum and dad to be a group, but even with the odd social butterflies i felt myself sitting at the edge of a deep blue pool. [CLS] on wednesday morning, fighter jets billoured the area during the early hours of the morning. [CLS] i know of the sailing course, the scenery, the coastline, the whole thing very beautiful - - the land of water. [CLS] wednesday, after its peak height reached the ice’s lowest point. [CLS] reader’s thought is. for the basic requirements of team leadership, internship, part time, a...”
MDLM - 1024“[CLS] was killed as mr. giffords and as the caregiver, representative giffords’s. [CLS] but i have no doubt that this process will produce meat, ms. rommel said. [CLS] and even if you don’t need to hit an agency envelope during it, you should pay the rent through office expenses, referring to the possible error. [CLS] blog. view billshift and discuss yahoo commercials, and what? [CLS] this month, the new logos of cin - armarge became scranton neck - based riverton and tollhorn. [CLS] when i arrived, he’d ducking behind the woman..”
UDLM - 16“[CLS] grandeur. [CLS] grand avenue an. [CLS] it upon request, such information plays only in the provision of the protocoläs guidelines for the nonprofit sector. [CLS] that too has to worry people about schools that shut down and closed schools for several weeks. [CLS] i will not comment on anything important to the eu, where someone is blaming serbia to not a figurehead. [CLS] but i think that because an increasing number of coal is put at risk as a displaced gateway, and the other party of technology falls away from communities that can somehow show up as a starting point, one thing that the province will suffer is loss of almost [CLS]”
UDLM - 1024“[CLS] would [CLS] a 49 percent stake in the company under the terms of the deal. [CLS] the only subsequent trial out of ms, sykes is 19 febru-ary next year after prosecutors failed to overturn the death sentence against him. [CLS] but dugard has recorded several rings for baby je-sus, a completely new thing as for calling muslim cold - callers and working with his confiscators. [CLS] i am forced to seek out convenient explanations while remaining in no position either to caucus. [CLS] of course, get me out of there. [CLS] the first thing being wrote about is having available food. [CLS] sir simon’s guests included singer hayley wood and”
\ No newline at end of file diff --git a/ICLR/2025/Simple Guidance Mechanisms for Discrete Diffusion Models/images.zip b/ICLR/2025/Simple Guidance Mechanisms for Discrete Diffusion Models/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..07d25494166c851963804881f59eb3f5b08fa62c --- /dev/null +++ b/ICLR/2025/Simple Guidance Mechanisms for Discrete Diffusion Models/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:04c450f02a0722b7e48f1812a4e55496f63cfff9e9bea0f5b7c8f5425b8e3972 +size 4163355 diff --git a/ICLR/2025/Simple Guidance Mechanisms for Discrete Diffusion Models/layout.json b/ICLR/2025/Simple Guidance Mechanisms for Discrete Diffusion Models/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..bc938082211fe6406212aa44347db430a5e202e2 --- /dev/null +++ b/ICLR/2025/Simple Guidance Mechanisms for Discrete Diffusion Models/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d769f97aeb189fdde88fb867c647be52d5e88c079188c859432688b78667b1aa +size 1372822 diff --git a/ICLR/2025/Simple ReFlow_ Improved Techniques for Fast Flow Models/48f8160d-81c3-42c7-a46b-622ee29e117c_content_list.json b/ICLR/2025/Simple ReFlow_ Improved Techniques for Fast Flow Models/48f8160d-81c3-42c7-a46b-622ee29e117c_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..ea9f33c428dad1c736b761b23a49e16f00d59ba7 --- /dev/null +++ b/ICLR/2025/Simple ReFlow_ Improved Techniques for Fast Flow Models/48f8160d-81c3-42c7-a46b-622ee29e117c_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ec85ce2ff268ce562df46a73599df946f021cae4ce9b4555cec83a4569a69f98 +size 200775 diff --git a/ICLR/2025/Simple ReFlow_ Improved Techniques for Fast Flow Models/48f8160d-81c3-42c7-a46b-622ee29e117c_model.json b/ICLR/2025/Simple ReFlow_ Improved Techniques for Fast Flow Models/48f8160d-81c3-42c7-a46b-622ee29e117c_model.json new file mode 100644 index 0000000000000000000000000000000000000000..4af3e7deec1a443966956a3b9c965fdafe50bdd5 --- /dev/null +++ b/ICLR/2025/Simple ReFlow_ Improved Techniques for Fast Flow Models/48f8160d-81c3-42c7-a46b-622ee29e117c_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:25d708d275484219a0e1129d1204689b4aa5a9e442829bdbeb690b22b2d4ef8b +size 237378 diff --git a/ICLR/2025/Simple ReFlow_ Improved Techniques for Fast Flow Models/48f8160d-81c3-42c7-a46b-622ee29e117c_origin.pdf b/ICLR/2025/Simple ReFlow_ Improved Techniques for Fast Flow Models/48f8160d-81c3-42c7-a46b-622ee29e117c_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..70bfe8db55d4e3cf311abefc7203e04e170b78e6 --- /dev/null +++ b/ICLR/2025/Simple ReFlow_ Improved Techniques for Fast Flow Models/48f8160d-81c3-42c7-a46b-622ee29e117c_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7fec8d4864cc1bccefa77712df851615a596b5bbd384d2bcb38c61124e8bbb26 +size 4728180 diff --git a/ICLR/2025/Simple ReFlow_ Improved Techniques for Fast Flow Models/full.md b/ICLR/2025/Simple ReFlow_ Improved Techniques for Fast Flow Models/full.md new file mode 100644 index 0000000000000000000000000000000000000000..71bbb110be6edab5e36fceb09459684041d911bb --- /dev/null +++ b/ICLR/2025/Simple ReFlow_ Improved Techniques for Fast Flow Models/full.md @@ -0,0 +1,1013 @@ +# SIMPLE REFLOW: IMPROVED TECHNIQUES FOR FAST FLOW MODELS + +Beomsu Kim + +Apple and KAIST + +Yu-Guan Hsieh + +Apple + +Michal Klein + +Apple + +Marco Cuturi + +Apple + +Jong Chul Ye + +KAIST + +Bahjat Kawar + +Apple + +James Thornton + +Apple + +# ABSTRACT + +Diffusion and flow-matching models achieve remarkable generative performance but at the cost of many sampling steps, this slows inference and limits applicability to time-critical tasks. The ReFlow procedure can accelerate sampling by straightening generation trajectories. However, ReFlow is an iterative procedure, typically requiring training on simulated data, and results in reduced sample quality. To mitigate sample deterioration, we examine the design space of ReFlow and highlight potential pitfalls in prior heuristic practices. We then propose seven improvements for training dynamics, learning and inference, which are verified with thorough ablation studies on CIFAR10 $32 \times 32$ , AFHQv2 $64 \times 64$ , and FFHQ $64 \times 64$ . Combining all our techniques, we achieve state-of-the-art FID scores (without / with guidance, resp.) for fast generation via neural ODEs: 2.23 / 1.98 on CIFAR10, 2.30 / 1.91 on AFHQv2, 2.84 / 2.67 on FFHQ, and 3.49 / 1.74 on ImageNet-64, all with merely 9 neural function evaluations. + +# 1 INTRODUCTION + +The diffusion model (DMs) paradigm (Sohl-Dickstein et al., 2015; Ho et al., 2020) has changed the landscape of generative modelling of perceptual data, benefitting from scalability, stability and remarkable performance in a diverse set of tasks ranging from unconditional generation (Dhariwal & Nichol, 2021) to conditional generation such as image restoration (Chung et al., 2023), editing (Meng et al., 2022), translation (Su et al., 2023), and text-to-image generation (Rombach et al., 2022). However, to generate samples, DMs require numerically integrating a differential equation using tens to hundreds of neural function evaluations (NFEs) (Song et al., 2021b;a). Naively reducing the NFE increases discretization error, causing sample quality to worsen. This has sparked wide interest in accelerating diffusion sampling (Song et al., 2021a; Lu et al., 2022; Zhang & Chen, 2023; Kim & Ye, 2023; Salimans & Ho, 2022; Song et al., 2023). + +Flow matching models (FMs) (Lipman et al., 2023) are a closely related class of generative model sharing similar training and sampling procedures and enjoying similar performance to diffusion models. Indeed, FM and DMs coincide for a particular choice of forward process (Kingma & Gao, 2023), and are also related to stochastic interpolants (Albergo & Vanden-Eijnden, 2023; Albergo et al., 2023). Whereas diffusion models relate to entropically regularized transport (Bortoli et al., 2021; Shi et al., 2023; Peluchetti, 2023), a key property of flow matching models is their connection to non-regularized optimal transport, and hence deterministic, straight trajectories (Liu, 2022). + +While there exist a plethora of acceleration techniques, one promising, yet less explored avenue is ReFlow (Liu et al., 2022; Liu, 2022), also known as Iterative Markovian Fitting (IMF) (Shi et al., 2023). ReFlow straightens ODE trajectories through flow-matching between marginal distributions coupled by a previously trained flow ODE, rather than using an independent coupling. Theoretically, with an infinite number of ReFlow updates, the resulting learned ODE should be straight, which enables perfect translation between the marginals with a single function evaluation (Liu et al., 2022). + +In practice however, ReFlow results in a drop in sample quality (Liu et al., 2022; 2024). To address this problem, recent works on sampling acceleration via ReFlow opt to use heuristic tricks such as perceptual losses that only loosely adhere to the underlying theory (Lee et al., 2024; Zhu et al., + +2024). Consequently, it is unclear whether the marginals are still preserved after ReFlow. This is problematic, as exact inversion and tractable likelihood calculation require access to a valid probability flow ODE between the marginals. Moreover, these two functions are critical to downstream applications such as zero-shot classification (Li et al., 2023) etc. + +The goal of this work is to study and mitigate the performance drop after ReFlow without violating the theoretical setup. Although technical in nature, we call our method simple, as, similar to simple diffusion (Hoogeboom et al., 2023), it does not rely on latent-encoders, perceptual losses, or premetrics, whose effect on the learned marginals is poorly understood. To this end, we first disentangle the components of ReFlow. Next, we examine the pitfalls of previous practices. Finally, we propose enhancements within the theoretical bounds, and verify them through rigorous ablation studies. + +Our contributions are summarized as follows. + +- We generalize and categorize the design choices of ReFlow (Section 3.1). We generalize the ReFlow training loss and categorize the design choices of ReFlow into three key groups: training dynamics, learning, and inference. Within each group, we discuss previous practices, highlight their potential pitfalls, and propose improved techniques. +- We analyze each improvement via ablations (Sections 3.2, 3.3, and 3.4). For each proposed improvement, we verify its effect on sample quality via extensive ablations on three datasets: CIFAR10 $32 \times 32$ (Krizhevsky, 2009), FFHQ $64 \times 64$ (Karras et al., 2019), and AFHQv2 $64 \times 64$ (Choi et al., 2020). We demonstrate that our techniques are robust, and they offer consistent gains in FID scores (Heusel et al., 2017) on all three datasets. +- We achieve state-of-the-art results (Section 4). With all our improvements, we set state-of-the-art FIDs for fast generation via neural ODEs, without perceptual losses or premetrics. Our best models achieve 2.23 FID on CIFAR10, 2.30 FID on AFHQv2, 2.84 FID on FFHQ, and 3.49 FID on ImageNet-64, all with merely 9 NFEs. In particular, our models outperform the latest fast neural ODEs such as curvature minimization (Lee et al., 2023) and minibatch OT flow matching (Pooladian et al., 2023). We are also able to further enhance the perceptual quality of samples via guidance, setting 1.98 FID on CIFAR10, 1.91 FID on AFHQv2, 2.67 FID on FFHQ, and 1.74 FID on ImageNet-64, also with 9 NFEs. + +# 2 BACKGROUND + +Let $\mathbb{P}_0$ and $\mathbb{P}_1$ be two data distributions on $\mathbb{R}^d$ . Rectified Flow (RF) (Liu et al., 2022; Liu, 2022) is an algorithm which learns straight ordinary differential equations (ODEs) between $\mathbb{P}_0$ and $\mathbb{P}_1$ by iterating a procedure called ReFlow. Below, we describe ReFlow, and explain how it can be applied to diffusion probability flow ODEs to learn fast generative flow models. + +# 2.1 FLOW MATCHING AND REFLOW + +Let us first define the flow matching (FM) loss and its equivalent formulation as a denoising problem + +$$ +\begin{array}{l} \mathcal {L} _ {\mathrm {F M}} (\theta ; \mathbb {Q} _ {0 1}) := \mathbb {E} _ {(\boldsymbol {x} _ {0}, \boldsymbol {x} _ {1}) \sim \mathbb {Q} _ {0 1}} \mathbb {E} _ {t \sim \operatorname {u n i f} (0, 1)} \left[ \ell_ {\text {M S E}} (\boldsymbol {x} _ {1} - \boldsymbol {x} _ {0}, \boldsymbol {v} _ {\theta} (\boldsymbol {x} _ {t}, t)) \right] (1) \\ := \mathbb {E} _ {\left(\boldsymbol {x} _ {0}, \boldsymbol {x} _ {1}\right) \sim \mathbb {Q} _ {0 1}} \mathbb {E} _ {t \sim \operatorname {u n i f} (0, 1)} \left[ t ^ {- 2} \cdot \ell_ {\text {M S E}} \left(\boldsymbol {x} _ {0}, \boldsymbol {D} _ {\theta} \left(\boldsymbol {x} _ {t}, t\right)\right) \right] (2) \\ \end{array} +$$ + +where $\pmb{v}_{\theta}:\mathbb{R}^{d}\times (0,1)\to \mathbb{R}^{d}$ is a velocity parameterized by $\theta ,\ell_{\mathrm{MSE}}(\pmb {x},\pmb {y})\coloneqq \| \pmb {x} - \pmb {y}\| _2^2,\pmb{x}_t\coloneqq (1 - t)\pmb {x}_0 + t\pmb {x}_1$ , and $\mathbb{Q}_{01}$ is a coupling, i.e., a joint distribution, of $\mathbb{P}_0$ and $\mathbb{P}_1$ , and $D_{\theta}(\pmb{x}_t,t)\coloneqq \pmb{x}_t - tv_\theta$ is a denoiser that is optimized to recover the original data $\pmb{x}_0$ given a corrupted observation $\pmb{x}_t$ and time $t$ as inputs. According to the FM theory, a velocity which minimizes Eq. (1) or a denoiser which minimizes Eq. (2) can translate samples from $\mathbb{P}_i$ to $\mathbb{P}_{1 - i}$ $i\in \{0,1\}$ , by solving the ODE + +$$ +d \boldsymbol {x} _ {t} = \boldsymbol {v} _ {\theta} (\boldsymbol {x} _ {t}, t) d t = t ^ {- 1} \left(\boldsymbol {x} _ {t} - \boldsymbol {D} _ {\theta} (\boldsymbol {x} _ {t}, t)\right) d t, \quad t \in (0, 1) \tag {3} +$$ + +from $t = i$ to $1 - i$ (Lipman et al., 2023). Let us call the denoiser which minimizes Eq. (2) w.r.t. the independent coupling $\mathbb{Q}_{01} = \mathbb{P}_0\otimes \mathbb{P}_1$ as $D_{\theta}^{1}$ + +For $n \geq 1$ , ReFlow minimizes Eq. (2) with coupling induced by $D_{\theta}^{n}$ to obtain $D_{\theta}^{n+1}$ whose ODE has a lower transport cost. Specifically, observe that Eq. (3) with $D_{\theta}^{n}$ induces a coupling + +$$ +d \mathbb {Q} _ {0 1} ^ {n} \left(\boldsymbol {x} _ {0}, \boldsymbol {x} _ {1}\right) := \left\{ \begin{array}{l} d \mathbb {P} _ {1} \left(\boldsymbol {x} _ {1}\right) \delta \left(\boldsymbol {x} _ {0} - \operatorname {s o l v e} \left(\boldsymbol {x} _ {1}, \boldsymbol {D} _ {\theta} ^ {n}, 1, 0\right)\right) \\ d \mathbb {P} _ {0} \left(\boldsymbol {x} _ {0}\right) \delta \left(\boldsymbol {x} _ {1} - \operatorname {s o l v e} \left(\boldsymbol {x} _ {0}, \boldsymbol {D} _ {\theta} ^ {n}, 0, 1\right)\right) \end{array} \right. \tag {4} +$$ + +where $\delta$ is the Dirac delta, and solve $(\pmb{x},\pmb{D}_{\theta}^{n},t_{0},t_{1})$ solves Eq. (3) from time $t = t_0$ to $t_1$ with initial point $\pmb{x}$ . Concretely, given $\pmb{x}_i\sim \mathbb{P}_i$ for $i\in \{0,1\}$ , we sample $\pmb{x}_{1 - i}\sim \mathbb{Q}_{1 - i|i}(\cdot |\pmb{x}_i)$ by integrating Eq. (3) from $t = i$ to $1 - i$ starting from $\pmb{x}_i$ . The two expressions in Eq. (4) are equivalent, since an ODE defines a bijective map between initial and terminal points. + +RF guarantees that if $D_{\theta}^{n + 1}$ is a minimizer of $\mathcal{L}_{\mathrm{FM}}(\theta; \mathbb{Q}_{01}^n)$ , the ODE with $D_{\theta}^{n + 1}$ converges to a perfectly straight ODE as $n \to \infty$ . If an ODE has perfectly straight trajectories, it is possible to translate between the marginals with a single Euler step, e.g., $x_0 = D_{\theta}(x_1, 1)$ when translating from $t = 1$ to 0 (see Section 3 of Liu et al., 2022). + +# 2.2 REFLOW WITH DIFFUSION PROBABILITY FLOW ODES + +Given distribution $\mathbb{P}_0$ on $\mathbb{R}^d$ and Gaussian perturbation kernel $d\mathbb{Q}_{\sigma |0}(\pmb {y}_\sigma |\pmb {y}_0)\coloneqq \mathcal{N}(\pmb {y}_\sigma |\pmb {y}_0,\sigma^2\pmb {I})$ DMs solve the denoising score matching (DSM) (Vincent, 2011) problems + +$$ +\mathcal {L} _ {\mathrm {D S M}} (\theta) := \mathbb {E} _ {\sigma \sim \mathbb {S}} \mathbb {E} _ {\boldsymbol {y} _ {0} \sim \mathbb {P} _ {0}} \mathbb {E} _ {\boldsymbol {y} _ {\sigma} \sim \mathbb {Q} _ {\sigma | 0} (\cdot | \boldsymbol {y} _ {0})} \left[ \ell_ {\mathrm {M S E}} \left(\boldsymbol {y} _ {0}, \boldsymbol {F} _ {\theta} \left(\boldsymbol {y} _ {\sigma}, \sigma\right)\right) \right] \tag {5} +$$ + +to learn a denoiser $\pmb{F}_{\theta}:\mathbb{R}^{d}\times (0,\infty)\rightarrow \mathbb{R}^{d}$ . $\pmb{F}_{\theta}$ then defines a probability flow ODE between $\mathbb{P}_0$ and $\mathbb{P}_0*\mathcal{N}(\mathbf{0},\hat{\sigma}^2\mathbf{I})\approx \mathcal{N}(\mathbf{0},\hat{\sigma}^2\mathbf{I})$ for a large $\hat{\sigma}$ : + +$$ +d \boldsymbol {y} _ {\sigma} = \sigma^ {- 1} \left(\boldsymbol {y} _ {\sigma} - \boldsymbol {F} _ {\theta} \left(\boldsymbol {y} _ {\sigma}, \sigma\right)\right) d \sigma , \quad \sigma \in (0, \infty). \tag {6} +$$ + +When $\mathbb{P}_1$ is standard normal, Eq. (3) with $D_{\theta}^{1}$ and Eq. (6) are equivalent, as Eq. (3) with the change of variables $(y_{\sigma},\sigma)\coloneqq \left(\frac{x_t}{1 - t},\frac{t}{1 - t}\right)$ and Eq. (6) are identical (Lee et al., 2024). It follows that we can straighten diffusion probability flow ODE trajectories via ReFlow. Specifically, with the coupling + +$$ +d \mathbb {Q} _ {0 1} ^ {1} \left(\boldsymbol {x} _ {0}, \boldsymbol {x} _ {1}\right) = \left\{ \begin{array}{l} d \mathbb {P} _ {1} \left(\boldsymbol {x} _ {1}\right) \delta \left(\boldsymbol {x} _ {0} - \operatorname {s o l v e} \left(\frac {\boldsymbol {x} _ {1}}{1 - t}, \boldsymbol {F} _ {\theta}, \frac {t}{1 - t}, 0\right)\right) \\ d \mathbb {P} _ {0} \left(\boldsymbol {x} _ {0}\right) \delta \left(\boldsymbol {x} _ {1} - (1 - t) \cdot \operatorname {s o l v e} \left(\boldsymbol {x} _ {0}, \boldsymbol {F} _ {\theta}, 0, \frac {t}{1 - t}\right)\right) \end{array} \right. \tag {7} +$$ + +where $t \approx 1$ and $\mathrm{solve}(\pmb{y},\pmb{F}_{\theta},\sigma_0,\sigma_1)$ solves Eq. (6) from $\sigma = \sigma_0$ to $\sigma_{1}$ with initial point $\pmb{y}$ , we can minimize Eq. (1) to learn $D_{\theta}^{2}$ , and so on. Because optimizing Eq. (1) is often expensive, a typical procedure is to perform one ReFlow step with Eq. (7) to get $D_{\theta}^{2}$ , and distill Eq. (3) trajectories into a student model for one-step generation (Liu et al., 2022; Zhu et al., 2024; Liu et al., 2024). + +# 3 IMPROVED TECHNIQUES FOR REFLOW + +We now investigate the design space of ReFlow and propose improvements. Specifically, in Section 3.1, we generalize the FM loss and identify the components that constitute ReFlow. The components are organized into three groups - training dynamics, learning, and inference. In Sections 3.2, 3.3, and 3.4, we investigate the pitfalls of previous practices and propose improved techniques in each group. To show that our improvements are robust, we provide rigorous ablation studies on CIFAR10 $32 \times 32$ , AFHQv2 $64 \times 64$ , and FFHQ $64 \times 64$ . We find that ReFlow training and sampling are very different from those of DMs, and generally require distinct techniques for optimal performance. + +# 3.1 THE DESIGN SPACE OF REFLOW + +Generalizing weight and time distribution. Let the joint distribution of $(\pmb{x}_0, \pmb{x}_1, t, \pmb{x}_t)$ be given by $\pmb{x}_0, \pmb{x}_1 \sim d\mathbb{Q}_{01}, t \sim \mathbb{T}$ , and $\pmb{x}_t = (1 - t)\pmb{x}_0 + t\pmb{x}_1$ . Then Eq. (2) can also be expressed as + +$$ +\mathcal {L} _ {\mathrm {F M}} (\theta ; \mathbb {Q} _ {0 1}) = \mathbb {E} _ {t \sim \operatorname {u n i f} (0, 1)} \mathbb {E} _ {\boldsymbol {x} _ {t} \sim \mathbb {Q} _ {t}} [ w (t) \cdot \mathcal {L} _ {\mathrm {F M}} (\theta ; \mathbb {Q} _ {0 1}, \boldsymbol {x} _ {t}, t) ], \tag {8} +$$ + +$$ +w h e r e \mathcal {L} _ {\mathrm {F M}} (\theta ; \mathbb {Q} _ {0 1}, \boldsymbol {x} _ {t}, t) := \mathbb {E} _ {\boldsymbol {x} _ {0} \sim \mathbb {Q} _ {0 | t} (\cdot | \boldsymbol {x} _ {t})} \left[ \ell_ {\mathrm {M S E}} \left(\boldsymbol {x} _ {0}, \boldsymbol {D} _ {\theta} \left(\boldsymbol {x} _ {t}, t\right)\right) \right], \tag {9} +$$ + +and $w(t) = t^{-2}$ . This shows that the FM loss is separable w.r.t. $(\pmb{x}_t, t)$ , and the optimal denoising function is given by the posterior mean (Robbins, 1956): $D^{*}(\pmb{x}_{t}, t) = \mathbb{E}_{\pmb{x}_{0} \sim \mathbb{Q}_{0|t}(\cdot|\pmb{x}_{t})}[\pmb{x}_{0}]$ . Hence, we may replace $w(t)$ with a general weight $w(\pmb{x}_t, t)$ and use a general time distribution $\mathbb{T}$ + +$$ +\mathcal {L} _ {\mathrm {F M}} (\theta ; \mathbb {Q} _ {0 1}) = \mathbb {E} _ {t \sim \mathbb {T}} \mathbb {E} _ {\boldsymbol {x} _ {t} \sim \mathbb {Q} _ {t}} [ w (\boldsymbol {x} _ {t}, t) \cdot \mathcal {L} _ {\mathrm {F M}} (\theta ; \mathbb {Q} _ {0 1}, \boldsymbol {x} _ {t}, t) ]. \tag {10} +$$ + +This is minimized under the same condition, given that $w(\pmb{x}_t,t) > 0$ and $\mathbb{T}$ is supported on $(0,1)$ . + +
RFRF++BaselineSimple ReFlow (Ours)
Train Dynamics (Sec. 3.2)
Weight w(xt,t)1/t21, 1/t11/sg[LFM(θ; Q01, xt,t)]
Time distribution dT(t) ∝1cosh(4(t-0.5))cosh(4(t-0.5))10t
Loss function ℓℓMSE, LPIPSPseudo-Huber, LPIPSℓMSEℓI+λHPF
Learning (Sec. 3.3)
Dθinitialization with DM×✓✓✓
Dθdropout probability0.15Equal to EDM0.15≪ 0.15
Sampling from Q01BackwardBackwardBackwardForward, Projection
Inference (Sec. 3.4)
ODE SolverEulerEuler, HeunHeunDPM-Solver
Discretization of [0,1]UniformUniformUniformSigmoid κ = 20
Reference(Liu et al., 2022)(Lee et al., 2024)--
(Zhu et al., 2024)
+ +Table 1: Comparison of practices for optimizing the ReFlow loss Eq. (13) and solving the ODE Eq. (3). sg means stop gradient and HPF denotes high-pass filter. Baseline is the combination of most recent techniques which do not violate the flow matching theory. + +Generalizing the loss function. We also consider using general loss functions in ReFlow, i.e., + +$$ +\mathcal {L} _ {\mathrm {F M}} (\theta ; \mathbb {Q} _ {0 1}, \boldsymbol {x} _ {t}, t) = \mathbb {E} _ {\boldsymbol {x} _ {0} \sim \mathbb {Q} _ {0 | t} (\cdot | \boldsymbol {x} _ {t})} [ \ell (\boldsymbol {x} _ {0}, \boldsymbol {D} _ {\theta} (\boldsymbol {x} _ {t}, t)) ] \tag {11} +$$ + +for general $\ell : \mathbb{R}^d \times \mathbb{R}^d \to \mathbb{R}$ . It is difficult to precisely characterize the class of $\ell$ that preserves the minimizers of Eq. (1), and popular losses such as LPIPS (Kendall et al., 2018) and pseudo-Huber (PH) (Song & Dhariwal, 2024) lack this guarantee. However, $\ell_{\mathrm{MSE}}$ has been observed to be suboptimal compared to, e.g., LPIPS and PH for training fast models (Lee et al., 2024). To mitigate this trade-off between theoretical correctness and practicality, we consider a wider class of losses + +$$ +\ell_ {\phi} (\boldsymbol {x}, \boldsymbol {y}) := \| \phi (\boldsymbol {x}) - \phi (\boldsymbol {y}) \| _ {2} ^ {2} \tag {12} +$$ + +for invertible linear maps $\phi : \mathbb{R}^d \to \mathbb{R}^d$ . This again ensures that the loss is minimized when $D_{\theta}$ outputs the posterior mean, and $\ell_{\mathrm{MSE}}$ is a special case of this loss with the identity map $\phi = I$ . + +Generalized FM loss. Combining the two generalizations, we have our generalized FM loss + +$$ +\mathcal {L} _ {\mathrm {G F M}} (\theta ; \mathbb {Q} _ {0 1}) = \mathbb {E} _ {t \sim \mathbb {T}} \mathbb {E} _ {\boldsymbol {x} _ {t} \sim \mathbb {Q} _ {t}} \left[ w (\boldsymbol {x} _ {t}, t) \cdot \mathcal {L} _ {\mathrm {G F M}} (\theta ; \mathbb {Q} _ {0 1}, \boldsymbol {x} _ {t}, t) \right], \tag {13} +$$ + +$$ +w h e r e \mathcal {L} _ {\mathrm {G F M}} (\theta ; \mathbb {Q} _ {0 1}, \boldsymbol {x} _ {t}, t) := \mathbb {E} _ {\boldsymbol {x} _ {0} \sim \mathbb {Q} _ {0 | t} (\cdot | \boldsymbol {x} _ {t})} \left[ \ell_ {\phi} \left(\boldsymbol {x} _ {0}, \boldsymbol {D} _ {\theta} \left(\boldsymbol {x} _ {t}, t\right)\right) \right]. \tag {14} +$$ + +The following proposition ensures its theoretical correctness. Proof is deferred to Appendix E.1. + +Proposition 1. Let $w(\pmb{x}_t, t)$ , $d\mathbb{T}(t)$ be positive, and $\phi$ be an invertible linear map. Then, $\theta$ minimizes Eq. (13) if and only if it minimizes Eq. (1). + +# 3.1.1 TRAINING DYNAMICS, LEARNING, AND INFERENCE + +We now observe that there are seven components that constitute ReFlow: time distribution $\mathbb{T}$ , training dataset (empirical realization of $\mathbb{Q}_{01}$ ), weight $w(\boldsymbol{x}_t, t)$ , loss function $\ell_{\phi}$ , denoiser $\pmb{D}_{\theta}$ , and ODE solver and discretization schedule for solving Eq. (3). We categorize them into three groups below. + +Training dynamics influence the path that the model takes towards the minimizers of Eq. (13) during training. Although the solution to which the model converges may change if dynamics changes, training dynamics do not impact the solution set itself. Weight function $w(\boldsymbol{x}_t, t)$ , time distribution $\mathbb{T}$ , and loss function $\ell_{\phi}$ belong here. Learning influence the solution set of Eq. (13) by constraining the hypothesis class or by changing the training dataset. Parameterization of $D_{\theta}$ and how we sample from $\mathbb{Q}_{01}$ belong here. Finally, inference influence generation or inversion of samples given a trained model. ODE solver and time discretization of the unit interval belong here. + +In Tab. 1, we describe recent ReFlow practices within our framework. Baseline is the collection of most recent ReFlow techniques which do not violate FM theory (Lipman et al., 2023). We will build up improvements on this baseline setting in the subsequent sections. + +# 3.2 IMPROVING TRAINING DYNAMICS + +Evaluation protocol. To evaluate a training setting, we perform a single ReFlow step. Unless written otherwise, we initialize ReFlow denoisers with pre-trained EDM (Karras et al., 2022) denoisers + +![](images/de90d40b9d47a4f1a36879a2c4b6f87ed3c4d1faed646004125390957f6b5e0e.jpg) +Figure 1: Min., avg., max. relative losses after training on CIFAR10. + +
w(xt,t)CIFAR10AFHQv2FFHQ
12.832.874.28
1/t2.772.764.01
1/t²2.762.744.04
(σ²+0.5²)/(0.5σ)²2.782.824.04
1/Ex[sg[LCGFM(θ;Q01,xt,t)]]2.742.793.83
1/sg[LCGFM(θ;Q01,xt,t)]2.612.743.83
+ +Table 2: Comparison of various $w(\pmb{x}_t, t)$ , combined with baseline $\mathbb{T}$ , $\ell$ , and learning choices. Best numbers are bolded, and second best are underlined. + +and optimize Eq. (13) with $\mathbb{Q}_{01} = \mathbb{Q}_{01}^{1}$ of Eq. (7) for $200k$ iterations. We sample $1M$ pairs from $\mathbb{Q}_{01}^{1}$ by solving Eq. (6) from $t = 1$ to 0 with EDM models and use them for training. We measure the performance of an optimized model by computing the FID (Heusel et al., 2017) between $50k$ generated images and all available dataset images. Samples are generated by solving Eq. (3) with the Heun solver (Ascher & Petzold, 1998) with 9 NFEs, and we use the sigmoid discretization instead of the baseline uniform discretization for reasons discussed in Appendix F.1. We report the minimum FID out of three random generation trials. See Appendix D for a complete description. + +# 3.2.1 LOSS NORMALIZATION + +Previous practice. There is little study on suitable loss weights for ReFlow training. For instance, Lee et al. (2024) use $w(\boldsymbol{x}_t,t) = 1$ , and such choices can be detrimental to training, as the weighted loss $w(\boldsymbol{x}_t,t)\cdot \mathcal{L}_{\mathrm{GFM}}(\theta ;\mathbb{Q}_{01},\boldsymbol{x}_t,t)$ without proper modulation by $w(\boldsymbol{x}_t,t)$ can have vastly different scales w.r.t. $t$ , leading to slow and unstable model convergence. Typically, the loss vanishes as $t\to 0$ since $\boldsymbol{x}_t\rightarrow \boldsymbol{x}_0$ , and to counteract this, previous works have suggested + +$$ +w(\boldsymbol{x}_{t},t) = \left\{ \begin{array}{ll}1 / t & \text{for}\mbox{\rm ReFlow (Lee et al., 2024),}\\ (\sigma^{2} + 0.5^{2}) / (0.5\sigma)^{2}, \sigma := \frac{t}{1 - t} & \text{for DMs (Karras et al., 2022),}\\ 1 / \mathbb{E}_{\boldsymbol{x}_{t}\sim \mathbb{Q}_{t}}[\operatorname {sg}[\mathcal{L}_{\mbox{\rm GFM}}(\theta ;\mathbb{Q}_{01},\boldsymbol{x}_{t},t)]] & \text{for DMs (Karras et al., 2023b),} \end{array} \right. +$$ + +where $\mathrm{sg}[\cdot ]$ is stop-gradient. The FM weight $1 / t^{-2}$ in Eq. (2) naturally emphasizes $t\approx 0$ as well. + +However, we claim that such weights constant w.r.t. $\boldsymbol{x}_t$ can be sub-optimal for ReFlow, as ReFlow loss scales can vary greatly w.r.t. $\boldsymbol{x}_t$ even for fixed $t$ . For instance, the following proposition shows that, at initialization, relative loss for DM at $t = 1$ is constant whereas relative loss for ReFlow can be arbitrarily large. Proof is deferred to Appendix E.2. + +Proposition 2. Assume output layer zero initialization for the DM denoiser and DM initialization for the ReFlow denoiser. Then maximum relative losses for DM and ReFlow at $t = 1$ are + +$$ +\max _ {\boldsymbol {x} _ {1}} \mathcal {L} _ {\mathrm {D M}} (\theta ; \mathbb {P} _ {0} \otimes \mathbb {P} _ {1}, \boldsymbol {x} _ {1}, 1) / \min _ {\boldsymbol {x} _ {1}} \mathcal {L} _ {\mathrm {D M}} (\theta ; \mathbb {P} _ {0} \otimes \mathbb {P} _ {1}, \boldsymbol {x} _ {1}, 1) = 1 +$$ + +$\max_{\pmb{x}_1}\mathcal{L}_{\mathrm{GFM}}(\theta ;\mathbb{Q}_{01}^1,\pmb {x}_1,1) / \min_{\pmb{x}_1}\mathcal{L}_{\mathrm{GFM}}(\theta ;\mathbb{Q}_{01}^1,\pmb {x}_1,1) = \max_{\pmb {x}_0,\pmb{x}_0'}\| \pmb {x}_0 - \pmb {\mu}_0\| _2^2 /\| \pmb{x}_0' - \pmb {\mu}_0\| _2^2$ resp., where $\pmb{\mu}_0 = \mathbb{E}_{\pmb{x}_0\sim \mathbb{P}_0}[\pmb {x}_0]$ , and $\min_{\pmb {x}_i}$ $\max_{\pmb{x}_i}$ is taken w.r.t. $\pmb {x}_i$ in the support of $\mathbb{P}_i$ + +In fact, in Fig. 1, we observe that ReFlow loss varies greatly w.r.t. $\boldsymbol{x}_t$ after training as well. In contrast to DM training loss whose minimum and maximum values differ by a factor of at most 20, minimum ReFlow loss is at least $\times 100$ smaller than the maximum loss for all $t > 0.2$ . + +Our improvement. Multi-task learning interpretation of loss normalization (Zhang et al., 2018; Karras et al., 2023b) (see Appendix G) motivates a simple improvement by using + +$$ +w \left(\boldsymbol {x} _ {t}, t\right) = 1 / \operatorname {s g} \left[ \mathcal {L} _ {\mathrm {G F M}} \left(\theta ; \mathbb {Q} _ {0 1}, \boldsymbol {x} _ {t}, t\right) \right]. \tag {15} +$$ + +Similar to Karras et al. (2023b), we keep track of the loss values during training with a small neural net that is optimized alongside $D_{\theta}$ using the parameterization $w(\pmb{x}_t, t) = \exp(-f_{\phi}(\pmb{x}_t, t))$ . + +Ablations. In Tab. 2, we compare our weight with all aforementioned weights. As expected, the uniform weight $w(\pmb{x}_t,t) = 1$ has the worst performance, as it is unable to account for vanishing loss as $t\to 0$ . We get noticeable FID gain by using weights such as $1 / t$ or which place a larger emphasis on $t = 0$ . Our weight, which accounts for loss variance w.r.t. both $t$ and $\pmb{x}_t$ , yields the best FID across all three datasets. The gap between baselines and our weight is especially large on CIFAR10. + +# 3.2.2 TIME DISTRIBUTION + +![](images/e503faca264628895bd37ad77656fb00e2687dd145e296eb46d205cee28d7cf1.jpg) +(a) $\pmb{v}_{\theta}(\pmb{x}_t,t)$ + +![](images/aac5f80cf0939886a186c3d8438af0f56fd471540b9e67c55af909dd4d60d4c5.jpg) +(b) FM with $\ell_{\mathrm{MSE}}$ + +![](images/0ffb5ad102a16b875173b4c376b2676029cb7c76be52dc81b95b69dd62ea5af4.jpg) + +![](images/b83457e4b73f1fdcf0980c83d7aafe5c33fa796316da56de6e858ae5c2109b23.jpg) +(c) FM with PH + +![](images/7af6ff59081ba798a6c47d1525de44ec59ed414a7d723031a7261a485045f714.jpg) + +Previous practice. Liu et al. (2022) and Zhu et al. (2024) use a uniform distribution on $(0,1)$ . On the other hand, Lee et al. (2024) notice better performance with a time distribution whose density is proportional to a shifted hyperbolic cosine function, i.e., $d\mathbb{T}(t)\propto \cosh (4(t - 0.5))$ which has peaks at $t = 0$ and 1. The rationale behind using such a distribution is that, as Eq. (3) converges to a straight ODE with ReFlows, the denoiser needs to directly predict data from noise at $t\approx 1$ and vice versa at $t\approx 0$ , so it is beneficial to emphasize those regions via $\mathbb{T}$ . + +Our improvement. The peak at $t = 0$ of the baseline cosh time density compensates for vanishing loss as $t \to 0$ , but as we normalize the loss with our weight, this peak is now no longer necessary. Thus, we use a distribution with density proportional to the increasing exponential, i.e., $d\mathbb{T}(t) \propto a^t$ for $a \geq 1$ . + +Ablations. We compare the performance of the exponential distribution with $a \in \{1, 10, 100\}$ , where $a = 1$ corresponds to the uniform distribution. We also compare with the lognormal distribution, which has been observed (Karras et al., 2022; 2023b; Song & Dhariwal, 2024) Fig. 7 training results. We first note that an emphasis on $t = 1$ degradation with the lognormal distribution. We then observe a cosh distribution, but without the peak at $t = 0$ , has consi from a slight loss on CIFAR10. Other choices such as $1^t$ or worse FID. Hence, we propose to take $d\mathbb{T}(t) \propto 10^t$ . + +![](images/873fd6854c7e3b6c4078d451212f87aa789e03295e5ebfa9137781475ecc5694.jpg) +Figure 3: Comparison of flow matching (FM) with $\ell_{\mathrm{MSE}}$ and Pseudo Huber (PH) losses. +Figure 2: Time distribution densities. + +
dT(t)∞CIFAR10AFHQv2FFHQ
cosh(4(t-0.5))2.612.743.83
lognormal3.283.204.48
uniform (1t)2.652.703.85
10t2.622.693.77
100t2.682.693.93
+ +Table 3: Comparison of various $\mathbb{T}$ , combined with our $w(\pmb{x}_t, t)$ and baseline $\ell$ and learning choices. + +to be effective for training DMs and CMs, it displays time densities, and Tab. 3 shows its necessary, as evidenced by severe FID, serve that $10^{t}$ , which closely resembles the entirely good performance, while suffering at $100^{t}$ are either too flat or sharp, yielding + +# 3.2.3 LOSS FUNCTION + +Previous practice. To accelerate convergence and mitigate sample quality degradation during Ref-Flow, previous works have employed heuristic losses in Eq. (2) such as LPIPS and + +$$ +\ell (\boldsymbol {x}, \boldsymbol {y}) = \left\{ \begin{array}{l l} (1 / t) \cdot (\| \boldsymbol {x} - \boldsymbol {y} \| _ {2} ^ {2} + (c t) ^ {2}) ^ {1 / 2} - c & \text {P s e u d o - H u b e r (P H)} \\ \operatorname {L P I I P S} (\boldsymbol {x}, \boldsymbol {y}) + (1 - t) \cdot \operatorname {P H} (\boldsymbol {x}, \boldsymbol {y}) & \operatorname {L P I I S} + \operatorname {P H} (\text {L e e e t a l . , 2 0 2 4}). \end{array} \right. +$$ + +While such losses perform better in practice than $\ell_{\mathrm{MSE}}$ in terms of FID, they do not ensure Eq. (1) is minimized at optimality, and so lose the theoretical guarantees of FM. We demonstrate this below. + +Fig. 3 compares FM with $\ell_{\mathrm{MSE}}$ and PH, where $\mathbb{P}_1$ is unit Gaussian and $\mathbb{P}_0$ is a mixture of Gaussians. As shown in Fig. 3a, the two models learn distinct vector fields, so PH indeed induces different ODE trajectories. While the model trained with $\ell_{\mathrm{MSE}}$ translates between $\mathbb{P}_0$ and $\mathbb{P}_1$ accurately, the model trained with PH generates incorrect distributions, e.g., the model density is not isotropic at $t = 1$ , and modes are biased at $t = 0$ . So, instead of relying on empirical arguments (e.g., Section 4 in Lee et al. (2024)) to justify heuristic losses, we show that a proper choice of the invertible linear map $\phi$ in Eq. (12) can still offer non-trivial performance gains while adhering to FM theory. + +Our improvement. Previous works have observed high-frequency features are crucial to diffusion-based modeling of image datasets (Kadkhodaie et al., 2024; Zhang & Hooi, 2023; Yang et al., 2023). + +
LossCIFAR10AFHQv2FFHQ
\( \ell_{\text{MSE}} \)2.622.693.77
PH2.592.713.75
LPIPS2.812.654.02
LPIPS+PH2.632.723.79
\( \ell_{I+0.1HPF} \)2.632.623.76
\( \ell_{I+10HPF} \)2.582.553.69
\( \ell_{I+1000HPF} \)3.202.794.43
+ +Table 4: Comparison of various $\ell$ combined with our $w\left( {{\mathbf{x}}_{t},t}\right)$ and $\mathbb{T}$ . + +![](images/f983d6cb12c8bbc5a28faba354b08717df6bfba816d4d69d0a9d6ee7dd4bb6de.jpg) +Figure 4: $\lambda$ ablation. + +![](images/258f862562daa0d583bcb0e739a60b2802e068f47546041e2f236ef78ca6fd5b.jpg) +Figure 5: CIFAR10 training. + +Moreover, since we initialize $D_{\theta}$ with a pre-trained DM, we assert that the model already has a good representation of low-frequency visual features. Hence, to accelerate the learning of high-frequency features, we propose calculating the difference of denoiser output $D_{\theta}(\pmb{x}_t,t)$ and clean data $\pmb{x}_0$ after passing them through a high-pass filter (HPF) using the linear map, i.e., use $\ell_{\phi}$ in Eq. (12) with + +$$ +\phi = \boldsymbol {I} + \lambda \cdot \mathrm {H P F} \tag {16} +$$ + +where $\lambda > 0$ controls the emphasis on high-frequency features. The identity matrix in Eq. (16) is necessary to ensure that $\phi$ is invertible, so Eq. (1) is minimized at optimality per Prop. 1. We also remark that using $\ell_{\phi}$ can be interpreted as preconditioning the gradient. Specifically, since + +$$ +\nabla_ {\boldsymbol {D} _ {\theta}} \ell_ {\phi} \left(\boldsymbol {x} _ {0}, \boldsymbol {D} _ {\theta} \left(\boldsymbol {x} _ {t}, t\right)\right) = \phi^ {\top} \phi \left\{\nabla_ {\boldsymbol {D} _ {\theta}} \ell_ {\mathrm {M S E}} \left(\boldsymbol {x} _ {0}, \boldsymbol {D} _ {\theta} \left(\boldsymbol {x} _ {t}, t\right)\right) \right\}, \tag {17} +$$ + +using $\ell_{\phi}$ in place of $\ell_{\mathrm{MSE}}$ is equivalent to scaling the original FM loss gradient along the eigenvectors of $\phi^{\top}\phi$ by the corresponding eigenvalues. For instance, $\ell_{\phi}$ with Eq. (16) amplifies gradient magnitudes along high-frequency features by $(\lambda + 1)$ , and leaves gradient magnitudes along low-frequency features unchanged. This perspective provides another justification for using $\ell_{\phi}$ , since using an appropriate preconditioning matrix can accelerate convergence (Kingma & Ba, 2015). + +Ablations. Tab. 4 compares our loss $\ell_{I + \lambda \mathrm{HPF}}$ for $\lambda \in \{0.1, 10, 1000\}$ with $\ell_{\mathrm{MSE}}$ and the heuristic losses. If $\lambda$ is too small, $\ell_{I + \lambda \mathrm{HPF}}$ has little improvement compared to $\ell_{\mathrm{MSE}}$ , whereas if $\lambda$ is too large, $\phi$ becomes nearly singular, leading to a severe drop in the FID. Our loss with $\lambda = 10$ provides consistent improvement over $\ell_{\mathrm{MSE}}$ , doing even better than PH and LPIPS. Indeed, in Fig. 4 which visualizes FID change w.r.t. $\ell_{\mathrm{MSE}}$ for various values of $\lambda$ , we observe $\lambda = 10$ provides the optimal performance across all datasets. Moreover, CIFAR10 learning curves in Fig. 5 verify that $\ell_{I + 10 \mathrm{HPF}}$ enjoys fast convergence compared to all other losses. + +# 3.3 IMPROVING LEARNING + +# 3.3.1 MODEL DROPOUT + +Previous practice. Similar to simple diffusion (Hoogeboom et al., 2023), we find dropout to be highly impactful. There is little study on the impact of dropout in denoiser UNets for ReFlow. Dropout rates in ReFlow denoiser UNets are usually set to 0.15 (Liu et al., 2022; Zhu et al., 2024), or equal to the dropout rates of DMs that are used to initialize ReFlow denoisers (Lee et al., 2024). For the EDM networks, dropout rates are 0.13 on CIFAR10, 0.25 on AFHQv2, and 0.05 on FFHQ. + +Our improvement. We observe that learning a straight ODE is a harder task than learning the diffusion probability flow ODE. For instance, at $t = 1$ , the optimal DM denoiser only needs to predict the data mean $\mathbb{E}_{\boldsymbol{x}_0 \sim \mathbb{P}_0}[\boldsymbol{x}_0]$ for any input $\boldsymbol{x}_1 \sim \mathbb{P}_1$ , but a denoiser for a perfectly straight ODE has to directly map $\mathbb{P}_1$ samples to $\mathbb{P}_0$ samples. This means we need a larger Lipschitz constant for the ReFlow denoiser (Salmona et al., 2022) (see Appendix G for further discussion), so we use smaller dropout rates during ReFlow training in favor of larger UNet capacity over regularization. + +Ablations. To verify that smaller dropout rates are beneficial, we return to the baseline training setting (Tab. 1), and run a grid search over dropout probability $p \in [0, 0.15]$ . In Fig. 6, which shows FID change w.r.t. baseline $p = 0.15$ , we find that smaller $p$ is always beneficial. In fact, optimal $p$ are even smaller than those used to train EDM denoisers, despite using the same architecture (Tab. 5). FIDs after applying optimal dropout to baseline are written in row BSL+OP of Tab. 6. We also observe in row DYN+OP that optimal dropout rates can be combined with improved dynamics to further enhance performance without additional grid search over $p$ . + +![](images/325eed97cddfc1dd5184131af5d225fac831959c33a071102cf2e475c2960cb9.jpg) +Figure 6: Dropout $p$ ablation. + +
CIFAR10AFHQv2FFHQ
RF p =0.150.150.15
EDM p =0.130.250.05
Ours p =0.090.090.03
+ +Table 5: Dropout $p$ in each setting. + +
CIFAR10AFHQv2FFHQ
Baseline (BSL)2.832.874.28
Dynamics (DYN)
BSL + w(xt,t)2.61∇0.222.74∇0.133.83∇0.45
BSL + w(xt,t) + T2.62∇0.212.69∇0.183.77∇0.51
BSL + w(xt,t) + T + ℓφ2.58∇0.252.55∇0.323.69∇0.59
Learning (LRN)
BSL + Optimal p (OP)2.63∇0.202.67∇0.203.60∇0.68
BSL + OP + Forward2.57∇0.262.63∇0.243.60∇0.68
BSL + OP + Projected2.57∇0.262.62∇0.253.58∇0.70
DYN & LRN
DYN + OP2.43∇0.402.53∇0.343.17∇1.11
DYN + OP + Forward2.38∇0.452.44∇0.433.14∇1.14
DYN + OP + Projected2.38∇0.452.47∇0.403.13∇1.15
+ +Table 6: Summary of our training improvements. Subscripts denote FID improvement w.r.t. baseline. Evaluated with sigmoid discretization (see Append. F.1). + +![](images/f34eb6530697f5d3897264c7a17dc19baf5d27dc578095c511694c10b105b81c.jpg) +Figure 7: $\rho$ ablation. Solid and dotted lines show results w/o and with improved dynamics, resp. + +![](images/f2f4e297654fb69f43a9a0a19600d955c40650cc4e7153436dd96f15aff41756.jpg) + +![](images/8ff01a6e2f72478d57446e440db48d20d2b36bb2dc40f37921e5a7aa03263bb1.jpg) + +# 3.3.2 TRAINING COUPLING + +Previous practice. A common practice is to generate a large number of pairs from $\mathbb{Q}_{01}^{1}$ by solving the diffusion probability flow ODE Eq. (6) backwards, i.e., from noise to data, and use the generated set as an empirical approximation of $\mathbb{Q}_{01}^{1}$ throughout training (Liu et al., 2022; Lee et al., 2024; Zhu et al., 2024; Liu et al., 2024). However, the set of generated $x_{0}$ is only an approximation of the true marginal $\mathbb{P}_0$ , so naively training with generated data will accumulate error on the marginal at $t = 0$ as discussed by Alemohammad et al. (2024) (see Appendix G for further discussion). + +Our improvement - forward pairs. To mitigate error accumulation at $t = 0$ , we incorporate pairs generated by solving the diffusion probability flow ODE forwards, starting from data, coined forward pairs. We assert forward pairs can be helpful, as $x_0$ are exactly data points. + +To use forward pairs, we first invert the training sets for each dataset, which yields additional $50k$ pairs for CIFAR10, $13.5k$ pairs for AFHQv2, and $70k$ pairs for FFHQ. Due to the small number of forward pairs, we use them in combination with backward pairs, and to prevent forward pairs from being ignored due to the large number of backward pairs, we sample forward pairs with probability $\rho$ and backward pairs with probability $1 - \rho$ at each step of the optimization. + +Our improvement - projected pairs. We also propose projecting the coupling $\mathbb{Q}_{01}^{1}$ to $\Pi (\mathbb{P}_0,\mathbb{P}_1)$ , the set of joint distributions with marginals $\mathbb{P}_0$ and $\mathbb{P}_1$ , by solving the optimization problem + +$$ +\widehat {\mathbb {Q}} _ {0 1} ^ {1} = \arg \min _ {\Gamma_ {0 1}} W _ {p} \left(\Gamma_ {0 1}, \mathbb {Q} _ {0 1} ^ {1}\right) \quad s. t. \quad \Gamma_ {0 1} \in \Pi \left(\mathbb {P} _ {0}, \mathbb {P} _ {1}\right) \tag {18} +$$ + +where $W_{p}$ is the $p$ -Wasserstein distance (Villani, 2009), and using the projected coupling $\widehat{\mathbb{Q}}_{01}^{1}$ in place of the original during training. Intuitively, this procedure can be understood as fine-tuning the generated marginals to adhere to the true marginals without losing the coupling information in $\mathbb{Q}_{01}^{1}$ . We do not mix projected pairs with any other pairs. The full procedure is described in Appendix D. + +Ablations. In Fig. 7, we see that it is always beneficial to use forward pairs, as long as $\rho$ is not too high, e.g., $\rho \leq 0.5$ . Otherwise, the model starts overfitting to the forward pairs. Interestingly, on FFHQ, using forward pairs without improved training dynamics has no improvement in the FID, implying that improved dynamics may be necessary to make the best out of the rich information contained in the forward pairs. In rows $\mathrm{BSL + OP + Projected}$ and $\mathrm{DYN + OP + Projected}$ of Tab. 6, we observe that projected pairs also offer improvements in the FID score across all three datasets. + +
CIFAR10AFHQv2FFHQ
Unif.2.36∇0.472.34∇0.532.97∇1.31
EDM2.80∇0.033.61Δ0.746.78Δ2.50
Ours
κ = 102.31∇0.522.31∇0.562.87∇1.41
κ = 202.23∇0.602.30∇0.572.84∇1.44
κ = 302.45∇0.382.78∇0.093.32∇0.96
+ +Table 7: Various discretizations applied to our best models and DPM-Solver with $r = 0.4$ . + +![](images/6b19fad2c789068ca444fca23bddcbde477f58b2feed7d515736f3cab96ea0d4.jpg) +Figure 8: Truncation error. + +![](images/a5e324dea74afa73a29d69a343ee2e098d65f6ca11fc084ee765538034bf4da9.jpg) +Figure 9: $\kappa$ ablation. + +# 3.4 IMPROVING INFERENCE + +Previous practice. To generate data after ReFlow, previous works often use an uniform discretization $\{t_i = i / N : i = 0, \dots, N\}$ of $[0,1]$ along with the Euler or Heun to integrate Eq. (3) from $t = 1$ to 0 (Liu et al., 2022; 2024; Lee et al., 2024; Zhu et al., 2024). + +Our improvement. As ReFlow ODE converges to a straight ODE, we assert that high-curvature regions in ODE paths now occur near $t \in \{0,1\}$ . While the previously proposed EDM schedule + +$$ +t _ {0} = 0, \quad t _ {i} = \frac {\sigma_ {i}}{\sigma_ {i} + 1} \text {w h e r e} \sigma_ {i} = \left(\sigma_ {\min } ^ {1 / d} + \frac {i}{N} \left(\sigma_ {\max } ^ {1 / d} - \sigma_ {\min } ^ {1 / d}\right)\right) ^ {d} +$$ + +for solving diffusion probability flow ODEs emphasizes $t \in \{0,1\}$ , + +we note that it does not perform better than the uniform discretization, as shown in Tab. 7. Similar to Lin et al. (2024), we speculate that this is because $t_N < 1$ . Specifically, $\pmb{v}_{\theta}(\pmb{x}_1,t_N) \neq \pmb{v}_{\theta}(\pmb{x}_1,1)$ since $t_N \neq 1$ , but the integration of the ODE is done with $\pmb{v}_{\theta}(\pmb{x}_1,t_N)$ in place of $\pmb{v}_{\theta}(\pmb{x}_1,1)$ , leading to erroneous ODE trajectories. + +![](images/356080987e741a405add93ddc287f00b7ae98bef83c233479c92ee5f51a05a75.jpg) +Figure 10: Discretizations. + +Instead of tuning $\{\sigma_{\mathrm{min}},\sigma_{\mathrm{max}},d\}$ to address this problem, we propose a simple sigmoid schedule + +$$ +\left\{t _ {i} = \left(\operatorname {s i g} \left(\kappa \left(\frac {i}{N} - 0. 5\right)\right) - \operatorname {s i g} \left(- \frac {\kappa}{2}\right)\right) / \left(\operatorname {s i g} \left(\frac {\kappa}{2}\right) - \operatorname {s i g} \left(- \frac {\kappa}{2}\right)\right): i = 0, \dots , N \right\} \tag {19} +$$ + +with one parameter $\kappa$ which controls the concentration of $t_i$ at $t\in \{0,1\}$ . Here, sig is the sigmoid function. As $\kappa \rightarrow 0$ , $\{t_i\}$ converges to the uniform discretization, and as $\kappa \rightarrow \infty$ , all $t_i$ with $i < N / 2$ will converge to 0, and all $t_i$ with $i > N / 2$ will converge to 1. + +To solve the ODE Eq. (3), we consider DPM-Solver (Lu et al., 2022) with the update rule + +$$ +\boldsymbol {x} _ {t _ {i}} \leftarrow \boldsymbol {x} _ {t _ {i + 1}} + \left(t _ {i} - t _ {i + 1}\right) \left(\frac {1}{2 r} \boldsymbol {v} _ {\theta} \left(\boldsymbol {x} _ {s _ {i + 1}}, s _ {i + 1}\right) + \left(1 - \frac {1}{2 r}\right) \boldsymbol {v} _ {\theta} \left(\boldsymbol {x} _ {t _ {i + 1}}, t _ {i + 1}\right)\right) \tag {20} +$$ + +where $s_{i+1} = t_i^r t_{i+1}^{1-r}$ and $r \in (0, 1]$ . We recover the second order Heun update (the baseline solver) with $r = 1$ , but we assert that we can obtain better performance by tuning $r$ . + +Ablations. In Tab. 7, we display results for solving Eq. (3) with various discretizations and DPM-Solver with $r = 0.4$ . First, row $\kappa = 10$ shows that we can indeed mitigate the timestep mismatch problem in the EDM schedule. It also shows we can gain improvements by using $r < 1$ (in the baseline setting, we use the sigmoid schedule with $\kappa = 10$ and Heun). See Appendix F.2 for a full ablation over $r$ . Second, rows $\kappa = 20, 30$ tells us we can get even better results by increasing sharpness, but too large $\kappa$ hurts performance. + +To investigate the performance difference between discretizations, we visualize local truncation error $\| \pmb{\tau}\|_{2}$ in Fig. 8, where $\pmb{\tau}$ given time-step $t_i$ and $\pmb{x}_{t_{i + 1}}\sim \mathbb{Q}_{t_{i + 1}}$ is defined as + +$$ +\boldsymbol {\tau} = \left(\boldsymbol {x} _ {t _ {i + 1}} + \left(t _ {i} - t _ {i + 1}\right) \boldsymbol {v} _ {\theta} \left(\boldsymbol {x} _ {t _ {i + 1}}, t _ {i + 1}\right)\right) - \operatorname {s o l v e} \left(\boldsymbol {x} _ {t _ {i + 1}}, \boldsymbol {D} _ {\theta}, t _ {i + 1}, t _ {i}\right). +$$ + +We first note that the uniform distribution incurs large error near $t \in \{0,1\}$ . This highlights that we indeed must place more points near those $t$ in order to control discretization error. While the EDM schedule has less error at those regions, because $t_N \neq 1$ , the mismatch between the initial state $x_1$ and time $t_N$ does not ensure the ODE is solved properly. Finally, we see that our schedule is able to control the error at the extremes. While the error for our schedule increases near $t \approx 0.5$ , Fig. 9 tells us we can sacrifice accuracy at intermediate $t$ to prioritize perceptual quality by choosing a large $\kappa$ . + +
MethodCIFAR10AFHQv2FFHQImageNet (cond.)Reference
NFEFIDSTNNFEFIDSTNNFEFIDSTNNFEFIDSTN
DM ODE
EDM351.9714.19791.9628.41792.3927.15792.3026.76(Karras et al., 2022)
937.91-928.03-956.84-935.46-—"—
DPM-Solver94.98----99.26-96.64-(Lu et al., 2022)
AMED-Solver92.63----94.24-95.60-(Zhou et al., 2024)
FM ODE
MinCurv98.765.87913.6310.45910.4410.49---(Lee et al., 2023)
FM-OT1426.35-------13814.45-(Lipman et al., 2023)
OT-CFM1004.44----------(Tong et al., 2023)
MOT-50---------13211.82-(Pooladian et al., 2023)
FM*1002.9610.731002.7316.201003.3016.71---Baseline
MOT-512*1003.298.771005.5313.451004.6914.29---—"—
MOT-1024*1003.188.591005.8313.451004.8414.07---—"—
MOT-4096*1003.168.341006.1812.681004.9213.47---—"—
ReFlow1103.36----------(Liu et al., 2022)
Simple ReFlow*92.231.6492.303.3092.842.8793.492.72Ours
+ Guidance*91.982.4991.915.6092.673.2491.743.92—"—
+ +Table 8: Comparison of neural ODE methods. MOT- $b$ is minibatch OT with minibatch size $b$ , and MinCurv is curvature minimizing flow. We report FID and straightness (STN): $S(\pmb{v}_{\theta}) \coloneqq \int_0^1 \mathbb{E}[\|(\pmb{x}_1 - \pmb{x}_0) - \pmb{v}_{\theta}(\pmb{x}_t, t)\|_2]$ dt. Star * next to a method denotes our training results. + +# 4 APPLICATIONS + +Comparison to other fast flow methods. Our approach significantly outperforms other ODE approaches, e.g., minibatch-OT FM (Pooladian et al., 2023; Tong et al., 2023) and curvature minimization (Lee et al., 2023), see see Tab. 8. Where possible, we report straightness (Liu et al., 2022), which quantifies how an ODE trajectory deviates from a straight line between its initial and terminal points (see Tab. 8 and Eq. (21) and further details in Appendix D). We attribute the inferior baseline performance due to bias in minibatch OT, and discuss this and other pitfalls in Appendix A. + +Improving perceptual quality via guidance. DMs often use guidance such as classifier-free guidance (CFG) (Ho & Salimans, 2022) or autoguidance (AG) (Karras et al., 2024) to enhance the perceptual quality of samples. As observed by Liu et al. (2024), conditional ReFlow models can also be combined with CFG. While it is unclear what effect guidance has on the marginals of ReFlow models, we also apply AG / CFG to our best unconditional / conditional models, since perceptual quality may be of interest for certain downstream tasks. We already achieve state-of-the-art results for fast ODE-based generation, but we obtain even lower FID scores with guidance, as shown in the last row of Tab. 8. See Appendix F.2 for a full ablation over guidance strength. + +![](images/e01716aa742f1ee451e522b6d82c8194c0265886aff479dd1c6fad908f2e3481.jpg) +Figure 11: ImageNet-64 FID at 9 NFEs without and with our improvements. + +Class-conditional ImageNet-64. We verify the scalability of our training dynamics (DYN), learning (LRN), and inference (INF) choices on ReFlow with the class-conditional ImageNet-64 EDM model. We use $8M$ backward, $4M$ forward pairs, and $\rho = 0.2$ . Fig. 11 at CFG scale $w = 0$ , i.e., no guidance, confirms that our techniques are effective. DYN+LRN improves BSL FID from 4.27 to 3.91, and INF further improves the FID to 3.49, improving on prior state-of-the-art fast flow methods. With CFG $w = 0.4$ , our DYN+LRN+INF model achieves an even better FID score of 1.74. Also, our techniques consistently improve CFG FIDs, implying that they offer orthogonal benefits. + +# 5 CONCLUSION + +We decompose the design space of ReFlow into training dynamics, learning, and inference. Within each group, we examine prior practices and their potential pitfalls. We propose seven improved choices for loss weight, time distribution, loss function, model dropout, training data, ODE discretization and solver. We verify the robustness of our techniques on CIFAR10, AFHQv2, and FFHQ, and their scalability on ImageNet-64. Our techniques yield SoTA results among fast neural ODE methods, without latent-encoders, perceptual losses, or premetrics. In terms of FID score, weight and dropout contributed most. However, in terms of novelty, we believe training data improvements and the generalized loss function are our largest contributions. + +# ACKNOWLEDGMENTS + +This work was supported by the National Research Foundation of Korea under Grant RS-2024-00336454 and by the Institute of Information & communications Technology Planning & Evaluation (IITP) grant funded by the Korea government (MSIT) (No.2019-0-00075, Artificial Intelligence Graduate School Program (KAIST)). + +# REFERENCES + +Michael S. Albergo and Eric Vanden-Eijnden. Building Normalizing Flows with Stochastic Interpolants. In ICLR, 2023. +Michael S Albergo, Nicholas M Boffi, and Eric Vanden-Eijnden. Stochastic interpolants: A unifying framework for flows and diffusions. arXiv preprint arXiv:2303.08797, 2023. +Sina Alemohammad, Josue Casco-Rodriguez, Lorenzo Luzi, Ahmed Imtiaz Humayun, Hossein Babaei, Daniel LeJeune, Ali Siahkoohi, and Richard Baraniuk. Self-Consuming Generative Models Go MAD. In ICLR, 2024. +Donald G. Anderson. Iterative procedures for nonlinear integral equations. J. ACM, 12(4):547-560, October 1965. ISSN 0004-5411. doi: 10.1145/321296.321305. URL https://doi.org/10.1145/321296.321305. +Uri M. Ascher and Linda R. Petzold. Computer Methods for Ordinary Differential Equations and Differential Algebraic Equations. Society for Industrial and Applied Mathematics, 1998. +Marc G Bellemare, Ivo Danihelka, Will Dabney, Shakir Mohamed, Balaji Lakshminarayanan, Stephan Hoyer, and Rémi Munos. The cramer distance as a solution to biased Wasserstein gradients. arXiv preprint arXiv:1705.10743, 2017. +Valentin De Bortoli, James Thornton, Jeremy Heng, and Arnaud Doucet. Diffusion Schrödinger Bridge with Applications to Score-Based Generative Modeling. In NeurIPS, 2021. +Yunjey Choi, Youngjung Uh, Jaejun Yoo, and Jung-Woo Ha. StarGAN v2: Diverse Image Synthesis for Multiple Domains. In CVPR, 2020. +Hyungjin Chung, Jeongsol Kim, Michael T. McCann, Marc L. Klasky, and Jong Chul Ye. Diffusion Posterior Sampling for General Noisy Inverse Problems. In ICLR, 2023. +Marco Cuturi. Sinkhorn distances: Lightspeed computation of optimal transport. In C.J. Burges, L. Bottou, M. Welling, Z. Ghahramani, and K.Q. Weinberger (eds.), Advances in Neural Information Processing Systems, volume 26. Curran Associates, Inc., 2013. URL https://proceedings.neurips.cc/paper_files/paper/2013/file/af21d0c97db2e27e13572cbf59eb343d-Paper.pdf. +Marco Cuturi, Laetitia Meng-Papaxanthos, Yingtao Tian, Charlotte Bunne, Geoff Davis, and Olivier Teboul. Optimal transport tools (ott): A jax toolbox for all things wasserstein. arXiv preprint arXiv:2201.12324, 2022. +Prafulla Dhariwal and Alex Nichol. Diffusion Models Beat GANs on Image Synthesis. In NeurIPS, 2021. +Tim Dockhorn, Arash Vahdat, and Karsten Kreis. GENIE: Higher-Order Denoising Diffusion Solvers. In NeurIPS, 2022. +Jean Feydy, Thibault Séjourne, François-Xavier Vialard, Shun-ichi Amari, Alain Trouve, and Gabriel Peyré. Interpolating between Optimal Transport and MMD using Sinkhorn Divergences. In AISTATS, 2019. +Zhengyang Geng, Ashwini Pokle, William Luo, Justin Lin, and J. Zico Kolter. Consistency Models Made Easy. arXiv preprint arXiv:2406.14548, 2024. +Ian J. Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative Adversarial Nets. In NeurIPS, 2014. +Martin Heusel, Hubert Ramsauer, Thomas Unterthiner, and Bernhard Nessler. GANs Trained by a Two TimeScale Update Rule Converge to a Local Nash Equilibrium. In NeurIPS, 2017. +Jonathan Ho and Tim Salimans. Classifier-Free Diffusion Guidance. arXiv preprint arXiv:2207.12598, 2022. +Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising Diffusion Probabilistic Models. In NeurIPS, 2020. + +Emiel Hoogeboom, Jonathan Heek, and Tim Salimans. Simple diffusion: End-to-end diffusion for high resolution images. In ICML, 2023. +Zahra Kadkhodaie, Florentin Guth, Eero P. Simoncelli, and Stephane Mallat. Generalization in diffusion models arises from geometry-adaptive harmonic representations. In ICLR, 2024. +Tero Karras, Samuli Laine, and Timo Aila. A Style-Based Generator Architecture for Generative Adversarial Networks. In CVPR, 2019. +Tero Karras, Miika Aittala, Timo Aila, and Samuli Laine. Elucidating the Design Space of Diffusion-Based Generative Models. In NeurIPS, 2022. +Tero Karras, Miika Aittala, Samuli Laine, Erik Härkonen, Janne Hellsten, Jaakko Lehtinen, and Timo Aila. Alias-Free Generative Adversarial Networks. In NeurIPS, 2023a. +Tero Karras, Miika Aittala, Jaakko Lehtinen, Janne Hellsten, Timo Aila, and Samuli Laine. Analyzing and Improving the Training Dynamics of Diffusion Models. In CVPR, 2023b. +Tero Karras, Miika Aittala, Tuomas Kynkänniemi, Jaakko Lehtinen, Timo Aila, and Samuli Laine. Guiding a Diffusion Model with a Bad Version of Itself. arXiv preprint arXiv:2406.02507, 2024. +Alex Kendall, Yarin Gal, and Roberto Cipolla. Multi-Task Learning Using Uncertainty to Weigh Losses for Scene Geometry and Semantics. In CVPR, 2018. +Beomsu Kim and Jong Chul Ye. Denoising MCMC for Accelerating Diffusion-Based Generative Models. In ICML, 2023. +Dongjun Kim, Chieh-Hsin Lai, Wei-Hsiang Liao, Naoki Murata, Yuhta Takida, Toshimitsu Uesaka, Yutong He, Yuki Mitsufuji, and Stefano Ermon. Consistency Trajectory Models: Learning Probability Flow ODE Trajectory of Diffusion. In ICLR, 2024a. +Sanghwan Kim, Hao Tang, and Fisher Yu. Distilling ODE Solvers of Diffusion Models into Smaller Steps. In CVPR, 2024b. +Diederik P. Kingma and Jimmy Lei Ba. Adam: A Method for Stochastic Optimization. In ICLR, 2015. +Diederik P Kingma and Ruiqi Gao. Understanding Diffusion Objectives as the ELBO with Simple Data Augmentation. In NeurIPS, 2023. +Alex Krizhevsky. Learning multiple layers of features from tiny images. Technical report, University of Toronto, 2009. +H. W. Kuhn. The hungarian method for the assignment problem. Naval Research Logistics Quarterly, 2(1-2): 83-97, 1955. doi: https://doi.org/10.1002/nav.3800020109. URL https://onlinelibrary.wiley.com/doi/abs/10.1002/nav.3800020109. +Sangyun Lee, Beomsu Kim, and Jong Chul Ye. Minimizing Trajectory Curvature of ODE-based Generative Models. In ICML, 2023. +Sangyun Lee, Zinan Lin, and Giulia Fanti. Improving the Training of Rectified Flows. arXiv preprint arXiv:2405.20320, 2024. +Alexander C. Li, Mihir Prabhudesai, Shivam Duggal, Ellis Brown, and Deepak Pathak. Your Diffusion Model is Secretly a Zero-Shot Classifier. In ICCV, 2023. +Shanchuan Lin, Bingchen Liu, Jiashi Li, and Xiao Yang. Common Diffusion Noise Schedules and Sample Steps are Flawed. In WACV, 2024. +Yaron Lipman, Ricky T. Q. Chen, Heli Ben-Hamu, Maximilian Nickel, and Matthew Le. Flow Matching for Generative Modeling. In ICLR, 2023. +Qiang Liu. Rectified Flow: A Marginal Preserving Approach to Optimal Transport. arXiv preprint arXiv:2209.14577, 2022. +Xingchao Liu, Chengyue Gong, and Qiang Liu. Flow Straight and Fast: Learning to Generate and Transfer Data with Rectified Flow. arXiv preprint arXiv:2209.03003, 2022. +Xingchao Liu, Xiwen Zhang, Jianzhu Ma, Jian Peng, and Qiang Liu. InstaFlow: One Step is Enough for High-Quality Diffusion-Based Text-to-Image Generation. In ICLR, 2024. + +Cheng Lu, Yuhao Zhou, Fan Bao, Jianfei Chen, Chongxuan Li, and Jun Zhu. DPM-Solver: A Fast ODE Solver for Diffusion Probabilistic Model Sampling in Around 10 Steps. In NeurIPS, 2022. +Chenlin Meng, Yutong He, Yang Song, Jiaming Song, Jiajun Wu, Jun-Yan Zhu, and Stefano Ermon. SDEdit: Guided Image Synthesis and Editing with Stochastic Differential Equations. In ICLR, 2022. +Stefano Peluchetti. Non-denoising forward-time diffusions. arXiv preprint arXiv:2312.14589, 2021. +Stefano Peluchetti. Diffusion bridge mixture transports, schrödinger bridge problems and generative modeling. Journal of Machine Learning Research, 24(374):1-51, 2023. +Aram-Alexandre Pooladian, Heli Ben-Hamu, Carles Domingo-Enrich, Brandon Amos, Yaron Lipman, and Ricky T. Q. Chen. Multisample Flow Matching: Straightening Flows with Minibatch Couplings. In ICML, 2023. +Herbert Robbins. An empirical Bayes approach to statistics. In Proceedings of the Third Berkeley Symposium on Mathematical Statistics and Probability, 1956. +Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Björn Ommer. High-Resolution Image Synthesis with Latent Diffusion Models. In CVPR, 2022. +Tim Salimans and Jonathan Ho. Progressive Distillation for Fast Sampling of Diffusion Models. In ICLR, 2022. +Antoine Salmona, Valentin de Bortoli, Julie Delon, and Agnès Desolneux. Can Push-forward Generative Models Fit Multimodal Distributions? In NeurIPS, 2022. +Yuyang Shi, Valentin De Bortoli, Andrew Campbell, and Arnaud Doucet. Diffusion Schrödinger Bridge Matching. In NeurIPS, 2023. +Richard Sinkhorn. A Relationship Between Arbitrary Positive Matrices and Doubly Stochastic Matrices. The Annals of Mathematical Statistics, 35(2):876 - 879, 1964. doi: 10.1214/aoms/1177703591. URL https://doi.org/10.1214/aoms/1177703591. +Jascha Sohl-Dickstein, Eric A. Weiss, Niru Maheswaranathan, and Surya Ganguli. Deep Unsupervised Learning using Nonequilibrium Thermodynamics. In ICML, 2015. +Jiaming Song, Chenlin Meng, and Stefano Ermon. Denoising Diffusion Implicit Models. In ICLR, 2021a. +Yang Song and Prafulla Dhariwal. Improved Techniques for Training Consistency Models. In ICLR, 2024. +Yang Song, Jascha Sohl-Dickstein, Diederik P. Kingma, Abhishek Kumar, Stefano Ermon, and Ben Poole. Score-Based Generative Modeling through Stochastic Differential Equations. In ICLR, 2021b. +Yang Song, Prafulla Dhariwal, Mark Chen, and Ilya Sutskever. Consistency Models. In ICML, 2023. +Josef Stoer and Roland Bulisch. Introduction to Numerical Analysis, volume 12. Springer Science+Business Media New York, 2002. +Xuan Su, Jiaming Song, Chenlin Meng, and Stefano Ermon. Dual Diffusion Implicit Bridges for Image-to-Image Translation. In ICLR, 2023. +Alexander Tong, Kilian Fatras, Nikolay Malkin, Guillaume Huguet, Yanlei Zhang, Jarrid Rector-Brooks, Guy Wolf, and Yoshua Bengio. Improving and generalizing flow-based generative models with minibatch optimal transport. arXiv preprint arXiv:2302.00482, 2023. +Cédric Villani. Optimal Transport: Old and New. Springer Berlin, Heidelberg, 2009. +Pascal Vincent. A Connection Between Score Matching and Denoising Autoencoders. Neural Computation, 23(7):1661-74, 2011. +Xingyi Yang, Daquan Zhou, Jiashi Feng, and Xinchao Wang. Diffusion Probabilistic Model Made Slim. In CVPR, 2023. +Qinsheng Zhang and Yongxin Chen. Fast Sampling of Diffusion Models with Exponential Integrator. In ICLR, 2023. +Richard Zhang, Phillip Isola, Alexei A. Efros, Eli Shectman, and Oliver Wang. The Unreasonable Effectiveness of Deep Features as a Perceptual Metric. In CVPR, 2018. + +Yifan Zhang and Bryan Hooi. HiPA: Enabling One-Step Text-to-Image Diffusion Models via High-Frequency-Promoting Adaptation. arXiv preprint arXiv:2311.18158, 2023. +Zhenyu Zhou, Defang Chen, Can Wang, and Chun Chen. Fast ODE-based Sampling for Diffusion Models in Around 5 Steps. In CVPR, 2024. +Yuanzhi Zhu, Xingchao Liu, and Qiang Liu. SlimFlow: Training Smaller One-Step Diffusion Models with Rectified Flow. In ECCV, 2024. + +# A FASTER ODES VIA COUPLINGS + +# A.1 FASTER SAMPLING VIA STRAIGHT PATHS + +Generative ODEs with straight trajectories can be solved accurately with substantially fewer velocity evaluations than those with high-curvature trajectories (Stoer & Bulisch, 2002). In fact, probability flow ODEs with perfectly straight trajectories can translate one distribution to another with a single Euler step. For an ODE with velocity $\boldsymbol{v}_{\theta}$ , we can quantify its straightness as (Liu et al., 2022): + +$$ +S (\boldsymbol {v} _ {\theta}) := \int_ {0} ^ {1} \mathbb {E} \left[ \| \left(\boldsymbol {x} _ {1} - \boldsymbol {x} _ {0}\right) - \boldsymbol {v} _ {\theta} \left(\boldsymbol {x} _ {t}, t\right) \| _ {2} \right] \mathrm {d} t \tag {21} +$$ + +where the expectation is over ODE trajectories $\{\pmb{x}_t : t \in [0,1]\}$ generated by $\pmb{v}_{\theta}$ . An ODE with zero straightness has linear trajectories, which means it can translate initial points to terminal points with a single function evaluation. + +One approach to encourage straight paths is to learn ODEs which minimize trajectory curvature (Lee et al., 2023) by parameterizing the coupling with a neural network which takes as input some image and outputs a sample such the distribution of these samples is close to Gaussian. Another approach is based on connections to optimal transport. + +# A.2 CONNECTION TO OPTIMAL TRANSPORT + +For any convex ground cost, the solution to the dynamic optimal transport on continuous support will be straight trajectories, see e.g. Liu (2022). In addition, training a flow matching model on samples from an optimal transport coupling will preserve the coupling, providing the vector field of the flow matching model is conservative. + +As an aside, more generally performing bridge matching (Peluchetti, 2021; Shi et al., 2023) on an entropically-regularized optimal coupling will preserve the coupling, though the trajectory will be given by an SDE, and hence no longer straight. In the limit as the entropic regularization term tends to zero, then this recovers the non-regularized optimal coupling with squared Euclidean ground cost (Shi et al., 2023; Peluchetti, 2023). + +This motivates learning an optimal transport (OT) coupling and then performing bridge / flow matching on this coupling. There are two dominant ways to do this, either ReFlow (also known as Iterative Markovian fitting) (Liu et al., 2022; Liu, 2022; Lee et al., 2024; Shi et al., 2023) or approximating the coupling using mini-batches (Tong et al., 2023; Pooladian et al., 2023). + +# A.2.1 MINI-BATCH OPTIMAL TRANSPORT FLOW MATCHING + +We first make a distinction between the loss batch size $b_{\mathrm{loss}}$ and coupling batch size $b_{\mathrm{coupling}}$ where $b_{\mathrm{coupling}} \geq b_{\mathrm{loss}}$ . The loss batch size, $b_{\mathrm{loss}}$ , is the number of input pairs $(x_0, x_1)$ used per training iteration in the flow matching loss Eq. (1), whereas the coupling batch size, $b_{\mathrm{coupling}}$ , refers to the number of independently sampled pairs used as input into the mini-batch OT solver. + +The procedure for obtaining mini-batch couplings is to first independently sample $b_{\mathrm{coupling}}$ items denoted $(y_i)_{i=1}^{b_{\mathrm{coupling}}} (x_i)_{i=1}^{b_{\mathrm{coupling}}}$ from both marginal distributions $x_i \sim \mathbb{P}_0$ and $y_i \sim \mathbb{P}_1$ . The next step is to run a mini-batch OT solver to obtain a coupling matrix $P = (p_{i,j})_{i=1,j=1}^{b_{\mathrm{coupling}}}$ such that $\sum_{i,j} p_{i,j} = 1$ , $\sum_i p_{i,j} = 1 / b_{\mathrm{coupling}}$ , $\sum_j p_{i,j} = 1 / b_{\mathrm{coupling}}$ . + +The final step is to sub-sample the coupling batch of size $b_{\mathrm{coupling}}$ to obtain $b_{\mathrm{loss}}$ aligned pairs $(\tilde{x}_i, \tilde{y}_i)_{i=1}^{b_{\mathrm{loss}}} \sim P$ , which are then fed into loss Eq. (1) and corresponding standard gradient based optimization procedure. + +Mini-batch bias. In stochastic gradient descent, for example, losses computed on uniformly sampled batches are unbiased with respect to the measures the batches were sampled from. This is not true for mini-batch OT couplings with respect to the true OT coupling between marginals (Bellemare et al., 2017). Indeed, marginal preservation within mini-batches may force points in each minibatchto be mapped together, such points may not be mapped, or have very low probability of being mapped, in the true OT coupling. Asymptotically the mini-batch couplings should converge to the true OT coupling solvers the mini-batch size increases. Unfortunately, this is not practically feasible with discrete OT solvers for large datasets or indeed for measures with continuous support. The mini-batch and true OT couplings would also be the same for infinite regularization, indeed the couplings would both be independent couplings and so not very informative. + +Subsampling. Computing OT couplings for large batch sizes is not typically possible using the Hungarian algorithm (Kuhn, 1955) due to the cubic time complexity. However, entropic approximations from Sinkhorn (Sinkhorn, 1964) is of only quadratic complexity and can be implemented on modern GPU-accelerators (Cuturi, 2013; Cuturi et al., 2022), hence enables fast computation of discrete entropic OT for batches in excess of 100,000 points. + +Prior works (Tong et al., 2023; Pooladian et al., 2023) set $b_{\mathrm{loss}} = b_{\mathrm{coupling}}$ and do not subsample. This is problematic as mini-batch OT is only justified as being close to optimal in the asymptotically large batch regime. Although we can compute the coupling for large batch sizes, the optimization setup for training the neural network via FM is limited by hardware memory and so it becomes infeasible to set $b_{\mathrm{loss}} = b_{\mathrm{coupling}}$ for large batch size. Prior works therefore use small coupling batch size. + +Subsampling should still preserve marginal distributions. We observe in Tab. 8 that the straightness of the generative trajectories increases as batch size grows, as expected, however generative performance in terms of FID gets increasingly worse compared to regular flow matching. This is a surprising empirical result that warrants further investigation. + +# A.2.2 REFLOW AND ITERATIVE MARKOVIAN FITTING + +ReFlow (Liu et al., 2022; Liu, 2022; Lee et al., 2024) and more generally Iterative Markovian Fitting (Shi et al., 2023) are procedures which iteratively refine the coupling between marginals. We shall focus on ReFlow for brevity. ReFlow first takes an independent coupling, then involves training a flow between samples from that coupling, known as a Markovian projection. Simulating from this trained flow is then used to define an updated coupling. This process is repeated between updating a flow and coupling until convergence. It has been shown that this process iteratively reduces the transport cost for any convex ground cost, and hence straightens the paths between coupling whilst retaining the correct marginals. + +Note that ReFlow results in a coupling which is slightly stronger than optimal transport. OT aims to minimize the transport cost for a specific ground cost function, whereas ReFlow reduces transport cost for all convex costs. ReFlow can be limited to specific convex ground cost by ensuring the vector field takes a specific conservative form (Liu, 2022). + +# B FAST SAMPLING VIA HIGHER ORDER SOLVERS + +One can use higher-order solvers which utilize higher order differentials of the ODE velocity to take large integration steps or reduce truncation error (Karras et al., 2022; Dockhorn et al., 2022; Lu et al., 2022; Zhang & Chen, 2023). While this approach is generally training-free, recent works (Zhou et al., 2024; Kim et al., 2024b) have incorporated trainable components which minimize truncation error to further accelerate sampling. + +# C DISTILLATION AND CONSISTENCY MODELS + +The goal of distillation within the field of diffusion models is typically to compress multiple steps along a probability flow ODE of a teacher diffusion model into a fewer steps steps of a student model. We refer to this as discrete-time distillation (DTD). Representative methods are progressive distillation (Salimans & Ho, 2022), and consistency distillation (Song et al., 2023; Song & Dhariwal, 2024; Kim et al., 2024a; Geng et al., 2024). While distillation and ReFlow are similar in the aspect + +
CIFAR10AFHQv2FFHQImageNet-64
Iterations200k200k200k500k
Minibatch Size5122562561024
Adam LR2e-42e-42e-42e-4
Label dropout---0.1
EMA0.99990.99990.99990.9999
Num. Backward Pairs1M1M1M8M
Num. Forward Pairs50k13.5k70k4M
+ +Table 9: Training hyper-parameters. + +that they train a new model using the outputs a teacher diffusion model, we emphasize that they are, in fact, complementary approaches, and can benefit from one another. We discussion this point in more detail in the following section. + +# C.1 REFLOW VS. DISTILLATION + +We remark that faster ODEs have several practical benefits over discrete-time distillation alone. Since translation along an ODE is a bijective map, we can achieve fast inversion and likelihood evaluation by integrating the ODE backwards starting from data. + +Fast ODEs can be combined with discrete-time distillation. For instance, Lee et al. (2023); Liu et al. (2024); Zhu et al. (2024) have observed it is substantially easier to distill ODE models with straight trajectories. One may also use any ODE solver with a continuous time ODE, and there may be some benefit using adaptive solvers. Lee et al. (2023; 2024) also report combining RF models with higher-order solvers improves the trade-off between generation speed and quality. + +# D EXPERIMENT SETTINGS + +# D.1 TRAINING AND EVALUATION + +To evaluate a training setting, we initialize ReFlow denoisers with pre-trained EDM (Karras et al., 2022) denoisers, and optimize Eq. (13) with $\mathbb{Q}_{01} = \mathbb{Q}_{01}^{1}$ of Eq. (7). Specific optimization hyperparameters are reported in Tab. 9. We sample backward and forward pairs from $\mathbb{Q}_{01}^{1}$ by solving Eq. (6) with EDM models and use them throughout training. Specifically, we use the EDM discretization with the Heun solver (Ascher & Petzold, 1998). We use sampling budgets of 35 NFEs for CIFAR10 and 79 NFEs for AFHQv2, FFHQ, and ImageNet. FIDs of backward training samples are reported in the first row of Tab. 8. + +We measure the generative performance of the optimized model by computing the FID (Heusel et al., 2017) between $50k$ generated images and all available dataset images. Inception statistics are computed using the pre-trained Inception-v3 model (Karras et al., 2023a). Samples are generated by solving Eq. (3) with the Heun solver with 9 NFEs, and we report the minimum FID score out of three random generation trials, as done by Karras et al. (2022). For reasons described in Appendix F.1, we use the sigmoid discretization instead of the baseline uniform discretization. + +# D.1.1 BEST SETTINGS + +Here, we report hyper-parameters used to produce results for our best models in Table 8. + +CIFAR10. High-pass filter $\lambda = 10$ , dropout probability 0.09, forward pairs with mixing ratio $\rho = 0.4$ , sigmoid discretization with $\kappa = 20$ , DPM-solver $r = 0.4$ , AutoGuidance scale $w = 0.6$ . + +AFHQv2. High-pass filter $\lambda = 10$ , dropout probability 0.09, forward pairs with mixing ratio $\rho = 0.4$ , sigmoid discretization with $\kappa = 20$ , DPM-solver $r = 0.4$ , AutoGuidance scale $w = 1.0$ . + +FFHQ. High-pass filter $\lambda = 10$ , dropout probability 0.03, forward pairs with mixing ratio $\rho = 0.2$ , sigmoid discretization with $\kappa = 20$ , DPM-solver $r = 0.4$ , AutoGuidance scale $w = 0.3$ . + +ImageNet-64. High-pass filter $\lambda = 10$ , dropout probability 0.05, forward pairs with mixing ratio $\rho = 0.2$ , sigmoid discretization with $\kappa = 20$ , DPM-solver $r = 0.4$ , CFG scale $w = 0.4$ . + +# D.2 FLOW MATCHING BASELINES + +We strove to obtain competitive baselines for base and mini-batch OT flow matching methods, and indeed achieved superior performance to comparable implementations from Tong et al. (2023) on the datasets considered. + +Firstly, similar to Karras et al. (2022), we formulate flow matching as $x_0$ or mean-prediction rather than using regression target $X_0 - X_1$ . We parameterize the mean-prediction to be of form $D_{\theta}(x_t,t) = c_{\mathrm{skip}}(t)x_t + c_{\mathrm{out}}(t)F_{\theta}(c_{\mathrm{in}}(t),c_{\sigma}(t))$ where $F_{\theta}$ is a neural network: + +$$ +\mathbb {E} _ {t, \mathbf {X} _ {t}, \mathbf {X} _ {0}} \lambda (t) \| D _ {\theta} (\mathbf {X} _ {t}, t) - \mathbf {X} _ {0} \| ^ {2}. \tag {22} +$$ + +The scalar functions $c_{\sigma}, c_{\mathrm{skip}}, c_{\mathrm{out}}, c_{\mathrm{in}}, \lambda(t)$ are derived according to the reasoning of Karras et al. (2022) in Sec D.2.2. We set $\sigma_{0,T} = 0$ for the independent coupling. + +Throughout we use the a similar setup as Karras et al. (2022) but with the flow matching loss and new preconditioning. In particular for AFHQv2, FFHQ and CIFAR10 we use the SongNet from Song et al. (2021b) with corresponding hyperparameters from Karras et al. (2022) per dataset. + +The time-sampling during training is taken to be uniform and the Euler solver with 100 steps is used for computing FID and straightness metrics, in order to be comparable to other reported baselines from Tong et al. (2023). + +# D.2.1 MINI-BATCH FLOW MATCHING + +The mini-batch flow matching experiments use the same learning rate, networks, and training objectives as base flow matching. The primary difference is in how the inputs, $\mathbf{X}_t$ , $\mathbf{X}_0$ , are sampled. + +We follow the procedure outlined in Sec. A.2.1 for sampling mini-batches, using Sinkhorn (Sinkhorn, 1964; Cuturi, 2013) as the mini-batch solver based on the OTT-JAX library (Cuturi et al., 2022). Images were scaled to $[-1,1]$ as is standard in diffusion models and flattened. The squared Euclidean ground cost was used. + +The regularization parameter was set to $\epsilon = 2$ , qualitatively this provided a reasonable trade-off between meaningful coupling visually and the time to compute using convergence threshold defaults from Cuturi et al. (2022). The default regularization parameter from Cuturi et al. (2022) did not provide a visually meaningful coupling on large batches, and setting parameter less than $\epsilon < 1$ took over the maximum iteration threshold of 2,000 iterations to converge, and hence was not feasible for training. + +Each Sinkhorn loop took approximately $100 - 200$ Sinkhorn iterations without acceleration techniques, and wall-clock time up to roughly 0.8s for the largest coupling batch size 8192. We then ran acceleration techniques including Anderson acceleration (Anderson, 1965) with memory 2, epsilon decay starting from 10, and initializing potentials from prior batches to reduce runtime. This sped up the mini-batch process to 0.4s per Sinkhorn loop, and convergence of Sinkhorn in approximately $20 - 30$ Sinkhorn iterations. + +We ablated the coupling batch size between 512, 1024, 4096, 8192. The loss batch size was kept constant at 512 for CIFAR10 and 256 for AFHQV2 and FFHQ. + +Scope for further improvements: Unfortunately, $\mathbb{Cov}[X_0,x_T] = \sigma_{0,T}^2$ is not known for minibatch couplings and hence as in the independent coupling we set $\sigma_{0,T} = 0$ in the preconditioning computation. It is possible that this is sub-optimal and may be estimated in better ways. + +Although straightness improves with larger batch size and our implementation achieves better FID scores than prior baselines, mini-batch OT flow matching is still not well understood. It is puzzling as to why performance in terms of FID gets worse compared to base flow matching. This is corroborated in Table 5 of Tong et al. (2023) where FID for CIFAR10 is 3.74 with the mini-batch coupling and 3.64 with independent coupling, however we notice a significant discrepancy at 2.98 FID for the independent coupling and 3.16 for the best mini-batch coupling. We leave further investigations to future work. + +# D.2.2 PRECONDITIONING + +In the interest of generality, we derive EDM-style preconditioning (Karras et al., 2022) for the more general case of bridge matching / stochastic interpolant (Peluchetti, 2023; 2021; Shi et al., 2023; Albergo et al., 2023) which recovers preconditioning for flow matching for $\gamma_t = 0$ , + +Let $\mathbf{X}_t = \alpha_t\mathbf{X}_0 + \beta_t\mathbf{X}_T + \gamma_t\epsilon$ where $\epsilon \sim \mathcal{N}(0,\mathbb{I})$ . Consider prediction of form $D_{\theta}(x_t,t) = c_{\mathrm{skip}}(t)x_t + c_{\mathrm{out}}(t)F_{\theta}(c_{\mathrm{in}}(t),c_{\sigma}(t))$ and $\lambda (\cdot)$ weighted loss per Eq. (22). + +The loss per Eq. (22) may be written: + +$$ +\mathbb {E} _ {t, \mathbf {X} _ {t}, \mathbf {X} _ {0}} \lambda (t) c _ {\text {o u t}} (t) ^ {2} \| F _ {\theta} (\mathbf {X} _ {t}, t) - c _ {\text {o u t}} (t) ^ {- 1} (\mathbf {X} _ {0} - c _ {\text {s k i p}} (t) \mathbf {X} _ {t}) \| ^ {2} \tag {23} +$$ + +Setting $\lambda(\cdot)$ . In order to uniformly weight the loss per time step, we set $\lambda(t) = c_{\mathrm{out}}(t)^{-2}$ similarly to Karras et al. (2022). + +Setting $c_{\mathrm{in}}(t)$ . We take the strategy of finding $c_{\mathrm{in}}$ such that $\mathbb{Var}[c_{\mathrm{in}}(t)\mathbf{X}_t] = 1$ . + +Let $\mathbb{Var}[\mathbf{X}_0] = \sigma_0^2$ , $\mathbb{Var}[\mathbf{X}_T] = \sigma_T^2$ and $\mathbb{Cov}[\mathbf{X}_0, x_T] = \sigma_{0,T}^2$ + +$$ +\mathbb {V} a r \left[ c _ {\text {i n}} (t) \mathbf {X} _ {t} \right] = c _ {\text {i n}} (t) ^ {2} \left[ \alpha_ {t} ^ {2} \sigma_ {0} ^ {2} + \beta_ {t} ^ {2} \sigma_ {0} ^ {2} + 2 \alpha_ {t} \beta_ {t} \sigma_ {0, T} ^ {2} + \gamma_ {t} ^ {2} \right] = 1 \tag {24} +$$ + +$$ +c _ {\text {i n}} (t) = \left[ \alpha_ {t} ^ {2} \sigma_ {0} ^ {2} + \beta_ {t} ^ {2} \sigma_ {T} ^ {2} + 2 \alpha_ {t} \beta_ {t} \sigma_ {0, T} ^ {2} + \gamma_ {t} ^ {2} \right] ^ {- \frac {1}{2}} \tag {25} +$$ + +Setting $c_{\mathrm{skip}}$ and $c_{\mathrm{out}}$ . The prediction target of $D_{\theta}(x_t,t)$ is $\mathbf{X}_0$ , hence the target of network $F_{\theta}$ is $c_{\mathrm{out}}(t)^{-1}\left[\mathbf{X}_0 - c_{\mathrm{skip}}(t)x_t\right]$ . We choose $c_{\mathrm{skip}}$ and $c_{\mathrm{out}}$ to ensure regression target has uniform variance i.e. $\mathbb{Var}\left[c_{\mathrm{out}}(t)^{-1}\left[\mathbf{X}_0 - c_{\mathrm{skip}}(t)\mathbf{X}_t\right]\right] = 1$ , + +$$ +\operatorname {V a r} \left[ c _ {\text {o u t}} (t) ^ {- 1} \left[ \mathbf {X} _ {0} - c _ {\text {s k i p}} (t) \mathbf {X} _ {t} \right] \right] = 1 \tag {26} +$$ + +$$ +c _ {\text {o u t}} (t) ^ {2} = \mathbb {V} a r \left[ \mathbf {X} _ {0} - c _ {\text {s k i p}} (t) \mathbf {X} _ {t} \right] \tag {27} +$$ + +$$ +c _ {\text {o u t}} (t) ^ {2} = \mathbb {V} a r \left[ \left(1 - \alpha_ {t} c _ {\text {s k i p}} (t)\right) \mathbf {X} _ {0} - c _ {\text {s k i p}} (t) \left(\beta_ {t} \mathbf {X} _ {T} + \gamma_ {t} \epsilon\right) \right] \tag {28} +$$ + +$$ +c _ {\text {o u t}} (t) ^ {2} = \left(1 - \alpha_ {t} c _ {\text {s k i p}} (t)\right) ^ {2} \sigma_ {0} ^ {2} \tag {29} +$$ + +$$ +- 2 \beta_ {t} \left(1 - \alpha_ {t} c _ {\text {s k i p}} (t)\right) c _ {\text {s k i p}} (t) \sigma_ {0, T} ^ {2} \tag {30} +$$ + +$$ ++ c _ {\mathrm {s k i p}} (t) ^ {2} \beta_ {t} ^ {2} \sigma_ {T} ^ {2} + \gamma_ {t} ^ {2} c _ {\mathrm {s k i p}} (t) ^ {2} \tag {31} +$$ + +Given the fixed relationship between $c_{\mathrm{skip}}$ and $c_{\mathrm{out}}$ , we choose $c_{\mathrm{skip}}$ to minimize $c_{\mathrm{out}}$ + +$$ +\frac {\mathrm {d} c _ {\text {o u t}} ^ {2}}{\mathrm {d} c _ {\text {s k i p}}} = - 2 \alpha_ {t} \left(1 - \alpha_ {t} c _ {\text {s k i p}} (t)\right) \sigma_ {0} ^ {2} \tag {32} +$$ + +$$ +- 2 \beta_ {t} \sigma_ {0, T} ^ {2} + 4 \alpha_ {t} \beta_ {t} \sigma_ {0, T} ^ {2} c _ {\text {s k i p}} (t) \tag {33} +$$ + +$$ ++ 2 c _ {\text {s k i p}} (t) \beta_ {t} ^ {2} \sigma_ {T} ^ {2} + 2 \gamma_ {t} ^ {2} c _ {\text {s k i p}} (t) \tag {34} +$$ + +With first order condition $\frac{\mathrm{d}c_{\mathrm{out}}^2}{\mathrm{d}c_{\mathrm{skip}}} = 0$ , we obtain: + +$$ +c _ {\text {s k i p}} (t) = \frac {\alpha_ {t} \sigma_ {0} ^ {2} + \beta_ {t} \sigma_ {0 , T} ^ {2}}{\alpha_ {t} ^ {2} \sigma_ {0} ^ {2} + 2 \alpha_ {t} \beta_ {t} \sigma_ {0 , T} ^ {2} + \beta_ {t} ^ {2} \sigma_ {T} ^ {2} + \gamma_ {t} ^ {2}}. \tag {35} +$$ + +# D.3 COUPLING PROJECTION + +Recall that we propose projecting $\mathbb{Q}_{01}^{1}$ to $\Pi (\mathbb{P}_0,\mathbb{P}_1)$ at the end of each iteration + +$$ +\widehat {\mathbb {Q}} _ {0 1} ^ {1} := \operatorname {p r o j} _ {\Pi \left(\mathbb {P} _ {0}, \mathbb {P} _ {1}\right)} \left(\mathbb {Q} _ {0 1} ^ {1}\right) \tag {36} +$$ + +and using $\widehat{\mathbb{Q}}_{01}^{1}$ in place of $\mathbb{Q}_{01}^{1}$ . However, the projection operation is well-defined only if there is a suitable metric on the space under consideration (the space of distributions, in our case). An applicable metric is the $p$ -Wasserstein distance $W_{p}$ . Then, projection w.r.t. $W_{p}$ is defined as + +$$ +\widehat {\mathbb {Q}} _ {0 1} ^ {1} = \underset {\Gamma_ {0 1}} {\arg \min } W _ {p} \left(\Gamma_ {0 1}, \mathbb {Q} _ {0 1} ^ {1}\right) \quad s. t. \quad \Gamma_ {0} = \mathbb {P} _ {0}, \Gamma_ {1} = \mathbb {P} _ {1}. \tag {37} +$$ + +Furthermore, we may parameterize + +$$ +d \Gamma_ {0 1} \left(\boldsymbol {x} _ {0}, \boldsymbol {x} _ {1}\right) = d \Gamma_ {0 | 1} \left(\boldsymbol {x} _ {0} \mid \boldsymbol {x} _ {1}\right) d \mathbb {P} _ {1} \left(\boldsymbol {x} _ {1}\right) \quad o r \quad d \mathbb {P} _ {0} \left(\boldsymbol {x} _ {0}\right) d \Gamma_ {1 | 0} \left(\boldsymbol {x} _ {1} \mid \boldsymbol {x} _ {0}\right) \tag {38} +$$ + +which means (with the first parameterization), we only have to enforce the marginal constraint + +$$ +\widehat {\mathbb {Q}} _ {0 1} ^ {1} = \underset {\Gamma_ {0 1}} {\arg \min } W _ {p} \left(\Gamma_ {0 1}, \mathbb {Q} _ {0 1} ^ {1}\right) \quad s. t. \quad \Gamma_ {0} = \mathbb {P} _ {0}, d \Gamma_ {0 1} = d \Gamma_ {0 | 1} d \mathbb {P} _ {1}. \tag {39} +$$ + +Noting that + +$$ +\Gamma_ {0} = \mathbb {P} _ {0} \iff D \left(\Gamma_ {0}, \mathbb {P} _ {0}\right) = 0 \tag {40} +$$ + +for distances or divergences $D$ , we can optimize + +$$ +\min _ {\Gamma_ {0 1}} D \left(\Gamma_ {0}, \mathbb {P} _ {0}\right) + \lambda W _ {p} ^ {p} \left(\Gamma_ {0 1}, \mathbb {Q} _ {0 1} ^ {1}\right) \quad s. t. \quad d \Gamma_ {0 1} = d \Gamma_ {0 | 1} d \mathbb {P} _ {1} \tag {41} +$$ + +for decreasing values of $\lambda$ and stop when $D(\Gamma_0, \mathbb{P}_0)$ saturates. In practice, we solve + +$$ +\min _ {\Gamma_ {0 1}} D \left(\Gamma_ {0}, \mathbb {P} _ {0}\right) + \lambda \operatorname {S K D} _ {p} \left(\Gamma_ {0 1}, \mathbb {Q} _ {0 1} ^ {1}\right) \quad s. t. \quad d \Gamma_ {0 1} = d \Gamma_ {0 | 1} d \mathbb {P} _ {1} \tag {42} +$$ + +with gradient descent, where SKD stands for Sinkhorn Divergence (Feydy et al., 2019). We approximate $\mathbb{Q}_{01}^{1}$ as a mixture of diracs using the generated backward pairs, and approximate $D$ using a Generative Adversarial Network (Goodfellow et al., 2014). Since we do not know an appropriate value of $\lambda$ , we initialize $\lambda$ from a large value, e.g., $\lambda = 1000$ , decay it by a factor of 0.1 every time FID saturates. If decaying $\lambda$ does not offer any more FID improvement, we terminate optimization, and use the optimized $\Gamma_{01}$ as $\widehat{\mathbb{Q}}_{01}^{1}$ . The full optimization procedure is described in Algorithm 2. + +Algorithm 1 Coupling projection given $\lambda$ +1: Inputs: $\mathbb{P}_0,\mathbb{Q}_{01}^1$ $\Gamma_{01}$ , batch size $B$ , discriminator $D_{\psi}$ , discriminator learning rate $\eta$ , coupling learning rate $\gamma$ , evaluate FID every $N_{\mathrm{FID}}$ iterations, $\mathrm{SKD}_p$ coefficient $\lambda$ +2: Initialize $i\gets 0$ $\Gamma_{01,best}\gets \Gamma_{01}$ $\mathrm{FID}_{best}\gets \mathrm{FID}(\Gamma_0,\mathbb{P}_0)$ +3: while training do +4: Sample $\{\hat{x}_0^n\}_{n = 1}^B\sim \mathbb{P}_0$ $\{(\pmb {x}_0^n,\pmb {x}_1^n)\}_{n = 1}^B\sim \mathbb{Q}_{01}^1$ $\{(\hat{x}_0^n,\hat{x}_1^n)\}_{n = 1}^B\sim \Gamma_{01}$ +5: $\psi \gets \phi +\eta \nabla_{\psi}\{\sum_{n}\log D_{\psi}(\hat{x}_0^n) + \sum_n\log (1 - D_{\psi}(\hat{x}_0^n))\}$ +6: $\hat{x}_0^n\gets \hat{x}_0^n -\gamma \nabla_{\hat{x}_0^n}\{\log (1 - D_\psi (\hat{x}_0^n)) + \lambda \mathrm{SKD}_p(\{(\hat{x}_0^n,\hat{x}_1^n)\}_{n = 1}^B,\{(\pmb {x}_0^n,\pmb {x}_1^n)\}_{n = 1}^B)\}$ +7: $i\gets i + 1$ +8: if $i \% N_{\mathrm{FID}} = 0$ then +9: $\mathrm{FID}_{curr}\gets \mathrm{FID}(\Gamma_0,\mathbb{P}_0)$ +10: if $\mathrm{FID}_{curr}\geq \mathrm{FID}_{best}$ then +11: return $\Gamma_{01,best}$ , FIDbest +12: else +13: $(\Gamma_{01,best},\mathrm{FID}_{best})\gets (\Gamma_{01},\mathrm{FID}_{curr})$ +14: end if +15: end if +16: end while + +Algorithm 2 Coupling projection +1: Inputs: $\mathbb{P}_0,\mathbb{Q}_{01}^1$ , batch size $B$ , discriminator $D_{\psi}$ , discriminator learning rate $\eta$ , coupling lea +ing rate $\gamma$ , evaluate FID every $N_{\mathrm{FID}}$ iterations, initial $\lambda$ , $\lambda$ decay factor $\rho \in (0,1)$ +2: Initialize $i\gets 0,\Gamma_{01}\gets \mathbb{Q}_{01}^{1},\Gamma_{01,\text{best}}\gets \mathbb{Q}_{01}^{1},\mathrm{FID}_{\text{best}}\gets \mathrm{FID}(\Gamma_0,\mathbb{P}_0)$ +3: while training do +4: $\Gamma_{01},\mathrm{FID}_{\text{curr}}\gets \mathrm{ALG1}[\mathbb{P}_0,\mathbb{Q}_{01}^1,\Gamma_{01},B,D_\psi ,\eta ,\gamma ,N_{\mathrm{FID}},\lambda ]$ +5: if $\mathrm{FID}_{\text{curr}}\geq \mathrm{FID}_{\text{best}}$ then +6: return $\Gamma_{01,\text{best}}$ +7: else +8: $(\lambda ,\Gamma_{01,\text{best}},\mathrm{FID}_{\text{best}})\gets (\rho \cdot \lambda ,\Gamma_{01},\mathrm{FID}_{\text{curr}})$ +9: end if +10: end while + +# E PROOFS + +# E.1 PROOF OF PROPOSITION 1 + +Lemma 1. The following statements are equivalent. + +(a) $\theta$ minimizes $\mathcal{L}_{\mathrm{FM}}(\theta ;\mathbb{Q}_{01},\boldsymbol{x}_t,t)$ +(b) $\theta$ minimizes $\mathcal{L}_{\mathrm{GFM}}(\theta ;\mathbb{Q}_{01},\boldsymbol{x}_t,t)$ +(c) $D_{\theta}(\pmb{x}_t,t) = \mathbb{E}_{\pmb{x}_0\sim \mathbb{Q}_{0|t}(\cdot |\pmb{x}_t)}[\pmb{x}_0]$ . + +Proof. We first observe that (writing $D_{\theta}$ in place of $D_{\theta}(\pmb{x}_t,t)$ for brevity) + +$$ +\nabla_ {\boldsymbol {D} _ {\theta}} \mathcal {L} _ {\mathrm {G F M}} (\theta ; \mathbb {Q} _ {0 1}, \boldsymbol {x} _ {t}, t) = \phi^ {\top} \phi \left\{\nabla_ {\boldsymbol {D} _ {\theta}} \mathcal {L} _ {\mathrm {F M}} (\theta ; \mathbb {Q} _ {0 1}, \boldsymbol {x} _ {t}, t) \right\} \tag {43} +$$ + +and since $\phi$ is invertible, $\phi^{\top}\phi$ is invertible as well, which implies + +$$ +\nabla_ {\boldsymbol {D} _ {\theta}} \mathcal {L} _ {\mathrm {G F M}} (\theta ; \mathbb {Q} _ {0 1}, \boldsymbol {x} _ {t}, t) = \mathbf {0} \iff \nabla_ {\boldsymbol {D} _ {\theta}} \mathcal {L} _ {\mathrm {F M}} (\theta ; \mathbb {Q} _ {0 1}, \boldsymbol {x} _ {t}, t) = \mathbf {0}. \tag {44} +$$ + +Because both $\mathcal{L}_{\mathrm{GFM}}(\theta ;\mathbb{Q}_{01},\boldsymbol{x}_t,t)$ and $\mathcal{L}_{\mathrm{FM}}(\theta ;\mathbb{Q}_{01},\boldsymbol{x}_t,t)$ are strongly convex w.r.t. $D_{\theta}$ , this means $\theta$ minimizes $\mathcal{L}_{\mathrm{GFM}}(\theta ;\mathbb{Q}_{01},\boldsymbol{x}_t,t)$ iff $\theta$ minimizes $\mathcal{L}_{\mathrm{FM}}(\theta ;\mathbb{Q}_{01},\boldsymbol{x}_t,t)$ iff + +$$ +\boldsymbol {D} _ {\theta} \left(\boldsymbol {x} _ {t}, t\right) = \mathbb {E} _ {\boldsymbol {x} _ {0} \sim \mathbb {Q} _ {0 | t} (\cdot | \boldsymbol {x} _ {t})} \left[ \boldsymbol {x} _ {0} \right]. \tag {45} +$$ + +This establishes the equivalence of the three claims. + +![](images/94dfbc3f143b16cca01da4b2eafee5254c09d1ec04123160cc52246121d9c833.jpg) + +Lemma 2. Let $\mu$ be a $\sigma$ -finite measure. If $f > g$ on a set $A$ with $\mu(A) > 0$ , $\int_{A} f \, d\mu > \int_{A} g \, d\mu$ . + +Proof. By linearity of integrals, we can assume $g = 0$ . Since $f > 0$ on $A$ , we may express + +$$ +A = \cup_ {n = 1} ^ {\infty} A _ {n}, \quad A _ {n} := \{x \in A: f (x) > 1 / n \}. \tag {46} +$$ + +Since $\mu (A) > 0$ , there is $n$ such that $\mu (A_n) > 0$ . Otherwise, by subadditivity of measures, + +$$ +\mu (A) \leq \sum_ {n = 1} ^ {\infty} \mu \left(A _ {n}\right) = 0 \tag {47} +$$ + +which contradicts the assumption $\mu (A) > 0$ . It follows that + +$$ +\int_ {A} f d \mu \geq \int_ {A _ {n}} f d \mu \geq \int_ {A _ {n}} \frac {1}{n} d \mu = \frac {\mu \left(A _ {n}\right)}{n} > 0. \tag {48} +$$ + +This establishes the claim. + +![](images/9d16859beb551f3ed41c004331bdd11f83bd6aee836cebfb51ac7626da84180b.jpg) + +Proof of Proposition 1. Denote the measure of $(t, \pmb{x}_t)$ where $t \sim \mathrm{unif}(0,1)$ and $\pmb{x}_t \sim \mathbb{Q}_t$ as $\mu$ . (Assuming $\pmb{D}_{\theta}$ can approximate a sufficiently large set of functions), define $\theta^*$ as the neural net parameter which satisfies + +$$ +\boldsymbol {D} _ {\theta^ {*}} \left(\boldsymbol {x} _ {t}, t\right) = \mathbb {E} _ {\boldsymbol {x} _ {0} \sim \mathbb {Q} _ {0 | t} (\cdot | \boldsymbol {x} _ {t})} [ \boldsymbol {x} _ {0} ] \tag {49} +$$ + +for any $(\pmb{x}_t,t)$ such that + +$$ +\mathcal {L} _ {\mathrm {G F M}} \left(\theta ; \mathbb {Q} _ {0 1}, \boldsymbol {x} _ {t}, t\right) \geq \mathcal {L} _ {\mathrm {G F M}} \left(\theta^ {*}; \mathbb {Q} _ {0 1}, \boldsymbol {x} _ {t}, t\right) \tag {50} +$$ + +or equivalently, + +$$ +\mathcal {L} _ {\mathrm {F M}} (\theta ; \mathbb {Q} _ {0 1}, \boldsymbol {x} _ {t}, t) \geq \mathcal {L} _ {\mathrm {F M}} \left(\theta^ {*}; \mathbb {Q} _ {0 1}, \boldsymbol {x} _ {t}, t\right) \tag {51} +$$ + +for any $(x_{t},t)$ and $\theta$ by Lemma 1. + +We now show that a minimizer of Eq. (13) minimizes Eq. (1). Suppose $\theta$ minimizes Eq. (13), but there is a set $A$ with positive measure, i.e., $\mu(A) > 0$ , such that + +$$ +\boldsymbol {D} _ {\theta} \left(\boldsymbol {x} _ {t}, t\right) \neq \mathbb {E} _ {\boldsymbol {x} _ {0} \sim \mathbb {Q} _ {0 | t} (\cdot | \boldsymbol {x} _ {t})} \left[ \boldsymbol {x} _ {0} \right] \tag {52} +$$ + +for all $(\pmb{x}_t,t)\in A$ . By Lemma 1, + +$$ +\mathcal {L} _ {\mathrm {G F M}} \left(\theta ; \mathbb {Q} _ {0 1}, \boldsymbol {x} _ {t}, t\right) > \mathcal {L} _ {\mathrm {G F M}} \left(\theta^ {*}; \mathbb {Q} _ {0 1}, \boldsymbol {x} _ {t}, t\right) \tag {53} +$$ + +for all $(\pmb{x}_t,t)\in A$ , and since $w(\pmb {x}_t,t)$ and $d\mathbb{T}(t)$ are positive by assumption, + +$$ +d \mathbb {T} (t) \cdot w (\boldsymbol {x} _ {t}, t) \cdot \mathcal {L} _ {\mathrm {G F M}} (\theta ; \mathbb {Q} _ {0 1}, \boldsymbol {x} _ {t}, t) > d \mathbb {T} (t) \cdot w (\boldsymbol {x} _ {t}, t) \cdot \mathcal {L} _ {\mathrm {G F M}} \left(\theta^ {*}; \mathbb {Q} _ {0 1}, \boldsymbol {x} _ {t}, t\right) \tag {54} +$$ + +for all $(\pmb{x}_t,t)\in A$ , so by Lemma 2, + +$$ +\mathbb {E} _ {(t, \boldsymbol {x} _ {t}) \sim \mu} [ 1 _ {A} (\boldsymbol {x} _ {t}, t) \cdot d \mathbb {T} (t) \cdot w (\boldsymbol {x} _ {t}, t) \cdot \mathcal {L} _ {\mathrm {G F M}} (\theta ; \mathbb {Q} _ {0 1}, \boldsymbol {x} _ {t}, t) ] \tag {55} +$$ + +$$ +> \mathbb {E} _ {(t, \boldsymbol {x} _ {t}) \sim \mu} [ 1 _ {A} (\boldsymbol {x} _ {t}, t) \cdot d \mathbb {T} (t) \cdot w (\boldsymbol {x} _ {t}, t) \cdot \mathcal {L} _ {\mathrm {G F M}} \left(\theta^ {*}; \mathbb {Q} _ {0 1}, \boldsymbol {x} _ {t}, t\right) ] \tag {56} +$$ + +where $1_A(\pmb{x}_t,t) = 1$ if $(\pmb{x}_t,t)\in A$ and 0 if not, and so + +$$ +\mathcal {L} _ {\mathrm {G F M}} (\theta ; \mathbb {Q} _ {0 1}) = \mathbb {E} _ {(t, \boldsymbol {x} _ {t}) \sim \mu} [ d \mathbb {T} (t) \cdot w (\boldsymbol {x} _ {t}, t) \cdot \mathcal {L} _ {\mathrm {G F M}} (\theta ; \mathbb {Q} _ {0 1}, \boldsymbol {x} _ {t}, t) ] \tag {57} +$$ + +$$ +> \mathbb {E} _ {(t, \boldsymbol {x} _ {t}) \sim \mu} [ d \mathbb {T} (t) \cdot w (\boldsymbol {x} _ {t}, t) \cdot \mathcal {L} _ {\mathrm {G F M}} \left(\theta^ {*}; \mathbb {Q} _ {0 1}, \boldsymbol {x} _ {t}, t\right) ] = \mathcal {L} _ {\mathrm {G F M}} \left(\theta^ {*}; \mathbb {Q} _ {0 1}\right) \tag {58} +$$ + +which contradicts the assumption that $\theta$ minimizes Eq. (13). It follows that if $\theta$ minimizes Eq. (13), + +$$ +\boldsymbol {D} _ {\theta} \left(\boldsymbol {x} _ {t}, t\right) = \mathbb {E} _ {\boldsymbol {x} _ {0} \sim \mathbb {Q} _ {0 | t} (\cdot | \boldsymbol {x} _ {t})} \left[ \boldsymbol {x} _ {0} \right] \tag {59} +$$ + +almost everywhere w.r.t. $\mu$ , it also minimizes + +$$ +\mathcal {L} _ {\mathrm {F M}} (\theta ; \mathbb {Q} _ {0 1}, \boldsymbol {x} _ {t}, t) \tag {60} +$$ + +almost everywhere w.r.t. $\mu$ by Lemma 1, which implies $\theta$ minimizes Eq. (1). + +The other direction can be proven in an analogous manner. + +# E.2 PROOF OF PROPOSITION 2 + +Proof of Proposition 2. Let $\mathbb{Q}_{01}^{0} = \mathbb{P}_{0}\otimes \mathbb{P}_{1}$ . If we assume zero initialization in output layer for $D_{\theta}$ + +$$ +\begin{array}{l} \max _ {\boldsymbol {x} _ {1}} \mathcal {L} _ {\mathrm {D M}} \left(\theta ; \mathbb {Q} _ {0 1} ^ {0}, \boldsymbol {x} _ {1}, 1\right) / \min _ {\boldsymbol {x} _ {1}} \mathcal {L} _ {\mathrm {D M}} \left(\theta ; \mathbb {Q} _ {0 1} ^ {0} \boldsymbol {x} _ {1}, 1\right) (61) \\ = \max _ {\boldsymbol {x} _ {1}} \mathbb {E} _ {\boldsymbol {x} _ {0} \sim \mathbb {Q} _ {0 | 1} ^ {0} (\cdot | \boldsymbol {x} _ {1})} \| \boldsymbol {x} _ {0} - \boldsymbol {D} _ {\theta} (\boldsymbol {x} _ {1}, 1) \| _ {2} ^ {2} / \min _ {\boldsymbol {x} _ {1}} \mathbb {E} _ {\boldsymbol {x} _ {0} \sim \mathbb {Q} _ {0 | 1} ^ {0} (\cdot | \boldsymbol {x} _ {1})} \| \boldsymbol {x} _ {0} - \boldsymbol {D} _ {\theta} (\boldsymbol {x} _ {1}, 1) \| _ {\mathcal {2}} ^ {2} (62) \\ = \max _ {\boldsymbol {x} _ {1}} \mathbb {E} _ {\boldsymbol {x} _ {0} \sim \mathbb {Q} _ {0 | 1} ^ {0} (\cdot | \boldsymbol {x} _ {1})} \| \boldsymbol {x} _ {0} \| _ {2} ^ {2} / \min _ {\boldsymbol {x} _ {1}} \mathbb {E} _ {\boldsymbol {x} _ {0} \sim \mathbb {Q} _ {0 | 1} ^ {0} (\cdot | \boldsymbol {x} _ {1})} \| \boldsymbol {x} _ {0} \| _ {2} ^ {2} (63) \\ = \max _ {\boldsymbol {x} _ {1}} \mathbb {E} _ {\boldsymbol {x} _ {0} \sim \mathbb {P} ^ {0}} \| \boldsymbol {x} _ {0} \| _ {2} ^ {2} / \min _ {\boldsymbol {x} _ {1}} \mathbb {E} _ {\boldsymbol {x} _ {0} \sim \mathbb {P} ^ {0}} \| \boldsymbol {x} _ {0} \| _ {2} ^ {2} = 1 (64) \\ \end{array} +$$ + +On the other hand, if we use a pre-trained diffusion model to initialize $D_{\theta}$ + +$$ +\boldsymbol {D} _ {\theta} \left(\boldsymbol {x} _ {1}, 1\right) = \boldsymbol {\mu} _ {0} \tag {65} +$$ + +such that + +$$ +\begin{array}{l} \max _ {\boldsymbol {x} _ {1}} \mathcal {L} _ {\mathrm {G F M}} \left(\theta ; \mathbb {Q} _ {0 1} ^ {1}, \boldsymbol {x} _ {1}, 1\right) / \min _ {\boldsymbol {x} _ {1}} \mathcal {L} _ {\mathrm {G F M}} \left(\theta ; \mathbb {Q} _ {0 1} ^ {1}, \boldsymbol {x} _ {1}, 1\right) (66) \\ = \max _ {\boldsymbol {x} _ {1}} \mathbb {E} _ {\boldsymbol {x} _ {0} \sim \mathbb {Q} _ {0 | 1} ^ {1} (\cdot | \boldsymbol {x} _ {1})} \| \boldsymbol {x} _ {0} - \boldsymbol {\mu} _ {0} \| _ {2} ^ {2} / \min _ {\boldsymbol {x} _ {1}} \mathbb {E} _ {\boldsymbol {x} _ {0} \sim \mathbb {Q} _ {0 | 1} ^ {1} (\cdot | \boldsymbol {x} _ {1})} \| \boldsymbol {x} _ {0} - \boldsymbol {\mu} _ {0} \| _ {2} ^ {2} (67) \\ = \max _ {\boldsymbol {x} _ {0}} \| \boldsymbol {x} _ {0} - \boldsymbol {\mu} _ {0} \| _ {2} ^ {2} / \min _ {\boldsymbol {x} _ {0}} \| \boldsymbol {x} _ {0} - \boldsymbol {\mu} _ {0} \| _ {2} ^ {2} (68) \\ \end{array} +$$ + +because $\pmb{x}_1 \mapsto \pmb{x}_0 \sim \mathbb{Q}_{0|1}^1(\cdot|\pmb{x}_1)$ is now a bijective map between $\mathbb{P}_0$ and $\mathbb{P}_1$ samples. + +![](images/bee18b610dc8090764d4554196e75328d25e0f041d39a573f4899bdf50386464.jpg) +Figure 12: DPM-Solver $r$ + +![](images/518ba8d5d14706b2af77f61490e10bab0fe37ad6db3c0df5dad833f9cfda37b6.jpg) +Figure 13: AutoGuidance $w$ + +# F ADDITIONAL EXPERIMENTS + +# F.1 LINEAR DISCRETIZATION LACKS DISCRIMINATIVE POWER + +While all previous works use the uniform discretization to sample from ReFlow models, we use the sigmoid discretization to evaluate models in Sections 3.2 and 3.3. This is because, we found that the uniform discretization lacks discrimination power, i.e., the ability to make the best of a given model, especially at small NFEs. + +
w(xt,t)UniformSigmoid
12.882.87
1/t2.892.76
1/t22.932.74
(σ2+0.52)/(0.5σ)22.972.82
1/Ext[sg[LCFm(θ;Q01, xt,t)]]2.982.79
1/sg[LCFm(θ;Q01, xt,t)]2.952.74
+ +Table 10: Uniform vs. sigmoid $(\kappa = 10)$ discretizations with Heun on AFHQv2. + +To demonstrate this, in Tab. 10, we re-evaluate models in Sec. 3.2.1 with the uniform discretization, and compare them with evaluation results with the sig- + +moid discretization with $\kappa = 10$ . We observe that none of the FIDs with the uniform discretization are better than the worst FID with the sigmoid discretization. Moreover, the model with our proposed weight, when evaluated with the uniform schedule, performs worse than the model with uniform weight. + +We speculate this happens because, as analyzed in Sec. 3.4, large curvature regions for ReFlow ODEs occur near $t \in \{0,1\}$ , but the uniform discretization fails to account for them. So, the uniform discretization is unable to accurately capture the differences in ODE trajectories between different models. Due to these reasons, we opt to use the sigmoid discretization to distinguish training techniques that work from those that do not. + +# F.2 DPM-SOLVER AND GUIDANCE ABLATIONS + +Recall that the DPM-Solver update for Eq. (3) is given as + +$$ +\boldsymbol {x} _ {t _ {i}} \leftarrow \boldsymbol {x} _ {t _ {i + 1}} + \left(t _ {i} - t _ {i + 1}\right) \left(\frac {1}{2 r} \boldsymbol {v} _ {\theta} \left(\boldsymbol {x} _ {s _ {i + 1}}, s _ {i + 1}\right) + \left(1 - \frac {1}{2 r}\right) \boldsymbol {v} _ {\theta} \left(\boldsymbol {x} _ {t _ {i + 1}}, t _ {i + 1}\right)\right). \tag {69} +$$ + +In Fig. 12, we show the FID for various values of $r \in (0,1]$ . While we can get better FIDs than those in Tab. 7 by using $r$ tailored to individual datasets, we opt for simplicity and set $r = 0.4$ as our improved choice, which still yields better FID than the Heun solver, i.e., using $r = 1$ . + +For conditional ReFlow models, classifier-free guidance (CFG) (Ho & Salimans, 2022) can be formulated as solving the ODE + +$$ +d \boldsymbol {x} _ {t} = \left\{\left(1 + w\right) \cdot \boldsymbol {v} _ {\theta} \left(\boldsymbol {x} _ {t}, t, c\right) - w \cdot \boldsymbol {v} _ {\theta} \left(\boldsymbol {x} _ {t}, t, \varnothing\right) \right\} d t \tag {70} +$$ + +where $\pmb{v}_{\theta}(\pmb{x}_t,t,c)$ is velocity conditioned on $c$ , and $\pmb{v}_{\theta}(\pmb{x}_t,t,\varnothing)$ is an unconditional velocity, and $w$ is guidance scale. Note that $w = 0$ reduces the ODE to standard class-conditional generation. In practice, we train conditional velocities with label dropout such that $\pmb{v}_{\theta}(\pmb{x}_t,t,c)$ and $\pmb{v}_{\theta}(\pmb{x}_t,t,\varnothing)$ can be evaluated in parallel, by passing class labels to the former and null labels to the latter. + +For unconditional ReFlow models, AutoGuidance (Karras et al., 2024) can be formulated as solving + +$$ +d \boldsymbol {x} _ {t} = \left\{\left(1 + w\right) \cdot \boldsymbol {v} _ {\theta} \left(\boldsymbol {x} _ {t}, t\right) - w \cdot \hat {\boldsymbol {v}} _ {\phi} \left(\boldsymbol {x} _ {t}, t\right) \right\} d t \tag {71} +$$ + +where $\hat{\pmb{v}}_{\phi}$ is a degraded version of $\pmb{v}_{\theta}$ . In practice, we use ReFlow models trained with the baseline training configuration (see Tab. 1) for $10k$ iterations as $\hat{\pmb{v}}_{\phi}$ . While other choices of $\hat{\pmb{v}}_{\phi}$ may offer better FIDs, as AG is not the main topic of our paper, we do not perform an extensive search. + +# F.3 QUANTIFYING REFLOW BIAS REDUCTION + +The extent of the bias introduced by ReFlow, and its reduction with our techniques can be calculated by comparing Tables 6, 7, 8. Specifically, since we measure the performance of our ReFlow models via Frechet Inception Distance (Wasserstein-2 distance between Gaussian approximations of true and model distributions in the feature space of the Inception network) (Heusel et al., 2017), we may use + +$$ +(\operatorname {F I D} \text {o f} \mathbb {Q} _ {0} ^ {n + 1}) - (\operatorname {F I D} \text {o f} \mathbb {Q} _ {0} ^ {n}) +$$ + +
CIFAR10AFHQv2FFHQ
BSL0.860.911.89
DYN0.610.591.30
DYN+LRN0.410.510.74
DYN+LRN+INF0.260.340.45
DYN+LRN+INF+GD0.01-0.050.28
+ +Table 11: Amount of bias introduced by Reflow under different settings. Negative bias means our model achieves a better FID than the diffusion model used to generate $\mathbb{Q}_{01}^{1}$ + +as a proxy for the amount of bias introduced by Re + +Flow. In our work, with $n = 1$ , $\mathbb{Q}_0^1$ is the EDM model marginal and $\mathbb{Q}_0^2$ is our ReFlow model marginal. In Table 11, we summarize the extent of bias as we add improved training dynamics (DYN), improved learning (LRN), improved inference (INF), and guidance (GD) to the baseline (BSL) setting. With everything combined, our techniques achieve a significant reduction in bias. + +# F.4 SAMPLE VISUALIZATION + +![](images/3da7d8b9e103b1858fac5a16b2f4a799c5bc711a43dba4d35b91b580f64352bf.jpg) +(a) BSL, 2.83 FID with 9 NFEs + +![](images/66cb875e8c40117cc55504070a87672546ff40cf8449c025c356cb7bdb797307.jpg) +(b) DYN+LRN+INF, 2.23 FID with 9 NFEs + +![](images/793cbe06dcb18b155973265e08b3f1dbe72df0166f0c5ffc0d324d78a04de988.jpg) +(c) DYN+LRN+INF+AG, 1.98 FID with 9 NFEs +Figure 14: CIFAR10 samples with fixed random seeds + +![](images/e6842452c94172ac40f3d7293dc09a89913f303742badaf15d7d22e53d17bf98.jpg) +(a) BSL, 2.87 FID with 9 NFEs + +![](images/44bd29635519370bf781a13dccc74baf1cfcc8bf8297bf2f905cc3984d388bb6.jpg) +(b) DYN+LRN+INF, 2.30 FID with 9 NFEs + +![](images/caaee444fe6a414841279774ba5d6f81ebb24d4a9e85978f0824f0110ec69b78.jpg) +(c) DYN+LRN+INF+AG, 1.91 FID with 9 NFEs +Figure 15: AFHQv2 samples with fixed random seeds + +![](images/aa7018d12ad58012eb491bf58a488a8bfb5484cbdee37c18d7c36dac188b67cd.jpg) +(a) BSL, 4.27 FID with 9 NFEs + +![](images/436093245d212aa2e1a01c7bf674b50a699099dab63eb6b48654e27f9fd18e0f.jpg) +(b) DYN+LRN+INF, 3.49 FID with 9 NFEs + +![](images/d9e21a0e977e3875fc8ebb21860bc985087cc01a1ed9700e86592758fea99b6c.jpg) +(c) DYN+LRN+INF+CFG, 1.74 FID with 9 NFEs +Figure 16: ImageNet-64 samples with fixed random seeds + +# G FURTHER DISCUSSION OF OUR IMPROVEMENTS + +Here, we provide further insight into why our techniques improve upon prior practice. + +Loss normalization. In Section 3.1 we show that the Generalized Flow Matching objective is a collection of regression problems aggregated over $(\boldsymbol{x}_t, t)$ , and at Section 3.2.1, we theoretically and numerically show that individual regression loss values during ReFlow can have vastly different scales with respect to $(\boldsymbol{x}_t, t)$ . Multi-task learning interpretation of loss normalization (Zhang et al., 2018; Karras et al., 2023b) along with our observation motivates loss normalization with respect to both $\boldsymbol{x}_t$ and $t$ , and in Table 2, we demonstrate that loss normalization beats all other weights. + +Time distribution. In Section 3.2.2, we explain that previous work (Lee et al., 2024) uses the cosh time distribution in order to oversample $t$ near 0 or 1, where most of the learning happens. We also explain that we choose the increasing exponential time distribution, since our weight function already compensates for vanishing loss near $t = 0$ . + +Loss function. In Section 3.2.3, we show that using $\phi$ in the loss function is equivalent to preconditioning the loss gradient, and it is well known that an appropriate gradient preconditioning can accelerate model convergence (Kingma & Ba, 2015). + +Dropout. In Section 3.3.1, we explain that we need models with larger Lipschitz constants if we wish to learn better ReFlow models. This is because ReFlow converges to a straight ODE, and a straight ODE is ultimately a push-forward generative model, and (Salmona et al., 2022) formally shows that a push-forward generative model needs to have a Lipschitz constant in order to map a unimodal distribution to a multi-modal distribution accurately. For instance, Corollaries 5, 6, 8 in (Salmona et al., 2022) show divergence or distance between data and model distributions is lower bounded by a decreasing function of Lipschitz constant of the push-forward model. This motivates us to increase effective model capacity by decreasing dropout probability. + +Training data. Alemohammad et al. (2024) shows that recursively training generative models on data generated by itself reduces the quality and diversity of data. Alemohammad et al. (2024) also shows one can delay or prevent degradation by injecting real data into the training loop. Using forward pairs can be interpreted as an instance of injecting real data in the training loop, and using projected pairs can be interpreted as synthesizing new real data by solving the projection problem. + +Discretization. In Figure 8, as evidenced by truncation error for the uniform discretization, the ODE after ReFlow has high curvature regions near $t = 0$ and 1. Truncation error for our sigmoid discretization schedule shows it is able to effectively control the error at the extremes of the interval. + +Solver. We note that Karras et al. (2022) popularized Heun as an alternative to Euler, among the large set of solvers considered, based primarily on strong empirical performance. We argue that DPM-solver is a generalization of Heun (coinciding for $r = 1$ ), and we observe that setting $r = 0.4$ performs better than Heun's second order solver. $r$ can be tuned cheaply, especially since our ReFlow models produce state-of-the-art results with NFE $< 10$ . \ No newline at end of file diff --git a/ICLR/2025/Simple ReFlow_ Improved Techniques for Fast Flow Models/images.zip b/ICLR/2025/Simple ReFlow_ Improved Techniques for Fast Flow Models/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..9694a0bc746c9afc39d29b94028a06c3c99f386e --- /dev/null +++ b/ICLR/2025/Simple ReFlow_ Improved Techniques for Fast Flow Models/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b314f094e3feda59c1b9d92c3fa29b907f464208b90e4759024a485b6bb6eeb2 +size 1879165 diff --git a/ICLR/2025/Simple ReFlow_ Improved Techniques for Fast Flow Models/layout.json b/ICLR/2025/Simple ReFlow_ Improved Techniques for Fast Flow Models/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..f53ae6329d634144ea58c969da9f96a084e90238 --- /dev/null +++ b/ICLR/2025/Simple ReFlow_ Improved Techniques for Fast Flow Models/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3a8bde27efd414b0e47b88474fd5f5dca46c8bf905c319e41ec0440d76d953a8 +size 1253918 diff --git a/ICLR/2025/Simple is Effective_ The Roles of Graphs and Large Language Models in Knowledge-Graph-Based Retrieval-Augmented Generation/2c15b9dd-fae3-47ff-b153-c9a312d10d78_content_list.json b/ICLR/2025/Simple is Effective_ The Roles of Graphs and Large Language Models in Knowledge-Graph-Based Retrieval-Augmented Generation/2c15b9dd-fae3-47ff-b153-c9a312d10d78_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..645a6dc494a1708d7ec917e2226bd8939721dedf --- /dev/null +++ b/ICLR/2025/Simple is Effective_ The Roles of Graphs and Large Language Models in Knowledge-Graph-Based Retrieval-Augmented Generation/2c15b9dd-fae3-47ff-b153-c9a312d10d78_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3f474d9e5d2adcee0a78a630ddc3cfdba140c2febf1d10964215d41f02aed699 +size 221423 diff --git a/ICLR/2025/Simple is Effective_ The Roles of Graphs and Large Language Models in Knowledge-Graph-Based Retrieval-Augmented Generation/2c15b9dd-fae3-47ff-b153-c9a312d10d78_model.json b/ICLR/2025/Simple is Effective_ The Roles of Graphs and Large Language Models in Knowledge-Graph-Based Retrieval-Augmented Generation/2c15b9dd-fae3-47ff-b153-c9a312d10d78_model.json new file mode 100644 index 0000000000000000000000000000000000000000..feff1a601811a82596c2236622c3b6cbb9a9004c --- /dev/null +++ b/ICLR/2025/Simple is Effective_ The Roles of Graphs and Large Language Models in Knowledge-Graph-Based Retrieval-Augmented Generation/2c15b9dd-fae3-47ff-b153-c9a312d10d78_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:028b2a01f431fa8687ca3b2136e11467813b62fa04a129cd022823c7d4a44509 +size 264292 diff --git a/ICLR/2025/Simple is Effective_ The Roles of Graphs and Large Language Models in Knowledge-Graph-Based Retrieval-Augmented Generation/2c15b9dd-fae3-47ff-b153-c9a312d10d78_origin.pdf b/ICLR/2025/Simple is Effective_ The Roles of Graphs and Large Language Models in Knowledge-Graph-Based Retrieval-Augmented Generation/2c15b9dd-fae3-47ff-b153-c9a312d10d78_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..e86e558969b4521f193df3f60e069a8528eefcee --- /dev/null +++ b/ICLR/2025/Simple is Effective_ The Roles of Graphs and Large Language Models in Knowledge-Graph-Based Retrieval-Augmented Generation/2c15b9dd-fae3-47ff-b153-c9a312d10d78_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:058366b0b2c7ae64d7b5dd8e9088a75b0f8e0d667016b53c01d387bb86149a81 +size 4526735 diff --git a/ICLR/2025/Simple is Effective_ The Roles of Graphs and Large Language Models in Knowledge-Graph-Based Retrieval-Augmented Generation/full.md b/ICLR/2025/Simple is Effective_ The Roles of Graphs and Large Language Models in Knowledge-Graph-Based Retrieval-Augmented Generation/full.md new file mode 100644 index 0000000000000000000000000000000000000000..988b461937959551594ec7b00e3e425a1389b9cc --- /dev/null +++ b/ICLR/2025/Simple is Effective_ The Roles of Graphs and Large Language Models in Knowledge-Graph-Based Retrieval-Augmented Generation/full.md @@ -0,0 +1,1102 @@ +# SIMPLE IS EFFECTIVE: THE ROLES OF GRAPHS AND LARGE LANGUAGE MODELS IN KNOWLEDGE-GRAPH-BASED RETRIEVAL-AUGMENTED GENERATION + +Mufei Li*, Siqi Miao*, Pan Li + +Georgia Institute of Technology +{mufei.li, siqi.miao, panli}@gatech.edu +*Equal contribution. + +# ABSTRACT + +Large Language Models (LLMs) demonstrate strong reasoning abilities but face limitations such as hallucinations and outdated knowledge. Knowledge Graph (KG)-based Retrieval-Augmented Generation (RAG) addresses these issues by grounding LLM outputs in structured external knowledge from KGs. However, current KG-based RAG frameworks still struggle to optimize the trade-off between retrieval effectiveness and efficiency in identifying a suitable amount of relevant graph information for the LLM to digest. We introduce SubgraphRAG, extending the KG-based RAG framework that retrieves subgraphs and leverages LLMs for reasoning and answer prediction. Our approach innovatively integrates a lightweight multilayer perceptron (MLP) with a parallel triple-scoring mechanism for efficient and flexible subgraph retrieval while encoding directional structural distances to enhance retrieval effectiveness. The size of retrieved subgraphs can be flexibly adjusted to match the query's needs and the downstream LLM's capabilities. This design strikes a balance between model complexity and reasoning power, enabling scalable and generalizable retrieval processes. Notably, based on our retrieved subgraphs, smaller LLMs like Llama3.1-8B-Instruct deliver competitive results with explainable reasoning, while larger models like GPT-4o achieve state-of-the-art accuracy compared with previous baselines—all without fine-tuning. Extensive evaluations on the WebQSP and CWQ benchmarks highlight SubgraphRAG's strengths in efficiency, accuracy, and reliability by reducing hallucinations and improving response grounding. Our implementation is available at https://github.com/Graph-COM/SubgraphRAG. + +# 1 INTRODUCTION + +Large language models (LLMs) have increasingly demonstrated remarkable capabilities (Brown et al., 2020; Kojima et al., 2022; Wei et al., 2022; Bubeck et al., 2023; Yao et al., 2023; Huang & Chang, 2023). However, issues like hallucinations (Ji et al., 2023; Huang et al., 2023; Zhang et al., 2023), outdated knowledge (Dhingra et al., 2022; Kasai et al., 2023), and a lack of domain expertise (Li et al., 2023b) undermine their trustworthiness. Retrieval-augmented generation (RAG) has emerged as a promising strategy to mitigate these problems by grounding LLM outputs in external knowledge sources (Shuster et al., 2021; Borgeaud et al., 2022; Vu et al., 2024; Gao et al., 2024b). + +Despite the effectiveness of text-based RAG, graph-based structures offer a more efficient alternative for organizing knowledge (Chein & Mugnier, 2008). Graphs facilitate explicit representation of relationships, reduce information redundancy, and allow for more flexible updates (Robinson et al., 2015). Recent studies have explored using graph-structured knowledge, particularly knowledge graphs (KGs), as RAG resources (Pan et al., 2024; Peng et al., 2024; Edge et al., 2024). However, developing effective and efficient frameworks for KG-based RAG remains limited due to the unique challenges posed by information retrieval from KGs. + +Firstly, traditional text retrieval methods, such as BM25 (Robertson et al., 1994; Robertson & Zaragoza, 2009) and dense retrieval (Karpukhin et al., 2020), are insufficient for supporting LLMs + +![](images/3b2b9efb6a3891cf274e123d5cb9b91c58bf01896374db4c8d09eb409a1c9259.jpg) +Figure 1: The SubgraphRAG framework. Retrieved subgraphs are flexible in form and size, consisting of triples extracted in parallel. This example subgraph has a complex form beyond a path. + +in complex reasoning tasks (Sun et al., 2018). For instance, a query like "What is the most famous painting by a contemporary of Michelangelo and Raphael?" requires not only retrieving works by their contemporaries but also reasoning about relationships beyond Michelangelo and Raphael themselves. Thus, KG retrieval goes beyond basic entity linking, requiring the extraction of non-local entities connected through multi-hop and semantically relevant relationships to support reasoning (Jiang et al., 2023a; Luo et al., 2024b; Sun et al., 2024a). Such information is often best represented as KG subgraphs, whose retrieval enables more effective downstream reasoning. + +Second, KG-based RAG faces significant computational challenges. In order to handle online queries and adapt to dynamic KG updates (Trivedi et al., 2017; Liang et al., 2024), efficiently identifying relevant structural information while meeting latency requirements is crucial for designing a practical KG-based RAG framework. Efficient approximate methods for nearest neighbor search like locality-sensitive hashing (Indyk & Motwani, 1998) are not suitable for structure extraction. + +Third, retrieved structural information must cover the critical evidence needed to answer the query while respecting the reasoning capacity of LLMs. Simply expanding the context window increases computational cost and can degrade RAG performance due to the introduction of irrelevant information (Xu et al., 2024), causing the "lost in the middle" phenomenon (Liu et al., 2024b). To prevent these issues, redundant structural information should be pruned to keep only relevant evidence within the LLMs' processing limits, improving accuracy and avoiding hallucinations of LLMs. + +Existing KG-based RAG frameworks often struggle to effectively balance retrieval with reasoning over the retrieved data, limiting their ability to address these challenges. For example, many approaches rely on multiple LLM calls for iterative KG search, introducing significant complexity for each query (Kim et al.; Gao et al., 2024a; Wang et al., 2024; Guo et al., 2024; Ma et al., 2024; Sun et al., 2024a; Jiang et al., 2024; Jin et al., 2024; Xiong et al., 2024). Furthermore, the mismatch between large KG search spaces and constrained LLM context windows poses challenges to the coverage of LLM-based retrieval. Conversely, some methods employ lighter models, such as Long Short-Term Memory or Graph Neural Networks, for both retrieval and reasoning (Zhang et al., 2022; Liu et al., 2024a; Sun et al., 2019). Despite being more efficient, these methods are constrained by the inferior reasoning capabilities of the lighter models. Additionally, certain approaches retrieve fixed types of subgraphs (e.g., paths) for convenience (Zhang et al., 2022; Luo et al., 2024b), which restricts the coverage of critical evidence for LLM reasoning—a point we explore further in Sec. 3.1. + +Design Principles We argue that there is an inherent tradeoff between model complexity and reasoning capability. To effectively search over KGs, which are expected to grow rapidly, knowledge retrievers should remain lightweight, flexible, generalizable, and equipped with basic reasoning abilities to efficiently filter (roughly) relevant information from vast amounts of irrelevant data while delegating complex reasoning tasks to LLMs. As LLMs continue to demonstrate increasingly sophisticated reasoning capabilities and are likely to improve further, this division of labor will become more sensible. As long as the retrieved information fits within the LLM's reasoning capacity, LLMs—leveraging their superior reasoning power—can then perform more fine-grained analysis and provide accurate answers with appropriate prompting. This approach extends the two-stage Recall & Ranking (rough to fine) framework commonly used in traditional information retrieval and recommendation pipelines, with the key advance being that each stage is paired with appropriately tiered reasoning capabilities from AI models to meet the demands of answering complex queries. + +Besides, for questions proven too challenging, the concept of iterating the above process can be adopted. However, this consideration is beyond the scope of the current work. + +Present Work Our KG-based RAG framework, SubgraphRAG (Fig. 1), follows a pipeline that first retrieves a relevant subgraph and then employs LLMs to reason over it. While this approach mirrors some existing methods (He et al., 2021; Jiang et al., 2023b), SubgraphRAG introduces novel design elements that significantly improve both efficiency and effectiveness by adhering to the aforementioned principles. For efficiency, we employ a lightweight multilayer perceptron (MLP) combined with parallel triple-scoring for subgraph retrieval. To ensure effectiveness, we encode tailored structural distances from the query topic entities as structural features. This enables our MLP retriever to outperform more complex models, such as GNNs, LLMs, and heuristic searches, in terms of covering the triples and entities critical for answering the query while maintaining high efficiency. Additionally, the retrieved subgraphs have flexible forms, with adjustable sizes to accommodate the varying capacities of LLMs. SubgraphRAG employs unfine-tuned LLMs, maintaining generalization, adaptability to updated KGs, and compatibility with black-box LLMs. + +We evaluate SubgraphRAG on two multi-hop knowledge graph question answering benchmarks—WebQSP and CWQ. Remarkably, without fine-tuning, smaller models like Llama3.1-8B-Instruct can achieve competitive performance. Larger models, such as GPT-4o, deliver state-of-the-art results. Furthermore, SubgraphRAG shows robust multi-hop reasoning capabilities, excelling on more complex, multi-hop questions and demonstrating effective generalization across datasets despite domain shifts. Ablation studies on different retrievers highlight the advantage of our retriever, which consistently outperforms baseline retrievers and is key to our superior KGQA performance. Additionally, our method also exhibits a substantial capability of reducing hallucination by generating knowledge-grounded answers and explanations for its reasoning. + +# 2 PRELIMINARIES + +A KG can be represented as a set of triples, denoted by $\mathcal{G} = \{(h,r,t) \mid h,t \in \mathcal{E}, r \in \mathcal{R}\}$ , where $\mathcal{E}$ represents the set of entities and $\mathcal{R}$ represents the set of relations. Each triple denoted by $\tau = (h,r,t)$ characterizes a fact that the head entity $h$ and the tail entity $t$ follow a directed relation $r$ . In practice, entities and relations are often associated with a raw text surface form friendly for LLM reasoning. + +KG-based RAG enhances LLMs with KG knowledge. Given a query $q$ , LLMs can access relevant knowledge represented by triples in the KG to address $q$ . The challenge lies in efficiently searching for relevant knowledge within the often large-scale KG and reasoning for accurate prediction. + +Entity Linking is often the first step in KG-based RAG, whose goal is to identify the set of entities $\mathcal{T}_q\subset \mathcal{E}$ directly involved in the query $q$ . The entities in $\mathcal{T}_q$ , named topic entities, provide valuable inductive bias for retrieval as the triples relevant to $q$ are often close to $\mathcal{T}_q$ . + +Knowledge Graph Question Answering (KGQA) is an important application often used to evaluate KG-based RAG, where the query $q$ is a question that requires finding answers that satisfy certain constraints. The answer(s) $\mathcal{A}_q$ often correspond to a set of entities in the KG. Questions that require multiple triples in the KG as evidence to identify an answer entity are classified as complex questions, as they demand multi-hop reasoning, in contrast to single-hop questions. + +# 3 THE SUBGRAPHRAG FRAMEWORK + +Our proposed framework, SubgraphRAG, adopts a retrieval-and-reasoning pipeline for KG-based RAG. Specifically, given a query $q$ , SubgraphRAG first extracts a subgraph $\mathcal{G}_q \subset \mathcal{G}$ that represents predicted relevant knowledge, and then LLMs generate the response by reasoning over $\mathcal{G}_q$ . While some existing works adopt a similar pipeline (Zhang et al., 2022; Luo et al., 2024b; Wu et al., 2023; Wen et al., 2023), our approach is novel in addressing three key challenges: First, the extracted subgraph $\mathcal{G}_q$ is designed to comprehensively cover the relevant evidence for answering $q$ , while adhering to a size constraint $K$ , which can be adjusted according to the capacity of the downstream LLM. Second, the extraction of $\mathcal{G}_q$ is highly efficient and scalable. Third, we employ tailored prompting to guide the LLM in reasoning over $\mathcal{G}_q$ and generating a well-grounded answer with explanations. + +# 3.1 EFFICIENT, FLEXIBLE AND EXPRESSIVE SUBGRAPH RETRIEVAL + +Problem Reduction We formulate the subgraph retrieval problem and reduce it to an efficiently solvable problem. An LLM models $\mathbb{P}(\cdot |\mathcal{G}_q,q)$ that takes queries and evidence subgraphs. Given a query $q$ and its answer $\mathcal{A}_q$ , the best subgraph evidence for this LLM is denoted as $\mathcal{G}_q^* = \arg \max_{\mathcal{G}_q\subseteq \mathcal{G}}\mathbb{P}(\mathcal{A}_q\mid \mathcal{G}_q,q)$ . However, solving this problem is impossible as it requires the knowledge of $\mathcal{A}_q$ . Instead, we aim to learn a subgraph retriever that generalizes to unseen future queries. + +Specifically, let the subgraph retriever be a distribution $\mathbb{Q}_{\theta}(\cdot |q,\mathcal{G})$ over the subgraph space of the KG, where $\theta$ denotes the parameters. Given a training set of question-answer pairs $\mathcal{D}$ , the subgraph retriever learning problem can be formulated as the following problem: + +$$ +\max _ {\theta} \mathbb {E} _ {(q, \mathcal {A} _ {q}) \sim \mathcal {D}, \mathcal {G} _ {q} \sim \mathbb {Q} _ {\theta} (\mathcal {G} _ {q} | q, \mathcal {G})} \mathbb {P} \left(\mathcal {A} _ {q} \mid \mathcal {G} _ {q}, q\right). \tag {1} +$$ + +This problem is hard to solve due to the complexity of the LLM $(\mathbb{P})$ . Evaluating $\mathbb{P}(\mathcal{A}_q \mid \mathcal{G}_q, q)$ requires the LLM to generate the particular answer $\mathcal{A}_q$ , which can be costly and is only applicable to grey/white-box LLMs with accessible output logits, let alone the non-computable gradient $\frac{d\mathbb{P}}{d\mathcal{G}_q}$ . + +To solve the problem in Eq. 1, we adopt the following strategy. If we know the optimal subgraph $\mathcal{G}_q^*$ , the maximum likelihood estimation (MLE) principle can be leveraged to train the retriever $\max_{\theta} \mathbb{E}_{(q,\mathcal{A}_q)\sim \mathcal{D}}\mathbb{Q}_{\theta}(\mathcal{G}_q^*|\mathcal{G},q)$ . However, getting $\mathcal{G}_q^*$ for an even known question-answer pair $(q,\mathcal{A}_q)$ is computationally hard and LLM-dependent. Instead, we use $(q,\mathcal{A}_q)$ to construct surrogate subgraph evidence with heuristics $\tilde{\mathcal{G}} (q,\mathcal{A}_q)$ and train the retriever based on MLE: + +$$ +\max _ {\theta} \mathbb {E} _ {(q, \mathcal {A} _ {q}) \sim \mathcal {D}} \mathbb {Q} _ {\theta} \left(\tilde {\mathcal {G}} _ {q} \mid \mathcal {G}, q\right), \quad \text {w h e r e} \tilde {\mathcal {G}} _ {q} = \tilde {\mathcal {G}} (q, \mathcal {A} _ {q}). \tag {2} +$$ + +An example $\tilde{\mathcal{G}}_q$ is the shortest paths between the topic entities $\mathcal{T}_q$ and answer entities $\mathcal{A}_q$ . Eq. 2 is conceptually similar to the weak supervision in Zhang et al. (2022). However, the formulation in Eq. 2 indicates that the sampled subgraph does not necessarily follow a fixed type like path. Instead, the retriever distribution $\mathbb{Q}_{\theta}$ can by construction factorize into a product of distributions over triples, allowing efficient training and inference, flexible subgraph forms, and adjustable subgraph sizes. + +Triple Factorization We propose to adopt a retriever that allows a subgraph distribution factorization over triples given some latent variables $z_{\tau} = z_{\tau}(\mathcal{G},q)$ (to be elaborated later): + +$$ +\mathbb {Q} _ {\theta} \left(\mathcal {G} _ {q} \mid \mathcal {G}, q\right) = \prod_ {\tau \in \mathcal {G} _ {q}} p _ {\theta} (\tau \mid z _ {\tau}, q) \prod_ {\tau \in \mathcal {G} \backslash \mathcal {G} _ {q}} \left(1 - p _ {\theta} (\tau \mid z _ {\tau}, q)\right), \tag {3} +$$ + +This strategy is inspired by the studies on graph generative models (Kipf & Welling, 2016) and enjoys four benefits: Efficiency in Training - The problem in Eq. 2 can be factorized as $\max_{\theta} \mathbb{E}_{(q,\mathcal{A}_q)\sim \mathcal{D}}\sum_{\tau \in \tilde{\mathcal{G}}_q}\log p_\theta (\tau \mid z_\tau ,q) + \sum_{\tau \in \mathcal{G}\setminus \tilde{\mathcal{G}}_q}\log (1 - p_\theta (\tau \mid z_\tau ,q))$ ; Efficiency in Sampling - After computing $z_{\tau}$ , we can select triples $\tau$ from $\mathcal{G}$ in parallel; Flexibility - Triple combinations can form arbitrary subgraphs; Adjustable Size - Subgraphs formed by top- $K$ triples with different $K$ values can accommodate various LLMs with diverse reasoning capabilities. In practice, $\mathbb{Q}_{\theta}$ can be further simplified given topic entities $\mathcal{T}_q$ (He et al., 2021; Jiang et al., 2023b), by only considering subgraphs close to the topic entities, i.e., $p_{\theta}(\tau \mid z_{\tau},q) = 0$ for a $\tau$ that is far from $\mathcal{T}_q$ . + +Relevant Designs Previous approaches often adopt heuristics and focus on particular subgraph types, such as constrained subgraph search (e.g., connected subgraphs (He et al., 2024)), constrained path search from topic entities, often imposing constraints in path counts and lengths (Luo et al., 2024b; Mavromatis & Karypis, 2024) or employing potentially expensive iterative processes (Zhang et al., 2022; Wu et al., 2023; Sun et al., 2024a; Liu et al., 2024a; Sun et al., 2024b), and entity selection followed by extracting entity-induced subgraphs, where all triples involving an entity are included together (Yasunaga et al., 2021; Taunk et al., 2023). The loss in flexibility narrows the space of possible retrieved subgraphs, which eventually harms the RAG effectiveness. + +Directional Distance Encoding (DDE) $z_{\tau}(\mathcal{G},q)$ models the relationship between a triple $\tau$ and the query $q$ given $\mathcal{G}$ . Graph neural network (GNN) is one option for this modeling purpose through message passing with entity, relation, and question embeddings (Yasunaga et al., 2021; Kang et al., 2023; Mavromatis & Karypis, 2024; Liu et al., 2024a). However, it faces fundamental limitations in its representation power (Xu et al., 2019; Murphy et al., 2019; Morris et al., 2019; Chen et al., 2020). + +
System: Based on the triples retrieved from a knowledge graph, please answer the question. Please return formatted answers as a list, each prefixed with `ans`. +User: Triplets: (e1, r12, e2) \n (e3, r34, e4) \n ... \ n Question: ... +Assistant: To answer the question, we have to find .... From the triples we can see that .... Therefore, the answers are: \n ans: ... \ n ans: ... \ n .... +User: Triplets: (eα, rαb, eβ) \n (eγ, rγd, eγd) \ n ... \ n Question: ... +assistant: To answer the question, we have to find .... From the triples we can see that .... Therefore, the answers are: \n ans: ... \ n ans: ... \ n .... +// the evaluation question
+ +Figure 2: The prompt used in SubgraphRAG. Concrete examples can be found in Appendix E). + +One critical limitation is its inability to compute distances between entities and topic entities (Li et al., 2020), which can be particularly problematic for multi-hop question answering. + +The structural relationship between $\tau$ and $q$ provides valuable information complementing their semantic relationship. Inspired by the success of distance encoding and labeling trick in enhancing the structural representation power of GNNs (Li et al., 2020; Zhang et al., 2021), we propose a DDE as $z_{\tau}(\mathcal{G}, q)$ to model the structural relationship. Given topic entities $\mathcal{T}_q$ , let $\mathbf{s}_e^{(0)}$ be a one-hot encoding representing whether $e \in \mathcal{T}_q$ or not. For the $l + 1$ -th round, we perform feature propagation and compute $\mathbf{s}_e^{(l + 1)} = \mathrm{MEAN}\{\mathbf{s}_{e'}^{(l)} \mid (e', \cdot, e) \in \mathcal{G}\}$ , and through the reverse direction to account for the directed nature of $\mathcal{G}$ , $\mathbf{s}_e^{(r,l + 1)} = \mathrm{MEAN}\{\mathbf{s}_{e'}^{(r,l)} \mid (e, \cdot, e') \in \mathcal{G}\}$ , where $\mathbf{s}_e^{(r,0)} = \mathbf{s}_e^{(0)}$ . We concatenate all results to obtain the final entity encodings $\mathbf{s}_e = [\mathbf{s}_e^{(0)} \| \mathbf{s}_e^{(1)} \| \dots \| \mathbf{s}_e^{(r,1)} \| \dots]$ , leading to triple encodings $z_{\tau}(\mathcal{G}, q) = [\mathbf{s}_h \| \mathbf{s}_t]$ that concatenate the encodings of $h$ and $t$ . In section 4.1, we compare different approaches to compute $z_{\tau}(\mathcal{G}, q)$ - using GNNs, DDE, or only one-hot encodings of $\mathcal{T}_q$ , and DDEs perform the best. See Appendix A for additional illustrations and discussions. + +A Lightweight Implementation For $p_{\theta}(\cdot | z_{\tau}(\mathcal{G}, q), q)$ We present a lightweight implementation of $p_{\theta}$ that integrates structural and semantic information. Following previous approaches (Karpukhin et al., 2020; Gao et al., 2024b), we employ off-the-shelf pre-trained text encoders to embed all entities/relations in a KG based on their text attributes. These semantic text embeddings are computed and stored in a vector database during the pre-processing stage for efficient retrieval. For a newly arrived question $q$ , we embed $q$ to obtain $z_{q}$ and retrieve embeddings $z_{h}, z_{r}, z_{t}$ from the vector database for the involved entities and relations. After computing DDEs $z_{\tau}$ , an MLP is employed for binary classification using the concatenated input $[z_{q} \| z_{h} \| z_{r} \| z_{t} \| z_{\tau}]$ . + +Relevant Designs We considered several alternatives but found them less preferable due to concerns about efficiency and adaptability to KG updates. Cross-encoders, which concatenate a question and a retrieval candidate for joint embedding (Wolf et al., 2019), potentially offer better retrieval performance. However, due to the inability to pre-compute embeddings, this approach significantly reduces retrieval efficiency when dealing with a large number of retrieval candidates, as is the case in triple retrieval. Li et al. (2023a) embeds each triple as a whole rather than individual entities and relations. However, this approach incurs higher computational and storage costs and exhibits reduced generalizability to the triples that are new combinations of old entities and relations. Our lightweight implementation allows for fast triple scoring while maintaining good generalizability. + +# 3.2 PROMPTING-BASED LLM REASONING + +We employ an LLM to reason over $\mathcal{G}_q$ by incorporating the linearized list of triples forming $\mathcal{G}_q$ into the prompt. This approach allows the LLM to ground its reasoning in the retrieved structured knowledge and select the answers $\hat{\mathcal{A}}_q$ from the entities within $\mathcal{G}_q$ , mitigating issues like hallucinations and outdated knowledge (Lin et al., 2019; Shuster et al., 2021; Vu et al., 2024). Specifically, we prompt the LLM to generate knowledge-grounded explanations besides the answers, which further effectively reduces hallucinations. We adopt in-context learning (ICL) (Brown et al., 2020) and design dedicated prompt templates with explanation demonstrations to guide LLM reasoning (see Fig. 2). + +Without fine-tuning LLMs, we reduce computational costs, enable the usage of state-of-the-art (SOTA) black-box LLMs, and maintain the generalizability for unseen KGs. Fine-tuning also risks enhancing prediction accuracy at the cost of general reasoning and explaining capabilities. High-quality text-based explanations are typically unavailable for question-answering tasks in practice. As a result, previous KG-based RAG approaches that rely on fine-tuning often depend on larger, unfinetuned LLMs like GPT-4 to generate explanations as additional training data (Luo et al., 2024b). + +Regarding the size $K$ of the retrieved subgraph, while increasing $K$ in principle improves the coverage of relevant information, it also risks introducing more irrelevant information that may harm + +Table 1: Evaluation results for retrieval recall and wall-clock time. Best results are in **bold**. Being training-free, cosine similarity and G-Retriever stay unchanged in generalization evaluations. + +
ModelWebQSPCWQCWQ→WebQSPWebQSP→CWQ
TriplesEntities AnswerTime (s)TriplesEntities AnswerTime (s)TriplesEntities AnswerTriplesEntities Answer
Shortest PathGPT-4oShortest PathGPT-4oShortest PathGPT-4oShortest PathGPT-4o
cosine similarity0.7140.7190.70830.4880.5670.582130.7140.7190.7080.4880.5670.582
SR+NSM w E2E0.4870.5040.707101----------
Retrieve-Rewrite-Answer0.0580.0620.74069----------
RoG0.7130.3880.8079480.6230.2980.84123270.5890.3230.6580.3010.1390.412
G-R retriever0.2940.3250.5456720.1830.2170.37515300.2940.3250.5450.1830.2170.375
GNN-RAG0.5220.4050.818680.5000.3860.8411600.4460.3640.6910.4440.3510.697
SubgraphRAG0.8830.8650.94460.8110.8400.914120.7940.7760.8870.6220.6230.773
+ +Table 2: Breakdown of recall evaluation over # hops. Best results are in bold. + +
ModelShortest Path Triple RecallGPT-4o Triple RecallAnswer Entity Recall
WebQSPCWQWebQSPCWQWebQSPCWQ
1 (65.8%)2 (34.2%)1 (28.0%)2 (65.9%)≥ 3 (6.1%)1 (65.8%)2 (34.2%)1 (28.0%)2 (65.9%)≥ 3 (6.1%)1 (65.8%)2 (34.2%)1 (28.0%)2 (65.9%)≥ 3 (6.1%)
cosine similarity0.8740.4050.6290.4420.3330.8470.4830.6290.5110.4640.9430.2530.9030.4720.289
SR+NSM w E2E0.5650.324---0.5800.376---0.9160.301---
Retrieve-Rewrite-Answer0.0640.046---0.0620.061---0.7450.729---
RoG0.8690.4150.7660.5970.2530.4460.2710.3470.2930.1220.8740.6770.9200.8270.628
G-Retriever0.3350.2160.1340.2050.1680.3450.2840.1590.2400.2260.5960.4460.3770.3840.269
GNN-RAG0.5320.5020.5150.4980.4460.3840.4450.3280.4080.4180.8100.8310.8530.8410.787
MLP0.8280.6870.6510.6900.5340.8110.7810.6350.7070.6160.9330.8740.9320.8700.793
MLP + topic entity0.9440.7290.8540.7500.5600.8840.7750.7690.7730.6470.9760.8430.9560.8850.665
SubgraphRAG0.9530.7480.8310.8200.6260.9080.8090.8230.8600.7550.9770.8810.9460.9160.741
+ +LLM reasoning (Xu et al., 2024; Liu et al., 2024b). Different LLMs are inherently equipped with different sized context windows and also exhibit distinct capabilities in reasoning over long-context retrieval results (Dubey et al., 2024). As such, although the training of SubgraphRAG retriever is LLM-agnostic, the size $K$ needs to be properly selected per LLM and constraints. In Section 4.2, we empirically verify that more powerful LLMs can benefit from incorporating a larger-sized retrieved subgraph, demonstrating the benefit of size-adjustable subgraph retrieval in SubgraphRAG. + +# 4 EXPERIMENTS + +We design our empirical studies to examine the effectiveness and efficiency of SubgraphRAG in addressing the various challenges inherent to KG-based RAG, covering both retrieval and reasoning aspects. Q1) Overall, to meet the accuracy and low-latency requirements of KG-based RAG, does SubgraphRAG effectively and efficiently retrieve relevant information? Q2) For complex questions involving multi-hop reasoning and multiple topic entities, does SubgraphRAG properly integrate structural information for effective retrieval? Q3) How effectively does SubgraphRAG perform on KGQA tasks, and how is its accuracy influenced by different factors? Q4) To what extent can our pipeline provide effective knowledge-grounded explanations for question answering? + +Datasets. We adopt two prominent and challenging KGQA benchmarks that necessitate multi-hop reasoning – WebQSP (Yih et al., 2016) and CWQ (Talmor & Berant, 2018). Both benchmarks utilize Freebase (Bollacker et al., 2008) as the underlying KG. To evaluate the capability of LLM reasoners in knowledge-grounded hallucination-free question answering, we introduce WebQSP-sub and CWQ-sub, where we remove samples whose answer entities are absent from the KG. + +# 4.1 EVALUATION FOR RETRIEVAL (Q1 & Q2) + +Baseline Retrievers. Cosine similarity performs structure-free triple retrieval based on triple embeddings (Li et al., 2023a). SR+NSM w E2E (Zhang et al., 2022) and Retrieve-Rewrite-Answer (Wu et al., 2023) propose constrained path search based on pre-trained text encoders. RoG (Luo et al., 2024b) adopts a similar strategy but fine-tunes an LLM for relation path prediction. G-Retriever (He et al., 2024) combines cosine similarity search with combinatorial optimization to construct a connected subgraph. GNN-RAG employs lightweight GNNs to predict answer entities and extracts shortest paths between them and topic entities (Mavromatis & Karypis, 2022; 2024). + +Implementation Details. We adopt gte-large-en-v1.5 (Li et al., 2023c) as the pre-trained text encoder for both the cosine similarity baseline and SubgraphRAG, a 434M model that achieves a good balance between efficiency and English retrieval performance, as evidenced by the Massive Text Embedding Benchmark (MTEB) leaderboard (Muennighoff et al., 2023). For supervision signals, there are no ground-truth relevant subgraphs for a query $q$ . Previous path-based subgraph retrievers adopt the shortest paths between the topic and answer entities for the weak supervision signals (Zhang et al., 2022; Luo et al., 2024b). We also utilize these shortest paths as the heuristic relevant sub + +![](images/fb0625c31abb85384f346e033fcbd4dc04d00868918b4ffecaf294d302aa064b.jpg) +Figure 3: Retrieval effectiveness on CWQ across a spectrum of $K$ values for top- $K$ triple retrieval. + +graphs $\tilde{\mathcal{G}}_q$ to train $\mathbb{Q}_{\theta}$ as in Eq. 2. To reduce the size of candidate triples $\mathcal{G}$ , we construct subgraphs centered at topic entities $\mathcal{T}_q$ , following previous works. See Appendix C.1 for more details. + +Evaluation Metrics. Our evaluation covers both effectiveness and efficiency. For effectiveness, we employ three recall metrics, respectively for shortest path triples (i.e., $\tilde{\mathcal{G}}_q$ ), GPT-4o-identified relevant triples, and answer entities within retrieved subgraphs. The first metric assesses the retrieval of weak supervision signals used for training. For a more accurate assessment, we employ GPT-4o to identify $\leq 20$ relevant triples for all test samples, potentially capturing relevant triples beyond the shortest paths (see Appendix E for labeling details). We calculate individual recall values per question and then take the average. For efficiency, we measure wall clock time on a 48GB NVIDIA RTX 6000 Ada GPU in seconds. To focus on model computational efficiency, we exclude KG query time. For text embedding, employed by SubgraphRAG variants and most baselines (cosine similarity, G-R retriever, and GNN-RAG), we only count the time for question embedding as the entity and relation embeddings for the entire KG can be pre-computed. Such pre-computation may yield a time-memory trade-off. + +Overall Evaluation (Q1). Table 1 shows that SubgraphRAG consistently outperforms all other ap + +Table 3: Question-answering performance on WebQSP and CWQ. Best results are in bold. By default, our reasoners use the top 100 retrieved triples. Results with 200 and 500 triples (indicated in parentheses) are also shown. Results with $(\leftrightarrow)$ evaluate retriever generalizability, where the retriever is trained on one dataset and applied to the other. + +
WebQSPCWQ
Macro-F1HitMacro-F1Hit
UniKGQA72.2-49.0-
SR+NSM w E2E64.1-46.3-
KD-CoT52.568.6-55.7
ToG (GPT-4)-82.6-67.6
StructGPT-74.69--
Retrieve-Rewrite-Answer-79.36--
G-Retriever53.4173.46--
RoG-Joint70.2686.6754.6361.94
RoG-Sep66.4582.1953.8760.55
EtD-82.5-62.0
GNN-RAG71.385.759.466.8
SubgraphRAG + Llama3.1-8B70.5786.6147.1656.98
SubgraphRAG + Llama3.1-70B74.7086.2451.7857.89
SubgraphRAG + ChatGPT69.2183.1149.1356.27
SubgraphRAG + GPT4o-mini77.4590.1154.1362.02
SubgraphRAG + GPT4o76.4689.8059.0866.69
SubgraphRAG + GPT4o-mini (200)77.8290.5454.6963.49
SubgraphRAG + GPT4o (200)78.2490.9159.4267.49
SubgraphRAG + GPT4o-mini (500)77.6791.2255.4164.97
SubgraphRAG + Llama3.1-8B (↔)66.4283.4237.9648.57
SubgraphRAG + GPT4o-mini (↔)73.8188.0844.6954.21
SubgraphRAG + GPT4o-mini (↔, 500)76.2091.2250.3060.80
SubgraphRAG + GPT4o (↔)74.2787.1047.5554.89
SubgraphRAG + GPT4o (↔, 500)77.1289.6855.1462.98
+ +proaches in retrieval effectiveness. RoG achieves the most competitive baseline performance for retrieving shortest path triples. However, when evaluated on GPT-4o-labeled triples, RoG's performance drops significantly (45.6% for WebQSP, 52.2% for CWQ), while SubgraphRAG remains robust (2.0% decrease for WebQSP, 3.6% increase for CWQ). This stark difference, despite using the same training signals, empirically validates that SubgraphRAG's individual triple selection mechanism allows for more flexible and effective subgraph extraction compared to RoG's constrained path search approach. Regarding efficiency, SubgraphRAG is only slightly slower than the cosine similarity baseline on WebQSP while being one to two orders of magnitude faster than other baselines, including GNN-RAG. For the cosine similarity baseline and SubgraphRAG, we report recall metrics based on the top-100 retrieved triples (2.3% of total candidate triples on average). This budget consistently yields robust reasoning performance across LLMs in subsequent experiments. + +Generalizability. We further examine the generalizability of the retrievers by training them on dataset $A$ and evaluating on dataset $B$ , denoted as $A \rightarrow B$ in Table 1. Despite an anticipated performance degradation, SubgraphRAG consistently outperforms the alternative approaches. + +Ablation Study for Design Options and Retrieval Size. To evaluate individual component contributions, we conduct an ablation study with several variants. MLP is a structure-free variant employing only text embeddings. We consider GraphSAGE (Hamilton et al., 2017), a popular + +![](images/2ab73390baede894645d4932447a4f20a2e910ab7cf501af8ba35761e9555194.jpg) +(a) WebQSP-sub + +![](images/8ff7dc80c5323fcce25ff259455a61554195a75f78843d7fe47a5a1679475266.jpg) +Figure 4: Ablation studies on the number of retrieved triples used in LLM reasoners. + +![](images/a3ad2153e53b9b0bdc5d138549c1b67ee1873ae2da8aa845054a2239361a4363.jpg) +(b) CWQ-sub + +![](images/c7c6031d2dc81c95eb09812491b5a03757af4b98055a2eb5ad38fbfc52837691.jpg) + +GNN, to update entity representations prior to the triple scoring. We further augment both MLP and GraphSAGE with a one-hot-encoding topic entity indicator (MLP + topic entity and GraphSAGE + topic entity). Following Sun et al. (2018), we incorporate Personalized PageRank (PPR) (Haveli-wala, 2002), seeded from the topic entities, to integrate structural information (MLP + topic entity + PPR). To account for both the varying capabilities of downstream LLMs and inference cost/latency constraints, we evaluate these variants across a broad spectrum of retrieval sizes $(K)$ . + +Fig. 3 presents the results on CWQ, with baselines included for reference. Larger retrieval sizes uniformly improve recall across all variants. Equipped with DDE, SubgraphRAG outperforms other variants, even at the relatively small average retrieval sizes of the baselines. This demonstrates that SubgraphRAG's superiority is not solely attributable to larger retrieval sizes. Regarding design options, the topic entity indicator invariably leads to an improvement. In contrast, GNN variants often result in performance degradation compared to their MLP counterparts. We suspect that the diffusion of semantic information introduces noise in triple selection. Finally, PPR fails to reliably yield improvements. For the results on WebQSP, see Appendix C.3, which are also consistent. + +Multi-Hop and Multi-Topic Questions (Q2). To evaluate the effectiveness of various approaches in capturing structural information for complex multi-hop and multi-topic questions, we group questions based on the number of hops and topic entities. Table 2 presents the performance breakdown by hop count. SubgraphRAG consistently outperforms other methods on WebQSP and achieves the best overall performance on CWQ. Notably, while the cosine similarity baseline and RoG demonstrate competitive performance for single-hop questions, their performance degrades significantly for multi-hop questions. Appendix C.4 provides a performance breakdown for single-topic and multi-topic questions, focusing exclusively on CWQ due to the predominance of single-topic questions in the WebQSP test set $(98.3\%)$ . SubgraphRAG consistently exhibits superior performance across all metrics for both single-topic and multi-topic questions. Our comprehensive analysis highlights the remarkable effectiveness of DDE in capturing complex topic-centered structural information essential for challenging questions involving multi-hop reasoning and multiple topic entities. + +# 4.2 KGQA RESULTS (Q3 & Q4) + +KGQA Baselines. Besides the baselines in retrieval evaluation, we include more KGQA methods, including UniKGQA (Jiang et al., 2023b), KD-CoT (Wang et al., 2023a), StructGPT (Jiang et al., 2023a), ToG (Sun et al., 2024a), and EtD (Liu et al., 2024a). For RoG, we present two entries: RoG-Joint and RoG-Sep. Originally, RoG fine-tuned its LLMs on the training sets of both WebQSP and CWQ. Yet, this joint training approach leads to significant label leakage, with over $50\%$ of WebQSP test questions (or their variants) appearing in CWQ's training set, and vice versa. Therefore, we re-trained RoG on each dataset separately, denoted by RoG-Sep. + +Evaluation Metrics. Along with the commonly reported Macro-F1 and Hit1, we also include Micro-F1 to account for the imbalance in the number of ground-truth answers across samples and Hit@1 for a more inclusive evaluation. To further assess model performance, we introduce scoreH, inspired by (Yang et al., 2024), which evaluates how truth-grounded the predicted answers are and the degree of hallucination. This metric penalizes hallucinated answers while favoring missing answers over incorrect ones. Scores are normalized to a range of 0 to 100, with higher scores indicating better truth-grounding in the model's answers. The scoring strategy is described in detail in Appendix D. + +Experiment Settings. We use the vllm (Kwon et al., 2023) framework for efficient LLM inference. For UniKGQA, KD-CoT, Retrieve-Rewrite-Answer, ToG, and EtD, we reference their published + +Table 4: Question-answering performance on WebQSP-sub and CWQ-sub. Best results are in **bold**. By default, our reasoners use the top 100 retrieved triples. Results with 200 and 500 triples (indicated in parentheses) are also shown. Results with $(\leftrightarrow)$ evaluate retriever generalizability, where the retriever is trained on one dataset and applied to the other. + +
WebQSP-subCWQ-sub
Macro-F1Micro-F1HitHit@1ScorehMacro-F1Micro-F1HitHit@1Scoreh
SR+NSM w E2E58.7937.0468.6360.6264.44-----
G-Retriever54.1323.8474.5267.5667.97-----
RoG-Joint72.0147.7088.9082.6276.1358.6152.1266.2261.1755.15
RoG-Sep67.9443.1084.0377.6172.7957.6952.8364.6460.6454.51
SubgraphRAG + Llama3.1-8B72.1046.5688.5884.8082.4254.7651.7665.8059.6962.89
SubgraphRAG + Llama3.1-70B75.9751.6487.8885.8985.5761.4959.9168.4365.5267.62
SubgraphRAG + ChatGPT70.8144.7385.1880.8281.5356.3754.4464.4060.9961.31
SubgraphRAG + GPT4o-mini78.3458.4491.3487.3682.2161.1358.8670.0165.4864.20
SubgraphRAG + GPT4o77.6156.7891.4086.4081.8565.9963.1873.9168.8966.57
SubgraphRAG + GPT4o-mini (200)78.6658.6591.7387.0481.9861.5857.4771.4565.8763.66
SubgraphRAG + GPT4o (200)79.4058.9192.4387.7582.4666.4861.3075.1469.4266.45
SubgraphRAG + GPT4o-mini (500)78.4657.0892.4388.0181.9562.1856.8672.8266.5762.77
SubgraphRAG + Llama3.1-8B (↔)67.9142.7985.2581.2180.0943.0340.7355.0947.5856.78
SubgraphRAG + GPT4o-mini (↔)74.4249.4189.1084.6781.3549.4745.1660.1854.1858.86
SubgraphRAG + GPT4o-mini (↔, 500)76.8352.0192.3087.4381.4155.5849.1367.2459.6959.87
SubgraphRAG + GPT4o (↔)74.9850.6788.2684.7383.2452.4052.2860.3656.3963.70
SubgraphRAG + GPT4o (↔, 500)77.9656.4090.9686.6683.3561.9658.4870.4764.9666.86
+ +Table 5: Breakdown of QA performance by reasoning hops. + +
WebQSP-subCWQ-sub
1 (65.8%)2 (34.2%)1 (28.0%)2 (65.9%)≥ 3 (6.1%)
Marco-F1HitMarco-F1HitMarco-F1HitMarco-F1HitMarco-F1Hit
G-Retriever56.4178.2045.7365.35------
RoG-Joint77.0592.9662.5381.5459.7566.3359.7068.5641.4643.27
RoG-Sep74.5089.8355.6273.4559.3566.2059.4567.1731.3333.33
SubgraphRAG (Llama3.1-8B)75.5091.4065.8783.6251.5463.0557.5268.9341.8847.37
SubgraphRAG (GPT4o-mini)80.5692.8674.1188.5157.3667.3463.8572.7451.1454.39
+ +results due to various reproducibility difficulties. For StructGPT, we directly use their provided processed files to obtain results for WebQSP. For SR, we include their reported results for WebQSP and CWQ, and further evaluate it on WebQSP-sub as we could not run through SR's code on the two CWQ datasets. For the remaining baselines, we successfully reproduced their results and evaluated them on additional metrics and datasets, including WebQSP-sub and CWQ-sub. However, we do not include results for G-R retriever on CWQ as it required over 200 hours of computation on 2 NVIDIA RTX 6000 Ada GPUs. If not specified, the LLM reasoners in SubgraphRAG use the top 100 retrieved triples; results using more triples are explicitly noted. All Llama models used are their instruction fine-tuned versions, i.e., Llama3.1-8B(70B)-Instruct. The used GPT models' versions are gpt-3.5-turbo-1106, gpt-4o-mini-2024-07-18, and gpt-4o-2024-08-06. For all LLM reasoners used in SubgraphRAG, both the temperature and the seed are set to 0 to ensure reproducibility. + +Overall Performance. Tables 3 and 4 present the results, where SubgraphRAG achieves SOTA on WebQSP and WebQSP-sub. Even with 8B LLMs, our method surpasses previous SOTA approaches by $\leq 4\%$ in Macro-F1 and Hit metrics (excluding RoG-Joint due to test label leakage). With larger models like Llama3.1-70B-Instruct and GPT-4o, SubgraphRAG achieves greater performance, showing $\leq 12\%$ improvement in Macro-F1 and $\leq 9\%$ in Hit. On the more challenging CWQ and CWQ-sub datasets, which require more reasoning hops, SubgraphRAG performs competitively with smaller 8B models. When paired with advanced LLMs like GPT-4o, SubgraphRAG achieves results second only to ToG on CWQ. Notably, SubgraphRAG requires only a single call to GPT-4o, whereas ToG requires 6-8 calls, which increases computational cost, and we were unable to reproduce ToG's performance using their published code. On CWQ-sub, SubgraphRAG demonstrates gains of $\leq 9\%$ in Macro-F1 and $\leq 11\%$ in Hit, indicating that tasks with greater reasoning complexity benefit substantially from more powerful LLMs. Our method also excels in truth-grounded QA, with Scoreh consistently outperforming baselines by $\leq 12\%$ , driven by our prompt design that encourages retrieval-grounded reasoning. See Appendix D for further discussions. + +Additionally, our framework generalizes well, with retrievers trained on one dataset performing effectively on others. Although moderate performance decay occurs due to domain shift, this can largely be mitigated by including more triples extracted by the retriever. Notably, the decay is generally minor on WebQSP and WebQSP-sub but more pronounced on CWQ and CWQ-sub, potentially due to greater label leakage from the WebQSP test set to the CWQ training set. + +Table 6: Ablation studies with different retrievers, using the same prompt and Llama3.1-8B-Instruct as the reasoner. Rand refers to random triple sampling, RandNoAns removes triples with ground-truth answers after random sampling, and NoRetriever directly asks questions without KG info. + +
WebQSPCWQWebQSP-subCWQ-sub
Macro-F1HitMacro-F1HitMacro-F1Micro-F1HitHit@1ScorehMacro-F1Micro-F1HitHit@1Scoreh
Rand + SubgraphRAG Reasoner37.6960.1427.3435.8537.7917.7960.7454.9765.0629.9729.1539.1535.1152.45
RandNoAns + SubgraphRAG Reasoner21.1833.5416.4022.7120.618.6433.0327.3347.2916.4716.4423.0019.4243.79
NoRetriever + SubgraphRAG Reasoner35.8651.9025.6432.3435.0317.0151.3847.5955.5727.4222.6633.9530.6544.87
cosine similarity + SubgraphRAG Reasoner58.4174.1434.5943.6159.2637.3175.4371.2073.1639.0535.4849.0243.6855.72
Retrieve-Rewrite-Answer + SubgraphRAG Reasoner8.9611.43--9.115.2311.4310.8463.45-----
StructGPT + SubgraphRAG Reasoner62.1475.00--62.5544.7275.6973.5780.82-----
G-Retriever + SubgraphRAG Reasoner48.9164.5028.4734.5849.9228.0865.8862.6072.5431.5532.2238.1735.2258.22
RoG-Sep + SubgraphRAG Reasoner57.6874.3936.8545.2359.3640.3276.6572.6179.6944.1143.6954.0447.6866.18
GNN-RAG + SubgraphRAG Reasoner62.3478.8146.4054.3563.9342.4380.8977.1082.8655.0853.3864.3359.7667.55
GNN-RAG (↔) + SubgraphRAG Reasoner52.0771.3834.8843.1353.0134.5872.9367.9973.3739.9834.6049.5444.9157.42
SubgraphRAG70.5786.6147.1656.9872.1046.5688.5884.8082.4254.7651.7665.8059.6962.89
SubgraphRAG (↔)66.4283.4237.9648.5767.9142.7985.2581.2180.0943.0340.7355.0947.5856.78
+ +For efficiency, studies show that overall LLM latency is dominated by # LLM calls, followed by # output tokens and then # input tokens2. SubgraphRAG, despite potentially varying # input tokens, utilizes only one LLM call per question, whereas various baselines require multiple calls. + +Performance Breakdown & Analysis. Table 5 presents the performance breakdown by reasoning hops. Our method, even with an 8B LLM, shows significantly better results on multi-hop questions. This can be attributed to our design philosophy, which does not restrict the retrieved subgraph form and leverages unfine-tuned LLMs with ICL examples, fully unlocking their reasoning capabilities. Interestingly, SubgraphRAG shows relatively lower performance on some 1-hop questions in CWQ-sub. Cross-referencing with Table 8, which provides a detailed breakdown of whether the answers are truth-grounded, we find that previous methods may generate many correct answers that are not supported by the retrieved results. Further investigation suggests this discrepancy may partly result from dataset leakage, giving tuning-based methods an advantage: In CWQ, over $60\%$ of test samples have answers that have appeared in the training set, making it easier for these methods to succeed without robust reasoning. Thus, future studies are needed to fully investigate the potential leakage. + +Performance with Different Retrievers. To assess the impact of our retriever on the overall performance, we conducted extensive studies by replacing the retrieval results with those from baseline retrievers, while keeping all other settings constant (same prompts, same LLM reasoners). Tables 6 and 9 show the results using Llama3.1 8B and GPT4o-mini as the LLM reasoners, respectively. For retrievers from Retrieve-Rewrite-Answer, StructGPT, G-Retriever, and RoG, we used all their retrieved triples, while for other cases, we kept 100 triples. Clearly, pairing with our retriever yields significantly better performance on all metrics and datasets compared to using baseline retrievers, indicating that our superior results are largely due to the effectiveness of our improved retriever. + +Impact of Retrieval Size. Irrelevant context can mislead LLMs (Wu et al., 2024), and retrieving more triples may not help. We conducted experiments (Fig. 4) by feeding Llama 3.1 8B and GPT-4o-mini different numbers of retrieved triples. The upper bound is defined such that if the answer entity is present in the retrieved results, it is considered a correct answer. The results show a significant performance decay in Llama 3.1 8B with more triples, while GPT-4o-mini performs even better with additional retrieved triples. This suggests that different LLMs have varying capacities for robust reasoning, and users should input proper numbers of retrieved results to match the capacity of the used LLM and the available computational budget. See Appendix D for more results. + +Explainability. By retrieving flexible, high-quality evidence subgraphs as context and exploiting the strong reasoning capabilities of pre-trained LLMs, SubgraphRAG can natively provide effective explanations along with answer predictions. In contrast, explainable predictions with fine-tuned LLMs necessitate extra labeling efforts for preserving explainability (Luo et al., 2024b) or post hoc explainability approaches (Krishna et al., 2023). To illustrate the explainability of our framework, we provide multiple examples of our reasoner's responses (see Appendix F). + +# 5 CONCLUSION + +We propose SubgraphRAG, a KG-based RAG framework that performs efficient and flexible subgraph retrieval followed by prompting unfine-tuned LLMs. SubgraphRAG demonstrates better or comparable accuracy, efficiency, and explainability compared to existing approaches. + +# ACKNOWLEDGMENTS + +M. Li, S. Miao, and P. Li are partially supported by NSF awards PHY-2117997, IIS-2239565, IIS-2428777, and CCF-2402816; DOE award DE-FOA-0002785; JPMC faculty awards; OpenAI Researcher Access Program Credits; and Microsoft Azure Research Credits for Generative AI. + +# REFERENCES + +Kurt Bollacker, Colin Evans, Praveen Paritosh, Tim Sturge, and Jamie Taylor. Freebase: a collaboratively created graph database for structuring human knowledge. In Proceedings of the 2008 ACM SIGMOD International Conference on Management of Data, pp. 1247-1250, 2008. +Sebastian Borgeaud, Arthur Mensch, Jordan Hoffmann, Trevor Cai, Eliza Rutherford, Katie Millican, George Bm Van Den Driessche, Jean-Baptiste Lespiau, Bogdan Damoc, Aidan Clark, Diego De Las Casas, Aurelia Guy, Jacob Menick, Roman Ring, Tom Hennigan, Saffron Huang, Loren Maggiore, Chris Jones, Albin Cassirer, Andy Brock, Michela Paganini, Geoffrey Irving, Oriol Vinyals, Simon Osindero, Karen Simonyan, Jack Rae, Erich Elsen, and Laurent Sifre. Improving language models by retrieving from trillions of tokens. In Proceedings of the 39th International Conference on Machine Learning, pp. 2206-2240, 2022. +Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel Ziegler, Jeffrey Wu, Clemens Winter, Chris Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, and Dario Amodei. Language models are few-shot learners. In Advances in Neural Information Processing Systems, pp. 1877-1901, 2020. +Sebastien Bubeck, Varun Chandrasekaran, Ronen Eldan, Johannes Gehrke, Eric Horvitz, Ece Kamar, Peter Lee, Yin Tat Lee, Yuanzhi Li, Scott Lundberg, Harsha Nori, Hamid Palangi, Marco Tulio Ribeiro, and Yi Zhang. Sparks of artificial general intelligence: Early experiments with gpt-4. arXiv preprint arXiv:2303.12712, 2023. +Michel Chein and Marie-Laure Mugnier. Graph-based knowledge representation: computational foundations of conceptual graphs. Springer Science & Business Media, 2008. +Zhengdao Chen, Lei Chen, Soledad Villar, and Joan Bruna. Can graph neural networks count substructures? In Advances in Neural Information Processing Systems, pp. 10383-10395, 2020. +Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pp. 4171–4186, 2019. +Bhuwan Dhingra, Jeremy R. Cole, Julian Martin Eisenschlos, Daniel Gillick, Jacob Eisenstein, and William W. Cohen. Time-aware language models as temporal knowledge bases. Transactions of the Association for Computational Linguistics, 10:257-273, 2022. +Abhimanyu Dubey et al. The llama 3 herd of models. arXiv preprint arXiv:2407.21783, 2024. +Darren Edge, Ha Trinh, Newman Cheng, Joshua Bradley, Alex Chao, Apurva Mody, Steven Truitt, and Jonathan Larson. From local to global: A graph rag approach to query-focused summarization. arXiv preprint arXiv:2404.16130, 2024. +Matthias Fey and Jan E. Lenssen. Fast graph representation learning with PyTorch Geometric. In ICLR Workshop on Representation Learning on Graphs and Manifolds, 2019. +Yifu Gao, Linbo Qiao, Zhigang Kan, Zhihua Wen, Yongquan He, and Dongsheng Li. Two-stage generative question answering on temporal knowledge graph using large language models. arXiv preprint arXiv:2402.16568, 2024a. + +Yunfan Gao, Yun Xiong, Xinyu Gao, Kangxiang Jia, Jinliu Pan, Yuxi Bi, Yi Dai, Jiawei Sun, Meng Wang, and Haofen Wang. Retrieval-augmented generation for large language models: A survey. arXiv preprint arXiv:2312.10997, 2024b. +Tiezheng Guo, Qingwen Yang, Chen Wang, Yanyi Liu, Pan Li, Jiawei Tang, Dapeng Li, and Yingyou Wen. Knowledge navigator: Leveraging large language models for enhanced reasoning over knowledge graph. Complex & Intelligent Systems, pp. 1-14, 2024. +Aric A. Hagberg, Daniel A. Schult, and Pieter J. Swart. Exploring network structure, dynamics, and function using networkx. In Proceedings of the 7th Python in Science Conference, pp. 11-15, 2008. +Will Hamilton, Zhitao Ying, and Jure Leskovec. Inductive representation learning on large graphs. In Advances in Neural Information Processing Systems, 2017. +Taher H. Haveliwala. Topic-sensitive pagerank. In Proceedings of the 11th International Conference on World Wide Web, pp. 517-526, 2002. +Gaole He, Yunshi Lan, Jing Jiang, Wayne Xin Zhao, and Ji-Rong Wen. Improving multi-hop knowledge base question answering by learning intermediate supervision signals. In Proceedings of the 14th ACM international conference on web search and data mining, pp. 553-561, 2021. +Xiaoxin He, Yijun Tian, Yifei Sun, Nitesh V Chawla, Thomas Laurent, Yann LeCun, Xavier Bresson, and Bryan Hooi. G-retriever: Retrieval-augmented generation for textual graph understanding and question answering. arXiv preprint arXiv:2402.07630, 2024. +Yuntong Hu, Zhihan Lei, Zheng Zhang, Bo Pan, Chen Ling, and Liang Zhao. Grag: Graph retrieval-augmented generation. arXiv preprint arXiv:2405.16506, 2024. +Jie Huang and Kevin Chen-Chuan Chang. Towards reasoning in large language models: A survey. In Findings of the Association for Computational Linguistics: ACL 2023, pp. 1049-1065, 2023. +Lei Huang, Weijiang Yu, Weitao Ma, Weihong Zhong, Zhangyin Feng, Haotian Wang, Qianglong Chen, Weihua Peng, Xiaocheng Feng, Bing Qin, and Ting Liu. A survey on hallucination in large language models: Principles, taxonomy, challenges, and open questions. arXiv preprint arXiv:2311.05232, 2023. +Piotr Indyk and Rajeev Motwani. Approximate nearest neighbors: towards removing the curse of dimensionality. In Proceedings of the Thirtieth Annual ACM Symposium on Theory of Computing, STOC '98, pp. 604-613, New York, NY, USA, 1998. Association for Computing Machinery. ISBN 0897919629. doi: 10.1145/276698.276876. URL https://doi.org/10.1145/276698.276876. +Ziwei Ji, Nayeon Lee, Rita Frieske, Tiezheng Yu, Dan Su, Yan Xu, Etsuko Ishii, Ye Jin Bang, Andrea Madotto, and Pascale Fung. Survey of hallucination in natural language generation. ACM Computing Surveys, 55(12), 2023. +Jinhao Jiang, Kun Zhou, Zican Dong, Keming Ye, Wayne Xin Zhao, and Ji-Rong Wen. Structgpt: A general framework for large language model to reason over structured data. In Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing, pp. 9237-9251, 2023a. +Jinhao Jiang, Kun Zhou, Xin Zhao, and Ji-Rong Wen. UniKGQA: Unified retrieval and reasoning for solving multi-hop question answering over knowledge graph. In International Conference on Learning Representations, 2023b. +Jinhao Jiang, Kun Zhou, Wayne Xin Zhao, Yang Song, Chen Zhu, Hengshu Zhu, and Ji-Rong Wen. Kg-agent: An efficient autonomous agent framework for complex reasoning over knowledge graph. arXiv preprint arXiv:2402.11163, 2024. +Bowen Jin, Chulin Xie, Jiawei Zhang, Kashob Kumar Roy, Yu Zhang, Suhang Wang, Yu Meng, and Jiawei Han. Graph chain-of-thought: Augmenting large language models by reasoning on graphs. arXiv preprint arXiv:2404.07103, 2024. + +Minki Kang, Jin Myung Kwak, Jincheon Baek, and Sung Ju Hwang. Knowledge graph-augmented language models for knowledge-grounded dialogue generation. arXiv preprint arXiv:2305.18846, 2023. +Vladimir Karpukhin, Barlas Oguz, Sewon Min, Patrick Lewis, Ledell Wu, Sergey Edunov, Danqi Chen, and Wen-tau Yih. Dense passage retrieval for open-domain question answering. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pp. 6769-6781, 2020. +Jungo Kasai, Keisuke Sakaguchi, yoichi takahashi, Ronan Le Bras, Akari Asai, Xinyan Velocity Yu, Dragomir Radev, Noah A. Smith, Yejin Choi, and Kentaro Inui. Realtime QA: What's the answer right now? In Thirty-seventh Conference on Neural Information Processing Systems Datasets and Benchmarks Track, 2023. +Jiho Kim, Yeonsu Kwon, Yohan Jo, and Edward Choi. Kg-gpt: A general framework for reasoning on knowledge graphs using large language models. In The 2023 Conference on Empirical Methods in Natural Language Processing. +Thomas N Kipf and Max Welling. Variational graph auto-encoders. arXiv preprint arXiv:1611.07308, 2016. +Takeshi Kojima, Shixiang Shane Gu, Machel Reid, Yutaka Matsuo, and Yusuke Iwasawa. Large language models are zero-shot reasoners. In Advances in Neural Information Processing Systems, 2022. +Satyapriya Krishna, Jiaqi Ma, Dylan Z Slack, Asma Ghandeharioun, Sameer Singh, and Himabindu Lakkaraju. Post hoc explanations of language models can improve language models. In Advances in Neural Information Processing Systems, 2023. +Woosuk Kwon, Zhuohan Li, Siyuan Zhuang, Ying Sheng, Lianmin Zheng, Cody Hao Yu, Joseph E. Gonzalez, Hao Zhang, and Ion Stoica. Efficient memory management for large language model serving with pagedattention. In Proceedings of the ACM SIGOPS 29th Symposium on Operating Systems Principles, 2023. +Benjamin Lefaudeau, Francisco Massa, Diana Liskovich, Wenhan Xiong, Vittorio Caggiano, Sean Naren, Min Xu, Jieru Hu, Marta Tintore, Susan Zhang, Patrick Labatut, Daniel Haziza, Luca Wehrstedt, Jeremy Reizenstein, and Grigory Sizov. xformers: A modular and hackable transformer modelling library. https://github.com/facebookresearch/xformers, 2022. +Pan Li, Yanbang Wang, Hongwei Wang, and Jure Leskovec. Distance encoding: Design provably more powerful neural networks for graph representation learning. Advances in Neural Information Processing Systems, 33, 2020. +Shiyang Li, Yifan Gao, Haoming Jiang, Qingyu Yin, Zheng Li, Xifeng Yan, Chao Zhang, and Bing Yin. Graph reasoning for question answering with triplet retrieval. In Findings of the Association for Computational Linguistics: ACL 2023, pp. 3366-3375, 2023a. +Xianzhi Li, Samuel Chan, Xiaodan Zhu, Yulong Pei, Zhiqiang Ma, Xiaomo Liu, and Sameena Shah. Are ChatGPT and GPT-4 general-purpose solvers for financial text analytics? a study on several typical tasks. In Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing: Industry Track, pp. 408-422, 2023b. +Zehan Li, Xin Zhang, Yanzhao Zhang, Dingkun Long, Pengjun Xie, and Meishan Zhang. Towards general text embeddings with multi-stage contrastive learning. arXiv preprint arXiv:2308.03281, 2023c. +Zijian Li, Qingyan Guo, Jiawei Shao, Lei Song, Jiang Bian, Jun Zhang, and Rui Wang. Graph neural network enhanced retrieval for question answering of llms. arXiv preprint arXiv:2406.06572, 2024. + +Ke Liang, Lingyuan Meng, Meng Liu, Yue Liu, Wenxuan Tu, Siwei Wang, Sihang Zhou, Xinwang Liu, Fuchun Sun, and Kunlun He. A survey of knowledge graph reasoning on graph types: Static, dynamic, and multi-modal. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2024. +Bill Yuchen Lin, Xinyue Chen, Jamin Chen, and Xiang Ren. *Kagnet: Knowledge-aware graph networks for commonsense reasoning*. 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. 2829-2839, 2019. +Guangyi Liu, Yongqi Zhang, Yong Li, and Quanming Yao. Explore then determine: A gnn-llm synergy framework for reasoning over knowledge graph. arXiv preprint arXiv:2406.01145, 2024a. +Nelson F. Liu, Kevin Lin, John Hewitt, Ashwin Paranjape, Michele Bevilacqua, Fabio Petroni, and Percy Liang. Lost in the middle: How language models use long contexts. Transactions of the Association for Computational Linguistics, 12:157-173, 2024b. +Haoran Luo, Haihong E, Zichen Tang, Shiyao Peng, Yikai Guo, Wentai Zhang, Chenghao Ma, Guanting Dong, Meina Song, Wei Lin, Yifan Zhu, and Anh Tuan Luu. ChatKBQA: A generate-then-retrieve framework for knowledge base question answering with fine-tuned large language models. In Findings of the Association for Computational Linguistics: ACL 2024, pp. 2039-2056, 2024a. +Linhao Luo, Yuan-Fang Li, Gholamreza Haffari, and Shirui Pan. Reasoning on graphs: Faithful and interpretable large language model reasoning. In International Conference on Learning Representations, 2024b. +Shengjie Ma, Chengjin Xu, Xuhui Jiang, Muzhi Li, Huaren Qu, and Jian Guo. Think-on-graph 2.0: Deep and interpretable large language model reasoning with knowledge graph-guided retrieval. arXiv preprint arXiv:2407.10805, 2024. +Costas Mavromatis and George Karypis. ReaRev: Adaptive reasoning for question answering over knowledge graphs. In Findings of the Association for Computational Linguistics: EMNLP 2022, pp. 2447-2458, 2022. +Costas Mavromatis and George Karypis. Gnn-rag: Graph neural retrieval for large language model reasoning. arXiv preprint arXiv:2405.20139, 2024. +Christopher Morris, Martin Ritzert, Matthias Fey, William L. Hamilton, Jan Eric Lenssen, Gaurav Rattan, and Martin Grohe. Weisfeiler and leman go neural: higher-order graph neural networks. In Proceedings of the Thirty-Third AAAI Conference on Artificial Intelligence and Thirty-First Innovative Applications of Artificial Intelligence Conference and Ninth AAAI Symposium on Educational Advances in Artificial Intelligence, 2019. +Niklas Muennighoff, Nouamane Tazi, Loic Magne, and Nils Reimers. MTEB: Massive text embedding benchmark. In Proceedings of the 17th Conference of the European Chapter of the Association for Computational Linguistics, pp. 2014-2037, 2023. +Ryan L. Murphy, Balasubramaniam Srinivasan, Vinayak Rao, and Bruno Ribeiro. Janossy pooling: Learning deep permutation-invariant functions for variable-size inputs. In International Conference on Learning Representations, 2019. +Shirui Pan, Linhao Luo, Yufei Wang, Chen Chen, Jiapu Wang, and Xindong Wu. Unifying large language models and knowledge graphs: A roadmap. IEEE Transactions on Knowledge and Data Engineering, 36(7):3580-3599, 2024. +Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, Alban Desmaison, Andreas Kopf, Edward Yang, Zachary DeVito, Martin Raison, Alykhan Tejani, Sasank Chilamkurthy, Benoit Steiner, Lu Fang, Junjie Bai, and Soumith Chintala. Pytorch: An imperative style, high-performance deep learning library. In Advances in Neural Information Processing Systems, pp. 8024-8035, 2019. + +Boci Peng, Yun Zhu, Yongchao Liu, Xiaohe Bo, Haizhou Shi, Chuntao Hong, Yan Zhang, and Siliang Tang. Graph retrieval-augmented generation: A survey. arXiv preprint arXiv:2408.08921, 2024. +Stephen Robertson and Hugo Zaragoza. The probabilistic relevance framework: Bm25 and beyond. Found. Trends Inf. Retr., 3(4):333-389, 2009. +Stephen E. Robertson, Steve Walker, Susan Jones, Micheline Hancock-Beaulieu, and Mike Gatford. Okapi at trec-3. In TREC, volume 500-225 of NIST Special Publication, pp. 109-126, 1994. +Ian Robinson, Jim Webber, and Emil Eifrem. Graph databases: new opportunities for connected data." O'Reilly Media, Inc.", 2015. +Kurt Shuster, Spencer Poff, Moya Chen, Douwe Kiela, and Jason Weston. Retrieval augmentation reduces hallucination in conversation. In Findings of the Association for Computational Linguistics: EMNLP 2021, pp. 3784-3803, 2021. +Haitian Sun, Bhuwan Dhingra, Manzil Zaheer, Kathryn Mazaitis, Ruslan Salakhutdinov, and William Cohen. Open domain question answering using early fusion of knowledge bases and text. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pp. 4231-4242, 2018. +Haitian Sun, Tania Bedrax-Weiss, and William Cohen. Pullnet: Open domain question answering with iterative retrieval on knowledge bases and text. 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. 2380-2390, 2019. +Jiashuo Sun, Chengjin Xu, Lumingyuan Tang, Saizhuo Wang, Chen Lin, Yeyun Gong, Lionel Ni, Heung-Yeung Shum, and Jian Guo. Think-on-graph: Deep and responsible reasoning of large language model on knowledge graph. In International Conference on Learning Representations, 2024a. +Lei Sun, Zhengwei Tao, Youdi Li, and Hiroshi Arakawa. Oda: Observation-driven agent for integrating llms and knowledge graphs. arXiv preprint arXiv:2404.07677, 2024b. +Alon Talmor and Jonathan Berant. The web as a knowledge-base for answering complex questions. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long Papers), pp. 641-651, 2018. +Dhaval Taunk, Lakshya Khanna, Siri Venkata Pavan Kumar Kandru, Vasudeva Varma, Charu Sharma, and Makarand Tapaswi. Grapeqa: Graph augmentation and pruning to enhance question-answering. In Companion Proceedings of the ACM Web Conference 2023, pp. 1138-1144, 2023. +Rakshit Trivedi, Hanjun Dai, Yichen Wang, and Le Song. Know-evolve: Deep temporal reasoning for dynamic knowledge graphs. In international conference on machine learning, pp. 3462-3471. PMLR, 2017. +Vivek. Understanding input/output tokens vs latency tradeoff. https://minusx.ai/blog/input-vs-output-tokens/, 2024. URL https://minusx.ai/blog-input-vs-output-tokens/. Accessed: 2024-10-27. +Tu Vu, Mohit Iyyer, Xuezhi Wang, Noah Constant, Jerry Wei, Jason Wei, Chris Tar, Yun-Hsuan Sung, Denny Zhou, Quoc Le, and Thang Luong. FreshLLMs: Refreshing large language models with search engine augmentation. In Findings of the Association for Computational Linguistics ACL 2024, pp. 13697-13720, 2024. +Keheng Wang, Feiyu Duan, Sirui Wang, Peiguang Li, Yunsen Xian, Chuantao Yin, Wenge Rong, and Zhang Xiong. Knowledge-driven cot: Exploring faithful reasoning in llms for knowledge-intensive question answering. arXiv preprint arXiv:2308.13259, 2023a. +Xintao Wang, Qianwen Yang, Yongting Qiu, Jiaqing Liang, Qianyu He, Zhouhong Gu, Yanghua Xiao, and Wei Wang. Knowledge: Enhancing large language models with retrieval and storage access on knowledge bases. arXiv preprint arXiv:2308.11761, 2023b. + +Yu Wang, Nedim Lipka, Ryan A Rossi, Alexa Siu, Ruiyi Zhang, and Tyler Derr. Knowledge graph prompting for multi-document question answering. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 38, pp. 19206-19214, 2024. +Jason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma, brian richter, Fei Xia, Ed H. Chi, Quoc V Le, and Denny Zhou. Chain of thought prompting elicits reasoning in large language models. In Advances in Neural Information Processing Systems, 2022. +Yilin Wen, Zifeng Wang, and Jimeng Sun. Mindmap: Knowledge graph prompting sparks graph of thoughts in large language models. arXiv preprint arXiv:2308.09729, 2023. +Thomas Wolf, Victor Sanh, Julien Chaumont, and Clement Delangue. Transfertransfo: A transfer learning approach for neural network based conversational agents. arXiv preprint arXiv:1901.08149, 2019. +Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumont, Clement Delangue, Anthony Moi, Pierrick Cistac, Tim Rault, Remi Louf, Morgan Funtowicz, Joe Davison, Sam Shleifer, Patrick von Platen, Clara Ma, Yacine Jernite, Julien Plu, Canwen Xu, Teven Le Scao, Sylvain Gugger, Mariama Drame, Quentin Lhoest, and Alexander Rush. Transformers: State-of-the-art natural language processing. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing: System Demonstrations, pp. 38-45, 2020. +Siye Wu, Jian Xie, Jiangjie Chen, Tinghui Zhu, Kai Zhang, and Yanghua Xiao. How easily do irrelevant inputs skew the responses of large language models? arXiv preprint arXiv:2404.03302, 2024. +Yike Wu, Nan Hu, Guilin Qi, Sheng Bi, Jie Ren, Anhuan Xie, and Wei Song. Retrieve-rewrite-answer: A kg-to-text enhanced llms framework for knowledge graph question answering. arXiv preprint arXiv:2309.11206, 2023. +Guanming Xiong, Junwei Bao, and Wen Zhao. Interactive-KBQA: Multi-turn interactions for knowledge base question answering with large language models. In Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 10561-10582, 2024. +Keyulu Xu, Weihua Hu, Jure Leskovec, and Stefanie Jegelka. How powerful are graph neural networks? In International Conference on Learning Representations, 2019. +Peng Xu, Wei Ping, Xianchao Wu, Lawrence McAfee, Chen Zhu, Zihan Liu, Sandeep Subramanian, Evelina Bakhturina, Mohammad Shoeybi, and Bryan Catanzaro. Retrieval meets long context large language models. In International Conference on Learning Representations, 2024. +Xiao Yang, Kai Sun, Hao Xin, Yushi Sun, Nikita Bhalla, Xiangsen Chen, Sajal Choudhary, Rongze Daniel Gui, Ziran Will Jiang, Ziyu Jiang, et al. Crag-comprehensive rag benchmark. arXiv preprint arXiv:2406.04744, 2024. +Shunyu Yao, Dian Yu, Jeffrey Zhao, Izhak Shafran, Thomas L. Griffiths, Yuan Cao, and Karthik R Narasimhan. Tree of thoughts: Deliberate problem solving with large language models. In Advances in Neural Information Processing Systems, 2023. +Michihiro Yasunaga, Hongyu Ren, Antoine Bosselut, Percy Liang, and Jure Leskovec. Qa-gnn: Reasoning with language models and knowledge graphs for question answering. In North American Chapter of the Association for Computational Linguistics (NAACL), 2021. +Wen-tau Yih, Matthew Richardson, Chris Meek, Ming-Wei Chang, and Jina Suh. The value of semantic parse labeling for knowledge base question answering. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 2: Short Papers), pp. 201-206, 2016. +Jing Zhang, Xiaokang Zhang, Jifan Yu, Jian Tang, Jie Tang, Cuiping Li, and Hong Chen. Subgraph retrieval enhanced model for multi-hop knowledge base question answering. In Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 5773-5784, 2022. + +Muhan Zhang, Pan Li, Yinglong Xia, Kai Wang, and Long Jin. Labeling trick: A theory of using graph neural networks for multi-node representation learning. Advances in Neural Information Processing Systems, 34:9061-9073, 2021. +Yue Zhang, Yafu Li, Leyang Cui, Deng Cai, Lemao Liu, Tingchen Fu, Xinting Huang, Enbo Zhao, Yu Zhang, Yulong Chen, Longyue Wang, Anh Tuan Luu, Wei Bi, Freda Shi, and Shuming Shi. Siren's song in the ai ocean: A survey on hallucination in large language models. arXiv preprint arXiv:2309.01219, 2023. + +![](images/a760bac324ce86b96a39fd0cf9d58aeb5f85889fdbf9af83bc8a70c0ef67e7fc.jpg) + +![](images/a3e560d00c52e640d099fb0c5a3e0bf7a118489944ce7ab55b75507c1a6823ad.jpg) + +![](images/186489f265df58cfe236f1e83b16fe5cc1339882862552845cade0d8b3a32409.jpg) + +![](images/d80776837d888c9dc320f8cd0e5eda9cdfb961c1083c64ac57f588b1161d736b.jpg) + +![](images/02adbe4c0d543dce71edf006e3dcd84188e7cf5e4b4b8650aa0f0fdc2c49bdf8.jpg) + +![](images/c67ea8a33112cc20bdacea44e997c1a4929f8d4cb85a91b16644f05c11518294.jpg) +Figure 5: A visual illustration of DDE, where the leftmost column highlights the topic entities in color. From left to right, we iteratively perform graph diffusion over the directed edges. The color intensity indicates the magnitude of the diffusion weights for individual entities. + +![](images/b0fc7e0380a4cee3d6e8d2d510e570c291f43304d5629fbe3c40d273dda2539f.jpg) + +![](images/19574ed8ab1a7c18d965d0977fc314c9ef6aa9442e4f03c4da2e92241ec922d4.jpg) + +![](images/c44e12e0536e9c7f603fca2a227190f59a46c3b0ebb39f117d48d23b8be878e4.jpg) + +![](images/0bbf546f322df12c781938e5841c3b7c5718fb176fcc34db48be3b52cc61a507.jpg) + +# A DIRECTIONAL DISTANCE ENCODING (DDE) + +Fig. 5 provides a visual illustration of DDE. By passing entity labeling information in both directions for multiple rounds, DDE efficiently approximates measures such as the average distance between an entity and all topic entities. This process implicitly reveals information like whether an entity lies at the intersection of paths of particular lengths connecting multiple topic entities. + +# B ADDITIONAL RELATED WORK + +The field of KGQA has evolved significantly over time. Early approaches to KGQA do not rely on LLMs for answer generation (Yasunaga et al., 2021; Taunk et al., 2023; Zhang et al., 2022; Lin et al., 2019; Sun et al., 2019), though they often employ pre-trained language models (PLMs) like BERT as text encoders (Devlin et al., 2019). These methods typically search for answer entities with GNNs Yasunaga et al. (2021); Taunk et al. (2023); Lin et al. (2019) or LSTM-based models Sun et al. (2019); Zhang et al. (2022). + +With the rapid advancement of LLMs in recent years, researchers began to leverage them in KGQA. For instance, recent work has explored using LLMs as translators, converting natural language questions into executable SPARQL queries for KG databases to retrieve the answers (Jiang et al., 2023a; Wang et al., 2023b; Luo et al., 2024a; Xiong et al., 2024). + +Contemporary approaches have further expanded the role of LLMs, utilizing them for both knowledge retrieval from KGs and reasoning (Kim et al.; Gao et al., 2024a; Wang et al., 2024; Guo et al., 2024; Ma et al., 2024; Sun et al., 2024a; Jiang et al., 2024; Jin et al., 2024). The strength of this strategy lies in LLMs' ability to handle multi-hop tasks by breaking them down into manageable steps. However, as discussed in Section 1, this often necessitates multiple LLM calls, resulting in high latency. To mitigate this issue, some frameworks have attempted to fine-tune LLMs to memorize knowledge, but this reduces their ability to generalize to dynamically updated or novel KGs (Luo et al., 2024b; Mavromatis & Karypis, 2024). Other models have explored fine-tuning adapters embedded in fixed LLMs to better preserve their general reasoning capabilities while adapting to specific KGs (He et al., 2024; Gao et al., 2024a; Hu et al., 2024). + +In parallel with these developments, several approaches have emerged that, like our approach, allow LLMs to reason over subgraphs (Kim et al.; Liu et al., 2024a; Li et al., 2023a; Guo et al., 2024; Wu et al., 2023; Li et al., 2024; Wen et al., 2023), though they employ different retrieval strategies. Kim et al. breaks queries into sub-queries, retrieving evidence for each sub-query before reasoning over the collected evidence. Guo et al. (2024) uses PLM-based entity extraction followed by multihop expansion for retrieval. Li et al. (2023a) linearizes KG triples into natural language for global triple retrieval using BM25 or dense passage retrievers. Wen et al. (2023) extracts topic entities and + +merges triples into the retrieved subgraph using two heuristic methods: connecting topic entities via paths and retrieving their 1-hop neighbors. + +While these subgraph retrieval strategies share similarities with SubgraphRAG, they lack several key advantages of it, such as retrieval efficiency, adjustable subgraph sizes, and flexible subgraph types. Consequently, they frequently result in suboptimal coverage of relevant information in the retrieved subgraphs. SubgraphRAG addresses these limitations, offering a more comprehensive and adaptable approach to KGQA that builds upon and extends the capabilities of existing methods, while fully leveraging the power of advanced LLMs. + +# C ADDITIONAL EXPERIMENT DETAILS FOR SUBGRAPH RETRIEVAL + +# C.1 ADDITIONAL IMPLEMENTATION AND EVALUATION DETAILS + +For Retrieve-Rewrite-Answer, RoG, G-Retriever, GNN-RAG, and SR+NSM w E2E, we utilize their official open-source implementations for training and evaluation. While a pre-trained RoG model is publicly available, it was jointly trained on the training subset of both WebQSP and CWQ, causing a label leakage issue due to sample duplication across the two datasets. To address this, we retrain the RoG model separately on the training subset of WebQSP and CWQ. Both Retrieve-Rewrite-Answer and G-Retriever were originally only evaluated on the WebQSP dataset. We managed to adapt the G-Retriever codebase for an evaluation on the CWQ dataset. While SR+NSM w E2E originally also reports the results for CWQ, we failed in running the official codebase for this dataset. + +RoG, G-Retriever, the cosine similarity baseline, GNN-RAG, and all SubgraphRAG variants perform relevant subgraph retrieval from the identical rough subgraphs. These subgraphs are centered around the topic entities and are included in the released RoG implementation. In contrast, Retrieve-Rewrite-Answer directly loads and queries the raw KG. + +GraphSAGE originally only deals with node attributes and we propose a straightforward extension of it for handling both the node attributes and edge attributes. Let $\mathbf{z}_e$ be the text embedding of an entity $e\in \mathcal{E}$ and $\mathbf{z}_r$ be the text embedding of a relation $r\in \mathcal{R}$ . A GraphSAGE layer updates entity representations with + +$$ +\mathbf {z} _ {\mathcal {N} (e)} ^ {l + 1} = \operatorname {M E A N} \left(\left\{\left[ \mathbf {z} _ {e ^ {\prime}} ^ {l} \| \mathbf {z} _ {r} \right] \mid \left(e ^ {\prime}, r, e\right) \in \mathcal {G} \right\}\right), \tag {4} +$$ + +$$ +\mathbf {z} _ {e} ^ {l + 1} = \sigma \left(\left[ \mathbf {z} _ {e} ^ {l} \| \mathbf {z} _ {\mathcal {N} (e)} ^ {l + 1}\right), \right. \tag {5} +$$ + +$$ +\mathbf {z} _ {e} ^ {0} = \mathbf {z} _ {e}, \tag {6} +$$ + +where $\sigma (\cdot)$ is an MLP. Empirically, we find that 1-layer GraphSAGE yields the best performance. + +# C.2 IMPLEMENTATION DEPENDENCIES + +Our implementation is based on the following packages: PyTorch (Paszke et al., 2019), Transformers (Wolf et al., 2020), xFormers (Lefaudeaux et al., 2022), NetworkX (Hagberg et al., 2008), and PyTorch Geometric (Fey & Lenssen, 2019). We employ the built-in implementation of PPR from NetworkX. + +# C.3 ADDITIONAL EXPERIMENT RESULTS FOR VARYING K IN TOP-K TRIPLE RETRIEVAL + +Fig. 6 presents the performance of SubgraphRAG variants on WebQSP across a spectrum of $K$ values for top- $K$ triple retrieval, which is consistent with the observations made for CWQ. + +# C.4 EVALUATION BREAKDOWN OVER TOPIC ENTITY COUNT + +See table 7. + +# D SUPPLEMENTARY KGQA RESULTS + +Truth-grounded QA Analysis. Table 8 provides a detailed analysis of truth-grounding in generated answers, showing that previous methods often produce correct answers that are unsupported by the + +![](images/3faa78f602a38260b614e9305b81fe2080703135a87a61d2d7cf84d69ea63378.jpg) +Figure 6: Retrieval effectiveness on WebQSP across various $K$ values for top- $K$ triple retrieval. + +Table 7: Breakdown of recall evaluation for CWQ over topic entity count. Best results are in bold. + +
ModelShortest Path TriplesGPT-4o-labeled TriplesAnswer Entities
Single (46.3%)Multiple (53.7%)Single (46.3%)Multiple (53.7%)Single (46.3%)Multiple (53.7%)
cosine similarity0.5860.4030.5870.4990.5170.638
RoG0.7110.5470.3240.2750.7690.903
G-R retriever0.2450.1280.2890.1560.3930.360
GNN-RAG0.4960.5030.3690.4030.8290.851
MLP0.7880.5680.7770.6000.8940.873
MLP + topic entity0.8580.6900.8190.7180.8940.889
SubgraphRAG0.8770.7540.8710.8200.9110.916
+ +retrieved results, increasing the risk of hallucination. In particular, our method is significantly less likely to generate answers that are not present in the retriever results (the NR answers in the table). For instance, on CWQ-sub, more than $10\%$ of RoG's correct answers are NR, while SubgraphRAG keeps this to just $1\%$ . SubgraphRAG can also decline to answer when there is insufficient evidence, with refusal rates increasing from $2\%$ to $19\%$ on WebQSP and from $7\%$ to $29\%$ on CWQ for questions lacking answers in the KG, compared to questions with KG-supported answers. In contrast, baseline models consistently provide answers even when supporting evidence is absent. Together, these qualities make SubgraphRAG a more trustworthy and truth-grounded KGQA framework. + +To obtain a single metric to assess the degree of truth-grounded QA performance, we follow (Yang et al., 2024) to develop a scoring strategy to aggregate the results of these tables. Specifically, for samples with answer entities present in the KG, correct answers receive a score of $+1$ , incorrect answers $-1$ , and missing answers $0$ . For samples without answer entities in the KG, missing answers, answers with entities found in the retrieved results, and answers with entities not found in the retrieved results are scored $+1$ , $-1$ , and $-1.5$ , respectively. Denote $s_i$ as the score yielded for sample $i$ and $a_i$ the number of answers outputted by the LLM reasoner for this sample. For a dataset with $n$ samples: $\mathrm{Score}_h = \mathrm{Normalize}\left(\frac{1}{n}\sum_{i=0}^{n}\frac{s_i}{a_i}\right)$ , where we use min-max normalization with $\min = 0$ and $\max = 100$ . This metric penalizes hallucinated answers while favoring missing answers over incorrect ones. + +Impact of Retrieval Size. Fig. 4 shows how our SubgraphRAG would perform with different numbers of retrieved triples. To further demonstrate the superior performance of our proposed retriever module, we also scale RoG's retriever with more retrieved triples by increasing its beam search sizes (noting that this substantially increases computational costs). As shown in Fig. 7, clearly, even when using RoG's retriever with more triples in SubgraphRAG, our proposed retriever consistently achieves significantly better results, further demonstrating the effectiveness of our retriever module. + +# E PROMPTTEMPLATES + +Fig. 8 is the detailed prompt template used in our experiments for all samples, and Fig. 9 provides the prompt employed to label relevant triples via GPT-4o. + +![](images/70a9523966eb5b0cb35f47f3e46187cf8b27d5b46a39b431265d7b87cd328363.jpg) +(a) WebQSP-sub + +![](images/70b15709c7af63f38d5b65fefa49a549e5354715d2abbfce55f4e907abfa5c4a.jpg) +Figure 7: Ablation studies on the number of retrieved triples and the used retrievers in SubgraphRAG. The triples from RoG's retriever are generated using beam search with sizes \{3, 6, 9, 12\}, and all the experiments use SubgraphRAG's un-fine-tuned LLM reasoners. + +![](images/ce3f680949c224d5ad0a53fdda4081c59791a7ed44ad041a6d3bd556247e9b07.jpg) +(b) CWQ-sub + +![](images/64c79168b7ee1c2dfe47f18b3a1c1347fa11497cd6f8090c5ce34b4d149c470d.jpg) +Figure 8: Detailed prompt for LLM question-answering used in our experiments for all samples. + +Table 8: Detailed performance of truth-grounded QA. No Ans Samples refers to cases where LLM reasoners refuse to answer; NR (Not Retrieved) indicates answers not present in the retrieved triples, while R (Retrieved) indicates answers found within the retrieved triples. + +
DatasetMethodSamples w/ Ans Entities in KGSamples w/o Ans Entities in KG
No Ans Samples Total SamplesWrong Ans Total AnsCorrect Ans (NR) Correct AnsWrong Ans (NR) Wrong AnsNo Ans Samples Total SamplesWrong Ans (NR) Total AnsWrong Ans (R) Total Ans
WebQSPRoG-Joint0/1559 = 0%4605/10206 = 45%170/5601 = 3%1178/4605 = 26%0/69 = 0%24/126 = 19%70/126 = 56%
RoG-Sep0/1559 = 0%6867/12401 = 55%327/5534 = 6%2494/6867 = 36%0/69 = 0%71/162 = 44%43/162 = 27%
SubgraphRAG (Llama3.1-8B)29/1559 = 2%1397/5850 = 24%59/4453 = 1%84/1397 = 6%13/69 = 19%16/107 = 15%71/107 = 66%
SubgraphRAG (GPT4o-mini)12/1559 = 1%1802/8011 = 22%37/6209 = 1%126/1802 = 7%7/69 = 10%17/83 = 20%31/83 = 37%
CWQRoG-Joint0/2848 = 0%3651/6709 = 54%305/3058 = 10%1293/3651 = 35%0/683 = 0%1835/2729 = 67%363/2729 = 13%
RoG-Sep0/2848 = 0%3183/6129 = 52%341/2946 = 12%1295/3183 = 41%0/683 = 0%1840/2620 = 70%268/2620 = 10%
SubgraphRAG (Llama3.1-8B)210/2848 = 7%2417/5028 = 48%21/2611 = 1%98/2417 = 4%199/683 = 29%114/1052 = 11%819/1052 = 78%
SubgraphRAG (GPT4o-mini)203/2848 = 7%2194/5205 = 42%30/3011 = 1%159/2194 = 7%137/683 = 20%170/953 = 18%564/953 = 59%
+ +# Input Prompts for KGQA + +# System: + +Based on the triples retrieved from a knowledge graph, please answer the question. Please return formatted answers as a list, each prefixed with "ans". + +# User: //ICLexample + +Triplets: + +(Lou Seal,sports.mascot.team,San Francisco Giants) + +(San Francisco Giants,sports.sports_team.championships,2012 World Series) + +(San Francisco Giants,sports.sports_championship_event.champion,2014 World Series) + +(San Francisco Giants, time. participant.event, 2014 Major League Baseball season) + +(San Francisco Giants, timeparticipant.event, 2010 World Series) + +(San Francisco Giants, time. participant.event, 2010 Major League Baseball season) + +(San Francisco Giants,sports.sports_team.championships,2014 World Series) + +(San Francisco Giants,sports.sports_team team_mascot,Crazy Crab) + +(San Francisco Giants,sports.sports_team.championships,2010 World Series) + +(San Francisco Giants,sports.professional_sports-team owner_s,Bill Neukom) + +(San Francisco Giants, timeparticipant.event, 2012 World Series) + +(San Francisco,sports.sports_team_location.teams,San Francisco Giants) + +(San Francisco Giants,sports.sports_team.arena_stadium,AT&T Park) + +(AT&T Park, location/location.events, 2012 World Series) + +# Question: + +What year did the team with mascot named Lou Seal win the World Series? + +# Assistant: // ICL example + +To find the year the team with mascot named Lou Seal won the World Series, we need to find the team with mascot named Lou + +Seal and then find the year they won the World Series. + +From the triplets, we can see that Lou Seal is the mascot of the San Francisco Giants. + +Now, we need to find the year the San Francisco Giants won the World Series. + +From the triplets, we can see that San Francisco Giants won the 2010 World Series and 2012 World Series and 2014 World Series. + +So, the team with mascot named Lou Seal (San Francisco Giants) won the World Series in 2010, 2012, and 2014. + +Therefore, the formatted answers are: + +ans: 2014 (2014 World Series) + +ans: 2012 (2012 World Series) + +ans: 2010 (2010 World Series) + +# User: // Sample to infer + +Triplets: + +$(\mathsf{e}_a,\mathsf{r}_{ab},\mathsf{e}_b)$ //Retrieved triples + +$(\mathfrak{e}_c,\mathfrak{r}_{cd},\mathfrak{e}_d)$ + +Question: + +what's...? //Q in datasets + +Table 9: Ablation studies with different retrievers, using the same prompt and GPT4o-mini as the reasoner. Rand refers to random triple sampling, RandNoAns removes triples with ground-truth answers after random sampling, and NoRetriever directly asks questions without KG info. + +
WebQSPCWQWebQSP-subCWQ-sub
Macro-F1HitMacro-F1HitMacro-F1Micro-F1HitHit@1ScorehMacro-F1Micro-F1HitHit@1Scoreh
Rand + SubgraphRAG Reasoner47.7068.3733.1339.8247.1523.7468.5764.5969.6735.5534.2642.9440.4854.81
RandNoAns + SubgraphRAG Reasoner36.8349.6325.6930.7035.7714.6248.9444.9657.1226.2526.1131.6029.2148.80
NoRetriever + SubgraphRAG Reasoner47.4971.0133.4342.2546.6825.5370.9462.6760.2235.6631.1144.6639.9944.24
cosine similarity + SubgraphRAG Reasoner64.9478.1941.2349.2265.2643.8478.9074.1573.0345.0742.2753.8349.3757.06
Retrieve-Rewrite-Answer + SubgraphRAG Reasoner38.2653.62--37.5419.6253.3750.1067.68-----
StructGPT + SubgraphRAG Reasoner71.6282.68--71.6659.0582.8780.4481.48-----
G-Retriever + SubgraphRAG Reasoner59.2875.2536.7942.2359.5535.1976.0172.8776.3139.5539.4245.4743.2957.67
RoG-Sep + SubgraphRAG Reasoner70.0882.2544.3051.1570.9154.6983.4578.5181.0049.8550.4057.5152.3564.27
GNN-RAG + SubgraphRAG Reasoner73.2785.9352.9159.6474.2453.9287.2483.3984.4160.8959.8668.4364.0467.71
GNN-RAG (↔) + SubgraphRAG Reasoner61.1978.9943.4251.3761.4142.0279.7974.9876.1148.0443.756.8852.3259.45
SubgraphRAG77.4590.1154.1362.0278.3458.4491.3487.3682.2161.1358.8670.0165.4864.20
SubgraphRAG (↔)73.8188.0844.6954.2174.4249.4189.1084.6781.3549.4745.1660.1854.1858.86
+ +# Input Prompts for Labeling Relevant Triples via GPT-4o + +# System: + +Based on the triplets retrieved from a knowledge graph, please select relevant triplets for answering the question. Please return formatted triplets as a list, each prefixed with "evidence:" + +User: // Sample to infer + +Triplets: + +$(\mathsf{e}_a,\mathsf{r}_{ab},\mathsf{e}_b)$ // Retrieved triples + +$(e_c,r_{cd},e_d)$ + +··· + +Question: + +what's...? //Qin datasets + +Figure 9: Detailed prompt for labeling triples via GPT-4o. + +# F EXPLAINABILITY EXAMPLES + +To demonstrate the superior explainability of our approach, we provide multiple example responses from our LLM reasoners below, which cover questions requiring different reasoning hops and logic chains. We have also included examples of our LLM reasoners refusing to answer due to insufficient information in Appendix F.2, which helps to provide more truth-grounded answers. Due to limited space, we do not include retrieved triples for all the examples, but one will be able to find full prediction files in our released repository. + +# F.1 LLM RESPONSES WITH EXPLAINABLE REASONING + +# CWQ-WebQTest-100_bf66fd89b6e9fc5fea96c8b3f7a0e616 + +# Question: + +The people from the country that contains Nord-Ouest Department speak what languages today? + +# Retrieved Triples: + +(Haiti, location, country, languages spoken, Haitian Creole) + +(Haiti,location.country.first_level_divisions,Nord-Ouest Department) + +(Haiti, location, country. official language, French) + +(French, language.human_language.countries_spoken_in,Haiti) + +(Nord-Ouest Department, locationadministrative_division.first_level_division_of,Haiti) + +(Haiti, location, country, languages spoken, French) + +(Haiti,location.cOUNTRY-administrative_divisions,Nord-Ouest Department) + +(Haiti, location, country, official language, Haitian Creole) + +(Nord-Ouest Department, location.location.containedby,Haiti) + +(Haitian Creole,language.human_language.main_country,Haiti) + +# LLM Response: + +To find the languages spoken in the country that contains Nord-Ouest Department, we need to find the country that contains Nord-Ouest Department. + +From the triplets, we can see that Nord-Ouest Department is contained by Haiti. + +So, the country that contains Nord-Ouest Department is Haiti. + +From the triplets, we can see that Haiti speaks Haitian Creole and French. + +Therefore, the people from the country that contains Nord-Ouest Department (Haiti) speak Haitian Creole and French today. + +The formatted answer is: + +ans: Haitian Creole + +ans: French + +# Ground-truth: + +Haitian Creole + +French + +# CWQ-WebQTest-1320_c5498ca807d2e1ec30d4c8fdd41f0bf7 + +# Question: + +What stadium does the team with mascot named Hank play at? + +# Retrieved Triples: + +(Milwaukee Brewers,sports.sports_team team_mascot,Hank) + +(Hank,sports.mascot team, Milwaukee Brewers) + +(Milwaukee Brewers,sports.sports_team previouslyknown_as,Seattle Pilots) + +(Seattle Pilots,sports.defunct_sports_team.laterknown_as,Milwaukee Brewers) + +(Milwaukee Brewers,sports.sports_team.arena_stadium,Miller Park) + +(Milwaukee Brewers,sports.sports_team.location,Milwaukee) + +(Miller Park,sports.sports_facility.teams,Milwaukee Brewers) + +(Milwaukee,sports.sports_team_locationteams,Milwaukee Brewers) + +(Miller Park, location. location.containedby,Milwaukee) + +(Milwaukee Brewers,baseball.baseball_team.current_coaches,m.0527c88) + +中 + +# LLM Response: + +To find the stadium where the team with mascot named Hank plays, we need to find the team with mascot named Hank and then find the stadium they play at. + +From the triplets, we can see that Hank is the mascot of the Milwaukee Brewers. + +Now, we need to find the stadium where the Milwaukee Brewers play. + +From the triplets, we can see that the Milwaukee Brewers play at Miller Park. + +Therefore, the formatted answer is: + +ans: Miller Park + +# Ground-truth: + +Miller Park + +# CWQ-WebQTrn-2152_92fba37c9723caee68665ad9a5e4a468 + +# Question: + +Which of team owners Tom Hicks sports team are in the American League West? + +# Retrieved Triples: + +(Texas Rangers,sports.professional_sports-team owner_s,Tom Hicks) + +(Tom Hicks,sports.sports_team Owner.teams-owned,Texas Rangers) + +(Dallas Stars,sports.professional_sports-team owner_s,Tom Hicks) + +(Seattle Pilots,sports.defunct_sports_team.laterknown_as,Milwaukee Brewers) + +(Tom Hicks,sports.sports_team Owner.teams_owned,Dallas Stars) + +(United States of America,baseLocations.countries.state-provinces.within,Alabama) + +(Houston Astros,sports.professional_sports-team owner_s,Drayton McLane, Jr.) + +(m.0crtd2r,sports.sports_league_participation.team,Los Angeles Angels of Anaheim) + +(United States of America,base.aareas schemaadministrative_areaadministrative_child,Alabama) + +(m.0crtd31,sports.sports_league_participation.team,Anaheim Angels) + +(United States of America,base.aareas schemaadministrative_areaadministrativechildren,Washington,D.C.) + +(United States of America,baseLocations.countries.state_provinces_within,Mississippi) + +(m.0crtd3v,sports.sports_league_participation.team,California Angels) + +(United States of America,base.aareas.schemasadministrative_areaadministrativechildren,Mississippi) + +(American League West,baseball.baseball_division.teams,Texas Rangers) + +… + +# LLM Response: + +To find the teams owned by Tom Hicks that are in the American League West, we need to find the teams owned by Tom Hicks and then find the teams in the American League West. + +From the triplets, we can see that Tom Hicks owns the Texas Rangers and Dallas Stars. + +Now, we need to find the teams in the American League West. + +From the triplets, we can see that the teams in the American League West are Texas Rangers, Los Angeles Angels of Anaheim, + +Seattle Marines, Oakland Athletics, and Seattle Pilots. + +So, among the teams owned by Tom Hicks (Texas Rangers and Dallas Stars), only Texas Rangers is in the American League West. + +Therefore, the formatted answer is: + +ans: Texas Rangers + +# Ground-truth: + +Texas Rangers + +# CWQ-WebQTrn-557_960c16ffdb29e173df0577fc76c7455d + +# Question: + +In the film with the character named Winged Monkey #7, who played Dorothy? + +# LLM Response: + +To find the actor who played Dorothy in the film with the character named Winged Monkey #7, we need to find the film that Winged Monkey #7 is in and then find the actor who played Dorothy in that film. + +From the triplets, we can see that Winged Monkey #7 is in the film "The Wizard of Oz" (m.0yj6tr7). + +Now, we need to find the actor who played Dorothy in "The Wizard of Oz". + +From the triplets, we can see that Judy Garland (m.0k6y72) played Dorothy in "The Wizard of Oz". + +Therefore, the formatted answer is: + +ans: Judy Garland + +# Ground-truth: + +Judy Garland + +# CWQ-WebQTm-2904_cb8d941f825c5dd7b2d6f3faef7f9229 + +# Question: + +What city is home for Lauren Conrad and had a mayor named Willie Brown? + +# LLM Response: + +To find the city that is home for Lauren Conrad and had a mayor named Willie Brown, we need to find the city where Lauren Conrad lives and the city where Willie Brown was the mayor. + +From the triplets, we can see that Lauren Conrad lived in Los Angeles (m.043jjv4) and San Francisco (m.04hy_14). + +From the triplets, we can see that Willie Brown was the mayor of San Francisco. + +Therefore, the city that is home for Lauren Conrad and had a mayor named Willie Brown is San Francisco. + +So, the formatted answer is: + +ans: San Francisco + +# Ground-truth: + +San Francisco + +# CWQ-WebQTrn-124_405a78f132e69f4771aff40d07cd0294 + +# Question: + +Which movie did Angelina Jolie direct, that was produced by Erwin Stoff? + +# LLM Response: + +To find the movie that Angelina Jolie directed, which was produced by Erwin Stoff, we need to find the movies that Angelina Jolie directed and the movies that Erwin Stoff produced. + +From the triplets, we can see that Angelina Jolie directed the following movies: + +- In the Land of Blood and Honey + +- Unbroken + +- By the Sea + +From the triplets, we can see that Erwin Stoff produced the following movies: + +- Unbroken + +- The Day the Earth Stood Still + +- Edge of Tomorrow + +- Water for Elephants + +- Austin Powers: The Spy Who Shagged Me + +- The Blind Side + +- The Replacements + +- I Am Legend + +-Ha + +- The Lake House + +- Street Kings + +-47 Ronin + +Now, we need to find the common movie between Angelina Jolie's directed movies and Erwin Stoff's produced movies. + +The common movie is Unbroken. + +Therefore, the formatted answer is: + +ans: Unbroken + +# Ground-truth: + +Unbroken + +# WebQSP-WebQTest-33 + +# Question: + +whattimezone isSweden + +# Retrieved Triples: + +(Sweden,location.location.time Zones,Central European Time Zone) +(Sweden,location countrylanguagespoken,Finnish Language) +(Finnish Language,language.human-language.countries_spoken_in,Sweden) +(Sweden,location countryLanguagespoken,Turoyo Language) +(Sweden,location countryofficial language,Swedish Language) +(Spain,location.location.time_zones,Central European Time Zone) +(Stockholm,location.location.time_zones,Central European Time Zone) +(Unitary state,government.form_of_government.countries,Sweden) +(Swedish Language,language.human-language.countries_spoken_in,Finland) +(Sweden,location.locationLanguagespoken,Swedish Language) +... + +# LLM Response: + +To find the timezone of Sweden, we can look for the triplets that contain Sweden and have a property related to timezones. From the triplets, we can see that Sweden is located in the Central European Time Zone. Therefore, the answer is: ans: Central European Time Zone + +# Ground-truth: + +Central European Time Zone + +# WebQSP-WebQTest-188 + +# Question: + +where did bristol palin go to school + +# Retrieved Triples: + +(m.0by14zl,education.education.institution,Wasilla High School) +(Wasilla High School,education.educational_institution.students_graduates,m.0by14zl) +(Juneau-Douglas High School,education.educational_institution.students_graduates,m.0cpkbwp) +(m.0cpkbwp,education.education.institution,Juneau-Douglas High School) +(Bristol Palin,people.person.education,m.0by14zl) +(Bristol Palin,people.person.education,m.0cpk4bl) +(Bristol Palin,people.person.education,m.0cpkbwp) +(m.0cpk4bl,education.education.institution,West Anchorage High School) +(West Anchorage High School,education.educational_institution.students_graduates,m.0cpk4bl) +(m.0by14zl,education.education/student,Bristol Palin) +(m.0cpk4bl,education.education/student,Bristol Palin) +(m.0cpkbwp,education.education/student,Bristol Palin) +(m.04tlm1z,education.education.institution,Wasilla High School) +(m.0n1g77g,education.education.institution,Wasilla High School) +(Wasilla High School,education.educational_institution.students_graduates,m.04tlm1z) +(Wasilla High School,education.educational_institution.students_graduates,m.0n1g77g) +(Bristol Palin,people.person.place_of_birth,Wasilla) +(Wasillalocation.location.people.born.here,Bristol Palin) +(Bristol Palin,people.person.nationality,United States of America) +(Levi Johnston,people.person.place_of_birth,Wasilla) + +# LLM Response: + +To find where Bristol Palin went to school, we need to find the educational institutions that Bristol Palin attended. From the triplets, we can see that Bristol Palin attended the following educational institutions: +- Wasilla High School (m.0byl4zl) +- Juneau-Douglas High School (m.0cpkbwp) +- West Anchorage High School (m.0cpk4bl) +Therefore, the formatted answers are: +ans: Wasilla High School +ans: Juneau-Douglas High School +ans: West Anchorage High School + +# Ground-truth: + +West Anchorage High School +Wasilla High School +Juneau-Douglas High School + +# WebQSP-WebQTest-760 + +# Question: + +what party does barack obama belong to + +# Retrieved Triples: + +(Barack Obama, influence.influence_node.influenced_by, Saul Alinsky) +(Barack Obama, organization.organization-founderorganizations_founded,National Commission on Fiscal Responsibility and Reform) +(Barack Obama presidential campaign, 2012,government.election_campaign party,Democratic Party) +(Barack Obama,government.politician.election_campaigns, Barack Obama 1996 Illinois Senate Campaign) +(Barack Obama,government.politician party,m.03gjhww) +(Barack Obama,government.politician.election_campaigns, Barack Obama 1996 Illinois Senate Campaign) +(Barack Obama 2004 US Senate Campaign,government.election_campaignParty,Democratic Party) +(Barack Obama,influence.influence_node.influenced_by, Reinhold Niebuhr) +(m.03gjhww,government.political PARTY_tenure party,Democratic Party) +(Barack Obama,organization organization-founderorganizationsFounded, White House Task Force to Protect Students from Sexual Assault) +(Barack Obama presidential primary campaign, 2008,government.election_campaignparty,Democratic Party) +(Barack Obama 1996 Illinois Senate Campaign,government.election_campaignparty,Democratic Party) +(Barack Obama,base.politicalconventions,presidential_nominee.nominated_at,2008 Democratic National Convention) +(Barack Obama,government.politician,governmentPositions_held.m.03h96h6) +(Barack Obama,government.politician.election_campaigns, Barack Obama 2004 US Senate Campaign) + +# LLM Response: + +From the triplets, we can see that Barack Obama is associated with the Democratic Party in several instances: 1. (Barack Obama, government politician, party, m.03gjhww) 2. (Barack Obama 2004 US Senate Campaign, government election campaign, party, Democratic Party) 3. (Barack Obama 1996 Illinois Senate Campaign, government election campaign, party, Democratic Party) 4. (Barack Obama presidential primary campaign, 2008, government election campaign, party, Democratic Party) 5. (Democratic Party presidential primaries, 2008, government primary election party, Democratic Party) 6. (m.03gjhww,governmentpoliticalParty_tenure,party,Democratic Party) Therefore, the formatted answer is: ans: Democratic Party + +# Ground-truth: + +Democratic Party + +# WebQSP-WebQTest-62 + +# Question: + +what was Jesse james killed with + +# LLM Response: + +To find what Jesse James was killed with, we need to find the cause of his death. +From the triplets, we can see that Jesse James was killed by Assassination. +Now, we need to find the cause of Assassination. +From the triplets, we can see that Assassination includes causes of death such as Assassination in ways which appear natural, Assassination by 'Accident', Assassination by firearm, and Assassination by 'Suicide'. +However, we are looking for what Jesse James was killed with, not how he was killed. +From the triplets, we can see that Firearm is a cause of death that includes causes of death such as Assassination by firearm. +Therefore, Jesse James was killed with a Firearm. +So, the answer is: +ans: Firearm + +# Ground-truth: + +Firearm + +# F.2 LLM REFUSAL TO ANSWER DUE TO INSUFFICIENT INFORMATION + +# WebQSP-WebQTest-386 + +# Question: + +how deep is lake merritt oakland + +# LLM Response: + +To find the depth of Lake Merritt in Oakland, we need to look for any information related to the depth of Lake Merritt. + +From the triplets, we can see that Lake Merritt is a lake, but there is no direct information about its depth. + +However, we can see that Lake Merritt is a National Historic Landmark (m.06.44f4, + +protectedSites.natural_or_cultural_site Listingdesignation_as_national_or_cultural_site, m.06_44f4) and a National Historic + +Landmark (m.06_44f4, protectedSites.natural_or_cultural_site.listing_category_orcriteria,National Historic Landmark). + +We can also see that Lake Merritt is a lake (Lake Merritt, common.topnic.notable_types, Lake) and it is located in Oakland (Lake + +Merritt, location.location.containedby, Oakland). + +But there is no information about the depth of Lake Merritt. + +However, we can see that there is a mention of a location with geolocation m.0cs7t50 (Lake Merritt, location.location.geolocation, + +m.0cs7t50), but this does not provide any information about the depth of the lake. + +Therefore, based on the given triplets, we cannot find any information about the depth of Lake Merritt. + +ans: not available + +# Ground-truth: + +3.048 + +# WebQSP-WebQTest-612 + +# Question: + +who does jeremy shockey play for in 2012 + +# LLM Response: + +To find out who Jeremy Shockey played for in 2012, we need to find the team he played for and the year he played for that team. + +From the triplets, we can see that Jeremy Shockey played for the New Orleans Saints, Carolina Panthers, Miami Hurricanes + +football, and New York Giants. + +However, we need to find the year he played for each of these teams. + +From the triplets, we can see that Jeremy Shockey played for the New Orleans Saints in 2007, + +for the Carolina Panthers in 2007, + +for the Miami Hurricanes football in 2001, + +and for the New York Giants in 2002. + +However, there is no information about Jeremy Shockey playing for any of these teams in 2012. + +Therefore, we cannot determine which team Jeremy Shockey played for in 2012 based on the given triplets. + +ans: not available + +# Ground-truth: + +Carolina Panthers + +# CWQ-WebQTest-397_0b3a8b0643fac530a078012a025201fa + +# Question: + +Harvard Board of Overseers is part of the school with what colors? + +# LLM Response: + +To find the school with the colors that Harvard Board of Overseers is part of, we need to find the parent organization of Harvard + +Board of Overseers. + +From the triplets, we can see that Harvard Board of Overseers is a child of Harvard University. + +Now, we need to find the colors of Harvard University. + +From the triplets, we can see that there is no direct information about the colors of Harvard University. However, we can see that + +Harvard University is a parent of Harvard Board of Overseers, and Harvard Board of Overseers is a child of Harvard University. + +But we can also see that Harvard University is a parent of itself (Harvard + +University, education, educational institution campuses, Harvard University), which means it's an educational institution. + +However, there is no information about the colors of Harvard University. + +# Ground-truth: + +Crimson + +# CWQ-WebQTest-1528_2f6fb6d585b98261a3ae6d2a112a4c91 + +# Question: + +What movie starring Logan Lerman that was edited by Thomas J Nordberg? + +# LLM Response: + +To find the movie starring Logan Lerman that was edited by Thomas J Nordberg, we need to find the movies edited by Thomas J Nordberg and then find the ones starring Logan Lerman. + +From the triplets, we can see that the following movies were edited by Thomas J Nordberg: + +- Scary Movie 2 + +- The Host + +- I Love You Phillip Morris + +- U Turn + +- Any Given Sunday + +- The Guardian + +- Alexander + +Now, we need to find the movies among these that star Logan Lerman. + +From the triplets, we can see that Logan Lerman starred in the following movies: + +- What Women Want + +- The Perks of Being a Wallflower + +-Fury + +- Percy Jackson: Sea of Monsters + +- Noah + +- Riding in Cars with Boys + +- 3:10 to Yuma + +However, none of these movies are among the ones edited by Thomas J Nordberg. + +But, we can see that Fury is not edited by Thomas J Nordberg but Fury is related to another film edited by Thomas J Nordberg. The film Fury is related to Fury (2014) which is a film edited by Thomas J Nordberg. + +Ground-truth: + +What Women Want + +# CWQ-WebQTest-12_c701ad2b5b8ef3f3ed26dd2ed8703d05 + +# Question: + +Who held his governmental position from December 12, 1808 and was Governor of Ohio in 2011? + +# LLM Response: + +To find the answer, we need to find a person who held a governmental position from December 12, 1808 and was Governor of Ohio in 2011. + +From the triplets, we can see that there is no direct information about a person holding a governmental position from December 12, 1808. However, we can find a person who was Governor of Ohio in 2011. + +From the triplets, we can see that Mike DeWine was the Governor of Ohio. + +However, there is no information about Mike DeWine holding a governmental position from December 12, 1808. + +We can also see that there is no information about any other person holding a governmental position from December 12, 1808. + +Therefore, we cannot find a person who held a governmental position from December 12, 1808 and was Governor of Ohio in 2011. +ans: not available + +# Ground-truth: + +Return J. Meigs, Jr. \ No newline at end of file diff --git a/ICLR/2025/Simple is Effective_ The Roles of Graphs and Large Language Models in Knowledge-Graph-Based Retrieval-Augmented Generation/images.zip b/ICLR/2025/Simple is Effective_ The Roles of Graphs and Large Language Models in Knowledge-Graph-Based Retrieval-Augmented Generation/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..ae3d50d62e0d9ed3a4e4b329360adf7d9e456625 --- /dev/null +++ b/ICLR/2025/Simple is Effective_ The Roles of Graphs and Large Language Models in Knowledge-Graph-Based Retrieval-Augmented Generation/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ae303b6c908d759d2fe8dac926511e39c2a47a20742e727faf7ee16ae08f08cb +size 882268 diff --git a/ICLR/2025/Simple is Effective_ The Roles of Graphs and Large Language Models in Knowledge-Graph-Based Retrieval-Augmented Generation/layout.json b/ICLR/2025/Simple is Effective_ The Roles of Graphs and Large Language Models in Knowledge-Graph-Based Retrieval-Augmented Generation/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..d34d8c29849127f7eb46341279a044cbcec92dc2 --- /dev/null +++ b/ICLR/2025/Simple is Effective_ The Roles of Graphs and Large Language Models in Knowledge-Graph-Based Retrieval-Augmented Generation/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2c4c512bdd313627ec15526b3bfb762bf8f3283bcea2588ad618ac3b2fe331a4 +size 1011580 diff --git a/ICLR/2025/Simple, Good, Fast_ Self-Supervised World Models Free of Baggage/999202a9-828d-433b-bbec-83ecf3b78e52_content_list.json b/ICLR/2025/Simple, Good, Fast_ Self-Supervised World Models Free of Baggage/999202a9-828d-433b-bbec-83ecf3b78e52_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..0b12117246f9dc051572c0a9192d2dab6dd93b6d --- /dev/null +++ b/ICLR/2025/Simple, Good, Fast_ Self-Supervised World Models Free of Baggage/999202a9-828d-433b-bbec-83ecf3b78e52_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:50b0b2bb9523e4f252e02b3c954ff5019e05bb6790a6b28269ecc100ee070675 +size 116963 diff --git a/ICLR/2025/Simple, Good, Fast_ Self-Supervised World Models Free of Baggage/999202a9-828d-433b-bbec-83ecf3b78e52_model.json b/ICLR/2025/Simple, Good, Fast_ Self-Supervised World Models Free of Baggage/999202a9-828d-433b-bbec-83ecf3b78e52_model.json new file mode 100644 index 0000000000000000000000000000000000000000..42f2bb2d42568c43c6c53f7db805aa273e89ae9b --- /dev/null +++ b/ICLR/2025/Simple, Good, Fast_ Self-Supervised World Models Free of Baggage/999202a9-828d-433b-bbec-83ecf3b78e52_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d23b8b7e78e35d204efd3056661d02709469fc1f4c1318d45e2780c91e55b747 +size 146634 diff --git a/ICLR/2025/Simple, Good, Fast_ Self-Supervised World Models Free of Baggage/999202a9-828d-433b-bbec-83ecf3b78e52_origin.pdf b/ICLR/2025/Simple, Good, Fast_ Self-Supervised World Models Free of Baggage/999202a9-828d-433b-bbec-83ecf3b78e52_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..7d32ed72f02ca0feb5f0c6f7e62e3f0a05b64a43 --- /dev/null +++ b/ICLR/2025/Simple, Good, Fast_ Self-Supervised World Models Free of Baggage/999202a9-828d-433b-bbec-83ecf3b78e52_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f38168fe7478aa9a01d2d38944e82c0b3fa445b67634b5c05b34a12d9e218d0d +size 594845 diff --git a/ICLR/2025/Simple, Good, Fast_ Self-Supervised World Models Free of Baggage/full.md b/ICLR/2025/Simple, Good, Fast_ Self-Supervised World Models Free of Baggage/full.md new file mode 100644 index 0000000000000000000000000000000000000000..d16a26ba1d40f77c276165c651f001cc1582b204 --- /dev/null +++ b/ICLR/2025/Simple, Good, Fast_ Self-Supervised World Models Free of Baggage/full.md @@ -0,0 +1,382 @@ +# SIMPLE, GOOD, FAST: SELF-SUPERVISED WORLD MODELS FREE OF BAGGAGE + +Jan Robine, $^{1,2}$ Marc Höftmann $^{1,2}$ & Stefan Harmeling $^{1,2}$ + +$^{1}$ TU Dortmund, $^{2}$ Lamarr Institute for Machine Learning and Artificial Intelligence {jan.robine,marc.hoeftmann, stefan.harmeling}@tu-dortmund.de + +# ABSTRACT + +What are the essential components of world models? How far do we get with world models that are not employing RNNs, transformers, discrete representations, and image reconstructions? This paper introduces SGF, a Simple, Good, and Fast world model that uses self-supervised representation learning, captures short-time dependencies through frame and action stacking, and enhances robustness against model errors through data augmentation. We extensively discuss SGF's connections to established world models, evaluate the building blocks in ablation studies, and demonstrate good performance through quantitative comparisons on the Atari 100k benchmark. The code is available at https://github.com/jrobine/sgf. + +# 1 INTRODUCTION + +Deep reinforcement learning has demonstrated remarkable success in solving challenging decision-making problems (Mnih et al., 2015; Schulman et al., 2017; Mnih et al., 2016; Hessel et al., 2018; Badia et al., 2020; Schrittwieser et al., 2020; Kapturowski et al., 2023; Hafner et al., 2023). Despite these achievements, the primary challenge remains sample efficiency, i.e., the amount of data required to learn effective behaviors. Recent works have addressed this challenge by improving architectures and hyperparameters (van Hasselt et al., 2019; Schwarzer et al., 2023), pretraining and fine-tuning (Schwarzer et al., 2021b), applying data augmentation (Yarats et al., 2021; Laskin et al., 2020a), incorporating ideas from self-supervised representation learning (Laskin et al., 2020b; Schwarzer et al., 2021a;b; 2023), or learning a model of the environment (Kaiser et al., 2020; Ye et al., 2021; Robine et al., 2023; Micheli et al., 2023; Hafner et al., 2020; 2021; 2023). + +Several approaches have been proposed in the literature to leverage a model of the environment. Improving the representations for the model-free agent can be achieved by learning a (latent) transition model (Lee et al., 2020; Schwarzer et al., 2021a), a reward model, or both (Gelada et al., 2019; Zhang et al., 2021), where the model serves as an auxiliary task. Aside from that, a world model, i.e., a deep generative model of the environment, can be learned. World models find applications in learning in imagination, where a model-free algorithm is applied to sequences generated by the world model (Sutton, 1991; Ha & Schmidhuber, 2018; Kaiser et al., 2020; Hafner et al., 2020; 2021; 2023; Micheli et al., 2023; Robine et al., 2023), and in decision-time planning, where the model is used for lookahead + +![](images/b7a7abc1117c88099b8d916209671e2606ba080d3d5dfb5a153a413f614f1eae.jpg) +Figure 1: Our world model learns representations that are both temporally consistent and maximize the information about the observations. + +search during action selection (Watter et al., 2015; Banijamali et al., 2018; Chua et al., 2018; Hafner et al., 2019). Another line of work performs decision-time planning without a full world model, relying on value equivalence. In this paradigm, trajectories of the model are required to yield the same cumulative rewards as those in the real environment, regardless of whether the produced hidden states correspond to any real environment states or not (Tamar et al., 2016; Silver et al., 2017; Oh et al., 2017; Schrittwieser et al., 2020; Ye et al., 2021; Hansen et al., 2022). + +In computer vision, self-supervised learning of image representations has made significant progress in recent years (Chen et al., 2020; He et al., 2020; Grill et al., 2020; Caron et al., 2020; Chen & He, 2021; Zbontar et al., 2021; Caron et al., 2021; Bardes et al., 2022). Many approaches are based on Siamese neural networks (Bromley et al., 1993) and can be categorized into contrastive and non-contrastive methods. Contrastive methods (Chen et al., 2020; He et al., 2020) aim to learn representations that are similar for different views (e.g. image augmentations) of the same image but dissimilar for different images to prevent the collapse of representations. Non-contrastive methods do not rely on negative samples. Instead, they prevent representation collapse by the design of the architecture (Grill et al., 2020; Chen & He, 2021) or by regularization of the representations (Zbontar et al., 2021; Bardes et al., 2022). + +Contributions: In this work, we explore simplifying world models while maintaining good performance. Many world models rely on RNNs or transformers to capture long-term dependencies, introducing computational complexity and instability. We focus on problems where short-term dependencies might be sufficient, avoiding sequence models and instead leveraging self-supervised learning, data augmentation, and stacking. Our contributions are as follows: + +- We present SGF, a world model based on a representation learning framework inspired by VICReg (Bardes et al., 2022). While restricting ourselves to simple world models (w/o RNNs and transformers) and choosing simple ingredients, we still have the essential properties of effective world models: maximum information and temporal consistency (Section 2.3). +- We reduce the complexity of world models in terms of both methodology and implementation: SGF does not require image reconstructions or discretization of representations. Besides avoiding sequence models, such as recurrent neural networks or transformers, we also do not use probabilistic predictions for deterministic environments. Instead, we employ simple techniques from model-free reinforcement learning, in particular data augmentation and stacking, which already have been successfully used before (Section 2.2). +- We conduct several ablations and thoroughly discuss the similarities and differences between SGF and other world models that learn in imagination (Sections 4.2 and 5.2). +- We demonstrate that our design choices lead to shorter training times compared to other world models, while achieving good performance on the Atari 100k benchmark (Section 5.1). + +# 2 SIMPLE, GOOD, AND FAST WORLD MODELS + +While being increasingly powerful, model-based approaches have simultaneously grown in complexity and consist of more and more components that need to be adjusted to each other (Hafner et al., 2020; 2021; 2023; Robine et al., 2023; Micheli et al., 2023). After introducing our notation, we aim to distill minimal ingredients and objectives for world models that are easy to implement and computationally efficient. + +# 2.1 PRELIMINARIES AND NOTATION + +We formalize the environment in terms of a partially observable Markov decision process (POMDP) with discrete time steps, rewards $r \in \mathbb{R}$ , image observations $o \in \mathbb{R}^{C \times H \times W}$ , and actions $a \in \mathcal{A}$ which are either discrete or continuous. Transitions within the environment are described by a tuple $(o, a, o', r, e)$ , where $o$ is the current observation, $o'$ is the next observation, and $e \in \{0, 1\}$ indicates terminal states. + +In its simplest form, a world model is a generative model of the dynamics $p(\pmb{o}', r, e \mid \pmb{o}, \pmb{a})$ of a POMDP. Given a policy $\pmb{a} = \pi(\pmb{o})$ , iterative sampling from the world model generates trajectories without further real environment interactions. These trajectories can be used for learning behaviors in imagination (Ha & Schmidhuber, 2018; Hafner et al., 2020), e.g., via model-free RL. + +To increase efficiency, world models should operate in a low-dimensional representation space (commonly known as latent space) as opposed to the high-dimensional observation space (Ha & Schmidhuber, 2018). For this we need two components: a representation model that maps image observations $\pmb{o}$ onto representations $\pmb{y}$ , and a dynamics model that predicts the latent dynamics $p(\pmb{y}', r, e \mid \pmb{y}, \pmb{a})$ . Usually, the policy also operates in the low-dimensional space, i.e., $\pmb{a} = \pi(\pmb{y})$ , enabling behavior learning with high computational efficiency (Ha & Schmidhuber, 2018). + +A common assumption is the conditional independence of $r$ and $e$ given $\pmb{y}$ , $\pmb{a}$ , and $\pmb{y}'$ , which is also employed by previous world models (e.g., Micheli et al., 2023; Hafner et al., 2023). This leads to the following factorization of the latent dynamics + +$$ +p \left(\boldsymbol {y} ^ {\prime}, r, e \mid \boldsymbol {y}, \boldsymbol {a}\right) = p \left(\boldsymbol {y} ^ {\prime} \mid \boldsymbol {y}, \boldsymbol {a}\right) p \left(r \mid \boldsymbol {y}, \boldsymbol {a}, \boldsymbol {y} ^ {\prime}\right) p \left(e \mid \boldsymbol {y}, \boldsymbol {a}, \boldsymbol {y} ^ {\prime}\right), \tag {1} +$$ + +which consists of three conditional distributions: the transition distribution $p(\pmb{y}' \mid \pmb{y}, \pmb{a})$ , which is only conditioned on $\pmb{y}$ and $\pmb{a}$ , the reward distribution $p(r \mid \pmb{y}, \pmb{a}, \pmb{y}')$ and the terminal distribution $p(e \mid \pmb{y}, \pmb{a}, \pmb{y}')$ , both further conditioned on the next representation $\pmb{y}'$ . This is a natural choice for many POMDPs, where most of the complexity of the dynamics is captured by the transition distribution. This allows for learning three separate models rather than modeling the joint distribution. + +# 2.2 INGREDIENTS LEADING TO SIMPLICITY + +Stacking instead of memory. Model-free methods often assume that the observations of an POMDP approximately satisfy the Markov property. This means that the next observation $o'$ (and consequently $y'$ ) is independent of the preceding history of transitions given the current observation $o$ and action $a$ . However, previous works on world models consider non-Markovian observations, which might exhibit long-term dependencies. This is approached by adding a notion of memory to the dynamics model, which can be realized by introducing recurrent states (RNN-based, Ha & Schmidhuber, 2018; Hafner et al., 2020) or by directly conditioning on the history of transitions (attention-based Robine et al., 2023; Micheli et al., 2023). However, the memory is typically a big computational burden and makes the model more complicated. We are asking whether we can omit the memory to obtain a much faster world model. + +To capture short-time dependencies with minimal computational overhead, we suggest to simply use frame and action stacking. Stacking the $m$ most recent frames alleviates the problem of partial observability, e.g., by capturing the velocity of objects in the scene. This is a well-known preprocessing technique in model-free reinforcement learning (Mnih et al., 2015), and has already been applied to world models by Robine et al. (2023). Additionally, stacking the most $m$ recent actions can be beneficial, considering potential delays in the effects of actions. In Section 4.2, we show significant improvements of our world model through action stacking while being computationally cheap. + +Augmentations instead of stochasticity. In deterministic POMDPs, executing a specific action in a specific state consistently yields the same outcomes $o^{\prime}$ , $r$ , and $e$ . However, prior world models are stochastic even in deterministic POMDPs (see Section 5.2). Ha & Schmidhuber (2018) argue that, due to model errors, behaviors learned in imagination may perform poorly in the real environment. They propose that stochastic predictions can reduce the exploitability of an imperfect world model. + +Similarly, we introduce stochasticity through data augmentation, as demonstrated in previous model-free algorithms (Yarats et al., 2021; Laskin et al., 2020a). We investigate whether this helps to improve the robustness of our world model against model errors. In Section 4.2, we demonstrate that data augmentation significantly improves the performance of our world model. + +# 2.3 ESSENTIAL PROPERTIES OF REPRESENTATIONS + +Building meaningful representations of observations is crucial for dynamics modeling and behavior learning. In this work, we argue that representations should possess two key properties: (1) the information about the observations should be maximized, (2) they should be temporally consistent, i.e., representations of two successive observations should be similar. We describe these properties in more detail below. Both properties are already present in other world models (see Section 5.2), however, in this work we try to implement them in a most simple and efficient manner. + +Maximizing information. In latent world models, the representations are used for downstream behavior learning, so any information not encoded in these representations is not accessible to the agent. Therefore, extracting maximum information from observations is necessary for learning optimal behaviors in latent space. This is often realized by reconstructing the input observations (i.e., autoencoder-style), however, this can also be realized by self-supervised objectives, as we show in Section 3. + +Temporal consistency. Temporal consistency can be motivated by predictive coding, where the future or missing information is predicted. Predictive coding has been applied in information theory for data compression (Elias, 1955), and more recently in representation learning (Oord et al., 2018; Henaff et al., 2019). Also, the neuroscience literature suggests that the human brain learns internal representations of incoming sensory signals by minimizing prediction errors subject to particular constraints on the representations, in spatial and temporal domains (Rao & Ballard, 1999; Hosoya et al., 2005; Huang & Rao, 2011). Furthermore, Henaff et al. (2019) proposed the temporal straightening hypothesis which suggests that inside the human brain visual inputs are transformed to follow straighter temporal trajectories, in order to make the stream of visual inputs more predictable. These advantages of temporal consistency for biological agents translate to advantages for agents in reinforcement learning that are based on latent world models: + +- Simpler dynamics prediction: as successive observations are close in representation space, the dynamics model often only needs to predict minor changes and the danger of sudden jumps in representation space is reduced. +- Improved behavior learning: both, the policy and value function benefit from temporally similar representations. This concept can be loosely connected to bisimulation metrics, where "behaviorally similar" states are grouped together (Zhang et al., 2021). Further details are available in Appendix B.1. + +# 3 BUILDING BLOCKS FOR SGF + +Having identified core ingredients, we now describe the construction of a simple, fast, and good world model. We will begin by outlining the representation model of SGF, followed by an description of the dynamics model, implementational details, and our evaluation protocol. For representation learning we draw inspiration from VICReg (Bardes et al., 2022). Further connections to other self-supervised methods are discussed in Appendix B.2. + +# 3.1 LEARNING A WORLD MODEL + +Representation learning. Given a POMDP transition $(\boldsymbol{o}, \boldsymbol{a}, \boldsymbol{o}', r, e)$ , we apply random transformations $t, t' \sim \mathcal{T}$ from a set $\mathcal{T}$ of image augmentations to obtain augmented observations $\tilde{\boldsymbol{o}} = t(\boldsymbol{o})$ and $\tilde{\boldsymbol{o}}' = t'(o')$ . An encoder $f_{\theta}$ computes representations $\tilde{\boldsymbol{y}} = f_{\theta}(\tilde{\boldsymbol{o}})$ and $\tilde{\boldsymbol{y}}' = f_{\theta}(\tilde{\boldsymbol{o}}')$ with $\tilde{\boldsymbol{y}}, \tilde{\boldsymbol{y}}' \in \mathbb{R}^d$ . A projector network $g_{\theta}$ computes embeddings $\tilde{\boldsymbol{z}} = g_{\theta}(\tilde{\boldsymbol{y}})$ and $\tilde{\boldsymbol{z}}' = g_{\theta}(\tilde{\boldsymbol{y}}')$ with $\tilde{\boldsymbol{z}}, \tilde{\boldsymbol{z}}' \in \mathbb{R}^D$ . An action-conditioned predictor network $h_{\theta}$ predicts the next embedding $\tilde{\boldsymbol{z}}' = h_{\theta}(\tilde{\boldsymbol{z}}, a)$ . An illustration can be seen in Figure 1. + +To achieve temporal consistency, we minimize the mean squared error between $\hat{z}^{\prime}$ and $\tilde{z}^{\prime}$ . To maximize the information content, the embeddings are regularized using the variance and covariance regularization terms proposed by Bardes et al. (2022). The total representation loss is summarized by + +$$ +\mathcal {L} _ {\text {R e p r .}} (\theta) = \mathbb {E} _ {\tau} \left[ \underbrace {\frac {\eta}{D} \| h _ {\theta} \left(\tilde {\mathbf {z}}, \mathbf {a}\right) - \tilde {\mathbf {z}} ^ {\prime} \| _ {2} ^ {2}} _ {\text {T e m p o r a l C o n s i s t e n c y}} + \underbrace {\operatorname {V C} \left(\tilde {\mathbf {Z}}\right) + \operatorname {V C} \left(\tilde {\mathbf {Z}} ^ {\prime}\right)} _ {\text {I n f o r m a t i o n M a x i m i z a t i o n}} \right], \tag {2} +$$ + +where $\tau$ is a batch of transitions from a replay buffer, $\tilde{\mathbf{Z}}$ and $\tilde{\mathbf{Z}}^{\prime}$ are batches of embeddings, $\eta >0$ controls the strength of the consistency loss, and VC (variance and covariance) is defined as + +$$ +\operatorname {V C} (\mathbf {Z}) = \frac {1}{D} \sum_ {j = 1} ^ {D} \left[ \underbrace {\rho \max \left(0 , 1 - \sqrt {\operatorname {C o v} (\mathbf {Z}) _ {j , j} + \varepsilon}\right)} _ {\text {V a r i a n c e R e g u l a r i z a t i o n}} + \underbrace {\nu \sum_ {k \neq j} \operatorname {C o v} (\mathbf {Z}) _ {j , k} ^ {2}} _ {\text {C o v a r i a n c e R e g u l a r i z a t i o n}} \right], \tag {3} +$$ + +where $D$ is the dimensionality of the embeddings, $\rho, \nu > 0$ control the strength of variance and covariance regularization terms, respectively, and $\varepsilon = 1 \times 10^{-4}$ prevents numerical instabilities. The goal of the VC terms is to maximize information content and to prevent representation collapse. Variance regularization keeps the standard deviation of each embedding feature across the batch above 1 using a hinge loss. Covariance regularization decorrelates the embedding features by attracting their covariances towards zero (Bardes et al., 2022). + +Dynamics learning. We build a simple dynamics model and rely on the capabilities of temporally consistent representations. Based on the dynamics factorization, we learn a transition distribution $p_{\theta}(\pmb{y}' \mid \pmb{y}, \pmb{a})$ , a reward distribution $p_{\theta}(r \mid \pmb{y}, \pmb{a}, \pmb{y}')$ , and a terminal distribution $p_{\theta}(e \mid \pmb{y}, \pmb{a}, \pmb{y}')$ . In this work, we focus on deterministic prediction, i.e., we simply calculate the means for transitions and rewards, and the mode for terminals (more details on this in Appendix F). Maximum likelihood estimation leads to the total dynamics loss + +$$ +\mathcal {L} _ {\mathrm {D y n .}} (\theta) = \mathbb {E} _ {\tau} \left[ - \underbrace {\log p _ {\theta} \left(\operatorname {s g} \left(\mathbf {y} ^ {\prime}\right) \mid \operatorname {s g} (\mathbf {y}) , \mathbf {a}\right)} _ {\text {T r a n s i t i o n D i s t r i b u t i o n}} - \underbrace {\log p _ {\theta} \left(\mathrm {r} \mid \tilde {\mathbf {y}} , \mathrm {a} , \tilde {\mathbf {y}} ^ {\prime}\right)} _ {\text {R e w a r d D i s t r i b u t i o n}} - \underbrace {\log p _ {\theta} \left(\mathrm {e} \mid \tilde {\mathbf {y}} , \mathrm {a} , \tilde {\mathbf {y}} ^ {\prime}\right)} _ {\text {T e r m i n a l D i s t r i b u t i o n}} \right], \tag {4} +$$ + +where $\mathrm{sg}(\cdot)$ denotes the stop-gradient operator, meaning that the representations are not influenced by the loss of the transition distribution. This is because the transition distribution has moving targets, given that $\pmb{y}'$ originates from the representation model, which changes during training. The rewards and terminals provide stable signals from the POMDP. Note that we learn the transitions with non-augmented observations, i.e., $\pmb{y} = f_{\theta}(\pmb{o})$ and $\pmb{y}' = f_{\theta}(\pmb{o}')$ . + +# 3.2 LEARNING BEHAVIORS IN IMAGINATION + +The representations $\pmb{y}$ serve as inputs to the policy $\pi_{\phi}(\pmb{a} \mid \pmb{y})$ . Through iterative dynamics prediction, batches of representations, actions, rewards, and terminals are generated and used to train the policy. The policy learns to maximize the expected return by performing approximate gradient ascent with the policy gradient (Sutton et al., 1999). To reduce the variance of the gradient estimates, we employ a learned value function $v_{\phi}(\pmb{y})$ as a baseline, resulting in an advantage actor-critic approach (Mnih et al., 2016); the details are explained in Appendix F. The pseudocode outlining our world model and policy training procedure is presented in Algorithm 1. + +# 3.3 EVALUATION PROTOCOL + +We evaluate our world model on the Atari 100k benchmark, which was first proposed by Kaiser et al. (2020) and has been used to evaluate many sample-efficient reinforcement learning methods (Laskin et al., 2020b; Yarats et al., 2021; Schwarzer et al., 2021a; 2023; Micheli et al., 2023; Hafner et al., 2023). It includes a subset of 26 Atari games from the Arcade Learning Environment (Bellemare et al., 2013) and is limited to 400k environment steps, which amounts to 100k steps after frame skipping or 2 hours of human gameplay. Note that all games are deterministic (Machado et al., 2018). + +We perform 10 runs per game and for each run we compute the average score over 100 episodes at the end of training. We follow Micheli et al. (2023) by selecting a random action with $1\%$ probability inside the environment and using a sampling temperature of 0.5 for the policy during evaluation. We also adapt their special handling of Freeway and use a sampling temperature of 0.01 for the policy. + +# 4 EMPIRICAL STUDY + +Behavior learning depends entirely on the quality of the world model. To assess our world model, we first analyze it qualitatively and then show how getting rid of individual design choices results in a degradation of performance. Further analysis and ablations are presented in Appendices C and E. + +# 4.1 INSPECTING THE WORLD MODEL + +To assess whether the learned representations contain relevant information and do not collapse, we train a separate decoder for analysis without affecting the world model's gradients. This allows us to visually interpret the imagined sequences of the world model. In Figure 2 we depict three exemplary sequences, demonstrating that the learned representations contain useful information without relying on image reconstructions. We can also see that the dynamics model can work for long sequences (30 time steps) without accumulating notable model errors, although being only a feedforward model. + +Furthermore, we study the temporal consistency of the learned representations. For that, we generate an episode in Pong following a policy trained with our approach. We then encode the observations and compute two-dimensional t-SNE embeddings (Van der Maaten & Hinton, 2008) of the representations. The result can be seen in Figure 3, and it suggests that subsequent observations have similar + +![](images/d61d1e959d0609e9cfc60ec404983e88fe811fcf8f185d4cb5ef43c39f11ca73.jpg) +Figure 2: Illustration of imagined sequences of length 30. Each frame in the frame stack is converted to grayscale, and pixel changes are visualized in red, green, and blue. From top to bottom: Kung Fu Master, Ms Pacman, and Seaquest. + +![](images/e6926a47ffdbc6b12d67f680e7720b0d935b86fdf7d9271bd7bd4720d55738be.jpg) +Figure 3: Two-dimensional t-SNE embeddings of the learned representations obtained by playing an episode in Pong. We highlight a subsequence of the episode, which starts with a new ball and stops after a point is scored. + +representations and temporally consistency is successfully employed. In Figure 7 we compare the learned embeddings when disabling temporal consistency. + +# 4.2 ABLATING THE WORLD MODEL + +We show empirically how effective the components presented in Section 2 are by performing five ablations. Each ablation is assessed by the performance on five Atari games. The results are illustrated in Figure 4. Numerical results can be found in Table 3. We observe that data augmentation, action stacking, frame stacking, and temporal consistency are crucial: + +1. No augmentations: omitting image augmentations leads to poor performance in all games. +2. No action stacking: stacking only the frames but not the actions decreases the overall performance for all five games. +3. No frame stacking: stacking only the actions but not the frames decreases the performance of all games, with complete failures in Boxing and Breakout. However, Kung Fu Master suffers only a small degradation, possibly because all enemies face the direction they are heading, so their velocity is identifiable from a single frame. +4. No temporal consistency: setting the coefficient $\eta$ to zero leads to a significant decrease in performance for most games except Kung Fu Master. +5. Sample-contrastive: Garrido et al. (2022) show that VICReg can be also seen as a dimension-contrastive method, as opposed to sample-contrastive methods such as SimCLR (Chen et al., 2020). They also show that VICReg can be converted to a sample-contrastive method by transposing the embedding matrix $\mathbf{Z}$ in Equation (3). Making VICReg sample-contrastive significantly worsens the performance in Breakout, but less so in the other games. + +# 5 COMPARISONS + +In this section we compare our method with previous world models regarding the results and the methodology. In Appendix B we discuss the relations to other methods. + +# 5.1 RESULT COMPARISON + +We compare our method with five baselines: the model-free algorithm SPR (Schwarzer et al., 2021a), with updated scores from Agarwal et al. (2021), and the model-based methods EfficientZero (Ye et al., 2021), IRIS (Micheli et al., 2023), and DreamerV3 (Hafner et al., 2023). The mean metric across all games is calculated using human normalized scores (Mnih et al., 2015). + +![](images/448a6c4f45824477c2b80d3b3c2a3188cedee72cadd4c03b463028b527f796fd.jpg) +Figure 4: Ablations of SGF in five games. Human normalized scores, normalized with the maximum value achieved per game. + +![](images/81de16e9c195594ebee958dee96d7ef0216ea42d6bec26619808f52ecfd4ddaf.jpg) +Figure 5: Score and runtime comparison in the Atari 100k benchmark. SPR is model-free, EfficientZero performs lookahead. + +In terms of performance, our simple world model achieves good scores with significantly faster training. Figure 5 shows the scores in relation to runtime. Detailed scores can be found in Table 2 and numerical runtimes can be found in Table 4. Training SGF takes 1.5 hours on a single NVIDIA A100 GPU. Obtaining precise training times for other methods is challenging, as they depend on the GPU. Following Hafner et al. (2023), we approximate runtimes for an NVIDIA V100 GPU, assuming NVIDIA P100 GPUs are twice as slow and NVIDIA A100 GPUs are twice as fast. Notably, SGF's runtime is four times shorter than the runtime of DreamerV3, despite both having the same number of imagination steps (1.5 billion). In Table 5 we provide a breakdown of the runtime for certain components of our method. + +# 5.2 WORLD MODEL COMPARISON + +We also compare the methodologies of SGF and state-of-the-art world models used for learning in imagination: SimPLe (Kaiser et al., 2020), Dreamer (Hafner et al., 2020; 2021; 2023), IRIS (Micheli et al., 2023), TWM (Robine et al., 2023), and the world model developed by Ha & Schmidhuber (2018), referred to as HS. In the Dreamer line of work, our focus is on DreamerV2 and DreamerV3, given their performance improvements over the initial version, notably achieved through the discretization of representations. A summarized comparison of the main differences is provided in Table 1 (we highlight the components in the text). + +Temporal consistency. We enforce successive representations to be similar by the choice of our objective (Consistency). IRIS and HS have no explicit concept of temporal consistency. Dreamer and TWM also seek temporal consistency and attract the representations slightly towards the outputs of the transition predictor from the previous time step. The transition predictor can be interpreted as a time-dependent prior for a variational auto-encoder. An illustration of this difference can be seen in Figure 6. Our approach is simpler for the following reasons: + +- In Dreamer, the training of the representation model and the dynamics model is intertwined. Correctly balancing the representation loss and the dynamics loss is crucial for ensuring stable training. Our representation model learns in isolation, simplifying hyperparameter tuning while still achieving temporal consistency. +- In Dreamer, consistency is imposed directly on the representations, whereas we maximize the similarity of the non-linear embeddings of the representations. In DreamerV3 (Hafner et al., 2023) the consistency loss is clipped when it falls below a certain threshold, considering the similarity as sufficient (aka free bits). Our hypothesis is that maximizing the similarity of the embeddings offers a similar degree of freedom. + +Table 1: Comparison of methodology with other world models used for imagination. DVx denotes DreamerV2 and DreamerV3. Every component results in additional complexity. + +
ComponentHSSimPLeIRISTWMDVxSGF
Augmentationsx
Information Maximizationx
Stackingxx
Consistencyxxx
Reconstructionsxxxxx
Discretizationxxxx
Sequential Dynamicsxxxx
Stochastic Transitionsxxxxx
Pixel Transitionsx
Pixel Dreamsxx
Act with Memoryxxxx
+ +Information extraction. Previous world models depend on pixel-wise image reconstruction for information extraction from observations (Reconstructions). These auto-encoder architectures treat all pixels equally, including less important high-frequency details or noise. In contrast, we adopt a self-supervised objective and utilize data augmentation (Augmentations) to learn representations that maximize information (Information Maximization) and extract relevant features. + +Discretization. Most previous methods learn discrete representations (Discretization): SimPLe discretizes representation values into bits. DreamerV2 (Hafner et al., 2021), DreamerV3 (Hafner et al., 2023), and TWM (Robine et al., 2023) utilize softmax normalization to obtain a stack of independent categorical distributions. IRIS (Micheli et al., 2023) converts each image observation into multiple discrete tokens. Discretization introduces additional complexity and requires techniques such as straight-through gradient estimation (Bengio et al., 2013). We propose two primary factors for the success of discretization in world models and explain how they are addressed in our approach: + +- Discretization significantly limits the information capacity of representations, potentially preventing collapse in auto-encoder architectures (LeCun, 2022). Since our objective already prevents representation collapse, there is no need for discretization on that account. +- Discretization potentially facilitates dynamics prediction by shrinking and stabilizing the support of $p(\pmb{y}' \mid \pmb{y}, \pmb{a})$ . However, we found that a simple architectural choice, specifically adding layer normalization as the final layer of the encoder (as mentioned in Appendix F), is sufficient to keep the mean and variance of the representations stable. Note that another common approach is to normalize the outputs to lie in the interval [0, 1] (Schrittwieser et al., 2020; Schwarzer et al., 2021a). + +Dynamics modeling. As we assume Markovian observations, our approach utilizes a feedforward dynamics model. Prior methods, with the exception of SimPLe, are RNN-based (HS, DreamerV2, DreamerV3) or transformer-based (IRIS, TWM) (Sequential Dynamics). SimPLe operates directly on image observations instead of operating in a low-dimensional representation space (Pixel Transitions). Additionally, our dynamics model is deterministic, whereas previous methods are stochastic (Stochastic Transitions), at least regarding transition prediction, while rewards and terminals typically remain deterministic. + +Behavior learning. Efficient world models, such as ours, usually train a policy based on the low-dimensional representations. However, IRIS decodes the representations back to pixels, slowing down training significantly (Pixel Dreams). Since SimPLe predicts the pixels directly, their policy has to operate on pixels as well. Moreover, previous methods that use a sequence model usually equip the policy with a memory, since the representations encapsulate the history of transitions either via attention or through a compressed recurrent state (Act with Memory). Due to our feedforward dynamics model, our policy is memoryless. + +![](images/c7ad0e530e67e8de79e1df4396055d56c3bdd15f3730eb772fbad14749fa4036.jpg) +(a) SGF (ours) + +![](images/d6011d3257429f2c0ccf88666992ce666bf226ecdc57e17a2e1eee20e59ed9a9.jpg) +(b) Dreamer +Figure 6: High-level illustration of how SGF and Dreamer ensure temporal consistency. The dashed lines denote that two variables are attracted towards each other by a loss function. White nodes indicate inputs, blue nodes indicate representations, and green nodes indicate variables used for representation learning. The red node indicates that Dreamer depends on the dynamics model for representation learning. We omit Dreamer's recurrent states for simplicity. + +Stacking. Previous world models considered in this section only employ the usual preprocessing, e.g., conversion to grayscale or downscaling the observations. Our method applies frame and action stacking (Stacking); TWM applies only frame stacking. + +# 6 LIMITATIONS + +The insights presented in our paper provide a solid foundation for new world models that are simple, good, and fast. For this paper, we limited our method to deterministic MDPs. To also include non-deterministic POMPDs, the transition distribution needs to be stochastic, allowing for the prediction of multiple possible outcomes. The predictor must also be stochastic to account for non-deterministic information between $o$ and $o'$ . Both networks would need to make stochastic predictions, e.g., by modeling the mean and variance of independent normal distributions or using Gaussian mixtures. + +Having avoided sequence models such as RNN and transformers, we did limit ourselves to environments with mainly short-term dependencies, which might be the reason that we did not reach state-of-the-art performance. Future work could replace the MLPs used for the transition, reward, and terminal distributions with a sequence model, requiring some implementation effort and resulting in increased computation time. Since the transition distribution is independent of representation learning, this change would not affect the encoder. We evaluated a preliminary version of this in Appendix E. Another more sophisticated approach would involve using a sequence model for the predictor, which would also affect the features extracted by the encoder. However, this would significantly increase the complexity of the model, which we aimed to avoid. + +Another current limitation of our approach is that VICReg requires the observations to be images. In principle, VICReg could be applied to other modalities if reasonable augmentations are available. We could also combine SGF with other self-supervised learning methods. + +# 7 CONCLUSION + +The starting point of our work are the questions: What are the essential components of world models? How far do we get with world models that are not employing RNNs, transformers, discrete representations, and image reconstructions? We demonstrate that representations learned in a self-supervised fashion using VICReg combined with a action-conditioned predictor network and applied to stacked observations can learn latent representations without resorting to resource-intensive sequence models. Self-supervised learning, coupled with augmentations and frame and action stacking, proves effective in building a good world model. Applying SGF to the Atari 100k benchmark, we attained good results with significantly reduced training times. We advocate for future research in model-based reinforcement learning to focus on sparingly adding new components and analyzing their necessity under varying circumstances. + +# ACKNOWLEDGMENTS + +This research has been funded/supported by the Federal Ministry of Education and research of Germany and the state of North Rhine-Westphalia as part of the Lamarr Institute for Machine Learning and Artificial Intelligence. + +# REFERENCES + +Rishabh Agarwal, Max Schwarzer, Pablo Samuel Castro, Aaron C. Courville, and Marc G. Bellemare. Deep reinforcement learning at the edge of the statistical precipice. In Advances in Neural Information Processing Systems 34: Annual Conference on Neural Information Processing Systems 2021, NeurIPS 2021, December 6-14, 2021, virtual, pp. 29304-29320, 2021. +Lei Jimmy Ba, Jamie Ryan Kiros, and Geoffrey E. Hinton. Layer normalization. CoRR, abs/1607.06450, 2016. +Adrià Puigdomènech Badia, Bilal Piot, Steven Kapturowski, Pablo Sprechmann, Alex Vitvitskyi, Zhaohan Daniel Guo, and Charles Blundell. Agent57: Outperforming the atari human benchmark. In Proceedings of the 37th International Conference on Machine Learning, ICML 2020, 13-18 July 2020, Virtual Event, volume 119 of Proceedings of Machine Learning Research, pp. 507-517. PMLR, 2020. +Ershad Banijamali, Rui Shu, Hung Bui, Ali Ghodsi, et al. Robust locally-linear controllable embedding. In International Conference on Artificial Intelligence and Statistics, pp. 1751-1759. PMLR, 2018. +Adrien Bardes, Jean Ponce, and Yann LeCun. Vicreg: Variance-invariance-covariance regularization for self-supervised learning. In The Tenth International Conference on Learning Representations, ICLR 2022, Virtual Event, April 25-29, 2022. OpenReview.net, 2022. +Marc G. Bellemare, Yavar Naddaf, Joel Veness, and Michael Bowling. The arcade learning environment: An evaluation platform for general agents. J. Artif. Intell. Res., 47:253-279, 2013. doi: 10.1613/jair.3912. +Yoshua Bengio, Nicholas Léonard, and Aaron Courville. Estimating or propagating gradients through stochastic neurons for conditional computation. arXiv preprint arXiv:1308.3432, 2013. +Jane Bromley, Isabelle Guyon, Yann LeCun, Eduard Säckinger, and Roopak Shah. Signature verification using a siamese time delay neural network. In Advances in Neural Information Processing Systems 6, [7th NIPS Conference, Denver, Colorado, USA, 1993], pp. 737-744. Morgan Kaufmann, 1993. +Mathilde Caron, Ishan Misra, Julien Mairal, Priya Goyal, Piotr Bojanowski, and Armand Joulin. Unsupervised learning of visual features by contrasting cluster assignments. In Advances in Neural Information Processing Systems 33: Annual Conference on Neural Information Processing Systems 2020, NeurIPS 2020, December 6-12, 2020, virtual, 2020. +Mathilde Caron, Hugo Touvron, Ishan Misra, Hervé Jégou, Julien Mairal, Piotr Bojanowski, and Armand Joulin. Emerging properties in self-supervised vision transformers. In 2021 IEEE/CVF International Conference on Computer Vision, ICCV 2021, Montreal, QC, Canada, October 10-17, 2021, pp. 9630-9640. IEEE, 2021. doi: 10.1109/ICCV48922.2021.00951. +Ting Chen, Simon Kornblith, Mohammad Norouzi, and Geoffrey E. Hinton. A simple framework for contrastive learning of visual representations. In Proceedings of the 37th International Conference on Machine Learning, ICML 2020, 13-18 July 2020, Virtual Event, volume 119 of Proceedings of Machine Learning Research, pp. 1597-1607. PMLR, 2020. +Xinlei Chen and Kaiming He. Exploring simple siamese representation learning. In IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2021, virtual, June 19-25, 2021, pp. 15750-15758. Computer Vision Foundation / IEEE, 2021. doi: 10.1109/CVPR46437.2021.01549. + +Kurtland Chua, Roberto Calandra, Rowan McAllister, and Sergey Levine. Deep reinforcement learning in a handful of trials using probabilistic dynamics models. Advances in neural information processing systems, 31, 2018. +Peter Elias. Predictive coding-i. IRE transactions on information theory, 1(1):16-24, 1955. +Norman Ferns and Doina Precup. Bisimulation metrics are optimal value functions. In UAI, pp. 210-219, 2014. +Quentin Garrido, Yubei Chen, Adrien Bardes, Laurent Najman, and Yann Lecun. On the duality between contrastive and non-contrastive self-supervised learning. arXiv preprint arXiv:2206.02574, 2022. +Carles Gelada, Saurabh Kumar, Jacob Buckman, Ofir Nachum, and Marc G. Bellemare. Deepmdp: Learning continuous latent space models for representation learning. In Proceedings of the 36th International Conference on Machine Learning, ICML 2019, 9-15 June 2019, Long Beach, California, USA, volume 97 of Proceedings of Machine Learning Research, pp. 2170-2179. PMLR, 2019. +Jean-Bastien Grill, Florian Strub, Florent Alché, Corentin Tallec, Pierre H. Richemond, Elena Buchatskaya, Carl Doersch, Bernardo Ávila Pires, Zhaohan Guo, Mohammad Gheshlaghi Azar, Bilal Piot, Koray Kavukcuoglu, Rémi Munos, and Michal Valko. Bootstrap your own latent - A new approach to self-supervised learning. In Advances in Neural Information Processing Systems 33: Annual Conference on Neural Information Processing Systems 2020, NeurIPS 2020, December 6-12, 2020, virtual, 2020. +David Ha and Jürgen Schmidhuber. Recurrent world models facilitate policy evolution. In Advances in Neural Information Processing Systems 31: Annual Conference on Neural Information Processing Systems 2018, NeurIPS 2018, December 3-8, 2018, Montréal, Canada, pp. 2455-2467, 2018. +Danijar Hafner, Timothy P. Lillicrap, Ian Fischer, Ruben Villegas, David Ha, Honglak Lee, and James Davidson. Learning latent dynamics for planning from pixels. In Proceedings of the 36th International Conference on Machine Learning, ICML 2019, 9-15 June 2019, Long Beach, California, USA, volume 97 of Proceedings of Machine Learning Research, pp. 2555-2565. PMLR, 2019. +Danijar Hafner, Timothy P. Lillicrap, Jimmy Ba, and Mohammad Norouzi. Dream to control: Learning behaviors by latent imagination. In 8th International Conference on Learning Representations, ICLR 2020, Addis Ababa, Ethiopia, April 26-30, 2020. OpenReview.net, 2020. +Danijar Hafner, Timothy P. Lillicrap, Mohammad Norouzi, and Jimmy Ba. Mastering atari with discrete world models. In 9th International Conference on Learning Representations, ICLR 2021, Virtual Event, Austria, May 3-7, 2021. OpenReview.net, 2021. +Danijar Hafner, Jurgis Pasukonis, Jimmy Ba, and Timothy P. Lillicrap. Mastering diverse domains through world models. CoRR, abs/2301.04104, 2023. doi: 10.48550/arXiv.2301.04104. +Nicklas Hansen, Hao Su, and Xiaolong Wang. Temporal difference learning for model predictive control. In International Conference on Machine Learning, ICML 2022, 17-23 July 2022, Baltimore, Maryland, USA, volume 162 of Proceedings of Machine Learning Research, pp. 8387-8406. PMLR, 2022. +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, pp. 770-778, 2016. +Kaiming He, Haoqi Fan, Yuxin Wu, Saining Xie, and Ross B. Girshick. Momentum contrast for unsupervised visual representation learning. In 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition, CVPR 2020, Seattle, WA, USA, June 13-19, 2020, pp. 9726-9735. Computer Vision Foundation / IEEE, 2020. doi: 10.1109/CVPR42600.2020.00975. +Olivier J Henaff, Robbe LT Goris, and Eero P Simoncelli. Perceptual straightening of natural videos. Nature neuroscience, 22(6):984-991, 2019. + +Olivier J. Henaff, Aravind Srinivas, Jeffrey De Fauw, Ali Razavi, Carl Doersch, S. M. Ali Eslami, and Aïron van den Oord. Data-efficient image recognition with contrastive predictive coding. CoRR, abs/1905.09272, 2019. URL http://arxiv.org/abs/1905.09272. +Dan Hendrycks and Kevin Gimpel. Bridging nonlinearities and stochastic regularizers with gaussian error linear units. CoRR, abs/1606.08415, 2016. +Matteo Hessel, Joseph Modayil, Hado van Hasselt, Tom Schaul, Georg Ostrovski, Will Dabney, Dan Horgan, Bilal Piot, Mohammad Gheshlaghi Azar, and David Silver. Rainbow: Combining improvements in deep reinforcement learning. In Proceedings of the Thirty-Second AAAI Conference on Artificial Intelligence, (AAAI-18), the 30th innovative Applications of Artificial Intelligence (IAAI-18), and the 8th AAAI Symposium on Educational Advances in Artificial Intelligence (EAAI-18), New Orleans, Louisiana, USA, February 2-7, 2018, pp. 3215-3222. AAAI Press, 2018. +Toshihiko Hosoya, Stephen A Baccus, and Markus Meister. Dynamic predictive coding by the retina. Nature, 436(7047):71-77, 2005. +Yanping Huang and Rajesh PN Rao. Predictive coding. Wiley Interdisciplinary Reviews: Cognitive Science, 2(5):580-593, 2011. +Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In Proceedings of the 32nd International Conference on Machine Learning, ICML 2015, Lille, France, 6-11 July 2015, volume 37 of JMLR Workshop and Conference Proceedings, pp. 448-456. JMLR.org, 2015. +Lukasz Kaiser, Mohammad Babaeizadeh, Piotr Milos, Blazej Osinski, Roy H. Campbell, Konrad Czechowski, Dumitru Erhan, Chelsea Finn, Piotr Kozakowski, Sergey Levine, Afroz Mohiuddin, Ryan Sepassi, George Tucker, and Henryk Michalewski. Model based reinforcement learning for atari. In 8th International Conference on Learning Representations, ICLR 2020, Addis Ababa, Ethiopia, April 26-30, 2020. OpenReview.net, 2020. +Steven Kapturowski, Victor Campos, Ray Jiang, Nemanja Rakicevic, Hado van Hasselt, Charles Blundell, and Adrià Puigdomènech Badia. Human-level atari 200x faster. In *The Eleventh International Conference on Learning Representations*, ICLR 2023, Kigali, Rwanda, May 1-5, 2023. OpenReview.net, 2023. +Michael Laskin, Kimin Lee, Adam Stooke, Lerrel Pinto, Pieter Abbeel, and Aravind Srinivas. Reinforcement learning with augmented data. In Advances in Neural Information Processing Systems 33: Annual Conference on Neural Information Processing Systems 2020, NeurIPS 2020, December 6-12, 2020, virtual, 2020a. +Michael Laskin, Aravind Srinivas, and Pieter Abbeel. CURL: contrastive unsupervised representations for reinforcement learning. In Proceedings of the 37th International Conference on Machine Learning, ICML 2020, 13-18 July 2020, Virtual Event, volume 119 of Proceedings of Machine Learning Research, pp. 5639-5650. PMLR, 2020b. +Yann LeCun. A path towards autonomous machine intelligence version 0.9.2, 2022-06-27. Open Review, 62(1), 2022. +Alex X Lee, Anusha Nagabandi, Pieter Abbeel, and Sergey Levine. Stochastic latent actor-critic: Deep reinforcement learning with a latent variable model. Advances in Neural Information Processing Systems, 33:741-752, 2020. +Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization. In 7th International Conference on Learning Representations, ICLR 2019, New Orleans, LA, USA, May 6-9, 2019. OpenReview.net, 2019. +Marlos C Machado, Marc G Bellemare, Erik Talvitie, Joel Veness, Matthew Hausknecht, and Michael Bowling. Revisiting the arcade learning environment: Evaluation protocols and open problems for general agents. Journal of Artificial Intelligence Research, 61:523-562, 2018. +Vincent Micheli, Eloi Alonso, and François Fleuret. Transformers are sample-efficient world models. In The Eleventh International Conference on Learning Representations, ICLR 2023, Kigali, Rwanda, May 1-5, 2023. OpenReview.net, 2023. + +Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Andrei A. Rusu, Joel Veness, Marc G. Bellemare, Alex Graves, Martin A. Riedmiller, Andreas Fidjeland, Georg Ostrovski, Stig Petersen, Charles Beattie, Amir Sadik, Ioannis Antonoglou, Helen King, Dharshan Kumaran, Daan Wierstra, Shane Legg, and Demis Hassabis. Human-level control through deep reinforcement learning. Nat., 518(7540):529-533, 2015. doi: 10.1038/nature14236. +Volodymyr Mnih, Adrià Puigdomènech Badia, Mehdi Mirza, Alex Graves, Timothy P. Lillicrap, Tim Harley, David Silver, and Koray Kavukcuoglu. Asynchronous methods for deep reinforcement learning. In Proceedings of the 33nd International Conference on Machine Learning, ICML 2016, New York City, NY, USA, June 19-24, 2016, volume 48 of JMLR Workshop and Conference Proceedings, pp. 1928-1937. JMLR.org, 2016. +Junhyuk Oh, Satinder Singh, and Honglak Lee. Value prediction network. Advances in neural information processing systems, 30, 2017. +Aaron van den Oord, Yazhe Li, and Oriol Vinyals. Representation learning with contrastive predictive coding. arXiv preprint arXiv:1807.03748, 2018. +Rajesh PN Rao and Dana H Ballard. Predictive coding in the visual cortex: a functional interpretation of some extra-classical receptive-field effects. Nature neuroscience, 2(1):79-87, 1999. +Jan Robine, Marc Höftmann, Tobias Uelwer, and Stefan Harmeling. Transformer-based world models are happy with 100k interactions. In *The Eleventh International Conference on Learning Representations*, ICLR 2023, Kigali, Rwanda, May 1-5, 2023. OpenReview.net, 2023. +Julian Schrittwieser, Ioannis Antonoglou, Thomas Hubert, Karen Simonyan, Laurent Sifre, Simon Schmitt, Arthur Guez, Edward Lockhart, Denis Hassabis, Thore Graepel, Timothy P. Lillicrap, and David Silver. Mastering atari, go, chess and shogi by planning with a learned model. Nat., 588 (7839):604-609, 2020. doi: 10.1038/s41586-020-03051-4. +John Schulman, Philipp Moritz, Sergey Levine, Michael I. Jordan, and Pieter Abbeel. High-dimensional continuous control using generalized advantage estimation. In 4th International Conference on Learning Representations, ICLR 2016, San Juan, Puerto Rico, May 2-4, 2016, Conference Track Proceedings, 2016. +John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms. CoRR, abs/1707.06347, 2017. +Max Schwarzer, Ankesh Anand, Rishab Goel, R. Devon Hjelm, Aaron C. Courville, and Philip Bachman. Data-efficient reinforcement learning with self-predictive representations. In 9th International Conference on Learning Representations, ICLR 2021, Virtual Event, Austria, May 3-7, 2021. OpenReview.net, 2021a. +Max Schwarzer, Nitarshan Rajkumar, Michael Noukhovitch, Ankesh Anand, Laurent Charlin, R. Devon Hjelm, Philip Bachman, and Aaron C. Courville. Pretraining representations for data-efficient reinforcement learning. CoRR, abs/2106.04799, 2021b. +Max Schwarzer, Johan Samir Obando-Ceron, Aaron C. Courville, Marc G. Bellemare, Rishabh Agarwal, and Pablo Samuel Castro. Bigger, better, faster: Human-level atari with human-level efficiency. In International Conference on Machine Learning, ICML 2023, 23-29 July 2023, Honolulu, Hawaii, USA, volume 202 of Proceedings of Machine Learning Research, pp. 30365-30380. PMLR, 2023. +David Silver, Hado Hasselt, Matteo Hessel, Tom Schaul, Arthur Guez, Tim Harley, Gabriel Dulac-Arnold, David Reichert, Neil Rabinowitz, Andre Barreto, et al. The predictron: End-to-end learning and planning. In International Conference on Machine Learning, pp. 3191-3199. PMLR, 2017. +Richard S. Sutton. Dyna, an integrated architecture for learning, planning, and reacting. SIGART Bull., 2(4):160-163, 1991. doi: 10.1145/122344.122377. +Richard S. Sutton and Andrew G. Barto. Reinforcement Learning: An Introduction. A Bradford Book, Cambridge, MA, USA, 2018. ISBN 0262039249. + +Richard S. Sutton, David A. McAllester, Satinder Singh, and Yishay Mansour. Policy gradient methods for reinforcement learning with function approximation. In Advances in Neural Information Processing Systems 12, [NIPS Conference, Denver, Colorado, USA, November 29 - December 4, 1999], pp. 1057-1063. The MIT Press, 1999. +Aviv Tamar, Yi Wu, Garrett Thomas, Sergey Levine, and Pieter Abbeel. Value iteration networks. Advances in neural information processing systems, 29, 2016. +Laurens Van der Maaten and Geoffrey Hinton. Visualizing data using t-sne. Journal of machine learning research, 9(11), 2008. +Hado van Hasselt, Matteo Hessel, and John Aslanides. When to use parametric models in reinforcement learning? In Advances in Neural Information Processing Systems 32: Annual Conference on Neural Information Processing Systems 2019, NeurIPS 2019, December 8-14, 2019, Vancouver, BC, Canada, pp. 14322-14333, 2019. +Manuel Watter, Jost Springenberg, Joschka Boedecker, and Martin Riedmiller. Embed to control: A locally linear latent dynamics model for control from raw images. Advances in neural information processing systems, 28, 2015. +Ronald J. Williams and Jing Peng. Function optimization using connectionist reinforcement learning algorithms. Connection Science, 3(3):241-268, 1991. doi: 10.1080/09540099108946587. +Denis Yarats, Ilya Kostrikov, and Rob Fergus. Image augmentation is all you need: Regularizing deep reinforcement learning from pixels. In 9th International Conference on Learning Representations, ICLR 2021, Virtual Event, Austria, May 3-7, 2021. OpenReview.net, 2021. +Weirui Ye, Shaohuai Liu, Thanard Kurutach, Pieter Abbeel, and Yang Gao. Mastering atari games with limited data. In Advances in Neural Information Processing Systems 34: Annual Conference on Neural Information Processing Systems 2021, NeurIPS 2021, December 6-14, 2021, virtual, pp. 25476-25488, 2021. +Jure Zbontar, Li Jing, Ishan Misra, Yann LeCun, and Stephane Deny. Barlow twins: Self-supervised learning via redundancy reduction. In 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. 12310-12320. PMLR, 2021. +Amy Zhang, Rowan Thomas McAllister, Roberto Calandra, Yarin Gal, and Sergey Levine. Learning invariant representations for reinforcement learning without reconstruction. In 9th International Conference on Learning Representations, ICLR 2021, Virtual Event, Austria, May 3-7, 2021. OpenReview.net, 2021. + +# A ETHICS STATEMENT + +The advancements in developing Simple, Good, and Fast (SGF) world models for reinforcement learning can significantly enhance various fields by making advanced techniques more accessible and reducing computational demands. While this democratization can drive innovation in areas like robotics and autonomous systems, it also raises ethical concerns, such as potential misuse in surveillance or autonomous weaponry. Therefore, it is crucial for the research community to address these risks and develop guidelines to ensure responsible use. + +# B RELATIONS TO OTHER METHODS + +# B.1 RECONSTRUCTION-FREE MODELS + +Previous world models learning in imagination rely on image reconstructions. However, there are other approaches that learn a model without relying on image reconstructions, which we will discuss in this section. + +Value equivalence. In the value equivalence paradigm, trajectories of the model must achieve the same cumulative rewards as those in the real environment, regardless of whether the produced hidden states correspond to any real environment states or not. These models are used for decision-time planning. For instance, MuZero (Schrittwieser et al., 2020) trains a model with hidden states by predicting the policy, the value function, and the reward. EfficientZero (Ye et al., 2021) extends this objective by introducing a self-supervised consistency loss with a projector and a predictor network, which shares similarities with our temporal consistency loss. However, they predict the next representation before feeding it into the projector, rather than employing an action-conditioned predictor. Additionally, their approach bears more resemblance to SimSiam (Chen & He, 2021), as they utilize the stop-gradient operation and lack explicit information maximization. + +Auxiliary tasks and bisimulation metrics. Learning a model as an auxiliary task can improve the representations of the model-free agent. Although these approaches only share a loose connection to generative world models, they typically are reconstruction-free. For instance, SPR (Schwarzer et al., 2021a) learns a transition model to predict the latent states of future time steps using a projector and a predictor network, incorporating data augmentation. Their architecture shares similarities with ours, however, their transition model is convolutional, and they predict the next representation before feeding it into the projector (similar to EfficientZero). Moreover, their methodology is influenced by BYOL (Grill et al., 2020), utilizing a momentum encoder and lacking explicit information maximization. SPI (Schwarzer et al., 2021b) combines SPR with goal-conditioned RL and inverse dynamics modelling, i.e., predicting the action $a_{t}$ from states $s_t$ and $s_{t + 1}$ . They pretrain an encoder on unlabelled data, which is later finetuned on task-specific data. + +A special type of auxiliary tasks are connected to bisimulation metrics, where "behaviorally similar" states are grouped together (Ferns & Precup, 2014). Similar to our approach, this also amounts to learning a reward model and a (distributional) latent transition model (by minimizing the Wasserstein distance). Prominent works include DeepMDP (Gelada et al., 2019), which still requires reconstructions for good results on Atari, and DBC (Zhang et al., 2021). + +# B.2 SELF-SUPERVISED REPRESENTATION LEARNING + +Our self-supervised representation learning framework is similar to existing visual representation learning methods. We describe the differences to the most related works. Note that a common difference is our architecture, as we employ layer normalization instead of batch normalization (Ioffe & Szegedy, 2015), SiLU instead of ReLU nonlinearities, and no ResNet-based encoder (He et al., 2016). + +Relation to VICReg (Bardes et al., 2022). Our work is greatly inspired by VICReg, which is used to learn representations of (stationary) images. Originally, the same image is augmented and fed into both branches of the Siamese neural network. We augment two successive image observations, so the two branches get different inputs, which are nonetheless related. Furthermore, VICReg maximizes + +the similarity between the embeddings $z$ and $z'$ directly, whereas we integrate an action-conditioned predictor network, since the observations $o$ and $o'$ might have a more complicated connection. + +Relation to BYOL (Grill et al., 2020) and SimSiam (Chen & He, 2021). The basis of our self-supervised learning setup is a combination of ideas from VICReg and BYOL. Specifically, we adopt the predictor network concept from BYOL but utilize the regularization terms from VICReg, omitting BYOL's momentum encoder. Additionally, our predictor network is action-conditioned. Similarly, our method is related to SimSiam (Chen & He, 2021), which also employs a predictor network, but we do not need the stop-gradient operation. + +From a practical perspective, these methods could likely achieve comparable performance with appropriate hyperparameter tuning. However, our decision to use VICReg was motivated by its conceptual advantages, which we believe make it particularly suitable for our framework: Specifically, VICReg offers two key advantages over BYOL and SimSiam. First, it avoids the need for additional target networks updated through moving averages (as in BYOL). Second, VICReg has a more established theoretical foundation for its loss functions, leveraging variance and covariance regularization to prevent representation collapse. In contrast, BYOL and SimSiam rely on mechanisms like target networks or stop-gradient operations, which are more heuristic in nature. + +# B.3 MODEL-FREE DATA AUGMENTATION + +Our method is model-based, but there are model-free methods that also use data augmentation. Laskin et al. (2020a) also use data augmentation to increase the sample efficiency, but by augmenting the image observations passed to the model-free agent. Yarats et al. (2021) additionally regularize the value function such that it is invariant to the augmentations. + +# C ADDITIONAL ANALYSIS + +![](images/98be14cfa7057a55bff4c6701806e6772317d461355ec08c3af9540d9152a88c.jpg) +(a) With temporal consistency. + +![](images/2a231b96dc8b933ba26a7ef79983a7d9af72ddbd4c48b9d7acaca3e3299c8756.jpg) +(b) Without temporal consistency. + +![](images/9dd24b0553fd88cc7009668cba6c3352e1a5d4536a3e8714e0c8eec5d9618ac1.jpg) +Figure 7: Comparison of two-dimensional t-SNE embeddings of the learned representations with and without temporal consistency. When only maximizing information, the representations are arranged in Gaussian blobs, which are harder to predict. We show the representations of one episode in Pong. + +![](images/a3eb4a35ad66ad1297f1017f808f0efc87927979771278ec5493f8f36beba3c8.jpg) +(a) Top- $k$ accuracies of the reconstructions for different values of $k$ . The accuracy is determined by first encoding and reconstructing an observation, then computing the MSE between the reconstruction and all ground truth observations in the replay buffer, and finally testing whether the input observation is among the $k$ -nearest neighbors. We calculate the mean over a batch of 512 observations. Note that the observations in the replay buffer can be very similar or even identical, so the top-1 accuracy is not as expressive as top-5 and top-10. +(b) Reconstruction loss of the decoder. +Figure 8: Additional analysis of the decoder from Section 4.1. We start training after collecting 5000 environment steps. + +# D DETAILED RESULTS + +Table 2: Comparison with other methods on the Atari100k benchmark. Averaged over 10 seeds. + +
GameRandomHumanModel-free SPRLookahead Eff. ZeroLearning in imagination
IRISDreamerV3SGF(std. dev.)
Alien227.87127.7841.9808.5420.0959518.8(116.7)
Amidar5.81719.5179.7148.6143.013962.7(19.4)
Assault222.4742.0565.61263.11524.4706850.1(250.3)
Asterix210.08503.3962.525557.8853.6932802.5(317.5)
Bank Heist14.2753.1345.4351.053.164958.7(38.9)
Battle Zone2360.037187.514834.113871.213074.0122503747.0(1240.3)
Boxing0.112.135.752.770.17883.4(10.7)
Breakout1.730.519.6414.183.73150.7(37.6)
Chopper Cmd.811.07387.8946.31117.31565.04201775.4(593.9)
Crazy Climber10780.535829.436700.583940.259324.29719015751.3(5488.9)
Demon Attack152.11971.0517.613003.92034.43032809.5(749.2)
Freeway0.029.619.321.831.1011.9(4.7)
Frostbite65.24334.71170.7296.3259.1909265.6(8.6)
Gopher257.62412.5660.63260.32236.13730416.4(133.7)
Hero1027.030826.45858.69315.97037.4111611522.9(1513.1)
James Bond29.0302.8366.5517.0462.7445280.9(60.9)
Kangaroo52.03035.03617.4724.1838.24098271.2(298.0)
Krull1598.02665.53681.65663.36616.477827813.7(1598.0)
Kung Fu Master258.522736.314783.230944.821759.82142020169.8(8206.7)
Ms Pacman307.36951.61318.41281.2999.113271356.8(775.8)
Pong-20.714.6-5.420.114.61812.6(10.0)
Private Eye24.969571.386.096.7100.0882405.5(1144.3)
Qbert163.913455.0866.313781.9745.73405685.0(68.3)
Road Runner11.57845.012213.117751.39614.6155658164.2(4066.8)
Seaquest68.442054.7558.11100.2661.3618476.8(88.7)
Up n' Down533.411693.210859.217264.23546.2N/A7745.0(8515.7)
Normalized mean0.0001.0000.6161.9431.0461.120.884
Normalized median0.0001.0000.3961.0900.2890.490.152
+ +Table 3: Mean scores for the ablation studies. + +
AblationBoxingBreakoutKung Fu MasterMs PacmanPong
SGF (default)83.450.720169.81356.812.6
No augmentations1.69.16031.4847.6-20.6
No action stacking63.322.911981.2651.4-3.1
No frame stacking12.18.217833.2708.43.2
No temporal consistency0.06.417008.8754.3-20.6
Sample-contrastive77.425.119237.21162.66.4
+ +Table 4: Total training times of various methods on the Atari 100k benchmark. They are approximated for an NVIDIA V100 GPU. + +
MethodRuntime (hours)
SPR2.3
SGF (ours)3
DreamerV312
TWM20
EfficientZero29
IRIS168
SimPLE240
+ +Table 5: Detailed time breakdown. Percentages in the lower half are relative to the default setting, obtained by enabling or disabling components. + +
ComponentPercentage
Total training100 %
World model training63 %
Policy training37 %
- No augmentations-16 %
- No action stacking-0.1 %
- No frame stacking-0.1 %
+ With decoder+19 %
+ +# E ADDITIONAL ABLATIONS + +Table 6: Mean scores for additional ablation studies. + +
AblationBoxingBreakoutKung Fu MasterMs PacmanPong
SGF83.942.222626.21134.014.8
Projectile × 479.123.722481.41176.16.7
Transition × 482.927.123779.41208.713.5
Actor/critic × 477.929.717627.8787.51.7
Horizon = 1557.930.921579.4978.1-0.4
Training × 464.129.014035.8572.413.3
Stack size = 868.121.819171.21154.711.5
Stack size = 1235.314.416423.61042.812.6
Recurrent transition71.711.818639.41105.513
Recurrent predictors87.89.416086.21032.110.5
+ +In this section we provide additional ablation studies to analyze the effect of increasing the model size and training time. The results are shown in Table 6. We evaluated these additional ablation studies on 5 instead of 10 random seeds. We observe that the default configuration of SGF performs best in most cases. The ablations are as follows: + +1. **Projector $\times 4$ :** We increase the hidden dimension of the projector network from 2048 to 8192. This increases the number of parameters of this network from 9.5M to 88M. +2. Transition $\times 4$ : We increase the hidden dimension of the transition network from 1024 to 4096. This increases the number of parameters of this network from 5.2M to 71.3M. +3. Actor/critic $\times 4$ : We increase the hidden dimension of the actor and critic networks from 512 to 2048. This increases the total number of parameters of the agent from 0.5M to 8.4M. +4. Horizon $= 15$ : We increase the imagination horizon $H$ from 10 to 15 steps, and reduce the imagination batch size to 2048 to keep the effective batch size constant. +5. Training $\times 4$ : We train the world model and the agent with two batches per environment step instead of one batch every second step. This effectively multiplies the training time by four and is similar to the training time of DreamerV3. +6. Stack size $= 8$ : We stack 8 frames and actions instead of 4. +7. Stack size $= 12$ : We stack 12 frames and actions instead of 4. +8. Recurrent transition: We incorporate a recurrent layer (LSTM) into the transition network, placing it after the five hidden linear layers and before the final output layer. This requires several changes in the implementation, since the recurrent states must be maintained and passed between steps. +9. Recurrent predictors: We make the transition, reward, and terminal distributions recurrent by introducing a shared three-layer MLP followed by an LSTM layer. The output of the LSTM is then fed into a two-layer transition head, as well as the reward and terminal networks. + +# F IMPLEMENTATION DETAILS + +Implementing a world model involves numerous design choices, many of which may seem arbitrary at the first glance or are obscured in the source code. In the following, we explain all of our implementation details. + +Stacking and preprocessing. As detailed in Section 2.2, we stack the $m$ most recent observations and actions, with $m = 4$ . Frame stacking also plays a role in our representation learning approach, with observations $o$ and $o'$ sharing information from three subsequent frames. For data augmentation, we apply the transformations proposed for Atari by Yarats et al. (2021), i.e., random shifts and imagewise intensity jittering. + +Distributions. We model the transition distribution using independent normal distributions with unit variance, i.e., $p_{\theta}(\pmb{y}' \mid \pmb{y}, \pmb{a}) = \mathcal{N}(\pmb{y}' \mid \mu_{\theta}(\pmb{y}, \pmb{a}), \pmb{I}_d)$ , where $\mu_{\theta}$ is a neural network computing the mean vector. We chose this distribution since the loss function reduces to minimizing the mean squared error $\frac{1}{2} \| \mu_{\theta}(\pmb{y}, \pmb{a}) - \pmb{y}' \|_2^2$ . Also, the mean that we use for prediction is available without further computation. We model the reward distribution $p_{\theta}(r \mid \pmb{y}, \pmb{a}, \pmb{y}')$ using discrete regression with two-hot encoded targets and symlog predictions, as recently proposed by Hafner et al. (2023). Although not yet being a widely used approach, it makes reward prediction stable across different scales without the need for domain-specific reward normalization or hyperparameter tuning. We model the terminal distribution using a Bernoulli distribution, i.e., $p_{\theta}(e \mid \pmb{y}, \pmb{a}, \pmb{y}') = \text{Bernoulli}(e \mid \sigma_{\theta}(\pmb{y}, \pmb{a}, \pmb{y}'))$ , where $\sigma_{\theta}$ is a neural network computing the terminal probability. We chose this distribution since it is a common choice for distributions with binary support; the loss function reduces to the binary cross-entropy, and the mode can be computed by $[\sigma_{\theta}(\pmb{y}, \pmb{a}, \pmb{y}') \geq 0.5]$ with the squared brackets being Iverson brackets. + +Architecture. All networks use SiLU nonlinearities (Hendrycks & Gimpel, 2016) to prevent dead ReLUs, especially given that the data is coming from an ever-changing replay buffer. Furthermore, we employ layer normalization (Ba et al., 2016) in all networks. The encoder $f_{\theta}$ consists of four convolutional layers with a kernel size of 4, stride of 2, and padding size of 1, followed by a linear layer that computes representations of dimension $d = 512$ . To stabilize training, the representations are also normalized using layer normalization; refer to Section 5.2 for our motivation. The projector network is an MLP with two hidden layers of dimension 2048, computing embeddings of dimension $D = 2048$ ; these dimension have been proven to strike a good balance between qualitative performance and architecture size for VICReg (Garrido et al., 2022). The predictor network uses the same architecture as the projector network. The network of the transition distribution is an MLP with five hidden layers of dimension 1024, and a residual connection from the input to the output. The networks of the reward distribution, terminal distribution, policy, and value function are MLPs with two hidden layers of dimension 1024. We use the AdamW optimizer (Loshchilov & Hutter, 2019) for all networks and loss functions. + +Actor-critic. We estimate advantages using generalized advantage estimation (Schulman et al., 2016) and calculate multi-step truncated $\lambda$ -returns (Sutton & Barto, 2018) as the target for the value function. To improve exploration and prevent early convergence to suboptimal policies, we add the entropy of the policy to the objective (Williams & Peng, 1991; Mnih et al., 2016). Additionally, we adopt the following strategies from DreamerV3 (Hafner et al., 2023), which have demonstrated success across various environments and reward scales without domain-specific fine-tuning. For advantage computation, the returns are normalized by mapping the $5^{\text{th}}$ and the $95^{\text{th}}$ percentile to 0 and 1, respectively. The value function utilizes the same discrete regression approach as the reward predictor, i.e., two-hot encoded targets and symlog predictions. A target network, which is the exponential moving average of the online value network, computes additional targets for the value function. This allows for estimating returns using the online network instead of the target network. + +Algorithm 1: SGF's main training procedure. +Input: environment $\mathcal{E}$ environment steps $M$ ,imagination horizon $H$ initialize replay buffer $\mathcal{D}$ +initialize networks of the world model and the policy +for $i\in \{1,\dots ,M\}$ do execute action in $\mathcal{E}$ according to policy $\pi_{\phi}$ store observed transition in $\mathcal{D}$ #all following computations are batch-wise if world model update then sample batch of transitions $\tau \sim \mathcal{D}$ estimate $\mathcal{L}_{\mathrm{Repr.}}(\theta)$ and $\mathcal{L}_{\mathrm{Dyn.}}(\theta)$ according to (2), (4) update $\theta$ to minimize the losses if policy update then #sample from arbitrary time steps sample batch of observations $O\sim \mathcal{D}$ encode observations $\mathbf{Y}_1 = f_\theta (\mathbf{O})$ for $t\in \{1,\ldots ,H\}$ do select actions $A_{t}\sim \pi_{\phi}(A_{t}|\mathbf{Y}_{t})$ predict $\mathbf{Y}_{t + 1}\sim p_{\theta}(\mathbf{Y}_{t + 1}|\mathbf{Y}_{t},\mathbf{A}_{t})$ predict $r_{t + 1}\sim p_{\theta}(r_{t + 1}|\mathbf{Y}_{t},\mathbf{A}_{t},\mathbf{Y}_{t + 1})$ predict $e_{t + 1}\sim p_{\theta}(e_{t + 1}|\mathbf{Y}_{t},\mathbf{A}_{t},\mathbf{Y}_{t + 1})$ update $\phi$ actor-critic style using trajectories + +Table 7: Summary of all hyperparameters. Note that we use the original coefficients for VICReg. + +
HyperparameterSymbolValue
Dimensionality of yd512
Dimensionality of zD2048
Consistency coefficientη12.5
Covariance coefficientρ1.0
Variance coefficientν25.0
Frame resolution-64 × 64
Grayscale frames-No
Terminal on loss of life-Yes
Frame and action stackingm4
Random shifts-0–3 pixels
Discount factorγ0.997
λ-return parameterλ0.95
Entropy coefficient-1 × 10-3
Target network decay-0.98
World model training interval-Every 2nd environment step
Policy training interval-Every 2nd environment step
Environment stepsM100000
Initial random steps-5000
World model batch size-1024
World model learning rate-6 × 10-4
World model warmup steps-5000
World model weight decay-1 × 10-3
World model gradient clipping-10.0
Imagination batch size-3072
Imagination horizonH10
Actor-critic learning rate-2.4 × 10-4
Actor-critic gradient clipping-100.0
Policy temperature for evaluation-0.5 (0.01 for Freeway)
Random actions during collection-1%
\ No newline at end of file diff --git a/ICLR/2025/Simple, Good, Fast_ Self-Supervised World Models Free of Baggage/images.zip b/ICLR/2025/Simple, Good, Fast_ Self-Supervised World Models Free of Baggage/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..fef12f858250e637e2408886c52a0749c31d26fc --- /dev/null +++ b/ICLR/2025/Simple, Good, Fast_ Self-Supervised World Models Free of Baggage/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2888f13244af28ee825b3f7237de65dece605b2e38649d0b9452242d049fb097 +size 761304 diff --git a/ICLR/2025/Simple, Good, Fast_ Self-Supervised World Models Free of Baggage/layout.json b/ICLR/2025/Simple, Good, Fast_ Self-Supervised World Models Free of Baggage/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..44dd4dcae3450eecaa5ee3d70c498e6b5a770780 --- /dev/null +++ b/ICLR/2025/Simple, Good, Fast_ Self-Supervised World Models Free of Baggage/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:621b8084136e833ccb38eb4e95ae894fd3a230223fb4ff754270339d10bcf739 +size 566139